Cleanup: pass selectmode directly
authorCampbell Barton <ideasman42@gmail.com>
Tue, 13 Mar 2018 15:02:05 +0000 (02:02 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 13 Mar 2018 15:08:29 +0000 (02:08 +1100)
Pass instead of editmesh or toolsettings.
Needed for multi edit-mode

source/blender/editors/include/ED_mesh.h
source/blender/editors/mesh/editmesh_select.c
source/blender/editors/mesh/editmesh_utils.c
source/blender/editors/mesh/mesh_data.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_hook.c
source/blender/editors/object/object_relations.c
source/blender/makesrna/intern/rna_object.c
source/blenderplayer/bad_level_call_stubs/stubs.c

index 5ed6105..40d796a 100644 (file)
@@ -80,7 +80,7 @@ void EDBM_mesh_normals_update(struct BMEditMesh *em);
 void EDBM_mesh_clear(struct BMEditMesh *em);
 
 void EDBM_selectmode_to_scene(struct bContext *C);
-void EDBM_mesh_make(struct ToolSettings *ts, struct Object *ob, const bool add_key_index);
+void EDBM_mesh_make(struct Object *ob, const int select_mode, const bool add_key_index);
 void EDBM_mesh_free(struct BMEditMesh *em);
 void EDBM_mesh_load(struct Object *ob);
 struct DerivedMesh *EDBM_mesh_deform_dm_get(struct BMEditMesh *em);
index f0ad491..7d20f7a 100644 (file)
@@ -2422,10 +2422,10 @@ static bool select_linked_delimit_test(
  * Gets the default from the operator fallback to own last-used value
  * (selected based on mode)
  */
-static int select_linked_delimit_default_from_op(wmOperator *op, BMEditMesh *em)
+static int select_linked_delimit_default_from_op(wmOperator *op, int select_mode)
 {
        static char delimit_last_store[2] = {0, BMO_DELIM_SEAM};
-       int delimit_last_index = (em->selectmode & (SCE_SELECT_VERTEX | SCE_SELECT_EDGE)) == 0;
+       int delimit_last_index = (select_mode & (SCE_SELECT_VERTEX | SCE_SELECT_EDGE)) == 0;
        char *delimit_last = &delimit_last_store[delimit_last_index];
        PropertyRNA *prop_delimit = RNA_struct_find_property(op->ptr, "delimit");
        int delimit;
@@ -2495,7 +2495,7 @@ static int edbm_select_linked_exec(bContext *C, wmOperator *op)
        BMWalker walker;
 
 #ifdef USE_LINKED_SELECT_DEFAULT_HACK
-       int delimit = select_linked_delimit_default_from_op(op, em);
+       int delimit = select_linked_delimit_default_from_op(op, em->selectmode);
 #else
        int delimit = RNA_enum_get(op->ptr, "delimit");
 #endif
@@ -2827,7 +2827,7 @@ static int edbm_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmE
        }
 
 #ifdef USE_LINKED_SELECT_DEFAULT_HACK
-       int delimit = select_linked_delimit_default_from_op(op, em);
+       int delimit = select_linked_delimit_default_from_op(op, em->selectmode);
 #else
        int delimit = RNA_enum_get(op->ptr, "delimit");
 #endif
@@ -2864,7 +2864,7 @@ static int edbm_select_linked_pick_exec(bContext *C, wmOperator *op)
        BMElem *ele = EDBM_elem_from_index_any(em, index);
 
 #ifdef USE_LINKED_SELECT_DEFAULT_HACK
-       int delimit = select_linked_delimit_default_from_op(op, em);
+       int delimit = select_linked_delimit_default_from_op(op, em->selectmode);
 #else
        int delimit = RNA_enum_get(op->ptr, "delimit");
 #endif
index 8197e36..5595ca0 100644 (file)
@@ -330,7 +330,7 @@ void EDBM_selectmode_to_scene(bContext *C)
        WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, scene);
 }
 
