[Bf-blender-cvs] [22b700247b5] greasepencil-object: merge 'master' into greasepencil-object branch
Antonio Vazquez
noreply at git.blender.org
Thu Dec 19 14:41:53 CET 2019
Commit: 22b700247b525dce81534c31c835cef6fc3fcfd2
Author: Antonio Vazquez
Date: Thu Dec 19 14:30:51 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB22b700247b525dce81534c31c835cef6fc3fcfd2
merge 'master' into greasepencil-object branch
===================================================================
M release/scripts/startup/bl_ui/properties_paint_common.py
M release/scripts/startup/bl_ui/space_view3d.py
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/draw/intern/draw_manager_text.c
M source/blender/editors/uvedit/uvedit_ops.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index c5937906406..0bfc8adce07 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -29,8 +29,9 @@ class UnifiedPaintPanel:
def get_brush_mode(context):
""" Get the correct mode for this context. For any context where this returns None,
no brush options should be displayed."""
+ mode = context.mode
- if context.mode == 'PARTICLE':
+ if mode == 'PARTICLE':
# Particle brush settings currently completely do their own thing.
return None
@@ -54,14 +55,13 @@ class UnifiedPaintPanel:
if space_data.show_uvedit:
return 'UV_SCULPT'
return 'PAINT_2D'
-
- if space_type in {'VIEW_3D', 'PROPERTIES'}:
- if context.mode == 'PAINT_TEXTURE':
- if tool_settings.image_paint and tool_settings.image_paint.detect_data():
- return context.mode
+ elif space_type in {'VIEW_3D', 'PROPERTIES'}:
+ if mode == 'PAINT_TEXTURE':
+ if tool_settings.image_paint:
+ return mode
else:
return None
- return context.mode
+ return mode
return None
@staticmethod
@@ -95,6 +95,7 @@ class UnifiedPaintPanel:
return tool_settings.gpencil_weight_paint
elif mode == 'VERTEX_GPENCIL':
return tool_settings.gpencil_vertex_paint
+ return None
@staticmethod
def prop_unified(
@@ -163,10 +164,12 @@ class BrushSelectPanel(BrushPanel):
row.column().template_ID(settings, "brush", new="brush.add")
col = row.column()
col.menu("VIEW3D_MT_brush_context_menu", icon='DOWNARROW_HLT', text="")
- col.prop(brush, "use_custom_icon", toggle=True, icon='FILE_IMAGE', text="")
- if brush.use_custom_icon:
- layout.prop(brush, "icon_filepath", text="")
+ if brush is not None:
+ col.prop(brush, "use_custom_icon", toggle=True, icon='FILE_IMAGE', text="")
+
+ if brush.use_custom_icon:
+ layout.prop(brush, "icon_filepath", text="")
class ColorPalettePanel(BrushPanel):
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index a713717179f..d6c12cf84e8 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -78,7 +78,7 @@ class VIEW3D_HT_tool_header(Header):
# (obviously separated for from the users POV)
draw_fn = getattr(_draw_tool_settings_context_mode, tool_mode, None)
if draw_fn is not None:
- draw_fn(context, layout, tool)
+ is_valid_context = draw_fn(context, layout, tool)
def draw_3d_brush_settings(layout, tool_mode):
layout.popover("VIEW3D_PT_tools_brush_settings_advanced", text="Brush")
@@ -92,16 +92,16 @@ class VIEW3D_HT_tool_header(Header):
# Note: general mode options should be added to 'draw_mode_settings'.
if tool_mode == 'SCULPT':
- if (tool is not None) and tool.has_datablock:
+ if is_valid_context:
draw_3d_brush_settings(layout, tool_mode)
elif tool_mode == 'PAINT_VERTEX':
- if (tool is not None) and tool.has_datablock:
+ if is_valid_context:
draw_3d_brush_settings(layout, tool_mode)
elif tool_mode == 'PAINT_WEIGHT':
- if (tool is not None) and tool.has_datablock:
+ if is_valid_context:
draw_3d_brush_settings(layout, tool_mode)
elif tool_mode == 'PAINT_TEXTURE':
- if (tool is not None) and tool.has_datablock:
+ if is_valid_context:
draw_3d_brush_settings(layout, tool_mode)
elif tool_mode == 'EDIT_ARMATURE':
pass
@@ -117,7 +117,7 @@ class VIEW3D_HT_tool_header(Header):
# layout.popover_group(context=".paint_common", **popover_kw)
pass
elif tool_mode == 'PAINT_GPENCIL':
- if (tool is not None) and tool.has_datablock:
+ if is_valid_context:
brush = context.tool_settings.gpencil_paint.brush
if brush.gpencil_tool != 'ERASE':
if brush.gpencil_tool != 'TINT':
@@ -245,14 +245,14 @@ class _draw_tool_settings_context_mode:
@staticmethod
def SCULPT(context, layout, tool):
if (tool is None) or (not tool.has_datablock):
- return
+ return False
paint = context.tool_settings.sculpt
layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True)
brush = paint.brush
if brush is None:
- return
+ return False
tool_settings = context.tool_settings
capabilities = brush.sculpt_capabilities
@@ -290,44 +290,50 @@ class _draw_tool_settings_context_mode:
if not capabilities.has_direction:
layout.row().prop(brush, "direction", expand=True, text="")
+ return True
+
@staticmethod
def PAINT_TEXTURE(context, layout, tool):
if (tool is None) or (not tool.has_datablock):
- return
+ return False
paint = context.tool_settings.image_paint
layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True)
brush = paint.brush
if brush is None:
- return
+ return False
brush_basic_texpaint_settings(layout, context, brush, compact=True)
+ return True
+
@staticmethod
def PAINT_VERTEX(context, layout, tool):
if (tool is None) or (not tool.has_datablock):
- return
+ return False
paint = context.tool_settings.vertex_paint
layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True)
brush = paint.brush
if brush is None:
- return
+ return False
brush_basic_texpaint_settings(layout, context, brush, compact=True)
+ return True
+
@staticmethod
def PAINT_WEIGHT(context, layout, tool):
if (tool is None) or (not tool.has_datablock):
- return
+ return False
paint = context.tool_settings.weight_paint
layout.template_ID_preview(paint, "brush", rows=3, cols=8, hide_buttons=True)
brush = paint.brush
if brush is None:
- return
+ return False
# NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281
capabilities = brush.weight_paint_capabilities
@@ -351,10 +357,12 @@ class _draw_tool_settings_context_mode:
pressure_name="use_pressure_strength",
)
+ return True
+
@staticmethod
def PAINT_GPENCIL(context, layout, tool):
if tool is None:
- return
+ return False
# is_paint = True
# FIXME: tools must use their own UI drawing!
@@ -371,14 +379,14 @@ class _draw_tool_settings_context_mode:
elif tool.idname == "Cutter":
row = layout.row(align=True)
row.prop(context.tool_settings.gpencil_sculpt, "intersection_threshold")
- return
+ return False
elif not tool.has_datablock:
- return
+ return False
paint = context.tool_settings.gpencil_paint
brush = paint.brush
if brush is None:
- return
+ return False
gp_settings = brush.gpencil_settings
@@ -442,34 +450,36 @@ class _draw_tool_settings_context_mode:
)
brush_basic_gpencil_paint_settings(layout, context, brush, compact=True)
+ return True
+
@staticmethod
def SCULPT_GPENCIL(context, layout, tool):
if (tool is None) or (not tool.has_datablock):
return
paint = context.tool_settings.gpencil_sculpt_paint
brush = paint.brush
- if brush is None:
- return
from bl_ui.properties_paint_common import (
brush_basic_gpencil_sculpt_settings,
)
brush_basic_gpencil_sculpt_settings(layout, context, brush, compact=True)
+ return True
+
@staticmethod
def WEIGHT_GPENCIL(context, layout, tool):
if (tool is None) or (not tool.has_datablock):
return
paint = context.tool_settings.gpencil_weight_paint
brush = paint.brush
- if brush is None:
- return
from bl_ui.properties_paint_common import (
brush_basic_gpencil_weight_settings,
)
brush_basic_gpencil_weight_settings(layout, context, brush, compact=True)
+ return True
+
@staticmethod
def VERTEX_GPENCIL(context, layout, tool):
if (tool is None) or (not tool.has_datablock):
@@ -477,8 +487,6 @@ class _draw_tool_settings_context_mode:
paint = context.tool_settings.gpencil_vertex_paint
brush = paint.brush
- if brush is None:
- return
row = layout.row(align=True)
tool_settings = context.scene.tool_settings
@@ -500,38 +508,44 @@ class _draw_tool_settings_context_mode:
brush_basic_gpencil_vertex_settings(layout, context, brush, compact=True)
+ return True
+
@staticmethod
def PARTICLE(context, layout, tool):
if (tool is None) or (not tool.has_datablock):
- return
+ return False
# See: 'VIEW3D_PT_tools_brush', basically a duplicate
settings = context.tool_settings.particle_edit
brush = settings.brush
tool = settings.tool
- if tool != 'NONE':
- layout.prop(brush, "size", slider=True)
- if tool == 'ADD':
- layout.prop(brush, "count")
+ if tool == 'NONE':
+ return False
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list