[Closed] How do you make CA's GUI controls' controllers to stay?
Hi everyone,
I’ve been puzzling myself over this issue and I seem to be lost for now.
I’m adding a CA def on a standard Empty Attribute holder and I’m using simple UI controls (sliders, spinners) on it, however, when I define the UI and I assign a controller to the UI’s control’s controller, as soon as I deselect the object with the CA DEF on, the controller link gets lost.
I have no friggin idea why that is and how to avoid it. But creating a UI control with a default controller fails, so, I really don’t know.
Here’s the simple CA DEF:
def = attributes "Body"
(
parameters main rollout:params
(
bodyScale type:#float ui:sldrHBS default:1.0
)
rollout params "Hanuman Controls"
(
group "Hanuman Scale"
(
-- BODY --
slider sldrHBS "Body Scale" range:[1.0,10.0,1.0] type:#float ticks:10 width:97 orient:#horizontal align:#left across:2
spinner spnHBS range:[1.0,10.0,1.0] type:#float scale:.1 fieldWidth:35 align:#right offset:[0,25]
)
)
)
Now, as soon as the CA DEF is created and added to the empty Attribute Holder modifier, I assign the slider and the spinner the same controller, so that they’re linked together:
$obj.modifiers[1].Body.params.sldrHBS.controller = <some controller on another object>
$obj.modifiers[1].Body.params.spnHBS.controller = $obj.modifiers[1].Body.params.sldrHBS.controller
Everything works just fine, until I deselect the object the CA def is stored on. Then, suddently, all the links among the controllers dissappear.
I’ve searched web, obviously the documentation, but I haven’t found a solution to this issue. It almost seems like a bug in 3ds Max.
By the way, I’m on 3ds Max 2009 x64, if it makes any difference.
Thanks a lot in advance, cheers,
- Lukas
Oks, got it working.
In case anybody bumped into the same issue, all I had to do was to assign a default controller to the slider, spinner etc… and then instantiate that controller elsewhere.
So, in my case, I changed the CA DEF to:
def = attributes "Body"
(
parameters main rollout:params
(
bodyScale type:#float ui:sldrHBS default:1.0
)
rollout params "Hanuman Controls"
(
group "Hanuman Scale"
(
-- BODY --
slider sldrHBS "Body Scale" range:[1.0,10.0,1.0] type:#float ticks:10 width:97 orient:#horizontal align:#left across:2 controller:(Bezier_Float())
spinner spnHBS range:[1.0,10.0,1.0] type:#float scale:.1 fieldWidth:35 align:#right offset:[0,25] controller:this.params.sldrHBS.controller
)
)
)
Then I accessed the controller via:
$obj.modifiers[1].Body.bodyScale.controller
Which I can then instantiate onto other objects I needed to control.
What a pain. But at least it works.