-- macro maxscript EditVertexDirect -- author: Andrei Kletskov (111) - http://andklv.narod.ru -- description: this script's purpose is allowing opening vertex level for editing, this is replacement for the "1" hotkey -- history: -- v0.1 - 15 nov 2013: support for -- base objects: editable_poly, editable_mesh, spline, nurbs_spline, nurbs_surface -- and modifiers (the very first in the stack): edit_poly, edit_mesh, edit_spline, edit_patch macroScript EditVertexDirect_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 ( obj = selection[1] ------------ selected object, object to be processed SupportedClasses = #(Editable_Poly, Editable_mesh, line, NURBSCurveshape, NURBSSurf) ---- 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 ( if l == 0 then modPanel.setCurrentObject obj.baseObject else modPanel.setCurrentObject obj.modifiers[l] subobjectLevel = 1 ) ------- checking subobject level, if base level (no opened subobjects) then if subObjectLevel == 0 then ( ModifiersNotFound = true notFound = true 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 ) /* if obj.modifiers.count == 0 then ( -- trying on the base level print "base level" if (findItem SupportedClasses (classof obj.baseObject)) != 0 then OpenVertexLevel 0 ) else -----checking modifiers for supported type ( print "mod level" ModifiersNotFound = true notFound = true for i = 1 to obj.modifiers.count while notFound do ( if (findItem SupportedMClasses (classof obj.modifiers[i])) != 0 then ( OpenVertexLevel 1 notFound = false ModifiersNotFound = false ) ) if ModifiersNotFound then ( -- trying on the base level if (findItem SupportedClasses (classof obj.baseObject)) != 0 then OpenVertexLevel 0 ) ) */ ) else --------- closing opened subojects ( subobjectLevel = 0 modPanel.setCurrentObject prevInitialStackLevel ) --------------- saving stack position for the next run prevInitialStackLevel = InitialStackLevel ) --- end modpanel availability check ) --- end macroscript definition