diff --git a/exact_edit/__init__.py b/exact_edit/__init__.py index 365bd5fa35de362b5839ce0900e8157cf4f08d90..014a2adcc2972e6a6a7532a613f10d407e6cf503 100644 --- a/exact_edit/__init__.py +++ b/exact_edit/__init__.py @@ -43,7 +43,7 @@ import bpy class XEDIT_PT_ui_pan(bpy.types.Panel): # Creates a panel in the 3d view N Panel bl_label = 'Exact Edit' - bl_idname = 'xedit_base_panel' + bl_idname = 'XEDIT_PT_base_panel' bl_space_type = 'VIEW_3D' bl_region_type = 'UI' #bl_context = 'objectmode' @@ -52,8 +52,8 @@ class XEDIT_PT_ui_pan(bpy.types.Panel): def draw(self, context): row = self.layout.row(align=True) col = row.column() - col.operator("view3d.xedit_set_meas_op", text="Set Measure", icon="EDIT") - col.operator("view3d.xedit_free_rotate_op", text="Free Rotate", icon="FORCE_MAGNETIC") + col.operator("view3d.xedit_set_meas_op", text="Set Measure") + col.operator("view3d.xedit_free_rotate_op", text="Free Rotate") classes = ( diff --git a/exact_edit/xedit_set_meas.py b/exact_edit/xedit_set_meas.py index dca44ee01c3585882d76abd13ff83b3ff925cedd..fbd72c2843a5e669e07ad5b9465e922d25dec7a5 100644 --- a/exact_edit/xedit_set_meas.py +++ b/exact_edit/xedit_set_meas.py @@ -1106,9 +1106,9 @@ def do_translation(new_co, old_co): # takes: ref_pts (ReferencePoints), s_fac (float) def do_scale(ref_pts, s_fac): # back up settings before changing them - piv_back = deepcopy(bpy.context.space_data.pivot_point) + piv_back = deepcopy(bpy.context.tool_settings.transform_pivot_point) curs_back = bpy.context.scene.cursor.location.copy() - bpy.context.space_data.pivot_point = 'CURSOR' + bpy.context.tool_settings.transform_pivot_point = 'CURSOR' bpy.context.scene.cursor.location = ref_pts[1].co3d.copy() ax_multip, cnstrt_bls = (), () if RotDat.axis_lock is None: @@ -1122,7 +1122,7 @@ def do_scale(ref_pts, s_fac): bpy.ops.transform.resize(value=ax_multip, constraint_axis=cnstrt_bls) # restore settings back to their pre "do_scale" state bpy.context.scene.cursor.location = curs_back.copy() - bpy.context.space_data.pivot_point = deepcopy(piv_back) + bpy.context.tool_settings.transform_pivot_point = deepcopy(piv_back) # end_a, piv_pt, and end_b are Vector based 3D coordinates @@ -1243,9 +1243,9 @@ def prep_rotation_info(curr_ms_stor, new_ms_stor): # 3D cursor using RotDat's ang_diff_r radian value. def do_rotate(self): # back up settings before changing them - piv_back = deepcopy(bpy.context.space_data.pivot_point) + piv_back = deepcopy(bpy.context.tool_settings.transform_pivot_point) curs_back = bpy.context.scene.cursor.location.copy() - bpy.context.space_data.pivot_point = 'CURSOR' + bpy.context.tool_settings.transform_pivot_point = 'CURSOR' bpy.context.scene.cursor.location = self.pts[2].co3d.copy() axis_lock = RotDat.axis_lock @@ -1266,7 +1266,7 @@ def do_rotate(self): # restore settings back to their pre "do_rotate" state bpy.context.scene.cursor.location = curs_back.copy() - bpy.context.space_data.pivot_point = deepcopy(piv_back) + bpy.context.tool_settings.transform_pivot_point = deepcopy(piv_back) # Updates lock points and changes curr_meas_stor to use measure based on @@ -1458,20 +1458,6 @@ def draw_callback_px(self, context): lk_pts2d = None # lock points 2D self.meas_btn.is_drawn = False # todo : cleaner btn activation - # if the addon_mode is WAIT_FOR_POPUP, wait on POPUP to disable - # popup_active, then run process_popup_input - # would prefer not to do pop-up check inside draw_callback, but not sure - # how else to check for input. need higher level "input handler" class? - if self.addon_mode == WAIT_FOR_POPUP: - global popup_active - if not popup_active: - process_popup_input(self) - set_help_text(self, "CLICK") - - elif self.addon_mode == GET_0_OR_180: - choose_0_or_180(RotDat.lock_pts[2], RotDat.rot_pt_pos, - RotDat.rot_pt_neg, RotDat.ang_diff_r, self.mouse_co) - # note, can't chain above if-elif block in with one below as # it breaks axis lock drawing if self.grab_pt is not None: # not enabled if mod_pt active @@ -1582,9 +1568,9 @@ def get_reg_overlap(): return rtoolsw -class XEditSetMeas(bpy.types.Operator): +class XEDIT_OT_set_meas(bpy.types.Operator): bl_idname = "view3d.xedit_set_meas_op" - bl_label = "XEdit Set Measaure" + bl_label = "Exact Edit Set Measure" # Only launch Add-On from OBJECT or EDIT modes @classmethod @@ -1592,6 +1578,7 @@ class XEditSetMeas(bpy.types.Operator): return context.mode == 'OBJECT' or context.mode == 'EDIT_MESH' def modal(self, context, event): + global popup_active context.area.tag_redraw() if event.type in {'A', 'MIDDLEMOUSE', 'WHEELUPMOUSE', @@ -1873,6 +1860,19 @@ class XEditSetMeas(bpy.types.Operator): exit_addon(self) return {'FINISHED'} + # if the addon_mode is WAIT_FOR_POPUP, wait on POPUP to disable + # popup_active, then run process_popup_input + # would prefer not to do pop-up check inside draw_callback, but not sure + # how else to check for input. need higher level "input handler" class? + if self.addon_mode == WAIT_FOR_POPUP: + if not popup_active: + process_popup_input(self) + set_help_text(self, "CLICK") + + elif self.addon_mode == GET_0_OR_180: + choose_0_or_180(RotDat.lock_pts[2], RotDat.rot_pt_pos, + RotDat.rot_pt_neg, RotDat.ang_diff_r, self.mouse_co) + return {'RUNNING_MODAL'} def invoke(self, context, event):