[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43825] trunk/blender: Movie Clip Editor: proxy sizes for original and undistortted footages are now controlling separately

Sergey Sharybin sergey.vfx at gmail.com
Wed Feb 1 19:08:51 CET 2012


Revision: 43825
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43825
Author:   nazgul
Date:     2012-02-01 18:08:37 +0000 (Wed, 01 Feb 2012)
Log Message:
-----------
Movie Clip Editor: proxy sizes for original and undistortted footages are now controlling separately

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/space_clip.py
    trunk/blender/source/blender/editors/space_clip/clip_ops.c
    trunk/blender/source/blender/makesdna/DNA_movieclip_types.h
    trunk/blender/source/blender/makesrna/intern/rna_movieclip.c

Modified: trunk/blender/release/scripts/startup/bl_ui/space_clip.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_clip.py	2012-02-01 17:47:13 UTC (rev 43824)
+++ trunk/blender/release/scripts/startup/bl_ui/space_clip.py	2012-02-01 18:08:37 UTC (rev 43825)
@@ -720,17 +720,21 @@
 
         layout.active = clip.use_proxy
 
-        layout.label(text="Build Sizes:")
+        layout.label(text="Build Original:")
 
-        row = layout.row()
-        row.prop(clip.proxy, "build_25")
-        row.prop(clip.proxy, "build_50")
+        row = layout.row(align=True)
+        row.prop(clip.proxy, "build_25", toggle=True)
+        row.prop(clip.proxy, "build_50", toggle=True)
+        row.prop(clip.proxy, "build_75", toggle=True)
+        row.prop(clip.proxy, "build_100", toggle=True)
 
-        row = layout.row()
-        row.prop(clip.proxy, "build_75")
-        row.prop(clip.proxy, "build_100")
+        layout.label(text="Build Undistorted:")
 
-        layout.prop(clip.proxy, "build_undistorted")
+        row = layout.row(align=True)
+        row.prop(clip.proxy, "build_undistorted_25", toggle=True)
+        row.prop(clip.proxy, "build_undistorted_50", toggle=True)
+        row.prop(clip.proxy, "build_undistorted_75", toggle=True)
+        row.prop(clip.proxy, "build_undistorted_100", toggle=True)
 
         layout.prop(clip.proxy, "quality")
 
@@ -738,7 +742,7 @@
         if clip.use_proxy_custom_directory:
             layout.prop(clip.proxy, "directory")
 
-        layout.operator("clip.rebuild_proxy", text="Rebuild Proxy")
+        layout.operator("clip.rebuild_proxy", text="Build Proxy")
 
         if clip.source == 'MOVIE':
             col = layout.column()

Modified: trunk/blender/source/blender/editors/space_clip/clip_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_clip/clip_ops.c	2012-02-01 17:47:13 UTC (rev 43824)
+++ trunk/blender/source/blender/editors/space_clip/clip_ops.c	2012-02-01 18:08:37 UTC (rev 43825)
@@ -834,6 +834,27 @@
 	MEM_freeN(pj);
 }
 
