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:
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_tools.c')
-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);