Patch #20693: add parameters for FPS and wait timer for screen cast

This patch by Guillaume Lecocq (lguillaume) adds user preference settings for setting the playback frame-rate and delay between captured frames for the screencasting feature. 

-- 

I've made a few tweaks for a few minor issues
- Made DNA vars for these settings shorts instead of ints, reducing the number of unnecessary extra pad vars 
- Added version patching to ensure that these settings are initialised by default
- Made tooltips for the settings more descriptive
This commit is contained in:
Joshua Leung 2010-01-21 10:28:19 +00:00
parent da3abc78a2
commit 9d54d6ba4e
5 changed files with 29 additions and 3 deletions

@ -416,6 +416,13 @@ class USERPREF_PT_system(bpy.types.Panel):
col.separator()
col.separator()
col.separator()
col.label(text="Screencast:")
col.prop(system, "screencast_fps")
col.prop(system, "screencast_wait_time")
col.separator()
col.separator()
col.separator()
#column = split.column()
#colsplit = column.split(percentage=0.85)

@ -1373,6 +1373,10 @@ void init_userdef_do_versions(void)
if (U.anim_player_preset == 0) {
U.anim_player_preset =1 ;
}
if (U.scrcastfps == 0) {
U.scrcastfps = 10;
U.scrcastwait = 50;
}
/* funny name, but it is GE stuff, moves userdef stuff to engine */
// XXX space_set_commmandline_options();

@ -38,6 +38,7 @@
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_userdef_types.h"
#include "BKE_context.h"
#include "BKE_global.h"
@ -226,7 +227,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update)
int cfra= 1;
/* we need this as local variables for renderdata */
rd.frs_sec= 10;
rd.frs_sec= U.scrcastfps;
rd.frs_sec_base= 1.0f;
if(BKE_imtype_is_movie(rd.imtype)) {
@ -279,9 +280,10 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update)
*do_update= 1;
cfra++;
}
else
PIL_sleep_ms(50);
PIL_sleep_ms(U.scrcastwait);
}
if(mh)

@ -341,7 +341,10 @@ typedef struct UserDef {
short ndof_pan, ndof_rotate;
short curssize, ipo_new;
short color_picker_type;
short pad2[3];
short pad2;
short scrcastfps; /* frame rate for screencast to be played back */
short scrcastwait; /* milliseconds between screencast snapshots */
char versemaster[160];
char verseuser[160];

@ -2322,6 +2322,16 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Audio Channels", "Sets the audio channel count.");
RNA_def_property_update(prop, 0, "rna_UserDef_audio_update");
prop= RNA_def_property(srna, "screencast_fps", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "scrcastfps");
RNA_def_property_range(prop, 10, 50);
RNA_def_property_ui_text(prop, "FPS", "Frame rate for the screencast to be played back.");
prop= RNA_def_property(srna, "screencast_wait_time", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "scrcastwait");
RNA_def_property_range(prop, 50, 1000);
RNA_def_property_ui_text(prop, "Wait Timer (ms)", "Time in milliseconds between each frame recorded for screencast.");
#if 0
prop= RNA_def_property(srna, "verse_master", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "versemaster");