[Bf-blender-cvs] [c1bededd1c4] greasepencil-object: WIP: UI panels reorganization

Antonio Vazquez noreply at git.blender.org
Wed Jun 7 13:11:23 CEST 2017


Commit: c1bededd1c4cba7f94747c01b99dc110a9bbd882
Author: Antonio Vazquez
Date:   Wed Jun 7 13:11:07 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rBc1bededd1c4cba7f94747c01b99dc110a9bbd882

WIP: UI panels reorganization

Moved the stroke placement to bottom of the viewport instead of Tools panel.

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

M	release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/makesrna/intern/rna_scene.c

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

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 14e51c06289..cd896930581 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -37,35 +37,11 @@ def gpencil_stroke_placement_settings(context, layout):
 
     col = layout.column(align=True)
 
-    col.label(text="Stroke Placement:")
-
-    row = col.row(align=True)
-    row.prop_enum(ts, propname, 'VIEW')
-    if ts.grease_pencil_source != 'OBJECT' or context.space_data.type != 'VIEW_3D':
-        row.prop_enum(ts, propname, 'CURSOR')
-    else:
-        row.prop_enum(ts, propname, 'CURSOR', text='Origin')
-
-    if context.space_data.type == 'VIEW_3D':
-        row = col.row(align=True)
-        row.prop_enum(ts, propname, 'SURFACE')
-        row.prop_enum(ts, propname, 'STROKE')
-
-        row = col.row(align=False)
-        row.active = getattr(ts, propname) in {'SURFACE', 'STROKE'}
-        row.prop(ts, "use_gpencil_stroke_endpoints")
-
-        row = col.row(align=True)
-        row.label("Lock axis:")
-        row = col.row(align=True)
-        if ts.gpencil_stroke_placement_view3d != 'CURSOR':
-            row.active = False
-        row.prop(ts.gpencil_sculpt, "lockaxis", expand=True)
-
+    if context.space_data.type != 'VIEW_3D':
+        col.label(text="Stroke Placement:")
         row = col.row(align=True)
-        if ts.gpencil_stroke_placement_view3d != 'CURSOR' or ts.grease_pencil_source != 'OBJECT':
-            row.active = False
-        row.prop(ts, "use_gpencil_3dcursor")
+        row.prop_enum(ts, propname, 'VIEW')
+        row.prop_enum(ts, propname, 'CURSOR', text='Cursor')
 
 
 def gpencil_active_brush_settings_simple(context, layout):
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index d5bf6a6de1c..c88288ff456 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -130,6 +130,19 @@ class VIEW3D_HT_header(Header):
             row.operator("pose.paste", text="", icon='PASTEFLIPDOWN').flipped = True
 
         # GPencil
+        if context.active_object.type == 'GPENCIL':
+            ob = context.active_object
+            if ob.grease_pencil.is_stroke_paint_mode:
+                row.separator()
+                row.prop(toolsettings, "gpencil_stroke_placement_view3d", text='')
+                if toolsettings.gpencil_stroke_placement_view3d == 'CURSOR':
+                    row.separator()
+                    row.prop(toolsettings.gpencil_sculpt, "lockaxis", text='')
+                    row.prop(toolsettings, "use_gpencil_3dcursor")
+
+                if toolsettings.gpencil_stroke_placement_view3d in ('SURFACE', 'STROKE'):
+                    row.prop(toolsettings, "use_gpencil_stroke_endpoints")
+
         if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode:
             row = layout.row(align=True)
             row.operator("gpencil.copy", text="", icon='COPYDOWN')
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 8a8b0a065d6..d3635561255 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -3451,10 +3451,10 @@ static void rna_def_tool_settings(BlenderRNA  *brna)
 	};
 	
 	static EnumPropertyItem gpencil_stroke_placement_items[] = {
-		{GP_PROJECT_VIEWSPACE, "CURSOR", 0, "Cursor", "Draw stroke at the 3D cursor or Object origin"},
-		{0, "VIEW", 0, "View", "Stick stroke to the view "}, /* weird, GP_PROJECT_VIEWALIGN is inverted */
-		{GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_VIEW, "SURFACE", 0, "Surface", "Stick stroke to surfaces"},
-		{GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_STROKE, "STROKE", 0, "Stroke", "Stick stroke to other strokes"},
+		{GP_PROJECT_VIEWSPACE, "CURSOR", ICON_CURSOR, "Origin", "Draw stroke at the Object origin or 3D cursor"},
+		{0, "VIEW", ICON_VISIBLE_IPO_ON, "View", "Stick stroke to the view "}, /* weird, GP_PROJECT_VIEWALIGN is inverted */
+		{GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_VIEW, "SURFACE", ICON_FACESEL, "Surface", "Stick stroke to surfaces"},
+		{GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_STROKE, "STROKE", ICON_GREASEPENCIL, "Stroke", "Stick stroke to other strokes"},
 		{0, NULL, 0, NULL, NULL}
 	};




More information about the Bf-blender-cvs mailing list