PDA

View Full Version : Turning faces on and off with a check box...


Ian00
02-10-2009, 09:23 AM
Hello, I've been looking for a way of having certain faces on a model deleted when a check box is turned off, and not deleted when turned on. So, basically I need a way of turning parts of a model on and off with booleans, like how the teapot primitive is.

The first solution I had was to have a poly select modifier that selected the faces I wanted, and a slice modifier on top, with the z-position of the plane wired with an extreme value either in the positive or negative direction, to a check box.

This method seems to work fine, but it would require a lot of modifiers, depending on how many parts I wanted to turn on/off.

The second method I decided to try was to script in the check box by using the polyop method, with the setFaceFlags operation.

I'm still fairly new to maxscript, and I tried learning alittle about polyops from the documentation (I'm using max2009 btw). I'm not sure if this is the best method for what I am trying to do, but I was trying to get the selected faces to be flagged as 2 so they would be dead faces.

Heres my test with this method-

custom_attributes = attributes Modeling_Cube_Attributes
(
parameters Side_Parameters rollout: Side_Parameters_Rollout
(
Param_Use_Top type:#boolean default:true ui:Use_Top
on Param_Use_Top set val do
if (Param_Use_Top == true) then
(
bit2 = bit.set 0 2 false
sel = 2
polyop.setFaceFlags $Box01 sel bit2 flagMask:bit2
)
else
(
bit2 = bit.set 0 2 true
sel = 2
polyop.setFaceFlags $Box01 sel bit2 flagMask:bit2
)
)
rollout Side_Parameters_Rollout "Side Parameters" width:160 height:384
(
checkbox Use_Top "Use Top" pos:[64,30] width:88 height:16 checked:true
)
)
custAttributes.add $Box01.modifiers[1] custom_attributes

It should work on a editable poly named Box01 with an attribute holder modifier on it. It seems to delete the face I need, but I can't figure out a way of getting the dead face back to normal, when the check box is set to true.

Any ideas and suggestions would be greatly appreciated. :)

BTW, does anyone know where I can find some basic object primitive scripting tutorials?

Thanks -Ian

CGTalk Moderation
02-10-2009, 09:23 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.