Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/undo/ed_undo.c
| Show First 20 Lines • Show All 810 Lines • ▼ Show 20 Lines | |||||
| * \{ */ | * \{ */ | ||||
| static int undo_editmode_objects_from_view_layer_prepare(ViewLayer *view_layer, | static int undo_editmode_objects_from_view_layer_prepare(ViewLayer *view_layer, | ||||
| Object *obact, | Object *obact, | ||||
| int *r_active_index) | int *r_active_index) | ||||
| { | { | ||||
| const short object_type = obact->type; | const short object_type = obact->type; | ||||
| for (Base *base = view_layer->object_bases.first; base; base = base->next) { | LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| if ((ob->type == object_type) && (ob->mode & OB_MODE_EDIT)) { | if ((ob->type == object_type) && (ob->mode & OB_MODE_EDIT)) { | ||||
| ID *id = ob->data; | ID *id = ob->data; | ||||
| id->tag &= ~LIB_TAG_DOIT; | id->tag &= ~LIB_TAG_DOIT; | ||||
| } | } | ||||
| } | } | ||||
| int len = 0; | int len = 0; | ||||
| for (Base *base = view_layer->object_bases.first; base; base = base->next) { | LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| if ((ob->type == object_type) && (ob->mode & OB_MODE_EDIT)) { | if ((ob->type == object_type) && (ob->mode & OB_MODE_EDIT)) { | ||||
| if (ob == obact) { | if (ob == obact) { | ||||
| *r_active_index = len; | *r_active_index = len; | ||||
| } | } | ||||
| ID *id = ob->data; | ID *id = ob->data; | ||||
| if ((id->tag & LIB_TAG_DOIT) == 0) { | if ((id->tag & LIB_TAG_DOIT) == 0) { | ||||
| len += 1; | len += 1; | ||||
| Show All 10 Lines | Object **ED_undo_editmode_objects_from_view_layer(ViewLayer *view_layer, uint *r_len) | ||||
| if ((obact == NULL) || (obact->mode & OB_MODE_EDIT) == 0) { | if ((obact == NULL) || (obact->mode & OB_MODE_EDIT) == 0) { | ||||
| return MEM_mallocN(0, __func__); | return MEM_mallocN(0, __func__); | ||||
| } | } | ||||
| int active_index = 0; | int active_index = 0; | ||||
| const int len = undo_editmode_objects_from_view_layer_prepare(view_layer, obact, &active_index); | const int len = undo_editmode_objects_from_view_layer_prepare(view_layer, obact, &active_index); | ||||
| const short object_type = obact->type; | const short object_type = obact->type; | ||||
| int i = 0; | int i = 0; | ||||
| Object **objects = MEM_malloc_arrayN(len, sizeof(*objects), __func__); | Object **objects = MEM_malloc_arrayN(len, sizeof(*objects), __func__); | ||||
| for (Base *base = view_layer->object_bases.first; base; base = base->next) { | LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| if ((ob->type == object_type) && (ob->mode & OB_MODE_EDIT)) { | if ((ob->type == object_type) && (ob->mode & OB_MODE_EDIT)) { | ||||
| ID *id = ob->data; | ID *id = ob->data; | ||||
| if (id->tag & LIB_TAG_DOIT) { | if (id->tag & LIB_TAG_DOIT) { | ||||
| objects[i++] = ob; | objects[i++] = ob; | ||||
| id->tag &= ~LIB_TAG_DOIT; | id->tag &= ~LIB_TAG_DOIT; | ||||
| } | } | ||||
| } | } | ||||
| Show All 12 Lines | Base **ED_undo_editmode_bases_from_view_layer(ViewLayer *view_layer, uint *r_len) | ||||
| if ((obact == NULL) || (obact->mode & OB_MODE_EDIT) == 0) { | if ((obact == NULL) || (obact->mode & OB_MODE_EDIT) == 0) { | ||||
| return MEM_mallocN(0, __func__); | return MEM_mallocN(0, __func__); | ||||
| } | } | ||||
| int active_index = 0; | int active_index = 0; | ||||
| const int len = undo_editmode_objects_from_view_layer_prepare(view_layer, obact, &active_index); | const int len = undo_editmode_objects_from_view_layer_prepare(view_layer, obact, &active_index); | ||||
| const short object_type = obact->type; | const short object_type = obact->type; | ||||
| int i = 0; | int i = 0; | ||||
| Base **base_array = MEM_malloc_arrayN(len, sizeof(*base_array), __func__); | Base **base_array = MEM_malloc_arrayN(len, sizeof(*base_array), __func__); | ||||
| for (Base *base = view_layer->object_bases.first; base; base = base->next) { | LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { | ||||
| Object *ob = base->object; | Object *ob = base->object; | ||||
| if ((ob->type == object_type) && (ob->mode & OB_MODE_EDIT)) { | if ((ob->type == object_type) && (ob->mode & OB_MODE_EDIT)) { | ||||
| ID *id = ob->data; | ID *id = ob->data; | ||||
| if (id->tag & LIB_TAG_DOIT) { | if (id->tag & LIB_TAG_DOIT) { | ||||
| base_array[i++] = base; | base_array[i++] = base; | ||||
| id->tag &= ~LIB_TAG_DOIT; | id->tag &= ~LIB_TAG_DOIT; | ||||
| } | } | ||||
| } | } | ||||
| Show All 10 Lines | |||||