Created
September 22, 2016 16:44
-
-
Save EricTRocks/604093909063a8fd4ee85e7f5f307e55 to your computer and use it in GitHub Desktop.
Get custom attribute containers and parameters and print data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MaxPlus | |
node = MaxPlus.SelectionManager.GetNodes()[0] | |
# Add Attr Holder to selected object | |
#~ attrHolder = MaxPlus.Factory.CreateObjectModifier(MaxPlus.ClassIds.EmptyModifier) | |
#~ attrHolder.SetName(MaxPlus.WStr('myObjAttrs')) | |
#~ node.AddModifier(attrHolder) | |
# Find Modifier Programmatically | |
mod = None | |
for i in xrange(node.NumModifiers): | |
currMod = node.GetModifier(i) | |
if currMod.GetName() == 'myObjAttrs': | |
mod = currMod | |
break | |
# Get Attr Containers and Param Blocks | |
for i in xrange(len(mod.GetCustomAttributeContainer())): | |
attrCntr = mod.GetCustomAttributeContainer()[i] | |
print attrCntr.GetName() | |
paramBlock = attrCntr.GetParameterBlock() | |
for i in range(paramBlock.NumParameters): | |
param = paramBlock.GetItem(i) | |
paramName = param.GetName() | |
paramValue = param.Value | |
paramType = param.GetParamType() | |
print '- {0} : value({1}) : type({2})'.format(paramName, paramValue, paramType) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment