[Bf-blender-cvs] [b72d9216f12] blender-v2.93-release: Fix T87677: Add primitive tools produce wrong sized objects after changing values in 'Adjust Last Operation'

Philipp Oeser noreply at git.blender.org
Wed Apr 21 13:13:48 CEST 2021


Commit: b72d9216f12edb37e79ce2fe17c72bb5a072db6a
Author: Philipp Oeser
Date:   Wed Apr 21 12:35:38 2021 +0200
Branches: blender-v2.93-release
https://developer.blender.org/rBb72d9216f12edb37e79ce2fe17c72bb5a072db6a

Fix T87677: Add primitive tools produce wrong sized objects after changing values in 'Adjust Last Operation'

Always use the defaults here (radius, depth etc), since desired bounds
have been set interactively, it does not make sense to use a different
value from a previous command.

The Cube tool has already seen a fix for this in rB26e5718e29a7, but
Cone/UVSphere/Cylinder/IcoSphere havent.

Maniphest Tasks: T87677

Differential Revision: https://developer.blender.org/D11038

===================================================================

M	source/blender/editors/space_view3d/view3d_placement.c

===================================================================

diff --git a/source/blender/editors/space_view3d/view3d_placement.c b/source/blender/editors/space_view3d/view3d_placement.c
index 8172742a756..7347e528edc 100644
--- a/source/blender/editors/space_view3d/view3d_placement.c
+++ b/source/blender/editors/space_view3d/view3d_placement.c
@@ -1472,10 +1472,27 @@ static int view3d_interactive_add_modal(bContext *C, wmOperator *op, const wmEve
           RNA_float_set_array(&op_props, "rotation", rotation);
           RNA_float_set_array(&op_props, "location", location);
           RNA_float_set_array(&op_props, "scale", scale);
-          /* Always use default size here. */
+
+          /* Always use the defaults here since desired bounds have been set interactively, it does
+           * not make sense to use a different values from a previous command. */
           if (ipd->primitive_type == PLACE_PRIMITIVE_TYPE_CUBE) {
             RNA_float_set(&op_props, "size", 2.0f);
           }
+          if (ELEM(ipd->primitive_type,
+                   PLACE_PRIMITIVE_TYPE_CYLINDER,
+                   PLACE_PRIMITIVE_TYPE_SPHERE_UV,
+                   PLACE_PRIMITIVE_TYPE_SPHERE_ICO)) {
+            RNA_float_set(&op_props, "radius", 1.0f);
+          }
+          if (ELEM(
+                  ipd->primitive_type, PLACE_PRIMITIVE_TYPE_CYLINDER, PLACE_PRIMITIVE_TYPE_CONE)) {
+            RNA_float_set(&op_props, "depth", 2.0f);
+          }
+          if (ipd->primitive_type == PLACE_PRIMITIVE_TYPE_CONE) {
+            RNA_float_set(&op_props, "radius1", 1.0f);
+            RNA_float_set(&op_props, "radius2", 0.0f);
+          }
+
           WM_operator_name_call_ptr(C, ot, WM_OP_EXEC_DEFAULT, &op_props);
           WM_operator_properties_free(&op_props);
         }



More information about the Bf-blender-cvs mailing list