If there is an object which has a property that which varies with each frame, would it be possible to to build a script that can access that property before each frame is rendered and thus change another property?
1 Answer
One way is by using drivers. Drivers allow you to calculate a value to use, this may be from other values in the same object, or from other objects. This answer provides examples. Also consider that drivers may be disabled by the user.
Another way is to setup a handler function. You could choose between using frame_change_post
or a render_pre
. You simply define your function and then append it to the handler list, then remove it when it is no longer needed.
def my_handler(scene):
val = scene.objects['Cube'].location.x
scene.objects['Sphere'].location.y = val + 1.6
def register():
bpy.app.handlers.frame_change_post.append(my_handler)
def unregister():
bpy.app.handlers.frame_change_post.remove(my_handler)
bpy.app.handlers.frame_change_post
with a function as a parameter. Check the API here: blender.org/api/blender_python_api_2_60_6/bpy.app.handlers.html $\endgroup$