Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / WM3_MC_BuildFromNode not working with button press?
  RSS 2.0 ATOM  

WM3_MC_BuildFromNode not working with button press?
Rate this thread
 
63948
 
Permlink of this thread  
avatar
  • Total Posts: 13
  • Joined: 12 May 2009 01:40 PM

Hey folks, I’ve got a pretty simple piece of code that doesn’t seem to be behaving as expected at all.  After a couple of hours of head scratching I thought I’d seek help.

Here’s the script:

on bigBtn pressed do
 (
 
originalMesh $originalBox
 newMesh 
$newBox
 originalMeshCheck 
copy originalMesh
 compatibilityCheck 
= (Morpher())
 
addModifier newMesh compatibilityCheck
 WM3_MC_BuildFromNode compatibilityCheck 1 originalMeshCheck
 
--Then there'd be an if statement to check if morph data present
 )

I’ve put the first two variables as hardcoded, but they are grabbed via a pick button.

So it’s a pretty simple script, but at the end of it I’m left with the newMesh having a morph target and no data.

What’s SUPER confusing is that if I just run this without a button press, just that code on its own, it works flawlessly.



Replies: 0
avatar

Okay I’ve tried putting this into a function and calling it:

fn checkTopology originalMesh newMesh =
(
 --
2.Check if meshes are compatible
 
--Copy original mesh and delete morpher
 originalMeshCheck 
copy originalMesh
 deleteModifier originalMeshCheck 1
 
--define modifier
 compatibilityCheck 
= (Morpher())
 --
add modifier to new mesh and check if it's compatible with the original mesh
 addModifier newMesh compatibilityCheck
 WM3_MC_BuildFromNode compatibilityCheck 1 originalMeshCheck
)

And then I just call that function when the button is pressed and pass off the object, but it still doesn’t work.



Replies: 0
avatar

Okay I fixed it.

Essentially before I add the morph target I have to select the object.

Makes no sense; I shouldn’t have to select it; it works if I manually run that single line without it selected - but in the script it needs to be selected.

Moral of the story: MAXScript makes no sense sometimes.



Replies: 0