~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/src/transform_conversions.c

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2007-05-17 11:47:59 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070517114759-yp4ybrnhp2u7pk66
Tags: 2.44-1
* New upstream release.
* Drop debian/patches/01_64bits_stupidity, not needed anymore: as of this
  version blender is 64 bits safe again. Adjust README.Debian accordingly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * $Id: transform_conversions.c,v 1.91 2006/12/07 09:31:51 aligorith Exp $
 
2
 * $Id: transform_conversions.c,v 1.97 2007/05/05 05:10:35 aligorith Exp $
3
3
 *
4
4
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5
5
 *
240
240
                                if(td->flag & TD_SELECTED) {
241
241
                                        VecSubf(vec, tob->center, td->center);
242
242
                                        Mat3MulVecfl(tob->mtx, vec);
243
 
                                        dist = Normalise(vec);
 
243
                                        dist = Normalize(vec);
244
244
                                        if (tob->rdist == -1.0f) {
245
245
                                                tob->rdist = dist;
246
246
                                        }
397
397
        return NULL;
398
398
}
399
399
 
400
 
static void apply_targetless_ik(Object *ob)
 
400
static short apply_targetless_ik(Object *ob)
401
401
{
402
402
        bPoseChannel *pchan, *parchan, *chanlist[256];
403
403
        bKinematicConstraint *data;
404
 
        int segcount;
 
404
        int segcount, apply= 0;
405
405
        
406
406
        /* now we got a difficult situation... we have to find the
407
407
           target-less IK pchans, and apply transformation to the all 
499
499
                                
500
500
                        }
501
501
                        
 
502
                        apply= 1;
502
503
                        data->flag &= ~CONSTRAINT_IK_AUTO;
503
504
                }
504
505
        }               
505
506
        
 
507
        return apply;
506
508
}
507
509
 
508
510
static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, TransData *td)
1564
1566
        EditVert *eve, *prev;
1565
1567
        EditFace *efa;
1566
1568
        float *v1, *v2, *v3, *v4;
1567
 
        int index= 0;
 
1569
        long index= 0;
1568
1570
        
1569
1571
        /* two abused locations in vertices */
1570
1572
        for(eve= em->verts.first; eve; eve= eve->next, index++) {
1576
1578
        for(efa= em->faces.first; efa; efa= efa->next) {
1577
1579
                
1578
1580
                /* retrieve mapped coordinates */
1579
 
                v1= mappedcos + 3*( (int)(efa->v1->prev) );
1580
 
                v2= mappedcos + 3*( (int)(efa->v2->prev) );
1581
 
                v3= mappedcos + 3*( (int)(efa->v3->prev) );
 
1581
                v1= mappedcos + 3*( (long)(efa->v1->prev) );
 
1582
                v2= mappedcos + 3*( (long)(efa->v2->prev) );
 
1583
                v3= mappedcos + 3*( (long)(efa->v3->prev) );
1582
1584
                
1583
1585
                if(efa->v2->tmp.fp==NULL && efa->v2->f1) {
1584
1586
                        set_crazy_vertex_quat(quats, efa->v2->co, efa->v3->co, efa->v1->co, v2, v3, v1);
1587
1589
                }
1588
1590
                
1589
1591
                if(efa->v4) {
1590
 
                        v4= mappedcos + 3*( (int)(efa->v4->prev) );
 
1592
                        v4= mappedcos + 3*( (long)(efa->v4->prev) );
1591
1593
                        
1592
1594
                        if(efa->v1->tmp.fp==NULL && efa->v1->f1) {
1593
1595
                                set_crazy_vertex_quat(quats, efa->v1->co, efa->v2->co, efa->v4->co, v1, v2, v4);
1824
1826
        tf= me->mtface;
1825
1827
        mf= me->mface;
1826
1828
        for(a=me->totface; a>0; a--, tf++, mf++) {
1827
 
                if(mf->v3 && tf->flag & TF_SELECT) {
 
1829
                if(mf->v3 && mf->flag & ME_FACE_SEL) {
1828
1830
                        if(tf->flag & TF_SEL1) countsel++;
1829
1831
                        if(tf->flag & TF_SEL2) countsel++;
1830
1832
                        if(tf->flag & TF_SEL3) countsel++;
1851
1853
        tf= me->mtface;
1852
1854
        mf= me->mface;
1853
1855
        for(a=me->totface; a>0; a--, tf++, mf++) {
1854
 
                if(mf->v3 && tf->flag & TF_SELECT) {
 
1856
                if(mf->v3 && mf->flag & ME_FACE_SEL) {
1855
1857
                        if(tf->flag & TF_SEL1 || propmode)
1856
1858
                                UVsToTransData(td++, td2d++, tf->uv[0], (tf->flag & TF_SEL1));
1857
1859
                        if(tf->flag & TF_SEL2 || propmode)
2197
2199
                bAction *act;
2198
2200
                bPose   *pose;
2199
2201
                bPoseChannel *pchan;
 
2202
                short targetless_ik= 0;
2200
2203
 
2201
2204
                ob= t->poseobj;
2202
2205
                arm= ob->data;
2207
2210
 
2208
2211
                /* if target-less IK grabbing, we calculate the pchan transforms and clear flag */
2209
2212
                if(!cancelled && t->mode==TFM_TRANSLATION)
2210
 
                        apply_targetless_ik(ob);
 
2213
                        targetless_ik= apply_targetless_ik(ob);
2211
2214
                else {
2212
2215
                        /* not forget to clear the auto flag */
2213
2216
                        for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
2224
2227
                        act= ob->action;
2225
2228
                        
2226
2229
                        if (!act)
2227
 
                                act= ob->action= add_empty_action(ID_PO);
 
2230
                                act= ob->action= add_empty_action("Action");
2228
2231
                        
2229
2232
                        for (pchan=pose->chanbase.first; pchan; pchan=pchan->next){
2230
2233
                                if (pchan->bone->flag & BONE_TRANSFORM){
2247
2250
                                                }
2248
2251
                                        }
2249
2252
                                        else if (U.uiflag & USER_KEYINSERTNEED) {
2250
 
                                                insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_X);
2251
 
                                                insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Y);
2252
 
                                                insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Z);
2253
 
 
2254
 
                                                insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_W);
2255
 
                                                insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_X);
2256
 
                                                insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Y);
2257
 
                                                insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Z);
2258
 
 
2259
 
                                                insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_X);
2260
 
                                                insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Y);
2261
 
                                                insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Z);
 
2253
                                                if ((t->mode==TFM_TRANSLATION) && (targetless_ik==0)) {
 
2254
                                                        insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_X);
 
2255
                                                        insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Y);
 
2256
                                                        insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Z);
 
2257
                                                }
 
