Commit de369b12 authored by Bruno Laurencich's avatar Bruno Laurencich

fix missing helpers crashes

parent f3e7c2f0
......@@ -53,7 +53,8 @@ class Armature_Handler:
self.object = armature_object
self.meshes = [ch for ch in armature_object.children if ch.type== "MESH"]
self.helpers = {ob.name: ob for ob in helpers.children }
if helpers:
self.helpers = {ob.name: ob for ob in helpers.children }
self.pose = self.object.pose.bones
self.bones = self.object.data.bones
self.arm_repr = {}
......@@ -87,7 +88,10 @@ class Armature_Handler:
def __del__(self):
for m in self.meshes: m.hide = False
for key,h in self.helpers.items(): h.hide = True
try:
for key,h in self.helpers.items(): h.hide = True
except Exception:
pass
def set_key(self, context):
......@@ -104,7 +108,11 @@ class Armature_Handler:
def put_quad_on_bones(self, bone_name, quat):
self.helpers[bone_name].rotation_quaternion = quat
try:
self.helpers[bone_name].rotation_quaternion = quat
except Exception:
pass
b = self.arm_repr[bone_name]
# for key, b in self.arm_repr.items():
......@@ -119,7 +127,11 @@ class Armature_Handler:
def get_rot_diff(self):
for m in self.meshes: m.hide = False
for key, b in self.arm_repr.items():
self.helpers[key].hide = True
try:
self.helpers[key].hide = True
except Exception:
pass
q0 = b["local_q"].conjugated() * b['avg_quat'].copy() * b["local_q"]
b["diff_quat"] = self.object.pose.bones[key].rotation_quaternion.rotation_difference(q0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment