Home Coding, Scripting, Shaders

Maxscript - "Current Modifier"

polycounter lvl 11
Offline / Send Message
leechdemon polycounter lvl 11
I've done some searching and I can't find a simple answer to this; is there a command in maxscript to call on the currently active modifier?

I have some scripts that work in Editable/Edit Poly, but if I have multiple copies of Edit Poly on the mesh, they refuse to work. It'd be nice to say "Hey, we're currently using modifier #4 in the stack, so try this using THAT edit poly...".

Replies

  • monster
    Offline / Send Message
    monster polycounter
    --THIS STEP IS IMPORTANT, THE MODIFIER IS ONLY AVAILABLE IF IN THE MODIFY PANEL
    setCommandPanelTaskMode #modify

    --THIS GETS THE MODIFIER
    CurrentMod = modpanel.getCurrentObject()
  • leechdemon
    Offline / Send Message
    leechdemon polycounter lvl 11
    That's awesome. Super easy. Thanks a ton!
  • supernekosan
    Offline / Send Message
    supernekosan polycounter lvl 7
    I personally wouldn't go with this solution since it could cause issues were you will edit more than one object that got the same modifier name at the same time. to be safe I would rather advice to use this instead

    CurrentMod = modpanel.getCurrentObject()
    theModifier_ID = modPanel.getModifierIndex $ CurrentMod 

    -- and then use this to call it

    $.modifiers[
    theModifier_ID]

    this way your script will control the modifier that will be specific to your Object


    --------------here is the maxdoc definition on the two function.-------------------

    modPanel.getCurrentObject()

        Returns the modifier or base object currently selected in the Modify panel stack.

        If the Modify panel is not open, this function returns undefined . Use the max modify mode command to switch to the Modify panel. 


    modPanel.getModifierIndex <node> <modifier>

        Returns the index of the given modifier in the modifier stack for the given node.

        This index corresponds to the modifiers position in the <node>.modifiers array.

       This function returns undefined if the given modifier is not in the node's modifier stack. 


    I hope this will be helpful for the next person that will search for this information.


Sign In or Register to comment.