Notifications
Clear all

[Closed] Edit_Poly accessing selection when object isn't selected

Hello all

I’m trying to get some work done with Edit_Poly modifier and having an issue with it…
Consider the following code:

(
   fn GetEPoly obj =*
   (
      curObj = obj
      if not (isKindOf obj Edit_Poly or isKindOf obj Editable_Poly) then*
      (
         for _mod in obj.modifiers while curObj == obj do*
         (
            if (isKindOf _mod Edit_Poly)
               then curObj = _mod
               else curObj = obj.baseobject
         )
      )
      curObj
   )
   
   obj1 = convertToPoly (box isselected:on)
   poly = Edit_Poly()
   modPanel.addModToSelection poly ui:on
   setselectionlevel poly #vertex
   poly.select #vertex #{1}
   
   obj2 = convertToPoly (box pos:[0, 50, 0] isselected:on)
   setselectionlevel obj2 #vertex
   obj2.Setselection #vertex #{1}
   
   clearSelection()
   format "obj1 selected vert: %
" ((GetEPoly obj1).GetSelection #vertex)
   format "obj2 selected vert: %
" ((GetEPoly obj2).GetSelection #vertex)
)


Why ((GetEPoly obj1).GetSelection #vertex) return me undefined on obj1 when it work perfectly fine on obj2 ?

4 Replies

You kinda answered it yourself in the title of the post, edit_poly needs to be selected and active in the modify panel for most of its methods to work.

If you’re interested in the topmost selection, isPointSelected and pointSelection functions are your friends.

That’s just sad… But thanks for the answer

Why don’t you use polyop functions. *You don’t need objects selected.

polyop doesn’t work on Edit_Poly modifier, only on Editable_Poly