diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:31:30 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-04 10:31:30 +0300 |
commit | 44505b38df557a5711703613685a1dec9fc2c3d9 (patch) | |
tree | 3f05bebcc7bfadf56569f2dcca7f95fc56b1b0d0 /source/blender/editors/space_view3d/view3d_snap.c | |
parent | 6654e109df952be3a3128fae2508a02c196ae593 (diff) |
Cleanup: strip trailing space in editors
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_snap.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_snap.c | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 5dd69cc66eb..80586217691 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -86,7 +86,7 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op)) copy_m3_m4(bmat, obedit->obmat); invert_m3_m3(imat, bmat); - + tv = tvs.transverts; for (a = 0; a < tvs.transverts_tot; a++, tv++) { copy_v3_v3(vec, tv->loc); @@ -96,11 +96,11 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op)) vec[1] = gridf * floorf(0.5f + vec[1] / gridf); vec[2] = gridf * floorf(0.5f + vec[2] / gridf); sub_v3_v3(vec, obedit->obmat[3]); - + mul_m3_v3(imat, vec); copy_v3_v3(tv->loc, vec); } - + ED_transverts_update_obedit(&tvs, obedit); ED_transverts_free(&tvs); } @@ -112,15 +112,15 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op)) if (ob->mode & OB_MODE_POSE) { bPoseChannel *pchan; bArmature *arm = ob->data; - + invert_m4_m4(ob->imat, ob->obmat); - + for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { if (pchan->bone->flag & BONE_SELECTED) { if (pchan->bone->layer & arm->layer) { if ((pchan->bone->flag & BONE_CONNECTED) == 0) { float nLoc[3]; - + /* get nearest grid point to snap to */ copy_v3_v3(nLoc, pchan->pose_mat[3]); /* We must operate in world space! */ @@ -130,10 +130,10 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op)) vec[2] = gridf * floorf(0.5f + nLoc[2] / gridf); /* Back in object space... */ mul_m4_v3(ob->imat, vec); - + /* Get location of grid point in pose space. */ BKE_armature_loc_pose_to_bone(pchan, vec, vec); - + /* adjust location */ if ((pchan->protectflag & OB_LOCK_LOCX) == 0) pchan->loc[0] = vec[0]; @@ -152,18 +152,18 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op)) } } ob->pose->flag |= (POSE_LOCKED | POSE_DO_UNLOCK); - + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } else { vec[0] = -ob->obmat[3][0] + gridf * floorf(0.5f + ob->obmat[3][0] / gridf); vec[1] = -ob->obmat[3][1] + gridf * floorf(0.5f + ob->obmat[3][1] / gridf); vec[2] = -ob->obmat[3][2] + gridf * floorf(0.5f + ob->obmat[3][2] / gridf); - + if (ob->parent) { float originmat[3][3]; BKE_object_where_is_calc_ex(scene, NULL, ob, originmat); - + invert_m3_m3(imat, originmat); mul_m3_v3(imat, vec); } @@ -173,7 +173,7 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op)) ob->loc[1] += vec[1]; if ((ob->protectflag & OB_LOCK_LOCZ) == 0) ob->loc[2] += vec[2]; - + /* auto-keyframing */ ED_autokeyframe_object(C, scene, ob, ks); @@ -184,7 +184,7 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op)) } WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); - + return OPERATOR_FINISHED; } @@ -194,11 +194,11 @@ void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot) ot->name = "Snap Selection to Grid"; ot->description = "Snap selected item(s) to nearest grid division"; ot->idname = "VIEW3D_OT_snap_selected_to_grid"; - + /* api callbacks */ ot->exec = snap_sel_to_grid_exec; ot->poll = ED_operator_region_view3d_active; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -232,7 +232,7 @@ static int snap_selected_to_location(bContext *C, const float snap_target_global if (obedit) { float snap_target_local[3]; - + if (ED_transverts_check_obedit(obedit)) ED_transverts_create_from_obedit(&tvs, obedit, 0); if (tvs.transverts_tot == 0) @@ -240,7 +240,7 @@ static int snap_selected_to_location(bContext *C, const float snap_target_global copy_m3_m4(bmat, obedit->obmat); invert_m3_m3(imat, bmat); - + /* get the cursor in object space */ sub_v3_v3v3(snap_target_local, snap_target_global, obedit->obmat[3]); mul_m3_v3(imat, snap_target_local); @@ -261,7 +261,7 @@ static int snap_selected_to_location(bContext *C, const float snap_target_global copy_v3_v3(tv->loc, snap_target_local); } } - + ED_transverts_update_obedit(&tvs, obedit); ED_transverts_free(&tvs); } @@ -393,7 +393,7 @@ static int snap_selected_to_location(bContext *C, const float snap_target_global } WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); - + return OPERATOR_FINISHED; } @@ -415,11 +415,11 @@ void VIEW3D_OT_snap_selected_to_cursor(wmOperatorType *ot) ot->name = "Snap Selection to Cursor"; ot->description = "Snap selected item(s) to cursor"; ot->idname = "VIEW3D_OT_snap_selected_to_cursor"; - + /* api callbacks */ ot->exec = snap_selected_to_cursor_exec; ot->poll = ED_operator_view3d_active; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -470,7 +470,7 @@ static int snap_curs_to_grid_exec(bContext *C, wmOperator *UNUSED(op)) curs[0] = gridf * floorf(0.5f + curs[0] / gridf); curs[1] = gridf * floorf(0.5f + curs[1] / gridf); curs[2] = gridf * floorf(0.5f + curs[2] / gridf); - + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d); /* hrm */ return OPERATOR_FINISHED; @@ -482,11 +482,11 @@ void VIEW3D_OT_snap_cursor_to_grid(wmOperatorType *ot) ot->name = "Snap Cursor to Grid"; ot->description = "Snap cursor to nearest grid division"; ot->idname = "VIEW3D_OT_snap_cursor_to_grid"; - + /* api callbacks */ ot->exec = snap_curs_to_grid_exec; ot->poll = ED_operator_region_view3d_active; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -569,7 +569,7 @@ static bool snap_curs_to_sel_ex(bContext *C, float cursor[3]) } copy_m3_m4(bmat, obedit->obmat); - + tv = tvs.transverts; for (a = 0; a < tvs.transverts_tot; a++, tv++) { copy_v3_v3(vec, tv->loc); @@ -578,7 +578,7 @@ static bool snap_curs_to_sel_ex(bContext *C, float cursor[3]) add_v3_v3(centroid, vec); minmax_v3v3_v3(min, max, vec); } - + if (v3d->around == V3D_AROUND_CENTER_MEAN) { mul_v3_fl(centroid, 1.0f / (float)tvs.transverts_tot); copy_v3_v3(cursor, centroid); @@ -591,7 +591,7 @@ static bool snap_curs_to_sel_ex(bContext *C, float cursor[3]) } else { Object *obact = CTX_data_active_object(C); - + if (obact && (obact->mode & OB_MODE_POSE)) { bArmature *arm = obact->data; bPoseChannel *pchan; @@ -666,11 +666,11 @@ void VIEW3D_OT_snap_cursor_to_selected(wmOperatorType *ot) ot->name = "Snap Cursor to Selected"; ot->description = "Snap cursor to center of selected item(s)"; ot->idname = "VIEW3D_OT_snap_cursor_to_selected"; - + /* api callbacks */ ot->exec = snap_curs_to_sel_exec; ot->poll = ED_operator_view3d_active; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -721,7 +721,7 @@ static int snap_curs_to_active_exec(bContext *C, wmOperator *UNUSED(op)) Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); float *curs; - + curs = ED_view3d_cursor3d_get(scene, v3d); if (snap_calc_active_center(C, false, curs)) { @@ -739,11 +739,11 @@ void VIEW3D_OT_snap_cursor_to_active(wmOperatorType *ot) ot->name = "Snap Cursor to Active"; ot->description = "Snap cursor to active item"; ot->idname = "VIEW3D_OT_snap_cursor_to_active"; - + /* api callbacks */ ot->exec = snap_curs_to_active_exec; ot->poll = ED_operator_view3d_active; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -758,9 +758,9 @@ static int snap_curs_to_center_exec(bContext *C, wmOperator *UNUSED(op)) curs = ED_view3d_cursor3d_get(scene, v3d); zero_v3(curs); - + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d); - + return OPERATOR_FINISHED; } @@ -770,11 +770,11 @@ void VIEW3D_OT_snap_cursor_to_center(wmOperatorType *ot) ot->name = "Snap Cursor to Center"; ot->description = "Snap cursor to the Center"; ot->idname = "VIEW3D_OT_snap_cursor_to_center"; - + /* api callbacks */ ot->exec = snap_curs_to_center_exec; ot->poll = ED_operator_view3d_active; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } @@ -804,12 +804,12 @@ bool ED_view3d_minmax_verts(Object *obedit, float min[3], float max[3]) if (ED_transverts_check_obedit(obedit)) ED_transverts_create_from_obedit(&tvs, obedit, TM_ALL_JOINTS); - + if (tvs.transverts_tot == 0) return false; copy_m3_m4(bmat, obedit->obmat); - + tv = tvs.transverts; for (a = 0; a < tvs.transverts_tot; a++, tv++) { copy_v3_v3(vec, (tv->flag & TX_VERT_USE_MAPLOC) ? tv->maploc : tv->loc); @@ -818,8 +818,8 @@ bool ED_view3d_minmax_verts(Object *obedit, float min[3], float max[3]) add_v3_v3(centroid, vec); minmax_v3v3_v3(min, max, vec); } - + ED_transverts_free(&tvs); - + return true; } |