[Bf-blender-cvs] [4d58a1c657d] blender-v3.3-release: Fix Grease Pencil materials added by Python missing

Philipp Oeser noreply at git.blender.org
Mon Nov 28 15:06:35 CET 2022


Commit: 4d58a1c657db7acc585d1782d66ff983ef5ce90a
Author: Philipp Oeser
Date:   Fri Nov 18 10:25:17 2022 +0100
Branches: blender-v3.3-release
https://developer.blender.org/rB4d58a1c657db7acc585d1782d66ff983ef5ce90a

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 44d82be8ab0..ad307f8100d 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