Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-10-19 12:01:30 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-10-19 12:01:30 +0400
commit0445ff1ae9ce619efa1eb065eecbc03e45e90d62 (patch)
treea4065c8e392daf636ac93c4298701f31ac2a8844 /source/blender/editors/transform
parent1a7ec53dc446f417592d077f3b736ad35f72ae2e (diff)
Give sequencer its own transform freeing function.
Updating the sequencer after transform could not use special_aftertrans_update because it relies on data that is freed theeth: moved the customFree function to run before freeing t->data, t->data2d in postTrans(), checked that customData is not needed.
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform_conversions.c112
-rw-r--r--source/blender/editors/transform/transform_generics.c16
2 files changed, 59 insertions, 69 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index d8770afbaae..7d5ca4d57a1 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -4012,6 +4012,53 @@ static int SeqToTransData_Recursive(TransInfo *t, ListBase *seqbase, TransData *
}
+static void freeSeqData(TransInfo *t)
+{
+ Editing *ed= seq_give_editing(t->scene, FALSE);
+ if (ed && !(t->state == TRANS_CANCEL)) {
+ ListBase *seqbasep= ed->seqbasep;
+ Sequence *seq;
+
+ int a;
+ TransData *td= t->data;
+
+ /* prevent updating the same seq twice
+ * if the transdata order is changed this will mess up
+ * but so will TransDataSeq */
+ Sequence *seq_prev= NULL;
+
+ /* flush to 2d vector from internally used 3d vector */
+ for(a=0; a<t->total; a++, td++) {
+ seq= ((TransDataSeq *)td->extra)->seq;
+ if ((seq != seq_prev) && (seq->depth==0) && (seq->flag & SEQ_OVERLAP)) {
+ shuffle_seq(seqbasep, seq);
+ }
+
+ seq_prev= seq;
+ }
+
+ for(seq= seqbasep->first; seq; seq= seq->next) {
+ /* We might want to build a list of effects that need to be updated during transform */
+ if(seq->type & SEQ_EFFECT) {
+ if (seq->seq1 && seq->seq1->flag & SELECT) calc_sequence(seq);
+ else if (seq->seq2 && seq->seq2->flag & SELECT) calc_sequence(seq);
+ else if (seq->seq3 && seq->seq3->flag & SELECT) calc_sequence(seq);
+ }
+ }
+
+ sort_seq(t->scene);
+ }
+
+ if (t->customData) {
+ MEM_freeN(t->customData);
+ t->customData= NULL;
+ }
+ if (t->data) {
+ MEM_freeN(t->data); // XXX postTrans usually does this
+ t->data= NULL;
+ }
+}
+
static void createTransSeqData(bContext *C, TransInfo *t)
{
@@ -4029,6 +4076,8 @@ static void createTransSeqData(bContext *C, TransInfo *t)
return;
}
+ t->customFree= freeSeqData;
+
/* which side of the current frame should be allowed */
if (t->mode == TFM_TIME_EXTEND) {
/* only side on which mouse is gets transformed */
@@ -4480,6 +4529,7 @@ void autokeyframe_pose_cb_func(Scene *scene, View3D *v3d, Object *ob, int tmode,
/* inserting keys, refresh ipo-keys, pointcache, redraw events... (ton) */
/* note: transdata has been freed already! */
/* note: this runs even when createTransData exits early because (t->total==0), is this correct?... (campbell) */
+/* note: sequencer freeing has its own function now because of a conflict with transform's order of freeing (campbell)*/
void special_aftertrans_update(TransInfo *t)
{
Object *ob;
@@ -4494,68 +4544,6 @@ void special_aftertrans_update(TransInfo *t)
}
}
}
-
- if (t->spacetype == SPACE_SEQ) {
- Editing *ed= seq_give_editing(t->scene, FALSE);
- if (ed && !cancelled) {
- ListBase *seqbasep= ed->seqbasep;
- Sequence *seq;
-#if 0 // TRANSFORM_FIX_ME, Would prefer to use this since the array takes into
- // account what where transforming (with extend, locked strips etc)
- // But at the moment t->data is freed in postTrans so for now re-shuffeling selected strips works ok. - Campbell
-
- int a;
- TransData *td= t->data;
-
- /* prevent updating the same seq twice
- * if the transdata order is changed this will mess up
- * but so will TransDataSeq */
- Sequence *seq_prev= NULL;
-
- /* flush to 2d vector from internally used 3d vector */
- for(a=0; a<t->total; a++, td++) {
- seq= ((TransDataSeq *)td->extra)->seq;
- if ((seq != seq_prev) && (seq->depth==0) && (seq->flag & SEQ_OVERLAP)) {
- shuffle_seq(seqbasep, seq);
- }
-
- seq_prev= seq;
- }
-#else // while t->data is not available...
- int machine, max_machine = 0;
-
- /* update in order so we always move bottom strips first */
- for(seq= seqbasep->first; seq; seq= seq->next) {
- max_machine = MAX2(max_machine, seq->machine);
- }
-
- for (machine = 0; machine <= max_machine; machine++)
- {
- for(seq= seqbasep->first; seq; seq= seq->next) {
- if (seq->machine == machine && seq->depth == 0 && (seq->flag & (SELECT|SEQ_LEFTSEL|SEQ_RIGHTSEL)) != 0 && (seq->flag & SEQ_OVERLAP)) {
- shuffle_seq(seqbasep, seq);
- }
- }
- }
-#endif
-
- for(seq= seqbasep->first; seq; seq= seq->next) {
- /* We might want to build a list of effects that need to be updated during transform */
- if(seq->type & SEQ_EFFECT) {
- if (seq->seq1 && seq->seq1->flag & SELECT) calc_sequence(seq);
- else if (seq->seq2 && seq->seq2->flag & SELECT) calc_sequence(seq);
- else if (seq->seq3 && seq->seq3->flag & SELECT) calc_sequence(seq);
- }
- }
-
- sort_seq(t->scene);
- }
-
- if (t->customData)
- MEM_freeN(t->customData);
- if (t->data)
- MEM_freeN(t->data); // XXX postTrans usually does this
- }
else if (t->spacetype == SPACE_ACTION) {
SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
Scene *scene;
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index a7a35c281fd..c2046621c3a 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1052,6 +1052,15 @@ void postTrans (TransInfo *t)
ED_region_draw_cb_exit(t->ar->type, t->draw_handle);
}
+
+ if (t->customFree) {
+ /* Can take over freeing t->data and data2d etc... */
+ t->customFree(t);
+ }
+ else if (t->customData) {
+ MEM_freeN(t->customData);
+ }
+
/* postTrans can be called when nothing is selected, so data is NULL already */
if (t->data) {
int a;
@@ -1080,13 +1089,6 @@ void postTrans (TransInfo *t)
{
MEM_freeN(t->mouse.data);
}
-
- if (t->customFree) {
- t->customFree(t);
- }
- else if (t->customData) {
- MEM_freeN(t->customData);
- }
}
void applyTransObjects(TransInfo *t)