diff options
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 6 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 12 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.h | 2 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_snap.c | 18 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 10 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 24 |
8 files changed, 48 insertions, 38 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index de1502375cf..3c713de9a71 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -5225,12 +5225,6 @@ class VIEW3D_PT_snapping(Panel): col.prop(tool_settings, "use_snap_grid_absolute") if snap_elements != {'INCREMENT'}: - col.label(text="Affect") - row = col.row(align=True) - row.prop(tool_settings, "use_snap_force_increment_translate", text="Move") - row.prop(tool_settings, "use_snap_force_increment_rotate", text="Rotate") - row.prop(tool_settings, "use_snap_force_increment_scale", text="Scale") - col.label(text="Target") row = col.row(align=True) row.prop(tool_settings, "snap_target", expand=True) @@ -5247,6 +5241,12 @@ class VIEW3D_PT_snapping(Panel): if 'VOLUME' in snap_elements: col.prop(tool_settings, "use_snap_peel_object") + col.label(text="Affect") + row = col.row(align=True) + row.prop(tool_settings, "use_snap_translate", text="Move", toggle=True) + row.prop(tool_settings, "use_snap_rotate", text="Rotate", toggle=True) + row.prop(tool_settings, "use_snap_scale", text="Scale", toggle=True) + class VIEW3D_PT_transform_orientations(Panel): bl_space_type = 'VIEW_3D' diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index cd0e437ec7e..3a9d22f559b 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -670,7 +670,7 @@ void BKE_scene_init(Scene *sce) sce->toolsettings->snap_mode = SCE_SNAP_MODE_INCREMENT; sce->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID; sce->toolsettings->snap_uv_mode = SCE_SNAP_MODE_INCREMENT; - sce->toolsettings->snap_force_increment_flag = SCE_SNAP_FORCE_INCREMENT_ROTATE | SCE_SNAP_FORCE_INCREMENT_SCALE; + sce->toolsettings->snap_transform_mode_flag = SCE_SNAP_TRANSFORM_MODE_TRANSLATE; sce->toolsettings->curve_paint_settings.curve_type = CU_BEZIER; sce->toolsettings->curve_paint_settings.flag |= CURVE_PAINT_FLAG_CORNERS_DETECT; diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 4eda9bc7a12..a2a2c3fb738 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -2737,10 +2737,10 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) { /* Versioning code until next subversion bump goes here. */ - if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "char", "snap_force_increment_flag")) { + if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "char", "snap_transform_mode_flag")) { for (Scene *scene = bmain->scene.first; scene; scene = scene->id.next) { - scene->toolsettings->snap_force_increment_flag = - SCE_SNAP_FORCE_INCREMENT_ROTATE | SCE_SNAP_FORCE_INCREMENT_SCALE; + scene->toolsettings->snap_transform_mode_flag = + SCE_SNAP_TRANSFORM_MODE_TRANSLATE; } } } diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 60c1f4f1f40..90bfaf7bc9d 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -2101,11 +2101,13 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) } /* do we check for parameter? */ - if (t->modifiers & MOD_SNAP) { - ts->snap_flag |= SCE_SNAP; - } - else { - ts->snap_flag &= ~SCE_SNAP; + if (transformModeUseSnap(t)) { + if (t->modifiers & MOD_SNAP) { + ts->snap_flag |= SCE_SNAP; + } + else { + ts->snap_flag &= ~SCE_SNAP; + } } if (t->spacetype == SPACE_VIEW3D) { diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index ca341fc8738..75044e77110 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -783,6 +783,8 @@ typedef enum { SMALL_GEARS = 2 } GearsType; +bool transformModeUseSnap(const TransInfo *t); + void snapGridIncrement(TransInfo *t, float *val); void snapGridIncrementAction(TransInfo *t, float *val, GearsType action); diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index c2c864b51ad..3a73c2386a8 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -137,21 +137,27 @@ bool activeSnap(const TransInfo *t) ((t->modifiers & (MOD_SNAP | MOD_SNAP_INVERT)) == MOD_SNAP_INVERT); } -static bool doForceIncrementSnap(const TransInfo *t) +bool transformModeUseSnap(const TransInfo *t) { - const ToolSettings *ts = t->settings; + ToolSettings *ts = t->settings; if (t->mode == TFM_TRANSLATION) { - return ts->snap_force_increment_flag & SCE_SNAP_FORCE_INCREMENT_TRANSLATE; + return (ts->snap_transform_mode_flag & SCE_SNAP_TRANSFORM_MODE_TRANSLATE) != 0; } if (t->mode == TFM_ROTATION) { - return ts->snap_force_increment_flag & SCE_SNAP_FORCE_INCREMENT_ROTATE; + return (ts->snap_transform_mode_flag & SCE_SNAP_TRANSFORM_MODE_ROTATE) != 0; } if (t->mode == TFM_RESIZE) { - return ts->snap_force_increment_flag & SCE_SNAP_FORCE_INCREMENT_SCALE; + return (ts->snap_transform_mode_flag & SCE_SNAP_TRANSFORM_MODE_SCALE) != 0; } + return false; } +static bool doForceIncrementSnap(const TransInfo *t) +{ + return !transformModeUseSnap(t); +} + void drawSnapping(const struct bContext *C, TransInfo *t) { unsigned char col[4], selectedCol[4], activeCol[4]; @@ -656,7 +662,7 @@ void initSnapping(TransInfo *t, wmOperator *op) /* use scene defaults only when transform is modal */ else if (t->flag & T_MODAL) { if (ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE, SPACE_NODE)) { - if (ts->snap_flag & SCE_SNAP) { + if (transformModeUseSnap(t) && (ts->snap_flag & SCE_SNAP)) { t->modifiers |= MOD_SNAP; } diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 8be63add398..d312566a4fd 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1351,7 +1351,7 @@ typedef struct ToolSettings { char snap_uv_mode; char snap_flag; char snap_target; - char snap_force_increment_flag; + char snap_transform_mode_flag; char proportional, prop_mode; @@ -1910,11 +1910,11 @@ enum { #define SCE_SNAP_MODE_NODE_X (1 << 6) #define SCE_SNAP_MODE_NODE_Y (1 << 7) -/** #ToolSettings.snap_force_increment_flag */ +/** #ToolSettings.snap_transform_mode_flag */ enum { - SCE_SNAP_FORCE_INCREMENT_TRANSLATE = (1 << 0), - SCE_SNAP_FORCE_INCREMENT_ROTATE = (1 << 1), - SCE_SNAP_FORCE_INCREMENT_SCALE = (1 << 2), + SCE_SNAP_TRANSFORM_MODE_TRANSLATE = (1 << 0), + SCE_SNAP_TRANSFORM_MODE_ROTATE = (1 << 1), + SCE_SNAP_TRANSFORM_MODE_SCALE = (1 << 2), }; /* ToolSettings.selectmode */ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 52e4c62ea00..037b16ab5df 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2478,24 +2478,24 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Project onto Self", "Snap onto itself (Edit Mode Only)"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ - prop = RNA_def_property(srna, "use_snap_force_increment_translate", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_force_increment_flag", SCE_SNAP_FORCE_INCREMENT_TRANSLATE); - RNA_def_property_ui_text(prop, "Resctrict Translation", - "Translate uses the snapping modes, otherwise use increment snapping"); + prop = RNA_def_property(srna, "use_snap_translate", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_TRANSLATE); + RNA_def_property_ui_text(prop, "Use Snap for Translation", + "Move is affected by snapping settings"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ - prop = RNA_def_property(srna, "use_snap_force_increment_rotate", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_force_increment_flag", SCE_SNAP_FORCE_INCREMENT_ROTATE); + prop = RNA_def_property(srna, "use_snap_rotate", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_ROTATE); RNA_def_property_boolean_default(prop, false); - RNA_def_property_ui_text(prop, "Resctrict Rotate", - "Rotate uses the snapping modes, otherwise use increment snapping"); + RNA_def_property_ui_text(prop, "Use Snap for Rotation", + "Rotate is affected by the snapping settings"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ - prop = RNA_def_property(srna, "use_snap_force_increment_scale", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_force_increment_flag", SCE_SNAP_FORCE_INCREMENT_SCALE); + prop = RNA_def_property(srna, "use_snap_scale", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_SCALE); RNA_def_property_boolean_default(prop, false); - RNA_def_property_ui_text(prop, "Resctrict Scale", - "Scale uses the snapping modes, otherwise use increment snapping"); + RNA_def_property_ui_text(prop, "Use Snap for Scale", + "Scale is affected by snapping settings"); RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */ prop = RNA_def_property(srna, "use_gizmo_mode", PROP_ENUM, PROP_NONE); |