Notifications
Clear all
[Closed] Edit_Poly accessing selection when object isn't selected
Jun 26, 2017 10:27 pm
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
Jun 26, 2017 10:27 pm
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.