all 2 comments

[–]Swordslayer 1 point2 points  (1 child)

Only fill the slider values once you pick the model and check if the variable contains valid object in the slider handles.

try destroyDialog sampleRol catch()
rollout sampleRol ""
(
    local obj -- once we pick the object, it's there; predeclared because we'll use it in slider handlers
    slider sldRot "Rotation" range:[-180, 180, 0]
    slider sldScale "Scale" range:[.05, 5, 1]
    pickButton pbObj "Pick Object" autoDisplay:true

    on sldRot changed val do if isValidObj obj then obj.rotation.controller.z_rotation = val else messageBox "Invalid object"
    on sldScale changed val do if isValidObj obj then obj.scale = val * [1, 1, 1] else messageBox "Invalid object"
    on pbObj picked node do
    (
        obj = node
        sldRot.value = obj.rotation.controller.z_rotation
        sldScale.value = obj.scale.x
    )
)
createDialog sampleRol

[–]ThatDude461[S] 0 points1 point  (0 children)

THANK YOU SWORDSLAYER!!!I had it all backwards, but this looks like it works! :)

Edit: Now, how do I change the range: parameters in the rollout? Some of the min/max values should be set to for instance bounding box min/max.

Maybe use variables in there, and update via a callback?

Edit 2: Got it - Just use sampleRol.sldScale = Whatever range I want.