Page MenuHome

Refactor: arrange transform convert functions in 'TransConvertTypeInfo'
ClosedPublic

Authored by Germano Cavalcante (mano-wii) on Jul 19 2022, 7:19 PM.

Details

Summary

Simplify the transform code by bundling the TransData creation, Data
recalculation, and special updates into a single struct.

So similar functions and parameters can be accessed without special
type checks.


The Transform code has an extensive list of Data types.

This list keeps growing (rBd14c2d549b2f) and with it, enums and
specific conditions are added to various scattered parts of the code,
making it complicated.

So it's good to conventionalize types and functions.

Later more members can be added to the struct:

  • create/free Data allocated specifically for the type
  • create/free Data for snapping
  • Function for calculating proportional editing factors

And others

Diff Detail

Repository
rB Blender

Event Timeline

Germano Cavalcante (mano-wii) requested review of this revision.Jul 19 2022, 7:19 PM
Germano Cavalcante (mano-wii) created this revision.
  • Remove wrong usage of the UNUSED macro
  • Avoid referencing NULL pointer
Campbell Barton (campbellbarton) requested changes to this revision.Jul 22 2022, 4:40 AM

This seems reasonable however this patch causes transform not to refresh contents while transforming, tested on Linux (finishing transform redraws as expected). Tested with object-mode/mesh-edit-mode and UV editing.

source/blender/editors/transform/transform_convert_action.c
934

This function can now be declared static.

This revision now requires changes to proceed.Jul 22 2022, 4:40 AM
  • fix recalData failure (caused by last unchecked change)
  • silence warning
Germano Cavalcante (mano-wii) marked an inline comment as done.Jul 22 2022, 4:58 AM

Looks good, note that some of the ELEM(..) checks would be good to replace with a capabilities flag, for PET, Multi-object editing... etc.

This revision is now accepted and ready to land.Jul 22 2022, 7:19 AM