Fix #105590: Compositor: Masks don't consider anamorphic aspect ratio
This PR adds support for anamorphic aspect rations when using masks. As viewport compositor doesn't support masks yet, this has not been added yet. Pull Request: https://projects.blender.org/blender/blender/pulls/106121
This commit is contained in:
committed by
Jeroen Bakker
parent
aa69ec7f80
commit
3ea5a8fbb9
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "COM_MaskNode.h"
|
||||
#include "COM_MaskOperation.h"
|
||||
#include "COM_ScaleOperation.h"
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
@@ -50,7 +51,21 @@ void MaskNode::convert_to_operations(NodeConverter &converter,
|
||||
}
|
||||
|
||||
converter.add_operation(operation);
|
||||
converter.map_output_socket(output_mask, operation->get_output_socket());
|
||||
|
||||
ScaleFixedSizeOperation *scale_operation = new ScaleFixedSizeOperation();
|
||||
scale_operation->set_variable_size(true);
|
||||
/* Consider aspect ratio from scene. */
|
||||
const int new_height = rd->xasp / rd->yasp * operation->get_mask_height();
|
||||
scale_operation->set_new_height(new_height);
|
||||
scale_operation->set_new_width(operation->get_mask_width());
|
||||
scale_operation->set_is_aspect(false);
|
||||
scale_operation->set_is_crop(false);
|
||||
scale_operation->set_scale_canvas_max_size({float(data->size_x), float(data->size_y)});
|
||||
|
||||
converter.add_operation(scale_operation);
|
||||
converter.add_link(operation->get_output_socket(0), scale_operation->get_input_socket(0));
|
||||
|
||||
converter.map_output_socket(output_mask, scale_operation->get_output_socket(0));
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
||||
@@ -63,6 +63,14 @@ class MaskOperation : public MultiThreadedOperation {
|
||||
mask_height_inv_ = 1.0f / (float)height;
|
||||
mask_px_ofs_[1] = mask_height_inv_ * 0.5f;
|
||||
}
|
||||
int get_mask_width()
|
||||
{
|
||||
return mask_width_;
|
||||
}
|
||||
int get_mask_height()
|
||||
{
|
||||
return mask_height_;
|
||||
}
|
||||
void set_framenumber(int frame_number)
|
||||
{
|
||||
frame_number_ = frame_number;
|
||||
|
||||
Reference in New Issue
Block a user