Skip to content

Decimate Ratio drag direction inverted vs. Shrink/Inflate; unify per-field drag config #680

Description

@Weisl

Bug

While dragging to adjust Decimate Ratio during collider creation (the (D) mouse-drag HUD field), the direction felt inverted compared to every other draggable field, e.g. Shrink/Inflate (S): dragging the mouse right decreased the Decimate ratio, while it increases Shrink/Inflate, Opacity, Height/Width Multiplier and the segment-count fields.

Root cause

Each of the ~9 mouse-drag-adjustable HUD fields in OBJECT_OT_add_bounding_object.modal() (collider_shapes/add_bounding_primitive.py) computed its new value from the raw mouse delta independently, hand-rolled per field. Every field but Decimate used ref_value - delta; Decimate alone used ref_value + delta, with no comment explaining why - almost certainly an old copy/paste slip rather than an intentional inversion (Voxel Size also uses + delta, but that one is intentional: it's a size, where smaller = finer, so inverting it keeps "drag right = more detail" consistent with Decimate's ratio).

The same hand-rolled-per-field pattern also duplicated the debounce logic (Decimate ratio and Voxel Size defer their expensive modifier re-evaluation until dragging pauses, see #631 / #641) as two near-identical timer classes, and duplicated each field's clamp range between the drag path and the typed-numeric-entry path (#640).

Fix

  • Flip Decimate's drag formula to match the rest (ref_value - delta).
  • Introduce a single _DRAG_FIELD_CONFIG table declaring, per field: drag sensitivity, direction (invert), clamp range, and whether committing a dragged change is debounced. This makes an intentional inversion (Voxel Size) explicit and documented instead of indistinguishable from a bug, and is the one place to check/adjust a field's feel going forward.
  • Replace the duplicated per-field debounce timers with one generic arm_update_debounce() / flush_update_debounce() pair.
  • Share the clamp range between the drag path and the typed-numeric-entry path via one clamp_field_value() helper.
  • Incidental fix found while unifying: Capsule Segments had no minimum-value floor (Cylinder and Sphere Segments both floor at their minimum), letting it drag down to 0/negative before abs()-ing back up. Now shares Sphere's floor of 2.

Working tree fix is ready on main (uncommitted): collider_shapes/add_bounding_primitive.py.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Minor Prioit's a bug but not affecting the experience or causing many issues.bugSomething isn't workinghotkey

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions