[Bf-blender-cvs] [7d4dcfe8799] master: Fix T86822: context.collection not available in Object/Object Data Properties

Sebastian Parborg noreply at git.blender.org
Mon Mar 22 17:38:58 CET 2021


Commit: 7d4dcfe879953298bb0a2baaec1dbb5ca7886d64
Author: Sebastian Parborg
Date:   Mon Mar 22 17:37:44 2021 +0100
Branches: master
https://developer.blender.org/rB7d4dcfe879953298bb0a2baaec1dbb5ca7886d64

Fix T86822: context.collection not available in Object/Object Data Properties

We need to return the global context collection if it is not found in
the data path.

Also fix pinning of the collection tab.

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

M	source/blender/editors/space_buttons/buttons_context.c
M	source/blender/editors/space_buttons/space_buttons.c

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

diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index 41d8ff9bc9e..c42e2531f25 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -877,7 +877,7 @@ int /*eContextResult*/ buttons_context(const bContext *C,
     return CTX_RESULT_OK;
   }
   if (CTX_data_equals(member, "scene")) {
-    /* Do not return one here if scene not found in path,
+    /* Do not return one here if scene is not found in path,
      * in this case we want to get default context scene! */
     return set_pointer_type(path, result, &RNA_Scene);
   }
@@ -886,8 +886,9 @@ int /*eContextResult*/ buttons_context(const bContext *C,
     return CTX_RESULT_OK;
   }
   if (CTX_data_equals(member, "collection")) {
-    set_pointer_type(path, result, &RNA_Collection);
-    return CTX_RESULT_OK;
+    /* Do not return one here if collection is not found in path,
+     * in this case we want to get default context collection! */
+    return set_pointer_type(path, result, &RNA_Collection);
   }
   if (CTX_data_equals(member, "object")) {
     set_pointer_type(path, result, &RNA_Object);
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 43d45db38e2..9db8f7efbb2 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -206,7 +206,7 @@ int ED_buttons_tabs_list(SpaceProperties *sbuts, short *context_tabs_array)
     context_tabs_array[length] = -1;
     length++;
   }
-  if (sbuts->pathflag & (1 << BCONTEXT_VIEW_LAYER)) {
+  if (sbuts->pathflag & (1 << BCONTEXT_COLLECTION)) {
     context_tabs_array[length] = BCONTEXT_COLLECTION;
     length++;
   }



More information about the Bf-blender-cvs mailing list