[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44130] branches/soc-2011-tomato/source/ blender: Camera tracking: animation datablock for MovieClip

Sergey Sharybin sergey.vfx at gmail.com
Wed Feb 15 17:06:48 CET 2012


Revision: 44130
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44130
Author:   nazgul
Date:     2012-02-15 16:06:48 +0000 (Wed, 15 Feb 2012)
Log Message:
-----------
Camera tracking: animation datablock for MovieClip

Added AnimData block to MovieClip datablock which allows to animate different
properties in clip. Currently supports animation of stabilization influence only.

Modified Paths:
--------------
    branches/soc-2011-tomato/source/blender/blenkernel/intern/anim_sys.c
    branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c
    branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c
    branches/soc-2011-tomato/source/blender/blenloader/intern/writefile.c
    branches/soc-2011-tomato/source/blender/makesdna/DNA_movieclip_types.h
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_movieclip.c
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_tracking.c

Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/anim_sys.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/anim_sys.c	2012-02-15 16:04:57 UTC (rev 44129)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/anim_sys.c	2012-02-15 16:06:48 UTC (rev 44130)
@@ -88,6 +88,7 @@
 		case ID_LA: case ID_CA: case ID_WO:
 		case ID_SPK:
 		case ID_SCE:
+		case ID_MC:
 		{
 			return 1;
 		}
@@ -2335,6 +2336,9 @@
 	/* speakers */
 	EVAL_ANIM_IDS(main->speaker.first, ADT_RECALC_ANIM);
 
+	/* movie clips */
+	EVAL_ANIM_IDS(main->movieclip.first, ADT_RECALC_ANIM);
+
 	/* objects */
 		/* ADT_RECALC_ANIM doesn't need to be supplied here, since object AnimData gets 
 		 * this tagged by Depsgraph on framechange. This optimisation means that objects

Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c	2012-02-15 16:04:57 UTC (rev 44129)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/movieclip.c	2012-02-15 16:06:48 UTC (rev 44130)
@@ -64,6 +64,7 @@
 #include "BLI_mempool.h"
 #include "BLI_threads.h"
 
+#include "BKE_animsys.h"
 #include "BKE_constraint.h"
 #include "BKE_library.h"
 #include "BKE_global.h"
@@ -889,6 +890,8 @@
 		IMB_free_anim(clip->anim);
 		clip->anim= FALSE;
 	}
+
+	BKE_free_animdata((ID *) clip);
 }
 
 void BKE_movieclip_reload(MovieClip *clip)

Modified: branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c	2012-02-15 16:04:57 UTC (rev 44129)
+++ branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c	2012-02-15 16:06:48 UTC (rev 44130)
@@ -6051,6 +6051,8 @@
 	MovieTracking *tracking= &clip->tracking;
 	MovieTrackingObject *object;
 
+	clip->adt= newdataadr(fd, clip->adt);
+
 	if(fd->movieclipmap) clip->cache= newmclipadr(fd, clip->cache);
 	else clip->cache= NULL;
 
@@ -6088,6 +6090,9 @@
 	clip= main->movieclip.first;
 	while(clip) {
 		if(clip->id.flag & LIB_NEEDLINK) {
+			if (clip->adt)
+				lib_link_animdata(fd, &clip->id, clip->adt);
+
 			clip->gpd= newlibadr_us(fd, clip->id.lib, clip->gpd);
 
 			clip->id.flag -= LIB_NEEDLINK;

Modified: branches/soc-2011-tomato/source/blender/blenloader/intern/writefile.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenloader/intern/writefile.c	2012-02-15 16:04:57 UTC (rev 44129)
+++ branches/soc-2011-tomato/source/blender/blenloader/intern/writefile.c	2012-02-15 16:06:48 UTC (rev 44130)
@@ -2564,6 +2564,9 @@
 			MovieTrackingObject *object;
 			writestruct(wd, ID_MC, "MovieClip", 1, clip);
 
+			if(clip->adt)
+				write_animdata(wd, clip->adt);
+
 			write_movieTracks(wd, &tracking->tracks);
 			write_movieReconstruction(wd, &tracking->reconstruction);
 

Modified: branches/soc-2011-tomato/source/blender/makesdna/DNA_movieclip_types.h
===================================================================
--- branches/soc-2011-tomato/source/blender/makesdna/DNA_movieclip_types.h	2012-02-15 16:04:57 UTC (rev 44129)
+++ branches/soc-2011-tomato/source/blender/makesdna/DNA_movieclip_types.h	2012-02-15 16:06:48 UTC (rev 44130)
@@ -39,6 +39,7 @@
 #include "DNA_tracking_types.h"
 
 struct anim;
+struct AnimData;
 struct bGPdata;
 struct ImBuf;
 struct MovieClipProxy;
@@ -61,6 +62,7 @@
 
 typedef struct MovieClip {
 	ID id;
+	struct AnimData *adt;	/* animation data (must be immediately after id for utilities to use it) */
 
 	char name[1024];		/* file path, 1024 = FILE_MAX */
 

