[Bf-blender-cvs] [ce4d52c4f3e] blender2.8: Object Mode: exit vert/weight paint on selection
Campbell Barton
noreply at git.blender.org
Fri Feb 16 14:07:11 CET 2018
Commit: ce4d52c4f3ed1cfbe7c13eab0ec94e27a4ab6904
Author: Campbell Barton
Date: Fri Feb 16 20:57:46 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBce4d52c4f3ed1cfbe7c13eab0ec94e27a4ab6904
Object Mode: exit vert/weight paint on selection
Was keeping data, since objects no longer store modes,
object mode can't be properly detected.
===================================================================
M source/blender/editors/object/object_select.c
M source/blender/makesrna/intern/rna_layer.c
===================================================================
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;
diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c
index 7db3028a020..558b963a768 100644
--- a/source/blender/makesrna/intern/rna_layer.c
+++ b/source/blender/makesrna/intern/rna_layer.c
@@ -847,24 +847,6 @@ static void rna_LayerObjects_active_object_update(struct bContext *C, PointerRNA
return;
}
ViewLayer *view_layer = (ViewLayer *)ptr->data;
-
- /* 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. */
- WorkSpace *workspace = CTX_wm_workspace(C);
- if (workspace->object_mode & OB_MODE_EDIT) {
- Object *obact = OBACT(view_layer);
- FOREACH_OBJECT(view_layer, ob) {
- if (ob != obact) {
- if (BKE_object_is_in_editmode(ob)) {
- ED_object_editmode_exit_ex(NULL, workspace, scene, ob, EM_FREEDATA);
- }
- }
- }
- FOREACH_OBJECT_END;
- }
-
ED_object_base_activate(C, view_layer->basact);
}
More information about the Bf-blender-cvs
mailing list