merge with 2.5 (not trunk, last merge message said that on accident) at r22252
[blender.git] / source / blender / editors / transform / transform_conversions.c
index 623c6bb24c35803806451dbf031a8bac70d72889..783d98e4c6f6526aa95dacc55fa1bdd85c9faa68 100644 (file)
@@ -1219,8 +1219,7 @@ static void createTransArmatureVerts(bContext *C, TransInfo *t)
 
 static void createTransMBallVerts(bContext *C, TransInfo *t)
 {
-       // TRANSFORM_FIX_ME
-#if 0
+       MetaBall *mb = (MetaBall*)t->obedit->data;
        MetaElem *ml;
        TransData *td;
        TransDataExtension *tx;
@@ -1229,7 +1228,7 @@ static void createTransMBallVerts(bContext *C, TransInfo *t)
        int propmode = t->flag & T_PROP_EDIT;
 
        /* count totals */
-       for(ml= editelems.first; ml; ml= ml->next) {
+       for(ml= mb->editelems->first; ml; ml= ml->next) {
                if(ml->flag & SELECT) countsel++;
                if(propmode) count++;
        }
@@ -1246,7 +1245,7 @@ static void createTransMBallVerts(bContext *C, TransInfo *t)
        Mat3CpyMat4(mtx, t->obedit->obmat);
        Mat3Inv(smtx, mtx);
 
-       for(ml= editelems.first; ml; ml= ml->next) {
+       for(ml= mb->editelems->first; ml; ml= ml->next) {
                if(propmode || (ml->flag & SELECT)) {
                        td->loc= &ml->x;
                        VECCOPY(td->iloc, td->loc);
@@ -1287,7 +1286,6 @@ static void createTransMBallVerts(bContext *C, TransInfo *t)
                        tx++;
                }
        }
-#endif
 }
 
 /* ********************* curve/surface ********* */
@@ -2451,7 +2449,7 @@ static void UVsToTransData(SpaceImage *sima, TransData *td, TransData2D *td2d, f
 
 static void createTransUVs(bContext *C, TransInfo *t)
 {
-       SpaceImage *sima = (SpaceImage*)CTX_wm_space_data(C);
+       SpaceImage *sima = CTX_wm_space_image(C);
        Image *ima = CTX_data_edit_image(C);
        Scene *scene = CTX_data_scene(C);
        TransData *td = NULL;
@@ -4680,34 +4678,34 @@ void special_aftertrans_update(TransInfo *t)
                SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
                Scene *scene;
                bAnimContext ac;
-
+               
                /* initialise relevant anim-context 'context' data from TransInfo data */
                        /* NOTE: sync this with the code in ANIM_animdata_get_context() */
                memset(&ac, 0, sizeof(bAnimContext));
-
+               
                scene= ac.scene= t->scene;
                ob= ac.obact= OBACT;
                ac.sa= t->sa;
                ac.ar= t->ar;
                ac.spacetype= (t->sa)? t->sa->spacetype : 0;
                ac.regiontype= (t->ar)? t->ar->regiontype : 0;
-
+               
                if (ANIM_animdata_context_getdata(&ac) == 0)
                        return;
-
+               
                if (ac.datatype == ANIMCONT_DOPESHEET) {
                        ListBase anim_data = {NULL, NULL};
                        bAnimListElem *ale;
                        short filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
-
+                       
                        /* get channels to work on */
                        ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+                       
                        /* these should all be ipo-blocks */
                        for (ale= anim_data.first; ale; ale= ale->next) {
                                AnimData *adt= ANIM_nla_mapping_get(&ac, ale);
                                FCurve *fcu= (FCurve *)ale->key_data;
-
+                               
                                if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
                                     ((cancelled == 0) || (duplicate)) )
                                {
@@ -4720,7 +4718,7 @@ void special_aftertrans_update(TransInfo *t)
                                                posttrans_fcurve_clean(fcu);
                                }
                        }
-
+                       
                        /* free temp memory */
                        BLI_freelistN(&anim_data);
                }
@@ -4729,13 +4727,13 @@ void special_aftertrans_update(TransInfo *t)
                        // fixme... some of this stuff is not good
                        if (ob) {
                                ob->ctime= -1234567.0f;
-
+                               
                                if (ob->pose || ob_get_key(ob))
                                        DAG_object_flush_update(scene, ob, OB_RECALC);
                                else
                                        DAG_object_flush_update(scene, ob, OB_RECALC_OB);
                        }
-
+                       
                        /* Do curve cleanups? */
                        if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
                             ((cancelled == 0) || (duplicate)) )
@@ -4747,7 +4745,7 @@ void special_aftertrans_update(TransInfo *t)
 #if 0 // XXX old animation system
                        /* fix up the Ipocurves and redraw stuff */
                        Key *key= (Key *)ac.data;
-
+                       
                        if (key->ipo) {
                                if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
                                     ((cancelled == 0) || (duplicate)) )
@@ -4756,7 +4754,7 @@ void special_aftertrans_update(TransInfo *t)
                                }
                        }
 #endif // XXX old animation system
