28 #include <OgreEntity.h>
29 #include <OgreMaterialManager.h>
31 #include <OgreSubEntity.h>
32 #include <OgreTechnique.h>
36 std::vector<std::shared_ptr<RoR::SkinDef>> result;
37 std::unique_ptr<RoR::SkinDef> curr_skin;
45 if (!line.length() || line.substr(0, 2) ==
"//")
53 Ogre::StringUtil::trim(line);
54 curr_skin = std::unique_ptr<SkinDef>(
new SkinDef);
55 curr_skin->name = line;
56 stream->skipLine(
"{");
63 result.push_back(std::shared_ptr<SkinDef>(curr_skin.release()));
76 fmt::format(
"Skin '{}' in file '{}' not properly closed with '}}'",
77 curr_skin->name, stream->getName()));
78 result.push_back(std::shared_ptr<SkinDef>(curr_skin.release()));
81 catch (Ogre::Exception& e)
85 fmt::format(
"Error parsing skin file '{}', message: {}",
86 stream->getName(), e.getFullDescription()));
93 Ogre::StringVector params = Ogre::StringUtil::split(line,
"\t=,;\n");
94 for (
unsigned int i=0; i < params.size(); i++)
96 Ogre::StringUtil::trim(params[i]);
98 Ogre::String& attrib = params[0];
99 Ogre::StringUtil::toLowerCase(attrib);
101 if (attrib ==
"replacetexture" && params.size() == 3) { skin_def->
replace_textures.insert(std::make_pair(params[1], params[2]));
return; }
102 if (attrib ==
"replacematerial" && params.size() == 3) { skin_def->
replace_materials.insert(std::make_pair(params[1], params[2]));
return; }
103 if (attrib ==
"preview" && params.size() >= 2) { skin_def->
thumbnail = params[1];
return; }
104 if (attrib ==
"description" && params.size() >= 2) { skin_def->
description = params[1];
return; }
105 if (attrib ==
"authorname" && params.size() >= 2) { skin_def->
author_name = params[1];
return; }
106 if (attrib ==
"authorid" && params.size() == 2) { skin_def->
author_id =
PARSEINT(params[1]);
return; }
107 if (attrib ==
"guid" && params.size() >= 2) { skin_def->
guid = params[1]; Ogre::StringUtil::trim(skin_def->
guid); Ogre::StringUtil::toLowerCase(skin_def->
guid);
return; }
108 if (attrib ==
"name" && params.size() >= 2) { skin_def->
name = params[1]; Ogre::StringUtil::trim(skin_def->
name);
return; }