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:
authorDalai Felinto <dfelinto@gmail.com>2019-06-07 23:15:52 +0300
committerDalai Felinto <dfelinto@gmail.com>2019-06-08 01:16:59 +0300
commit6a155646823024569c129e8bdcb55fb2de9b958e (patch)
tree5a4fd425dcf13748d979bd1fd95d447b950f948f /source/blender/editors/util
parente70428c80e4a0b23db905dabb02dba6e75d32665 (diff)
Fix T65420: Crash in file saved with edit mesh
Reviewers: brecht, sergey Differential Revision: https://developer.blender.org/D5041
Diffstat (limited to 'source/blender/editors/util')
-rw-r--r--source/blender/editors/util/ed_util.c92
1 files changed, 47 insertions, 45 deletions
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index df1906ea8a8..c23e004b306 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -54,6 +54,8 @@
#include "BKE_workspace.h"
#include "BKE_material.h"
+#include "DEG_depsgraph.h"
+
#include "ED_armature.h"
#include "ED_buttons.h"
#include "ED_image.h"
@@ -115,61 +117,61 @@ void ED_editors_init(bContext *C)
* e.g. linked objects we have to ensure that they are actually the
* active object in this scene. */
Object *obact = CTX_data_active_object(C);
- if (obact != NULL) {
- for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
- int mode = ob->mode;
- if (mode == OB_MODE_OBJECT) {
- continue;
- }
- else if (BKE_object_has_mode_data(ob, mode)) {
- continue;
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
+ int mode = ob->mode;
+ if (mode == OB_MODE_OBJECT) {
+ continue;
+ }
+ else if (BKE_object_has_mode_data(ob, mode)) {
+ continue;
+ }
+ else if (ob->type == OB_GPENCIL) {
+ /* For multi-edit mode we may already have mode data.
+ * (grease pencil does not need it) */
+ continue;
+ }
+
+ ID *ob_data = ob->data;
+ ob->mode = OB_MODE_OBJECT;
+ DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
+ if (obact && (ob->type == obact->type) && !ID_IS_LINKED(ob) &&
+ !(ob_data && ID_IS_LINKED(ob_data))) {
+ if (mode == OB_MODE_EDIT) {
+ ED_object_editmode_enter_ex(bmain, scene, ob, 0);
}
- else if (ob->type == OB_GPENCIL) {
- /* For multi-edit mode we may already have mode data.
- * (grease pencil does not need it) */
- continue;
+ else if (mode == OB_MODE_POSE) {
+ ED_object_posemode_enter_ex(bmain, ob);
}
-
- ID *ob_data = ob->data;
- ob->mode = OB_MODE_OBJECT;
- if ((ob->type == obact->type) && !ID_IS_LINKED(ob) && !(ob_data && ID_IS_LINKED(ob_data))) {
- if (mode == OB_MODE_EDIT) {
- ED_object_editmode_enter_ex(bmain, scene, ob, 0);
- }
- else if (mode == OB_MODE_POSE) {
- ED_object_posemode_enter_ex(bmain, ob);
- }
- else if (mode & OB_MODE_ALL_SCULPT) {
- if (obact == ob) {
- if (mode == OB_MODE_SCULPT) {
- ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, true, reports);
- }
- else if (mode == OB_MODE_VERTEX_PAINT) {
- ED_object_vpaintmode_enter_ex(bmain, depsgraph, wm, scene, ob);
- }
- else if (mode == OB_MODE_WEIGHT_PAINT) {
- ED_object_wpaintmode_enter_ex(bmain, depsgraph, wm, scene, ob);
- }
- else {
- BLI_assert(0);
- }
+ else if (mode & OB_MODE_ALL_SCULPT) {
+ if (obact == ob) {
+ if (mode == OB_MODE_SCULPT) {
+ ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, true, reports);
+ }
+ else if (mode == OB_MODE_VERTEX_PAINT) {
+ ED_object_vpaintmode_enter_ex(bmain, depsgraph, wm, scene, ob);
+ }
+ else if (mode == OB_MODE_WEIGHT_PAINT) {
+ ED_object_wpaintmode_enter_ex(bmain, depsgraph, wm, scene, ob);
}
else {
- /* Create data for non-active objects which need it for
- * mode-switching but don't yet support multi-editing. */
- if (mode & OB_MODE_ALL_SCULPT) {
- ob->mode = mode;
- BKE_object_sculpt_data_create(ob);
- }
+ BLI_assert(0);
}
}
else {
- /* TODO(campbell): avoid operator calls. */
- if (obact == ob) {
- ED_object_mode_toggle(C, mode);
+ /* Create data for non-active objects which need it for
+ * mode-switching but don't yet support multi-editing. */
+ if (mode & OB_MODE_ALL_SCULPT) {
+ ob->mode = mode;
+ BKE_object_sculpt_data_create(ob);
}
}
}
+ else {
+ /* TODO(campbell): avoid operator calls. */
+ if (obact == ob) {
+ ED_object_mode_toggle(C, mode);
+ }
+ }
}
}