diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-03-16 20:23:20 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-03-16 20:23:20 +0300 |
commit | 63a368ceaa747271d417c98c607a61374e3cfb68 (patch) | |
tree | 7c768870f700c4c963de7fad314721fb6bf8b563 | |
parent | 9a986d194c85187fcbcbe84d2355763012661992 (diff) |
- 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)
-rw-r--r-- | release/scripts/ui/space_sequencer.py | 2 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_add.c | 44 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 8 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 4 | ||||
-rw-r--r-- | source/creator/creator.c | 2 |
5 files changed, 48 insertions, 12 deletions
diff --git a/release/scripts/ui/space_sequencer.py b/release/scripts/ui/space_sequencer.py index 8badf741fac..0bf86642b25 100644 --- a/release/scripts/ui/space_sequencer.py +++ b/release/scripts/ui/space_sequencer.py @@ -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") diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 7a809f7b668..241ab2e854d 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -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; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 8a1b37c2ecf..2e1352eaa8e 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -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"); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 2a8091c1aa2..d535d8f5ea1 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -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) diff --git a/source/creator/creator.c b/source/creator/creator.c index 3eb2cad1f65..a3a43a4629d 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -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 |