[Bf-blender-cvs] [a3202e4] master: Code cleanup: Re-use Grease Pencil panel for 3D view as well.

Thomas Dinges noreply at git.blender.org
Mon Feb 24 20:54:10 CET 2014


Commit: a3202e434a8bce94aa2e496787dda1856da080bf
Author: Thomas Dinges
Date:   Mon Feb 24 20:53:37 2014 +0100
https://developer.blender.org/rBa3202e434a8bce94aa2e496787dda1856da080bf

Code cleanup: Re-use Grease Pencil panel for 3D view as well.

===================================================================

M	release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py

===================================================================

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 97173f8..5dd1f94 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 db20057..b7e0cc5 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 @@
 # <pep8 compliant>
 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.




More information about the Bf-blender-cvs mailing list