checking if objects already exist

Hi

I have created a camera rig script, which sets up a rigged camera in your max scene!

What I am also trying to do is check before it creates the rig to see if any cameras already exist. If they do exist then find the highest numbered Camera prefix and increment it. eg If camera01_ and camera02_ already exist then I will use a camera03_ prefix.

I am stuggling to do this part of the script.

Any help would be very appreciated.

Thanks

gram

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gramx's picture

Thanks

Thanks Anubis, Thats exactly what I was trying to do!

Graph, I will have a look at the uniquename and matchpattern functions also, they might come in usefull too.

Cheers

Gram

Anubis's picture

here is...

-- collect the names of all cameras:
cams = for c in cameras where
    classOf c != Targetobject collect c.name
 
-- var #1 -
sort cams -- sort array
myCam = getNodeByName cams[cams.count]
 
-- var #2
myCam = getNodeByName (amax cams)

Cheers

my recent MAXScripts RSS (archive here)

Graph's picture

did you look into the

did you look into the uniquename and/or matchpattern functions?

Raphael 'Insanto' Steves
http://Graph.Net84.Net

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.