Blender Git Commit Log

Git Commits -> Revision c751d40

Revision c751d40 by Monique Dewanchand (master)
November 30, 2020, 07:00 (GMT)
Cleanup hardcoded render percentage to factor conversion

During revision of {D8952} one of the comments was to make a function that converts the render percentage to a factor. This to avoid code duplication. However the duplicated code was already all over the compositor code. So in order to avoid this code duplication for {D8952} I propose to first cleanup the duplicated code and build patch {D8952} based on this clean up.

The method that converts the render percentage to a factor is put in the CompositorContext. Why? The CompositorContext keeps DNA information like the renderdata. DNA, and thus the CompositorContext, keeps the size of the render resolution in percentage (user oriented). The compositor needs the size of the render resolution as a factor. So the CompositorContext seems like the obvious place to have this conversion method.

Why not in de NodeBase? The method could've been added to the nodebase, but I wanted to keep the nodebase as clean as possible and not put simple "conversion" methods into this base class. Also I didn't really like the call flow: you'd always have to get the renderdata size from the context and then convert.
Putting it in the CompositorContext avoids this extra invoke of a call.

Why not in the Converter? See nodebase. And the Converter seems more like a class for "structural" and complex node tree conversions. Not the simple conversions.

Reviewed By: Sergey Sharybin

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

Commit Details:

Full Hash: c751d40e070c6df907a526d7e3e17fc10611191e
Parent Commit: f38cd7e
Committed By: Jeroen Bakker
Lines Changed: +28, -13

6 Modified Paths:

/source/blender/compositor/intern/COM_CompositorContext.h (+9, -0) (Diff)
/source/blender/compositor/nodes/COM_BoxMaskNode.cpp (+3, -2) (Diff)
/source/blender/compositor/nodes/COM_EllipseMaskNode.cpp (+4, -2) (Diff)
/source/blender/compositor/nodes/COM_MaskNode.cpp (+5, -4) (Diff)
/source/blender/compositor/nodes/COM_ScaleNode.cpp (+4, -3) (Diff)
/source/blender/compositor/nodes/COM_TranslateNode.cpp (+3, -2) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021