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
This commit is contained in:
parent
9de35e396b
commit
3e81d177ea
Notes:
blender-bot
2023-02-14 05:37:19 +01:00
Referenced by issue #100749, Blender LTS: Maintenance Task 3.3 Referenced by issue #102566, Regression: Grease Pencil materials added via Python do not show up in "Change Active Material" Menu
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue