diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-04-12 20:10:43 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-04-12 20:10:43 +0400 |
commit | 17f35293ee9d83605db7d73e7213d206d507a587 (patch) | |
tree | 703472804a9c2f4c05ccf6b6fcb18935fe6649ce /source/gameengine/GameLogic/SCA_PropertyActuator.cpp | |
parent | 332032fb9925091da49efa2e9c3653bdb3e68cba (diff) |
PropertyActuator toggle option didnt run when the Value field was empty.
Diffstat (limited to 'source/gameengine/GameLogic/SCA_PropertyActuator.cpp')
-rw-r--r-- | source/gameengine/GameLogic/SCA_PropertyActuator.cpp | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp index 37df8a5c401..359ab8adac6 100644 --- a/source/gameengine/GameLogic/SCA_PropertyActuator.cpp +++ b/source/gameengine/GameLogic/SCA_PropertyActuator.cpp @@ -77,11 +77,25 @@ bool SCA_PropertyActuator::Update() 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 @@ bool SCA_PropertyActuator::Update() } 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: { |