[Bf-blender-cvs] [963d668a039] blender2.8: GP: Move origin selector to center and convert to popup

Antonioya noreply at git.blender.org
Thu Sep 20 18:50:27 CEST 2018


Commit: 963d668a03991072b8fef6e70f0d105ff146735b
Author: Antonioya
Date:   Thu Sep 20 18:50:07 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB963d668a03991072b8fef6e70f0d105ff146735b

GP: Move origin selector to center and convert to popup

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

M	release/scripts/startup/bl_ui/space_topbar.py
M	release/scripts/startup/bl_ui/space_view3d.py

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

diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 88af0c53c3d..54498abfc7c 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -184,12 +184,6 @@ class TOPBAR_HT_lower_bar(Header):
             layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".particlemode", category="")
         elif mode == 'OBJECT':
             layout.popover_group(space_type='PROPERTIES', region_type='WINDOW', context=".objectmode", category="")
-        elif mode in ('GPENCIL_EDIT', 'GPENCIL_WEIGHT'):
-            layout.label(text="Layer:")
-            layout.popover(
-                panel="TOPBAR_PT_gpencil_layers",
-                text=txt
-            )
         elif mode == 'GPENCIL_PAINT':
             layout.label(text="Layer:")
             layout.popover(
@@ -197,20 +191,15 @@ class TOPBAR_HT_lower_bar(Header):
                 text=txt
             )
 
-            layout.prop(context.tool_settings, "gpencil_stroke_placement_view3d", text='')
-            if context.tool_settings.gpencil_stroke_placement_view3d in ('ORIGIN', 'CURSOR'):
-                layout.prop(context.tool_settings.gpencil_sculpt, "lockaxis", text='')
             layout.prop(context.tool_settings, "use_gpencil_draw_onback", text="", icon='ORTHO')
             layout.prop(context.tool_settings, "add_gpencil_weight_data", text="", icon='WPAINT_HLT')
             layout.prop(context.tool_settings, "use_gpencil_additive_drawing", text="", icon='FREEZE')
-
-        elif mode == 'GPENCIL_SCULPT':
+        elif mode in ('GPENCIL_EDIT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT'):
             layout.label(text="Layer:")
             layout.popover(
                 panel="TOPBAR_PT_gpencil_layers",
                 text=txt
             )
-            layout.prop(context.tool_settings.gpencil_sculpt, "lockaxis", text='')
 
 
 class _draw_left_context_mode:
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 885df0faaaa..f55ff95e3f8 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -215,6 +215,26 @@ class VIEW3D_HT_header(Header):
                 icon=act_pivot_point.icon,
                 text="",
             )
+        # grease pencil
+        if object_mode == 'GPENCIL_PAINT':
+            origin = tool_settings.gpencil_stroke_placement_view3d
+            gp_origin = \
+                tool_settings.bl_rna.properties['gpencil_stroke_placement_view3d'].enum_items[origin]
+
+            or_icon = getattr(gp_origin, "icon", "BLANK1")
+            or_name = getattr(gp_origin, "name", "Origin")
+            layout.popover(
+                panel="VIEW3D_PT_gpencil_origin",
+                text=or_name,
+                icon=or_icon,
+            )
+
+            row = layout.row()
+            row.enabled = context.tool_settings.gpencil_stroke_placement_view3d in ('ORIGIN', 'CURSOR')
+            row.prop(context.tool_settings.gpencil_sculpt, "lockaxis", text='')
+
+        if object_mode == 'GPENCIL_SCULPT':
+            layout.prop(context.tool_settings.gpencil_sculpt, "lockaxis", text='')
 
         layout.separator_spacer()
 
@@ -4752,6 +4772,20 @@ class VIEW3D_PT_transform_orientations(Panel):
             row.operator("transform.delete_orientation", text="", icon='X', emboss=False)
 
 
+class VIEW3D_PT_gpencil_origin(Panel):
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'HEADER'
+    bl_label = "Origin"
+
+    def draw(self, context):
+        layout = self.layout
+        layout.label(text="Origin")
+
+        row = layout.row()
+        col = row.column()
+        col.prop(context.tool_settings, "gpencil_stroke_placement_view3d", expand=True)
+
+
 class VIEW3D_PT_overlay_gpencil_options(Panel):
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'HEADER'
@@ -5181,6 +5215,7 @@ classes = (
     VIEW3D_PT_overlay_sculpt,
     VIEW3D_PT_pivot_point,
     VIEW3D_PT_snapping,
+    VIEW3D_PT_gpencil_origin,
     VIEW3D_PT_transform_orientations,
     VIEW3D_PT_overlay_gpencil_options,
     VIEW3D_PT_context_properties,



More information about the Bf-blender-cvs mailing list