PDA

View Full Version : checkbutton initial state?


fael097
11-10-2010, 04:40 PM
ehh, me again
while i cant figure out how to make the node thing work, let me ask another thing:
i have an attribute holder in a spline, with a checkbutton to hide/show another object , in this case box001. heres the script:


ca=CustAttributes.getDef $.modifiers[1].Controls
LM=$box001
attributes controls
redefine:ca
(
rollout cbt "Check"
(
checkButton chbtHideMe "Hide Me"

on chbtHideMe changed theState do
(
case TheState of
(
true:
(
LM.isHidden = true
)
false:
(
LM.isHidden = false
)
)
)
)
)

--custAttributes.add $.modifiers[1] ca

it works, but if i check the button, deselect the object, and select again, button will be unchecked. how to make an initial state for it? for (lame) example, "if box001 ishidden=true, button=checked"

thanks

lo
11-10-2010, 06:27 PM
on cbt open do
(
chbtHideMe.checked = ($whatever.property == whatever)
)

fael097
11-11-2010, 09:43 AM
alright, worked for that case, but how about lets say when i wired smooth iterations toa parameter "osmooth" and the checkbutton switches it between 0 and 1? for example:

on smoothB changed theState do
(
case TheState of
(
true:
(
osmooth = 0
)
false:
(
osmooth = 1
)
)
)

how to do it in this case?

lo
11-11-2010, 10:25 AM
on yourrollout open do
(
smoothB.checked = (if osmooth==0 then true else false)

)


same logic

p.s. this is the same as writing
(if osmooth==0 then smoothB.checked = true else smoothB.checked = false)

it's just shorter

fael097
11-11-2010, 12:18 PM
yeah, worked like a charm, thanks mate! :)

CGTalk Moderation
11-11-2010, 12:18 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.