Skip to content

Commit

Permalink
ed ror fix veget
Browse files Browse the repository at this point in the history
  • Loading branch information
cryham committed Feb 25, 2024
1 parent 5a3824c commit 07985e1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
11 changes: 11 additions & 0 deletions src/editor/ExportRoR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,17 @@ bool ExportRoR::CopyFile(const std::string& from, const std::string& to)
return true;
}

// rename colliding names with RoR
void ExportRoR::RenameMesh(std::string& mesh)
{
string name = mesh;
name = StringUtil::replaceAll(name, "palm2", "palm22");
if (name == mesh)
name = StringUtil::replaceAll(name, "palm", "palm11");
if (name != mesh)
gui->Exp(CGui::TXT, "renamed to: "+name);
mesh = name;
}

// ⚙️ Setup path, name, create dir
//------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/editor/ExportRoR.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class ExportRoR
// utils
Ogre::String strPos(const Ogre::Vector3& pos); // util convert SR pos to RoR pos
bool CopyFile(const std::string& from, const std::string& to); // both args are path with filenames
void RenameMesh(std::string& mesh); // colliding names with RoR

// packs
void ListPacks();
Expand Down
11 changes: 3 additions & 8 deletions src/editor/ExportRoR_Veget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ void ExportRoR::ExportVeget()
VegetLayer& vg = sc->vegLayersAll[sc->vegLayers[l]];
if (!vg.on)
continue;
const String mesh = vg.name;
String mesh = vg.name;
const string mapName = name + "-veget"+toStr(l)+".png";

// veget dens map
Expand Down Expand Up @@ -266,7 +266,7 @@ void ExportRoR::ExportVeget()
d = 0.f;
else
{ // check if in fluids
float fa = sc->GetDepthInFluids(Vector3(xw, 0.f, zw));
float fa = sc->GetDepthInFluids(Vector3(xw, h, zw));
if (fa > vg.maxDepth)
d = 0.f;
else
Expand Down Expand Up @@ -350,6 +350,7 @@ void ExportRoR::ExportVeget()
gui->Exp(CGui::WARN, "veget not found in old SR: "+mesh);
continue;
}
RenameMesh(mesh);
if (!AddPackFor(mesh)) //+
continue;

Expand All @@ -359,12 +360,6 @@ void ExportRoR::ExportVeget()
if (exists)
{
string name = mesh;
// rename colliding names with RoR
name = StringUtil::replaceAll(name, "palm2", "palm22");
if (name == mesh)
name = StringUtil::replaceAll(name, "palm", "palm11");
if (name != mesh)
gui->Exp(CGui::TXT, "renamed to: "+name);

if (!copyVeget)
++iVegetMesh;
Expand Down

0 comments on commit 07985e1

Please sign in to comment.