Notifications
Clear all

[Closed] How to distinguish objects that have same name?

Hi everyone,
Normally,we can select an object by its name,but if other objects have the same name,how can I select it?I remember there has a way to get an object’s ID,something like that,I am not sure,but I forgot what’s the function,can anyone help me?Thanks in advance!

10 Replies

Each node in the scene has a unique handle, you can get it like this:
$test.handle

Here’s the documentation on this:

http://docs.autodesk.com/3DSMAX/16/ENU/MAXScript-Help/index.html?url=files/GUID-40BD721E-9323-4FCF-8ABB-19E8EA92C675.htm,topicNumber=d30e277871

On a side-note, although Max allows us to have duplicate names, I would highly discourage using them especially if you’re intending on writing scripted tools.

Too much thanks,this is what I am looking for!

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

what ‘handle’ does a teapot object have?


t = teapot()
t.handle

why do you think that ‘handle id’ is unique? because the help says this?

i would say that more likely that you can’t see more then one node in scene with a specified handle

1 Reply
(@momo2012)
Joined: 11 months ago

Posts: 0

So is there a better way to get an object’s unique ID?

if you are looking for unique id in the scene it’s the anim handle… but it might be different if you load this scene next time.

see the mxs help – AnimHandle System

How about $.inode.handle ?

2 Replies
(@momo2012)
Joined: 11 months ago

Posts: 0
t = teapot()
t.inode.handle 

Seems work,thanks for help!

(@denist)
Joined: 11 months ago

Posts: 0

sure… it’s how it has to be

Well, it’s unique to the scene, which is superficially unique and too brittle to be actually considered unique.

I suppose if he wanted something more unique he could install a NodeCreated callback, generate a GUID or ClassID and then store that to an appData channel in the node.

I still maintain that a workflow that encourages hash collisions isn’t very ideal.