hey guys i'm currently working on a simple max script tool for my scripting class, and i 've ran into a problem.
i'm trying to run this command:
"render outputSize: [xWidth,xHeight]"
as you can see in the code below it takes the values inputted be the spinner and does a simple math formula. Then it should render ...but it doesn't
currently on the "25% Button" has the render code in it.
you can download the file from here:
http://www.filedropper.com/hitenmistry1
"/*
Mistry
Render Tools
This tool lets the user choice from 4 different render percents and can manully input the
width and height of the render directly into the dialog
*/
try(destroyDialog myToolUIR)catch()
rollout myToolUIR "RenderTools"
(
group "Size"
(
--renderWidth
spinner myrenderWidth "Width"
--renderHeight
spinner myrenderHeight "Height"
)
group "Render"
(
--25%
button my25Bt "25%"
--50%
button my50Bt "50%"
--75%
button my75Bt "75%"
--100%
button my100Bt "100%"
)
group "Percent"
(
--Percent
spinner myPercentSp "Percent:" feildWidth: 100 \
type:#integer range: [5,100,5]
)
--25% Button
on my25Bt pressed do
(
--Converts spinner values
.25 * myrenderWidth.value= xWidth
.25 * myrenderHeight.value= xHeight
render outputSize: [xWidth,xHeight]
--outputwidth: xWidth
--outputheight: xHeight
render()
)
--50% Button
on my50Bt pressed do
(
-- .50 * myrenderWidth= xWidth
-- .50 * myrenderHeight= xHeight
--outputwidth: <xWidth>
--outputheight: <xHeight>
--render()
)
--75% Button
on my75Bt pressed do
(
-- .75 * myrenderWidth= xWidth
-- .75 * myrenderHeight= xHeight
--outputwidth: <xWidth>
--outputheight: <xHeight>
--render()
)
--100% Button
on my100Bt pressed do
(
-- myrenderWidth= xWidth
-- myrenderHeight= xHeight
--outputwidth: <xWidth>
--outputheight: <xHeight>
--render()
)
--outputwidth: <number>
--outputheight: <number>
--render
--render()
)
createDialog myToolUIR
"
Replies
Fourth, it is never too early to teach good code design:
You can simplify your entire script by placing this function below your rollout controls and above the event handlers:
And then all of your event handlers look like this: etc.