-
+                       
                        DAG_object_flush_update(scene, OBACT, OB_RECALC_DATA);
                }
 #if 0 // XXX future of this is still not clear
@@ -4766,23 +4764,23 @@ void special_aftertrans_update(TransInfo *t)
                        {
                                bScreen *sc= (bScreen *)ac.data;
                                ScrArea *sa;
-
+                               
                                /* BAD... we need to loop over all screen areas for current screen...
                                 *      - sync this with actdata_filter_gpencil() in editaction.c
                                 */
                                for (sa= sc->areabase.first; sa; sa= sa->next) {
                                        bGPdata *gpd= gpencil_data_getactive(sa);
-
+                                       
                                        if (gpd)
                                                posttrans_gpd_clean(gpd);
                                }
                        }
                }
 #endif // XXX future of this is still not clear
-
+               
                /* make sure all F-Curves are set correctly */
                ANIM_editkeyframes_refresh(&ac);
-
+               
                /* clear flag that was set for time-slide drawing */
                saction->flag &= ~SACTION_MOVING;
        }
@@ -4790,35 +4788,34 @@ void special_aftertrans_update(TransInfo *t)
                SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first;
                Scene *scene;
                bAnimContext ac;
-
+               
                /* initialise relevant anim-context 'context' data from TransInfo data */
                        /* NOTE: sync this with the code in ANIM_animdata_get_context() */
                memset(&ac, 0, sizeof(bAnimContext));
-
+               
                scene= ac.scene= t->scene;
                ob= ac.obact= OBACT;
                ac.sa= t->sa;
                ac.ar= t->ar;
                ac.spacetype= (t->sa)? t->sa->spacetype : 0;
                ac.regiontype= (t->ar)? t->ar->regiontype : 0;
-
+               
                if (ANIM_animdata_context_getdata(&ac) == 0)
                        return;
-
+               
                if (ac.datatype)
                {
                        ListBase anim_data = {NULL, NULL};
                        bAnimListElem *ale;
                        short filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_CURVEVISIBLE);
-
+                       
                        /* get channels to work on */
                        ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
-                       /* these should all be ipo-blocks */
+                       
                        for (ale= anim_data.first; ale; ale= ale->next) {
                                AnimData *adt= ANIM_nla_mapping_get(&ac, ale);
                                FCurve *fcu= (FCurve *)ale->key_data;
-
+                               
                                if ( (sipo->flag & SIPO_NOTRANSKEYCULL)==0 &&
                                     ((cancelled == 0) || (duplicate)) )
                                {
@@ -4831,58 +4828,57 @@ void special_aftertrans_update(TransInfo *t)
                                                posttrans_fcurve_clean(fcu);
                                }
                        }
-
+                       
                        /* free temp memory */
                        BLI_freelistN(&anim_data);
                }
-
+               
                /* make sure all F-Curves are set correctly */
                ANIM_editkeyframes_refresh(&ac);
        }
        else if (t->spacetype == SPACE_NLA) {
                Scene *scene;
                bAnimContext ac;
-
+               
                /* initialise relevant anim-context 'context' data from TransInfo data */
                /* NOTE: sync this with the code in ANIM_animdata_get_context() */
                memset(&ac, 0, sizeof(bAnimContext));
-
+               
                scene= ac.scene= t->scene;
                ob= ac.obact= OBACT;
                ac.sa= t->sa;
                ac.ar= t->ar;
                ac.spacetype= (t->sa)? t->sa->spacetype : 0;
                ac.regiontype= (t->ar)? t->ar->regiontype : 0;
-
+               
                if (ANIM_animdata_context_getdata(&ac) == 0)
                        return;
-
+                       
                if (ac.datatype)
                {
                        ListBase anim_data = {NULL, NULL};
                        bAnimListElem *ale;
                        short filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_NLATRACKS);
-
+                       
                        /* get channels to work on */
                        ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
-
+                       
                        for (ale= anim_data.first; ale; ale= ale->next) {
                                NlaTrack *nlt= (NlaTrack *)ale->data;
-
+                               
                                /* make sure strips are in order again */
                                BKE_nlatrack_sort_strips(nlt);
-
+                               
                                /* remove the temp metas */
                                BKE_nlastrips_clear_metas(&nlt->strips, 0, 1);
                        }
-
+                       
                        /* free temp memory */
                        BLI_freelistN(&anim_data);
+                       
+                       /* perform after-transfrom validation */
+                       ED_nla_postop_refresh(&ac);
                }
-
-               // XXX check on the calls below... we need some of these sanity checks
-               //synchronize_action_strips();
-               //ANIM_editkeyframes_refresh(&ac);
        }
        else if (t->obedit) {
                // TRANSFORM_FIX_ME