mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 15:44:56 +00:00
string_view refactor
This commit is contained in:
@@ -131,7 +131,7 @@ void Material::SectionPASS::constructNode(hecl::BlenderConnection::PyOutStream&
|
||||
TXTR::Extract(rs, txtrPath);
|
||||
}
|
||||
hecl::SystemString resPath = pakRouter.getResourceRelativePath(entry, txtrId);
|
||||
hecl::SystemUTF8View resPathView(resPath);
|
||||
hecl::SystemUTF8Conv resPathView(resPath);
|
||||
out.format("if '%s' in bpy.data.textures:\n"
|
||||
" image = bpy.data.images['%s']\n"
|
||||
" texture = bpy.data.textures[image.name]\n"
|
||||
@@ -142,7 +142,7 @@ void Material::SectionPASS::constructNode(hecl::BlenderConnection::PyOutStream&
|
||||
" texture.image = image\n"
|
||||
"tex_maps.append(texture)\n"
|
||||
"\n", texName.c_str(), texName.c_str(),
|
||||
resPathView.str().c_str(), texName.c_str());
|
||||
resPathView.c_str(), texName.c_str());
|
||||
if (uvAnim.size())
|
||||
{
|
||||
const UVAnimation& uva = uvAnim[0];
|
||||
|
||||
@@ -23,9 +23,9 @@ namespace DNAMP3
|
||||
{
|
||||
logvisor::Module Log("urde::DNAMP3");
|
||||
|
||||
static bool GetNoShare(const std::string& name)
|
||||
static bool GetNoShare(std::string_view name)
|
||||
{
|
||||
std::string lowerName = name;
|
||||
std::string lowerName(name);
|
||||
std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), tolower);
|
||||
if (!lowerName.compare(0, 7, "metroid"))
|
||||
return false;
|
||||
@@ -70,9 +70,9 @@ PAKBridge::PAKBridge(hecl::Database::Project& project,
|
||||
}
|
||||
}
|
||||
|
||||
static hecl::SystemString LayerName(const std::string& name)
|
||||
static hecl::SystemString LayerName(std::string_view name)
|
||||
{
|
||||
hecl::SystemString ret = hecl::SystemStringView(name).sys_str();
|
||||
hecl::SystemString ret(hecl::SystemStringConv(name).sys_str());
|
||||
for (auto& ch : ret)
|
||||
if (ch == _S('/') || ch == _S('\\'))
|
||||
ch = _S('-');
|
||||
@@ -96,7 +96,7 @@ void PAKBridge::build()
|
||||
}
|
||||
bool named;
|
||||
std::string bestName = m_pak.bestEntryName(entry, named);
|
||||
level.name = hecl::SystemStringView(bestName).sys_str();
|
||||
level.name = hecl::SystemStringConv(bestName).sys_str();
|
||||
level.areas.reserve(mlvl.areaCount);
|
||||
unsigned layerIdx = 0;
|
||||
|
||||
@@ -132,11 +132,11 @@ void PAKBridge::build()
|
||||
}
|
||||
if (areaDeps.name.empty())
|
||||
{
|
||||
areaDeps.name = hecl::SystemStringView(area.internalAreaName).sys_str();
|
||||
areaDeps.name = hecl::SystemStringConv(area.internalAreaName).sys_str();
|
||||
if (areaDeps.name.empty())
|
||||
{
|
||||
std::string idStr = area.areaMREAId.toString();
|
||||
areaDeps.name = _S("MREA_") + hecl::SystemStringView(idStr).sys_str();
|
||||
areaDeps.name = hecl::SystemString(_S("MREA_")) + hecl::SystemStringConv(idStr).c_str();
|
||||
}
|
||||
}
|
||||
hecl::SystemChar num[16];
|
||||
@@ -200,7 +200,7 @@ void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
||||
{
|
||||
addTo[overlay.cmdl] = std::make_pair(overlay.cskr, ci.cinf);
|
||||
cskrCinfToChar[overlay.cskr] = std::make_pair(entry.second.id,
|
||||
hecl::Format("%s.%s.CSKR", ci.name.c_str(), overlay.type.toString().c_str()));
|
||||
hecl::Format("%s.%.4s.CSKR", ci.name.c_str(), overlay.type.getChars()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,12 +28,12 @@ public:
|
||||
bool doExtract=true);
|
||||
void build();
|
||||
static ResExtractor<PAKBridge> LookupExtractor(const PAK& pak, const PAK::Entry& entry);
|
||||
inline const std::string& getName() const {return m_node.getName();}
|
||||
inline hecl::SystemString getLevelString() const {return m_levelString;}
|
||||
std::string_view getName() const {return m_node.getName();}
|
||||
hecl::SystemStringView getLevelString() const {return m_levelString;}
|
||||
|
||||
using PAKType = PAK;
|
||||
inline const PAKType& getPAK() const {return m_pak;}
|
||||
inline const nod::Node& getNode() const {return m_node;}
|
||||
const PAKType& getPAK() const {return m_pak;}
|
||||
const nod::Node& getNode() const {return m_node;}
|
||||
|
||||
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
|
||||
std::unordered_map<UniqueID64, std::pair<UniqueID64, UniqueID64>>& addTo,
|
||||
|
||||
@@ -212,9 +212,9 @@ const PAK::Entry* PAK::lookupEntry(const UniqueID64& id) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const PAK::Entry* PAK::lookupEntry(const std::string& name) const
|
||||
const PAK::Entry* PAK::lookupEntry(std::string_view name) const
|
||||
{
|
||||
auto result = m_nameMap.find(name);
|
||||
auto result = m_nameMap.find(name.data());
|
||||
if (result != m_nameMap.end())
|
||||
{
|
||||
auto result1 = m_entries.find(result->second);
|
||||
|
||||
@@ -64,7 +64,7 @@ struct PAK : BigDNA
|
||||
DECL_EXPLICIT_DNA
|
||||
|
||||
const Entry* lookupEntry(const UniqueID64& id) const;
|
||||
const Entry* lookupEntry(const std::string& name) const;
|
||||
const Entry* lookupEntry(std::string_view name) const;
|
||||
std::string bestEntryName(const Entry& entry, bool& named) const;
|
||||
|
||||
typedef UniqueID64 IDType;
|
||||
|
||||
@@ -19,9 +19,9 @@ struct STRG : ISTRG
|
||||
std::unordered_map<DNAFourCC, std::vector<std::string>*> langMap;
|
||||
std::map<std::string, int32_t> names;
|
||||
|
||||
int32_t lookupIdx(const std::string& name) const
|
||||
int32_t lookupIdx(std::string_view name) const
|
||||
{
|
||||
auto search = names.find(name);
|
||||
auto search = names.find(name.data());
|
||||
if (search == names.end())
|
||||
return -1;
|
||||
return search->second;
|
||||
|
||||
Reference in New Issue
Block a user