//----------------------------------------------------------------------- void DoScaleEventHandler::copyAttributesTo (ParticleEventHandler* eventHandler) { ParticleEventHandler::copyAttributesTo(eventHandler); DoScaleEventHandler* doScaleEventHandler = static_cast<DoScaleEventHandler*>(eventHandler); doScaleEventHandler->setScaleFraction(mScaleFraction); doScaleEventHandler->setScaleType(mScaleType); }
//----------------------------------------------------------------------- bool DoScaleEventHandlerTranslator::translateChildProperty(Ogre::ScriptCompiler* compiler, const Ogre::AbstractNodePtr &node) { Ogre::PropertyAbstractNode* prop = reinterpret_cast<Ogre::PropertyAbstractNode*>(node.get()); ParticleEventHandler* evt = Ogre::any_cast<ParticleEventHandler*>(prop->parent->context); DoScaleEventHandler* handler = static_cast<DoScaleEventHandler*>(evt); if (prop->name == token[TOKEN_DOSCALE_FRACTION]) { // Property: scale_fraction if (passValidateProperty(compiler, prop, token[TOKEN_DOSCALE_FRACTION], VAL_REAL)) { Ogre::Real val = 0.0f; if(getReal(prop->values.front(), &val)) { handler->setScaleFraction(val); return true; } } } else if (prop->name == token[TOKEN_DOSCALE_TYPE]) { // Property: scale_type if (passValidateProperty(compiler, prop, token[TOKEN_DOSCALE_TYPE], VAL_STRING)) { Ogre::String val; if(getString(prop->values.front(), &val)) { if (val == token[TOKEN_TIME_TO_LIVE] || val == token[TOKEN_DOSCALE_TIME_TO_LIVE]) { handler->setScaleType(DoScaleEventHandler::ST_TIME_TO_LIVE); return true; } else if (val == token[TOKEN_VELOCITY] || val == token[TOKEN_DOSCALE_VELOCITY]) { handler->setScaleType(DoScaleEventHandler::ST_VELOCITY); return true; } } } } return false; }