[Bf-blender-cvs] [3e81d177ea0] blender-v3.4-release: Fix Grease Pencil materials added by Python missing
Philipp Oeser
noreply at git.blender.org
Fri Nov 18 12:37:50 CET 2022
Commit: 3e81d177ea08b4c3cb44fac0cf9e9a252b36b52c
Author: Philipp Oeser
Date: Fri Nov 18 10:25:17 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rB3e81d177ea08b4c3cb44fac0cf9e9a252b36b52c
Fix Grease Pencil materials added by Python missing
These materials were missing from the "Change Active Material" menu.
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.
Similar to rB182edd4c35c2.
Fixes T102566.
Maniphest Tasks: T102566
Differential Revision: https://developer.blender.org/D16541
===================================================================
M release/scripts/startup/bl_ui/properties_grease_pencil_common.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 38522a1bf84..6f9a3472792 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -296,6 +296,7 @@ class GPENCIL_MT_material_active(Menu):
for slot in ob.material_slots:
mat = slot.material
+ mat.id_data.preview_ensure()
if mat and mat.id_data and mat.id_data.preview:
icon = mat.id_data.preview.icon_id
layout.operator("gpencil.material_set", text=mat.name, icon_value=icon).slot = mat.name
More information about the Bf-blender-cvs
mailing list