|
@@ -149,10 +149,10 @@ void ParticleData::initPersistFields()
|
|
"Variance in lifetime of particle, from 0 - lifetimeMS." );
|
|
"Variance in lifetime of particle, from 0 - lifetimeMS." );
|
|
addField( "spinSpeed", TYPEID< F32 >(), Offset(spinSpeed, ParticleData),
|
|
addField( "spinSpeed", TYPEID< F32 >(), Offset(spinSpeed, ParticleData),
|
|
"Speed at which to spin the particle." );
|
|
"Speed at which to spin the particle." );
|
|
- addField( "spinRandomMin", TYPEID< F32 >(), Offset(spinRandomMin, ParticleData),
|
|
|
|
- "Minimum allowed spin speed of this particle, between -10000 and spinRandomMax." );
|
|
|
|
- addField( "spinRandomMax", TYPEID< F32 >(), Offset(spinRandomMax, ParticleData),
|
|
|
|
- "Maximum allowed spin speed of this particle, between spinRandomMin and 10000." );
|
|
|
|
|
|
+ addFieldV( "spinRandomMin", TYPEID< F32 >(), Offset(spinRandomMin, ParticleData), new FRangeValidator(-1000.f, 1000.f),
|
|
|
|
+ "Minimum allowed spin speed of this particle, between -1000 and spinRandomMax." );
|
|
|
|
+ addFieldV( "spinRandomMax", TYPEID< F32 >(), Offset(spinRandomMax, ParticleData), new FRangeValidator(-1000.f, 1000.f),
|
|
|
|
+ "Maximum allowed spin speed of this particle, between spinRandomMin and 1000." );
|
|
addField( "useInvAlpha", TYPEID< bool >(), Offset(useInvAlpha, ParticleData),
|
|
addField( "useInvAlpha", TYPEID< bool >(), Offset(useInvAlpha, ParticleData),
|
|
"@brief Controls how particles blend with the scene.\n\n"
|
|
"@brief Controls how particles blend with the scene.\n\n"
|
|
"If true, particles blend like ParticleBlendStyle NORMAL, if false, "
|
|
"If true, particles blend like ParticleBlendStyle NORMAL, if false, "
|
|
@@ -200,7 +200,8 @@ void ParticleData::initPersistFields()
|
|
"@brief Particle RGBA color keyframe values.\n\n"
|
|
"@brief Particle RGBA color keyframe values.\n\n"
|
|
"The particle color will linearly interpolate between the color/time keys "
|
|
"The particle color will linearly interpolate between the color/time keys "
|
|
"over the lifetime of the particle." );
|
|
"over the lifetime of the particle." );
|
|
- addField( "sizes", TYPEID< F32 >(), Offset(sizes, ParticleData), PDC_NUM_KEYS,
|
|
|
|
|
|
+ addProtectedField( "sizes", TYPEID< F32 >(), Offset(sizes, ParticleData), &protectedSetSizes,
|
|
|
|
+ &defaultProtectedGetFn, PDC_NUM_KEYS,
|
|
"@brief Particle size keyframe values.\n\n"
|
|
"@brief Particle size keyframe values.\n\n"
|
|
"The particle size will linearly interpolate between the size/time keys "
|
|
"The particle size will linearly interpolate between the size/time keys "
|
|
"over the lifetime of the particle." );
|
|
"over the lifetime of the particle." );
|
|
@@ -343,6 +344,22 @@ void ParticleData::unpackData(BitStream* stream)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+bool ParticleData::protectedSetSizes( void *object, const char *index, const char *data)
|
|
|
|
+{
|
|
|
|
+ ParticleData *pData = static_cast<ParticleData*>( object );
|
|
|
|
+ F32 val = dAtof(data);
|
|
|
|
+ U32 i;
|
|
|
|
+
|
|
|
|
+ if (!index)
|
|
|
|
+ i = 0;
|
|
|
|
+ else
|
|
|
|
+ i = dAtoui(index);
|
|
|
|
+
|
|
|
|
+ pData->sizes[i] = mClampF( val, 0.f, MaxParticleSize );
|
|
|
|
+
|
|
|
|
+ return false;
|
|
|
|
+}
|
|
|
|
+
|
|
bool ParticleData::protectedSetTimes( void *object, const char *index, const char *data)
|
|
bool ParticleData::protectedSetTimes( void *object, const char *index, const char *data)
|
|
{
|
|
{
|
|
ParticleData *pData = static_cast<ParticleData*>( object );
|
|
ParticleData *pData = static_cast<ParticleData*>( object );
|
|
@@ -356,7 +373,7 @@ bool ParticleData::protectedSetTimes( void *object, const char *index, const cha
|
|
|
|
|
|
pData->times[i] = mClampF( val, 0.f, 1.f );
|
|
pData->times[i] = mClampF( val, 0.f, 1.f );
|
|
|
|
|
|
- return true;
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
@@ -379,11 +396,11 @@ bool ParticleData::onAdd()
|
|
Con::warnf(ConsoleLogEntry::General, "ParticleData(%s) lifetimeVariance >= lifetime", getName());
|
|
Con::warnf(ConsoleLogEntry::General, "ParticleData(%s) lifetimeVariance >= lifetime", getName());
|
|
lifetimeVarianceMS = lifetimeMS - 1;
|
|
lifetimeVarianceMS = lifetimeMS - 1;
|
|
}
|
|
}
|
|
- if (spinSpeed > 10000.0 || spinSpeed < -10000.0) {
|
|
|
|
|
|
+ if (spinSpeed > 1000.f || spinSpeed < -1000.f) {
|
|
Con::warnf(ConsoleLogEntry::General, "ParticleData(%s) spinSpeed invalid", getName());
|
|
Con::warnf(ConsoleLogEntry::General, "ParticleData(%s) spinSpeed invalid", getName());
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- if (spinRandomMin > 10000.0 || spinRandomMin < -10000.0) {
|
|
|
|
|
|
+ if (spinRandomMin > 1000.f || spinRandomMin < -1000.f) {
|
|
Con::warnf(ConsoleLogEntry::General, "ParticleData(%s) spinRandomMin invalid", getName());
|
|
Con::warnf(ConsoleLogEntry::General, "ParticleData(%s) spinRandomMin invalid", getName());
|
|
spinRandomMin = -360.0;
|
|
spinRandomMin = -360.0;
|
|
return false;
|
|
return false;
|
|
@@ -393,7 +410,7 @@ bool ParticleData::onAdd()
|
|
spinRandomMin = spinRandomMax - (spinRandomMin - spinRandomMax );
|
|
spinRandomMin = spinRandomMax - (spinRandomMin - spinRandomMax );
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- if (spinRandomMax > 10000.0 || spinRandomMax < -10000.0) {
|
|
|
|
|
|
+ if (spinRandomMax > 1000.f || spinRandomMax < -1000.f) {
|
|
Con::warnf(ConsoleLogEntry::General, "ParticleData(%s) spinRandomMax invalid", getName());
|
|
Con::warnf(ConsoleLogEntry::General, "ParticleData(%s) spinRandomMax invalid", getName());
|
|
spinRandomMax = 360.0;
|
|
spinRandomMax = 360.0;
|
|
return false;
|
|
return false;
|