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>2012-07-29 21:49:14 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-29 21:49:14 +0400
commitf608b3c44402ef5c58217481d93e7fa83c9cd7cf (patch)
treecc8211154eb5a3cf9e1d89484cbe48facd51b90e /source/blender
parentc41e1e434ab9defa35178ad8886d81b60d889e9a (diff)
code cleanup:
- building without python works again - rename maxi/mini to i_max/i_min (so thay are available for function names) - some minor edits to IK stretch setting (no functional changes).
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/context.c2
-rw-r--r--source/blender/bmesh/operators/bmo_utils.c8
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c36
-rw-r--r--source/blender/ikplugin/intern/iksolver_plugin.c3
-rw-r--r--source/blender/ikplugin/intern/itasc_plugin.cpp5
5 files changed, 29 insertions, 25 deletions
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 393dbe0847d..be81c70f261 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -242,6 +242,8 @@ static void *ctx_wm_python_context_get(const bContext *C, const char *member, vo
if (result.ptr.data)
return result.ptr.data;
}
+#else
+ (void)C, (void)member;
#endif
return fall_through;
diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c
index 6d5d74ebed1..1d73435032d 100644
--- a/source/blender/bmesh/operators/bmo_utils.c
+++ b/source/blender/bmesh/operators/bmo_utils.c
@@ -304,7 +304,7 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
BLI_array_declare(fstack);
BMLoop *l, *l2;
float maxx, maxx_test, cent[3];
- int i, maxi, flagflip = BMO_slot_bool_get(op, "do_flip");
+ int i, i_max, flagflip = BMO_slot_bool_get(op, "do_flip");
startf = NULL;
maxx = -1.0e10;
@@ -353,7 +353,7 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
BMO_elem_flag_enable(bm, startf, FACE_VIS);
i = 0;
- maxi = 1;
+ i_max = 1;
while (i >= 0) {
f = fstack[i];
i--;
@@ -381,9 +381,9 @@ void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
}
}
- if (i == maxi) {
+ if (i == i_max) {
BLI_array_grow_one(fstack);
- maxi++;
+ i_max++;
}
fstack[i] = l2->f;
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index a2e276c09e3..c6ded2a91cf 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -3469,7 +3469,7 @@ static float p_chart_minimum_area_angle(PChart *chart)
float rotated, minarea, minangle, area, len;
float *angles, miny, maxy, v[2], a[4], mina;
- int npoints, right, mini, maxi, i, idx[4], nextidx;
+ int npoints, right, i_min, i_max, i, idx[4], nextidx;
PVert **points, *p1, *p2, *p3, *p4, *p1n;
/* compute convex hull */
@@ -3479,7 +3479,7 @@ static float p_chart_minimum_area_angle(PChart *chart)
/* find left/top/right/bottom points, and compute angle for each point */
angles = MEM_mallocN(sizeof(float) * npoints, "PMinAreaAngles");
- mini = maxi = 0;
+ i_min = i_max = 0;
miny = 1e10;
maxy = -1e10;
@@ -3492,19 +3492,19 @@ static float p_chart_minimum_area_angle(PChart *chart)
if (points[i]->uv[1] < miny) {
miny = points[i]->uv[1];
- mini = i;
+ i_min = i;
}
if (points[i]->uv[1] > maxy) {
maxy = points[i]->uv[1];
- maxi = i;
+ i_max = i;
}
}
/* left, top, right, bottom */
idx[0] = 0;
- idx[1] = maxi;
+ idx[1] = i_max;
idx[2] = right;
- idx[3] = mini;
+ idx[3] = i_min;
v[0] = points[idx[0]]->uv[0];
v[1] = points[idx[0]]->uv[1] + 1.0f;
@@ -3530,29 +3530,29 @@ static float p_chart_minimum_area_angle(PChart *chart)
while (rotated <= (float)(M_PI / 2.0)) { /* INVESTIGATE: how far to rotate? */
/* rotate with the smallest angle */
- mini = 0;
+ i_min = 0;
mina = 1e10;
for (i = 0; i < 4; i++)
if (a[i] < mina) {
mina = a[i];
- mini = i;
+ i_min = i;
}
rotated += mina;
- nextidx = (idx[mini] + 1) % npoints;
+ nextidx = (idx[i_min] + 1) % npoints;
- a[mini] = angles[nextidx];
- a[(mini + 1) % 4] = a[(mini + 1) % 4] - mina;
- a[(mini + 2) % 4] = a[(mini + 2) % 4] - mina;
- a[(mini + 3) % 4] = a[(mini + 3) % 4] - mina;
+ a[i_min] = angles[nextidx];
+ a[(i_min + 1) % 4] = a[(i_min + 1) % 4] - mina;
+ a[(i_min + 2) % 4] = a[(i_min + 2) % 4] - mina;
+ a[(i_min + 3) % 4] = a[(i_min + 3) % 4] - mina;
/* compute area */
- p1 = points[idx[mini]];
+ p1 = points[idx[i_min]];
p1n = points[nextidx];
- p2 = points[idx[(mini + 1) % 4]];
- p3 = points[idx[(mini + 2) % 4]];
- p4 = points[idx[(mini + 3) % 4]];
+ p2 = points[idx[(i_min + 1) % 4]];
+ p3 = points[idx[(i_min + 2) % 4]];
+ p4 = points[idx[(i_min + 3) % 4]];
len = len_v2v2(p1->uv, p1n->uv);
@@ -3570,7 +3570,7 @@ static float p_chart_minimum_area_angle(PChart *chart)
}
}
- idx[mini] = nextidx;
+ idx[i_min] = nextidx;
}
/* try keeping rotation as small as possible */
diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c
index 86bdc7e1ab6..af15333ece5 100644
--- a/source/blender/ikplugin/intern/iksolver_plugin.c
+++ b/source/blender/ikplugin/intern/iksolver_plugin.c
@@ -334,7 +334,8 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
IK_SetStiffness(seg, IK_Z, pchan->stiffness[2]);
if (tree->stretch && (pchan->ikstretch > 0.0f)) {
- double ikstretch = (double)pchan->ikstretch * (double)pchan->ikstretch;
+ const float ikstretch = pchan->ikstretch * pchan->ikstretch;
+ /* this function does its own clamping */
IK_SetStiffness(seg, IK_TRANS_Y, 1.0f - ikstretch);
IK_SetLimit(seg, IK_TRANS_Y, IK_STRETCH_STIFF_MIN, IK_STRETCH_STIFF_MAX);
}
diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp
index 1154605c673..516a4c7fdda 100644
--- a/source/blender/ikplugin/intern/itasc_plugin.cpp
+++ b/source/blender/ikplugin/intern/itasc_plugin.cpp
@@ -1254,8 +1254,9 @@ static IK_Scene *convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan)
joint = bone->name;
joint += ":TY";
ret = arm->addSegment(joint, parent, KDL::Joint::TransY, rot[ikchan->ndof - 1]);
- float ikstretch = pchan->ikstretch * pchan->ikstretch;
- weight[1] = (1.0 - minf(1.0 - ikstretch, 0.99));
+ const float ikstretch = pchan->ikstretch * pchan->ikstretch;
+ /* why invert twice here? */
+ weight[1] = (1.0 - minf(1.0 - ikstretch, 1.0f - IK_STRETCH_STIFF_EPS));
weights.push_back(weight[1]);
}
if (!ret)