diff options
Diffstat (limited to 'source/blender/editors/transform/transform_orientations.c')
-rw-r--r-- | source/blender/editors/transform/transform_orientations.c | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index dcfad455575..de6c56246a0 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -316,28 +316,24 @@ void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target) { void BIF_removeTransformOrientationIndex(bContext *C, int index) { ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; - TransformOrientation *ts = transform_spaces->first; - int i; - - for (i = 0, ts = transform_spaces->first; ts; ts = ts->next, i++) { - if (i == index) { - View3D *v3d = CTX_wm_view3d(C); - if(v3d) { - int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM); - - // Transform_fix_me NEED TO DO THIS FOR ALL VIEW3D - if (selected_index == i) { - v3d->twmode = V3D_MANIP_GLOBAL; /* fallback to global */ - } - else if (selected_index > i) { - v3d->twmode--; - } - - } + TransformOrientation *ts= BLI_findlink(transform_spaces, index); - BLI_freelinkN(transform_spaces, ts); - break; + if (ts) { + View3D *v3d = CTX_wm_view3d(C); + if(v3d) { + int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM); + + // Transform_fix_me NEED TO DO THIS FOR ALL VIEW3D + if (selected_index == index) { + v3d->twmode = V3D_MANIP_GLOBAL; /* fallback to global */ + } + else if (selected_index > index) { + v3d->twmode--; + } + } + + BLI_freelinkN(transform_spaces, ts); } } @@ -809,14 +805,14 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3], { if (ebone->flag & BONE_SELECTED) { - float mat[3][3]; + float tmat[3][3]; float vec[3]; sub_v3_v3v3(vec, ebone->tail, ebone->head); normalize_v3(vec); add_v3_v3(normal, vec); - vec_roll_to_mat3(vec, ebone->roll, mat); - add_v3_v3(plane, mat[2]); + vec_roll_to_mat3(vec, ebone->roll, tmat); + add_v3_v3(plane, tmat[2]); } } } |