Page MenuHome

Transform: Replace View3d Snap operators with a transform ops version
Needs RevisionPublic

Authored by Germano Cavalcante (mano-wii) on May 18 2020, 7:10 PM.

Details

Summary

All view3d.snap_ operators have a logic very similar to transform.translate.
It is basically moving specific objects to a chosen destination.
Because of this similar logic, there is a lot of similar or duplicate code between these operators.
Also, with each new feature implemented for transform, the user expects a corresponding behavior for view3d.snap_ (eg. T73400)

This patch proposes to remove all view3d.snap_ operators and use a corresponding one with the transform system.

Diff Detail

Repository
rB Blender
Branch
master
Build Status
Buildable 8102
Build 8102: arc lint + arc unit

Event Timeline

Germano Cavalcante (mano-wii) requested review of this revision.May 18 2020, 7:10 PM
Germano Cavalcante (mano-wii) planned changes to this revision.Sep 2 2021, 6:34 PM

Example of a file whose "Select to Cursor" does not work with this patch:

  • Fix Select to Cursor with constraints
  • Rename
Campbell Barton (campbellbarton) requested changes to this revision.Sep 3 2021, 3:25 AM

Generally good to reduce duplicate code:

It would be good to have UV snapping use this too (to make sure the logic here is generic and to further de-duplicate logic).
... possible f-curve too, although some of these snap operations don't map directly to transform logic as the 3d-view and UV-editor does.

source/blender/editors/transform/transform_ops.c
775

Suggest to call this TRANSFORM_OT_translate_snap_to, allowing for snapping rotation, normals ... etc in the future.

This revision now requires changes to proceed.Sep 3 2021, 3:25 AM