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:
authorDalai Felinto <dfelinto@gmail.com>2019-11-19 20:15:41 +0300
committerDalai Felinto <dfelinto@gmail.com>2019-11-19 20:28:59 +0300
commit9ca2cbdcea6a8e46a07348ae35cdecfb0637eb9f (patch)
tree7103bba5abfb76929c86959331bab66444fce6cf
parent83e87655627fc2156a87dbfe2f676869b97fa8d2 (diff)
Outliner: Don't show id operations (make single user) when not supported
For the make single user operation to work we expect a parent of the datablock to be around. However this is often not the case when not accessing the data from Scenes or Viewlayer display modes. For now we simply not show them in the other cases. They can be added later though, by testing the outliner tree parent compatibility with the expected parent id. Fix T71673 Differential Revision: https://developer.blender.org/D6276
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 219943d08a6..d6509986249 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -1528,21 +1528,38 @@ static const EnumPropertyItem prop_id_op_types[] = {
{0, NULL, 0, NULL, NULL},
};
-static const EnumPropertyItem *outliner_id_operation_itemf(bContext *UNUSED(C),
- PointerRNA *UNUSED(ptr),
- PropertyRNA *UNUSED(prop),
- bool *r_free)
+static bool outliner_id_operation_item_poll(bContext *C,
+ PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop),
+ const int enum_value)
{
- if (BKE_override_library_is_enabled()) {
- *r_free = false;
- return prop_id_op_types;
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
+
+ switch (enum_value) {
+ case OUTLINER_IDOP_OVERRIDE_LIBRARY:
+ return BKE_override_library_is_enabled();
+ case OUTLINER_IDOP_SINGLE:
+ if (ELEM(soops->outlinevis, SO_SCENES, SO_VIEW_LAYER)) {
+ return true;
+ }
+ /* TODO (dalai): enable in the few cases where this can be supported
+ (i.e., when we have a valid parent for the tselem). */
+ return false;
}
+ return true;
+}
+
+static const EnumPropertyItem *outliner_id_operation_itemf(bContext *C,
+ PointerRNA *ptr,
+ PropertyRNA *prop,
+ bool *r_free)
+{
EnumPropertyItem *items = NULL;
int totitem = 0;
for (const EnumPropertyItem *it = prop_id_op_types; it->identifier != NULL; it++) {
- if (it->value == OUTLINER_IDOP_OVERRIDE_LIBRARY) {
+ if (!outliner_id_operation_item_poll(C, ptr, prop, it->value)) {
continue;
}
RNA_enum_item_add(&items, &totitem, it);