Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/util/ed_util.c
| Show All 21 Lines | |||||
| */ | */ | ||||
| #include <math.h> | #include <math.h> | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "DNA_armature_types.h" | |||||
| #include "DNA_mesh_types.h" | |||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BLI_path_util.h" | #include "BLI_path_util.h" | ||||
| #include "BLI_string.h" | #include "BLI_string.h" | ||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| ▲ Show 20 Lines • Show All 160 Lines • ▼ Show 20 Lines | void ED_editors_exit(Main *bmain, bool do_undo_system) | ||||
| * since exiting edit-mode will tag the objects too. | * since exiting edit-mode will tag the objects too. | ||||
| * | * | ||||
| * However there is no guarantee the active object _never_ changes while in edit-mode. | * However there is no guarantee the active object _never_ changes while in edit-mode. | ||||
| * Python for example can do this, some callers to #ED_object_base_activate | * Python for example can do this, some callers to #ED_object_base_activate | ||||
| * don't handle modes either (doing so isn't always practical). | * don't handle modes either (doing so isn't always practical). | ||||
| * | * | ||||
| * To reproduce the problem where stale data is used, see: T84920. */ | * To reproduce the problem where stale data is used, see: T84920. */ | ||||
| for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) { | for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) { | ||||
| if (ob->type == OB_MESH) { | if (ED_object_editmode_free_ex(bmain, ob)) { | ||||
| Mesh *me = ob->data; | |||||
| if (me->edit_mesh) { | |||||
| EDBM_mesh_free(me->edit_mesh); | |||||
| MEM_freeN(me->edit_mesh); | |||||
| me->edit_mesh = NULL; | |||||
| if (do_undo_system == false) { | if (do_undo_system == false) { | ||||
| DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); | DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else if (ob->type == OB_ARMATURE) { | |||||
| bArmature *arm = ob->data; | |||||
| if (arm->edbo) { | |||||
| ED_armature_edit_free(ob->data); | |||||
| if (do_undo_system == false) { | |||||
| DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| /* global in meshtools... */ | /* global in meshtools... */ | ||||
| ED_mesh_mirror_spatial_table_end(NULL); | ED_mesh_mirror_spatial_table_end(NULL); | ||||
| ED_mesh_mirror_topo_table_end(NULL); | ED_mesh_mirror_topo_table_end(NULL); | ||||
| } | } | ||||
| bool ED_editors_flush_edits_for_object_ex(Main *bmain, | bool ED_editors_flush_edits_for_object_ex(Main *bmain, | ||||
| Object *ob, | Object *ob, | ||||
| ▲ Show 20 Lines • Show All 212 Lines • Show Last 20 Lines | |||||