Notifications
Clear all

[Closed] Modifier Gizmo TM, sets different between AddModifier and addModToSelection?

I thought I had this working correctly, but it appears that I do not… Or maybe is a bug…
I’m trying to set the Symmetry Gizmo Transform, based on the Object Transform/Pivot, or a Working Pivot.

But, it appears that if I add the Modifier via modPanel.addModToSelection, vs. AddModifier, it works differently…?

modPanel.addModToSelection will not set the TM/Gizmo properly always, but if I use AddModifier, then it works…?

Edit: If I do it this way, I think it works… Basically using a temp mod, to get the index/placement I want, and put the AddModifier version there.


if (modPnlStatus == #modify) then 
(
   SubObjectLevel = 0
   modPanel.addModToSelection (Symmetry())
   theTempMod = modPanel.getCurrentObject() 
   theTempMod.name = "temp_Symmetry"
      
   local theIndex = modPanel.getModifierIndex obj theTempMod
      
   addModifier obj (Symmetry()) before:theIndex
   theMod = obj.modifiers[theIndex+1]
   deleteModifier obj theTempMod 
   modPanel.setCurrentObject theMod node:obj
)
else 
(
   addModifier obj (Symmetry())
   theMod = obj.modifiers[1]
)

if (WorkingPivot.UseMode == true) then
(
theMod.mirror.transform = WorkingPivot.getTM() * inverse obj.objectTransform
)
else
(
theMod.mirror.transform = obj.transform * inverse obj.objectTransform 
)

2 Replies

i can’t understand your logic… why do you add two symmetry modifiers in the first case? what’s your expectation?

Yeah, that was not a good way to do it.

But basically, using modPanel.getModifierIndex, won’t work if the user has the base EditablePoly object selected in the mod Panel.
Or rather, it fails out.

So now I am doing this, which I think is all working…


local ModType = superclassof (modPanel.getCurrentObject())
   
case of 
(
   (modType == modifier):
   (
      local theIndex = modPanel.getModifierIndex obj (modPanel.getCurrentObject())
         
      case of 
      (
         (theIndex == 1): (addModifier obj (Symmetry()) after:theIndex)
         
         (theIndex > 1): (addModifier obj (Symmetry()) before:theIndex)
      )
      theMod = obj.modifiers[theIndex]
   )
   
   (modType == GeometryClass):
   (
      addModifier obj (Symmetry()) before:(obj.modifiers.count)
      theMod = obj.modifiers[(obj.modifiers.count)]
   )
)
modPanel.setCurrentObject theMod node:obj