def set_bone_groups(): if do_mch: bg = Get.bone_group(rig, "BBone FK") if not bg: bg = New.bone_group(rig, "BBone FK", True) bone_mch.bone_group = bg if do_start_end: bg = Get.bone_group(rig, "BBone Stretch") if not bg: bg = New.bone_group(rig, "BBone Stretch", True) bone_start.bone_group = bone_end.bone_group = bg for name in self.center_bones[rig]: rig.pose.bones[name].bone_group = bg if do_in_out: bg = Get.bone_group(rig, "BBone Curve") if not bg: bg = New.bone_group(rig, "BBone Curve", True) bone_in.bone_group = bone_out.bone_group = bg if self.hide_bones.get(rig): bg = Get.bone_group(rig, "BBone Stretch [Hidden]") if not bg: bg = New.bone_group(rig, "BBone Stretch [Hidden]", 'THEME20') for name in self.hide_bones[rig]: rig.pose.bones[name].bone_group = bg
def reload_proxies(scn): for rig in bpy.data.objects: if not (Is.armature(rig) and not rig.library and rig.data.library): continue for src in bpy.data.objects: if (src.data == rig.data) and (src.library == rig.data.library): break else: # Can't find the original linked rig continue copy_custom(src, rig) copy_groups(src.pose.bone_groups, rig.pose.bone_groups) for pbone in rig.pose.bones: sbone = src.pose.bones.get(pbone.name) if not sbone: # Rig is proxy that was made local, incorrectly/incompletely continue elif (True, True) in zip(rig.data.layers_protected, pbone.bone.layers): # Bone is in a protected layer, so properties are locked and auto-reset continue if sbone.bone_group: try: pbone.bone_group = Get.bone_group(rig, name=sbone.bone_group.name) except: print(pbone, sbone) copy_constraints(sbone, pbone) copy_custom(sbone, pbone) copy_drivers(src, rig)