+static int proxy_bitflag_to_array(int size_flag, int build_sizes[4], int undistort)
+{
+	int build_count = 0;
+	int size_flags[2][4] = {{MCLIP_PROXY_SIZE_25,
+	                         MCLIP_PROXY_SIZE_50,
+                             MCLIP_PROXY_SIZE_75,
+                             MCLIP_PROXY_SIZE_100},
+                            {MCLIP_PROXY_UNDISTORTED_SIZE_25,
+                             MCLIP_PROXY_UNDISTORTED_SIZE_50,
+                             MCLIP_PROXY_UNDISTORTED_SIZE_75,
+                             MCLIP_PROXY_UNDISTORTED_SIZE_100}};
+	int size_nr = undistort ? 1 : 0;
+
+	if(size_flag & size_flags[size_nr][0]) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_25;
+	if(size_flag & size_flags[size_nr][1]) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_50;
+	if(size_flag & size_flags[size_nr][2]) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_75;
+	if(size_flag & size_flags[size_nr][3]) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_100;
+
+	return build_count;
+}
+
 /* only this runs inside thread */
 static void proxy_startjob(void *pjv, short *stop, short *do_update, float *progress)
 {
@@ -841,22 +862,23 @@
 	Scene *scene=pj->scene;
 	MovieClip *clip= pj->clip;
 	struct MovieDistortion *distortion= NULL;
-	int cfra, undistort;
-	short tc_flag, size_flag, quality, build_flag;
-	int sfra= SFRA, efra= EFRA;
+	short tc_flag, size_flag, quality;
+	int cfra, sfra= SFRA, efra= EFRA;
 	int build_sizes[4], build_count= 0;
+	int build_undistort_sizes[4], build_undistort_count= 0;
 
 	tc_flag= clip->proxy.build_tc_flag;
 	size_flag= clip->proxy.build_size_flag;
 	quality= clip->proxy.quality;
-	build_flag= clip->proxy.build_flag;
-	undistort= build_flag&MCLIP_PROXY_RENDER_UNDISTORT;
 
+	build_count= proxy_bitflag_to_array(size_flag, build_sizes, 0);
+	build_undistort_count= proxy_bitflag_to_array(size_flag, build_undistort_sizes, 1);
+
 	if(clip->source == MCLIP_SRC_MOVIE) {
 		if(clip->anim)
 			IMB_anim_index_rebuild(clip->anim, tc_flag, size_flag, quality, stop, do_update, progress);
 
-		if(!undistort) {
+		if(!build_undistort_count) {
 			return;
 		}
 		else {
@@ -865,20 +887,14 @@
 		}
 	}
 
-	if(size_flag&IMB_PROXY_25) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_25;
-	if(size_flag&IMB_PROXY_50) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_50;
-	if(size_flag&IMB_PROXY_75) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_75;
-	if(size_flag&IMB_PROXY_100) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_100;
-
-	if(undistort)
+	if(build_undistort_count)
 		distortion= BKE_tracking_distortion_create();
 
 	for(cfra= sfra; cfra<=efra; cfra++) {
 		if(clip->source != MCLIP_SRC_MOVIE)
 			BKE_movieclip_build_proxy_frame(clip, pj->clip_flag, NULL, cfra, build_sizes, build_count, 0);
 
-		if(undistort)
-			BKE_movieclip_build_proxy_frame(clip, pj->clip_flag, distortion, cfra, build_sizes, build_count, 1);
+		BKE_movieclip_build_proxy_frame(clip, pj->clip_flag, distortion, cfra, build_undistort_sizes, build_undistort_count, 1);
 
 		if(*stop || G.afbreek)
 			break;

Modified: trunk/blender/source/blender/makesdna/DNA_movieclip_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_movieclip_types.h	2012-02-01 17:47:13 UTC (rev 43824)
+++ trunk/blender/source/blender/makesdna/DNA_movieclip_types.h	2012-02-01 18:08:37 UTC (rev 43825)
@@ -57,8 +57,6 @@
 	short quality;			/* proxy build quality */
 	short build_size_flag;	/* size flags (see below) of all proxies to build */
 	short build_tc_flag;	/* time code flags (see below) of all tc indices to build */
-	short build_flag, pad;	/* other build flags */
-	char pad2[4];
 } MovieClipProxy;
 
 typedef struct MovieClip {
@@ -98,8 +96,15 @@
 	float slide_scale[2];			/* scale used for sliding from previewe area */
 } MovieClipScopes;
 
-/* MovieClipProxy->build_flag */
-#define MCLIP_PROXY_BUILD_UNDISTORT	1	/* build undistorted proxies as well */
+/* MovieClipProxy->build_size_flag */
+#define MCLIP_PROXY_SIZE_25		(1<<0)
+#define MCLIP_PROXY_SIZE_50		(1<<1)
+#define MCLIP_PROXY_SIZE_75		(1<<2)
+#define MCLIP_PROXY_SIZE_100	(1<<3)
+#define MCLIP_PROXY_UNDISTORTED_SIZE_25		(1<<4)
+#define MCLIP_PROXY_UNDISTORTED_SIZE_50		(1<<5)
+#define MCLIP_PROXY_UNDISTORTED_SIZE_75		(1<<6)
+#define MCLIP_PROXY_UNDISTORTED_SIZE_100	(1<<7)
 
 /* MovieClip->source */
 #define MCLIP_SRC_SEQUENCE	1

Modified: trunk/blender/source/blender/makesrna/intern/rna_movieclip.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_movieclip.c	2012-02-01 17:47:13 UTC (rev 43824)
+++ trunk/blender/source/blender/makesrna/intern/rna_movieclip.c	2012-02-01 18:08:37 UTC (rev 43825)
@@ -87,25 +87,37 @@
 
 	/* build proxy sized */
 	prop= RNA_def_property(srna, "build_25", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", IMB_PROXY_25);
+	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_25);
 	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", IMB_PROXY_50);
+	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_50);
 	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", IMB_PROXY_75);
+	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_75);
 	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", IMB_PROXY_100);
+	RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_100);
 	RNA_def_property_ui_text(prop, "100%", "Build proxy resolution 100% of the original footage dimension");
 
-	prop= RNA_def_property(srna, "build_undistorted", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "build_flag", MCLIP_PROXY_BUILD_UNDISTORT);
-	RNA_def_property_ui_text(prop, "Build Undistorted", "Also build undistorted proxies for selected sizes");
+	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_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_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_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_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);




More information about the Bf-blender-cvs mailing list