diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-06-12 18:28:36 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-06-12 18:28:36 +0400 |
commit | 9aa088bab68adb1488ae42c14813babbab594117 (patch) | |
tree | 328c2d17a5841e3102c47dadabfc2b291ac668f8 | |
parent | ba3a1067fa831d8fa7812049a1c3ee08a6b27bd9 (diff) |
Track Position node now could output absolute position of track at a given frame
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 1 | ||||
-rw-r--r-- | source/blender/compositor/nodes/COM_TrackPositionNode.cpp | 14 | ||||
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 2 |
4 files changed, 16 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 587acb8f0d7..b43747ab33a 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -921,6 +921,7 @@ void ntreeGPUMaterialNodes(struct bNodeTree *ntree, struct GPUMateria #define CMP_TRACKPOS_ABSOLUTE 0 #define CMP_TRACKPOS_RELATIVE_START 1 #define CMP_TRACKPOS_RELATIVE_FRAME 2 +#define CMP_TRACKPOS_ABSOLUTE_FRAME 3 /* API */ struct CompBuf; diff --git a/source/blender/compositor/nodes/COM_TrackPositionNode.cpp b/source/blender/compositor/nodes/COM_TrackPositionNode.cpp index f4efcfe27f0..c5474e0ce70 100644 --- a/source/blender/compositor/nodes/COM_TrackPositionNode.cpp +++ b/source/blender/compositor/nodes/COM_TrackPositionNode.cpp @@ -27,6 +27,8 @@ extern "C" { #include "DNA_movieclip_types.h" + + #include "BKE_node.h" } TrackPositionNode::TrackPositionNode(bNode *editorNode) : Node(editorNode) @@ -44,13 +46,21 @@ void TrackPositionNode::convertToOperations(ExecutionSystem *graph, CompositorCo NodeTrackPosData *trackpos_data = (NodeTrackPosData *) editorNode->storage; + int frame_number; + if (editorNode->custom1 == CMP_TRACKPOS_ABSOLUTE_FRAME) { + frame_number = editorNode->custom2; + } + else { + frame_number = context->getFramenumber(); + } + 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->setFramenumber(frame_number); operationX->setAxis(0); operationX->setPosition(editorNode->custom1); operationX->setRelativeFrame(editorNode->custom2); @@ -58,7 +68,7 @@ void TrackPositionNode::convertToOperations(ExecutionSystem *graph, CompositorCo operationY->setMovieClip(clip); operationY->setTrackingObject(trackpos_data->tracking_object); operationY->setTrackName(trackpos_data->track_name); - operationY->setFramenumber(context->getFramenumber()); + operationY->setFramenumber(frame_number); operationY->setAxis(1); operationY->setPosition(editorNode->custom1); operationY->setRelativeFrame(editorNode->custom2); diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index e6b4f3cbefb..6ba736b75f3 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -2216,7 +2216,7 @@ static void node_composit_buts_trackpos(uiLayout *layout, bContext *C, PointerRN uiItemR(layout, ptr, "position", 0, NULL, ICON_NONE); - if (node->custom1 == 2) { + if (ELEM(node->custom1, CMP_TRACKPOS_RELATIVE_FRAME, CMP_TRACKPOS_ABSOLUTE_FRAME)) { uiItemR(layout, ptr, "frame_relative", 0, NULL, ICON_NONE); } } diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 5230390bf00..a2bb1aff3b9 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -5720,6 +5720,8 @@ static void def_cmp_trackpos(StructRNA *srna) "Relative Start", "Output position of a marker relative to first marker of a track"}, {CMP_TRACKPOS_RELATIVE_FRAME, "RELATIVE_FRAME", 0, "Relative Frame", "Output position of a marker relative to marker at given frame number"}, + {CMP_TRACKPOS_ABSOLUTE_FRAME, "ABSOLUTE_FRAME", 0, + "Absolute Frame", "Output absolute position of a marker at given frame number"}, {0, NULL, 0, NULL, NULL} }; |