void TrackPositionNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { bNode *editorNode = this->getbNode(); MovieClip *clip = (MovieClip *) editorNode->id; NodeTrackPosData *trackpos_data = (NodeTrackPosData *) editorNode->storage; NodeOutput *outputX = this->getOutputSocket(0); NodeOutput *outputY = this->getOutputSocket(1); int frame_number; if (editorNode->custom1 == CMP_TRACKPOS_ABSOLUTE_FRAME) { frame_number = editorNode->custom2; } else { frame_number = context.getFramenumber(); } TrackPositionOperation *operationX = new TrackPositionOperation(); operationX->setMovieClip(clip); operationX->setTrackingObject(trackpos_data->tracking_object); operationX->setTrackName(trackpos_data->track_name); operationX->setFramenumber(frame_number); operationX->setAxis(0); operationX->setPosition(editorNode->custom1); operationX->setRelativeFrame(editorNode->custom2); converter.addOperation(operationX); TrackPositionOperation *operationY = new TrackPositionOperation(); operationY->setMovieClip(clip); operationY->setTrackingObject(trackpos_data->tracking_object); operationY->setTrackName(trackpos_data->track_name); operationY->setFramenumber(frame_number); operationY->setAxis(1); operationY->setPosition(editorNode->custom1); operationY->setRelativeFrame(editorNode->custom2); converter.addOperation(operationY); converter.mapOutputSocket(outputX, operationX->getOutputSocket()); converter.mapOutputSocket(outputY, operationY->getOutputSocket()); }
void TrackPositionNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { bNode *editorNode = this->getbNode(); MovieClip *clip = (MovieClip *) editorNode->id; NodeTrackPosData *trackpos_data = (NodeTrackPosData *) editorNode->storage; NodeOutput *outputX = this->getOutputSocket(0); NodeOutput *outputY = this->getOutputSocket(1); NodeOutput *outputSpeed = this->getOutputSocket(2); int frame_number; if (editorNode->custom1 == CMP_TRACKPOS_ABSOLUTE_FRAME) { frame_number = editorNode->custom2; } else { frame_number = context.getFramenumber(); } TrackPositionOperation *operationX = new TrackPositionOperation(); operationX->setMovieClip(clip); operationX->setTrackingObject(trackpos_data->tracking_object); operationX->setTrackName(trackpos_data->track_name); operationX->setFramenumber(frame_number); operationX->setAxis(0); operationX->setPosition(editorNode->custom1); operationX->setRelativeFrame(editorNode->custom2); converter.addOperation(operationX); converter.mapOutputSocket(outputX, operationX->getOutputSocket()); TrackPositionOperation *operationY = new TrackPositionOperation(); operationY->setMovieClip(clip); operationY->setTrackingObject(trackpos_data->tracking_object); operationY->setTrackName(trackpos_data->track_name); operationY->setFramenumber(frame_number); operationY->setAxis(1); operationY->setPosition(editorNode->custom1); operationY->setRelativeFrame(editorNode->custom2); converter.addOperation(operationY); converter.mapOutputSocket(outputY, operationY->getOutputSocket()); TrackPositionOperation *operationMotionPreX = create_motion_operation(converter, clip, trackpos_data, 0, frame_number, -1); TrackPositionOperation *operationMotionPreY = create_motion_operation(converter, clip, trackpos_data, 1, frame_number, -1); TrackPositionOperation *operationMotionPostX = create_motion_operation(converter, clip, trackpos_data, 0, frame_number, 1); TrackPositionOperation *operationMotionPostY = create_motion_operation(converter, clip, trackpos_data, 1, frame_number, 1); CombineChannelsOperation *combine_operation = new CombineChannelsOperation(); converter.addOperation(combine_operation); converter.addLink(operationMotionPreX->getOutputSocket(), combine_operation->getInputSocket(0)); converter.addLink(operationMotionPreY->getOutputSocket(), combine_operation->getInputSocket(1)); converter.addLink(operationMotionPostX->getOutputSocket(), combine_operation->getInputSocket(2)); converter.addLink(operationMotionPostY->getOutputSocket(), combine_operation->getInputSocket(3)); converter.mapOutputSocket(outputSpeed, combine_operation->getOutputSocket()); }