diff --git a/OP_breakdowner.py b/OP_breakdowner.py index 46f91f8..082c666 100644 --- a/OP_breakdowner.py +++ b/OP_breakdowner.py @@ -325,14 +325,14 @@ def unregister_keymaps(): ### --- REGISTER --- def register(): - if not bpy.app.background: - bpy.utils.register_class(OBJ_OT_breakdown_obj_anim) - register_keymaps() + # if not bpy.app.background: + bpy.utils.register_class(OBJ_OT_breakdown_obj_anim) + register_keymaps() def unregister(): - if not bpy.app.background: - unregister_keymaps() - bpy.utils.unregister_class(OBJ_OT_breakdown_obj_anim) + # if not bpy.app.background: + unregister_keymaps() + bpy.utils.unregister_class(OBJ_OT_breakdown_obj_anim) if __name__ == "__main__": diff --git a/OP_copy_paste.py b/OP_copy_paste.py index 1fafa6e..719cc95 100644 --- a/OP_copy_paste.py +++ b/OP_copy_paste.py @@ -316,7 +316,7 @@ def copy_all_strokes_in_frame(frame=None, layers=None, obj=None): #print(stroke_list) return stroke_list -def add_stroke(s, frame, layer, obj): +def add_stroke(s, frame, layer, obj, select=False): '''add stroke on a given frame, (layer is for parentage setting)''' # print(3*'-',s) ns = frame.strokes.new() @@ -343,6 +343,9 @@ def add_stroke(s, frame, layer, obj): ns.points[i].co = ob_mat_inv @ mat @ ns.points[i].co# invert of object * invert of layer * coordinate else: setattr(ns.points[i], k, v) + if select: + ns.points[i].select = True + else: for i, pt in enumerate(s['points']): for k, v in pt.items(): @@ -351,18 +354,21 @@ def add_stroke(s, frame, layer, obj): ns.points[i].co = ob_mat_inv @ ns.points[i].co# invert of object * coordinate else: setattr(ns.points[i], k, v) + if select: + ns.points[i].select = True ## trigger updapte (in 2.93 fix some drawing problem with fills and UVs) ns.points.update() - + ## patch pressure 2 # ns.points.foreach_set('pressure', pressure_flat_list) -def add_multiple_strokes(stroke_list, layer=None, use_current_frame=True): +def add_multiple_strokes(stroke_list, layer=None, use_current_frame=True, select=False): ''' add a list of strokes to active frame of given layer if no layer specified, active layer is used if use_current_frame is True, a new frame will be created only if needed + if select is True, newly added strokes are selected ''' scene = bpy.context.scene obj = bpy.context.object @@ -388,7 +394,7 @@ def add_multiple_strokes(stroke_list, layer=None, use_current_frame=True): #or active exists but not aligned scene.current with use_current_frame disabled target_frame = layer.frames.new(fnum) - add_stroke(s, target_frame, layer, obj) + add_stroke(s, target_frame, layer, obj, select=select) ''' for s in stroke_data: add_stroke(s, target_frame) @@ -478,7 +484,7 @@ class GPCLIP_OT_paste_strokes(bpy.types.Operator): return {"CANCELLED"} print('data loaded', time() - t0) - add_multiple_strokes(data, use_current_frame=True) + add_multiple_strokes(data, use_current_frame=True, select=True) print('total_time', time() - t0) return {"FINISHED"} diff --git a/README.md b/README.md index 9b7601f..c1af299 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,9 @@ Panel in sidebar : 3D view > sidebar 'N' > Gpencil ## Changelog: +1.0.5: + +- GP copy-paste : Pasted stroke are now selected (allow to use it to quickly rip/split strokes with cut/paste on the same layer) 1.0.4: diff --git a/__init__.py b/__init__.py index 893a83a..0ca0c87 100644 --- a/__init__.py +++ b/__init__.py @@ -15,7 +15,7 @@ bl_info = { "name": "GP toolbox", "description": "Set of tools for Grease Pencil in animation production", "author": "Samuel Bernou", -"version": (1, 0, 4), +"version": (1, 0, 5), "blender": (2, 91, 0), "location": "sidebar (N menu) > Gpencil > Toolbox / Gpencil properties", "warning": "",