Skip to content

Commit

Permalink
Loading palette overrides instead of breaking now.
Browse files Browse the repository at this point in the history
  • Loading branch information
justinlaughlin committed Dec 10, 2024
1 parent 124f19a commit 359b1cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/gltf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ int glTF_Builder::writeFile()
gltf << " ],\n\n";

// https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#reference-sampler
// see also: Texture::GenerateGLTexture()
// see also: Texture::Generate()
gltf << " \"samplers\" : [";
for (size_t i = 0; i != samplers.size(); ++i)
{
Expand Down
18 changes: 8 additions & 10 deletions lib/palettes_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,18 +443,16 @@ void PaletteRegistry::Load(const string& palette_filename)
{
pfile >> palname >> channeltype;
idx = GetIndexByName(palname);
if (idx == -1)
if (idx != -1)
{
AddPalette(palname);
idx = GetIndexByName(palname);
cout << "Reading palette: (" << idx+1 << ") " << palname << endl;
}
else
{
cout << "Error reading palette: " << palname
<< ". Palette with same name already exists." << endl;
break;
cout << "Warning: palette name <" << palname
<< "> already exists. Overriding..." << endl;
palettes.erase(palettes.begin() + idx);
}
// Add new palette
AddPalette(palname);
idx = GetIndexByName(palname);
cout << "Reading palette: (" << idx+1 << ") " << palname << endl;
}
else if (channeltype == "RGBf" && idx != -1)
{
Expand Down

0 comments on commit 359b1cb

Please sign in to comment.