Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_edit.c
| Show First 20 Lines • Show All 160 Lines • ▼ Show 20 Lines | |||||
| static int object_hide_view_clear_exec(bContext *C, wmOperator *op) | static int object_hide_view_clear_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| const bool select = RNA_boolean_get(op->ptr, "select"); | const bool select = RNA_boolean_get(op->ptr, "select"); | ||||
| bool changed = false; | bool changed = false; | ||||
| for (Base *base = view_layer->object_bases.first; base; base = base->next) { | LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { | ||||
| if (base->flag & BASE_HIDDEN) { | if (base->flag & BASE_HIDDEN) { | ||||
| base->flag &= ~BASE_HIDDEN; | base->flag &= ~BASE_HIDDEN; | ||||
| changed = true; | changed = true; | ||||
| if (select) { | if (select) { | ||||
| /* We cannot call `ED_object_base_select` because | /* We cannot call `ED_object_base_select` because | ||||
| * base is not selectable while it is hidden. */ | * base is not selectable while it is hidden. */ | ||||
| base->flag |= BASE_SELECTED; | base->flag |= BASE_SELECTED; | ||||
| Show All 34 Lines | |||||
| static int object_hide_view_set_exec(bContext *C, wmOperator *op) | static int object_hide_view_set_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| const bool unselected = RNA_boolean_get(op->ptr, "unselected"); | const bool unselected = RNA_boolean_get(op->ptr, "unselected"); | ||||
| bool changed = false; | bool changed = false; | ||||
| /* Hide selected or unselected objects. */ | /* Hide selected or unselected objects. */ | ||||
| for (Base *base = view_layer->object_bases.first; base; base = base->next) { | LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { | ||||
| if (!(base->flag & BASE_VISIBLE_VIEWLAYER)) { | if (!(base->flag & BASE_VISIBLE_VIEWLAYER)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (!unselected) { | if (!unselected) { | ||||
| if (base->flag & BASE_SELECTED) { | if (base->flag & BASE_SELECTED) { | ||||
| ED_object_base_select(base, BA_DESELECT); | ED_object_base_select(base, BA_DESELECT); | ||||
| base->flag |= BASE_HIDDEN; | base->flag |= BASE_HIDDEN; | ||||
| ▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | |||||
| void ED_collection_hide_menu_draw(const bContext *C, uiLayout *layout) | void ED_collection_hide_menu_draw(const bContext *C, uiLayout *layout) | ||||
| { | { | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| LayerCollection *lc_scene = view_layer->layer_collections.first; | LayerCollection *lc_scene = view_layer->layer_collections.first; | ||||
| uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN); | uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN); | ||||
| for (LayerCollection *lc = lc_scene->layer_collections.first; lc; lc = lc->next) { | LISTBASE_FOREACH (LayerCollection *, lc, &lc_scene->layer_collections) { | ||||
| int index = BKE_layer_collection_findindex(view_layer, lc); | int index = BKE_layer_collection_findindex(view_layer, lc); | ||||
| uiLayout *row = uiLayoutRow(layout, false); | uiLayout *row = uiLayoutRow(layout, false); | ||||
| if (lc->flag & LAYER_COLLECTION_EXCLUDE) { | if (lc->flag & LAYER_COLLECTION_EXCLUDE) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (lc->collection->flag & COLLECTION_RESTRICT_VIEWPORT) { | if (lc->collection->flag & COLLECTION_RESTRICT_VIEWPORT) { | ||||
| ▲ Show 20 Lines • Show All 1,255 Lines • ▼ Show 20 Lines | BKE_reportf(op->reports, | ||||
| RPT_ERROR, | RPT_ERROR, | ||||
| "%s already in %s", | "%s already in %s", | ||||
| single_object->id.name + 2, | single_object->id.name + 2, | ||||
| collection->id.name + 2); | collection->id.name + 2); | ||||
| BLI_freelistN(&objects); | BLI_freelistN(&objects); | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| for (LinkData *link = objects.first; link; link = link->next) { | LISTBASE_FOREACH (LinkData *, link, &objects) { | ||||
| Object *ob = link->data; | Object *ob = link->data; | ||||
| if (!is_link) { | if (!is_link) { | ||||
| BKE_collection_object_move(bmain, scene, collection, NULL, ob); | BKE_collection_object_move(bmain, scene, collection, NULL, ob); | ||||
| } | } | ||||
| else { | else { | ||||
| BKE_collection_object_add(bmain, collection, ob); | BKE_collection_object_add(bmain, collection, ob); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 254 Lines • Show Last 20 Lines | |||||