Notifications
Clear all
[Closed] what are flags and mask flags in editablepoly
Jul 13, 2010 9:48 am
i went through that several time in max script help and didnt get it well could anybody tell me what is flag and maskflags there s explaination code in the help i dont get it all
[left]
[/left]
[left]theObj = plane isSelected:true
[/left]
[left]convertto theObj editable_poly
[/left]
[left]
[/left]
[left]nVerts = theObj.numverts
[/left]
[left]
[/left]
[left]bit30 = bit.set 0 30 true
[/left]
[left]bit31 = bit.set 0 31 true
[/left]
[left]bit32 = bit.set 0 32 true
[/left]
[left]
[/left]
[left]-- set a bit on first 3/4 or so verts
[/left]
[left](
[/left]
[left]flagsToSet = bit30
[/left]
[left]flagsToMask = 0
[/left]
[left]vertexSet = #{1..(3*nVerts/4)}
[/left]
[left]theObj.setVertexFlags vertexSet flagsToSet flagMask:flagsToMask generateUndoRecord:true
[/left]
[left]ok
[/left]
[left])
[/left]
[left]-- and another on middle block
[/left]
[left](
[/left]
[left]flagsToSet = bit31
[/left]
[left]flagsToMask = 0
[/left]
[left]vertexSet = #{(nVerts/3)..(nVerts-4)}
[/left]
[left]theObj.setVertexFlags vertexSet flagsToSet flagMask:flagsToMask generateUndoRecord:true
[/left]
[left]ok
[/left]
[left])
[/left]
[left]-- set a bit on last 2 verts
[/left]
[left](
[/left]
[left]flagsToSet = bit32
[/left]
[left]flagsToMask = 0
[/left]
[left]vertexSet = #{(nVerts-2)..nVerts}
[/left]
[left]theObj.setVertexFlags vertexSet flagsToSet flagMask:flagsToMask generateUndoRecord:true
[/left]
[left]ok
[/left]
[left])
[/left]
[left]
[/left]
[left](
[/left]
[left]-- get verts with bit30, 31, 32 set
[/left]
[left]format "30: %
" (polyOp.getVertsByFlag theObj bit30)
[/left]
[left]format "31: %
" (polyOp.getVertsByFlag theObj bit31)
[/left]
[left]format "32: %
" (polyOp.getVertsByFlag theObj bit32)
[/left]
[left]
[/left]
[left]-- get verts with bit30 set, but not bit31
[/left]
[left]format "30 and !31: %
" (polyOp.getVertsByFlag theObj bit30 mask:(bit30+bit31))
[/left]
[left]
[/left]
[left]-- get verts with bit31 not set, doesn't matter what the <flag>
[/left]
[left]-- value is as long as it's not bit31
[/left]
[left]format "!31: %
" (polyOp.getVertsByFlag theObj bit30 mask:(bit31))
[/left]
[left]
[/left]
[left]-- get verts with bit30 and bit31 set
[/left]
[left]format "30 and 31: %
" (polyOp.getVertsByFlag theObj (bit30+bit31))
[/left]
[left]
[/left]
[left]-- get verts with neither bit31 or bit32 set, doesn't matter what
[/left]
[left]-- the <flag> value is as long as it's not bit31 or bit32
[/left]
[left]format "!(31 or 32): %
" (polyOp.getVertsByFlag theObj bit30 mask:(bit31+bit32))
[/left]
[left])
[/left]
so can i have any clue explaination for that?
1 Reply