~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to source/gameengine/Ketsji/KX_TrackToActuator.cpp

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** \file gameengine/Ketsji/KX_TrackToActuator.cpp
 
2
 *  \ingroup ketsji
 
3
 */
1
4
//
2
5
// Replace the mesh for this actuator's parent
3
6
//
4
 
// $Id: KX_TrackToActuator.cpp 28254 2010-04-18 10:28:37Z campbellbarton $
5
7
//
6
8
// ***** BEGIN GPL LICENSE BLOCK *****
7
9
//
51
53
 
52
54
 
53
55
KX_TrackToActuator::KX_TrackToActuator(SCA_IObject *gameobj, 
54
 
                                                                       SCA_IObject *ob,
55
 
                                                                           int time,
56
 
                                                                           bool allow3D,
57
 
                                                                           int trackflag,
58
 
                                                                           int upflag)
59
 
                                                                           : SCA_IActuator(gameobj, KX_ACT_TRACKTO)
 
56
                                       SCA_IObject *ob,
 
57
                                       int time,
 
58
                                       bool allow3D,
 
59
                                       int trackflag,
 
60
                                       int upflag)
 
61
    : SCA_IActuator(gameobj, KX_ACT_TRACKTO)
60
62
{
61
 
    m_time = time;
62
 
    m_allow3D = allow3D;
63
 
    m_object = ob;
 
63
        m_time = time;
 
64
        m_allow3D = allow3D;
 
65
        m_object = ob;
64
66
        m_trackflag = trackflag;
65
67
        m_upflag = upflag;
66
68
        m_parentobj = 0;
70
72
 
71
73
        {
72
74
                // if the object is vertex parented, don't check parent orientation as the link is broken
73
 
                if (!((KX_GameObject*)gameobj)->IsVertexParent()){
 
75
                if (!((KX_GameObject*)gameobj)->IsVertexParent()) {
74
76
                        m_parentobj = ((KX_GameObject*)gameobj)->GetParent(); // check if the object is parented 
75
77
                        if (m_parentobj) {  
76
78
                                // if so, store the initial local rotation
151
153
        dy= eul[1] - oldrot[1];
152
154
        dz= eul[2] - oldrot[2];
153
155
 
154
 
        if( fabs(dx) > MT_PI) {
155
 
                if(dx > 0.0) eul[0] -= MT_2_PI; else eul[0]+= MT_2_PI;
156
 
        }
157
 
        if( fabs(dy) > MT_PI) {
158
 
                if(dy > 0.0) eul[1] -= MT_2_PI; else eul[1]+= MT_2_PI;
159
 
        }
160
 
        if( fabs(dz) > MT_PI ) {
161
 
                if(dz > 0.0) eul[2] -= MT_2_PI; else eul[2]+= MT_2_PI;
 
156
        if ( fabs(dx) > MT_PI) {
 
157
                if (dx > 0.0) eul[0] -= MT_2_PI; else eul[0]+= MT_2_PI;
 
158
        }
 
159
        if ( fabs(dy) > MT_PI) {
 
160
                if (dy > 0.0) eul[1] -= MT_2_PI; else eul[1]+= MT_2_PI;
 
161
        }
 
162
        if ( fabs(dz) > MT_PI ) {
 
163
                if (dz > 0.0) eul[2] -= MT_2_PI; else eul[2]+= MT_2_PI;
162
164
        }
163
165
}
164
166
 
216
218
        return false;
217
219
}
218
220
 
219
 
void KX_TrackToActuator::Relink(GEN_Map<GEN_HashedPtr, void*> *obj_map)
 
221
void KX_TrackToActuator::Relink(CTR_Map<CTR_HashedPtr, void*> *obj_map)
220
222
{
221
223
        void **h_obj = (*obj_map)[m_object];
222
224
        if (h_obj) {
389
391
                mat= matrix3x3_interpol(oldmat, mat, m_time);
390
392
                
391
393
 
392
 
                if(m_parentobj){ // check if the model is parented and calculate the child transform
 
394
                if (m_parentobj) { // check if the model is parented and calculate the child transform
393
395
                                
394
396
                        MT_Point3 localpos;
395
397
                        localpos = curobj->GetSGNode()->GetLocalPosition();
417
419
        return result;
418
420
}
419
421
 
420
 
#ifndef DISABLE_PYTHON
 
422
#ifdef WITH_PYTHON
421
423
 
422
424
/* ------------------------------------------------------------------------- */
423
425
/* Python functions                                                          */
486
488
        return PY_SET_ATTR_SUCCESS;
487
489
}
488
490
 
489
 
#endif // DISABLE_PYTHON
 
491
#endif // WITH_PYTHON
490
492
 
491
493
/* eof */