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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-01-09 02:16:51 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-01-09 02:21:51 +0300
commitb536d1b95f01de9400d77dbaf311677222063178 (patch)
treeeb2dd3502c70a35b18fa08af006dc5d98930d782 /source
parent1b6b0fbd957f70ea177dbfd431ec2a2ba2d0daa6 (diff)
Object Mode: only toggle active object mode once
- When toggling a mode that doesn't support multi editing only do this once of the active object. - For sculpt mode create sculpt data since this is needed for activating other sculpt objects on reload.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_object.h2
-rw-r--r--source/blender/blenkernel/intern/object.c7
-rw-r--r--source/blender/blenloader/intern/readfile.c3
-rw-r--r--source/blender/editors/util/ed_util.c12
4 files changed, 21 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 329be174632..3348131cc4b 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -293,6 +293,8 @@ void BKE_object_handle_update_ex(
const bool do_proxy_update);
void BKE_object_sculpt_modifiers_changed(struct Object *ob);
+void BKE_object_sculpt_data_create(struct Object *ob);
+
int BKE_object_obdata_texspace_get(struct Object *ob, short **r_texflag, float **r_loc, float **r_size, float **r_rot);
struct Mesh *BKE_object_get_evaluated_mesh(const struct Depsgraph *depsgraph, struct Object *ob);
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 78e22c203ab..62f5b018545 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2959,6 +2959,13 @@ void BKE_object_handle_update(Depsgraph *depsgraph, Scene *scene, Object *ob)
BKE_object_handle_update_ex(depsgraph, scene, ob, NULL, true);
}
+void BKE_object_sculpt_data_create(Object *ob)
+{
+ BLI_assert(ob->mode & OB_MODE_ALL_SCULPT);
+ ob->sculpt = MEM_callocN(sizeof(SculptSession), __func__);
+ ob->sculpt->mode_type = ob->mode;
+}
+
void BKE_object_sculpt_modifiers_changed(Object *ob)
{
SculptSession *ss = ob->sculpt;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index bc3d38fd7f4..c7e9b8cd4ad 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5648,8 +5648,7 @@ static void direct_link_object(FileData *fd, Object *ob)
if (ob->sculpt) {
/* Only create data on undo, otherwise rely on editor mode switching. */
if (fd->memfile && (ob->mode & OB_MODE_ALL_SCULPT)) {
- ob->sculpt = MEM_callocN(sizeof(SculptSession), "reload sculpt session");
- ob->sculpt->mode_type = ob->mode;
+ BKE_object_sculpt_data_create(ob);
}
else {
ob->sculpt = NULL;
diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c
index b3ec0a4388f..188d06cec55 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -130,7 +130,17 @@ void ED_editors_init(bContext *C)
ED_object_posemode_enter_ex(bmain, ob);
}
else {
- ED_object_mode_toggle(C, mode);
+ if (obact == ob) {
+ ED_object_mode_toggle(C, mode);
+ }
+ 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);
+ }
+ }
}
}
}