- menu for selecting add scenes for the sequencer.

- update internal 'btempdir' from userprefs on changing and initializing the temp dir.
- add sequence strip operators nolonger require the sequence view to be active (better for automation).
(commit 27434 by Campbell from render25 branch)
This commit is contained in:
2010-03-16 17:23:20 +00:00
parent 9a986d194c
commit 63a368ceaa
5 changed files with 48 additions and 12 deletions

View File

@@ -185,7 +185,7 @@ class SEQUENCER_MT_add(bpy.types.Menu):
layout.operator_context = 'INVOKE_REGION_WIN'
layout.column()
layout.operator("sequencer.scene_strip_add", text="Scene")
layout.operator_menu_enum("sequencer.scene_strip_add", "scene", text="Scene...")
layout.operator("sequencer.movie_strip_add", text="Movie")
layout.operator("sequencer.image_strip_add", text="Image")
layout.operator("sequencer.sound_strip_add", text="Sound")

View File

@@ -191,7 +191,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
start_frame= RNA_int_get(op->ptr, "start_frame");
channel= RNA_int_get(op->ptr, "channel");
sce_seq= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "type"));
sce_seq= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene"));
if (sce_seq==NULL) {
BKE_report(op->reports, RPT_ERROR, "Scene not found");
@@ -232,6 +232,11 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
static int sequencer_add_scene_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
if(ED_operator_sequencer_active(C)) {
BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
return OPERATOR_CANCELLED;
}
sequencer_generic_invoke_xy__internal(C, op, event, 0);
return sequencer_add_scene_strip_exec(C, op);
// needs a menu
@@ -252,14 +257,15 @@ void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot)
ot->invoke= sequencer_add_scene_strip_invoke;
ot->exec= sequencer_add_scene_strip_exec;
ot->poll= ED_operator_sequencer_active;
ot->poll= ED_operator_scene_editable;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, 0, "Type", "");
prop= RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", "");
RNA_def_enum_funcs(prop, RNA_scene_itemf);
ot->prop= prop;
}
static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoadFunc seq_load_func)
@@ -318,7 +324,12 @@ static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op)
static int sequencer_add_movie_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
{
if(ED_operator_sequencer_active(C)) {
BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
return OPERATOR_CANCELLED;
}
sequencer_generic_invoke_xy__internal(C, op, event, 0);
return WM_operator_filesel(C, op, event);
//return sequencer_add_movie_strip_exec(C, op);
@@ -337,7 +348,7 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot)
ot->invoke= sequencer_add_movie_strip_invoke;
ot->exec= sequencer_add_movie_strip_exec;
ot->poll= ED_operator_sequencer_active;
ot->poll= ED_operator_scene_editable;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -355,7 +366,12 @@ static int sequencer_add_sound_strip_exec(bContext *C, wmOperator *op)
}
static int sequencer_add_sound_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
{
if(ED_operator_sequencer_active(C)) {
BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
return OPERATOR_CANCELLED;
}
sequencer_generic_invoke_xy__internal(C, op, event, 0);
return WM_operator_filesel(C, op, event);
//return sequencer_add_sound_strip_exec(C, op);
@@ -374,7 +390,7 @@ void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot)
ot->invoke= sequencer_add_sound_strip_invoke;
ot->exec= sequencer_add_sound_strip_exec;
ot->poll= ED_operator_sequencer_active;
ot->poll= ED_operator_scene_editable;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -442,6 +458,11 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
static int sequencer_add_image_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
if(ED_operator_sequencer_active(C)) {
BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
return OPERATOR_CANCELLED;
}
sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME);
return WM_operator_filesel(C, op, event);
//return sequencer_add_image_strip_exec(C, op);
@@ -460,7 +481,7 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot)
ot->invoke= sequencer_add_image_strip_invoke;
ot->exec= sequencer_add_image_strip_exec;
ot->poll= ED_operator_sequencer_active;
ot->poll= ED_operator_scene_editable;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
@@ -581,6 +602,11 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
/* add color */
static int sequencer_add_effect_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
if(ED_operator_sequencer_active(C)) {
BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
return OPERATOR_CANCELLED;
}
sequencer_generic_invoke_xy__internal(C, op, event, SEQPROP_ENDFRAME);
if (RNA_property_is_set(op->ptr, "type") && RNA_enum_get(op->ptr, "type")==SEQ_PLUGIN) {
@@ -603,7 +629,7 @@ void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot)
ot->invoke= sequencer_add_effect_strip_invoke;
ot->exec= sequencer_add_effect_strip_exec;
ot->poll= ED_operator_sequencer_active;
ot->poll= ED_operator_scene_editable;
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;

View File

@@ -228,7 +228,12 @@ static void rna_userdef_addon_remove(bAddon *bext)
BLI_freelinkN(&U.addons, bext);
}
static void rna_userdef_temp_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
extern char btempdir[];
UserDef *userdef = (UserDef*)ptr->data;
strncpy(btempdir, userdef->tempdir, FILE_MAXDIR+FILE_MAXFILE);
}
#else
@@ -2709,6 +2714,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
prop= RNA_def_property(srna, "temporary_directory", PROP_STRING, PROP_DIRPATH);
RNA_def_property_string_sdna(prop, NULL, "tempdir");
RNA_def_property_ui_text(prop, "Temporary Directory", "The directory for storing temporary save files");
RNA_def_property_update(prop, 0, "rna_userdef_temp_update");
prop= RNA_def_property(srna, "image_editor", PROP_STRING, PROP_DIRPATH);
RNA_def_property_string_sdna(prop, NULL, "image_editor");

View File

@@ -238,6 +238,8 @@ static void wm_window_match_do(bContext *C, ListBase *oldwmlist)
/* in case UserDef was read, we re-initialize all, and do versioning */
static void wm_init_userdef(bContext *C)
{
extern char btempdir[];
UI_init_userdef();
MEM_CacheLimiter_set_maximum(U.memcachelimit * 1024 * 1024);
sound_init(CTX_data_main(C));
@@ -245,6 +247,8 @@ static void wm_init_userdef(bContext *C)
/* set the python auto-execute setting from user prefs */
if (U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) G.f &= ~G_SCRIPT_AUTOEXEC;
else G.f |= G_SCRIPT_AUTOEXEC;
if(U.tempdir[0]) strncpy(btempdir, U.tempdir, FILE_MAXDIR+FILE_MAXFILE);
}
void WM_read_file(bContext *C, char *name, ReportList *reports)

View File

@@ -1000,7 +1000,7 @@ int main(int argc, char **argv)
WM_init(C, argc, argv);
// XXX BRECHT SOLVE
/* this is properly initialized with user defs, but this is default */
BLI_where_is_temp( btempdir, 1 ); /* call after loading the .B.blend so we can read U.tempdir */
#ifndef DISABLE_SDL