Merge branch 'master' into blender2.8
[blender.git] / source / blender / editors / uvedit / uvedit_unwrap_ops.c
index 521470d..78b4125 100644 (file)
@@ -147,7 +147,7 @@ static bool ED_uvedit_ensure_uvs(bContext *C, Scene *UNUSED(scene), Object *obed
                        }
                }
        }
-       
+
        /* select new UV's (ignore UV_SYNC_SELECTION in this case) */
        BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
                BMIter liter;
@@ -170,7 +170,7 @@ static bool uvedit_have_selection(Scene *scene, BMEditMesh *em, bool implicit)
        BMLoop *l;
        BMIter iter, liter;
        const int cd_loop_uv_offset  = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
-       
+
        if (cd_loop_uv_offset == -1) {
                return (em->bm->totfacesel != 0);
        }
@@ -184,15 +184,15 @@ static bool uvedit_have_selection(Scene *scene, BMEditMesh *em, bool implicit)
                }
                else if (!BM_elem_flag_test(efa, BM_ELEM_SELECT))
                        continue;
-       
+
                BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
                        if (uvedit_uv_select_test(scene, l, cd_loop_uv_offset))
                                break;
                }
-               
+
                if (implicit && !l)
                        continue;
-               
+
                return true;
        }
 
@@ -277,7 +277,7 @@ static ParamHandle *construct_param_handle(
        BMEdge *eed;
        BMIter iter, liter;
        int i;
-       
+
        const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
 
        handle = param_construct_begin();
@@ -290,10 +290,10 @@ static ParamHandle *construct_param_handle(
                if (aspx != aspy)
                        param_aspect_ratio(handle, aspx, aspy);
        }
-       
+
        /* we need the vert indices */
        BM_mesh_elem_index_ensure(bm, BM_VERT);
-       
+
        BM_ITER_MESH_INDEX (efa, &iter, bm, BM_FACES_OF_MESH, i) {
 
                if ((BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) || (sel && BM_elem_flag_test(efa, BM_ELEM_SELECT) == 0)) {
@@ -494,7 +494,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, B
 
        smd.levels = smd_real->levels;
        smd.subdivType = smd_real->subdivType;
-               
+
        initialDerived = CDDM_from_editbmesh(em, false, false);
        derivedMesh = subsurf_make_derived_from_derived(initialDerived, &smd,
                                                        NULL, SUBSURF_IN_EDIT_MODE);
@@ -563,7 +563,7 @@ static ParamHandle *construct_param_handle_subsurfed(Scene *scene, Object *ob, B
                co[1] = subsurfedVerts[mloop[1].v].co;
                co[2] = subsurfedVerts[mloop[2].v].co;
                co[3] = subsurfedVerts[mloop[3].v].co;
-               
+
                /* This is where all the magic is done. If the vertex exists in the, we pass the original uv pointer to the solver, thus
                 * flushing the solution to the edit mesh. */
                texface_from_original_index(origFace, origVertIndices[mloop[0].v], &uv[0], &pin[0], &select[0], scene, cd_loop_uv_offset);
@@ -791,7 +791,7 @@ void UV_OT_minimize_stretch(wmOperatorType *ot)
        ot->idname = "UV_OT_minimize_stretch";
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_GRAB_CURSOR | OPTYPE_BLOCKING;
        ot->description = "Reduce UV stretching by relaxing angles";
-       
+
        /* api callbacks */
        ot->exec = minimize_stretch_exec;
        ot->invoke = minimize_stretch_invoke;
@@ -869,7 +869,7 @@ void UV_OT_pack_islands(wmOperatorType *ot)
        ot->description = "Transform all islands so that they fill up the UV space as much as possible";
 
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-       
+
        /* api callbacks */
        ot->exec = pack_islands_exec;
        ot->poll = ED_operator_uvedit;
@@ -897,7 +897,7 @@ static int average_islands_scale_exec(bContext *C, wmOperator *UNUSED(op))
        param_average(handle);
        param_flush(handle);
        param_delete(handle);
-       
+
        DEG_id_tag_update(obedit->data, 0);
        WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
 
@@ -912,7 +912,7 @@ void UV_OT_average_islands_scale(wmOperatorType *ot)
        ot->description = "Average the size of separate UV islands, based on their area in 3D space";
 
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-       
+
        /* api callbacks */
        ot->exec = average_islands_scale_exec;
        ot->poll = ED_operator_uvedit;
@@ -950,7 +950,7 @@ void ED_uvedit_live_unwrap_re_solve(void)
                param_flush(liveHandle);
        }
 }
-       
+
 void ED_uvedit_live_unwrap_end(short cancel)
 {
        if (liveHandle) {
@@ -1139,7 +1139,7 @@ static void uv_map_transform(bContext *C, wmOperator *op, float rotmat[4][4])
        /* be compatible to the "old" sphere/cylinder mode */
        if (direction == ALIGN_TO_OBJECT)
                unit_m4(rotmat);
-       else 
+       else
                uv_map_rotation_matrix(rotmat, rv3d, obedit, upangledeg, sideangledeg, radius);
 
 }
@@ -1174,21 +1174,21 @@ static void correct_uv_aspect(Scene *scene, Object *ob, BMEditMesh *em)
        MLoopUV *luv;
        BMFace *efa;
        float scale, aspx, aspy;
-       
+
        const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
 
        ED_uvedit_get_aspect(scene, ob, em->bm, &aspx, &aspy);
-       
+
        if (aspx == aspy)
                return;
-               
+
        if (aspx > aspy) {
                scale = aspy / aspx;
 
                BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
                        if (!BM_elem_flag_test(efa, BM_ELEM_SELECT))
                                continue;
-                       
+
                        BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
                                luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
                                luv->uv[0] = ((luv->uv[0] - 0.5f) * scale) + 0.5f;
@@ -1201,7 +1201,7 @@ static void correct_uv_aspect(Scene *scene, Object *ob, BMEditMesh *em)
                BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
                        if (!BM_elem_flag_test(efa, BM_ELEM_SELECT))
                                continue;
-                       
+
                        BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
                                luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
                                luv->uv[1] = ((luv->uv[1] - 0.5f) * scale) + 0.5f;
@@ -1436,7 +1436,7 @@ void UV_OT_unwrap(wmOperatorType *ot)
        ot->description = "Unwrap the mesh of the object being edited";
        ot->idname = "UV_OT_unwrap";
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-       
+
        /* api callbacks */
        ot->exec = unwrap_exec;
        ot->poll = ED_operator_uvmap;
@@ -1596,7 +1596,7 @@ void UV_OT_project_from_view(wmOperatorType *ot)
        ot->description = "Project the UV vertices of the mesh as seen in current 3D view";
 
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-       
+
        /* api callbacks */
        ot->invoke = uv_from_view_invoke;
        ot->exec = uv_from_view_exec;
@@ -1651,7 +1651,7 @@ void UV_OT_reset(wmOperatorType *ot)
        ot->description = "Reset UV projection";
 
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-       
+
        /* api callbacks */
        ot->exec = reset_exec;
        ot->poll = ED_operator_uvmap;
@@ -1670,7 +1670,7 @@ static void uv_sphere_project(float target[2], float source[3], float center[3],
 
        /* split line is always zero */
        if (target[0] >= 1.0f)
-               target[0] -= 1.0f;  
+               target[0] -= 1.0f;
 }
 
 static void uv_map_mirror(BMEditMesh *em, BMFace *efa)
@@ -1764,7 +1764,7 @@ void UV_OT_sphere_project(wmOperatorType *ot)
        ot->description = "Project the UV vertices of the mesh over the curved surface of a sphere";
 
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-       
+
        /* api callbacks */
        ot->exec = sphere_project_exec;
        ot->poll = ED_operator_uvmap;
@@ -1787,7 +1787,7 @@ static void uv_cylinder_project(float target[2], float source[3], float center[3
 
        /* split line is always zero */
        if (target[0] >= 1.0f)
-               target[0] -= 1.0f;  
+               target[0] -= 1.0f;
 }
 
 static int cylinder_project_exec(bContext *C, wmOperator *op)
@@ -1852,7 +1852,7 @@ void UV_OT_cylinder_project(wmOperatorType *ot)
        ot->description = "Project the UV vertices of the mesh over the curved wall of a cylinder";
 
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-       
+
        /* api callbacks */
        ot->exec = cylinder_project_exec;
        ot->poll = ED_operator_uvmap;
@@ -1969,7 +1969,7 @@ void UV_OT_cube_project(wmOperatorType *ot)
        ot->description = "Project the UV vertices of the mesh over the six faces of a cube";
 
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-       
+
        /* api callbacks */
        ot->exec = cube_project_exec;
        ot->poll = ED_operator_uvmap;