Notifications
Clear all

[Closed] Maxscript: self-referencing when instancing an object?

changing changing changing

2 Replies

Hi!

I’m fairly new to Maxscript so maybe the answer is very simple, I’ll describe briefly.

Basically I have an object but I want to “imprint” it with a text (I’m using a proboolean), and I want that text to be easily changed by the user, so I opted for User Defined properties via a getUserProp.

I created a script in one of the object’s scale axis. Defined these variables:

myself
Assigned to Target: $‘obj_name’[#text_obj].‘Text(Object)’ (obj_name is the name of the object, and text_obj is the name of the extruded-text sub-object of the proboolean)

parent
Assigned to Node: $‘obj_name’ (I think here lies the problem, this node remains the same even when cloning the xref object, it doesn’t change to match the clone’s name… but I couldn’t do the reference in any other way but a Node because it tells me I create a “circular dependency”)

Then the script just says:

myself.text=getUserProp parent “var”
1

This works for the first xrefed object, but when doing clones of it, the behavior is undesirable… if doing a Copy-Clone of it, the original object’s text gets the User Defined Props from the NEW object… and if I delete the new object, the original stops working. If I do an Instance-Clone of the object, the clone gets the UsrDefProps from the original, not from itself…

I then played around and changed into:

myself.text=getUserProp $ “var”

Because “$” points to the object itself… but it has the same problems PLUS when reopening the scene which has the xrefs, it prompts with errors in the script…

Is there a way to make each clone point to its own UserDefProps, not the original’s? Any ideas or suggestions?

Thanks again :D!

Ok this problem in an even simpler situation… just a box with it’s height defined in the Custom User Props. Xrefed the first box, fine… instance-cloning it and the first box’s height is defined by the clone’s User Properties!!

Argh!