ScriptSpot home

Forum topic · General Scripting

rename camera problem

By dussla · 2014-06-17

Description

i make 3 camera
and after , i would like to change name

camera01 + taget
camera02 + tager
camera03 + taget

select $camera

i = 1
for o in selection

(
o.name = cam + i as sting

i = i + 1
)

after result = camera01 -> cam01 camera01 taget -> cam02

what problem ?

always thank youy

Comments (4)
fajar

local baseName = "my camera_"


baseName = "my camera_"  -- change whatever you want.
-- also you can change cameras to selection on the line below

for i=1 to cameras.count where classof cameras[i]!=targetObject do 
(
num= i as string
	cameras[i].name  = baseName + num
	cameras[i].target.name = baseName+"target_" + num
)
Stéphane

Try

obj = $selection as array
for i = 1 to obj.count do
(
obj[i].name = ( "cam"+ i as string )
)

Hope this help

Reply to Stéphane
dussla

camera taget name is other

i made camera01

there is camera01 / camere01-target

i excute your code

result

cam1 cam2

i want

cam1 cam1-target

Reply to dussla
dussla

really really rhank you

good work
really thank you always