[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57413] trunk/blender/source/blender: Remove magic constants from Track Position node RNA code.

Sergey Sharybin sergey.vfx at gmail.com
Wed Jun 12 14:55:44 CEST 2013


Revision: 57413
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57413
Author:   nazgul
Date:     2013-06-12 12:55:44 +0000 (Wed, 12 Jun 2013)
Log Message:
-----------
Remove magic constants from Track Position node RNA code.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_node.h
    trunk/blender/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
    trunk/blender/source/blender/compositor/operations/COM_TrackPositionOperation.h
    trunk/blender/source/blender/makesrna/intern/rna_nodetree.c

Modified: trunk/blender/source/blender/blenkernel/BKE_node.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_node.h	2013-06-12 12:34:10 UTC (rev 57412)
+++ trunk/blender/source/blender/blenkernel/BKE_node.h	2013-06-12 12:55:44 UTC (rev 57413)
@@ -917,6 +917,10 @@
 #define CMP_SCALE_RENDERSIZE_FRAME_ASPECT  (1 << 0)
 #define CMP_SCALE_RENDERSIZE_FRAME_CROP    (1 << 1)
 
+/* track position node, in custom1 */
+#define CMP_TRACKPOS_ABSOLUTE			0
+#define CMP_TRACKPOS_RELATIVE_START	1
+#define CMP_TRACKPOS_RELATIVE_FRAME	2
 
 /* API */
 struct CompBuf;

Modified: trunk/blender/source/blender/compositor/operations/COM_TrackPositionOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_TrackPositionOperation.cpp	2013-06-12 12:34:10 UTC (rev 57412)
+++ trunk/blender/source/blender/compositor/operations/COM_TrackPositionOperation.cpp	2013-06-12 12:55:44 UTC (rev 57413)
@@ -31,6 +31,7 @@
 
 extern "C" {
 	#include "BKE_movieclip.h"
+	#include "BKE_node.h"
 	#include "BKE_tracking.h"
 }
 
@@ -42,7 +43,7 @@
 	this->m_trackingObjectName[0] = 0;
 	this->m_trackName[0] = 0;
 	this->m_axis = 0;
-	this->m_position = POSITION_ABSOLUTE;
+	this->m_position = CMP_TRACKPOS_ABSOLUTE;
 	this->m_relativeFrame = 0;
 }
 
@@ -77,7 +78,7 @@
 
 			copy_v2_v2(this->m_markerPos, marker->pos);
 
-			if (this->m_position == POSITION_RELATIVE_START) {
+			if (this->m_position == CMP_TRACKPOS_RELATIVE_START) {
 				int i;
 
 				for (i = 0; i < track->markersnr; i++) {
@@ -90,7 +91,7 @@
 					}
 				}
 			}
-			else if (this->m_position == POSITION_RELATIVE_FRAME) {
+			else if (this->m_position == CMP_TRACKPOS_RELATIVE_FRAME) {
 				int relative_clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(this->m_movieClip,
 				                                                                    this->m_relativeFrame);
 

Modified: trunk/blender/source/blender/compositor/operations/COM_TrackPositionOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_TrackPositionOperation.h	2013-06-12 12:34:10 UTC (rev 57412)
+++ trunk/blender/source/blender/compositor/operations/COM_TrackPositionOperation.h	2013-06-12 12:55:44 UTC (rev 57413)
@@ -39,12 +39,6 @@
  */
 class TrackPositionOperation : public NodeOperation {
 protected:
-	enum {
-		POSITION_ABSOLUTE = 0,
-		POSITION_RELATIVE_START,
-		POSITION_RELATIVE_FRAME
-	};
-
 	MovieClip *m_movieClip;
 	int m_framenumber;
 	char m_trackingObjectName[64];

Modified: trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2013-06-12 12:34:10 UTC (rev 57412)
+++ trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2013-06-12 12:55:44 UTC (rev 57413)
@@ -5714,9 +5714,12 @@
 	PropertyRNA *prop;
 
 	static EnumPropertyItem position_items[] = {
-		{0, "ABSOLUTE", 0, "Absolute",  "Output absolute position of a marker"},
-		{1, "RELATIVE_START", 0, "Relative Start",  "Output position of a marker relative to first marker of a track"},
-		{2, "RELATIVE_FRAME", 0, "Relative Frame",  "Output position of a marker relative to marker at given frame number"},
+		{CMP_TRACKPOS_ABSOLUTE, "ABSOLUTE", 0,
+		 "Absolute",  "Output absolute position of a marker"},
+		{CMP_TRACKPOS_RELATIVE_START, "RELATIVE_START", 0,
+		 "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"},
 		{0, NULL, 0, NULL, NULL}
 	};
 




More information about the Bf-blender-cvs mailing list