Revision: 48089
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48089
Author: nazgul
Date: 2012-06-19 17:29:58 +0000 (Tue, 19 Jun 2012)
Log Message:
-----------
Implementation of node for track position input
Modified Paths:
--------------
branches/soc-2011-tomato/source/blender/blenkernel/BKE_node.h
branches/soc-2011-tomato/source/blender/blenkernel/intern/node.c
branches/soc-2011-tomato/source/blender/compositor/CMakeLists.txt
branches/soc-2011-tomato/source/blender/compositor/intern/COM_Converter.cpp
branches/soc-2011-tomato/source/blender/editors/space_node/drawnode.c
branches/soc-2011-tomato/source/blender/makesdna/DNA_node_types.h
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_nodetree.c
branches/soc-2011-tomato/source/blender/makesrna/intern/rna_nodetree_types.h
branches/soc-2011-tomato/source/blender/nodes/CMakeLists.txt
branches/soc-2011-tomato/source/blender/nodes/NOD_composite.h
Added Paths:
-----------
branches/soc-2011-tomato/source/blender/compositor/nodes/COM_TrackPositionNode.cpp
branches/soc-2011-tomato/source/blender/compositor/nodes/COM_TrackPositionNode.h
branches/soc-2011-tomato/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
branches/soc-2011-tomato/source/blender/compositor/operations/COM_TrackPositionOperation.h
branches/soc-2011-tomato/source/blender/nodes/composite/nodes/node_composite_trackpos.c
Modified: branches/soc-2011-tomato/source/blender/blenkernel/BKE_node.h
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/BKE_node.h
2012-06-19 17:21:59 UTC (rev 48088)
+++ branches/soc-2011-tomato/source/blender/blenkernel/BKE_node.h
2012-06-19 17:29:58 UTC (rev 48089)
@@ -660,6 +660,7 @@
#define CMP_NODE_MASK 268
#define CMP_NODE_KEYINGSCREEN 269
#define CMP_NODE_KEYING 270
+#define CMP_NODE_TRACKPOS 271
#define CMP_NODE_GLARE 301
#define CMP_NODE_TONEMAP 302
Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/node.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/node.c
2012-06-19 17:21:59 UTC (rev 48088)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/node.c
2012-06-19 17:29:58 UTC (rev 48089)
@@ -1925,6 +1925,7 @@
register_node_type_cmp_switch(ttype);
register_node_type_cmp_mask(ttype);
+ register_node_type_cmp_trackpos(ttype);
}
static void registerShaderNodes(bNodeTreeType *ttype)
Modified: branches/soc-2011-tomato/source/blender/compositor/CMakeLists.txt
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/CMakeLists.txt
2012-06-19 17:21:59 UTC (rev 48088)
+++ branches/soc-2011-tomato/source/blender/compositor/CMakeLists.txt
2012-06-19 17:29:58 UTC (rev 48089)
@@ -334,6 +334,11 @@
operations/COM_KeyingScreenOperation.cpp
operations/COM_KeyingScreenOperation.h
+ nodes/COM_TrackPositionNode.cpp
+ nodes/COM_TrackPositionNode.h
+ operations/COM_TrackPositionOperation.cpp
+ operations/COM_TrackPositionOperation.h
+
nodes/COM_KeyingNode.cpp
nodes/COM_KeyingNode.h
operations/COM_KeyingOperation.cpp
Modified:
branches/soc-2011-tomato/source/blender/compositor/intern/COM_Converter.cpp
===================================================================
--- branches/soc-2011-tomato/source/blender/compositor/intern/COM_Converter.cpp
2012-06-19 17:21:59 UTC (rev 48088)
+++ branches/soc-2011-tomato/source/blender/compositor/intern/COM_Converter.cpp
2012-06-19 17:29:58 UTC (rev 48089)
@@ -110,6 +110,7 @@
#include "COM_TransformNode.h"
#include "COM_TranslateNode.h"
#include "COM_TranslateOperation.h"
+#include "COM_TrackPositionNode.h"
#include "COM_ValueNode.h"
#include "COM_VectorBlurNode.h"
#include "COM_VectorCurveNode.h"
@@ -361,6 +362,9 @@
case CMP_NODE_KEYING:
node = new KeyingNode(bNode);
break;
+ case CMP_NODE_TRACKPOS:
+ node = new TrackPositionNode(bNode);
+ break;
/* not inplemented yet */
default:
node = new MuteNode(bNode);
Added:
branches/soc-2011-tomato/source/blender/compositor/nodes/COM_TrackPositionNode.cpp
===================================================================
---
branches/soc-2011-tomato/source/blender/compositor/nodes/COM_TrackPositionNode.cpp
(rev 0)
+++
branches/soc-2011-tomato/source/blender/compositor/nodes/COM_TrackPositionNode.cpp
2012-06-19 17:29:58 UTC (rev 48089)
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ * Jeroen Bakker
+ * Monique Dewanchand
+ * Sergey Sharybin
+ */
+
+#include "COM_TrackPositionNode.h"
+#include "COM_ExecutionSystem.h"
+#include "COM_TrackPositionOperation.h"
+
+extern "C" {
+ #include "DNA_movieclip_types.h"
+}
+
+TrackPositionNode::TrackPositionNode(bNode *editorNode) : Node(editorNode)
+{
+ /* pass */
+}
+
+void TrackPositionNode::convertToOperations(ExecutionSystem *graph,
CompositorContext *context)
+{
+ OutputSocket *outputX = this->getOutputSocket(0);
+ OutputSocket *outputY = this->getOutputSocket(1);
+
+ bNode *editorNode = this->getbNode();
+ MovieClip *clip = (MovieClip *) editorNode->id;
+
+ NodeTrackPosData *trackpos_data = (NodeTrackPosData *)
editorNode->storage;
+
+ TrackPositionOperation *operationX = new TrackPositionOperation();
+ TrackPositionOperation *operationY = new TrackPositionOperation();
+
+ operationX->setMovieClip(clip);
+ operationX->setTrackingObject(trackpos_data->tracking_object);
+ operationX->setTrackName(trackpos_data->track_name);
+ operationX->setFramenumber(context->getFramenumber());
+ operationX->setAxis(0);
+
+ operationY->setMovieClip(clip);
+ operationY->setTrackingObject(trackpos_data->tracking_object);
+ operationY->setTrackName(trackpos_data->track_name);
+ operationY->setFramenumber(context->getFramenumber());
+ operationY->setAxis(1);
+
+ outputX->relinkConnections(operationX->getOutputSocket());
+ outputY->relinkConnections(operationY->getOutputSocket());
+
+ graph->addOperation(operationX);
+}
Added:
branches/soc-2011-tomato/source/blender/compositor/nodes/COM_TrackPositionNode.h
===================================================================
---
branches/soc-2011-tomato/source/blender/compositor/nodes/COM_TrackPositionNode.h
(rev 0)
+++
branches/soc-2011-tomato/source/blender/compositor/nodes/COM_TrackPositionNode.h
2012-06-19 17:29:58 UTC (rev 48089)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ * Jeroen Bakker
+ * Monique Dewanchand
+ * Sergey Sharybin
+ */
+
+#include "COM_Node.h"
+#include "DNA_node_types.h"
+
+/**
+ * @brief TrackPositionNode
+ * @ingroup Node
+ */
+class TrackPositionNode : public Node {
+public:
+ TrackPositionNode(bNode *editorNode);
+ void convertToOperations(ExecutionSystem *graph, CompositorContext
*context);
+
+};
Added:
branches/soc-2011-tomato/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
===================================================================
---
branches/soc-2011-tomato/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
(rev 0)
+++
branches/soc-2011-tomato/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
2012-06-19 17:29:58 UTC (rev 48089)
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ * Jeroen Bakker
+ * Monique Dewanchand
+ * Sergey Sharybin
+ */
+
+#include "COM_TrackPositionOperation.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_listbase.h"
+#include "BLI_math.h"
+#include "BLI_math_color.h"
+
+#include "DNA_scene_types.h"
+
+extern "C" {
+ #include "BKE_movieclip.h"
+ #include "BKE_tracking.h"
+}
+
+TrackPositionOperation::TrackPositionOperation() : NodeOperation()
+{
+ this->addOutputSocket(COM_DT_VALUE);
+ this->movieClip = NULL;
+ this->framenumber = 0;
+ this->trackingObject[0] = 0;
+ this->trackName[0] = 0;
+ this->axis = 0;
+}
+
+void TrackPositionOperation::executePixel(float *outputValue, float x, float
y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
+ MovieClipUser user = {0};
+ MovieTracking *tracking = &movieClip->tracking;
+ MovieTrackingObject *object = BKE_tracking_object_get_named(tracking,
this->trackingObject);
+ MovieTrackingTrack *track;
+ MovieTrackingMarker *marker;
+ int width, height;
+
+ outputValue[0] = 0.0f;
+
+ if (!object)
+ return;
+
+ track = BKE_tracking_track_get_named(tracking, object, this->trackName);
+
+ if (!track)
+ return;
+
+ BKE_movieclip_user_set_frame(&user, this->framenumber);
+ BKE_movieclip_get_size(this->movieClip, &user, &width, &height);
+
+ marker = BKE_tracking_marker_get(track, this->framenumber);
+
+ outputValue[0] = marker->pos[this->axis];
+
+ if (this->axis == 0)
+ outputValue[0] *= width;
+ else
+ outputValue[0] *= height;
+}
+
+void TrackPositionOperation::determineResolution(unsigned int resolution[],
unsigned int preferredResolution[])
+{
+ resolution[0] = preferredResolution[0];
+ resolution[1] = preferredResolution[1];
+}
Added:
branches/soc-2011-tomato/source/blender/compositor/operations/COM_TrackPositionOperation.h
===================================================================
---
branches/soc-2011-tomato/source/blender/compositor/operations/COM_TrackPositionOperation.h
(rev 0)
+++
branches/soc-2011-tomato/source/blender/compositor/operations/COM_TrackPositionOperation.h
2012-06-19 17:29:58 UTC (rev 48089)
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs