-- 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 ----------------- it is recommended to put old "1"-key functionality (sub-object level 1) to "SHIFT+1" key binding -- 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 -- v0.2 - 15 nov 2013: bug with instances fixed, other small fixes -- v0.3 - 15 nov 2013: from edged subobject switches to vertex and only after that to top level -- v0.4 - 16 nov 2013: bug fixing -- v0.5 - 5 may 2014 - no object (or wrong object) selected error fixed macroScript EditVertexDirect_v05 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 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 = 1 ) 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 = 1 ) catch() ) ) prevInitialStackLevel = InitialStackLevel ------ saving stack position for the next run ) catch() ) else --------- closing opened subojects or going to vertex level ( try ( if subobjectLevel == 1 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 = 1 ------- going to vertex level ) catch () ) ) catch () ) --) --- end modpanel availability check ) --- end macroscript definition