diff --git a/CHANGELOG.md b/CHANGELOG.md index 76f79c6..e3e1bdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +1.7.3 + +- added: show/hide gp modifiers if they are showed in render (in subpanel `Animation Manager`) + 1.7.2 - added: `Object visibility conflict` in file check diff --git a/OP_helpers.py b/OP_helpers.py index fdddec9..1f8dce5 100644 --- a/OP_helpers.py +++ b/OP_helpers.py @@ -1,3 +1,4 @@ +from time import ctime import bpy from mathutils import Vector#, Matrix from pathlib import Path @@ -311,7 +312,7 @@ class GPTB_OT_reset_cam_rot(bpy.types.Operator): class GPTB_OT_toggle_mute_animation(bpy.types.Operator): bl_idname = "gp.toggle_mute_animation" - bl_label = "Toggle animation mute" + bl_label = "Toggle Animation Mute" bl_description = "Enable/Disable animation evaluation\n(shift+clic to affect selection only)" bl_options = {"REGISTER"} @@ -349,6 +350,34 @@ class GPTB_OT_toggle_mute_animation(bpy.types.Operator): return {'FINISHED'} +class GPTB_OT_toggle_hide_gp_modifier(bpy.types.Operator): + bl_idname = "gp.toggle_hide_gp_modifier" + bl_label = "Toggle Modifier Hide" + bl_description = "Show/Hide gp objects modifier (only touch modifier that are showed in render)\n(shift+clic to affect selection only)" + bl_options = {"REGISTER"} + + show : bpy.props.BoolProperty(default=True, options={'SKIP_SAVE'}) + + def invoke(self, context, event): + self.selection = event.shift + return self.execute(context) + + def execute(self, context): + if self.selection: + pool = context.selected_objects + else: + pool = context.scene.objects + for o in pool: + if o.type != 'GPENCIL': + continue + for m in o.grease_pencil_modifiers: + # skip modifier that are not visible in render + if not m.show_render: + continue + m.show_viewport = self.show + + return {'FINISHED'} + class GPTB_OT_list_disabled_anims(bpy.types.Operator): bl_idname = "gp.list_disabled_anims" bl_label = "List Disabled Anims" @@ -523,6 +552,7 @@ GPTB_OT_draw_cam, GPTB_OT_set_view_as_cam, GPTB_OT_reset_cam_rot, GPTB_OT_toggle_mute_animation, +GPTB_OT_toggle_hide_gp_modifier, GPTB_OT_list_disabled_anims, GPTB_OT_clear_active_frame, GPTB_OT_check_canvas_alignement, diff --git a/UI_tools.py b/UI_tools.py index b03b348..9c378c3 100644 --- a/UI_tools.py +++ b/UI_tools.py @@ -195,7 +195,8 @@ class GPTB_PT_anim_manager(bpy.types.Panel): ops.skip_gp = True ops.skip_obj = False ops.mute = True - ## Gps + + ## GPs row = col.row(align=True) row.label(text='Gp anims:') ops = row.operator('gp.toggle_mute_animation', text = 'ON')#, icon = 'GRAPH' @@ -207,6 +208,12 @@ class GPTB_PT_anim_manager(bpy.types.Panel): ops.skip_gp = False ops.skip_obj = True ops.mute = True + + ## GP modifiers + row = col.row(align=True) + row.label(text='Gp modifiers:') + row.operator('gp.toggle_hide_gp_modifier', text = 'ON').show = True + row.operator('gp.toggle_hide_gp_modifier', text = 'OFF').show = False ## This can go in an extra category... col = layout.column() diff --git a/__init__.py b/__init__.py index e66b141..de10abc 100755 --- 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, Christophe Seux", -"version": (1, 7, 2), +"version": (1, 7, 3), "blender": (2, 91, 0), "location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties", "warning": "",