Movie Clip Editor: proxy sizes for original and undistortted footages are now controlling separately

This commit is contained in:
Sergey Sharybin 2012-02-01 18:08:37 +00:00
parent d882f05b82
commit f193291b32
4 changed files with 71 additions and 34 deletions

@ -720,17 +720,21 @@ class CLIP_PT_proxy(Panel):
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 @@ class CLIP_PT_proxy(Panel):
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()

@ -834,6 +834,27 @@ static void proxy_freejob(void *pjv)
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 @@ static void proxy_startjob(void *pjv, short *stop, short *do_update, float *prog
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 @@ static void proxy_startjob(void *pjv, short *stop, short *do_update, float *prog
}
}
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;

@ -57,8 +57,6 @@ typedef struct MovieClipProxy {
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 @@ typedef struct MovieClipScopes {
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

@ -87,24 +87,36 @@ static void rna_def_movieclip_proxy(BlenderRNA *brna)
/* 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);