From ff51afb194493270c93535adc1580ee8eb0cacda Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Mon, 11 Jan 2021 17:32:10 +0100 Subject: Fix T84593: Operators on material (linked to local object but with linked obdata) fail Caused by rB1a650fdcb286. Above commit made polling more restricitive in that it did not allow for actions on material slots (linked to object, not object data) on objects with liked object data. This should be allowed though. Maniphest Tasks: T84593 https://developer.blender.org/D10078 --- source/blender/editors/render/render_shading.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index cf8418bb7b9..10cd1df6d96 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -148,10 +148,18 @@ static bool object_materials_supported_poll_ex(bContext *C, const Object *ob) if (!ED_operator_object_active_local_editable_ex(C, ob)) { return false; } + if (!OB_TYPE_SUPPORT_MATERIAL(ob->type)) { + return false; + } + + /* Material linked to object. */ + if (ob->matbits && ob->actcol && ob->matbits[ob->actcol - 1]) { + return true; + } + + /* Material linked to obdata. */ const ID *data = ob->data; - return (OB_TYPE_SUPPORT_MATERIAL(ob->type) && - /* Object data checks. */ - data && !ID_IS_LINKED(data) && !ID_IS_OVERRIDE_LIBRARY(data)); + return (data && !ID_IS_LINKED(data) && !ID_IS_OVERRIDE_LIBRARY(data)); } static bool object_materials_supported_poll(bContext *C) -- cgit v1.2.3