Revision: 48092
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48092
Author:   nazgul
Date:     2012-06-19 18:04:40 +0000 (Tue, 19 Jun 2012)
Log Message:
-----------
Added option to witch track position output node value to relative value
against initial's track position.

Modified Paths:
--------------
    
branches/soc-2011-tomato/source/blender/compositor/nodes/COM_TrackPositionNode.cpp
    
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/editors/space_node/drawnode.c
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_nodetree.c

Modified: 
branches/soc-2011-tomato/source/blender/compositor/nodes/COM_TrackPositionNode.cpp
===================================================================
--- 
branches/soc-2011-tomato/source/blender/compositor/nodes/COM_TrackPositionNode.cpp
  2012-06-19 17:57:51 UTC (rev 48091)
+++ 
branches/soc-2011-tomato/source/blender/compositor/nodes/COM_TrackPositionNode.cpp
  2012-06-19 18:04:40 UTC (rev 48092)
@@ -52,12 +52,14 @@
        operationX->setTrackName(trackpos_data->track_name);
        operationX->setFramenumber(context->getFramenumber());
        operationX->setAxis(0);
+       operationX->setRelative(editorNode->custom1);
 
        operationY->setMovieClip(clip);
        operationY->setTrackingObject(trackpos_data->tracking_object);
        operationY->setTrackName(trackpos_data->track_name);
        operationY->setFramenumber(context->getFramenumber());
        operationY->setAxis(1);
+       operationY->setRelative(editorNode->custom1);
 
        outputX->relinkConnections(operationX->getOutputSocket());
        outputY->relinkConnections(operationY->getOutputSocket());

Modified: 
branches/soc-2011-tomato/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
===================================================================
--- 
branches/soc-2011-tomato/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
        2012-06-19 17:57:51 UTC (rev 48091)
+++ 
branches/soc-2011-tomato/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
        2012-06-19 18:04:40 UTC (rev 48092)
@@ -44,6 +44,7 @@
        this->trackingObject[0] = 0;
        this->trackName[0] = 0;
        this->axis = 0;
+       this->relative = false;
 }
 
 void TrackPositionOperation::executePixel(float *outputValue, float x, float 
y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -72,6 +73,20 @@
 
        outputValue[0] = marker->pos[this->axis];
 
+       if (this->relative) {
+               int i;
+
+               for (i = 0; i < track->markersnr; i++) {
+                       marker = &track->markers[i];
+
+                       if ((marker->flag & MARKER_DISABLED) == 0) {
+                               outputValue[0] -= marker->pos[this->axis];
+
+                               break;
+                       }
+               }
+       }
+
        if (this->axis == 0)
                outputValue[0] *= width;
        else

Modified: 
branches/soc-2011-tomato/source/blender/compositor/operations/COM_TrackPositionOperation.h
===================================================================
--- 
branches/soc-2011-tomato/source/blender/compositor/operations/COM_TrackPositionOperation.h
  2012-06-19 17:57:51 UTC (rev 48091)
+++ 
branches/soc-2011-tomato/source/blender/compositor/operations/COM_TrackPositionOperation.h
  2012-06-19 18:04:40 UTC (rev 48092)
@@ -44,6 +44,7 @@
        char trackingObject[64];
        char trackName[64];
        int axis;
+       bool relative;
 
        /**
          * Determine the output resolution. The resolution is retrieved from 
the Renderer
@@ -58,6 +59,7 @@
        void setTrackName(char *track) {strncpy(this->trackName, track, 
sizeof(this->trackName));}
        void setFramenumber(int framenumber) {this->framenumber = framenumber;}
        void setAxis(int value) {this->axis = value;}
+       void setRelative(bool value) {this->relative = value;}
 
        void executePixel(float *color, float x, float y, PixelSampler sampler, 
MemoryBuffer * inputBuffers[]);
 

Modified: branches/soc-2011-tomato/source/blender/editors/space_node/drawnode.c
===================================================================
--- branches/soc-2011-tomato/source/blender/editors/space_node/drawnode.c       
2012-06-19 17:57:51 UTC (rev 48091)
+++ branches/soc-2011-tomato/source/blender/editors/space_node/drawnode.c       
2012-06-19 18:04:40 UTC (rev 48092)
@@ -2497,6 +2497,8 @@
                else {
                        uiItemR(layout, ptr, "track_name", 0, "", 
ICON_ANIM_DATA);
                }
+
+               uiItemR(layout, ptr, "use_relative", 0, NULL, ICON_NONE);
        }
 }
 

Modified: branches/soc-2011-tomato/source/blender/makesrna/intern/rna_nodetree.c
===================================================================
--- branches/soc-2011-tomato/source/blender/makesrna/intern/rna_nodetree.c      
2012-06-19 17:57:51 UTC (rev 48091)
+++ branches/soc-2011-tomato/source/blender/makesrna/intern/rna_nodetree.c      
2012-06-19 18:04:40 UTC (rev 48092)
@@ -3624,6 +3624,11 @@
        RNA_def_property_ui_text(prop, "Movie Clip", "");
        RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 
+       prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
+       RNA_def_property_ui_text(prop, "Relative", "Return relative position to 
first track's marker");
+       RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
        RNA_def_struct_sdna_from(srna, "NodeTrackPosData", "storage");
 
        prop = RNA_def_property(srna, "tracking_object", PROP_STRING, 
PROP_NONE);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to