-void EDBM_mesh_make(ToolSettings *ts, Object *ob, const bool add_key_index)
+void EDBM_mesh_make(Object *ob, const int select_mode, const bool add_key_index)
 {
        Mesh *me = ob->data;
        BMesh *bm;
@@ -357,7 +357,7 @@ void EDBM_mesh_make(ToolSettings *ts, Object *ob, const bool add_key_index)
        me->edit_btmesh = BKE_editmesh_create(bm, false);
 #endif
 
-       me->edit_btmesh->selectmode = me->edit_btmesh->bm->selectmode = ts->selectmode;
+       me->edit_btmesh->selectmode = me->edit_btmesh->bm->selectmode = select_mode;
        me->edit_btmesh->mat_nr = (ob->actcol > 0) ? ob->actcol - 1 : 0;
        me->edit_btmesh->ob = ob;
 
index cfeda36..84d2ac3 100644 (file)
@@ -596,7 +596,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, const wmEvent *e
        obedit = base->object;
        me = obedit->data;
        if (me->edit_btmesh == NULL) {
-               EDBM_mesh_make(scene->toolsettings, obedit, false);
+               EDBM_mesh_make(obedit, scene->toolsettings->selectmode, false);
                exitmode = 1;
        }
        if (me->edit_btmesh == NULL)
index 32f0f1f..add2ab9 100644 (file)
@@ -564,7 +564,7 @@ void ED_object_editmode_enter(bContext *C, int flag)
 
                const bool use_key_index = mesh_needs_keyindex(ob->data);
 
-               EDBM_mesh_make(scene->toolsettings, ob, use_key_index);
+               EDBM_mesh_make(ob, scene->toolsettings->selectmode, use_key_index);
 
                em = BKE_editmesh_from_object(ob);
                if (LIKELY(em)) {
index 42e3a4a..e9203fa 100644 (file)
@@ -316,7 +316,7 @@ static bool object_hook_index_array(Scene *scene, Object *obedit,
                        BMEditMesh *em;
 
                        EDBM_mesh_load(obedit);
-                       EDBM_mesh_make(scene->toolsettings, obedit, true);
+                       EDBM_mesh_make(obedit, scene->toolsettings->selectmode, true);
 
                        DAG_id_tag_update(obedit->data, 0);
 
index f8c80f2..83d67ce 100644 (file)
@@ -140,7 +140,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
                BMEditMesh *em;
 
                EDBM_mesh_load(obedit);
-               EDBM_mesh_make(scene->toolsettings, obedit, true);
+               EDBM_mesh_make(obedit, scene->toolsettings->selectmode, true);
 
                DAG_id_tag_update(obedit->data, 0);
 
index e6e7069..1d77030 100644 (file)
@@ -273,7 +273,7 @@ static void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA
                switch (ob->type) {
                        case OB_MESH:
                                EDBM_mesh_load(ob);
-                               EDBM_mesh_make(scene->toolsettings, ob, true);
+                               EDBM_mesh_make(ob, scene->toolsettings->selectmode, true);
 
                                DAG_id_tag_update(ob->data, 0);
 
index 8399b43..9486546 100644 (file)
@@ -224,7 +224,7 @@ bool BPY_string_is_keyword(const char *str) { return false; }
 /*new render funcs */
 void EDBM_selectmode_set(struct BMEditMesh *em) RET_NONE
 void EDBM_mesh_load(struct Object *ob) RET_NONE
-void EDBM_mesh_make(struct ToolSettings *ts, struct Object *ob, const bool use_key_index) RET_NONE
+void EDBM_mesh_make(struct Object *ob, const int select_mode, const bool use_key_index) RET_NONE
 void EDBM_mesh_normals_update(struct BMEditMesh *em) RET_NONE
 void *g_system;
 bool EDBM_uv_check(struct BMEditMesh *em) RET_ZERO