3
$\begingroup$

I can access and add the UV Map attribute using this code:

bpy.context.object.modifiers["UVProject"].uv_layer = "projectionunwrap"

But when I try to do it with project object it fails:

bpy.context.object.modifiers["UVProject"].projectors.object = bpy.data.objects["Camera"]

with the error:

AttributeError: `'bpy_prop_collection' object has no attribute 'clear'

When I try different method it says:

projectors" from "UVProjectModifier" is read-only

enter image description here

I want to choose Camera as a projector.

$\endgroup$

1 Answer 1

2
$\begingroup$

The projectors attribute is a list. You have to access index 0 to make it work:

bpy.context.object.modifiers["UVProject"].projectors[0].object = bpy.data.objects["Camera"]
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .