Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-01-30 12:28:54 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-01-31 09:05:12 +0300
commit2e84edea972fc046294ce56747f46989b5911090 (patch)
tree2cdad3ad9391984ced995035945d86c3a4b0f7c8 /source/blender/editors/space_view3d/view3d_placement.c
parent7a64e9376186182acb135aa864eb472d0562d624 (diff)
Add Object Tool: make automatic axis selection an option
While useful in some cases, this meant it wasn't possible to use the "Floor" for object placement without looking top-down or bottom up.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_placement.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_placement.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/editors/space_view3d/view3d_placement.c b/source/blender/editors/space_view3d/view3d_placement.c
index c81072a1384..f8af73b45c5 100644
--- a/source/blender/editors/space_view3d/view3d_placement.c
+++ b/source/blender/editors/space_view3d/view3d_placement.c
@@ -867,6 +867,7 @@ static void view3d_interactive_add_calc_plane(bContext *C,
const enum ePlace_Depth plane_depth,
const enum ePlace_Orient plane_orient,
const int plane_axis,
+ const bool plane_axis_auto,
float r_co_src[3],
float r_matrix_orient[3][3])
{
@@ -915,7 +916,7 @@ static void view3d_interactive_add_calc_plane(bContext *C,
found_surface_or_normal = true;
}
- if (!found_surface_or_normal) {
+ if (!found_surface_or_normal && plane_axis_auto) {
/* Drawing into empty space, draw onto the plane most aligned to the view direction. */
mat3_align_axis_to_v3(r_matrix_orient, plane_axis, rv3d->viewinv[2]);
}
@@ -1013,6 +1014,7 @@ static void view3d_interactive_add_begin(bContext *C, wmOperator *op, const wmEv
{
const int plane_axis = RNA_enum_get(op->ptr, "plane_axis");
+ const bool plane_axis_auto = RNA_boolean_get(op->ptr, "plane_axis_auto");
const enum ePlace_SnapTo snap_to = RNA_enum_get(op->ptr, "snap_target");
const enum ePlace_Depth plane_depth = RNA_enum_get(op->ptr, "plane_depth");
const enum ePlace_Origin plane_origin[2] = {
@@ -1074,6 +1076,7 @@ static void view3d_interactive_add_begin(bContext *C, wmOperator *op, const wmEv
plane_depth,
plane_orient,
plane_axis,
+ plane_axis_auto,
ipd->co_src,
ipd->matrix_orient);
@@ -1613,6 +1616,14 @@ void VIEW3D_OT_interactive_add(struct wmOperatorType *ot)
RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ prop = RNA_def_boolean(ot->srna,
+ "plane_axis_auto",
+ false,
+ "Auto Axis",
+ "Select the closest axis when placing objects "
+ "(surface overrides)");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+
static const EnumPropertyItem plane_depth_items[] = {
{PLACE_DEPTH_SURFACE,
"SURFACE",
@@ -1777,6 +1788,7 @@ static void gizmo_plane_update_cursor(const bContext *C,
const enum ePlace_SnapTo snap_to = RNA_enum_get(&ptr, "snap_target");
const int plane_axis = RNA_enum_get(&ptr, "plane_axis");
+ const bool plane_axis_auto = RNA_boolean_get(&ptr, "plane_axis_auto");
const enum ePlace_Depth plane_depth = RNA_enum_get(&ptr, "plane_depth");
const enum ePlace_Orient plane_orient = RNA_enum_get(&ptr, "plane_orientation");
@@ -1810,6 +1822,7 @@ static void gizmo_plane_update_cursor(const bContext *C,
plane_depth,
plane_orient,
plane_axis,
+ plane_axis_auto,
r_co,
r_matrix_orient);
*r_plane_axis = plane_axis;