fix path issues

This commit is contained in:
2026-03-17 00:47:36 -04:00
parent a83dbd5b6c
commit 4f5966dad6
3 changed files with 6 additions and 7 deletions

View File

@@ -1 +1 @@
/home/anon/sda/Personal/Repos/anm2ed/out/build/linux-debug/compile_commands.json /home/anon/sda/Personal/Repos/anm2ed/build/compile_commands.json

View File

@@ -91,9 +91,10 @@ namespace anm2ed::anm2
Spritesheet::Spritesheet(const std::filesystem::path& directory, const std::filesystem::path& path) Spritesheet::Spritesheet(const std::filesystem::path& directory, const std::filesystem::path& path)
{ {
WorkingDirectory workingDirectory(directory); WorkingDirectory workingDirectory(directory);
auto loadPath = !path.empty() ? path::lower_case_backslash_handle(path) : this->path;
this->path = !path.empty() ? path::make_relative(path) : this->path; this->path = !path.empty() ? path::make_relative(path) : this->path;
this->path = path::lower_case_backslash_handle(this->path); this->path = path::lower_case_backslash_handle(this->path);
texture = Texture(this->path); texture = Texture(!loadPath.empty() ? loadPath : this->path);
} }
XMLElement* Spritesheet::to_element(XMLDocument& document, int id, Flags flags) XMLElement* Spritesheet::to_element(XMLDocument& document, int id, Flags flags)
@@ -234,9 +235,10 @@ namespace anm2ed::anm2
void Spritesheet::reload(const std::filesystem::path& directory, const std::filesystem::path& path) void Spritesheet::reload(const std::filesystem::path& directory, const std::filesystem::path& path)
{ {
WorkingDirectory workingDirectory(directory); WorkingDirectory workingDirectory(directory);
auto loadPath = !path.empty() ? path::lower_case_backslash_handle(path) : this->path;
this->path = !path.empty() ? path::make_relative(path) : this->path; this->path = !path.empty() ? path::make_relative(path) : this->path;
this->path = path::lower_case_backslash_handle(this->path); this->path = path::lower_case_backslash_handle(this->path);
texture = Texture(this->path); texture = Texture(!loadPath.empty() ? loadPath : this->path);
} }
bool Spritesheet::is_valid() { return texture.is_valid(); } bool Spritesheet::is_valid() { return texture.is_valid(); }

View File

@@ -1,8 +1,8 @@
#include "animation_preview.hpp" #include "animation_preview.hpp"
#include <algorithm> #include <algorithm>
#include <cmath>
#include <chrono> #include <chrono>
#include <cmath>
#include <filesystem> #include <filesystem>
#include <format> #include <format>
#include <map> #include <map>
@@ -105,7 +105,6 @@ namespace anm2ed::imgui
pixels[index + 2] = (uint8_t)glm::clamp((float)std::round((float)pixels[index + 2] / alphaUnit), 0.0f, 255.0f); pixels[index + 2] = (uint8_t)glm::clamp((float)std::round((float)pixels[index + 2] / alphaUnit), 0.0f, 255.0f);
} }
} }
<<<<<<< HEAD
bool render_audio_stream_generate(AudioStream& audioStream, std::map<int, anm2::Sound>& sounds, bool render_audio_stream_generate(AudioStream& audioStream, std::map<int, anm2::Sound>& sounds,
const std::vector<int>& frameSoundIDs, int fps) const std::vector<int>& frameSoundIDs, int fps)
@@ -151,8 +150,6 @@ namespace anm2ed::imgui
MIX_DestroyMixer(mixer); MIX_DestroyMixer(mixer);
return true; return true;
} }
=======
>>>>>>> f58d894 (Render animation fixes, vs code tasks)
} }
AnimationPreview::AnimationPreview() : Canvas(vec2()) {} AnimationPreview::AnimationPreview() : Canvas(vec2()) {}