Blender  V2.93
COM_PlaneTrackDeformNode.cc
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * Copyright 2013, Blender Foundation.
17  */
18 
20 #include "COM_ExecutionSystem.h"
21 
23 
24 #include "BKE_movieclip.h"
25 #include "BKE_node.h"
26 #include "BKE_tracking.h"
27 
28 namespace blender::compositor {
29 
31 {
32  /* pass */
33 }
34 
36  const CompositorContext &context) const
37 {
38  bNode *editorNode = this->getbNode();
39  MovieClip *clip = (MovieClip *)editorNode->id;
41 
42  int frame_number = context.getFramenumber();
43 
44  NodeInput *input_image = this->getInputSocket(0);
45  NodeOutput *output_warped_image = this->getOutputSocket(0);
46  NodeOutput *output_plane = this->getOutputSocket(1);
47 
48  PlaneTrackWarpImageOperation *warp_image_operation = new PlaneTrackWarpImageOperation();
49  warp_image_operation->setMovieClip(clip);
50  warp_image_operation->setTrackingObject(data->tracking_object);
51  warp_image_operation->setPlaneTrackName(data->plane_track_name);
52  warp_image_operation->setFramenumber(frame_number);
54  warp_image_operation->setMotionBlurSamples(data->motion_blur_samples);
55  warp_image_operation->setMotionBlurShutter(data->motion_blur_shutter);
56  }
57  converter.addOperation(warp_image_operation);
58 
59  converter.mapInputSocket(input_image, warp_image_operation->getInputSocket(0));
60  converter.mapOutputSocket(output_warped_image, warp_image_operation->getOutputSocket());
61 
62  PlaneTrackMaskOperation *plane_mask_operation = new PlaneTrackMaskOperation();
63  plane_mask_operation->setMovieClip(clip);
64  plane_mask_operation->setTrackingObject(data->tracking_object);
65  plane_mask_operation->setPlaneTrackName(data->plane_track_name);
66  plane_mask_operation->setFramenumber(frame_number);
68  plane_mask_operation->setMotionBlurSamples(data->motion_blur_samples);
69  plane_mask_operation->setMotionBlurShutter(data->motion_blur_shutter);
70  }
71  converter.addOperation(plane_mask_operation);
72 
73  converter.mapOutputSocket(output_plane, plane_mask_operation->getOutputSocket());
74 }
75 
76 } // namespace blender::compositor
@ CMP_NODEFLAG_PLANETRACKDEFORM_MOTION_BLUR
Overall context of the compositor.
void mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket)
void addOperation(NodeOperation *operation)
void mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket)
NodeInput are sockets that can receive data/input.
Definition: COM_Node.h:210
NodeOperationInput * getInputSocket(unsigned int index)
NodeOperationOutput * getOutputSocket(unsigned int index=0)
NodeOutput are sockets that can send data/input.
Definition: COM_Node.h:258
NodeOutput * getOutputSocket(const unsigned int index=0) const
Definition: COM_Node.cc:108
bNode * getbNode() const
get the reference to the SDNA bNode struct
Definition: COM_Node.h:82
NodeInput * getInputSocket(const unsigned int index) const
Definition: COM_Node.cc:113
void convertToOperations(NodeConverter &converter, const CompositorContext &context) const override
convert node to operation
struct ID * id
void * storage