CEvent::CEvent(CEntity &owner, const tinyxml2::XMLElement *pElement) : m_sID(Attribute(pElement, "id", "unset id")), m_eRepeatType(REPEAT_TYPES_MAP.parseString(Attribute(pElement, "repeat", "none"))), m_fRepeatTime(RealAttribute(pElement, "time", 0)), m_fTimer(0), m_Owner(owner), m_bStarted(BoolAttribute(pElement, "started", false)) { for (const tinyxml2::XMLElement *pChildElem = pElement->FirstChildElement(); pChildElem; pChildElem = pChildElem->NextSiblingElement()) { if (strcmp(pChildElem->Value(), "emitter") == 0) { m_lEmitter.push_back(createEmitter(pChildElem, *this)); } else if (strcmp(pChildElem->Value(), "action") == 0) { m_lActions.push_back(createAction(pChildElem, *this)); } else { throw Ogre::Exception(0, "Unknown event child '" + std::string(pChildElem->Value()) + "'", __FILE__); } } }
void Effect::Deserialize(View* view, tinyxml2::XMLElement* in_xmlNode) { Node::Deserialize(view, in_xmlNode); for (auto pXmlChild = in_xmlNode->FirstChildElement(); pXmlChild; pXmlChild = pXmlChild->NextSiblingElement()) { string childName = pXmlChild->Name(); if (childName != "Filter") continue; const char* szType = pXmlChild->Attribute("type"); if (!szType) continue; string typeName = szType; if (typeName == "blur") { m_blurEnabled = pXmlChild->BoolAttribute("enabled"); float amount = GetBlurAmount(); pXmlChild->QueryFloatAttribute("amount", &amount); SetBlurAmount(amount); } if (typeName == "sepia") { m_sepiaEnabled = pXmlChild->BoolAttribute("enabled"); Vector3 tone = GetSepiaTone(); pXmlChild->QueryFloatAttribute("toneR", &tone.x); pXmlChild->QueryFloatAttribute("toneG", &tone.y); pXmlChild->QueryFloatAttribute("toneB", &tone.z); SetSepiaTone(tone); float saturation = GetSepiaSaturation(); pXmlChild->QueryFloatAttribute("saturation", &saturation); SetSepiaSaturation(saturation); float amount = GetSepiaAmount(); pXmlChild->QueryFloatAttribute("amount", &amount); SetSepiaAmount(amount); } if (typeName == "crt") { m_crtEnabled = pXmlChild->BoolAttribute("enabled"); } if (typeName == "cartoon") { m_cartoonEnabled = pXmlChild->BoolAttribute("enabled"); Vector3 tone = GetCartoonTone(); pXmlChild->QueryFloatAttribute("toneR", &tone.x); pXmlChild->QueryFloatAttribute("toneG", &tone.y); pXmlChild->QueryFloatAttribute("toneB", &tone.z); SetCartoonTone(tone); } if (typeName == "vignette") { m_vignetteEnabled = pXmlChild->BoolAttribute("enabled"); float amount = GetVignetteAmount(); pXmlChild->QueryFloatAttribute("amount", &amount); SetVignetteAmount(amount); } } }