diff --git a/CHANGELOG.md b/CHANGELOG.md index c546a82..fdc70f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +4.1.3 + +- fixed: error in "remove stroke duplication" using file checker 4.1.2 diff --git a/OP_file_checker.py b/OP_file_checker.py index 5f42578..669bb7c 100755 --- a/OP_file_checker.py +++ b/OP_file_checker.py @@ -15,24 +15,26 @@ def remove_stroke_exact_duplications(apply=True): :apply: Remove the duplication instead of just listing dupes return number of duplication found/deleted ''' - # TODO: add additional check of material (even if unlikely to happen) + # TODO: Add additional check of material (even if unlikely to happen, better to avoid false positive) ct = 0 - gp_datas = [gp for gp in bpy.data.grease_pencils] + gp_datas = [gp for gp in bpy.data.grease_pencils_v3] for gp in gp_datas: for l in gp.layers: for f in l.frames: stroke_list = [] - for s in reversed(f.drawing.strokes): - - point_list = [p.position for p in s.points] - + idx_to_delete = [] + + for idx, s in enumerate(f.drawing.strokes): + point_list = [p.position.copy() for p in s.points] if point_list in stroke_list: ct += 1 - if apply: - # Remove redundancy - f.drawing.strokes.remove(s) + idx_to_delete.append(idx) else: stroke_list.append(point_list) + + if apply: + # Remove redundancy + f.drawing.remove_strokes(indices=idx_to_delete) return ct class GPTB_OT_file_checker(bpy.types.Operator): bl_idname = "gp.file_checker" @@ -267,6 +269,7 @@ class GPTB_OT_file_checker(bpy.types.Operator): bpy.context.scene.tool_settings.lock_object_mode = False if fix.remove_redundant_strokes: + print('removing redundant strokes') ct = remove_stroke_exact_duplications(apply=apply) if ct > 0: mess = f'Removed {ct} strokes duplications' if apply else f'Found {ct} strokes duplications' @@ -274,7 +277,7 @@ class GPTB_OT_file_checker(bpy.types.Operator): # ## Set onion skin filter to 'All type' # fix_kf_type = 0 - # for gp in bpy.data.grease_pencils:#from data + # for gp in bpy.data.grease_pencils_v3:#from data # if not gp.is_annotation: # if gp.onion_keyframe_type != 'ALL': # gp.onion_keyframe_type = 'ALL' diff --git a/OP_palettes_linker.py b/OP_palettes_linker.py index bd0d85a..cb17b44 100644 --- a/OP_palettes_linker.py +++ b/OP_palettes_linker.py @@ -166,7 +166,7 @@ class GPTB_OT_import_obj_palette(Operator): # unlink objects and their gp data for src_ob in linked_objs: - bpy.data.grease_pencils.remove(src_ob.data) + bpy.data.grease_pencils_v3.remove(src_ob.data) return {"FINISHED"} diff --git a/__init__.py b/__init__.py index 41c752f..810dfa5 100755 --- a/__init__.py +++ b/__init__.py @@ -4,7 +4,7 @@ bl_info = { "name": "GP toolbox", "description": "Tool set for Grease Pencil in animation production", "author": "Samuel Bernou, Christophe Seux", -"version": (4, 1, 2), +"version": (4, 1, 3), "blender": (4, 3, 0), "location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties", "warning": "", diff --git a/properties.py b/properties.py index 94c3534..b14ea6f 100755 --- a/properties.py +++ b/properties.py @@ -11,10 +11,12 @@ from bpy.props import ( from .OP_cursor_snap_canvas import cursor_follow_update from .OP_layer_manager import layer_name_build -def change_edit_lines_opacity(self, context): - for gp in bpy.data.grease_pencils: - if not gp.is_annotation: - gp.edit_line_color[3]=self.edit_lines_opacity + +## Obsolete: Gpv3 has no edit line color anymore +# def change_edit_lines_opacity(self, context): +# for gp in bpy.data.grease_pencils: +# if not gp.is_annotation: +# gp.edit_line_color[3]=self.edit_lines_opacity def update_layer_name(self, context):