def _is_armature_context_with_fake_bones(context): if not _is_armature_context(context): return False for bone in _bones_from_context(context): if utils.is_fake_bone_name(bone.name): return True return False
def execute(self, context): bones = [ bone for bone in _bones_from_context(context) if utils.is_fake_bone_name(bone.name) ] hide = any((not bone.hide for bone in bones)) for bone in bones: bone.hide_viewport = hide return {'FINISHED'}
def execute(self, context): armature = context.object.data original_count = len(armature.bones) with utils.using_mode('EDIT'): bones = armature.edit_bones for bone in tuple(bones): if not utils.is_fake_bone_name(bone.name): continue bones.remove(bone) self.report( {'INFO'}, 'Removed %d fake bones' % (original_count - len(armature.bones)), ) return {'FINISHED'}
def _fake_hides(bones): return [bone.hide for bone in bones if is_fake_bone_name(bone.name)]