From 89941a9d30d015c82f4bc68a96bb3606b6f54e00 Mon Sep 17 00:00:00 2001 From: ChristopheSeux Date: Sat, 9 Apr 2022 20:12:40 +0200 Subject: [PATCH] fix non existing bone --- picker.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/picker.py b/picker.py index f6168e4..02cd75d 100644 --- a/picker.py +++ b/picker.py @@ -372,12 +372,16 @@ class Picker: ) elif s['type'] == 'BONE': + bone = rig.pose.bones.get(s['bone']) + if not bone: + print(f'Bone {s["bone"]} not exist') + continue shape = BoneShape( self, points=s['points'], polygons=s['polygons'], edges=s['edges'], - bone=rig.pose.bones.get(s['bone']), + bone=bone, color=s['color'] ) @@ -527,7 +531,8 @@ def draw_callback_view(): return if ob not in PICKERS: - picker_path = Path(bpy.path.abspath(ob.data.rig_picker.source)) + picker_path = Path(bpy.path.abspath(ob.data.rig_picker.source, library=ob.data.library)) + print('Load picker from', picker_path.resolve()) picker_datas = json.loads(picker_path.read_text()) #shapes = [s.to_dict() for s in ob.data.rig_picker['shapes']] PICKERS[ob] = Picker(ob, shapes=picker_datas)