[MaxPlus] How to get to subobjects in a ( XForm ) modifier?

python
max

#1

Hello,

I am diving into 3dsMax Python API and I cannot find any way with python to reach the Gizmo subobject in a XForm modifier.

Creating a XForm is not a problem.

>>> mod = MaxPlus.Factory.CreateObjectModifier(MaxPlus.ClassIds.XForm)

But I cannot reproduce in Python the following MaxScript from the official doc :


<XForm>.center Point3 default: [0,0,0] -- animatable 
<XForm>.gizmo SubAnim 
<XForm.Gizmo>.position Point3 default: [0,0,0] -- animatable 
<XForm.Gizmo>.rotation Quat default: (quat 0 0 0 1) -- animatable

I am clearly missing something there. What shoud I do ?


#2

yeah a bit weird…

There is actually something from the Refs, but not sure how to access it :

36872 : Animatable(Position/Rotation/Scale) - Class_ID(0x00002005, 0x00000000)
36875 : Animatable(Position XYZ) - Class_ID(0x118f7e02, 0xffee238a)

import MaxPlus

# new object
boxObject = MaxPlus.Factory.CreateGeomObject(MaxPlus.ClassIds.Box)
boxNode = MaxPlus.Factory.CreateNode(boxObject)
xformMod = MaxPlus.Factory.CreateObjectModifier(MaxPlus.ClassIds.XForm)
boxNode.AddModifier(xformMod)

# xform Refs
for ref in xformMod.Refs:
	if not ref:
		continue
	print(str(ref.SuperClassID) + " : " + str(ref) + " - " + str(ref.ClassID))


for par in xformMod.ParameterBlock.Parameters:
	print(par)

And nothing from the ParameterBlock… refering to the documentation and parameter available in looks weird…
http://help.autodesk.com/view/3DSMAX/2017/ENU/?guid=__files_GUID_4C5834F8_BC7D_4910_BE7C_BE2CB241253F_htm


#3

Hi, LBarret
you can go through SubAnims


import MaxPlus

# new object
boxObject = MaxPlus.Factory.CreateGeomObject(MaxPlus.ClassIds.Box)
boxNode = MaxPlus.Factory.CreateNode(boxObject)
xformMod = MaxPlus.Factory.CreateObjectModifier(MaxPlus.ClassIds.XForm)
boxNode.AddModifier(xformMod)

for nb in range (xformMod.GetNumSubAnims()):
    #Paramaters is empty, like sama.van says
    if xformMod.GetSubAnimName(nb)!="Parameters":
        print xformMod.GetSubAnimName(nb)
        for par in xformMod.GetSubAnim(nb):
            print par