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>2013-02-12 04:35:31 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-02-12 04:35:31 +0400
commit533f359c0d2587659566877fee7135d8c9828c06 (patch)
treebfd21f0edd600e9f9df204d956363e190d795112
parentfcbd9c3a332fda86c2fe9e8cf5ddfacf29b85419 (diff)
code cleanup: some style edits, also allow mul_v2_m2v2() to have the same value as in-out, since this is a convention for existing matrix functions.
-rw-r--r--source/blender/blenlib/intern/math_matrix.c9
-rw-r--r--source/blender/editors/interface/interface.c22
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c22
3 files changed, 31 insertions, 22 deletions
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index c12588463b0..9d9e3e611e1 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -344,10 +344,13 @@ void mul_v3_m4v3(float in[3], float mat[4][4], const float vec[3])
in[2] = x * mat[0][2] + y * mat[1][2] + mat[2][2] * vec[2] + mat[3][2];
}
-void mul_v2_m2v2(float r[2], float M[2][2], const float v[2])
+void mul_v2_m2v2(float r[2], float mat[2][2], const float vec[2])
{
- r[0] = M[0][0]*v[0] + M[1][0]*v[1];
- r[1] = M[0][1]*v[0] + M[1][1]*v[1];
+ float x;
+
+ x = vec[0];
+ r[0] = mat[0][0] * x + mat[1][0] * vec[1];
+ r[1] = mat[0][1] * x + mat[1][1] * vec[1];
}
/* same as mul_m4_v3() but doesnt apply translation component */
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 4a5f3acad4f..9cd86a2647c 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -2781,21 +2781,21 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str,
return but;
}
-/* ui_def_but_rna_propname and ui_def_but_rna
+static void ui_def_but_rna__disable(uiBut *but)
+{
+ but->flag |= UI_BUT_DISABLED;
+ but->lock = true;
+ but->lockstr = "";
+}
+
+/**
+ * ui_def_but_rna_propname and ui_def_but_rna
* both take the same args except for propname vs prop, this is done so we can
* avoid an extra lookup on 'prop' when its already available.
*
* When this kind of change won't disrupt branches, best look into making more
* of our UI functions take prop rather then propname.
*/
-
-#define UI_DEF_BUT_RNA_DISABLE(but) { \
- but->flag |= UI_BUT_DISABLED; \
- but->lock = TRUE; \
- but->lockstr = ""; \
- } (void)0
-
-
static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *str,
int x, int y, short width, short height,
PointerRNA *ptr, PropertyRNA *prop, int index,
@@ -2932,7 +2932,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
}
if (!RNA_property_editable(&but->rnapoin, prop)) {
- UI_DEF_BUT_RNA_DISABLE(but);
+ ui_def_but_rna__disable(but);
}
if (but->flag & UI_BUT_UNDO && (ui_but_is_rna_undo(but) == FALSE)) {
@@ -2962,7 +2962,7 @@ static uiBut *ui_def_but_rna_propname(uiBlock *block, int type, int retval, cons
else {
but = ui_def_but(block, type, retval, propname, x, y, width, height, NULL, min, max, a1, a2, tip);
- UI_DEF_BUT_RNA_DISABLE(but);
+ ui_def_but_rna__disable(but);
}
return but;
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index b7e12dda663..5bb8105cd14 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -429,13 +429,18 @@ static void stitch_calculate_island_snapping(StitchState *state, PreviewPosition
}
island_stitch_data[i].medianPoint[1] /= state->aspect;
- if ((island_stitch_data[i].rotation + island_stitch_data[i].rotation_neg < M_PI_2) ||
- island_stitch_data[i].num_rot_elements == 0 || island_stitch_data[i].num_rot_elements_neg == 0)
- rotation = (island_stitch_data[i].rotation*island_stitch_data[i].num_rot_elements -
- island_stitch_data[i].rotation_neg*island_stitch_data[i].num_rot_elements_neg)/totelem;
- else
- rotation = (island_stitch_data[i].rotation*island_stitch_data[i].num_rot_elements +
- (2*M_PI - island_stitch_data[i].rotation_neg)*island_stitch_data[i].num_rot_elements_neg)/totelem;
+ if ((island_stitch_data[i].rotation + island_stitch_data[i].rotation_neg < (float)M_PI_2) ||
+ island_stitch_data[i].num_rot_elements == 0 || island_stitch_data[i].num_rot_elements_neg == 0)
+ {
+ rotation = (island_stitch_data[i].rotation * island_stitch_data[i].num_rot_elements -
+ island_stitch_data[i].rotation_neg *
+ island_stitch_data[i].num_rot_elements_neg) / totelem;
+ }
+ else {
+ rotation = (island_stitch_data[i].rotation * island_stitch_data[i].num_rot_elements +
+ (2.0f * (float)M_PI - island_stitch_data[i].rotation_neg) *
+ island_stitch_data[i].num_rot_elements_neg) / totelem;
+ }
rotate_m2(rotation_mat, rotation);
numOfIslandUVs = getNumOfIslandUvs(state->element_map, i);
@@ -521,7 +526,8 @@ static void stitch_island_calculate_edge_rotation(UvEdge *edge, StitchState *sta
if (edgesin > 0.0f) {
island_stitch_data[element1->island].num_rot_elements++;
island_stitch_data[element1->island].rotation += rotation;
- } else {
+ }
+ else {
island_stitch_data[element1->island].num_rot_elements_neg++;
island_stitch_data[element1->island].rotation_neg += rotation;
}