[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25328] trunk/blender/source/blender/ editors/space_sequencer: Sequencer unique names for duplicates & metas and name new strips when the operator doesnt set them .
Campbell Barton
ideasman42 at gmail.com
Sun Dec 13 04:21:19 CET 2009
Revision: 25328
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25328
Author: campbellbarton
Date: 2009-12-13 04:20:29 +0100 (Sun, 13 Dec 2009)
Log Message:
-----------
Sequencer unique names for duplicates & metas and name new strips when the operator doesnt set them.
Modified Paths:
--------------
trunk/blender/source/blender/editors/space_sequencer/sequencer_add.c
trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c
Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_add.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_add.c 2009-12-12 08:45:16 UTC (rev 25327)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_add.c 2009-12-13 03:20:29 UTC (rev 25328)
@@ -73,6 +73,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
+#include "RNA_enum_types.h"
/* for menu/popup icons etc etc*/
#include "UI_interface.h"
@@ -150,7 +151,7 @@
seq_load->channel= RNA_int_get(op->ptr, "channel");
seq_load->len= 1; // images only!
- RNA_string_get(op->ptr, "name", seq_load->name);
+ RNA_string_get(op->ptr, "name", seq_load->name+2);
RNA_string_get(op->ptr, "path", seq_load->path); /* full path, file is set by the caller */
@@ -174,8 +175,7 @@
Editing *ed= seq_give_editing(scene, TRUE);
Scene *sce_seq;
- char sce_name[MAX_ID_NAME-2];
-
+
Sequence *seq; /* generic strip vars */
Strip *strip;
StripElem *se;
@@ -185,12 +185,10 @@
start_frame= RNA_int_get(op->ptr, "start_frame");
channel= RNA_int_get(op->ptr, "channel");
- RNA_string_get(op->ptr, "scene", sce_name);
-
- sce_seq= (Scene *)find_id("SC", sce_name);
+ sce_seq= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "type"));
if (sce_seq==NULL) {
- BKE_reportf(op->reports, RPT_ERROR, "Scene \"%s\" not found", sce_name);
+ BKE_report(op->reports, RPT_ERROR, "Scene not found");
return OPERATOR_CANCELLED;
}
@@ -206,9 +204,11 @@
strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
+ if(RNA_property_is_set(op->ptr, "name"))
+ RNA_string_get(op->ptr, "name", seq->name+2);
+ else
+ strcpy(seq->name+2, sce_seq->id.name+2);
- RNA_string_get(op->ptr, "name", seq->name);
-
calc_sequence_disp(seq);
sort_seq(scene);
@@ -227,16 +227,15 @@
static int sequencer_add_scene_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
sequencer_generic_invoke_xy__internal(C, op, event, 0);
-
- /* scene can be left default */
- RNA_string_set(op->ptr, "scene", "Scene"); // XXX should popup a menu but ton says 2.5 will have some better feature for this
-
return sequencer_add_scene_strip_exec(C, op);
+ // needs a menu
+ // return WM_menu_invoke(C, op, event);
}
void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot)
{
+ PropertyRNA *prop;
/* identifiers */
ot->name= "Add Scene Strip";
@@ -253,7 +252,8 @@
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
- RNA_def_string(ot->srna, "scene", "", MAX_ID_NAME-2, "Scene Name", "Scene name to add as a strip");
+ prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, 0, "Type", "");
+ RNA_def_enum_funcs(prop, RNA_scene_itemf);
}
static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoadFunc seq_load_func)
@@ -499,6 +499,11 @@
seq = alloc_sequence(ed->seqbasep, start_frame, channel);
seq->type= type;
+ if(RNA_property_is_set(op->ptr, "name"))
+ RNA_string_get(op->ptr, "name", seq->name+2);
+ else
+ strcpy(seq->name+2, give_seqname(seq));
+
seqUniqueName(ed->seqbasep, seq);
sh = get_sequence_effect(seq);
Modified: trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c 2009-12-12 08:45:16 UTC (rev 25327)
+++ trunk/blender/source/blender/editors/space_sequencer/sequencer_edit.c 2009-12-13 03:20:29 UTC (rev 25328)
@@ -925,7 +925,9 @@
"handled in duplicate!\nExpect a crash"
" now...\n");
}
-
+
+ seqUniqueName(scene->ed->seqbasep, seqn);
+
return seqn;
}
@@ -1963,6 +1965,8 @@
shuffle_seq(ed->seqbasep, seq_new);
}
+ seqUniqueName(scene->ed->seqbasep, seq_new);
+
cfra++;
start_ofs += step;
}
@@ -2085,7 +2089,7 @@
Sequence *seq, *seqm, *next;
- int tot;
+ int tot, channel_max= 1;
if(ed==NULL)
return OPERATOR_CANCELLED;
@@ -2106,6 +2110,7 @@
seq= ed->seqbasep->first;
while(seq) {
if(seq->flag & SELECT) {
+ channel_max= MAX2(seq->machine, channel_max);
if(seq->type & SEQ_EFFECT) {
if(seq->seq1 &&
(seq->seq1->flag & SELECT)==0) tot= 0;
@@ -2134,7 +2139,8 @@
/* remove all selected from main list, and put in meta */
- seqm= alloc_sequence(ed->seqbasep, 1, 1);
+ seqm= alloc_sequence(ed->seqbasep, 1, channel_max);
+ strcpy(seqm->name+2, "MetaStrip");
seqm->type= SEQ_META;
seqm->flag= SELECT;
@@ -2158,6 +2164,9 @@
if( seq_test_overlap(ed->seqbasep, seqm) ) shuffle_seq(ed->seqbasep, seqm);
seq_update_muting(ed);
+
+ seqUniqueName(scene->ed->seqbasep, seqm);
+
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, scene);
return OPERATOR_FINISHED;
More information about the Bf-blender-cvs
mailing list