Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2021-09-22 18:05:04 +0300
committerAntonio Vazquez <blendergit@gmail.com>2021-09-22 18:05:21 +0300
commit4762a9b09f98523093e5778e52b1ed8abf9fa331 (patch)
tree3489b88821d8881b41c827ae47b165cad8f38028 /release/scripts/startup/bl_ui/properties_grease_pencil_common.py
parent794c2828af60af02a38381c2a9a81f9046381074 (diff)
GPencil: Fix unreported missing material panel for new Scene
When a new scene is created, the paint pointers are not available before using them, so the python panel exits because the pointer was None. Now, the pointer is checked in order to display the materials panel as expected.
Diffstat (limited to 'release/scripts/startup/bl_ui/properties_grease_pencil_common.py')
-rw-r--r--release/scripts/startup/bl_ui/properties_grease_pencil_common.py5
1 files changed, 4 insertions, 1 deletions
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 f01e75dbab8..c31881fa194 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -525,7 +525,7 @@ class GreasePencilMaterialsPanel:
is_view3d = (self.bl_space_type == 'VIEW_3D')
tool_settings = context.scene.tool_settings
gpencil_paint = tool_settings.gpencil_paint
- brush = gpencil_paint.brush
+ brush = gpencil_paint.brush if gpencil_paint else None
ob = context.object
row = layout.row()
@@ -587,6 +587,9 @@ class GreasePencilMaterialsPanel:
ma = ob.material_slots[ob.active_material_index].material
else:
ma = gp_settings.material
+ else:
+ if len(ob.material_slots) > 0 and ob.active_material_index >= 0:
+ ma = ob.material_slots[ob.active_material_index].material
if ma is not None and ma.grease_pencil is not None:
gpcolor = ma.grease_pencil