Notifications
Clear all

[Closed] How to set/reset SO bit flags for EditPoly Modifiers?

Hi guys, I need a little help to make bit flags work with Edit Poly Modifiers. Methods are currently undocumented, but I discovered them poking at the SDK help. They got the same form of methods for Editable Poly objects. My issue is I can set verts/edges/faces flags, but cannot reset them, the bit mask doesn’t seem to have any effect. Am I doing anything wrong? Is there a solution? Thank you very much.

(
    local iFlag = bit.set 0 30 true
    local baVerts = #{}

    local theEPObj = convertToPoly (Plane pos:[30, 0, 0])

    local thePlane = Plane pos:[-30, 0, 0]
    local theEPMod = Edit_poly()
    addModifier thePlane theEPMod


    format "Editable Poly
"

    -- set bit flag 30 on verts 1..10
    polyop.setVertflags theEPObj #{1..10} iFlag mask:iFlag

    -- get verts with bit flag 30 set
    baVerts = polyOp.getVertsByFlag theEPObj iFlag mask:iFlag
    format "Flagged Verts after set: %
" baVerts

    -- reset bit flag 30 on all verts
    polyop.setVertflags theEPObj #{} iFlag mask:iFlag

    -- get verts with bit flag 30 set
    baVerts = polyOp.getVertsByFlag theEPObj iFlag mask:iFlag
    format "Flagged Verts after reset: %
" baVerts

    format "
"


    format "Edit Poly Modifier
"

    select thePlane

    if (getCommandPanelTaskMode() != #modify) do
        setCommandPanelTaskMode #modify

    if (modPanel.getCurrentObject() != theEPMod) do
        modPanel.setCurrentObject theEPMod

    -- set bit flag 30 on verts 11..20
    theEPMod.setVertexFlags #{11..20} iFlag flagMask:iFlag generateUndoRecord:true node:thePlane

    -- get verts with bit flag 30 set
    theEPMod.getVerticesByFlag &baVerts iFlag
    format "Flagged Verts after set: %
" baVerts

    -- set bit flag 30 on verts 11..20
    -- flagMask doesn't seem to work
    theEPMod.setVertexFlags #{} iFlag flagMask:iFlag generateUndoRecord:true node:thePlane

    -- get verts with bit flag 30 set
    theEPMod.getVerticesByFlag &baVerts iFlag
    format "Flagged Verts after reset: %
" baVerts
)

Output:

Editable Poly
Flagged Verts after set: #{1..10}
Flagged Verts after reset: #{}

Edit Poly Modifier
Flagged Verts after set: #{11..20}
Flagged Verts after reset: #{[B]11..20[/B]}
  • Enrico
3 Replies

Hi guys, just a bump because I still need this feature and cannot find any workaround. Thank you.

  • Enrico

use:


   theEPMod.setVertexFlags baVerts 0 flagMask:iFlag generateUndoRecord:true node:thePlane
   

to reset the flag

test:


  (
  	delete objects
  	local i30 = bit.set 0 30 true
  	local i31 = bit.set 0 31 true
  	local v30 = v31 = #{}
  	local thePlane = Plane pos:[-30, 0, 0]
  	addModifier thePlane (theEPMod = Edit_poly())
  
  	format "
Edit Poly Modifier
"
  	select thePlane
  	if (getCommandPanelTaskMode() != #modify) do
  		setCommandPanelTaskMode #modify
  
  	if (modPanel.getCurrentObject() != theEPMod) do
  		modPanel.setCurrentObject theEPMod
  
  	-- set bit flag 30 on verts 11..20
  	theEPMod.setVertexFlags #{11..20} i30
  	-- set bit flag 31 on verts 11..20
  	theEPMod.setVertexFlags #{11..20} i31
  	
  	-- get verts with bit flag 30-31 
  	theEPMod.getVerticesByFlag &v30 i30
  	theEPMod.getVerticesByFlag &v31 i31
  	format "Flagged Verts after set: 30:% 31:%
" v30 v31
  
  	-- set bit flag 30 on verts 11..20 to OFF
  	theEPMod.setVertexFlags v30 0 flagMask:i30
  
  	-- get verts with bit flag 30-31
  	theEPMod.getVerticesByFlag &v30 i30
  	theEPMod.getVerticesByFlag &v31 i31
  	format "Flagged Verts after 30 reset: 30:% 31:%
" v30 v31
  )
  

Just great! Once again you come to rescue, thank you very much! Now I can extend some more IC.Shape features to Edit Poly Modifier. Your solution makes me think I didn’t fully understand sub-objects bitFlags and bitMasks, even if I’ve been using them successfully so far

I truly appreciate your help.

  • Enrico