I'm trying to create a "Collapse To" hotkey on the currently selected modifier, but I'm struggling to find out how to determine the modifier index numbers.
I guess the bigger question is what's the proper way to search for related commands? Apologies, I'm clueless on maxscript.
if you are talking about only one object selected at that time, everything is more or less simple and doable. If we have multiple nodes selection, the task becomes more difficult.
I can answer on the first case...
Oh, yup. Only for 1 selected object.
Apologies, I asked this in another thread yesterday and someone posted a macroscript below. The bigger question though is how do users find information on things like obj.modifiers.count? I googled it and I couldn't find documentation, only old forum posts.
macroScript CollapseTo
category:"DragAndDrop"
toolTip:""
(--Begin Macro
for obj in selection do
(
for i in obj.modifiers.count to 1 by -1 where
obj.modifiers[i] == modPanel.getCurrentObject() do
(
maxops.CollapseNodeTo obj i off
exit
)
)
)--End Macro
If it's just one object, you can use a function that's made for that:
macroScript CollapseTo category:"Shortcuts" toolTip:"Collapse To" buttonText:"Collapse To"
(
if isValidNode $ and $.modifiers.count > 0 do
maxOps.collapseNodeTo $ (modPanel.getModifierIndex $ (modPanel.getCurrentObject())) off
)
Node's modifiers property is a collection and all collections have count property, you don't look it up by searching a variable name someone used in code but instead search for concepts. If you download the maxscript reference help file, you can for starterts search for 'common properties' and check to search only in titles, then go from their respective footnote links further on.
Can't find what you're looking for? Ask the community or share your knowledge.