2
* Copyright 2013, Blender Foundation.
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software Foundation,
16
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24
#include "COM_PlaneTrackDeformNode.h"
25
#include "COM_ExecutionSystem.h"
27
#include "COM_PlaneTrackMaskOperation.h"
28
#include "COM_PlaneTrackWarpImageOperation.h"
32
#include "BKE_movieclip.h"
33
#include "BKE_tracking.h"
36
PlaneTrackDeformNode::PlaneTrackDeformNode(bNode *editorNode) : Node(editorNode)
41
void PlaneTrackDeformNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
43
InputSocket *input_image = this->getInputSocket(0);
45
OutputSocket *output_warped_image = this->getOutputSocket(0);
46
OutputSocket *output_plane = this->getOutputSocket(1);
48
bNode *editorNode = this->getbNode();
49
MovieClip *clip = (MovieClip *) editorNode->id;
51
NodePlaneTrackDeformData *data = (NodePlaneTrackDeformData *) editorNode->storage;
53
int frame_number = context->getFramenumber();
55
if (output_warped_image->isConnected()) {
56
PlaneTrackWarpImageOperation *warp_image_operation = new PlaneTrackWarpImageOperation();
58
warp_image_operation->setMovieClip(clip);
59
warp_image_operation->setTrackingObject(data->tracking_object);
60
warp_image_operation->setPlaneTrackName(data->plane_track_name);
61
warp_image_operation->setFramenumber(frame_number);
63
input_image->relinkConnections(warp_image_operation->getInputSocket(0), 0, graph);
64
output_warped_image->relinkConnections(warp_image_operation->getOutputSocket());
66
graph->addOperation(warp_image_operation);
69
if (output_plane->isConnected()) {
70
PlaneTrackMaskOperation *plane_mask_operation = new PlaneTrackMaskOperation();
72
plane_mask_operation->setMovieClip(clip);
73
plane_mask_operation->setTrackingObject(data->tracking_object);
74
plane_mask_operation->setPlaneTrackName(data->plane_track_name);
75
plane_mask_operation->setFramenumber(frame_number);
77
output_plane->relinkConnections(plane_mask_operation->getOutputSocket());
79
graph->addOperation(plane_mask_operation);