PDA

View Full Version : modifiers.enabled states?


3rd Dimentia
04-24-2008, 02:31 AM
OK, modifier enabled states, from what I can tell there are 8 states that a modifier can be.

Enabled Views Render
1 on on on
2 on on off
3 on off on
4 on off off
5 off on on
6 off on off
7 off off on
8 off off off

And yes it does seem that when using maxscript, a modifier could be disabled but enabled in views and enabled in renders. And also it could be enabled, but disabled in view and disabled in renders. It does seem a bit weird that enabled is exclusive of the inviews and inrenders stuff.

So what should overwite what when maxscripting this stuff?

Does anyone know of more of a shortcut way to test the state without having to go thru somehting like this?

if m.enabled == true then
( if m.enabledinviews == true then
( if m.enabledinrenders == true then
( enabledState = 1 )
else
( enabledState = 2 )
)
else
( if m.enabledinrenders == true then
( enabledState = 3 )
else
( enabledState = 4 )
)
)
else
( if m.enabledinviews == true then
( if m.enabledinrenders == true then
( enabledState = 5 )
else
( enabledState = 6 )
)
else
( if m.enabledinrenders == true then
( enabledState = 7 )
else
( enabledState = 8 )
)

3rd Dimentia
04-24-2008, 07:18 AM
So this is what I've been able to figure out:


E= enabled
V=Enabled in views
R=Enabled in renders

set with script

E__V__R
on on on_____on
on on off_____off in render
on off on_____off in views
on off off_____off
off on on_____off
off on off_____off
off off on_____off
off off off____off



set with UI
____________E__V__R
on__________on on on
offViewport___on off on
offRender____on on off
off__________off on on

ZeBoxx2
04-24-2008, 10:22 AM
There's really only 4 logical states, despite maxscript access allowing you to set up other combinations. Those 4 logical states are what are in the UI.


if (myMod.enabled) then (
if (myMod.enabledInViews) AND (myMod.enabledInRenders) then (
state = #enabled
)
else if (myMod.enabledInViews) then (
state = #views
)
else if (myMod.enabledInRenders) then (
state = #renders
)
else (
state = #disabled
)
)
else (
state = #disabled
)


If you do want all the states recorded and parse them as such, try using bits

bitstate = 0
if (myMod.enabled) do ( bitstate += 1 )
if (myMod.enabledInViews) do ( bitstate += 2 )
if (myMod.enabledInRenders) do ( bitstate += 4 )
state = case bitstate of ( -- enabled(1) views(2) renders(4) result
0: #disabled -- false false false 0
1: #disabled -- true false false 1
2: #disabled -- false true false 2
3: #views -- true true false 1+2=3
4: #disabled -- false false true 4
5: #renders -- true false true 1+4=5
6: #disabled -- false true true 2+4=6
7: #enabled -- true true true 1+2+4=7
)


The above code (which no matter what I try gets messed up fromatting-wise in the actual post) doesn't actually use bit states, as it's a pretty simple case. But say you want to get the 'enabledInViews' status from the bitstate '7', you'd use:

bit.get 7 2 -- 2nd bit
true

CGTalk Moderation
04-24-2008, 10:22 AM
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.