Object Mode: add back non '_ex' versions of mode-switching functions
authorCampbell Barton <ideasman42@gmail.com>
Fri, 2 Aug 2019 01:33:57 +0000 (11:33 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 2 Aug 2019 01:44:01 +0000 (11:44 +1000)
While these aren't currently used, its strange to have
extended versions of a function without the non-extended versions
it also avoids callers needing to add them back if they need -
or duplicating the same boiler plate when calling the '_ex' versions.

Reverts 11da3b132aff111da3b132aff1, adds depsgraph argument
so the caller is responsible for the evaluation state.

source/blender/editors/include/ED_object.h
source/blender/editors/object/object_modes.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sculpt_paint/sculpt.c

index 5f9534a1f1c4ce42966e77522edf641e4225d30a..3a74bdc59ff7b36df0501c2215fab7b343e299b4 100644 (file)
@@ -166,11 +166,13 @@ void ED_object_vpaintmode_enter_ex(struct Main *bmain,
                                    struct wmWindowManager *wm,
                                    struct Scene *scene,
                                    struct Object *ob);
+void ED_object_vpaintmode_enter(struct bContext *C, struct Depsgraph *depsgraph);
 void ED_object_wpaintmode_enter_ex(struct Main *bmain,
                                    struct Depsgraph *depsgraph,
                                    struct wmWindowManager *wm,
                                    struct Scene *scene,
                                    struct Object *ob);
+void ED_object_wpaintmode_enter(struct bContext *C, struct Depsgraph *depsgraph);
 
 void ED_object_vpaintmode_exit_ex(struct Object *ob);
 void ED_object_vpaintmode_exit(struct bContext *C);
@@ -183,10 +185,14 @@ void ED_object_sculptmode_enter_ex(struct Main *bmain,
                                    struct Object *ob,
                                    const bool force_dyntopo,
                                    struct ReportList *reports);
+void ED_object_sculptmode_enter(struct bContext *C,
+                                struct Depsgraph *depsgraph,
+                                struct ReportList *reports);
 void ED_object_sculptmode_exit_ex(struct Main *bmain,
                                   struct Depsgraph *depsgraph,
                                   struct Scene *scene,
                                   struct Object *ob);
+void ED_object_sculptmode_exit(struct bContext *C, struct Depsgraph *depsgraph);
 
 void ED_object_location_from_view(struct bContext *C, float loc[3]);
 void ED_object_rotation_from_quat(float rot[3], const float quat[4], const char align_axis);
@@ -267,6 +273,7 @@ bool ED_object_mode_compat_set(struct bContext *C,
                                struct ReportList *reports);
 void ED_object_mode_toggle(struct bContext *C, eObjectMode mode);
 void ED_object_mode_set(struct bContext *C, eObjectMode mode);
+void ED_object_mode_exit(struct bContext *C, struct Depsgraph *depsgraph);
 
 bool ED_object_mode_generic_enter(struct bContext *C, eObjectMode object_mode);
 void ED_object_mode_generic_exit(struct Main *bmain,
index 271d8effd308088230889e0abb26f73069f420af..80e7e6312aa0494382039de277546ec051f6ae98 100644 (file)
@@ -186,6 +186,19 @@ void ED_object_mode_set(bContext *C, eObjectMode mode)
   wm->op_undo_depth--;
 }
 
+void ED_object_mode_exit(bContext *C, Depsgraph *depsgraph)
+{
+  struct Main *bmain = CTX_data_main(C);
+  Scene *scene = CTX_data_scene(C);
+  ViewLayer *view_layer = CTX_data_view_layer(C);
+  FOREACH_OBJECT_BEGIN (view_layer, ob) {
+    if (ob->mode & OB_MODE_ALL_MODE_DATA) {
+      ED_object_mode_generic_exit(bmain, depsgraph, scene, ob);
+    }
+  }
+  FOREACH_OBJECT_END;
+}
+
 /** \} */
 
 /* -------------------------------------------------------------------- */
index 9215a90c446753ef5a6250c1e78e4fc147ec41ac..32b89f5676fe1cc203ecd4195c4ef0cda686cab0 100644 (file)
@@ -1171,11 +1171,28 @@ void ED_object_vpaintmode_enter_ex(
 {
   ed_vwpaintmode_enter_generic(bmain, depsgraph, wm, scene, ob, OB_MODE_VERTEX_PAINT);
 }
+void ED_object_vpaintmode_enter(struct bContext *C, Depsgraph *depsgraph)
+{
+  Main *bmain = CTX_data_main(C);
+  wmWindowManager *wm = CTX_wm_manager(C);
+  Scene *scene = CTX_data_scene(C);
+  Object *ob = CTX_data_active_object(C);
+  ED_object_vpaintmode_enter_ex(bmain, depsgraph, wm, scene, ob);
+}
+
 void ED_object_wpaintmode_enter_ex(
     Main *bmain, Depsgraph *depsgraph, wmWindowManager *wm, Scene *scene, Object *ob)
 {
   ed_vwpaintmode_enter_generic(bmain, depsgraph, wm, scene, ob, OB_MODE_WEIGHT_PAINT);
 }
+void ED_object_wpaintmode_enter(struct bContext *C, Depsgraph *depsgraph)
+{
+  Main *bmain = CTX_data_main(C);
+  wmWindowManager *wm = CTX_wm_manager(C);
+  Scene *scene = CTX_data_scene(C);
+  Object *ob = CTX_data_active_object(C);
+  ED_object_wpaintmode_enter_ex(bmain, depsgraph, wm, scene, ob);
+}
 
 /** \} */
 
index c8709d40f966d57199ffaa61fa0ab16109871187..eeda7a7aeaf56504c50e86e38eac62783fee2c61 100644 (file)
@@ -6152,6 +6152,15 @@ void ED_object_sculptmode_enter_ex(Main *bmain,
   DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
 }
 
+void ED_object_sculptmode_enter(struct bContext *C, Depsgraph *depsgraph, ReportList *reports)
+{
+  Main *bmain = CTX_data_main(C);
+  Scene *scene = CTX_data_scene(C);
+  ViewLayer *view_layer = CTX_data_view_layer(C);
+  Object *ob = OBACT(view_layer);
+  ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, false, reports);
+}
+
 void ED_object_sculptmode_exit_ex(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
 {
   const int mode_flag = OB_MODE_SCULPT;
@@ -6198,6 +6207,15 @@ void ED_object_sculptmode_exit_ex(Main *bmain, Depsgraph *depsgraph, Scene *scen
   DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
 }
 
+void ED_object_sculptmode_exit(bContext *C, Depsgraph *depsgraph)
+{
+  Main *bmain = CTX_data_main(C);
+  Scene *scene = CTX_data_scene(C);
+  ViewLayer *view_layer = CTX_data_view_layer(C);
+  Object *ob = OBACT(view_layer);
+  ED_object_sculptmode_exit_ex(bmain, depsgraph, scene, ob);
+}
+
 static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op)
 {
   struct wmMsgBus *mbus = CTX_wm_message_bus(C);