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.
This commit is contained in:
Sebastian Parborg 2021-03-22 17:37:44 +01:00
parent 2c427d594f
commit 7d4dcfe879
Notes: blender-bot 2023-02-13 19:10:41 +01:00
Referenced by issue #86822, context.collection not available in Object/Object Data Properties
2 changed files with 5 additions and 4 deletions

View File

@ -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);

View File

@ -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++;
}