[Bf-blender-cvs] [5aee15c2c00] greasepencil-object: GPencil: Reorganize Vertex Color UI moving to Popover
Antonio Vazquez
noreply at git.blender.org
Sun Nov 3 11:26:47 CET 2019
Commit: 5aee15c2c00c3d24a881bb3d223d9cc5f940c3c4
Author: Antonio Vazquez
Date: Sun Nov 3 11:26:33 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB5aee15c2c00c3d24a881bb3d223d9cc5f940c3c4
GPencil: Reorganize Vertex Color UI moving to Popover
===================================================================
M release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M release/scripts/startup/bl_ui/space_view3d.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 c575eb860a2..1e6519f20b4 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -911,20 +911,45 @@ class GreasePencilMaterialsPanel:
row = layout.row()
row.prop(gpcolor, "color", text="Stroke Base Color")
- # Mix color
- if is_view3d and brush is not None and brush.gpencil_tool == 'DRAW':
- if gpcolor.stroke_style == 'SOLID' or gpcolor.use_stroke_pattern:
- gp_settings = brush.gpencil_settings
- row = layout.row()
- row.prop(brush, "color", text="Vertex Color")
- row = layout.row()
- row.prop(gp_settings, "vertex_color_factor", text="Vertex Color Factor")
-
else:
space = context.space_data
row.template_ID(space, "pin_id")
+class GreasePencilVertexcolorPanel:
+
+ def draw(self, context):
+ layout = self.layout
+ ts = context.scene.tool_settings
+ gpencil_paint = ts.gpencil_paint
+ brush = gpencil_paint.brush
+ gp_settings = brush.gpencil_settings
+
+ ob = context.object
+
+ if ob:
+ row = layout.row(align=True)
+
+ row.prop(brush, "color", text="")
+ row = layout.row(align=True)
+ row.template_color_picker(brush, "color", value_slider=True)
+
+ if brush.gpencil_tool == 'DRAW':
+ row = layout.row(align=True)
+ row.prop(gp_settings, "vertex_color_factor", slider=True, text="Vertex Color Factor")
+
+ sub_row = layout.row(align=True)
+ sub_row.prop(brush, "color", text="")
+ sub_row.prop(brush, "secondary_color", text="")
+
+ sub_row.operator("gpencil.tint_flip", icon='FILE_REFRESH', text="")
+
+ row = layout.row(align=True)
+ row.template_ID(gpencil_paint, "palette", new="palette.new")
+ if gpencil_paint.palette:
+ layout.template_palette(gpencil_paint, "palette", color=True)
+
+
class GPENCIL_UL_layer(UIList):
def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index):
# assert(isinstance(item, bpy.types.GPencilLayer)
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 0af34488bc5..4f5b88249c4 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -30,6 +30,7 @@ from bl_ui.properties_grease_pencil_common import (
AnnotationDataPanel,
AnnotationOnionSkin,
GreasePencilMaterialsPanel,
+ GreasePencilVertexcolorPanel,
)
from bl_ui.space_toolsystem_common import (
ToolActivePanelHelper,
@@ -347,11 +348,16 @@ class _draw_tool_settings_context_mode:
row.prop(gp_settings, "use_material_pin", text="")
- if brush.gpencil_tool == 'DRAW':
- if ma and (ma.grease_pencil.stroke_style != 'TEXTURE' or
- ma.grease_pencil.use_stroke_pattern):
+ if brush.gpencil_tool == 'DRAW' and ma:
+ gp_style = ma.grease_pencil
+ if gp_style.stroke_style != 'TEXTURE' or gp_style.use_stroke_pattern:
row.separator(factor=0.4)
row.prop(brush, "color", text="")
+ row.popover(
+ panel="TOPBAR_PT_gpencil_vertexcolor",
+ text="",
+ )
+
row = layout.row(align=True)
tool_settings = context.scene.tool_settings
@@ -363,8 +369,11 @@ class _draw_tool_settings_context_mode:
if context.object and brush.gpencil_tool == 'TINT':
row.separator(factor=0.4)
- row.label(text="Vertex Color")
row.prop(brush, "color", text="")
+ row.popover(
+ panel="TOPBAR_PT_gpencil_vertexcolor",
+ text="",
+ )
from bl_ui.properties_paint_common import (
brush_basic_gpencil_paint_settings,
@@ -6750,6 +6759,18 @@ class TOPBAR_PT_gpencil_materials(GreasePencilMaterialsPanel, Panel):
return ob and ob.type == 'GPENCIL'
+class TOPBAR_PT_gpencil_vertexcolor(GreasePencilVertexcolorPanel, Panel):
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'HEADER'
+ bl_label = "Vertex Color"
+ bl_ui_units_x = 14
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.object
+ return ob and ob.type == 'GPENCIL'
+
+
classes = (
VIEW3D_HT_header,
VIEW3D_HT_tool_header,
@@ -6962,6 +6983,7 @@ classes = (
VIEW3D_PT_gpencil_draw_context_menu,
VIEW3D_PT_sculpt_context_menu,
TOPBAR_PT_gpencil_materials,
+ TOPBAR_PT_gpencil_vertexcolor,
TOPBAR_PT_annotation_layers,
)
More information about the Bf-blender-cvs
mailing list