__author__ = 'thoth'
import bpy
def report(path_blocks, name, path_anim, action):
print("%s[%r].animation_data.%s = bpy.data.actions[%r]"%(path_blocks, name, path_anim, action.name))
def scan_datablock(block, path, action):
ad = block.animation_data
if ad is None:
return
if ad.action == action:
report(path, block.name, "action", action)
def check_datablocks(datablocks, path, action):
for block in datablocks:
scan_datablock(block, path, action)
def enumerate_users_of_action(action):
check_datablocks(bpy.data.objects, "bpy.data.objects", action)
#
enumerate_users_of_action(bpy.data.actions[3000])
|
Blender python API quick-start
Syntax highlighting by Pygments.