Problem with Maxscript WM3_MC_BuildFromNode

Problem with Maxscript WM3_MC_BuildFromNode

10DSpace
Advisor Advisor
1,142 Views
1 Reply
Message 1 of 2

Problem with Maxscript WM3_MC_BuildFromNode

10DSpace
Advisor
Advisor

 

When I explicitly name a valid morph target in the scene with the following:

WM3_MC_BuildFromNode $Head_Base_Mesh.morpher 1 (getNodeByName " MT_Object_Name")

I get the expected result with the morph target being added to channel 1 of the morpher modifier.

 

However, when trying to load the same valid morph targets from an array of these objects as follows:

for i = 1 to a.count do(

MT_Name = a[i].name

WM3_MC_BuildFromNode $Head_Base_Mesh.morpher i (getNodeByName MT_Name)

)

 

Nothing happens.  There are no error messages, but the morph targets are not added to the channels of the named Morpher modifier.  Similarly, the following variations  produce no error messages but with nothing being added to the morpher modifier:

 

--No errors but no added morph targets

for i = 1 to a.count do(

WM3_MC_BuildFromNode $Head_Base_Mesh.morpher i a[i]

)

OR

for i = 1 to a.count do(

WM3_MC_BuildFromNode $Head_Base_Mesh.morpher i (getNodeByName a[i].name)

)

 

The following variation of the WM3_MC_BuildFromNode statement,

 

  WM3_MC_BuildFromNode $Head_Base_Mesh.morpher i (getNodeByName (a[i] as string))

 

produces the following error:

-- Error occurred in anonymous codeblock; filename: E:\3ds Max 2020\Scripts in Progress\Morpher target script.ms; position: 2684; line: 71

-- Type error: WM3_MC_BuildFromNode [Morpher Modifier] [Channel Index] [Target] requires Object, got: undefined

 

Any help would be appreciated.  After reading through the Max documentation and checking for anything helpful online, I am stuck.  Overall goal is to load an array of morph targets into the channels of a morpher modifier which seems like it should be simple and WM3_MC_BuildFromNode seems to be well suited for it, but apparently I am missing something basic here.   Thanks in advance for any guidance.

0 Likes
Accepted solutions (1)
1,143 Views
1 Reply
Reply (1)
Message 2 of 2

10DSpace
Advisor
Advisor
Accepted solution

I sorted this out.   I was failing to take into account that max will auto-rename a duplicate mesh in certain operations earlier in the script ( polyOp.detachfaces in this case).  So I was creating a valid array and accessing it properly but using the wrong mesh name in building the array.  And the meshes in the array had the wrong vertex count so  WM3_MC_BuildFromNode could not load it properly.  So now all is sorted out and working properly.    

0 Likes