Notifications
Clear all

[Closed] How to avoid object's name?

Hi everybody,
I’m wondering if there is another way to call an object than with its name.
For a controller picker, for example, I would like to rely on something else than the name just in case the animator change the name by mistake.
I would like to store some information in the object like an “hidden” name and other parameters like “right” “left” etc.
Thanks for your help.

7 Replies

There are multiple ways to which you could do this.

1 – You could add a hidden attribute to the controllers that contains a certain TAG you want, so now if you created your character picker through DotNet you could add a .tag to each button with the same value as the TAG in the respective controller, now everytime someone clicks on this button you just have to look for the controller that has the same TAG attribute as the .tag property in your button.

2 – (This is the way I usually do it) Use week references to the controllers http://paulneale.com/tutorials/Scripting/weakReferences/weakReferences.htm this will make so you can always find the node regardless of the name on it.

Both ways will work , but they have their limitations that would require you to find ways to get around!

Hope that helps.

depends on the object, for nodes you can use the

.handle

property

Thank you for your answers.
Everything seems a bit more complicated than what I thaught. I will have to study that more carefully.
Today I was thinking of something else as well, would it be possible to use user defined parameters for that? Anybody tried that before?

From personal experience handles will change when you start merging things in and out of scenes.

I have not tested this in a while and not able to open max right now, but:

1 – reset max
2 – make a box (its handle should be = 1 I believe)
3 – save file as whatevername.max
4 – merge file you just saved
5 – check the handles
6 – merged box should have a handle = 2

Now imagine you refereed to handles in your rig and you merge said rig into a animation scene with sets and props! you got problems! Please let me know if I am mistaken by this or if they have implemented a way to handle this.

Thanks a lot for that help.
I have tried the weak references system, it’s amazing. Exactly what I was after.
The “.handle” solution would be a lot simplier but I read somewhere else as well about the merging problem.

Thanks again!

1 Reply
(@gazybara)
Joined: 11 months ago

Posts: 0

Also you can try GetHandleByAnim and GetAnimByHandle fn’s to avoid .handle property problem

I wouldn’t recommend using handle. I generally use weak references where necessary, however there are two other options to consider –

userpropbuffer
appdata

Userpropbuffer is useful but not the most robust as a user can still mess with it (via the tab in object properties) but does persist with merged and cloned nodes/systems.
Appdata is quick and robust but doesn’t transfer with things like cloning operations. It is great from a TD perpective, as it not possible to change except via script.