ScriptSpot home

Forum topic · General Scripting

Camera rename

By andrej · 2023-11-22

Description

Hi all.

I haven’t used Maxscript in my work for a long time, I forgot a lot...
There is a camera in the scene. It is known that the camera class is Freecamera. I want to rename it using a script.

But that doesn't happen

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
for v in geometry do (
if (classof v == Freecamera) then
(
select v
$.name = "Camera"
)
)
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Comments (4)
andrej

About Class

I understood the reason. The camera does not belong to the Geometry class. How to go through all classes of objects in the scene?

Reply to andrej
miauu

.



for o in objects do ...



for o in objects where classOf o == FreeCamera do ...

miauu

.


(
	for c in cameras where classOf c == FreeCamera do c.name = "Camera"
)