diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-12 22:56:47 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-12 23:04:45 +0300 |
commit | 1422c0650c951f21bee2555e4e7f03bb8c64cace (patch) | |
tree | 372c5500708c4a573bcacf09eb09bac4b555dd04 /source/blender/editors | |
parent | e0a561be1f83e94ea976166cf4ff6d5ecd16f990 (diff) |
UI: move pivot to the topbar
Pivot variables are now stored in scene toolsettings.
Diffstat (limited to 'source/blender/editors')
9 files changed, 36 insertions, 32 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index d8cbbb16542..d2f291f69fb 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -1606,7 +1606,7 @@ static int gp_snap_cursor_to_sel(bContext *C, wmOperator *UNUSED(op)) } } - if (v3d->around == V3D_AROUND_CENTER_MEAN && count) { + if (scene->toolsettings->transform_pivot_point == V3D_AROUND_CENTER_MEAN && count) { mul_v3_fl(centroid, 1.0f / (float)count); copy_v3_v3(cursor, centroid); } diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 6acd4b84641..a862ef718d2 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -788,7 +788,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) View3D *v3d = CTX_wm_view3d(C); copy_v3_v3(cursor, ED_view3d_cursor3d_get(scene, v3d)->location); if (v3d && !RNA_struct_property_is_set(op->ptr, "center")) - around = v3d->around; + around = scene->toolsettings->transform_pivot_point; } zero_v3(cent); diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 4014874a5b9..d6413e8bdfb 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -336,7 +336,6 @@ static SpaceLink *view3d_new(const ScrArea *UNUSED(sa), const Scene *scene) v3d->far = 1000.0f; v3d->twflag |= U.manipulator_flag & V3D_MANIPULATOR_DRAW; - v3d->around = V3D_AROUND_CENTER_MEAN; v3d->bundle_size = 0.2f; v3d->bundle_drawtype = OB_PLAINAXES; diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 7ae65f6db87..e7f6cf36476 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -328,7 +328,6 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) Object *obedit = CTX_data_edit_object(C); bGPdata *gpd = CTX_data_gpencil_data(C); uiBlock *block; - uiLayout *row; bool is_paint = ( ob && !(gpd && (gpd->flag & GP_DATA_STROKE_EDITMODE)) && ELEM(ob->mode, @@ -344,11 +343,14 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) /* other buttons: */ UI_block_emboss_set(block, UI_EMBOSS); - row = uiLayoutRow(layout, true); + /* moved to topbar */ +#if 0 + uiLayout *row = uiLayoutRow(layout, true); uiItemR(row, &v3dptr, "pivot_point", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); if (!ob || ELEM(ob->mode, OB_MODE_OBJECT, OB_MODE_POSE, OB_MODE_WEIGHT_PAINT)) { uiItemR(row, &v3dptr, "use_pivot_point_align", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); } +#endif if (obedit == NULL && is_paint) { /* Currently Python calls this directly. */ diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index f177a88240c..95ab30d3352 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -222,7 +222,7 @@ static int snap_selected_to_location(bContext *C, const float snap_target_global int a; if (use_offset) { - if ((v3d && v3d->around == V3D_AROUND_ACTIVE) && + if ((v3d && scene->toolsettings->transform_pivot_point == V3D_AROUND_ACTIVE) && snap_calc_active_center(C, true, center_global)) { /* pass */ @@ -582,7 +582,7 @@ static bool snap_curs_to_sel_ex(bContext *C, float cursor[3]) minmax_v3v3_v3(min, max, vec); } - if (v3d->around == V3D_AROUND_CENTER_MEAN) { + if (scene->toolsettings->transform_pivot_point == V3D_AROUND_CENTER_MEAN) { mul_v3_fl(centroid, 1.0f / (float)tvs.transverts_tot); copy_v3_v3(cursor, centroid); } @@ -634,7 +634,7 @@ static bool snap_curs_to_sel_ex(bContext *C, float cursor[3]) return false; } - if (v3d->around == V3D_AROUND_CENTER_MEAN) { + if (scene->toolsettings->transform_pivot_point == V3D_AROUND_CENTER_MEAN) { mul_v3_fl(centroid, 1.0f / (float)count); copy_v3_v3(cursor, centroid); } diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 6572aa0f443..dbbdf07ded2 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5929,22 +5929,22 @@ void autokeyframe_ob_cb_func(bContext *C, Scene *scene, ViewLayer *view_layer, V do_loc = true; } else if (ELEM(tmode, TFM_ROTATION, TFM_TRACKBALL)) { - if (v3d->around == V3D_AROUND_ACTIVE) { + if (scene->toolsettings->transform_pivot_point == V3D_AROUND_ACTIVE) { if (ob != OBACT(view_layer)) do_loc = true; } - else if (v3d->around == V3D_AROUND_CURSOR) + else if (scene->toolsettings->transform_pivot_point == V3D_AROUND_CURSOR) do_loc = true; if ((v3d->flag & V3D_ALIGN) == 0) do_rot = true; } else if (tmode == TFM_RESIZE) { - if (v3d->around == V3D_AROUND_ACTIVE) { + if (scene->toolsettings->transform_pivot_point == V3D_AROUND_ACTIVE) { if (ob != OBACT(view_layer)) do_loc = true; } - else if (v3d->around == V3D_AROUND_CURSOR) + else if (scene->toolsettings->transform_pivot_point == V3D_AROUND_CURSOR) do_loc = true; if ((v3d->flag & V3D_ALIGN) == 0) @@ -6074,14 +6074,14 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o do_loc = true; } else if (ELEM(tmode, TFM_ROTATION, TFM_TRACKBALL)) { - if (ELEM(v3d->around, V3D_AROUND_CURSOR, V3D_AROUND_ACTIVE)) + if (ELEM(scene->toolsettings->transform_pivot_point, V3D_AROUND_CURSOR, V3D_AROUND_ACTIVE)) do_loc = true; if ((v3d->flag & V3D_ALIGN) == 0) do_rot = true; } else if (tmode == TFM_RESIZE) { - if (ELEM(v3d->around, V3D_AROUND_CURSOR, V3D_AROUND_ACTIVE)) + if (ELEM(scene->toolsettings->transform_pivot_point, V3D_AROUND_CURSOR, V3D_AROUND_ACTIVE)) do_loc = true; if ((v3d->flag & V3D_ALIGN) == 0) diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index c3acf8c4350..237eb7651fd 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1344,7 +1344,7 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve } if (v3d->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN; - t->around = v3d->around; + t->around = t->scene->toolsettings->transform_pivot_point; /* bend always uses the cursor */ if (t->mode == TFM_BEND) { diff --git a/source/blender/editors/transform/transform_manipulator_3d.c b/source/blender/editors/transform/transform_manipulator_3d.c index c8248fa3198..8257ad595d7 100644 --- a/source/blender/editors/transform/transform_manipulator_3d.c +++ b/source/blender/editors/transform/transform_manipulator_3d.c @@ -600,6 +600,7 @@ int ED_transform_calc_manipulator_stats( bGPdata *gpd = CTX_data_gpencil_data(C); const bool is_gp_edit = ((gpd) && (gpd->flag & GP_DATA_STROKE_EDITMODE)); int a, totsel = 0; + const int pivot_point = scene->toolsettings->transform_pivot_point; /* transform widget matrix */ unit_m4(rv3d->twmat); @@ -638,7 +639,7 @@ int ED_transform_calc_manipulator_stats( { if (obedit || ob->mode & OB_MODE_POSE) { float mat[3][3]; - ED_getTransformOrientationMatrix(C, mat, v3d->around); + ED_getTransformOrientationMatrix(C, mat, pivot_point); copy_m4_m3(rv3d->twmat, mat); break; } @@ -653,7 +654,7 @@ int ED_transform_calc_manipulator_stats( * and users who select many bones will understand whats going on and what local means * when they start transforming */ float mat[3][3]; - ED_getTransformOrientationMatrix(C, mat, v3d->around); + ED_getTransformOrientationMatrix(C, mat, pivot_point); copy_m4_m3(rv3d->twmat, mat); break; } @@ -767,7 +768,7 @@ int ED_transform_calc_manipulator_stats( float vec[3] = {0, 0, 0}; /* USE LAST SELECTE WITH ACTIVE */ - if ((v3d->around == V3D_AROUND_ACTIVE) && BM_select_history_active_get(em->bm, &ese)) { + if ((pivot_point == V3D_AROUND_ACTIVE) && BM_select_history_active_get(em->bm, &ese)) { BM_editselection_center(&ese, vec); calc_tw_center(tbounds, vec); totsel = 1; @@ -792,7 +793,7 @@ int ED_transform_calc_manipulator_stats( bArmature *arm = obedit->data; EditBone *ebo; - if ((v3d->around == V3D_AROUND_ACTIVE) && (ebo = arm->act_edbone)) { + if ((pivot_point == V3D_AROUND_ACTIVE) && (ebo = arm->act_edbone)) { /* doesn't check selection or visibility intentionally */ if (ebo->flag & BONE_TIPSEL) { calc_tw_center(tbounds, ebo->tail); @@ -834,7 +835,7 @@ int ED_transform_calc_manipulator_stats( Curve *cu = obedit->data; float center[3]; - if (v3d->around == V3D_AROUND_ACTIVE && ED_curve_active_center(cu, center)) { + if ((pivot_point == V3D_AROUND_ACTIVE) && ED_curve_active_center(cu, center)) { calc_tw_center(tbounds, center); totsel++; } @@ -866,11 +867,13 @@ int ED_transform_calc_manipulator_stats( } else { if (bezt->f1 & SELECT) { - calc_tw_center(tbounds, bezt->vec[(v3d->around == V3D_AROUND_LOCAL_ORIGINS) ? 1 : 0]); + calc_tw_center( + tbounds, bezt->vec[(pivot_point == V3D_AROUND_LOCAL_ORIGINS) ? 1 : 0]); totsel++; } if (bezt->f3 & SELECT) { - calc_tw_center(tbounds, bezt->vec[(v3d->around == V3D_AROUND_LOCAL_ORIGINS) ? 1 : 2]); + calc_tw_center( + tbounds, bezt->vec[(pivot_point == V3D_AROUND_LOCAL_ORIGINS) ? 1 : 2]); totsel++; } } @@ -896,7 +899,7 @@ int ED_transform_calc_manipulator_stats( MetaBall *mb = (MetaBall *)obedit->data; MetaElem *ml; - if ((v3d->around == V3D_AROUND_ACTIVE) && (ml = mb->lastelem)) { + if ((pivot_point == V3D_AROUND_ACTIVE) && (ml = mb->lastelem)) { calc_tw_center(tbounds, &ml->x); totsel++; } @@ -913,7 +916,7 @@ int ED_transform_calc_manipulator_stats( Lattice *lt = ((Lattice *)obedit->data)->editlatt->latt; BPoint *bp; - if ((v3d->around == V3D_AROUND_ACTIVE) && (bp = BKE_lattice_active_point_get(lt))) { + if ((pivot_point == V3D_AROUND_ACTIVE) && (bp = BKE_lattice_active_point_get(lt))) { calc_tw_center(tbounds, bp->vec); totsel++; } @@ -943,7 +946,7 @@ int ED_transform_calc_manipulator_stats( int mode = TFM_ROTATION; // mislead counting bones... bah. We don't know the manipulator mode, could be mixed bool ok = false; - if ((v3d->around == V3D_AROUND_ACTIVE) && (pchan = BKE_pose_channel_active(ob))) { + if ((pivot_point == V3D_AROUND_ACTIVE) && (pchan = BKE_pose_channel_active(ob))) { /* doesn't check selection or visibility intentionally */ Bone *bone = pchan->bone; if (bone) { @@ -1067,14 +1070,15 @@ static void manipulator_prepare_mat( Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); - switch (v3d->around) { + switch (scene->toolsettings->transform_pivot_point) { case V3D_AROUND_CENTER_BOUNDS: case V3D_AROUND_ACTIVE: { bGPdata *gpd = CTX_data_gpencil_data(C); Object *ob = OBACT(view_layer); - if (((v3d->around == V3D_AROUND_ACTIVE) && (OBEDIT_FROM_OBACT(ob) == NULL)) && + if (((scene->toolsettings->transform_pivot_point == V3D_AROUND_ACTIVE) && + (OBEDIT_FROM_OBACT(ob) == NULL)) && ((gpd == NULL) || !(gpd->flag & GP_DATA_STROKE_EDITMODE)) && (!(ob->mode & OB_MODE_POSE))) { @@ -1140,12 +1144,11 @@ static void manipulator_xform_message_subscribe( RNA_id_pointer_create(&scene->id, &scene_ptr); { - const View3D *v3d = sa->spacedata.first; extern PropertyRNA rna_Scene_transform_orientation; extern PropertyRNA rna_Scene_cursor_location; const PropertyRNA *props[] = { &rna_Scene_transform_orientation, - (v3d->around == V3D_AROUND_CURSOR) ? &rna_Scene_cursor_location : NULL, + (scene->toolsettings->transform_pivot_point == V3D_AROUND_CURSOR) ? &rna_Scene_cursor_location : NULL, }; for (int i = 0; i < ARRAY_SIZE(props); i++) { if (props[i]) { @@ -1158,9 +1161,9 @@ static void manipulator_xform_message_subscribe( RNA_pointer_create(&screen->id, &RNA_SpaceView3D, sa->spacedata.first, &space_ptr); if (type_fn == TRANSFORM_WGT_manipulator) { - extern PropertyRNA rna_SpaceView3D_pivot_point; + extern PropertyRNA rna_ToolSettings_transform_pivot_point; const PropertyRNA *props[] = { - &rna_SpaceView3D_pivot_point + &rna_ToolSettings_transform_pivot_point }; for (int i = 0; i < ARRAY_SIZE(props); i++) { WM_msg_subscribe_rna(mbus, &space_ptr, props[i], &msg_sub_value_mpr_tag_refresh, __func__); diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 4192214fac3..8029759551d 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -1017,7 +1017,7 @@ static void uv_map_transform_center( float r_bounds[2][3]) { /* only operates on the edit object - this is all that's needed now */ - const int around = (v3d) ? v3d->around : V3D_AROUND_CENTER_BOUNDS; + const int around = (v3d) ? scene->toolsettings->transform_pivot_point : V3D_AROUND_CENTER_BOUNDS; float bounds[2][3]; INIT_MINMAX(bounds[0], bounds[1]); |