diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface.c | 22 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_smart_stitch.c | 22 |
2 files changed, 25 insertions, 19 deletions
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; } |