Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_tools.c
| Show First 20 Lines • Show All 1,522 Lines • ▼ Show 20 Lines | static const EnumPropertyItem prop_id_op_types[] = { | ||||
| "Ensure data-block gets saved even if it isn't in use (e.g. for motion and material " | "Ensure data-block gets saved even if it isn't in use (e.g. for motion and material " | ||||
| "libraries)"}, | "libraries)"}, | ||||
| {OUTLINER_IDOP_FAKE_CLEAR, "CLEAR_FAKE", 0, "Clear Fake User", ""}, | {OUTLINER_IDOP_FAKE_CLEAR, "CLEAR_FAKE", 0, "Clear Fake User", ""}, | ||||
| {OUTLINER_IDOP_RENAME, "RENAME", 0, "Rename", ""}, | {OUTLINER_IDOP_RENAME, "RENAME", 0, "Rename", ""}, | ||||
| {OUTLINER_IDOP_SELECT_LINKED, "SELECT_LINKED", 0, "Select Linked", ""}, | {OUTLINER_IDOP_SELECT_LINKED, "SELECT_LINKED", 0, "Select Linked", ""}, | ||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| static const EnumPropertyItem *outliner_id_operation_itemf(bContext *UNUSED(C), | static bool outliner_id_operation_item_poll(bContext *C, | ||||
| PointerRNA *UNUSED(ptr), | PointerRNA *UNUSED(ptr), | ||||
| PropertyRNA *UNUSED(prop), | PropertyRNA *UNUSED(prop), | ||||
| bool *r_free) | const int enum_value) | ||||
| { | { | ||||
| if (BKE_override_library_is_enabled()) { | SpaceOutliner *soops = CTX_wm_space_outliner(C); | ||||
| *r_free = false; | |||||
| return prop_id_op_types; | 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; | EnumPropertyItem *items = NULL; | ||||
| int totitem = 0; | int totitem = 0; | ||||
| for (const EnumPropertyItem *it = prop_id_op_types; it->identifier != NULL; it++) { | 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; | continue; | ||||
| } | } | ||||
| RNA_enum_item_add(&items, &totitem, it); | RNA_enum_item_add(&items, &totitem, it); | ||||
| } | } | ||||
| RNA_enum_item_end(&items, &totitem); | RNA_enum_item_end(&items, &totitem); | ||||
| *r_free = true; | *r_free = true; | ||||
| return items; | return items; | ||||
| ▲ Show 20 Lines • Show All 900 Lines • Show Last 20 Lines | |||||