//----------------------------------------------------------------------- bool VortexAffectorTranslator::translateChildObject(ScriptCompiler* compiler, const AbstractNodePtr &node) { ObjectAbstractNode* child = reinterpret_cast<ObjectAbstractNode*>(node.get()); ParticleAffector* af = any_cast<ParticleAffector*>(child->parent->context); VortexAffector* affector = static_cast<VortexAffector*>(af); DynamicAttributeTranslator dynamicAttributeTranslator; if (child->cls == token[TOKEN_ROTATION_SPEED]) { // Property: rotation_speed dynamicAttributeTranslator.translate(compiler, node); DynamicAttribute* dynamicAttribute = any_cast<DynamicAttribute*>(child->context); affector->setRotationSpeed(dynamicAttribute); return true; } else if (child->cls == token[TOKEN_VORTEX_ROTATION_SPEED]) { // Property: vortex_aff_speed (deprecated and replaced by 'rotation_speed') dynamicAttributeTranslator.translate(compiler, node); DynamicAttribute* dynamicAttribute = any_cast<DynamicAttribute*>(child->context); affector->setRotationSpeed(dynamicAttribute); return true; } return false; }
//----------------------------------------------------------------------- bool JetAffectorTranslator::translateChildObject(ScriptCompiler* compiler, const AbstractNodePtr &node) { ObjectAbstractNode* child = reinterpret_cast<ObjectAbstractNode*>(node.get()); ParticleAffector* af = any_cast<ParticleAffector*>(child->parent->context); JetAffector* affector = static_cast<JetAffector*>(af); DynamicAttributeTranslator dynamicAttributeTranslator; if (child->cls == token[TOKEN_ACCELERATION]) { // Property: acceleration dynamicAttributeTranslator.translate(compiler, node); DynamicAttribute* dynamicAttribute = any_cast<DynamicAttribute*>(child->context); affector->setDynAcceleration(dynamicAttribute); return true; } else if (child->cls == token[TOKEN_JET_ACCELERATION]) { // Property: jet_aff_accel (deprecated and replaced by 'acceleration') dynamicAttributeTranslator.translate(compiler, node); DynamicAttribute* dynamicAttribute = any_cast<DynamicAttribute*>(child->context); affector->setDynAcceleration(dynamicAttribute); return true; } return false; }
//----------------------------------------------------------------------- bool VortexExternTranslator::translateChildObject(ScriptCompiler* compiler, const AbstractNodePtr &node) { ObjectAbstractNode* child = reinterpret_cast<ObjectAbstractNode*>(node.get()); Extern* ex = any_cast<Extern*>(child->parent->context); VortexExtern* externObject = static_cast<VortexExtern*>(ex); DynamicAttributeTranslator dynamicAttributeTranslator; if (child->cls == token[TOKEN_ROTATION_SPEED]) { // Property: rotation_speed dynamicAttributeTranslator.translate(compiler, node); DynamicAttribute* dynamicAttribute = any_cast<DynamicAttribute*>(child->context); externObject->setRotationSpeed(dynamicAttribute); return true; } else if (child->cls == token[TOKEN_VORTEX_ROTATION_SPEED]) { // Property: vortex_aff_speed dynamicAttributeTranslator.translate(compiler, node); DynamicAttribute* dynamicAttribute = any_cast<DynamicAttribute*>(child->context); externObject->setRotationSpeed(dynamicAttribute); return true; } return false; }