macroScript EditFaceDirect_v01 category:"111" ( ----if modpanel is not accessable than triggring standard max "1" command --if modPanel.getCurrentObject() == undefined then (macros.run "Modifier Stack" "SubObject_1") --else --( max modify mode sblevel = 4 obj = selection[1] ------------ selected object, object to be processed SupportedClasses = #(Editable_Poly, Editable_mesh, line, NURBSCurveshape, NURBSSurf, Editable_Patch) ---- supported base classes SupportedMClasses = #(Edit_Poly, Edit_Mesh, Edit_Patch, Edit_Spline) -- supported modifiers (that can enter edit mode) global prevInitialStackLevel global InitialStackLevel = modPanel.getCurrentObject() ---------- stack position if prevInitialStackLevel == undefined then prevInitialStackLevel = InitialStackLevel ----var used for the second run fn OpenVertexLevel l = ------------ opening vertex level ( try ( if l == 0 then modPanel.setCurrentObject obj node:obj else modPanel.setCurrentObject obj.modifiers[l] node:obj subobjectLevel = sblevel ) catch() ) ------- checking subobject level, if base level (no opened subobjects) then if subObjectLevel == 0 then ( ModifiersNotFound = true notFound = true try ( for i = 1 to obj.modifiers.count while notFound do ( if (findItem SupportedMClasses (classof obj.modifiers[i])) != 0 then ( --print "suitable mod found" OpenVertexLevel i notFound = false ModifiersNotFound = false ) ) if ModifiersNotFound then ( -- trying on the base level --print "base level" if (findItem SupportedClasses (classof obj.baseObject)) != 0 then OpenVertexLevel 0 else ( try ( subobjectLevel = sblevel ) catch() ) ) prevInitialStackLevel = InitialStackLevel ------ saving stack position for the next run ) catch() ) else --------- closing opened subojects or going to vertex level ( try ( if subobjectLevel == sblevel then -------- going to top level from vertex level ( subobjectLevel = 0 modPanel.setCurrentObject prevInitialStackLevel node:obj prevInitialStackLevel = InitialStackLevel ------ saving stack position for the next run ) else ( try ( subobjectLevel = sblevel ------- going to vertex level ) catch () ) ) catch () ) --) --- end modpanel availability check ) --- end macroscript definition