diff options
19 files changed, 93 insertions, 106 deletions
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index 995d8bbcc99..6e1cd63d52c 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -199,22 +199,29 @@ class TOPBAR_HT_lower_bar(Header): scene = context.scene obj = context.active_object - if obj: - # Set above: - # mode = obj.mode + object_mode = 'OBJECT' if obj is None else obj.mode + + # Pivit & Orientation + row = layout.row(align=True) + row.prop(toolsettings, "transform_pivot_point", text="", icon_only=True) + if (obj is None) or (mode in {'OBJECT', 'POSE', 'WEIGHT_PAINT'}): + row.prop(toolsettings, "use_transform_pivot_point_align", text="") + layout.prop(scene, "transform_orientation", text="") + + if obj: # Proportional editing if context.gpencil_data and context.gpencil_data.use_stroke_edit_mode: row = layout.row(align=True) row.prop(toolsettings, "proportional_edit", icon_only=True) if toolsettings.proportional_edit != 'DISABLED': row.prop(toolsettings, "proportional_edit_falloff", icon_only=True) - elif mode in {'EDIT', 'PARTICLE_EDIT'}: + elif object_mode in {'EDIT', 'PARTICLE_EDIT'}: row = layout.row(align=True) row.prop(toolsettings, "proportional_edit", icon_only=True) if toolsettings.proportional_edit != 'DISABLED': row.prop(toolsettings, "proportional_edit_falloff", icon_only=True) - elif mode == 'OBJECT': + elif object_mode == 'OBJECT': row = layout.row(align=True) row.prop(toolsettings, "use_proportional_edit_objects", icon_only=True) if toolsettings.use_proportional_edit_objects: @@ -232,7 +239,7 @@ class TOPBAR_HT_lower_bar(Header): if obj is None: show_snap = True else: - if mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT'}: + if object_mode not in {'SCULPT', 'VERTEX_PAINT', 'WEIGHT_PAINT', 'TEXTURE_PAINT'}: show_snap = True else: paint_settings = UnifiedPaintPanel.paint_settings(context) @@ -251,9 +258,9 @@ class TOPBAR_HT_lower_bar(Header): else: row.prop(toolsettings, "snap_target", text="") if obj: - if mode == 'EDIT': + if object_mode == 'EDIT': row.prop(toolsettings, "use_snap_self", text="") - if mode in {'OBJECT', 'POSE', 'EDIT'} and snap_element != 'VOLUME': + if object_mode in {'OBJECT', 'POSE', 'EDIT'} and snap_element != 'VOLUME': row.prop(toolsettings, "use_snap_align_rotation", text="") if snap_element == 'VOLUME': @@ -263,14 +270,9 @@ class TOPBAR_HT_lower_bar(Header): # AutoMerge editing if obj: - if (mode == 'EDIT' and obj.type == 'MESH'): + if (object_mode == 'EDIT' and obj.type == 'MESH'): layout.prop(toolsettings, "use_mesh_automerge", text="", icon='AUTOMERGE_ON') - - layout.prop(scene, "transform_orientation", text="") - - - # Command Settings (redo) op = context.active_operator row = layout.row() diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 566bcfc6b3e..1c6bf490f7a 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -257,7 +257,6 @@ class USERPREF_PT_interface(Panel): col.prop(view, "use_mouse_depth_navigate") col.prop(view, "use_zoom_to_mouse") col.prop(view, "use_rotate_around_active") - col.prop(view, "use_global_pivot") col.prop(view, "use_camera_lock_parent") col.separator() diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index f20d48c5eef..7875a4e2076 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -655,6 +655,8 @@ void BKE_scene_init(Scene *sce) sce->toolsettings->uv_selectmode = UV_SELECT_VERTEX; sce->toolsettings->autokey_mode = U.autokey_mode; + + sce->toolsettings->transform_pivot_point = V3D_AROUND_CENTER_MEAN; sce->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID; sce->toolsettings->curve_paint_settings.curve_type = CU_BEZIER; 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]); diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index e3d349fe5f2..c14ab28ad62 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1270,9 +1270,12 @@ typedef struct ToolSettings { char _pad1; /* Transform */ + char transform_pivot_point; + char transform_flag; char snap_mode, snap_node_mode; char snap_uv_mode; - short snap_flag, snap_target; + char snap_flag; + char snap_target; short proportional, prop_mode; char proportional_objects; /* proportional edit, object mode */ char proportional_mask; /* proportional edit, mask editing */ @@ -1699,6 +1702,11 @@ extern const char *RE_engine_id_CYCLES; /* Base.flag is in DNA_object_types.h */ +/* ToolSettings.transform_flag */ +enum { + SCE_XFORM_AXIS_ALIGN = (1 << 0), +}; + /* ToolSettings.snap_flag */ #define SCE_SNAP 1 #define SCE_SNAP_ROTATE 2 diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 74602cf5b40..326d42d9cb3 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -694,7 +694,7 @@ typedef enum eUserpref_UI_Flag { USER_MENUOPENAUTO = (1 << 9), USER_DEPTH_CURSOR = (1 << 10), USER_AUTOPERSP = (1 << 11), - USER_LOCKAROUND = (1 << 12), + /* USER_LOCKAROUND = (1 << 12), */ /* DEPRECATED */ USER_GLOBALUNDO = (1 << 13), USER_ORBIT_SELECTION = (1 << 14), USER_DEPTH_NAVIGATE = (1 << 15), diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 8a92ad25c92..5a13f625905 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -193,7 +193,7 @@ typedef struct View3D { int layact; short ob_centre_cursor; /* optional bool for 3d cursor to define center */ - short scenelock, around; + short scenelock, _pad0; short flag, flag2, pad2; float lens, grid; diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index 07663b39649..d5b2493078c 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -157,6 +157,7 @@ extern const EnumPropertyItem rna_enum_operator_context_items[]; extern const EnumPropertyItem rna_enum_wm_report_items[]; +extern const EnumPropertyItem rna_enum_transform_pivot_items_full[]; extern const EnumPropertyItem rna_enum_transform_mode_types[]; extern const EnumPropertyItem rna_enum_posebone_rotmode_items[]; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index aac91fd806b..b487a08dccd 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -438,6 +438,18 @@ static const EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = { #endif +const EnumPropertyItem rna_enum_transform_pivot_items_full[] = { + {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", + "Pivot around bounding box center of selected object(s)"}, + {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", "Pivot around the 3D cursor"}, + {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, + "Individual Origins", "Pivot around each object's own origin"}, + {V3D_AROUND_CENTER_MEAN, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point", + "Pivot around the median point of selected objects"}, + {V3D_AROUND_ACTIVE, "ACTIVE_ELEMENT", ICON_ROTACTIVE, "Active Element", "Pivot around active object"}, + {0, NULL, 0, NULL, NULL} +}; + /* Icons could be made a consistent set of images. */ static const EnumPropertyItem transform_orientation_items[] = { {V3D_MANIP_GLOBAL, "GLOBAL", ICON_SCENE_DATA, "Global", "Align the transformation axes to world space"}, @@ -2587,6 +2599,19 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_range(prop, 0.0, 1.0); RNA_def_property_ui_range(prop, 0.0, 0.1, 0.01, 6); + /* Pivot Point */ + prop = RNA_def_property(srna, "transform_pivot_point", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "transform_pivot_point"); + RNA_def_property_enum_items(prop, rna_enum_transform_pivot_items_full); + RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop = RNA_def_property(srna, "use_transform_pivot_point_align", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "transform_flag", SCE_XFORM_AXIS_ALIGN); + RNA_def_property_ui_text(prop, "Align", "Manipulate center points (object, pose and weight paint mode only)"); + RNA_def_property_ui_icon(prop, ICON_ALIGN, 0); + RNA_def_property_update(prop, NC_SCENE, NULL); + prop = RNA_def_property(srna, "use_mesh_automerge", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "automerge", 0); RNA_def_property_ui_text(prop, "AutoMerge Editing", "Automatically merge vertices moved to the same location"); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index d8c3fdd7a64..306c659fbf6 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -136,18 +136,6 @@ static const EnumPropertyItem stereo3d_eye_items[] = { }; #endif -static const EnumPropertyItem pivot_items_full[] = { - {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center", - "Pivot around bounding box center of selected object(s)"}, - {V3D_AROUND_CURSOR, "CURSOR", ICON_CURSOR, "3D Cursor", "Pivot around the 3D cursor"}, - {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION, - "Individual Origins", "Pivot around each object's own origin"}, - {V3D_AROUND_CENTER_MEAN, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point", - "Pivot around the median point of selected objects"}, - {V3D_AROUND_ACTIVE, "ACTIVE_ELEMENT", ICON_ROTACTIVE, "Active Element", "Pivot around active object"}, - {0, NULL, 0, NULL, NULL} -}; - static const EnumPropertyItem draw_channels_items[] = { {SI_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha", "Draw image with RGB colors and alpha transparency"}, @@ -549,32 +537,6 @@ static void rna_SpaceView3D_matcap_enable(Main *UNUSED(bmain), Scene *UNUSED(sce } } -static void rna_SpaceView3D_pivot_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) -{ - if (U.uiflag & USER_LOCKAROUND) { - View3D *v3d_act = (View3D *)(ptr->data); - - /* TODO, space looper */ - bScreen *screen; - for (screen = bmain->screen.first; screen; screen = screen->id.next) { - ScrArea *sa; - for (sa = screen->areabase.first; sa; sa = sa->next) { - SpaceLink *sl; - for (sl = sa->spacedata.first; sl; sl = sl->next) { - if (sl->spacetype == SPACE_VIEW3D) { - View3D *v3d = (View3D *)sl; - if (v3d != v3d_act) { - v3d->around = v3d_act->around; - v3d->flag = (v3d->flag & ~V3D_ALIGN) | (v3d_act->flag & V3D_ALIGN); - ED_area_tag_redraw_regiontype(sa, RGN_TYPE_HEADER); - } - } - } - } - } - } -} - static PointerRNA rna_SpaceView3D_region_3d_get(PointerRNA *ptr) { View3D *v3d = (View3D *)(ptr->data); @@ -1031,7 +993,7 @@ static const EnumPropertyItem *rna_SpaceImageEditor_pivot_itemf( SpaceImage *sima = (SpaceImage *)ptr->data; if (sima->mode == SI_MODE_PAINT) - return pivot_items_full; + return rna_enum_transform_pivot_items_full; else return pivot_items; } @@ -2622,18 +2584,6 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_ui_icon(prop, ICON_ORTHO, 0); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); - prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "around"); - RNA_def_property_enum_items(prop, pivot_items_full); - RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling"); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_pivot_update"); - - prop = RNA_def_property(srna, "use_pivot_point_align", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_ALIGN); - RNA_def_property_ui_text(prop, "Align", "Manipulate center points (object, pose and weight paint mode only)"); - RNA_def_property_ui_icon(prop, ICON_ALIGN, 0); - RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_pivot_update"); - prop = RNA_def_property(srna, "show_manipulator", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "twflag", V3D_MANIPULATOR_DRAW); RNA_def_property_ui_text(prop, "Manipulator", "Use a 3D manipulator widget for controlling transforms"); @@ -3044,7 +2994,7 @@ static void rna_def_space_image(BlenderRNA *brna) prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "around"); - RNA_def_property_enum_items(prop, pivot_items_full); + RNA_def_property_enum_items(prop, rna_enum_transform_pivot_items_full); RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceImageEditor_pivot_itemf"); RNA_def_property_ui_text(prop, "Pivot", "Rotation/Scaling Pivot"); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 2b557c83867..58fe68bce90 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -3461,10 +3461,6 @@ static void rna_def_userdef_view(BlenderRNA *brna) "Otherwise menus, etc will always be top to bottom, left to right, " "no matter opening direction"); - prop = RNA_def_property(srna, "use_global_pivot", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_LOCKAROUND); - RNA_def_property_ui_text(prop, "Global Pivot", "Lock the same rotation/scaling pivot in all 3D Views"); - prop = RNA_def_property(srna, "use_mouse_depth_navigate", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DEPTH_NAVIGATE); RNA_def_property_ui_text(prop, "Auto Depth", |