From 359b1cb78135c9d92ad33d3c01181f63e460ac7c Mon Sep 17 00:00:00 2001 From: Justin Laughlin Date: Tue, 10 Dec 2024 11:49:16 -0800 Subject: [PATCH] Loading palette overrides instead of breaking now. --- lib/gltf.cpp | 2 +- lib/palettes_base.cpp | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/gltf.cpp b/lib/gltf.cpp index e846d5a2..c118ef01 100644 --- a/lib/gltf.cpp +++ b/lib/gltf.cpp @@ -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) { diff --git a/lib/palettes_base.cpp b/lib/palettes_base.cpp index 08ffc90f..35ee842a 100644 --- a/lib/palettes_base.cpp +++ b/lib/palettes_base.cpp @@ -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) {