Modified: branches/soc-2011-tomato/source/blender/makesrna/intern/rna_movieclip.c
===================================================================
--- branches/soc-2011-tomato/source/blender/makesrna/intern/rna_movieclip.c	2012-02-15 16:04:57 UTC (rev 44129)
+++ branches/soc-2011-tomato/source/blender/makesrna/intern/rna_movieclip.c	2012-02-15 16:06:48 UTC (rev 44130)
@@ -88,57 +88,70 @@
 	/* build proxy sized */
 	prop= RNA_def_property(srna, "build_25", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_25);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "25%", "Build proxy resolution 25% of the original footage dimension");
 
 	prop= RNA_def_property(srna, "build_50", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_50);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "50%", "Build proxy resolution 50% of the original footage dimension");
 
 	prop= RNA_def_property(srna, "build_75", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_75);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "75%", "Build proxy resolution 75% of the original footage dimension");
 
 	prop= RNA_def_property(srna, "build_100", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_100);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "100%", "Build proxy resolution 100% of the original footage dimension");
 
 	prop= RNA_def_property(srna, "build_undistorted_25", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_25);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "25%", "Build proxy resolution 25% of the original undistorted footage dimension");
 
 	prop= RNA_def_property(srna, "build_undistorted_50", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_50);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "50%", "Build proxy resolution 50% of the original undistorted footage dimension");
 
 	prop= RNA_def_property(srna, "build_undistorted_75", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_75);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "75%", "Build proxy resolution 75% of the original undistorted footage dimension");
 
 	prop= RNA_def_property(srna, "build_undistorted_100", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_100);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "100%", "Build proxy resolution 100% of the original undistorted footage dimension");
 
 	/* build timecodes */
 	prop= RNA_def_property(srna, "build_record_run", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_RECORD_RUN);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Rec Run", "Build record run time code index");
 
 	prop= RNA_def_property(srna, "build_free_run", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_FREE_RUN);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Free Run", "Build free run time code index");
 
 	prop= RNA_def_property(srna, "build_free_run_rec_date", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Free Run (Rec Date)", "Build free run time code index using Record Date/Time");
 
 	/* quality of proxied image */
 	prop= RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED);
 	RNA_def_property_int_sdna(prop, NULL, "quality");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Quality", "JPEG quality of proxy images");
 	RNA_def_property_ui_range(prop, 1, 100, 1, 0);
 
 	prop= RNA_def_property(srna, "timecode", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "tc");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_enum_items(prop, clip_tc_items);
 	RNA_def_property_ui_text(prop, "Timecode", "");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
@@ -146,6 +159,7 @@
 	/* directory */
 	prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
 	RNA_def_property_string_sdna(prop, NULL, "dir");
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Directory", "Location to store the proxy files");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_MovieClip_reload_update");
 }
@@ -223,6 +237,7 @@
 	/* use proxy */
 	prop= RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MCLIP_USE_PROXY);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Use Proxy / Timecode", "Use a preview proxy and/or timecode index for this clip");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
 
@@ -247,6 +262,7 @@
 	/* custom proxy directory */
 	prop= RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", MCLIP_USE_PROXY_CUSTOM_DIR);
+	RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 	RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Create proxy images in a custom directory (default is movie location)");
 	RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, "rna_MovieClip_reload_update");
 

Modified: branches/soc-2011-tomato/source/blender/makesrna/intern/rna_tracking.c
===================================================================
--- branches/soc-2011-tomato/source/blender/makesrna/intern/rna_tracking.c	2012-02-15 16:04:57 UTC (rev 44129)
+++ branches/soc-2011-tomato/source/blender/makesrna/intern/rna_tracking.c	2012-02-15 16:06:48 UTC (rev 44130)
@@ -54,6 +54,11 @@
 
 #include "WM_api.h"
 
+static char *rna_tracking_path(PointerRNA *UNUSED(ptr))
+{
+	return BLI_sprintfN("tracking");
+}
+
 static void rna_tracking_defaultSettings_levelsUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
 {

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list