[Bf-blender-cvs] [ff51afb1944] master: Fix T84593: Operators on material (linked to local object but with linked obdata) fail

Philipp Oeser noreply at git.blender.org
Tue Jan 12 10:07:59 CET 2021


Commit: ff51afb194493270c93535adc1580ee8eb0cacda
Author: Philipp Oeser
Date:   Mon Jan 11 17:32:10 2021 +0100
Branches: master
https://developer.blender.org/rBff51afb194493270c93535adc1580ee8eb0cacda

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

===================================================================

M	source/blender/editors/render/render_shading.c

===================================================================

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)



More information about the Bf-blender-cvs mailing list