Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/nodes/COM_ScaleNode.cc
| Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | case CMP_SCALE_RELATIVE: { | ||||
| converter.addOperation(operation); | converter.addOperation(operation); | ||||
| converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); | converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); | ||||
| converter.mapInputSocket(inputXSocket, operation->getInputSocket(1)); | converter.mapInputSocket(inputXSocket, operation->getInputSocket(1)); | ||||
| converter.mapInputSocket(inputYSocket, operation->getInputSocket(2)); | converter.mapInputSocket(inputYSocket, operation->getInputSocket(2)); | ||||
| converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); | converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); | ||||
| operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); | operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); | ||||
| operation->set_scale_canvas_max_size(context.get_render_size() * 1.5f); | |||||
| break; | break; | ||||
| } | } | ||||
| case CMP_SCALE_SCENEPERCENT: { | case CMP_SCALE_SCENEPERCENT: { | ||||
| SetValueOperation *scaleFactorOperation = new SetValueOperation(); | SetValueOperation *scaleFactorOperation = new SetValueOperation(); | ||||
| scaleFactorOperation->setValue(context.getRenderPercentageAsFactor()); | scaleFactorOperation->setValue(context.getRenderPercentageAsFactor()); | ||||
| converter.addOperation(scaleFactorOperation); | converter.addOperation(scaleFactorOperation); | ||||
| ScaleRelativeOperation *operation = new ScaleRelativeOperation(); | ScaleRelativeOperation *operation = new ScaleRelativeOperation(); | ||||
| converter.addOperation(operation); | converter.addOperation(operation); | ||||
| converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); | converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); | ||||
| converter.addLink(scaleFactorOperation->getOutputSocket(), operation->getInputSocket(1)); | converter.addLink(scaleFactorOperation->getOutputSocket(), operation->getInputSocket(1)); | ||||
| converter.addLink(scaleFactorOperation->getOutputSocket(), operation->getInputSocket(2)); | converter.addLink(scaleFactorOperation->getOutputSocket(), operation->getInputSocket(2)); | ||||
| converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); | converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); | ||||
| operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); | operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); | ||||
| operation->set_scale_canvas_max_size(context.get_render_size() * 1.5f); | |||||
| break; | break; | ||||
| } | } | ||||
| case CMP_SCALE_RENDERPERCENT: { | case CMP_SCALE_RENDERPERCENT: { | ||||
| const RenderData *rd = context.getRenderData(); | const RenderData *rd = context.getRenderData(); | ||||
| const float render_size_factor = context.getRenderPercentageAsFactor(); | const float render_size_factor = context.getRenderPercentageAsFactor(); | ||||
| ScaleFixedSizeOperation *operation = new ScaleFixedSizeOperation(); | ScaleFixedSizeOperation *operation = new ScaleFixedSizeOperation(); | ||||
| /* framing options */ | /* framing options */ | ||||
| operation->setIsAspect((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_ASPECT) != 0); | operation->setIsAspect((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_ASPECT) != 0); | ||||
| operation->setIsCrop((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_CROP) != 0); | operation->setIsCrop((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_CROP) != 0); | ||||
| operation->setOffset(bnode->custom3, bnode->custom4); | operation->setOffset(bnode->custom3, bnode->custom4); | ||||
| operation->setNewWidth(rd->xsch * render_size_factor); | operation->setNewWidth(rd->xsch * render_size_factor); | ||||
| operation->setNewHeight(rd->ysch * render_size_factor); | operation->setNewHeight(rd->ysch * render_size_factor); | ||||
| operation->getInputSocket(0)->setResizeMode(ResizeMode::None); | |||||
| converter.addOperation(operation); | converter.addOperation(operation); | ||||
| converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); | converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); | ||||
| converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); | converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); | ||||
| operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); | operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); | ||||
| operation->set_scale_canvas_max_size(context.get_render_size() * 3.0f); | |||||
| break; | break; | ||||
| } | } | ||||
| case CMP_SCALE_ABSOLUTE: { | case CMP_SCALE_ABSOLUTE: { | ||||
| /* TODO: what is the use of this one.... perhaps some issues when the ui was updated... */ | /* TODO: what is the use of this one.... perhaps some issues when the ui was updated... */ | ||||
| ScaleAbsoluteOperation *operation = new ScaleAbsoluteOperation(); | ScaleAbsoluteOperation *operation = new ScaleAbsoluteOperation(); | ||||
| converter.addOperation(operation); | converter.addOperation(operation); | ||||
| converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); | converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); | ||||
| converter.mapInputSocket(inputXSocket, operation->getInputSocket(1)); | converter.mapInputSocket(inputXSocket, operation->getInputSocket(1)); | ||||
| converter.mapInputSocket(inputYSocket, operation->getInputSocket(2)); | converter.mapInputSocket(inputYSocket, operation->getInputSocket(2)); | ||||
| converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); | converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); | ||||
| operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); | operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); | ||||
| operation->set_scale_canvas_max_size(context.get_render_size() * 1.5f); | |||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } // namespace blender::compositor | } // namespace blender::compositor | ||||