From fa3a0697b846bd0ed3766fcabd1bf6f260aa425a Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Tue, 7 Jan 2020 11:29:42 +0100 Subject: Annotations: Split annotation operators and pointer functions This allows to have annotation panels and grease pencil object panel at the same time. Differential Revision: https://developer.blender.org/D6467 --- .../bl_ui/properties_grease_pencil_common.py | 32 +++++++++++----------- .../startup/bl_ui/space_toolsystem_toolbar.py | 8 +++++- 2 files changed, 23 insertions(+), 17 deletions(-) (limited to 'release') diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py index 45cb10bb3bd..2001f46820f 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -581,9 +581,9 @@ class AnnotationDataPanel: def poll(cls, context): # Show this panel as long as someone that might own this exists # AND the owner isn't an object (e.g. GP Object) - if context.gpencil_data_owner is None: + if context.annotation_data_owner is None: return False - elif type(context.gpencil_data_owner) is bpy.types.Object: + elif type(context.annotation_data_owner) is bpy.types.Object: return False else: return True @@ -597,14 +597,14 @@ class AnnotationDataPanel: layout.use_property_decorate = False # Grease Pencil owner. - gpd_owner = context.gpencil_data_owner - gpd = context.gpencil_data + gpd_owner = context.annotation_data_owner + gpd = context.annotation_data # Owner selector. if context.space_data.type == 'CLIP_EDITOR': layout.row().prop(context.space_data, "grease_pencil_source", expand=True) - layout.template_ID(gpd_owner, "grease_pencil", new="gpencil.data_add", unlink="gpencil.data_unlink") + layout.template_ID(gpd_owner, "grease_pencil", new="gpencil.annotation_add", unlink="gpencil.data_unlink") # List of layers/notes. if gpd and gpd.layers: @@ -624,17 +624,17 @@ class AnnotationDataPanel: col = row.column() sub = col.column(align=True) - sub.operator("gpencil.layer_add", icon='ADD', text="") - sub.operator("gpencil.layer_remove", icon='REMOVE', text="") + sub.operator("gpencil.layer_annotation_add", icon='ADD', text="") + sub.operator("gpencil.layer_annotation_remove", icon='REMOVE', text="") - gpl = context.active_gpencil_layer + gpl = context.active_annotation_layer if gpl: if len(gpd.layers) > 1: col.separator() sub = col.column(align=True) - sub.operator("gpencil.layer_move", icon='TRIA_UP', text="").type = 'UP' - sub.operator("gpencil.layer_move", icon='TRIA_DOWN', text="").type = 'DOWN' + sub.operator("gpencil.layer_annotation_move", icon='TRIA_UP', text="").type = 'UP' + sub.operator("gpencil.layer_annotation_move", icon='TRIA_DOWN', text="").type = 'DOWN' tool_settings = context.tool_settings if gpd and gpl: @@ -653,7 +653,7 @@ class AnnotationDataPanel: else: lock_label = iface_("Lock Frame") row.prop(gpl, "lock_frame", text=lock_label, icon='UNLOCKED') - row.operator("gpencil.active_frame_delete", text="", icon='X') + row.operator("gpencil.annotation_active_frame_delete", text="", icon='X') class AnnotationOnionSkin: @@ -665,26 +665,26 @@ class AnnotationOnionSkin: def poll(cls, context): # Show this panel as long as someone that might own this exists # AND the owner isn't an object (e.g. GP Object) - if context.gpencil_data_owner is None: + if context.annotation_data_owner is None: return False - elif type(context.gpencil_data_owner) is bpy.types.Object: + elif type(context.annotation_data_owner) is bpy.types.Object: return False else: - gpl = context.active_gpencil_layer + gpl = context.active_annotation_layer if gpl is None: return False return True def draw_header(self, context): - gpl = context.active_gpencil_layer + gpl = context.active_annotation_layer self.layout.prop(gpl, "use_annotation_onion_skinning", text="") def draw(self, context): layout = self.layout layout.use_property_decorate = False - gpl = context.active_gpencil_layer + gpl = context.active_annotation_layer col = layout.column() split = col.split(factor=0.5) split.active = gpl.use_annotation_onion_skinning diff --git a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py index e0f3a03733e..170b635f7e1 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_toolbar.py @@ -2115,6 +2115,8 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): _defs_gpencil_paint.curve, _defs_gpencil_paint.box, _defs_gpencil_paint.circle, + None, + *_tools_annotate, ], 'EDIT_GPENCIL': [ *_tools_gpencil_select, @@ -2129,11 +2131,13 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): _defs_gpencil_edit.shear, _defs_gpencil_edit.tosphere, ), - + None, + *_tools_annotate, ], 'SCULPT_GPENCIL': [ _defs_gpencil_sculpt.generate_from_brushes, None, + *_tools_annotate, lambda context: ( VIEW3D_PT_tools_active._tools_gpencil_select if _defs_gpencil_sculpt.poll_select_mask(context) @@ -2142,6 +2146,8 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel): ], 'WEIGHT_GPENCIL': [ _defs_gpencil_weight.generate_from_brushes, + None, + *_tools_annotate, ], } -- cgit v1.2.3