From a3202e434a8bce94aa2e496787dda1856da080bf Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Mon, 24 Feb 2014 20:53:37 +0100 Subject: Code cleanup: Re-use Grease Pencil panel for 3D view as well. --- .../bl_ui/properties_grease_pencil_common.py | 6 +++++ .../scripts/startup/bl_ui/space_view3d_toolbar.py | 30 +++------------------- 2 files changed, 10 insertions(+), 26 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 97173f8c305..5dd1f94747c 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -42,3 +42,9 @@ class GreasePencilPanel(): row = col.row(align=True) row.prop(context.tool_settings, "use_grease_pencil_sessions") + if context.space_data.type == 'VIEW_3D': + col.separator() + + col.label(text="Measure:") + col.operator("view3d.ruler") + diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index db20057318f..b7e0cc5235d 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -19,6 +19,7 @@ # import bpy from bpy.types import Menu, Panel +from bl_ui.properties_grease_pencil_common import GreasePencilPanel from bl_ui.properties_paint_common import ( UnifiedPaintPanel, brush_texture_settings, @@ -50,26 +51,6 @@ def draw_keyframing_tools(context, layout): row.operator("anim.keyframe_delete_v3d", text="Remove") -# Grease Pencil tools -def draw_gpencil_tools(context, layout): - col = layout.column(align=True) - - row = col.row(align=True) - row.operator("gpencil.draw", text="Draw").mode = 'DRAW' - row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT' - row = col.row(align=True) - row.operator("gpencil.draw", text="Poly").mode = 'DRAW_POLY' - row.operator("gpencil.draw", text="Erase").mode = 'ERASER' - - col.separator() - - col.prop(context.tool_settings, "use_grease_pencil_sessions") - - col.separator() - - col.label(text="Measure:") - col.operator("view3d.ruler") - # ********** default tools for object-mode **************** @@ -1614,13 +1595,10 @@ class VIEW3D_PT_tools_particlemode(View3DPanel, Panel): # Grease Pencil tools -class VIEW3D_PT_tools_greasepencil(View3DPanel, Panel): +class VIEW3D_PT_tools_grease_pencil(GreasePencilPanel, Panel): + bl_space_type = 'VIEW_3D' + bl_region_type = 'TOOLS' bl_category = "Grease Pencil" - bl_label = "Grease Pencil" - - def draw(self, context): - layout = self.layout - draw_gpencil_tools(context, layout) if __name__ == "__main__": # only for live edit. -- cgit v1.2.3