~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/blender/blenkernel/intern/sca.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
#include "DNA_object_types.h"
45
45
 
46
46
#include "BLI_blenlib.h"
47
 
#include "BKE_utildefines.h"
48
47
#include "BKE_global.h"
49
48
#include "BKE_main.h"
50
49
#include "BKE_library.h"
110
109
        sens->data= NULL;
111
110
        sens->pulse = 0;
112
111
        
113
 
        switch(sens->type) {
 
112
        switch (sens->type) {
114
113
        case SENS_ALWAYS:
115
114
                sens->pulse = 0;
116
115
                break;
211
210
        bController *cont;
212
211
        
213
212
        for (cont= lb->first; cont; cont= cont->next)
214
 
                unlink_controller(cont);        
 
213
                unlink_controller(cont);
215
214
}
216
215
 
217
216
void free_controller(bController *cont)
272
271
        if (cont->data) MEM_freeN(cont->data);
273
272
        cont->data= NULL;
274
273
        
275
 
        switch(cont->type) {
 
274
        switch (cont->type) {
276
275
        case CONT_EXPRESSION:
277
276
                cont->data= MEM_callocN(sizeof(bExpressionCont), "expcont");
278
277
                break;
400
399
        if (act->data) MEM_freeN(act->data);
401
400
        act->data= NULL;
402
401
        
403
 
        switch(act->type) {
 
402
        switch (act->type) {
404
403
        case ACT_ACTION:
405
404
        case ACT_SHAPEACTION:
406
405
                act->data= MEM_callocN(sizeof(bActionActuator), "actionact");
537
536
        ob= G.main->object.first;
538
537
        while (ob) {
539
538
                clear_sca_new_poins_ob(ob);
540
 
                ob= ob->id.next;        
 
539
                ob= ob->id.next;
541
540
        }
542
541
}
543
542
 
553
552
                if (sens->flag & SENS_NEW) {
554
553
                        for (a=0; a<sens->totlinks; a++) {
555
554
                                if (sens->links[a] && sens->links[a]->mynew)
556
 
                                        sens->links[a]= sens->links[a]->mynew;
 
555
                                        sens->links[a] = sens->links[a]->mynew;
557
556
                        }
558
557
                }
559
558
                sens= sens->next;
564
563
                if (cont->flag & CONT_NEW) {
565
564
                        for (a=0; a<cont->totlinks; a++) {
566
565
                                if ( cont->links[a] && cont->links[a]->mynew)
567
 
                                        cont->links[a]= cont->links[a]->mynew;
 
566
                                        cont->links[a] = cont->links[a]->mynew;
568
567
                        }
569
568
                }
570
569
                cont= cont->next;
625
624
        ob= G.main->object.first;
626
625
        while (ob) {
627
626
                set_sca_new_poins_ob(ob);
628
 
                ob= ob->id.next;        
 
627
                ob= ob->id.next;
629
628
        }
630
629
}
631
630
 
647
646
 
648
647
        sens= obt->sensors.first;
649
648
        while (sens) {
650
 
                switch(sens->type) {
 
649
                switch (sens->type) {
651
650
                case SENS_MESSAGE:
652
651
                        ms= sens->data;
653
652
                        if (ms->fromObject==ob) ms->fromObject= NULL;
657
656
 
658
657
        act= obt->actuators.first;
659
658
        while (act) {
660
 
                switch(act->type) {
 
659
                switch (act->type) {
661
660
                case ACT_CAMERA:
662
661
                        ca= act->data;
663
662
                        if (ca->ob==ob) ca->ob= NULL;
697
696
                        if (sta->target == ob) sta->target = NULL;
698
697
                }
699
698
                act= act->next;
700
 
        }       
 
699
        }
701
700
}
702
701
 
703
702
/* ******************** INTERFACE ******************* */
717
716
        if (!sens) return;
718
717
 
719
718
        /* move up */
720
 
        if ( val==1 && sens->prev) {
 
719
        if (val == 1 && sens->prev) {
721
720
                for (tmp=sens->prev; tmp; tmp=tmp->prev) {
722
721
                        if (tmp->flag & SENS_VISIBLE)
723
722
                                break;
728
727
                }
729
728
        }
730
729
        /* move down */
731
 
        else if ( val==2 && sens->next) {
 
730
        else if (val == 2 && sens->next) {
732
731
                for (tmp=sens->next; tmp; tmp=tmp->next) {
733
732
                        if (tmp->flag & SENS_VISIBLE)
734
733
                                break;
756
755
        if (!cont) return;
757
756
 
758
757
        /* move up */
759
 
        if ( val==1 && cont->prev) {
 
758
        if (val == 1 && cont->prev) {
760
759
                /* locate the controller that has the same state mask but is earlier in the list */
761
760
                tmp = cont->prev;
762
761
                while (tmp) {
771
770
        }
772
771
 
773
772
        /* move down */
774
 
        else if ( val==2 && cont->next) {
 
773
        else if (val == 2 && cont->next) {
775
774
                tmp = cont->next;
776
775
                while (tmp) {
777
776
                        if (tmp->state_mask & cont->state_mask) 
799
798
        if (!act) return;
800
799
 
801
800
        /* move up */
802
 
        if ( val==1 && act->prev) {
 
801
        if (val == 1 && act->prev) {
803
802
                /* locate the first visible actuators before this one */
804
803
                for (tmp = act->prev; tmp; tmp=tmp->prev) {
805
804
                        if (tmp->flag & ACT_VISIBLE)
811
810
                }
812
811
        }
813
812
        /* move down */
814
 
        else if ( val==2 && act->next) {
 
813
        else if (val == 2 && act->next) {
815
814
                /* locate the first visible actuators after this one */
816
815
                for (tmp=act->next; tmp; tmp=tmp->next) {
817
816
                        if (tmp->flag & ACT_VISIBLE)
876
875
                return;
877
876
        }
878
877
}
 
878
 
 
879
const char *sca_state_name_get(Object *ob, short bit)
 
880
{
 
881
        bController *cont;
 
882
        unsigned int mask;
 
883
 
 
884
        mask = (1<<bit);
 
885
        cont = ob->controllers.first;
 
886
        while (cont) {
 
887
                if (cont->state_mask & mask) {
 
888
                        return cont->name;
 
889
                }
 
890
                cont = cont->next;
 
891
        }
 
892
        return NULL;
 
893
}
 
894