Merging r50192 through r50223 from trunk into soc-2011-tomato
[blender.git] / source / gameengine / Converter / BL_ShapeActionActuator.cpp
index a730041cdae9a5c0687643e700f4b1039fe21f38..c339e10f67302760070ead264c08763d490ebe1a 100644 (file)
@@ -222,22 +222,22 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
        priority = m_priority;
        
        /* Determine pre-incrementation behavior and set appropriate flags */
-       switch (m_playtype){
+       switch (m_playtype) {
        case ACT_ACTION_MOTION:
-               if (bNegativeEvent){
+               if (bNegativeEvent) {
                        keepgoing=false;
                        apply=false;
                };
                break;
        case ACT_ACTION_FROM_PROP:
-               if (bNegativeEvent){
+               if (bNegativeEvent) {
                        apply=false;
                        keepgoing=false;
                }
                break;
        case ACT_ACTION_LOOP_END:
-               if (bPositiveEvent){
-                       if (!(m_flag & ACT_FLAG_LOCKINPUT)){
+               if (bPositiveEvent) {
+                       if (!(m_flag & ACT_FLAG_LOCKINPUT)) {
                                m_flag &= ~ACT_FLAG_KEYUP;
                                m_flag &= ~ACT_FLAG_REVERSE;
                                m_flag |= ACT_FLAG_LOCKINPUT;
@@ -245,20 +245,20 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
                                m_starttime = curtime;
                        }
                }
-               if (bNegativeEvent){
+               if (bNegativeEvent) {
                        m_flag |= ACT_FLAG_KEYUP;
                }
                break;
        case ACT_ACTION_LOOP_STOP:
-               if (bPositiveEvent){
-                       if (!(m_flag & ACT_FLAG_LOCKINPUT)){
+               if (bPositiveEvent) {
+                       if (!(m_flag & ACT_FLAG_LOCKINPUT)) {
                                m_flag &= ~ACT_FLAG_REVERSE;
                                m_flag &= ~ACT_FLAG_KEYUP;
                                m_flag |= ACT_FLAG_LOCKINPUT;
                                SetStartTime(curtime);
                        }
                }
-               if (bNegativeEvent){
+               if (bNegativeEvent) {
                        m_flag |= ACT_FLAG_KEYUP;
                        m_flag &= ~ACT_FLAG_LOCKINPUT;
                        keepgoing=false;
@@ -266,8 +266,8 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
                }
                break;
        case ACT_ACTION_PINGPONG:
-               if (bPositiveEvent){
-                       if (!(m_flag & ACT_FLAG_LOCKINPUT)){
+               if (bPositiveEvent) {
+                       if (!(m_flag & ACT_FLAG_LOCKINPUT)) {
                                m_flag &= ~ACT_FLAG_KEYUP;
                                m_localtime = m_starttime;
                                m_starttime = curtime;
@@ -276,22 +276,22 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
                }
                break;
        case ACT_ACTION_FLIPPER:
-               if (bPositiveEvent){
-                       if (!(m_flag & ACT_FLAG_LOCKINPUT)){
+               if (bPositiveEvent) {
+                       if (!(m_flag & ACT_FLAG_LOCKINPUT)) {
                                m_flag &= ~ACT_FLAG_REVERSE;
                                m_flag |= ACT_FLAG_LOCKINPUT;
                                SetStartTime(curtime);
                        }
                }
-               else if (bNegativeEvent){
+               else if (bNegativeEvent) {
                        m_flag |= ACT_FLAG_REVERSE;
                        m_flag &= ~ACT_FLAG_LOCKINPUT;
                        SetStartTime(curtime);
                }
                break;
        case ACT_ACTION_PLAY:
-               if (bPositiveEvent){
-                       if (!(m_flag & ACT_FLAG_LOCKINPUT)){
+               if (bPositiveEvent) {
+                       if (!(m_flag & ACT_FLAG_LOCKINPUT)) {
                                m_flag &= ~ACT_FLAG_REVERSE;
                                m_localtime = m_starttime;
                                m_starttime = curtime;
@@ -304,8 +304,8 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
        }
        
        /* Perform increment */
-       if (keepgoing){
-               if (m_playtype == ACT_ACTION_MOTION){
+       if (keepgoing) {
+               if (m_playtype == ACT_ACTION_MOTION) {
                        MT_Point3       newpos;
                        MT_Point3       deltapos;
                        
@@ -316,13 +316,13 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
                        m_localtime += (length/m_stridelength) * deltapos.length();
                        m_lastpos = newpos;
                }
-               else{
+               else {
                        SetLocalTime(curtime);
                }
        }
        
        /* Check if a wrapping response is needed */
-       if (length){
+       if (length) {
                if (m_localtime < m_startframe || m_localtime > m_endframe)
                {
                        m_localtime = m_startframe + fmod(m_localtime, length);
@@ -333,14 +333,14 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
                m_localtime = m_startframe;
        
        /* Perform post-increment tasks */
-       switch (m_playtype){
+       switch (m_playtype) {
        case ACT_ACTION_FROM_PROP:
                {
                        CValue* propval = GetParent()->GetProperty(m_propname);
                        if (propval)
                                m_localtime = propval->GetNumber();
                        
-                       if (bNegativeEvent){
+                       if (bNegativeEvent) {
                                keepgoing=false;
                        }
                }
@@ -350,7 +350,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
        case ACT_ACTION_LOOP_STOP:
                break;
        case ACT_ACTION_PINGPONG:
-               if (wrap){
+               if (wrap) {
                        if (!(m_flag & ACT_FLAG_REVERSE))
                                m_localtime = m_endframe;
                        else 
@@ -362,8 +362,8 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
                }
                break;
        case ACT_ACTION_FLIPPER:
-               if (wrap){
-                       if (!(m_flag & ACT_FLAG_REVERSE)){
+               if (wrap) {
+                       if (!(m_flag & ACT_FLAG_REVERSE)) {
                                m_localtime=m_endframe;
                                //keepgoing = false;
                        }
@@ -374,8 +374,8 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
                }
                break;
        case ACT_ACTION_LOOP_END:
-               if (wrap){
-                       if (m_flag & ACT_FLAG_KEYUP){
+               if (wrap) {
+                       if (m_flag & ACT_FLAG_KEYUP) {
                                keepgoing = false;
                                m_localtime = m_endframe;
                                m_flag &= ~ACT_FLAG_LOCKINPUT;
@@ -384,7 +384,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
                }
                break;
        case ACT_ACTION_PLAY:
-               if (wrap){
+               if (wrap) {
                        m_localtime = m_endframe;
                        keepgoing = false;
                        m_flag &= ~ACT_FLAG_LOCKINPUT;
@@ -415,7 +415,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
        if (apply) {
 
                /* Priority test */
-               if (obj->SetActiveAction(this, priority, curtime)){
+               if (obj->SetActiveAction(this, priority, curtime)) {
                        BL_ShapeDeformer *shape_deformer = dynamic_cast<BL_ShapeDeformer*>(obj->GetDeformer());
                        Key *key = NULL;
 
@@ -430,7 +430,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
                        else {
                                ListBase tchanbase= {NULL, NULL};
                        
-                               if (m_blendin && m_blendframe==0.0f){
+                               if (m_blendin && m_blendframe==0.0f) {
                                        // this is the start of the blending, remember the startup shape
                                        obj->GetShape(m_blendshape);
                                        m_blendstart = curtime;
@@ -451,7 +451,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
                                } 
                                else {
                                        // the key have changed, apply blending if needed
-                                       if (m_blendin && (m_blendframe<m_blendin)){
+                                       if (m_blendin && (m_blendframe<m_blendin)) {
                                                newweight = (m_blendframe/(float)m_blendin);
 
                                                BlendShape(key, 1.0f - newweight);
@@ -466,12 +466,12 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
                                BLI_freelistN(&tchanbase);
                        }
                }
-               else{
+               else {
                        m_blendframe = 0.0f;
                }
        }
        
-       if (!keepgoing){
+       if (!keepgoing) {
                m_blendframe = 0.0f;
        }
        return keepgoing;