[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43243] trunk/blender/source/blender/ makesrna/intern/rna_tracking.c: Camera tracking: marker' s frame number is now writable from python api

Sergey Sharybin sergey.vfx at gmail.com
Mon Jan 9 21:18:37 CET 2012


Revision: 43243
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43243
Author:   nazgul
Date:     2012-01-09 20:18:36 +0000 (Mon, 09 Jan 2012)
Log Message:
-----------
Camera tracking: marker's frame number is now writable from python api

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_tracking.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_tracking.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_tracking.c	2012-01-09 20:18:28 UTC (rev 43242)
+++ trunk/blender/source/blender/makesrna/intern/rna_tracking.c	2012-01-09 20:18:36 UTC (rev 43243)
@@ -405,6 +405,31 @@
 	WM_main_add_notifier(NC_MOVIECLIP|NA_EDITED, NULL);
 }
 
+static void rna_trackingMarker_frame_set(PointerRNA *ptr, int value)
+{
+	MovieClip *clip = (MovieClip *) ptr->id.data;
+	MovieTracking *tracking = &clip->tracking;
+	MovieTrackingTrack *track;
+	MovieTrackingMarker *marker = (MovieTrackingMarker *) ptr->data;
+
+	track = tracking->tracks.first;
+	while (track) {
+		if (marker >= track->markers && marker < track->markers+track->markersnr) {
+			break;
+		}
+
+		track = track->next;
+	}
+
+	if (track) {
+		MovieTrackingMarker new_marker = *marker;
+		new_marker.framenr = value;
+
+		BKE_tracking_delete_marker(track, marker->framenr);
+		BKE_tracking_insert_marker(track, &new_marker);
+	}
+}
+
 static MovieTrackingMarker *rna_trackingMarkers_find_frame(MovieTrackingTrack *track, int framenr)
 {
 	return BKE_tracking_exact_marker(track, framenr);
@@ -718,10 +743,10 @@
 
 	/* frame */
 	prop= RNA_def_property(srna, "frame", PROP_INT, PROP_NONE);
-	RNA_def_property_clear_flag(prop, PROP_EDITABLE);	/* can't be safty edited for now, need to re-sort markers array after change */
 	RNA_def_property_int_sdna(prop, NULL, "framenr");
 	RNA_def_property_ui_text(prop, "Frame", "Frame number marker is keyframed on");
-	RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, NULL);
+	RNA_def_property_int_funcs(prop, NULL, "rna_trackingMarker_frame_set", NULL);
+	RNA_def_property_update(prop, NC_MOVIECLIP|NA_EDITED, 0);
 
 	/* enable */
 	prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);



More information about the Bf-blender-cvs mailing list