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:
authorCampbell Barton <ideasman42@gmail.com>2018-02-16 12:57:46 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-02-16 16:01:25 +0300
commitce4d52c4f3ed1cfbe7c13eab0ec94e27a4ab6904 (patch)
tree00e2ca09746f0ad471009eab76b2cb7a46feec24 /source/blender/editors/object
parentc28dea5e241a993ae9f3ca9f5208ad1e5010da63 (diff)
Object Mode: exit vert/weight paint on selection
Was keeping data, since objects no longer store modes, object mode can't be properly detected.
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_select.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 69e0fd20b86..55c0b4c2bdd 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -56,7 +56,9 @@
#include "BKE_layer.h"
#include "BKE_main.h"
#include "BKE_material.h"
+#include "BKE_object.h"
#include "BKE_particle.h"
+#include "BKE_paint.h"
#include "BKE_property.h"
#include "BKE_report.h"
#include "BKE_scene.h"
@@ -136,6 +138,53 @@ void ED_object_base_activate(bContext *C, Base *base)
}
eObjectMode object_mode = workspace->object_mode;
+
+ {
+ Scene *scene = CTX_data_scene(C);
+ /* We don't know the previous active object in update.
+ *
+ * Not correct because it's possible other work-spaces use these.
+ * although that's a corner case. */
+ if (workspace->object_mode & OB_MODE_EDIT) {
+ Object *obact = OBACT(view_layer);
+ FOREACH_OBJECT(view_layer, ob) {
+ if (ob != base->object) {
+ if (BKE_object_is_in_editmode(ob)) {
+ ED_object_editmode_exit_ex(NULL, workspace, scene, ob, EM_FREEDATA);
+ }
+ }
+ }
+ FOREACH_OBJECT_END;
+ }
+ else if (workspace->object_mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_SCULPT)) {
+ Object *obact = OBACT(view_layer);
+ FOREACH_OBJECT(view_layer, ob) {
+ if (ob != base->object) {
+ if (ob->sculpt) {
+ switch (ob->sculpt->mode_type) {
+ case OB_MODE_VERTEX_PAINT:
+ {
+ ED_object_vpaintmode_exit_ex(workspace, ob);
+ break;
+ }
+ case OB_MODE_WEIGHT_PAINT:
+ {
+ ED_object_wpaintmode_exit_ex(workspace, ob);
+ break;
+ }
+ case OB_MODE_SCULPT:
+ {
+ /* TODO */
+ break;
+ }
+ }
+ }
+ }
+ }
+ FOREACH_OBJECT_END;
+ }
+ }
+
workspace->object_mode = OB_MODE_OBJECT;
view_layer->basact = base;