Hi,
Does anyone know a way to check if a scene contains a type of object. For example
if Scene contains Camera:
print('yes')
not:
if scene contains 'Camera.001':
print('yes')
Thanks
Tom
Hi,
Does anyone know a way to check if a scene contains a type of object. For example
if Scene contains Camera:
print('yes')
not:
if scene contains 'Camera.001':
print('yes')
Thanks
Tom
you could make a list of object types…
import bpy
types = [obj.type for obj in bpy.context.scene.objects]
for t in types:
print (t)
if "CAMERA" in types: print ("there is a camera")
Okay, so I’ve got this:
types = [obj.type for obj in bpy.data.scenes['Scene.001'].objects]
for t in types:
print (t)
if "CAMERA" in types:
pass
else:
bpy.data.cameras.new('Cam')
How do I link this camera to a scene other than the active one?
Thanks
Tom