[Bf-blender-cvs] [182edd4c35c] master: Fix T89284: Greasepencil top bar draw tool settings missing
Philipp Oeser
noreply at git.blender.org
Tue Aug 10 11:39:34 CEST 2021
Commit: 182edd4c35c24f809c80674a0dbb9e6a5e3574bc
Author: Philipp Oeser
Date: Tue Aug 10 09:27:05 2021 +0200
Branches: master
https://developer.blender.org/rB182edd4c35c24f809c80674a0dbb9e6a5e3574bc
Fix T89284: Greasepencil top bar draw tool settings missing
Caused by {rBe3faef686d38}.
Error was getting the preview [which wasnt there yet]
These only appeared once the material tab in the Properties Editor was
used (since this ensured a valid preview icon).
Above commit changed behavior for RNA icon getter (this does not create
data anymore), so ensure the preview by hand here.
Maniphest Tasks: T89284
Differential Revision: https://developer.blender.org/D12178
===================================================================
M release/scripts/startup/bl_ui/properties_paint_common.py
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index ad963396022..c038f5f906a 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -1141,14 +1141,15 @@ def brush_basic__draw_color_selector(context, layout, brush, gp_settings, props)
if not gp_settings.use_material_pin:
ma = context.object.active_material
icon_id = 0
- if ma and ma.id_data.preview:
- icon_id = ma.id_data.preview.icon_id
- txt_ma = ma.name
- maxw = 25
- if len(txt_ma) > maxw:
- txt_ma = txt_ma[:maxw - 5] + '..' + txt_ma[-3:]
- else:
- txt_ma = ""
+ txt_ma = ""
+ if ma:
+ ma.id_data.preview_ensure()
+ if ma.id_data.preview:
+ icon_id = ma.id_data.preview.icon_id
+ txt_ma = ma.name
+ maxw = 25
+ if len(txt_ma) > maxw:
+ txt_ma = txt_ma[:maxw - 5] + '..' + txt_ma[-3:]
sub = row.row()
sub.ui_units_x = 8
More information about the Bf-blender-cvs
mailing list