Add support for expanding pose-bone custom pointers

This commit is contained in:
2014-12-05 15:48:27 +01:00
parent 06ac67772f
commit 25419a42fa

View File

@@ -270,8 +270,8 @@ class FilePath:
def iter_blocks_idlib(): def iter_blocks_idlib():
for block in blend.find_blocks_from_code(b'LI'): for block in blend.find_blocks_from_code(b'LI'):
# TODO, this should work but in fact mades some libs not link correctly. # TODO, this should work but in fact mades some libs not link correctly.
# if block[b'name'] in block_codes_idlib: if block[b'name'] in block_codes_idlib:
yield from block_expand(block, b'LI') yield from block_expand(block, b'LI')
else: else:
def iter_blocks_idlib(): def iter_blocks_idlib():
return blend.find_blocks_from_code(b'LI') return blend.find_blocks_from_code(b'LI')
@@ -568,6 +568,16 @@ class ExpandID:
yield block.get_pointer(b'proxy') yield block.get_pointer(b'proxy')
yield block.get_pointer(b'proxy_group') yield block.get_pointer(b'proxy_group')
# 'ob->pose->chanbase[...].custom'
block_pose = block.get_pointer(b'pose')
if block_pose is not None:
assert(block_pose.dna_type.dna_type_id == b'bPose')
sdna_index_bPoseChannel = block_pose.file.sdna_index_from_id[b'bPoseChannel']
for item in bf_utils.iter_ListBase(block_pose.get_pointer(b'chanbase.first')):
item_custom = item.get_pointer(b'custom', sdna_index_refine=sdna_index_bPoseChannel)
if item_custom is not None:
yield item_custom
@staticmethod @staticmethod
def expand_ME(block): # 'Mesh' def expand_ME(block): # 'Mesh'
yield from ExpandID._expand_generic_animdata(block) yield from ExpandID._expand_generic_animdata(block)