[Bf-blender-cvs] [261c06019f7] greasepencil-object: GPencil: More UI fixes after merge
Antonio Vazquez
noreply at git.blender.org
Sun Dec 15 23:43:00 CET 2019
Commit: 261c06019f7e891f4be9582cffb11271af62d436
Author: Antonio Vazquez
Date: Sun Dec 15 23:42:49 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB261c06019f7e891f4be9582cffb11271af62d436
GPencil: More UI fixes after merge
Still more issues pending.
===================================================================
M release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M release/scripts/startup/bl_ui/space_view3d.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 d1cb9147446..a74ac7e616d 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -261,6 +261,58 @@ class GreasePencilDisplayPanel:
sub.prop(brush, "icon_filepath", text="")
+class GreasePencilBrushFalloff:
+ bl_label = "Falloff"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ ts = context.tool_settings
+ settings = None
+ if context.mode == 'PAINT_GPENCIL':
+ settings = ts.gpencil_paint
+ if context.mode == 'SCULPT_GPENCIL':
+ settings = ts.gpencil_sculpt_paint
+ elif context.mode == 'WEIGHT_GPENCIL':
+ settings = ts.gpencil_weight_paint
+ elif context.mode == 'VERTEX_GPENCIL':
+ settings = ts.gpencil_vertex_paint
+
+ return (settings and settings.brush and settings.brush.curve)
+
+ def draw(self, context):
+ layout = self.layout
+ ts = context.tool_settings
+ settings = None
+ if context.mode == 'PAINT_GPENCIL':
+ settings = ts.gpencil_paint
+ if context.mode == 'SCULPT_GPENCIL':
+ settings = ts.gpencil_sculpt_paint
+ elif context.mode == 'WEIGHT_GPENCIL':
+ settings = ts.gpencil_weight_paint
+ elif context.mode == 'VERTEX_GPENCIL':
+ settings = ts.gpencil_vertex_paint
+
+ if settings:
+ brush = settings.brush
+
+ col = layout.column(align=True)
+ row = col.row(align=True)
+ row.prop(brush, "curve_preset", text="")
+
+ if brush.curve_preset == 'CUSTOM':
+ layout.template_curve_mapping(brush, "curve", brush=True)
+
+ col = layout.column(align=True)
+ row = col.row(align=True)
+ row.operator("brush.curve_preset", icon='SMOOTHCURVE', text="").shape = 'SMOOTH'
+ row.operator("brush.curve_preset", icon='SPHERECURVE', text="").shape = 'ROUND'
+ row.operator("brush.curve_preset", icon='ROOTCURVE', text="").shape = 'ROOT'
+ row.operator("brush.curve_preset", icon='SHARPCURVE', text="").shape = 'SHARP'
+ row.operator("brush.curve_preset", icon='LINCURVE', text="").shape = 'LINE'
+ row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX'
+
+
class GPENCIL_MT_snap(Menu):
bl_label = "Snap"
@@ -601,6 +653,45 @@ class GreasePencilMaterialsPanel:
row.template_ID(space, "pin_id")
+class GreasePencilVertexcolorPanel:
+
+ def draw(self, context):
+ layout = self.layout
+ layout.use_property_split = True
+ layout.use_property_decorate = False
+
+ ts = context.scene.tool_settings
+ is_vertex = context.mode == 'VERTEX_GPENCIL'
+ gpencil_paint = ts.gpencil_vertex_paint if is_vertex else ts.gpencil_paint
+ brush = gpencil_paint.brush
+ gp_settings = brush.gpencil_settings
+ tool = brush.gpencil_vertex_tool if is_vertex else brush.gpencil_tool
+
+ ob = context.object
+
+ if ob:
+ if tool in {'DRAW', 'FILL'} and is_vertex is False:
+ row = layout.row(align=True)
+ row.prop(gp_settings, "vertex_mode", text="Mode")
+ row = layout.row(align=True)
+ row.prop(gp_settings, "vertex_color_factor", slider=True, text="Mix Factor")
+
+ if tool == 'TINT' or is_vertex is True:
+ row = layout.row(align=True)
+ row.prop(gp_settings, "vertex_mode", text="Mode")
+
+ 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)
@@ -740,6 +831,35 @@ class GreasePencilLayerDisplayPanel:
col.prop(gpl, "use_solo_mode", text="Show Only On Keyframed")
+class GreasePencilFlipTintColors(Operator):
+ bl_label = "Flip Colors"
+ bl_idname = "gpencil.tint_flip"
+ bl_description = "Switch Tint colors"
+
+ def execute(self, context):
+ try:
+ ts = context.tool_settings
+ settings = ts.gpencil_paint
+ brush = settings.brush
+ if brush is not None:
+ color = brush.color
+ secondary_color = brush.secondary_color
+
+ orig_prim = color.hsv
+ orig_sec = secondary_color.hsv
+
+ color.hsv = orig_sec
+ secondary_color.hsv = orig_prim
+
+ return {'FINISHED'}
+
+ except Exception as e:
+ utils_core.error_handlers(self, "gpencil.tint_flip", e,
+ "Flip Colors could not be completed")
+
+ return {'CANCELLED'}
+
+
classes = (
GPENCIL_MT_snap,
GPENCIL_MT_cleanup,
@@ -749,6 +869,8 @@ classes = (
GPENCIL_UL_annotation_layer,
GPENCIL_UL_layer,
+
+ GreasePencilFlipTintColors,
)
if __name__ == "__main__": # only for live edit.
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index ca40accebf4..af7cb84e1c2 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -31,6 +31,7 @@ from bl_ui.properties_grease_pencil_common import (
AnnotationDataPanel,
AnnotationOnionSkin,
GreasePencilMaterialsPanel,
+ GreasePencilVertexcolorPanel,
)
from bl_ui.space_toolsystem_common import (
ToolActivePanelHelper,
@@ -377,6 +378,20 @@ class _draw_tool_settings_context_mode:
row.prop(gp_settings, "use_material_pin", text="")
+ if brush.gpencil_tool in {'DRAW', 'FILL'} and ma:
+ gp_style = ma.grease_pencil
+ if gp_style.stroke_style != 'TEXTURE':
+ row.separator(factor=0.4)
+ row.prop(settings, "use_vertex_color", text="",
+ icon='CHECKBOX_HLT' if settings.use_vertex_color else 'CHECKBOX_DEHLT')
+ sub_row = row.row(align=True)
+ sub_row.enabled = settings.use_vertex_color
+ sub_row.prop(brush, "color", text="")
+ sub_row.popover(
+ panel="TOPBAR_PT_gpencil_vertexcolor",
+ text="Vertex Color",
+ )
+
row = layout.row(align=True)
tool_settings = context.scene.tool_settings
settings = tool_settings.gpencil_paint
@@ -385,6 +400,14 @@ class _draw_tool_settings_context_mode:
if context.object and brush.gpencil_tool in {'FILL', 'DRAW'}:
draw_color_selector()
+ if context.object and brush.gpencil_tool == 'TINT':
+ row.separator(factor=0.4)
+ row.prop(brush, "color", text="")
+ row.popover(
+ panel="TOPBAR_PT_gpencil_vertexcolor",
+ text="Vertex Color",
+ )
+
from bl_ui.properties_paint_common import (
brush_basic_gpencil_paint_settings,
)
@@ -446,7 +469,7 @@ class _draw_tool_settings_context_mode:
brush_basic_gpencil_vertex_settings,
)
- brush_basic_gpencil_vertex_settings(layout, context, brush, tool, compact=True, is_toolbar=True)
+ brush_basic_gpencil_vertex_settings(layout, context, brush, compact=True)
@staticmethod
def PARTICLE(context, layout, tool):
@@ -779,7 +802,8 @@ class VIEW3D_MT_editor_menus(Menu):
obj = context.active_object
mode_string = context.mode
edit_object = context.edit_object
- gp_edit = obj and obj.mode in {'EDIT_GPENCIL', 'PAINT_GPENCIL', 'SCULPT_GPENCIL', 'WEIGHT_GPENCIL'}
+ gp_edit = obj and obj.mode in {'EDIT_GPENCIL', 'PAINT_GPENCIL', 'SCULPT_GPENCIL',
+ 'WEIGHT_GPENCIL', 'VERTEX_GPENCIL'}
ts = context.scene.tool_settings
layout.menu("VIEW3D_MT_view")
@@ -794,6 +818,8 @@ class VIEW3D_MT_editor_menus(Menu):
layout.menu("VIEW3D_MT_select_gpencil")
elif mode_string == 'EDIT_GPENCIL':
layout.menu("VIEW3D_MT_select_gpencil")
+ elif mode_string == 'VERTEX_GPENCIL':
+ layout.menu("VIEW3D_MT_select_gpencil")
elif mode_string in {'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}:
mesh = obj.data
if mesh.use_paint_mask:
@@ -6828,6 +6854,17 @@ 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 = 10
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.object
+ return ob and ob.type == 'GPENCIL'
+
classes = (
VIEW3D_HT_header,
VIEW3D_HT_tool_header,
@@ -6953,6 +6990,7 @@ classes = (
VIEW3D_MT_edit_gpencil_delete,
VIEW3D_MT_edit_gpencil_showhide,
VIEW3D_MT_weight_gpencil,
+ VIEW3D_MT_vertex_gpencil,
VIEW3D_MT_gpencil_animation,
VIEW3D_MT_gpencil_simplify,
VIEW3D_MT_gpencil_copy_layer,
@@ -7040,6 +7078,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,
)
diff --git a/r
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list