2258
                                                if ((t->mode==TFM_ROTATION) || ((t->mode==TFM_TRANSLATION) && targetless_ik)) {
 
2259
                                                        insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_W);
 
2260
                                                        insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_X);
 
2261
                                                        insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Y);
 
2262
                                                        insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Z);
 
2263
                                                }
 
2264
                                                if (t->mode==TFM_RESIZE) {
 
2265
                                                        insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_X);
 
2266
                                                        insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Y);
 
2267
                                                        insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Z);
 
2268
                                                }
2262
2269
                                        }
2263
2270
                                        else {
2264
2271
                                                insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_X);
2316
2323
                                        actname= "Object";
2317
2324
 
2318
2325
                                if(U.uiflag & USER_KEYINSERTAVAI) {
2319
 
                                        if(base->object->ipo) {
 
2326
                                        if(base->object->ipo || base->object->action) {
2320
2327
                                                ID* id= (ID *)(base->object);
2321
 
                                                icu= base->object->ipo->curve.first;
 
2328
                                                
 
2329
                                                if (base->object->ipo) {
 
2330
                                                        icu= base->object->ipo->curve.first;
 
2331
                                                }
 
2332
                                                else {
 
2333
                                                        bActionChannel *achan;
 
2334
                                                        achan= get_action_channel(base->object->action, actname);
 
2335
                                                        
 
2336
                                                        if (achan && achan->ipo)
 
2337
                                                                icu= achan->ipo->curve.first;
 
2338
                                                        else
 
2339
                                                                icu= NULL;
 
2340
                                                }
 
2341
                                                
2322
2342
                                                while(icu) {
2323
2343
                                                        icu->flag &= ~IPO_SELECT;
2324
2344
                                                        if (U.uiflag & USER_KEYINSERTNEED)