Dont get/set value in projectors wiht python

Hello. I’m doing a script python and I have a problem. I want to access: http://www.blender.org/documentation/blender_python_api_2_61_0/bpy.types.UVProjector.html#bpy.types.UVProjector.object , but this read-only mode and I am not able to get or set any value for this parameter. Does anyone know how? Thank you.

Example:
ob = bpy.context.active_object
ob.modifiers[‘UVProject’].projectors = “Camera”

Traceback (most recent call last):
File “<blender_console>”, line 1, in <module>
AttributeError: bpy_struct: attribute “projectors” from “UVProjectModifier” is read-only

Yeah, you can’t do that directly. Basically if you can right-click on the parameter in the GUI and it has an Insert Keyframe in it’s menu you can write to the value with a script. But if not, that value is read-only and can not be changed with scripting.

Looking at the console, it works like this


ob = bpy.context.object
camera1 = bpy.data.objects["Camera"]
camera2 = bpy.data.objects["Camera.001"]
mod = ob.modifiers["UVProject"]
mod.projector_count = 2
mod.projectors[0].object = camera1
mod.projectors[1].object = camera2

projectors is a collection.

But in the field does not seem to UV map insert keyframes, but if I can change as:

ob.modifiers[‘UVProject’].uv_layer = “UVTex”
if ob.modifiers[‘UVProject’].uv_layer == ‘’:
ob.modifiers[‘UVProject’].uv_layer = “UVMap”

Thanks!! :smiley: