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

« back to all changes in this revision

Viewing changes to source/blender/src/editarmature.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: editarmature.c,v 1.120 2007/02/10 19:32:12 joeedh Exp $
 
2
 * $Id: editarmature.c,v 1.124 2007/04/27 11:54:09 aligorith Exp $
3
3
 *
4
4
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
5
5
 *
50
50
#include "DNA_ID.h"
51
51
#include "DNA_mesh_types.h"
52
52
#include "DNA_meshdata_types.h"
 
53
#include "DNA_nla_types.h"
53
54
#include "DNA_object_types.h"
54
55
#include "DNA_scene_types.h"
55
56
#include "DNA_screen_types.h"
102
103
#include "blendef.h"
103
104
#include "nla.h"
104
105
 
105
 
extern  float centre[3], centroid[3];   /* Originally defined in editobject.c */
 
106
extern  float center[3], centroid[3];   /* Originally defined in editobject.c */
106
107
 
107
108
/*      Macros  */
108
109
#define TEST_EDITARMATURE {if(G.obedit==0) return; if( (G.vd->lay & G.obedit->lay)==0 ) return;}
367
368
        }
368
369
}
369
370
 
370
 
/* 0 == do centre, 1 == centre new, 2 == centre cursor */
371
 
void docentre_armature (Object *ob, int centremode)
 
371
/* 0 == do center, 1 == center new, 2 == center cursor */
 
372
void docenter_armature (Object *ob, int centermode)
372
373
{
373
374
        ListBase        list;
374
375
        EditBone *ebone;
384
385
        list.first= list.last = NULL;
385
386
        make_boneList(&list, &arm->bonebase, NULL);
386
387
 
387
 
        /* Find the centrepoint */
388
 
        if (centremode == 2) {
 
388
        /* Find the centerpoint */
 
389
        if (centermode == 2) {
389
390
                VECCOPY(cent, give_cursor());
390
391
                Mat4Invert(ob->imat, ob->obmat);
391
392
                Mat4MulVecfl(ob->imat, cent);
417
418
                BLI_freelistN(&list);
418
419
        }
419
420
        
420
 
        /* Adjust object location for new centrepoint */
421
 
        if(centremode && G.obedit==0) {
 
421
        /* Adjust object location for new centerpoint */
 
422
        if(centermode && G.obedit==0) {
422
423
                Mat3CpyMat4(omat, ob->obmat);
423
424
                
424
425
                Mat3MulVecfl(omat, cent);
522
523
        
523
524
        ob= OBACT;
524
525
        if(ob->type!=OB_ARMATURE) return 0;
525
 
        arm= get_armature(ob);
 
526
        if (object_data_is_libdata(ob)) {
 
527
                error_libdata();
 
528
                return 0;
 
529
        }
 
530
        arm= get_armature(ob); 
526
531
        
527
532
        /* Get editbones of active armature to add editbones to */
528
533
        ebbase.first=ebbase.last= NULL;
708
713
        glInitNames();
709
714
        hits= view3d_opengl_select(buffer, MAXPICKBUF, 0, 0, 0, 0);
710
715
 
711
 
        if (hits)
 
716
        if (hits>0)
712
717
                return get_bone_from_selectbuffer(BASACT, buffer, hits, findunsel);
713
718
        
714
719
        return NULL;
951
956
                hits= view3d_opengl_select(buffer, MAXPICKBUF, mval[0]-12, mval[1]-12, mval[0]+12, mval[1]+12);
952
957
                
953
958
        /* See if there are any selected bones in this group */
954
 
        if (hits) {
 
959
        if (hits>0) {
955
960
                
956
961
                if(hits==1) {
957
962
                        if (!(buffer[3] & BONESEL_NOSEL)) 
2678
2683
                        if(arm==ob->data) {
2679
2684
                                Object *cob;
2680
2685
                                bAction  *act;
2681
 
                                bActionChannel *chan;
 
2686
                                bActionChannel *achan;
 
2687
                                bActionStrip *strip;
2682
2688
 
2683
2689
                                /* Rename action channel if necessary */
2684
2690
                                act = ob->action;
2685
 
                                if (act && !act->id.lib){
 
2691
                                if (act && !act->id.lib) {
2686
2692
                                        /*      Find the appropriate channel */
2687
 
                                        chan= get_action_channel(act, oldname);
2688
 
                                        if(chan) BLI_strncpy(chan->name, newname, MAXBONENAME);
 
2693
                                        achan= get_action_channel(act, oldname);
 
2694
                                        if(achan) BLI_strncpy(achan->name, newname, MAXBONENAME);
2689
2695
                                }
2690
2696
                
2691
2697
                                /* Rename the pose channel, if it exists */
2696
2702
                                        }
2697
2703
                                }
2698
2704
                                
2699
 
                                /* and actually do the NLA too */
2700
 
                                /* (todo) */
 
2705
                                /* check all nla-strips too */
 
2706
                                for (strip= ob->nlastrips.first; strip; strip= strip->next) {
 
2707
                                        /* Rename action channel if necessary */
 
2708
                                        act = strip->act;
 
2709
                                        if (act && !act->id.lib) {
 
2710
                                                /*      Find the appropriate channel */
 
2711
                                                achan= get_action_channel(act, oldname);
 
2712
                                                if(achan) BLI_strncpy(achan->name, newname, MAXBONENAME);
 
2713
                                        }
 
2714
                                }
2701
2715
                                
2702
2716
                                /* Update any object constraints to use the new bone name */
2703
2717
                                for(cob= G.main->object.first; cob; cob= cob->id.next) {
2710
2724
                                                }
2711
2725
                                        }
2712
2726
                                }
2713
 
                                
2714
2727
                        }
2715
2728
                                        
2716
2729
                        /* See if an object is parented to this armature */