Notifications
Clear all

[Closed] Store selection with duplicately node's name

Hi all,
Is there a way to store selecting objects to .txt file and then can load it?I think the simply way is save their names,but if a scene has same name objects,such as Teapot01,Teapot01,Teapot02 … how can I avoid?if has the same name ,after load the selection,would no correct,right?anyone help?

6 Replies

Use:

GetHandleByAnim <object>

GetAnimByHandle <integer>

1 Reply
(@momo2012)
Joined: 11 months ago

Posts: 0

thanks,finally I use inode.handle to save unique names


--Save nodes data
selected_array=for o in getcurrentSelection() collect o.inode.handle

--Load nodes data
load_selected=#()
clearselection()
for i=1 to selected_array.count do append load_selected (maxOps.getNodeByHandle selected_array[i])
select load_selected
load_selected=#()

just curious… why do you do it? it makes sense for only one case: if you want store selection data, and restore it next time you open the same file. but there is a selection sets system that does do it for you.

3 Replies
(@momo2012)
Joined: 11 months ago

Posts: 0

what’s the selection sets system?

(@denist)
Joined: 11 months ago

Posts: 0

just make a selection set and save the file.
but you didn’t answer my question. why do you collect nodes by handle?

(@momo2012)
Joined: 11 months ago

Posts: 0

You mean save selected as a file,I don’t want to do that.
I want to hide objects when switching cameras ,some cameras viewport need to hide unuseful objects,other ones need to unhide,for example,
There are 3 objects in a scene:

Teapot01,Cone01,Sphere01

Camera_01:Teapot01,Cone01,Sphere01 (show all)
Camera_02:Cone01,Sphere01 (hide Teapot01)
Camera_03:Sphere01 (hide Teapot01,Cone01)

So switching them would easier if can store the selection data than save a file,right?Maybe there has another good way to do it,but I decide to choose saving selection data for my solution now.