- property sensor was converting floating point values to text then back to float - for floating point properties.
- IntValue's GetNumber() was convert int -> float -> double. - BL_Shader was using STR_String rather then char*, where most callers had a char*, use a char* to avoid STR_String conversion-and-alloc on shader access.
This commit is contained in:
@@ -126,7 +126,6 @@ bool SCA_PropertySensor::Evaluate()
|
||||
|
||||
bool SCA_PropertySensor::CheckPropertyCondition()
|
||||
{
|
||||
|
||||
m_recentresult=false;
|
||||
bool result=false;
|
||||
bool reverse = false;
|
||||
@@ -174,7 +173,7 @@ bool SCA_PropertySensor::CheckPropertyCondition()
|
||||
|
||||
case KX_PROPSENSOR_EXPRESSION:
|
||||
{
|
||||
/*
|
||||
#if 0
|
||||
if (m_rightexpr)
|
||||
{
|
||||
CValue* resultval = m_rightexpr->Calculate();
|
||||
@@ -189,7 +188,7 @@ bool SCA_PropertySensor::CheckPropertyCondition()
|
||||
result = resultval->GetNumber() != 0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case KX_PROPSENSOR_INTERVAL:
|
||||
@@ -197,7 +196,16 @@ bool SCA_PropertySensor::CheckPropertyCondition()
|
||||
CValue* orgprop = GetParent()->FindIdentifier(m_checkpropname);
|
||||
if (!orgprop->IsError())
|
||||
{
|
||||
float val = orgprop->GetText().ToFloat(), min = m_checkpropval.ToFloat(), max = m_checkpropmaxval.ToFloat();
|
||||
const float min = m_checkpropval.ToFloat();
|
||||
const float max = m_checkpropmaxval.ToFloat();
|
||||
float val;
|
||||
|
||||
if (dynamic_cast<CStringValue *>(orgprop) == NULL) {
|
||||
val = orgprop->GetNumber();
|
||||
}
|
||||
else {
|
||||
val = orgprop->GetText().ToFloat();
|
||||
}
|
||||
|
||||
result = (min <= val) && (val <= max);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user