//------------------------------------------------------------------------- bool PULinearForceAffectorTranslator::translateChildProperty( PUScriptCompiler* compiler, PUAbstractNode *node ) { // PUAffector* af = static_cast<PUAffector*>(prop->parent->context); // No own properties. Parse the BaseForceAffector PUBaseForceAffectorTranslator BaseForceAffectorTranslator; return BaseForceAffectorTranslator.translateChildProperty(compiler, node); }
//------------------------------------------------------------------------- bool PUSineForceAffectorTranslator::translateChildProperty( PUScriptCompiler* compiler, PUAbstractNode *node ) { PUPropertyAbstractNode* prop = reinterpret_cast<PUPropertyAbstractNode*>(node); PUAffector* af = static_cast<PUAffector*>(prop->parent->context); PUSineForceAffector* affector = static_cast<PUSineForceAffector*>(af); if (prop->name == token[TOKEN_MIN_FREQUENCY]) { // Property: min_frequency if (passValidateProperty(compiler, prop, token[TOKEN_MIN_FREQUENCY], VAL_REAL)) { float val = 0.0f; if(getFloat(*prop->values.front(), &val)) { affector->setFrequencyMin(val); return true; } } } else if (prop->name == token[TOKEN_SINE_MIN_FREQUENCY]) { // Property: sinef_aff_frequency_min (deprecated and replaced by 'min_frequency') if (passValidateProperty(compiler, prop, token[TOKEN_SINE_MIN_FREQUENCY], VAL_REAL)) { float val = 0.0f; if(getFloat(*prop->values.front(), &val)) { affector->setFrequencyMin(val); return true; } } } else if (prop->name == token[TOKEN_MAX_FREQUENCY]) { // Property: max_frequency if (passValidateProperty(compiler, prop, token[TOKEN_MAX_FREQUENCY], VAL_REAL)) { float val = 0.0f; if(getFloat(*prop->values.front(), &val)) { affector->setFrequencyMax(val); return true; } } } else if (prop->name == token[TOKEN_SINE_MAX_FREQUENCY]) { // Property: sinef_aff_frequency_max (deprecated and replaced by 'max_frequency') if (passValidateProperty(compiler, prop, token[TOKEN_SINE_MAX_FREQUENCY], VAL_REAL)) { float val = 0.0f; if(getFloat(*prop->values.front(), &val)) { affector->setFrequencyMax(val); return true; } } } else { // Parse the BaseForceAffector PUBaseForceAffectorTranslator BaseForceAffectorTranslator; return BaseForceAffectorTranslator.translateChildProperty(compiler, node); // Must be the last } return false; }