Realtime Compositor: Implement scale node

This patch implements the Scale node for the realtime compositor.

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

Reviewed By: Clement Foucault
This commit is contained in:
2022-09-09 14:10:38 +02:00
parent e254d8867d
commit 0fd39da3a9
5 changed files with 172 additions and 28 deletions

View File

@@ -25,7 +25,7 @@ void ScaleNode::convert_to_operations(NodeConverter &converter,
NodeOutput *output_socket = this->get_output_socket(0);
switch (bnode->custom1) {
case CMP_SCALE_RELATIVE: {
case CMP_NODE_SCALE_RELATIVE: {
ScaleRelativeOperation *operation = new ScaleRelativeOperation();
converter.add_operation(operation);
@@ -39,7 +39,7 @@ void ScaleNode::convert_to_operations(NodeConverter &converter,
break;
}
case CMP_SCALE_SCENEPERCENT: {
case CMP_NODE_SCALE_RENDER_PERCENT: {
SetValueOperation *scale_factor_operation = new SetValueOperation();
scale_factor_operation->set_value(context.get_render_percentage_as_factor());
converter.add_operation(scale_factor_operation);
@@ -59,13 +59,14 @@ void ScaleNode::convert_to_operations(NodeConverter &converter,
break;
}
case CMP_SCALE_RENDERPERCENT: {
case CMP_NODE_SCALE_RENDER_SIZE: {
const RenderData *rd = context.get_render_data();
const float render_size_factor = context.get_render_percentage_as_factor();
ScaleFixedSizeOperation *operation = new ScaleFixedSizeOperation();
/* framing options */
operation->set_is_aspect((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_ASPECT) != 0);
operation->set_is_crop((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_CROP) != 0);
operation->set_is_aspect(
ELEM(bnode->custom2, CMP_NODE_SCALE_RENDER_SIZE_FIT, CMP_NODE_SCALE_RENDER_SIZE_CROP));
operation->set_is_crop(bnode->custom2 == CMP_NODE_SCALE_RENDER_SIZE_CROP);
operation->set_offset(bnode->custom3, bnode->custom4);
operation->set_new_width(rd->xsch * render_size_factor);
operation->set_new_height(rd->ysch * render_size_factor);
@@ -79,7 +80,7 @@ void ScaleNode::convert_to_operations(NodeConverter &converter,
break;
}
case CMP_SCALE_ABSOLUTE: {
case CMP_NODE_SCALE_ABSOLUTE: {
/* TODO: what is the use of this one.... perhaps some issues when the ui was updated... */
ScaleAbsoluteOperation *operation = new ScaleAbsoluteOperation();
converter.add_operation(operation);