広告
広告

Blender で選択したボーンを参照しているボーンを表示するスクリプト

カテゴリ:blender
import bpy

amt = bpy.context.active_object
bpy.ops.object.mode_set(mode='POSE')

selected = [b.name for b in amt.pose.bones if b.bone.select]
if len(selected) == 0:
    exit
    
children = []
refers = []
for b in amt.pose.bones:
    if b.parent and b.parent.name in selected:
        children.append(b.name)
    for c in b.constraints:
        if hasattr(c, 'subtarget') and c.subtarget in selected:
            refers.append(b.name)
            
# print refers
if len(refers) > 0:
    refers = list(set(refers))
    print('')
    print('=== bones refered to ===')
    for b in refers:
        print(b)
        
# print children
if len(children) > 0:
    print('')
    print('=== children ===')
    for c in children:
        print(c)

関連記事

Blender 記事の目次


広告
広告