Community
3ds Max Programming
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max SDK, Maxscript and Python topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How To List Camera Names

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
17216-1071
2486 Views, 8 Replies

How To List Camera Names

Hi All,

 

I wonder if it is possible to list the camera names in the scene and save it to a .txt or .csv file on file system.

 

Can this be possible through Max Script or any other way? Even an external command without opening the scene will work.

 

 

Thanks in advance for your suggestions.

8 REPLIES 8
Message 2 of 9
Steve_Curley
in reply to: 17216-1071

The quickest (and dirtiest) way would be to open the Maxscript Listener, enter the following all on one line and press Enter. Click in the output pane, Ctrl+A then Ctrl+C then paste the results into your favourite text editor and clean up the results.
Creating a proper script to ask for a filename etc etc would be relatively easy, but by the time you've done that you could already have the necessary results. Only worth the effort if you have to do this on many scenes.

for cam in cameras do (print cam.name)

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

Message 3 of 9
17216-1071
in reply to: Steve_Curley

Hi Steve,

 

I will need the same for a couple hundred scenes. Looks like I need to learn max script and somehow automate it.

 

Thank you for you suggestion.

 

 

Message 4 of 9
Steve_Curley
in reply to: 17216-1071

Well worth it in that case. I'll have a look when I get a moment or 3 😉 but learning the basics of Maxscript is well worth it in the long run - repetative jobs like this are pretty easy and can save an enormous amount of time.

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

Message 5 of 9
17216-1071
in reply to: Steve_Curley

Actually I will really appreciate that if you can take a look to suggest for a proper script.

 

I allready started to study on MaxScript but it is still different to hear from a pro.

 

 

Cheers...

Message 6 of 9
Steve_Curley
in reply to: 17216-1071

Not a "pro" by any stretch of the imagination, just know enough to do small tasks like this one (hopefully).

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

Message 7 of 9
Steve_Curley
in reply to: Steve_Curley

(
Cams = for Cam in cameras where (superclassof Cam == camera) collect Cam
if Cams.count > 0 then
	(
	output_name = getSaveFileName caption:"Text File" types:"Text (*.txt)|*.txt|All Files (*.*)|*.*|"	
	if output_name != undefined then
		(
		output_file = createfile output_name
		if output_file != undefined then
			(
			for Cam in Cams do format "%\n" Cam.name to:output_file
			close output_file
			)
		)
	)
)
Load that into the Maxscript Editor (not the Listener), select all, drag the whole thing to a Toolbar - it will create a button for you which you can customise if you want. Attached it (zipped) in case copy/pasting from the forum doesn't work.

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

Message 8 of 9
17216-1071
in reply to: Steve_Curley

Hi Steve,

 

It works like a charm. You cant imagine how much time I will save with the help of this script.

 

Thank you very much for your interest and help.

 

Cheers.

Message 9 of 9
Steve_Curley
in reply to: 17216-1071

You're welcome. Just remember to take time out to look though it - it's pretty simple really. Everthing used in there is explained in the Maxscript help, often with examples.

Max 2016 (SP1/EXT1)
Win7Pro x64 (SP1). i5-3570K @ 4.4GHz, 8Gb Ram, DX11.
nVidia GTX760 (2GB) (Driver 430.86).

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report