I’ve been making a little script to automate the adding of a camera setup I frequently use.
However, when I get to the step of parenting the ring lights to my camera, its where it gets confusing.
Using the normal parenting functions works perfectly fine, but then the lights jump position. The internet has suggested using the inverse_matrix_parent function instead. But this gives me an error. Could anyone shed some light on what I am doing wrong? Below you will find the relevant code.
It is the last line that gives me the following error: ValueError: bpy_struct: item.attr = val: sequence expected at dimension 1, not ‘Object’
Is it expecting some sort of array of values? if I use the normal set_parent it works fine.
Is there some other way I should approach parenting the lamps to the camera?
#Create new light #lamp location for i in range(0,amount): lampData = bpy.data.lights.new('Area_light', "AREA") lampObject = bpy.data.objects.new('Area_light', lampData) #location lampObject.location.x = 5*math.cos(i) + camObject.location.x lampObject.location.z = 5*math.sin(i) + camObject.location.z lampObject.location.y = camObject.location.y #parent lampObject.matrix_parent_inverse = camObject