Search code examples
python3dsmax

MaxPlus Python - 3Ds Max - Add Worldspace Modifier


I'm trying to learn MaxPlus/Python in 3Ds Max, and I am stuck with creating a worldspace modifier. (Path Deform Binding WSM modifier)

mod = MaxPlus.Factory.CreateWorldSpaceModifier(MaxPlus.ClassIds.PathDeformSpaceWarp)
MaxPlus.ModifierPanel.AddToSelection(mod)

Above code gives the following error:

File "C:\Program Files\Autodesk\3ds Max 2017\MaxPlus.py", line 30534, in CreateWorldSpaceModifier return _MaxPlus.Factory_CreateWorldSpaceModifier(*args) RuntimeError: creation failure

Not sure why it happens, maybe the class ID is wrong? Adding object space modifiers works like a charm.

My current workaround is using the new pymxs:

# pymxs part
rt.execute("meshObj=$")
rt.modpanel.addmodtoselection(rt.SpacePathDeform())
rt.meshObj.modifiers[0].path = rt.s

But that feels really hacky. Any ideas?


Solution

  • Close enough, here you go:

    mod = MaxPlus.Factory.CreateWorldSpaceModifier(MaxPlus.Class_ID(0x000110b4, 0x00007f9e))
    MaxPlus.ModifierPanel.AddToSelection(mod)
    

    Apart from looking for #define in the SDK, you can get the classIDs by getting the classID property of existing object, for example $.modifiers[1].classID.