PDA

View Full Version : I'm missing something simple, but I can't figure out what


uzik
11-21-2003, 12:37 AM
I'm doing my first max script.
All the complicated stuff works, but
what should be simple doesn't!

I'm trying to select an object I've just
cloned and put a mesh select modifier
on it. It keeps erroring out saying
it's got an undefined class.

Here's the code:

-- add a mesh selection modifier
addModifier ($(js_LifeObjectName)) (Mesh_Select())

I get this:

-- Error occurred in s loop
-- Frame:
-- s: 1
-- js_LifeObjectName: "Life001001"
-- called in r loop
-- Frame:
-- r: 1
-- called in js_LifeCreate()
-- Frame:
-- n: 12
-- obj: $Editable_Mesh:Box01 @ [-4.743082,-4.347826,0.000000]
-- called in js_LifeCreatePickButton()
-- Frame:
-- obj: $Editable_Mesh:Box01 @ [-4.743082,-4.347826,0.000000]
>> MAXScript Rollout Handler Exception: -- Type error: Call needs function or class, got: undefined <<


js_LifeObjectName names the object.
I can see the object exists. The debug
output shows the variable is set.
I tried putting in $js_LifeObjectName
and $(js_LifeObjectName) and
($(js_LifeObjectName))

Why isn't it using the string as the
object name when I use
$(js_LifeObjectName)?

magicm
11-21-2003, 09:53 AM
I suspect js_LifeObjectName is a string value containing the name of the object?

If this is the case, you can get the actual object with:
getNodeByName js_LifeObjectName

so, to add the mesh select modifier try the following:
addModifier (getNodeByName js_LifeObjectName) (Mesh_Select())


Martijn

uzik
11-21-2003, 11:37 AM
Thanks very much! That was exactly
what I was looking for. Somewhere
I thought I read that it would
recursively evaluate an expression
and that $( string_naming_your_object )
would evaluate to $Object_name and
thus reference the object.

Thanks again!

CGTalk Moderation
01-16-2006, 05:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.