//----------------------------------------------------------------------- void SceneDecoratorExtern::copyAttributesTo (Extern* externObject) { Extern::copyAttributesTo(externObject); SceneDecoratorExtern* sceneDecoratorExtern = static_cast<SceneDecoratorExtern*>(externObject); sceneDecoratorExtern->setMaterialName(mMaterialName); sceneDecoratorExtern->setMeshName(mMeshName); sceneDecoratorExtern->mScale = mScale; sceneDecoratorExtern->mPosition = mPosition; }
//----------------------------------------------------------------------- bool SceneDecoratorExternTranslator::translateChildProperty(ScriptCompiler* compiler, const AbstractNodePtr &node) { PropertyAbstractNode* prop = reinterpret_cast<PropertyAbstractNode*>(node.get()); Extern* ex = any_cast<Extern*>(prop->parent->context); SceneDecoratorExtern* externObject = static_cast<SceneDecoratorExtern*>(ex); if (prop->name == token[TOKEN_MESH_NAME]) { // Property: mesh_name if (passValidateProperty(compiler, prop, token[TOKEN_MESH_NAME], VAL_STRING)) { String val; if(getString(prop->values.front(), &val)) { externObject->setMeshName(val); return true; } } } else if (prop->name == token[TOKEN_SCENE_MESH_NAME]) { // Property: scene_mesh_name (deprecated and replaced by mesh_name) if (passValidateProperty(compiler, prop, token[TOKEN_SCENE_MESH_NAME], VAL_STRING)) { String val; if(getString(prop->values.front(), &val)) { externObject->setMeshName(val); return true; } } } else if (prop->name == token[TOKEN_MATERIAL]) { // Property: material if (passValidateProperty(compiler, prop, token[TOKEN_MATERIAL], VAL_STRING)) { String val; if(getString(prop->values.front(), &val)) { externObject->setMaterialName(val); return true; } } } else if (prop->name == token[TOKEN_SCENE_MATERIAL_NAME]) { // Property: scene_material_name (deprecated and replaced by 'material') if (passValidateProperty(compiler, prop, token[TOKEN_SCENE_MATERIAL_NAME], VAL_STRING)) { String val; if(getString(prop->values.front(), &val)) { externObject->setMaterialName(val); return true; } } } else if (prop->name == token[TOKEN_SCENE_SCALE]) { // Property: scene_node_scale if (passValidateProperty(compiler, prop, token[TOKEN_SCENE_SCALE], VAL_VECTOR3)) { Vector3 val; if(getVector3(prop->values.begin(), prop->values.end(), &val)) { externObject->setScale(val); return true; } } } else if (prop->name == token[TOKEN_SCENE_POSITION]) { // Property: scene_node_position if (passValidateProperty(compiler, prop, token[TOKEN_SCENE_POSITION], VAL_VECTOR3)) { Vector3 val; if(getVector3(prop->values.begin(), prop->values.end(), &val)) { externObject->setPosition(val); return true; } } } return false; }