Notifications
Clear all

[Closed] Simple Script

 wsz

Simple Script

i 1 ° weeks studying the part of the scripts 3ds max hehe

i made the following script:

[color=Red]if $Slider01.value>0 then
(
$Box01.modifiers[#Bend].BendAngle =45
)
else
(
$Box01.modifiers[#Bend].BendAngle =0
)
[/color]

he works, but whenever $ Slider01.value> 0 “true” or $ Slider01.value = 0 “false” I have to press Evaluate All (Ctrl + E), is not automatic updating.

who knows why this happens?

i am starting to learn ok.

11 Replies

scripts are not automatically updated on scene or time changes… you would have to place the script either in…

  • a change handler
  • a callback
  • a scripted controller

If you search for any of the above terms in the help file, you should get some hits.

A scripted controller is the easiest way to do this because…

  • it’s in a reasonably easy to use interface, without having to manually code change handlers and callbacks
  • it automatically updates when the time changes (including while rendering)*
  • it can automatically update when you change the Slider manipulator’s value, as long as you specify in the script controller that it depends on that object’s value.
  • it automatically saves with the scene.

[size=1]( * as long as it’s not in a custom attributes block; has to be on an existing controller )
[/size]

sample file (3ds Max 2008) + screenshot attached

Disagree, the easiest way is to set the event handler which is specifically made for the change of values on the spinners/sliders:
Sph = sphere()
rollout New “New”
(
slider Slider01 “This is the slider” orient:#horizontal range:[-30,30,0] ticks:0
on Slider01 changed val do
(
Sph.pos.x = Slider01.value
)
)
createdialog New

1 Reply
(@zeboxx2)
Joined: 11 months ago

Posts: 0

Except they were using a Slider manipulator object (an in-viewport helper), and not an UI slider

UI Sliders suffer from much the same problems I mentioned before anyway…

  • you can’t animate them directly
    – if you want to animate them, you’ll have to associate a controller with them
  • they don’t save with the scene
  • once they’re animated (via the controller), the event callback for the UI slider itself will still not automatically be called.
  • and probably more
 wsz

ZeBoxx2

As you did, I could also, but I was wanting the other way, to achieve control the change between:

$IK Chain01.transform.controller.autoEnable = on/off

Painel Motion>Ik Solver>Enable>“CheckBox” Ik for Fk Pose

But even so very much, your help me reinforces the possibilities.

Dimich

I will try anything as your example.

My questions are very simple, sometimes I think that it’s my lack of thinking a little more.

For example, that your script, I could not in any way apply it to an object, in my case, the Ik?

Since starting the value of a Slider, 0 or 1, I change between on and off in the options:
$IK Chain01.transform.controller.autoEnable = on/off *

0—->off
1—->on

  • I found this property using the Macro Recorder.

i’m studying the Help of 3dsMax some examples on the internet, i am not only asking.

otherwise, o would not have such doubts.

Thank you!

on/off and true/false are booleanClass commands. So make sure your slider isn’t using decimal places, only integers, it should either be 0 or 1, since there are no values between on and off. Then you could simply do some scripting or wiring to get the results you want.

Hope that helps some,
-Eric

Here you go, this should do the trick.[b][b]

rollout New “New”
(
slider Slider01 “This is the slider” orient:#horizontal range:[0,1,0] ticks:0
on Slider01 changed val do
(
if Slider01.value == 1 then $IK_Chain01.transform.controller.autoEnable = on
else [/b][/b]$IK_Chain01.transform.controller.autoEnable = off
)
)
createdialog New

 wsz

Thank you Dimich!

With that I will try to implement in a Slider Object as ZeBoxx2 said.

Goodbye!

Ah, ok, gues I missed the fact that it was the slider object:) Yea, in this case you do need to use the Script controller as you described earlier, ZeBoxx2. My mistake for not seeing this. And the UI sliders ARE a pain in the ass, but then again, the object sliders are a pain as well. you need to actually turn on the select and manipulate first before you will be able to use it. I had to create a callback to be triggered when those were used so that animators can directly select the sliders and work with them. Incredibly annoying.

hear, hear… that seriously hampers their full potential… having to enter a special mode before being able to use kills the expected workflow

Page 1 / 2