Page MenuHome

Cleanup: rename variables to distinguish between target and source
ClosedPublic

Authored by Germano Cavalcante (mano-wii) on Jan 10 2023, 5:34 PM.

Details

Summary

From --> To

Struct Members:

snapTargetsnap_source
snapPointsnap_target
snapTargetGridsnap_target_grid
calcSnapsnap_target_fn
targetSnapsnap_source_fn
applySnapsnap_mode_apply_fn
distancesnap_mode_distance_fn
source_selectsource_operation
target_selecttarget_operation

Functions:

snap_calc_view3d_fnsnap_target_view3d_fn
snap_calc_uv_fnsnap_target_uv_fn
snap_calc_node_fnsnap_target_node_fn
snap_calc_sequencer_fnsnap_target_sequencer_fn
TargetSnapMediansnap_source_median_fn
TargetSnapCentersnap_source_center_fn
TargetSnapClosestsnap_source_closest_fn
TargetSnapActivesnap_source_active_fn

Enums:

TARGET_INITSOURCE_FOUND
TARGET_GRID_INITTARGET_GRID_FOUND
POINT_INITTARGET_FOUND

Types:

eSnapSourceOPSelecteSnapSourceOP
eSnapTargetSelecteSnapTargetOP

The definition of source and target of snap has always been confusing in transform code.

To give you an idea, one of the first changes to improve the situation was to rename the UI Snap Target to Snap With.

However, in a target shooting game, the target is usually the object that is still. Therefore it is more expected that the target is the point in the scene whose transformed element will move to "hit".

And the element that moves, usually pointed to first by the arrow, is the source.

This patch also proposes to rename Selection to Operation.

Diff Detail

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

Event Timeline

Germano Cavalcante (mano-wii) requested review of this revision.Jan 10 2023, 5:34 PM
Germano Cavalcante (mano-wii) created this revision.

Much improved clarity, only minor point noted inline which could be handled separately.

source/blender/editors/transform/transform.h
163–167

While not directly related to this patch, I think it'd be good to give these members a common suffix SNAP_TARGET_FOUND, SNAP_MULTI_POINTS ... etc.

This revision is now accepted and ready to land.Jan 12 2023, 8:55 AM