diff --git a/area.py b/area.py index 3ada21c..9add478 100644 --- a/area.py +++ b/area.py @@ -155,6 +155,7 @@ classes = ( def register(): + # Remove the tools inside the picker space bpy.types.WM_OT_tool_set_by_id._execute = bpy.types.WM_OT_tool_set_by_id.execute #tool_set_by_id bpy.types.WM_OT_tool_set_by_id.execute = tool_set_by_id diff --git a/core/picker.py b/core/picker.py index ed84ddc..d5630f1 100644 --- a/core/picker.py +++ b/core/picker.py @@ -459,7 +459,7 @@ class Picker: if shape.type == 'bone' and shape.hover: shape.assign_bone_event() - bpy.ops._rigpicker.save_picker(index=self.index) + bpy.ops.rigpicker.save_picker(index=self.index) def press_event(self, mode='SET'): for shape in self.shapes: @@ -712,7 +712,7 @@ class PickerGroup: def load_picker_data(rig): if 'pickers' in rig.data.rig_picker: - picker_datas = [p.to_dict() for p in rig.rig_picker['pickers']] + picker_datas = [[s.to_dict() for s in p] for p in rig.data.rig_picker['pickers']] else: picker_datas = [] diff --git a/core/shape.py b/core/shape.py index a6cbb10..9eef4ef 100644 --- a/core/shape.py +++ b/core/shape.py @@ -93,7 +93,7 @@ def get_shape_data(ob, matrix=None, depsgraph=None): for vert in mesh.vertices: co = matrix @ (ob.matrix_world @ Vector(vert.co)) - points.append([round(co[0]), round(co[1])]) + points.append([round(co[0], 1), round(co[1], 1)]) depths += [co[2]] diff --git a/gizmo.py b/gizmo.py index f0a16b2..17f5721 100644 --- a/gizmo.py +++ b/gizmo.py @@ -68,6 +68,8 @@ class RP_GT_gizmo(Gizmo): context.region.tag_redraw() + #print(location) + return -1 diff --git a/operators/picker.py b/operators/picker.py index ae884ae..77d7f33 100644 --- a/operators/picker.py +++ b/operators/picker.py @@ -392,24 +392,19 @@ class RP_OT_reload_picker(Operator): # return def execute(self, context): - #PICKERS.clear() if context.object.type == 'ARMATURE': rig = context.object else: collection = get_picker_collection(context.object) rig = collection.rig_picker.rig + #print('Reload', rig) load_picker_data(rig) - ''' for area in context.screen.areas: - #print(area.type, is_picker_space(area.spaces.active)) if is_picker_space(area.spaces.active): - - print('Tag Redraw Region', area.type) - area.regions[0].tag_redraw() area.tag_redraw() - ''' + return {"FINISHED"} @@ -551,7 +546,8 @@ class RP_MT_context_menu(Menu): def draw(self, context): layout = self.layout col = layout.column() - col.use_property_split = True + col.operator_context = 'INVOKE_DEFAULT' + #col.use_property_split = True ob = context.object picker = PICKERS.get(ob) @@ -561,9 +557,25 @@ class RP_MT_context_menu(Menu): else: bone = context.active_pose_bone + # Draw Space Switch Operator + if getattr(ob.data, 'space_switch'): + space_switch = ob.data.space_switch + + data_paths = [f'pose.bones["{bone.name}"]["{k}"]' for k in bone.keys()] + space_bone = next((s for s in space_switch.bones if s.data_path in data_paths), None) + if space_bone: + + index = list(space_switch.bones).index(space_bone) + value = ob.path_resolve(space_bone.data_path) + space = next((s.name for s in space_bone.spaces if s.value == value), None) + + op = col.operator("spaceswitch.change_space", text=f'({space})', icon='PINNED') + op.index=index + col.separator() + if bone: for key in bone.keys(): - layout.prop(bone,f'["{key}"]', slider=True) + col.prop(bone,f'["{key}"]', slider=True) #layout.operator("rigpicker.show_bone_layer", text="Show Bone Layer", ).type = 'ACTIVE' #layout.operator("rigidbody.objects_add", text="B Add Passive").type = 'PASSIVE' diff --git a/operators/shape.py b/operators/shape.py index c74d8c3..6825a77 100644 --- a/operators/shape.py +++ b/operators/shape.py @@ -222,7 +222,6 @@ class RP_OT_save_picker(Operator): bpy.ops.rigpicker.reload_picker() - return {'FINISHED'} classes = (