2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2012 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2012-06-14 12:18:42 +00:00
|
|
|
|
|
|
|
|
#include "COM_KeyingScreenNode.h"
|
|
|
|
|
#include "COM_KeyingScreenOperation.h"
|
|
|
|
|
|
2021-03-23 17:12:27 +01:00
|
|
|
namespace blender::compositor {
|
|
|
|
|
|
2021-10-13 23:01:15 +02:00
|
|
|
KeyingScreenNode::KeyingScreenNode(bNode *editor_node) : Node(editor_node)
|
2012-06-14 12:18:42 +00:00
|
|
|
{
|
2012-06-15 17:57:39 +00:00
|
|
|
/* pass */
|
2012-06-14 12:18:42 +00:00
|
|
|
}
|
|
|
|
|
|
2021-10-13 23:01:15 +02:00
|
|
|
void KeyingScreenNode::convert_to_operations(NodeConverter &converter,
|
|
|
|
|
const CompositorContext &context) const
|
2012-06-14 12:18:42 +00:00
|
|
|
{
|
2022-08-31 11:49:35 -05:00
|
|
|
const bNode *editor_node = this->get_bnode();
|
2021-10-13 23:01:15 +02:00
|
|
|
MovieClip *clip = (MovieClip *)editor_node->id;
|
|
|
|
|
NodeKeyingScreenData *keyingscreen_data = (NodeKeyingScreenData *)editor_node->storage;
|
2018-06-17 17:05:29 +02:00
|
|
|
|
2021-10-13 23:01:15 +02:00
|
|
|
NodeOutput *output_screen = this->get_output_socket(0);
|
2018-06-17 17:05:29 +02:00
|
|
|
|
2021-08-31 13:36:28 +10:00
|
|
|
/* Always connect the output image. */
|
2012-06-14 12:18:42 +00:00
|
|
|
KeyingScreenOperation *operation = new KeyingScreenOperation();
|
2021-10-13 23:01:15 +02:00
|
|
|
operation->set_movie_clip(clip);
|
|
|
|
|
operation->set_tracking_object(keyingscreen_data->tracking_object);
|
2023-10-04 07:07:04 +02:00
|
|
|
operation->set_smoothness(keyingscreen_data->smoothness);
|
2021-10-13 23:01:15 +02:00
|
|
|
operation->set_framenumber(context.get_framenumber());
|
|
|
|
|
converter.add_operation(operation);
|
2018-06-17 17:05:29 +02:00
|
|
|
|
2021-10-13 23:01:15 +02:00
|
|
|
converter.map_output_socket(output_screen, operation->get_output_socket());
|
2012-06-14 12:18:42 +00:00
|
|
|
}
|
2021-03-23 17:12:27 +01:00
|
|
|
|
|
|
|
|
} // namespace blender::compositor
|