Cleanup: Replaced Typedef Enum With Enum Class.
This commit is contained in:
parent
f725f42af5
commit
9d80b3a69c
|
@ -454,7 +454,7 @@ void COM_convert_resolution(NodeOperationBuilder &builder,
|
|||
NodeOperationOutput *fromSocket,
|
||||
NodeOperationInput *toSocket)
|
||||
{
|
||||
InputResizeMode mode = toSocket->getResizeMode();
|
||||
ResizeMode mode = toSocket->getResizeMode();
|
||||
|
||||
NodeOperation *toOperation = &toSocket->getOperation();
|
||||
const float toWidth = toOperation->getWidth();
|
||||
|
@ -470,22 +470,22 @@ void COM_convert_resolution(NodeOperationBuilder &builder,
|
|||
float scaleY = 0;
|
||||
|
||||
switch (mode) {
|
||||
case COM_SC_NO_RESIZE:
|
||||
case ResizeMode::None:
|
||||
break;
|
||||
case COM_SC_CENTER:
|
||||
case ResizeMode::Center:
|
||||
doCenter = true;
|
||||
break;
|
||||
case COM_SC_FIT_WIDTH:
|
||||
case ResizeMode::FitWidth:
|
||||
doCenter = true;
|
||||
doScale = true;
|
||||
scaleX = scaleY = toWidth / fromWidth;
|
||||
break;
|
||||
case COM_SC_FIT_HEIGHT:
|
||||
case ResizeMode::FitHeight:
|
||||
doCenter = true;
|
||||
doScale = true;
|
||||
scaleX = scaleY = toHeight / fromHeight;
|
||||
break;
|
||||
case COM_SC_FIT:
|
||||
case ResizeMode::FitAny:
|
||||
doCenter = true;
|
||||
doScale = true;
|
||||
scaleX = toWidth / fromWidth;
|
||||
|
@ -497,7 +497,7 @@ void COM_convert_resolution(NodeOperationBuilder &builder,
|
|||
scaleY = scaleX;
|
||||
}
|
||||
break;
|
||||
case COM_SC_STRETCH:
|
||||
case ResizeMode::Stretch:
|
||||
doCenter = true;
|
||||
doScale = true;
|
||||
scaleX = toWidth / fromWidth;
|
||||
|
@ -510,8 +510,8 @@ void COM_convert_resolution(NodeOperationBuilder &builder,
|
|||
ScaleOperation *scaleOperation = nullptr;
|
||||
if (doScale) {
|
||||
scaleOperation = new ScaleOperation();
|
||||
scaleOperation->getInputSocket(1)->setResizeMode(COM_SC_NO_RESIZE);
|
||||
scaleOperation->getInputSocket(2)->setResizeMode(COM_SC_NO_RESIZE);
|
||||
scaleOperation->getInputSocket(1)->setResizeMode(ResizeMode::None);
|
||||
scaleOperation->getInputSocket(2)->setResizeMode(ResizeMode::None);
|
||||
first = scaleOperation;
|
||||
SetValueOperation *sxop = new SetValueOperation();
|
||||
sxop->setValue(scaleX);
|
||||
|
@ -530,8 +530,8 @@ void COM_convert_resolution(NodeOperationBuilder &builder,
|
|||
}
|
||||
|
||||
TranslateOperation *translateOperation = new TranslateOperation();
|
||||
translateOperation->getInputSocket(1)->setResizeMode(COM_SC_NO_RESIZE);
|
||||
translateOperation->getInputSocket(2)->setResizeMode(COM_SC_NO_RESIZE);
|
||||
translateOperation->getInputSocket(1)->setResizeMode(ResizeMode::None);
|
||||
translateOperation->getInputSocket(2)->setResizeMode(ResizeMode::None);
|
||||
if (!first) {
|
||||
first = translateOperation;
|
||||
}
|
||||
|
@ -551,14 +551,14 @@ void COM_convert_resolution(NodeOperationBuilder &builder,
|
|||
builder.addOperation(translateOperation);
|
||||
|
||||
if (doScale) {
|
||||
translateOperation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE);
|
||||
translateOperation->getInputSocket(0)->setResizeMode(ResizeMode::None);
|
||||
builder.addLink(scaleOperation->getOutputSocket(), translateOperation->getInputSocket(0));
|
||||
}
|
||||
|
||||
/* remove previous link and replace */
|
||||
builder.removeInputLink(toSocket);
|
||||
first->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE);
|
||||
toSocket->setResizeMode(COM_SC_NO_RESIZE);
|
||||
first->getInputSocket(0)->setResizeMode(ResizeMode::None);
|
||||
toSocket->setResizeMode(ResizeMode::None);
|
||||
builder.addLink(fromSocket, first->getInputSocket(0));
|
||||
builder.addLink(translateOperation->getOutputSocket(), toSocket);
|
||||
}
|
||||
|
|
|
@ -70,17 +70,17 @@ class ExecutionGroup;
|
|||
*
|
||||
* - Image size conversions: the system can automatically convert when resolutions do not match.
|
||||
* An NodeInput has a resize mode. This can be any of the following settings.
|
||||
* - [@ref InputSocketResizeMode.COM_SC_CENTER]:
|
||||
* - [@ref InputSocketResizeMode.ResizeMode::Center]:
|
||||
* The center of both images are aligned
|
||||
* - [@ref InputSocketResizeMode.COM_SC_FIT_WIDTH]:
|
||||
* - [@ref InputSocketResizeMode.ResizeMode::FitWidth]:
|
||||
* The width of both images are aligned
|
||||
* - [@ref InputSocketResizeMode.COM_SC_FIT_HEIGHT]:
|
||||
* - [@ref InputSocketResizeMode.ResizeMode::FitHeight]:
|
||||
* The height of both images are aligned
|
||||
* - [@ref InputSocketResizeMode.COM_SC_FIT]:
|
||||
* - [@ref InputSocketResizeMode.ResizeMode::FitAny]:
|
||||
* The width, or the height of both images are aligned to make sure that it fits.
|
||||
* - [@ref InputSocketResizeMode.COM_SC_STRETCH]:
|
||||
* - [@ref InputSocketResizeMode.ResizeMode::Stretch]:
|
||||
* The width and the height of both images are aligned.
|
||||
* - [@ref InputSocketResizeMode.COM_SC_NO_RESIZE]:
|
||||
* - [@ref InputSocketResizeMode.ResizeMode::None]:
|
||||
* Bottom left of the images are aligned.
|
||||
*
|
||||
* \see COM_convert_data_type Datatype conversions
|
||||
|
|
|
@ -63,7 +63,7 @@ NodeOperationInput *NodeOperation::getInputSocket(unsigned int index) const
|
|||
return m_inputs[index];
|
||||
}
|
||||
|
||||
void NodeOperation::addInputSocket(DataType datatype, InputResizeMode resize_mode)
|
||||
void NodeOperation::addInputSocket(DataType datatype, ResizeMode resize_mode)
|
||||
{
|
||||
NodeOperationInput *socket = new NodeOperationInput(this, datatype, resize_mode);
|
||||
m_inputs.push_back(socket);
|
||||
|
@ -195,9 +195,7 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti *input,
|
|||
**** OpInput ****
|
||||
*****************/
|
||||
|
||||
NodeOperationInput::NodeOperationInput(NodeOperation *op,
|
||||
DataType datatype,
|
||||
InputResizeMode resizeMode)
|
||||
NodeOperationInput::NodeOperationInput(NodeOperation *op, DataType datatype, ResizeMode resizeMode)
|
||||
: m_operation(op), m_datatype(datatype), m_resizeMode(resizeMode), m_link(nullptr)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -48,24 +48,24 @@ typedef NodeOperation SocketReader;
|
|||
* How are the input and working resolutions matched
|
||||
* \ingroup Model
|
||||
*/
|
||||
typedef enum InputResizeMode {
|
||||
enum class ResizeMode {
|
||||
/** \brief Center the input image to the center of the working area of the node, no resizing
|
||||
* occurs */
|
||||
COM_SC_CENTER = NS_CR_CENTER,
|
||||
Center = NS_CR_CENTER,
|
||||
/** \brief The bottom left of the input image is the bottom left of the working area of the node,
|
||||
* no resizing occurs */
|
||||
COM_SC_NO_RESIZE = NS_CR_NONE,
|
||||
None = NS_CR_NONE,
|
||||
/** \brief Fit the width of the input image to the width of the working area of the node */
|
||||
COM_SC_FIT_WIDTH = NS_CR_FIT_WIDTH,
|
||||
FitWidth = NS_CR_FIT_WIDTH,
|
||||
/** \brief Fit the height of the input image to the height of the working area of the node */
|
||||
COM_SC_FIT_HEIGHT = NS_CR_FIT_HEIGHT,
|
||||
FitHeight = NS_CR_FIT_HEIGHT,
|
||||
/** \brief Fit the width or the height of the input image to the width or height of the working
|
||||
* area of the node, image will be larger than the working area */
|
||||
COM_SC_FIT = NS_CR_FIT,
|
||||
FitAny = NS_CR_FIT,
|
||||
/** \brief Fit the width and the height of the input image to the width and height of the working
|
||||
* area of the node, image will be equally larger than the working area */
|
||||
COM_SC_STRETCH = NS_CR_STRETCH,
|
||||
} InputResizeMode;
|
||||
Stretch = NS_CR_STRETCH,
|
||||
};
|
||||
|
||||
enum class PixelSampler {
|
||||
Nearest = 0,
|
||||
|
@ -444,7 +444,7 @@ class NodeOperation {
|
|||
protected:
|
||||
NodeOperation();
|
||||
|
||||
void addInputSocket(DataType datatype, InputResizeMode resize_mode = COM_SC_CENTER);
|
||||
void addInputSocket(DataType datatype, ResizeMode resize_mode = ResizeMode::Center);
|
||||
void addOutputSocket(DataType datatype);
|
||||
|
||||
void setWidth(unsigned int width)
|
||||
|
@ -546,7 +546,7 @@ class NodeOperationInput {
|
|||
DataType m_datatype;
|
||||
|
||||
/** Resize mode of this socket */
|
||||
InputResizeMode m_resizeMode;
|
||||
ResizeMode m_resizeMode;
|
||||
|
||||
/** Connected output */
|
||||
NodeOperationOutput *m_link;
|
||||
|
@ -554,7 +554,7 @@ class NodeOperationInput {
|
|||
public:
|
||||
NodeOperationInput(NodeOperation *op,
|
||||
DataType datatype,
|
||||
InputResizeMode resizeMode = COM_SC_CENTER);
|
||||
ResizeMode resizeMode = ResizeMode::Center);
|
||||
|
||||
NodeOperation &getOperation() const
|
||||
{
|
||||
|
@ -578,11 +578,11 @@ class NodeOperationInput {
|
|||
return m_link;
|
||||
}
|
||||
|
||||
void setResizeMode(InputResizeMode resizeMode)
|
||||
void setResizeMode(ResizeMode resizeMode)
|
||||
{
|
||||
this->m_resizeMode = resizeMode;
|
||||
}
|
||||
InputResizeMode getResizeMode() const
|
||||
ResizeMode getResizeMode() const
|
||||
{
|
||||
return this->m_resizeMode;
|
||||
}
|
||||
|
|
|
@ -399,7 +399,7 @@ void NodeOperationBuilder::determineResolutions()
|
|||
{
|
||||
blender::Vector<Link> convert_links;
|
||||
for (const Link &link : m_links) {
|
||||
if (link.to()->getResizeMode() != COM_SC_NO_RESIZE) {
|
||||
if (link.to()->getResizeMode() != ResizeMode::None) {
|
||||
NodeOperation &from_op = link.from()->getOperation();
|
||||
NodeOperation &to_op = link.to()->getOperation();
|
||||
if (from_op.getWidth() != to_op.getWidth() || from_op.getHeight() != to_op.getHeight()) {
|
||||
|
|
|
@ -60,7 +60,7 @@ void BoxMaskNode::convertToOperations(NodeConverter &converter,
|
|||
scaleOperation->setOffset(0.0f, 0.0f);
|
||||
scaleOperation->setNewWidth(rd->xsch * render_size_factor);
|
||||
scaleOperation->setNewHeight(rd->ysch * render_size_factor);
|
||||
scaleOperation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE);
|
||||
scaleOperation->getInputSocket(0)->setResizeMode(ResizeMode::None);
|
||||
converter.addOperation(scaleOperation);
|
||||
|
||||
converter.addLink(valueOperation->getOutputSocket(0), scaleOperation->getInputSocket(0));
|
||||
|
|
|
@ -60,7 +60,7 @@ void EllipseMaskNode::convertToOperations(NodeConverter &converter,
|
|||
scaleOperation->setOffset(0.0f, 0.0f);
|
||||
scaleOperation->setNewWidth(rd->xsch * render_size_factor);
|
||||
scaleOperation->setNewHeight(rd->ysch * render_size_factor);
|
||||
scaleOperation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE);
|
||||
scaleOperation->getInputSocket(0)->setResizeMode(ResizeMode::None);
|
||||
converter.addOperation(scaleOperation);
|
||||
|
||||
converter.addLink(valueOperation->getOutputSocket(0), scaleOperation->getInputSocket(0));
|
||||
|
|
|
@ -65,7 +65,7 @@ void GlareNode::convertToOperations(NodeConverter &converter,
|
|||
|
||||
MixGlareOperation *mixoperation = new MixGlareOperation();
|
||||
mixoperation->setResolutionInputSocketIndex(1);
|
||||
mixoperation->getInputSocket(2)->setResizeMode(COM_SC_FIT);
|
||||
mixoperation->getInputSocket(2)->setResizeMode(ResizeMode::FitAny);
|
||||
|
||||
converter.addOperation(glareoperation);
|
||||
converter.addOperation(thresholdOperation);
|
||||
|
|
|
@ -79,7 +79,7 @@ void ScaleNode::convertToOperations(NodeConverter &converter,
|
|||
operation->setOffset(bnode->custom3, bnode->custom4);
|
||||
operation->setNewWidth(rd->xsch * render_size_factor);
|
||||
operation->setNewHeight(rd->ysch * render_size_factor);
|
||||
operation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE);
|
||||
operation->getInputSocket(0)->setResizeMode(ResizeMode::None);
|
||||
converter.addOperation(operation);
|
||||
|
||||
converter.mapInputSocket(inputSocket, operation->getInputSocket(0));
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
BokehBlurOperation::BokehBlurOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE);
|
||||
this->addInputSocket(DataType::Color, ResizeMode::None);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addInputSocket(DataType::Value);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
CalculateMeanOperation::CalculateMeanOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE);
|
||||
this->addInputSocket(DataType::Color, ResizeMode::None);
|
||||
this->addOutputSocket(DataType::Value);
|
||||
this->m_imageReader = nullptr;
|
||||
this->m_iscalculated = false;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
CropBaseOperation::CropBaseOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE);
|
||||
this->addInputSocket(DataType::Color, ResizeMode::None);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->m_inputOperation = nullptr;
|
||||
this->m_settings = nullptr;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
GlareThresholdOperation::GlareThresholdOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color, COM_SC_FIT);
|
||||
this->addInputSocket(DataType::Color, ResizeMode::FitAny);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->m_inputProgram = nullptr;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
MapUVOperation::MapUVOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE);
|
||||
this->addInputSocket(DataType::Color, ResizeMode::None);
|
||||
this->addInputSocket(DataType::Vector);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->m_alpha = 0.0f;
|
||||
|
|
|
@ -46,7 +46,7 @@ BLI_INLINE void warpCoord(float x, float y, float matrix[3][3], float uv[2], flo
|
|||
|
||||
PlaneDistortWarpImageOperation::PlaneDistortWarpImageOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE);
|
||||
this->addInputSocket(DataType::Color, ResizeMode::None);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->m_pixelReader = nullptr;
|
||||
this->m_motion_blur_samples = 1;
|
||||
|
|
|
@ -39,7 +39,7 @@ PreviewOperation::PreviewOperation(const ColorManagedViewSettings *viewSettings,
|
|||
const unsigned int defaultHeight)
|
||||
|
||||
{
|
||||
this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE);
|
||||
this->addInputSocket(DataType::Color, ResizeMode::None);
|
||||
this->m_preview = nullptr;
|
||||
this->m_outputBuffer = nullptr;
|
||||
this->m_input = nullptr;
|
||||
|
|
|
@ -203,7 +203,7 @@ bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input,
|
|||
// Absolute fixed size
|
||||
ScaleFixedSizeOperation::ScaleFixedSizeOperation() : BaseScaleOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE);
|
||||
this->addInputSocket(DataType::Color, ResizeMode::None);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->setResolutionInputSocketIndex(0);
|
||||
this->m_inputOperation = nullptr;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
TonemapOperation::TonemapOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE);
|
||||
this->addInputSocket(DataType::Color, ResizeMode::None);
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->m_imageReader = nullptr;
|
||||
this->m_data = nullptr;
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
VariableSizeBokehBlurOperation::VariableSizeBokehBlurOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Color);
|
||||
this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE); // do not resize the bokeh image.
|
||||
this->addInputSocket(DataType::Color, ResizeMode::None); // do not resize the bokeh image.
|
||||
this->addInputSocket(DataType::Value); // radius
|
||||
#ifdef COM_DEFOCUS_SEARCH
|
||||
this->addInputSocket(DataType::Color,
|
||||
COM_SC_NO_RESIZE); // inverse search radius optimization structure.
|
||||
ResizeMode::None); // inverse search radius optimization structure.
|
||||
#endif
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->setComplex(true);
|
||||
|
@ -278,7 +278,7 @@ bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(
|
|||
// InverseSearchRadiusOperation
|
||||
InverseSearchRadiusOperation::InverseSearchRadiusOperation()
|
||||
{
|
||||
this->addInputSocket(DataType::Value, COM_SC_NO_RESIZE); // radius
|
||||
this->addInputSocket(DataType::Value, ResizeMode::None); // radius
|
||||
this->addOutputSocket(DataType::Color);
|
||||
this->setComplex(true);
|
||||
this->m_inputRadius = nullptr;
|
||||
|
|
Loading…
Reference in New Issue