diff --git a/OP_cursor_snap_canvas.py b/OP_cursor_snap_canvas.py index dcae665..e2a65ac 100644 --- a/OP_cursor_snap_canvas.py +++ b/OP_cursor_snap_canvas.py @@ -119,7 +119,7 @@ def cursor_follow_update(self, context): if self.cursor_follow:#True if not cursor_follow.__name__ in [hand.__name__ for hand in bpy.app.handlers.frame_change_post]: if context.object: - prev_matrix = context.object.matrix_world + prev_matrix = context.object.matrix_world.copy() bpy.app.handlers.frame_change_post.append(cursor_follow) @@ -131,7 +131,6 @@ def cursor_follow_update(self, context): def cursor_follow(scene): '''Handler to make the cursor follow active object matrix changes on frame change''' - ## TODO update global prev_matrix to equal current_matrix on selection change (need another handler)... if not bpy.context.object: return global prev_matrix @@ -148,9 +147,7 @@ def cursor_follow(scene): ## translation only # scene.cursor.location += (current_matrix - prev_matrix).to_translation() - - # print('offset:', (current_matrix - prev_matrix).to_translation()) - + ## full scene.cursor.location = current_matrix @ (prev_matrix.inverted() @ scene.cursor.location) @@ -164,11 +161,10 @@ def selection_changed(): """Callback function for selection changes""" if not bpy.context.scene.gptoolprops.cursor_follow: return - print('select_changed') global prev_matrix, prev_active_obj if prev_active_obj != bpy.context.object: ## Set stored matrix to active object - prev_matrix = bpy.context.object.matrix_world + prev_matrix = bpy.context.object.matrix_world.copy() prev_active_obj = bpy.context.object ## Note: Same owner as layer manager (will be removed as well) @@ -197,15 +193,15 @@ def register(): # swap_keymap_by_id('view3d.cursor3d','view3d.cursor_snap')#auto swap to custom GP snap wrap ## Follow cursor matrix update on object change - # bpy.app.handlers.load_post.append(subscribe_object_change_handler) # select_change + bpy.app.handlers.load_post.append(subscribe_object_change_handler) # select_change # ## Directly set msgbus to work at first addon activation # select_change - # bpy.app.timers.register(subscribe_object_change, first_interval=1) # select_change + bpy.app.timers.register(subscribe_object_change, first_interval=1) # select_change ## No need to frame_change_post.append(cursor_follow). Added by property update, when activating 'cursor follow' def unregister(): - # bpy.app.handlers.load_post.remove(subscribe_object_change_handler) # select_change + bpy.app.handlers.load_post.remove(subscribe_object_change_handler) # select_change # swap_keymap_by_id('view3d.cursor_snap','view3d.cursor3d')#Restore normal snap diff --git a/OP_file_checker.py b/OP_file_checker.py index 415982d..4df5bda 100755 --- a/OP_file_checker.py +++ b/OP_file_checker.py @@ -73,7 +73,6 @@ class GPTB_OT_file_checker(bpy.types.Operator): problems = [] ## Old method : Apply fixes based on pref (inverted by ctrl key) - # apply = not fix.check_only # # If Ctrl is pressed, invert behavior (invert boolean) # apply ^= self.ctrl