Revision: 19681
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19681
Author:   campbellbarton
Date:     2009-04-12 18:10:43 +0200 (Sun, 12 Apr 2009)

Log Message:
-----------
PropertyActuator toggle option didnt run when the Value field was empty.

Modified Paths:
--------------
    trunk/blender/source/blender/src/buttons_logic.c
    trunk/blender/source/gameengine/GameLogic/SCA_PropertyActuator.cpp

Modified: trunk/blender/source/blender/src/buttons_logic.c
===================================================================
--- trunk/blender/source/blender/src/buttons_logic.c    2009-04-12 14:22:51 UTC 
(rev 19680)
+++ trunk/blender/source/blender/src/buttons_logic.c    2009-04-12 16:10:43 UTC 
(rev 19681)
@@ -1970,7 +1970,7 @@
                        
                        pa= act->data;
                        
-                       str= "Type%t|Assign%x0|Add %x1|Copy %x2|Toggle%x3";
+                       str= "Type%t|Assign%x0|Add %x1|Copy %x2|Toggle 
(bool/int/float/timer)%x3";
                        uiDefButI(block, MENU, B_REDR, str,             
xco+30,yco-24,width-60, 19, &pa->type, 0, 31, 0, 0, "Type");
                        
                        uiDefBut(block, TEX, 1, "Prop: ",               
xco+30,yco-44,width-60, 19, pa->name, 0, 31, 0, 0, "Property name");

Modified: trunk/blender/source/gameengine/GameLogic/SCA_PropertyActuator.cpp
===================================================================
--- trunk/blender/source/gameengine/GameLogic/SCA_PropertyActuator.cpp  
2009-04-12 14:22:51 UTC (rev 19680)
+++ trunk/blender/source/gameengine/GameLogic/SCA_PropertyActuator.cpp  
2009-04-12 16:10:43 UTC (rev 19681)
@@ -77,11 +77,25 @@
        CParser parser;
        parser.SetContext( propowner->AddRef());
        
-       CExpression* userexpr = parser.ProcessText(m_exprtxt);
-       if (userexpr)
+       CExpression* userexpr= NULL;
+       
+       if (m_type==KX_ACT_PROP_TOGGLE)
        {
-               
-
+               /* dont use */
+               CValue* newval;
+               CValue* oldprop = propowner->GetProperty(m_propname);
+               if (oldprop)
+               {
+                       newval = new CBoolValue((oldprop->GetNumber()==0.0) ? 
true:false);
+                       oldprop->SetValue(newval);
+               } else
+               {       /* as not been assigned, evaluate as false, so assign 
true */
+                       newval = new CBoolValue(true);
+                       propowner->SetProperty(m_propname,newval);
+               }
+               newval->Release();
+       }
+       else if (userexpr = parser.ProcessText(m_exprtxt)) {
                switch (m_type)
                {
 
@@ -135,23 +149,7 @@
                                }
                                break;
                        }
-               case KX_ACT_PROP_TOGGLE:
-                       {
-                               
-                               CValue* newval;
-                               CValue* oldprop = 
propowner->GetProperty(m_propname);
-                               if (oldprop)
-                               {
-                                       newval = new 
CBoolValue((oldprop->GetNumber()==0.0) ? true:false);
-                                       oldprop->SetValue(newval);
-                               } else
-                               {       /* as not been assigned, evaluate as 
false, so assign true */
-                                       newval = new CBoolValue(true);
-                                       
propowner->SetProperty(m_propname,newval);
-                               }
-                               newval->Release();
-                               break;
-                       }
+               /* case KX_ACT_PROP_TOGGLE: */ /* accounted for above, no need 
for userexpr */
                default:
                        {
 


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to