let's actually stage those changes...
This commit is contained in:
Vendored
+2
-2
@@ -5,7 +5,7 @@
|
|||||||
"name": "Debug",
|
"name": "Debug",
|
||||||
"type": "cppdbg",
|
"type": "cppdbg",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${workspaceFolder}/build/anm2ed",
|
"program": "${workspaceFolder}/out/build/linux-debug/bin/anm2ed",
|
||||||
"args": [],
|
"args": [],
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
"name": "Release",
|
"name": "Release",
|
||||||
"type": "cppdbg",
|
"type": "cppdbg",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${workspaceFolder}/build-release/anm2ed",
|
"program": "${workspaceFolder}/out/build/linux-release/bin/anm2ed",
|
||||||
"args": [],
|
"args": [],
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
|
|||||||
Vendored
+9
-3
@@ -2,9 +2,9 @@
|
|||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"tasks": [
|
"tasks": [
|
||||||
{
|
{
|
||||||
"label": "build",
|
"label": "build-debug",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "cmake --build build --target anm2ed",
|
"command": "cmake -S . -B out/build/linux-debug -DCMAKE_BUILD_TYPE=Debug && cmake --build out/build/linux-debug --target anm2ed",
|
||||||
"group": {
|
"group": {
|
||||||
"kind": "build",
|
"kind": "build",
|
||||||
"isDefault": true
|
"isDefault": true
|
||||||
@@ -16,11 +16,17 @@
|
|||||||
{
|
{
|
||||||
"label": "build-release",
|
"label": "build-release",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "cmake -S . -B build-release -DCMAKE_BUILD_TYPE=Release && cmake --build build-release --target anm2ed",
|
"command": "cmake -S . -B out/build/linux-release -DCMAKE_BUILD_TYPE=Release && cmake --build out/build/linux-release --target anm2ed",
|
||||||
"group": "build",
|
"group": "build",
|
||||||
"problemMatcher": [
|
"problemMatcher": [
|
||||||
"$gcc"
|
"$gcc"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "build",
|
||||||
|
"dependsOn": "build-debug",
|
||||||
|
"group": "build",
|
||||||
|
"problemMatcher": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-8
@@ -87,23 +87,30 @@ set(TINYXML2_SRC external/tinyxml2/tinyxml2.cpp)
|
|||||||
|
|
||||||
file(GLOB PROJECT_SRC CONFIGURE_DEPENDS
|
file(GLOB PROJECT_SRC CONFIGURE_DEPENDS
|
||||||
src/anm2/*.cpp
|
src/anm2/*.cpp
|
||||||
src/anm2/*.h
|
src/anm2/*.hpp
|
||||||
src/resource/*.cpp
|
src/resource/*.cpp
|
||||||
src/resource/*.h
|
src/resource/*.hpp
|
||||||
src/imgui/*.cpp
|
src/imgui/*.cpp
|
||||||
src/imgui/*.h
|
src/imgui/*.hpp
|
||||||
src/imgui/window/*.cpp
|
src/imgui/window/*.cpp
|
||||||
src/imgui/window/*.h
|
src/imgui/window/*.hpp
|
||||||
src/imgui/wizard/*.cpp
|
src/imgui/wizard/*.cpp
|
||||||
src/imgui/wizard/*.h
|
src/imgui/wizard/*.hpp
|
||||||
src/util/*.cpp
|
src/util/*.cpp
|
||||||
src/util/*.h
|
src/util/*.hpp
|
||||||
src/window/*.cpp
|
src/window/*.cpp
|
||||||
src/window/*.h
|
src/window/*.hpp
|
||||||
src/*.cpp
|
src/*.cpp
|
||||||
src/*.h)
|
src/*.hpp)
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME} ${GLAD_SRC} ${IMGUI_SRC} ${TINYXML2_SRC} ${PROJECT_SRC})
|
add_executable(${PROJECT_NAME} ${GLAD_SRC} ${IMGUI_SRC} ${TINYXML2_SRC} ${PROJECT_SRC})
|
||||||
|
set_target_properties(
|
||||||
|
${PROJECT_NAME}
|
||||||
|
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin"
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin"
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_BINARY_DIR}/bin"
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_BINARY_DIR}/bin")
|
||||||
|
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE IMGUI_DISABLE_OBSOLETE_FUNCTIONS IMGUI_DEBUG_PARANOID
|
target_compile_definitions(${PROJECT_NAME} PRIVATE IMGUI_DISABLE_OBSOLETE_FUNCTIONS IMGUI_DEBUG_PARANOID
|
||||||
IMGUI_ENABLE_DOCKING)
|
IMGUI_ENABLE_DOCKING)
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "x64-Debug",
|
"name": "windows-debug",
|
||||||
"generator": "Ninja",
|
"generator": "Ninja",
|
||||||
"configurationType": "Debug",
|
"configurationType": "Debug",
|
||||||
"inheritEnvironments": [
|
"inheritEnvironments": [
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
"cmakeCommandArgs": "-DCMAKE_BUILD_TYPE=\"Debug\""
|
"cmakeCommandArgs": "-DCMAKE_BUILD_TYPE=\"Debug\""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "x64-Release",
|
"name": "windows-release",
|
||||||
"generator": "Ninja",
|
"generator": "Ninja",
|
||||||
"configurationType": "Release",
|
"configurationType": "Release",
|
||||||
"inheritEnvironments": [
|
"inheritEnvironments": [
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#include "animation.h"
|
#include "animation.hpp"
|
||||||
|
|
||||||
#include "map_.h"
|
#include "map_.hpp"
|
||||||
#include "math_.h"
|
#include "math_.hpp"
|
||||||
#include "unordered_map_.h"
|
#include "unordered_map_.hpp"
|
||||||
#include "xml_.h"
|
#include "xml_.hpp"
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "item.h"
|
#include "item.hpp"
|
||||||
|
|
||||||
namespace anm2ed::anm2
|
namespace anm2ed::anm2
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "animations.h"
|
#include "animations.hpp"
|
||||||
|
|
||||||
#include "xml_.h"
|
#include "xml_.hpp"
|
||||||
|
|
||||||
using namespace tinyxml2;
|
using namespace tinyxml2;
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "animation.h"
|
#include "animation.hpp"
|
||||||
|
|
||||||
namespace anm2ed::anm2
|
namespace anm2ed::anm2
|
||||||
{
|
{
|
||||||
|
|||||||
+7
-7
@@ -1,15 +1,15 @@
|
|||||||
#include "anm2.h"
|
#include "anm2.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "file_.h"
|
#include "file_.hpp"
|
||||||
#include "map_.h"
|
#include "map_.hpp"
|
||||||
#include "time_.h"
|
#include "time_.hpp"
|
||||||
#include "vector_.h"
|
#include "vector_.hpp"
|
||||||
#include "working_directory.h"
|
#include "working_directory.hpp"
|
||||||
#include "xml_.h"
|
#include "xml_.hpp"
|
||||||
|
|
||||||
using namespace tinyxml2;
|
using namespace tinyxml2;
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
|
|||||||
+4
-4
@@ -4,11 +4,11 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <tinyxml2/tinyxml2.h>
|
#include <tinyxml2/tinyxml2.h>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.hpp"
|
||||||
|
|
||||||
#include "animations.h"
|
#include "animations.hpp"
|
||||||
#include "content.h"
|
#include "content.hpp"
|
||||||
#include "info.h"
|
#include "info.hpp"
|
||||||
|
|
||||||
namespace anm2ed::anm2
|
namespace anm2ed::anm2
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "anm2.h"
|
#include "anm2.hpp"
|
||||||
|
|
||||||
#include "vector_.h"
|
#include "vector_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#include "anm2.h"
|
#include "anm2.hpp"
|
||||||
|
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
#include "map_.h"
|
#include "map_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#include "anm2.h"
|
#include "anm2.hpp"
|
||||||
|
|
||||||
#include "map_.h"
|
#include "map_.hpp"
|
||||||
#include "types.h"
|
#include "types.hpp"
|
||||||
#include "unordered_map_.h"
|
#include "unordered_map_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#include "anm2.h"
|
#include "anm2.hpp"
|
||||||
|
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
#include "map_.h"
|
#include "map_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#include "anm2.h"
|
#include "anm2.hpp"
|
||||||
|
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
#include "map_.h"
|
#include "map_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#include "anm2.h"
|
#include "anm2.hpp"
|
||||||
|
|
||||||
#include "map_.h"
|
#include "map_.hpp"
|
||||||
#include "path_.h"
|
#include "path_.hpp"
|
||||||
#include "working_directory.h"
|
#include "working_directory.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "anm2.h"
|
#include "anm2.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@@ -8,9 +8,9 @@
|
|||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "map_.h"
|
#include "map_.hpp"
|
||||||
#include "path_.h"
|
#include "path_.hpp"
|
||||||
#include "working_directory.h"
|
#include "working_directory.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "icon.h"
|
#include "icon.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
|
|
||||||
#include <glm/glm/vec2.hpp>
|
#include <glm/glm/vec2.hpp>
|
||||||
#include <glm/glm/vec3.hpp>
|
#include <glm/glm/vec3.hpp>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "content.h"
|
#include "content.hpp"
|
||||||
|
|
||||||
using namespace tinyxml2;
|
using namespace tinyxml2;
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "event.h"
|
#include "event.hpp"
|
||||||
#include "layer.h"
|
#include "layer.hpp"
|
||||||
#include "null.h"
|
#include "null.hpp"
|
||||||
#include "sound.h"
|
#include "sound.hpp"
|
||||||
#include "spritesheet.h"
|
#include "spritesheet.hpp"
|
||||||
|
|
||||||
namespace anm2ed::anm2
|
namespace anm2ed::anm2
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
#include "event.h"
|
#include "event.hpp"
|
||||||
|
|
||||||
#include "xml_.h"
|
#include "xml_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
using namespace tinyxml2;
|
using namespace tinyxml2;
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
#include "frame.h"
|
#include "frame.hpp"
|
||||||
|
|
||||||
#include "math_.h"
|
#include "math_.hpp"
|
||||||
#include "xml_.h"
|
#include "xml_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
using namespace tinyxml2;
|
using namespace tinyxml2;
|
||||||
|
|||||||
+2
-2
@@ -4,8 +4,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <tinyxml2/tinyxml2.h>
|
#include <tinyxml2/tinyxml2.h>
|
||||||
|
|
||||||
#include "anm2_type.h"
|
#include "anm2_type.hpp"
|
||||||
#include "types.h"
|
#include "types.hpp"
|
||||||
|
|
||||||
namespace anm2ed::anm2
|
namespace anm2ed::anm2
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
#include "info.h"
|
#include "info.hpp"
|
||||||
|
|
||||||
#include "xml_.h"
|
#include "xml_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
using namespace tinyxml2;
|
using namespace tinyxml2;
|
||||||
|
|||||||
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
#include "item.h"
|
#include "item.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
#include "vector_.h"
|
#include "vector_.hpp"
|
||||||
#include "xml_.h"
|
#include "xml_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
using namespace tinyxml2;
|
using namespace tinyxml2;
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "frame.h"
|
#include "frame.hpp"
|
||||||
|
|
||||||
namespace anm2ed::anm2
|
namespace anm2ed::anm2
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
#include "layer.h"
|
#include "layer.hpp"
|
||||||
|
|
||||||
#include "xml_.h"
|
#include "xml_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
using namespace tinyxml2;
|
using namespace tinyxml2;
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
#include "null.h"
|
#include "null.hpp"
|
||||||
|
|
||||||
#include "xml_.h"
|
#include "xml_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
using namespace tinyxml2;
|
using namespace tinyxml2;
|
||||||
|
|||||||
+4
-4
@@ -1,8 +1,8 @@
|
|||||||
#include "sound.h"
|
#include "sound.hpp"
|
||||||
|
|
||||||
#include "path_.h"
|
#include "path_.hpp"
|
||||||
#include "working_directory.h"
|
#include "working_directory.hpp"
|
||||||
#include "xml_.h"
|
#include "xml_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::resource;
|
using namespace anm2ed::resource;
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <tinyxml2/tinyxml2.h>
|
#include <tinyxml2/tinyxml2.h>
|
||||||
|
|
||||||
#include "audio.h"
|
#include "audio.hpp"
|
||||||
|
|
||||||
namespace anm2ed::anm2
|
namespace anm2ed::anm2
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "spritesheet.h"
|
#include "spritesheet.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@@ -6,10 +6,10 @@
|
|||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "map_.h"
|
#include "map_.hpp"
|
||||||
#include "path_.h"
|
#include "path_.hpp"
|
||||||
#include "working_directory.h"
|
#include "working_directory.hpp"
|
||||||
#include "xml_.h"
|
#include "xml_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::resource;
|
using namespace anm2ed::resource;
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <tinyxml2/tinyxml2.h>
|
#include <tinyxml2/tinyxml2.h>
|
||||||
|
|
||||||
#include "texture.h"
|
#include "texture.hpp"
|
||||||
#include "anm2_type.h"
|
#include "anm2_type.hpp"
|
||||||
#include "types.h"
|
#include "types.hpp"
|
||||||
#include "origin.h"
|
#include "origin.hpp"
|
||||||
|
|
||||||
namespace anm2ed::anm2
|
namespace anm2ed::anm2
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,603 @@
|
|||||||
|
#include "anm2.hpp"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
#include <format>
|
||||||
|
#include <tinyxml2/tinyxml2.h>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#include "../log.hpp"
|
||||||
|
#include "../util/path_.hpp"
|
||||||
|
#include "../util/working_directory.hpp"
|
||||||
|
#include "../util/xml_.hpp"
|
||||||
|
|
||||||
|
using namespace tinyxml2;
|
||||||
|
using namespace anm2ed::util;
|
||||||
|
|
||||||
|
namespace anm2ed::resource::anm2_new
|
||||||
|
{
|
||||||
|
Anm2::Item::Item(XMLElement* element, Type _type)
|
||||||
|
{
|
||||||
|
if (!element) return;
|
||||||
|
|
||||||
|
type = _type;
|
||||||
|
|
||||||
|
auto isFrameOwnerType =
|
||||||
|
_type == ROOT_ANIMATION || _type == LAYER_ANIMATION || _type == NULL_ANIMATION || _type == TRIGGERS;
|
||||||
|
auto isFrameLikeElement =
|
||||||
|
element->Name() && (std::strcmp(element->Name(), "Frame") == 0 || std::strcmp(element->Name(), "Trigger") == 0);
|
||||||
|
|
||||||
|
if (isFrameOwnerType && isFrameLikeElement)
|
||||||
|
{
|
||||||
|
ownerType = _type;
|
||||||
|
type = _type == TRIGGERS ? TRIGGER : FRAME;
|
||||||
|
|
||||||
|
switch (_type)
|
||||||
|
{
|
||||||
|
case ROOT_ANIMATION:
|
||||||
|
case NULL_ANIMATION:
|
||||||
|
element->QueryFloatAttribute("XPosition", &position.x);
|
||||||
|
element->QueryFloatAttribute("YPosition", &position.y);
|
||||||
|
element->QueryFloatAttribute("XScale", &scale.x);
|
||||||
|
element->QueryFloatAttribute("YScale", &scale.y);
|
||||||
|
element->QueryIntAttribute("Delay", &duration);
|
||||||
|
element->QueryBoolAttribute("Visible", &isVisible);
|
||||||
|
xml::query_color_attribute(element, "RedTint", tint.r);
|
||||||
|
xml::query_color_attribute(element, "GreenTint", tint.g);
|
||||||
|
xml::query_color_attribute(element, "BlueTint", tint.b);
|
||||||
|
xml::query_color_attribute(element, "AlphaTint", tint.a);
|
||||||
|
xml::query_color_attribute(element, "RedOffset", colorOffset.r);
|
||||||
|
xml::query_color_attribute(element, "GreenOffset", colorOffset.g);
|
||||||
|
xml::query_color_attribute(element, "BlueOffset", colorOffset.b);
|
||||||
|
element->QueryFloatAttribute("Rotation", &rotation);
|
||||||
|
element->QueryBoolAttribute("Interpolated", &isInterpolated);
|
||||||
|
break;
|
||||||
|
case LAYER_ANIMATION:
|
||||||
|
element->QueryIntAttribute("RegionId", ®ionID);
|
||||||
|
element->QueryFloatAttribute("XPosition", &position.x);
|
||||||
|
element->QueryFloatAttribute("YPosition", &position.y);
|
||||||
|
element->QueryFloatAttribute("XPivot", &pivot.x);
|
||||||
|
element->QueryFloatAttribute("YPivot", &pivot.y);
|
||||||
|
element->QueryFloatAttribute("XCrop", &crop.x);
|
||||||
|
element->QueryFloatAttribute("YCrop", &crop.y);
|
||||||
|
element->QueryFloatAttribute("Width", &size.x);
|
||||||
|
element->QueryFloatAttribute("Height", &size.y);
|
||||||
|
element->QueryFloatAttribute("XScale", &scale.x);
|
||||||
|
element->QueryFloatAttribute("YScale", &scale.y);
|
||||||
|
element->QueryIntAttribute("Delay", &duration);
|
||||||
|
element->QueryBoolAttribute("Visible", &isVisible);
|
||||||
|
xml::query_color_attribute(element, "RedTint", tint.r);
|
||||||
|
xml::query_color_attribute(element, "GreenTint", tint.g);
|
||||||
|
xml::query_color_attribute(element, "BlueTint", tint.b);
|
||||||
|
xml::query_color_attribute(element, "AlphaTint", tint.a);
|
||||||
|
xml::query_color_attribute(element, "RedOffset", colorOffset.r);
|
||||||
|
xml::query_color_attribute(element, "GreenOffset", colorOffset.g);
|
||||||
|
xml::query_color_attribute(element, "BlueOffset", colorOffset.b);
|
||||||
|
element->QueryFloatAttribute("Rotation", &rotation);
|
||||||
|
element->QueryBoolAttribute("Interpolated", &isInterpolated);
|
||||||
|
break;
|
||||||
|
case TRIGGERS:
|
||||||
|
{
|
||||||
|
element->QueryIntAttribute("EventId", &eventID);
|
||||||
|
element->QueryIntAttribute("AtFrame", &atFrame);
|
||||||
|
int soundID{};
|
||||||
|
if (element->QueryIntAttribute("SoundId", &soundID) == XML_SUCCESS) soundIDs.push_back(soundID);
|
||||||
|
for (auto* child = element->FirstChildElement("Sound"); child; child = child->NextSiblingElement("Sound"))
|
||||||
|
if (child->QueryIntAttribute("Id", &soundID) == XML_SUCCESS) soundIDs.push_back(soundID);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (_type)
|
||||||
|
{
|
||||||
|
case INFO:
|
||||||
|
xml::query_string_attribute(element, "CreatedBy", &createdBy);
|
||||||
|
xml::query_string_attribute(element, "CreatedOn", &createdOn);
|
||||||
|
element->QueryIntAttribute("Fps", &fps);
|
||||||
|
element->QueryIntAttribute("Version", &version);
|
||||||
|
break;
|
||||||
|
case SPRITESHEET:
|
||||||
|
element->QueryIntAttribute("Id", &id);
|
||||||
|
xml::query_path_attribute(element, "Path", &path);
|
||||||
|
path = util::path::lower_case_backslash_handle(path);
|
||||||
|
texture = Texture(path);
|
||||||
|
break;
|
||||||
|
case REGION:
|
||||||
|
{
|
||||||
|
element->QueryIntAttribute("Id", &id);
|
||||||
|
xml::query_string_attribute(element, "Name", &name);
|
||||||
|
element->QueryFloatAttribute("XCrop", &crop.x);
|
||||||
|
element->QueryFloatAttribute("YCrop", &crop.y);
|
||||||
|
element->QueryFloatAttribute("Width", &size.x);
|
||||||
|
element->QueryFloatAttribute("Height", &size.y);
|
||||||
|
|
||||||
|
auto* origin = element->Attribute("Origin");
|
||||||
|
if (origin && std::string(origin) == "TopLeft")
|
||||||
|
pivot = {};
|
||||||
|
else if (origin && std::string(origin) == "Center")
|
||||||
|
pivot = glm::vec2((int)(size.x / 2.0f), (int)(size.y / 2.0f));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
element->QueryFloatAttribute("XPivot", &pivot.x);
|
||||||
|
element->QueryFloatAttribute("YPivot", &pivot.y);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case LAYER:
|
||||||
|
element->QueryIntAttribute("Id", &id);
|
||||||
|
xml::query_string_attribute(element, "Name", &name);
|
||||||
|
element->QueryIntAttribute("SpritesheetId", &spritesheetID);
|
||||||
|
break;
|
||||||
|
case NULL_:
|
||||||
|
element->QueryIntAttribute("Id", &id);
|
||||||
|
xml::query_string_attribute(element, "Name", &name);
|
||||||
|
element->QueryBoolAttribute("ShowRect", &isShowRect);
|
||||||
|
break;
|
||||||
|
case EVENT:
|
||||||
|
element->QueryIntAttribute("Id", &id);
|
||||||
|
xml::query_string_attribute(element, "Name", &name);
|
||||||
|
break;
|
||||||
|
case SOUND:
|
||||||
|
element->QueryIntAttribute("Id", &id);
|
||||||
|
xml::query_path_attribute(element, "Path", &path);
|
||||||
|
path = util::path::lower_case_backslash_handle(path);
|
||||||
|
sound = Audio(path);
|
||||||
|
break;
|
||||||
|
case ANIMATION:
|
||||||
|
xml::query_string_attribute(element, "Name", &name);
|
||||||
|
element->QueryIntAttribute("FrameNum", &frameNum);
|
||||||
|
element->QueryBoolAttribute("Loop", &isLoop);
|
||||||
|
break;
|
||||||
|
case ROOT_ANIMATION:
|
||||||
|
case TRIGGERS:
|
||||||
|
break;
|
||||||
|
case LAYER_ANIMATION:
|
||||||
|
element->QueryIntAttribute("LayerId", &itemID);
|
||||||
|
element->QueryBoolAttribute("Visible", &isVisible);
|
||||||
|
break;
|
||||||
|
case NULL_ANIMATION:
|
||||||
|
element->QueryIntAttribute("NullId", &itemID);
|
||||||
|
element->QueryBoolAttribute("Visible", &isVisible);
|
||||||
|
break;
|
||||||
|
case FRAME:
|
||||||
|
case TRIGGER:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XMLElement* Anm2::Item::to_element(XMLDocument& document) const
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case INFO:
|
||||||
|
{
|
||||||
|
auto* element = document.NewElement("Info");
|
||||||
|
element->SetAttribute("CreatedBy", createdBy.c_str());
|
||||||
|
element->SetAttribute("CreatedOn", createdOn.c_str());
|
||||||
|
element->SetAttribute("Fps", fps);
|
||||||
|
element->SetAttribute("Version", version);
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
case SPRITESHEET:
|
||||||
|
{
|
||||||
|
auto* element = document.NewElement("Spritesheet");
|
||||||
|
element->SetAttribute("Id", id);
|
||||||
|
auto pathString = util::path::to_utf8(path);
|
||||||
|
element->SetAttribute("Path", pathString.c_str());
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
case REGION:
|
||||||
|
{
|
||||||
|
auto* element = document.NewElement("Region");
|
||||||
|
element->SetAttribute("Id", id);
|
||||||
|
element->SetAttribute("Name", name.c_str());
|
||||||
|
element->SetAttribute("XCrop", crop.x);
|
||||||
|
element->SetAttribute("YCrop", crop.y);
|
||||||
|
element->SetAttribute("Width", size.x);
|
||||||
|
element->SetAttribute("Height", size.y);
|
||||||
|
element->SetAttribute("XPivot", pivot.x);
|
||||||
|
element->SetAttribute("YPivot", pivot.y);
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
case LAYER:
|
||||||
|
{
|
||||||
|
auto* element = document.NewElement("Layer");
|
||||||
|
element->SetAttribute("Id", id);
|
||||||
|
element->SetAttribute("Name", name.c_str());
|
||||||
|
element->SetAttribute("SpritesheetId", spritesheetID);
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
case NULL_:
|
||||||
|
{
|
||||||
|
auto* element = document.NewElement("Null");
|
||||||
|
element->SetAttribute("Id", id);
|
||||||
|
element->SetAttribute("Name", name.c_str());
|
||||||
|
if (isShowRect) element->SetAttribute("ShowRect", isShowRect);
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
case EVENT:
|
||||||
|
{
|
||||||
|
auto* element = document.NewElement("Event");
|
||||||
|
element->SetAttribute("Id", id);
|
||||||
|
element->SetAttribute("Name", name.c_str());
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
case SOUND:
|
||||||
|
{
|
||||||
|
auto* element = document.NewElement("Sound");
|
||||||
|
element->SetAttribute("Id", id);
|
||||||
|
auto pathString = util::path::to_utf8(path);
|
||||||
|
element->SetAttribute("Path", pathString.c_str());
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
case ANIMATION:
|
||||||
|
{
|
||||||
|
auto* element = document.NewElement("Animation");
|
||||||
|
element->SetAttribute("Name", name.c_str());
|
||||||
|
element->SetAttribute("FrameNum", frameNum);
|
||||||
|
element->SetAttribute("Loop", isLoop);
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
case ROOT_ANIMATION:
|
||||||
|
return document.NewElement("RootAnimation");
|
||||||
|
case LAYER_ANIMATION:
|
||||||
|
{
|
||||||
|
auto* element = document.NewElement("LayerAnimation");
|
||||||
|
element->SetAttribute("LayerId", itemID);
|
||||||
|
element->SetAttribute("Visible", isVisible);
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
case NULL_ANIMATION:
|
||||||
|
{
|
||||||
|
auto* element = document.NewElement("NullAnimation");
|
||||||
|
element->SetAttribute("NullId", itemID);
|
||||||
|
element->SetAttribute("Visible", isVisible);
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
case TRIGGERS:
|
||||||
|
return document.NewElement("Triggers");
|
||||||
|
case TRIGGER:
|
||||||
|
{
|
||||||
|
auto* element = document.NewElement("Trigger");
|
||||||
|
if (eventID != -1) element->SetAttribute("EventId", eventID);
|
||||||
|
for (auto soundID : soundIDs)
|
||||||
|
{
|
||||||
|
if (soundID == -1) continue;
|
||||||
|
auto* soundElement = element->InsertNewChildElement("Sound");
|
||||||
|
soundElement->SetAttribute("Id", soundID);
|
||||||
|
}
|
||||||
|
element->SetAttribute("AtFrame", atFrame);
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
case FRAME:
|
||||||
|
{
|
||||||
|
auto* element = document.NewElement("Frame");
|
||||||
|
|
||||||
|
if (ownerType == LAYER_ANIMATION && regionID != -1) element->SetAttribute("RegionId", regionID);
|
||||||
|
element->SetAttribute("XPosition", position.x);
|
||||||
|
element->SetAttribute("YPosition", position.y);
|
||||||
|
|
||||||
|
if (ownerType == LAYER_ANIMATION)
|
||||||
|
{
|
||||||
|
element->SetAttribute("XPivot", pivot.x);
|
||||||
|
element->SetAttribute("YPivot", pivot.y);
|
||||||
|
element->SetAttribute("XCrop", crop.x);
|
||||||
|
element->SetAttribute("YCrop", crop.y);
|
||||||
|
element->SetAttribute("Width", size.x);
|
||||||
|
element->SetAttribute("Height", size.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
element->SetAttribute("XScale", scale.x);
|
||||||
|
element->SetAttribute("YScale", scale.y);
|
||||||
|
element->SetAttribute("Delay", duration);
|
||||||
|
element->SetAttribute("Visible", isVisible);
|
||||||
|
element->SetAttribute("RedTint", (int)glm::clamp(tint.r * 255.0f, 0.0f, 255.0f));
|
||||||
|
element->SetAttribute("GreenTint", (int)glm::clamp(tint.g * 255.0f, 0.0f, 255.0f));
|
||||||
|
element->SetAttribute("BlueTint", (int)glm::clamp(tint.b * 255.0f, 0.0f, 255.0f));
|
||||||
|
element->SetAttribute("AlphaTint", (int)glm::clamp(tint.a * 255.0f, 0.0f, 255.0f));
|
||||||
|
element->SetAttribute("RedOffset", (int)glm::clamp(colorOffset.r * 255.0f, 0.0f, 255.0f));
|
||||||
|
element->SetAttribute("GreenOffset", (int)glm::clamp(colorOffset.g * 255.0f, 0.0f, 255.0f));
|
||||||
|
element->SetAttribute("BlueOffset", (int)glm::clamp(colorOffset.b * 255.0f, 0.0f, 255.0f));
|
||||||
|
element->SetAttribute("Rotation", rotation);
|
||||||
|
element->SetAttribute("Interpolated", isInterpolated);
|
||||||
|
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return document.NewElement("Item");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Anm2::Item::to_string() const
|
||||||
|
{
|
||||||
|
XMLDocument document;
|
||||||
|
document.InsertEndChild(to_element(document));
|
||||||
|
return xml::document_to_string(document);
|
||||||
|
}
|
||||||
|
|
||||||
|
Anm2::Anm2(const std::filesystem::path& path)
|
||||||
|
{
|
||||||
|
XMLDocument document;
|
||||||
|
auto pathString = util::path::to_utf8(path);
|
||||||
|
|
||||||
|
if (document.LoadFile(pathString.c_str()) != XML_SUCCESS)
|
||||||
|
{
|
||||||
|
logger.error(std::format("Failed to initialize anm2: {} ({})", pathString, document.ErrorStr()));
|
||||||
|
isValid = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
WorkingDirectory workingDirectory(path, WorkingDirectory::FILE);
|
||||||
|
|
||||||
|
this->path = path;
|
||||||
|
isValid = true;
|
||||||
|
|
||||||
|
auto item_add = [&](Item item) { items.emplace_back(std::move(item)); };
|
||||||
|
|
||||||
|
if (auto* root = document.RootElement())
|
||||||
|
{
|
||||||
|
if (auto* infoElement = root->FirstChildElement("Info")) item_add(Item(infoElement, INFO));
|
||||||
|
|
||||||
|
if (auto* contentElement = root->FirstChildElement("Content"))
|
||||||
|
{
|
||||||
|
if (auto* spritesheetsElement = contentElement->FirstChildElement("Spritesheets"))
|
||||||
|
{
|
||||||
|
for (auto* child = spritesheetsElement->FirstChildElement("Spritesheet"); child;
|
||||||
|
child = child->NextSiblingElement("Spritesheet"))
|
||||||
|
{
|
||||||
|
auto spritesheet = Item(child, SPRITESHEET);
|
||||||
|
auto spritesheetID = spritesheet.id;
|
||||||
|
item_add(spritesheet);
|
||||||
|
|
||||||
|
for (auto* regionChild = child->FirstChildElement("Region"); regionChild;
|
||||||
|
regionChild = regionChild->NextSiblingElement("Region"))
|
||||||
|
{
|
||||||
|
auto region = Item(regionChild, REGION);
|
||||||
|
region.itemID = spritesheetID;
|
||||||
|
item_add(region);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auto* layersElement = contentElement->FirstChildElement("Layers"))
|
||||||
|
for (auto* child = layersElement->FirstChildElement("Layer"); child;
|
||||||
|
child = child->NextSiblingElement("Layer"))
|
||||||
|
item_add(Item(child, LAYER));
|
||||||
|
|
||||||
|
if (auto* nullsElement = contentElement->FirstChildElement("Nulls"))
|
||||||
|
for (auto* child = nullsElement->FirstChildElement("Null"); child; child = child->NextSiblingElement("Null"))
|
||||||
|
item_add(Item(child, NULL_));
|
||||||
|
|
||||||
|
if (auto* eventsElement = contentElement->FirstChildElement("Events"))
|
||||||
|
for (auto* child = eventsElement->FirstChildElement("Event"); child;
|
||||||
|
child = child->NextSiblingElement("Event"))
|
||||||
|
item_add(Item(child, EVENT));
|
||||||
|
|
||||||
|
if (auto* soundsElement = contentElement->FirstChildElement("Sounds"))
|
||||||
|
for (auto* child = soundsElement->FirstChildElement("Sound"); child;
|
||||||
|
child = child->NextSiblingElement("Sound"))
|
||||||
|
item_add(Item(child, SOUND));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auto* animationsElement = root->FirstChildElement("Animations"))
|
||||||
|
{
|
||||||
|
int animationIndex = 0;
|
||||||
|
for (auto* animationElement = animationsElement->FirstChildElement("Animation"); animationElement;
|
||||||
|
animationElement = animationElement->NextSiblingElement("Animation"))
|
||||||
|
{
|
||||||
|
auto animation = Item(animationElement, ANIMATION);
|
||||||
|
animation.id = animationIndex++;
|
||||||
|
item_add(animation);
|
||||||
|
|
||||||
|
if (auto* rootAnimationElement = animationElement->FirstChildElement("RootAnimation"))
|
||||||
|
{
|
||||||
|
Item rootAnimation{};
|
||||||
|
rootAnimation.type = ROOT_ANIMATION;
|
||||||
|
rootAnimation.animationID = animation.id;
|
||||||
|
item_add(rootAnimation);
|
||||||
|
|
||||||
|
for (auto* frameElement = rootAnimationElement->FirstChildElement("Frame"); frameElement;
|
||||||
|
frameElement = frameElement->NextSiblingElement("Frame"))
|
||||||
|
{
|
||||||
|
auto frame = Item(frameElement, ROOT_ANIMATION);
|
||||||
|
frame.animationID = animation.id;
|
||||||
|
frame.ownerID = -1;
|
||||||
|
item_add(frame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auto* layerAnimationsElement = animationElement->FirstChildElement("LayerAnimations"))
|
||||||
|
{
|
||||||
|
for (auto* layerAnimationElement = layerAnimationsElement->FirstChildElement("LayerAnimation");
|
||||||
|
layerAnimationElement;
|
||||||
|
layerAnimationElement = layerAnimationElement->NextSiblingElement("LayerAnimation"))
|
||||||
|
{
|
||||||
|
auto layerAnimation = Item(layerAnimationElement, LAYER_ANIMATION);
|
||||||
|
layerAnimation.animationID = animation.id;
|
||||||
|
item_add(layerAnimation);
|
||||||
|
|
||||||
|
for (auto* frameElement = layerAnimationElement->FirstChildElement("Frame"); frameElement;
|
||||||
|
frameElement = frameElement->NextSiblingElement("Frame"))
|
||||||
|
{
|
||||||
|
auto frame = Item(frameElement, LAYER_ANIMATION);
|
||||||
|
frame.animationID = animation.id;
|
||||||
|
frame.ownerID = layerAnimation.itemID;
|
||||||
|
item_add(frame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auto* nullAnimationsElement = animationElement->FirstChildElement("NullAnimations"))
|
||||||
|
{
|
||||||
|
for (auto* nullAnimationElement = nullAnimationsElement->FirstChildElement("NullAnimation");
|
||||||
|
nullAnimationElement; nullAnimationElement = nullAnimationElement->NextSiblingElement("NullAnimation"))
|
||||||
|
{
|
||||||
|
auto nullAnimation = Item(nullAnimationElement, NULL_ANIMATION);
|
||||||
|
nullAnimation.animationID = animation.id;
|
||||||
|
item_add(nullAnimation);
|
||||||
|
|
||||||
|
for (auto* frameElement = nullAnimationElement->FirstChildElement("Frame"); frameElement;
|
||||||
|
frameElement = frameElement->NextSiblingElement("Frame"))
|
||||||
|
{
|
||||||
|
auto frame = Item(frameElement, NULL_ANIMATION);
|
||||||
|
frame.animationID = animation.id;
|
||||||
|
frame.ownerID = nullAnimation.itemID;
|
||||||
|
item_add(frame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (auto* triggersElement = animationElement->FirstChildElement("Triggers"))
|
||||||
|
{
|
||||||
|
Item triggers{};
|
||||||
|
triggers.type = TRIGGERS;
|
||||||
|
triggers.animationID = animation.id;
|
||||||
|
item_add(triggers);
|
||||||
|
|
||||||
|
for (auto* triggerElement = triggersElement->FirstChildElement("Trigger"); triggerElement;
|
||||||
|
triggerElement = triggerElement->NextSiblingElement("Trigger"))
|
||||||
|
{
|
||||||
|
auto trigger = Item(triggerElement, TRIGGERS);
|
||||||
|
trigger.animationID = animation.id;
|
||||||
|
trigger.ownerID = -1;
|
||||||
|
item_add(trigger);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info(std::format("Initialized anm2: {}", pathString));
|
||||||
|
}
|
||||||
|
|
||||||
|
XMLElement* Anm2::to_element(XMLDocument& document) const
|
||||||
|
{
|
||||||
|
auto* root = document.NewElement("AnimatedActor");
|
||||||
|
auto add_frames = [&](XMLElement* parent, Type ownerType, int animationID, int ownerID)
|
||||||
|
{
|
||||||
|
for (auto& item : items)
|
||||||
|
{
|
||||||
|
if (item.type != FRAME && item.type != TRIGGER) continue;
|
||||||
|
if (item.ownerType != ownerType) continue;
|
||||||
|
if (item.animationID != animationID) continue;
|
||||||
|
if (item.ownerID != ownerID) continue;
|
||||||
|
parent->InsertEndChild(item.to_element(document));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const Item* info = nullptr;
|
||||||
|
for (auto& item : items)
|
||||||
|
if (item.type == INFO)
|
||||||
|
{
|
||||||
|
info = &item;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (info) root->InsertEndChild(info->to_element(document));
|
||||||
|
|
||||||
|
auto* contentElement = document.NewElement("Content");
|
||||||
|
auto* spritesheetsElement = document.NewElement("Spritesheets");
|
||||||
|
auto* layersElement = document.NewElement("Layers");
|
||||||
|
auto* nullsElement = document.NewElement("Nulls");
|
||||||
|
auto* eventsElement = document.NewElement("Events");
|
||||||
|
auto* soundsElement = document.NewElement("Sounds");
|
||||||
|
|
||||||
|
for (auto& item : items)
|
||||||
|
{
|
||||||
|
if (item.type != SPRITESHEET) continue;
|
||||||
|
auto* spritesheetElement = item.to_element(document);
|
||||||
|
for (auto& region : items)
|
||||||
|
if (region.type == REGION && region.itemID == item.id)
|
||||||
|
spritesheetElement->InsertEndChild(region.to_element(document));
|
||||||
|
spritesheetsElement->InsertEndChild(spritesheetElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto& item : items)
|
||||||
|
if (item.type == LAYER) layersElement->InsertEndChild(item.to_element(document));
|
||||||
|
|
||||||
|
for (auto& item : items)
|
||||||
|
if (item.type == NULL_) nullsElement->InsertEndChild(item.to_element(document));
|
||||||
|
|
||||||
|
for (auto& item : items)
|
||||||
|
if (item.type == EVENT) eventsElement->InsertEndChild(item.to_element(document));
|
||||||
|
|
||||||
|
for (auto& item : items)
|
||||||
|
if (item.type == SOUND) soundsElement->InsertEndChild(item.to_element(document));
|
||||||
|
|
||||||
|
contentElement->InsertEndChild(spritesheetsElement);
|
||||||
|
contentElement->InsertEndChild(layersElement);
|
||||||
|
contentElement->InsertEndChild(nullsElement);
|
||||||
|
contentElement->InsertEndChild(eventsElement);
|
||||||
|
if (soundsElement->FirstChildElement("Sound")) contentElement->InsertEndChild(soundsElement);
|
||||||
|
root->InsertEndChild(contentElement);
|
||||||
|
|
||||||
|
auto* animationsElement = document.NewElement("Animations");
|
||||||
|
|
||||||
|
for (auto& animation : items)
|
||||||
|
{
|
||||||
|
if (animation.type != ANIMATION) continue;
|
||||||
|
auto* animationElement = animation.to_element(document);
|
||||||
|
|
||||||
|
auto* rootAnimationElement = document.NewElement("RootAnimation");
|
||||||
|
add_frames(rootAnimationElement, ROOT_ANIMATION, animation.id, -1);
|
||||||
|
animationElement->InsertEndChild(rootAnimationElement);
|
||||||
|
|
||||||
|
auto* layerAnimationsElement = document.NewElement("LayerAnimations");
|
||||||
|
for (auto& layerAnimation : items)
|
||||||
|
{
|
||||||
|
if (layerAnimation.type != LAYER_ANIMATION || layerAnimation.animationID != animation.id) continue;
|
||||||
|
auto* layerAnimationElement = layerAnimation.to_element(document);
|
||||||
|
add_frames(layerAnimationElement, LAYER_ANIMATION, animation.id, layerAnimation.itemID);
|
||||||
|
layerAnimationsElement->InsertEndChild(layerAnimationElement);
|
||||||
|
}
|
||||||
|
animationElement->InsertEndChild(layerAnimationsElement);
|
||||||
|
|
||||||
|
auto* nullAnimationsElement = document.NewElement("NullAnimations");
|
||||||
|
for (auto& nullAnimation : items)
|
||||||
|
{
|
||||||
|
if (nullAnimation.type != NULL_ANIMATION || nullAnimation.animationID != animation.id) continue;
|
||||||
|
auto* nullAnimationElement = nullAnimation.to_element(document);
|
||||||
|
add_frames(nullAnimationElement, NULL_ANIMATION, animation.id, nullAnimation.itemID);
|
||||||
|
nullAnimationsElement->InsertEndChild(nullAnimationElement);
|
||||||
|
}
|
||||||
|
animationElement->InsertEndChild(nullAnimationsElement);
|
||||||
|
|
||||||
|
auto* triggersElement = document.NewElement("Triggers");
|
||||||
|
add_frames(triggersElement, TRIGGERS, animation.id, -1);
|
||||||
|
animationElement->InsertEndChild(triggersElement);
|
||||||
|
|
||||||
|
animationsElement->InsertEndChild(animationElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
root->InsertEndChild(animationsElement);
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Anm2::serialize(const std::filesystem::path& path, std::string* errorString) const
|
||||||
|
{
|
||||||
|
XMLDocument document;
|
||||||
|
document.InsertEndChild(to_element(document));
|
||||||
|
|
||||||
|
auto pathString = util::path::to_utf8(path);
|
||||||
|
if (document.SaveFile(pathString.c_str()) != XML_SUCCESS)
|
||||||
|
{
|
||||||
|
if (errorString) *errorString = document.ErrorStr();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string Anm2::to_string() const
|
||||||
|
{
|
||||||
|
XMLDocument document;
|
||||||
|
document.InsertEndChild(to_element(document));
|
||||||
|
return xml::document_to_string(document);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
|
#include <string>
|
||||||
|
#include <tinyxml2/tinyxml2.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "../resource/audio.hpp"
|
||||||
|
#include "../resource/texture.hpp"
|
||||||
|
|
||||||
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
|
namespace anm2ed::resource::anm2_new
|
||||||
|
{
|
||||||
|
class Anm2
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum Type
|
||||||
|
{
|
||||||
|
NONE,
|
||||||
|
INFO,
|
||||||
|
SPRITESHEET,
|
||||||
|
REGION,
|
||||||
|
LAYER,
|
||||||
|
NULL_,
|
||||||
|
EVENT,
|
||||||
|
SOUND,
|
||||||
|
ANIMATION,
|
||||||
|
ROOT_ANIMATION,
|
||||||
|
LAYER_ANIMATION,
|
||||||
|
NULL_ANIMATION,
|
||||||
|
TRIGGERS,
|
||||||
|
FRAME,
|
||||||
|
TRIGGER
|
||||||
|
};
|
||||||
|
|
||||||
|
class Item
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Type type{NONE};
|
||||||
|
Type ownerType{NONE};
|
||||||
|
std::string name{};
|
||||||
|
bool isInterpolated{false};
|
||||||
|
bool isLoop{false};
|
||||||
|
bool isVisible{false};
|
||||||
|
bool isShowRect{false};
|
||||||
|
glm::vec2 crop{};
|
||||||
|
glm::vec2 pivot{};
|
||||||
|
glm::vec2 position{};
|
||||||
|
glm::vec2 scale{100, 100};
|
||||||
|
glm::vec2 size{};
|
||||||
|
glm::vec3 colorOffset{};
|
||||||
|
glm::vec4 tint{1, 1, 1, 1};
|
||||||
|
int atFrame{-1};
|
||||||
|
int duration{1};
|
||||||
|
int eventID{-1};
|
||||||
|
int fps{30};
|
||||||
|
int frameNum{1};
|
||||||
|
int id{-1};
|
||||||
|
int itemID{-1};
|
||||||
|
int ownerID{-1};
|
||||||
|
int animationID{-1};
|
||||||
|
int spritesheetID{-1};
|
||||||
|
int regionID{-1};
|
||||||
|
int version{0};
|
||||||
|
float rotation{};
|
||||||
|
resource::Texture texture{};
|
||||||
|
resource::Audio sound{};
|
||||||
|
std::filesystem::path path{};
|
||||||
|
std::string createdBy{};
|
||||||
|
std::string createdOn{};
|
||||||
|
std::vector<int> soundIDs{};
|
||||||
|
|
||||||
|
Item() = default;
|
||||||
|
Item(tinyxml2::XMLElement*, Type);
|
||||||
|
tinyxml2::XMLElement* to_element(tinyxml2::XMLDocument&) const;
|
||||||
|
std::string to_string() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<Item> items{};
|
||||||
|
std::filesystem::path path{};
|
||||||
|
bool isValid{false};
|
||||||
|
|
||||||
|
Anm2() = default;
|
||||||
|
Anm2(const std::filesystem::path&);
|
||||||
|
tinyxml2::XMLElement* to_element(tinyxml2::XMLDocument&) const;
|
||||||
|
bool serialize(const std::filesystem::path&, std::string* = nullptr) const;
|
||||||
|
std::string to_string() const;
|
||||||
|
};
|
||||||
|
}
|
||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
#include "canvas.h"
|
#include "canvas.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <glm/ext/matrix_clip_space.hpp>
|
#include <glm/ext/matrix_clip_space.hpp>
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
#include <glm/gtc/matrix_inverse.hpp>
|
#include <glm/gtc/matrix_inverse.hpp>
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
|
||||||
#include "math_.h"
|
#include "math_.hpp"
|
||||||
|
|
||||||
using namespace glm;
|
using namespace glm;
|
||||||
using namespace anm2ed::resource;
|
using namespace anm2ed::resource;
|
||||||
|
|||||||
+3
-3
@@ -3,10 +3,10 @@
|
|||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
#include "framebuffer.h"
|
#include "framebuffer.hpp"
|
||||||
#include "shader.h"
|
#include "shader.hpp"
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.hpp"
|
||||||
|
|
||||||
namespace anm2ed
|
namespace anm2ed
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
#include "clipboard.h"
|
#include "clipboard.hpp"
|
||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -1,19 +1,19 @@
|
|||||||
#include "dialog.h"
|
#include "dialog.hpp"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#elif __unix__
|
#elif __unix__
|
||||||
#else
|
#else
|
||||||
#include "log.h"
|
#include "log.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
#include "toast.h"
|
#include "toast.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <format>
|
#include <format>
|
||||||
|
|
||||||
#include "path_.h"
|
#include "path_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -1,13 +1,13 @@
|
|||||||
#include "document.h"
|
#include "document.hpp"
|
||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include <format>
|
#include <format>
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.hpp"
|
||||||
#include "path_.h"
|
#include "path_.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
#include "toast.h"
|
#include "toast.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::anm2;
|
using namespace anm2ed::anm2;
|
||||||
using namespace anm2ed::imgui;
|
using namespace anm2ed::imgui;
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "snapshots.h"
|
#include "snapshots.hpp"
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
#include "framebuffer.h"
|
#include "framebuffer.hpp"
|
||||||
|
|
||||||
#include "texture.h"
|
#include "texture.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::resource;
|
using namespace anm2ed::resource;
|
||||||
using namespace glm;
|
using namespace glm;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "dockspace.h"
|
#include "dockspace.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
|||||||
+16
-16
@@ -1,21 +1,21 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "documents.h"
|
#include "documents.hpp"
|
||||||
#include "taskbar.h"
|
#include "taskbar.hpp"
|
||||||
#include "window/animation_preview.h"
|
#include "window/animation_preview.hpp"
|
||||||
#include "window/animations.h"
|
#include "window/animations.hpp"
|
||||||
#include "window/regions.h"
|
#include "window/regions.hpp"
|
||||||
#include "window/events.h"
|
#include "window/events.hpp"
|
||||||
#include "window/frame_properties.h"
|
#include "window/frame_properties.hpp"
|
||||||
#include "window/layers.h"
|
#include "window/layers.hpp"
|
||||||
#include "window/nulls.h"
|
#include "window/nulls.hpp"
|
||||||
#include "window/onionskin.h"
|
#include "window/onionskin.hpp"
|
||||||
#include "window/sounds.h"
|
#include "window/sounds.hpp"
|
||||||
#include "window/spritesheet_editor.h"
|
#include "window/spritesheet_editor.hpp"
|
||||||
#include "window/spritesheets.h"
|
#include "window/spritesheets.hpp"
|
||||||
#include "window/timeline.h"
|
#include "window/timeline.hpp"
|
||||||
#include "window/tools.h"
|
#include "window/tools.hpp"
|
||||||
#include "window/welcome.h"
|
#include "window/welcome.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#include "documents.h"
|
#include "documents.hpp"
|
||||||
|
|
||||||
#include <format>
|
#include <format>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "path_.h"
|
#include "path_.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
#include "time_.h"
|
#include "time_.hpp"
|
||||||
#include "toast.h"
|
#include "toast.hpp"
|
||||||
#include "log.h"
|
#include "log.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::resource;
|
using namespace anm2ed::resource;
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "manager.h"
|
#include "manager.hpp"
|
||||||
#include "resources.h"
|
#include "resources.hpp"
|
||||||
#include "settings.h"
|
#include "settings.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
#include "taskbar.h"
|
#include "taskbar.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "imgui_.h"
|
#include "imgui_.hpp"
|
||||||
#include "path_.h"
|
#include "path_.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
#include "types.h"
|
#include "types.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "taskbar.h"
|
#include "taskbar.hpp"
|
||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <format>
|
#include <format>
|
||||||
@@ -7,12 +7,12 @@
|
|||||||
|
|
||||||
#include <imgui/imgui.h>
|
#include <imgui/imgui.h>
|
||||||
|
|
||||||
#include "document.h"
|
#include "document.hpp"
|
||||||
#include "log.h"
|
#include "log.hpp"
|
||||||
#include "path_.h"
|
#include "path_.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
#include "toast.h"
|
#include "toast.hpp"
|
||||||
#include "types.h"
|
#include "types.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::resource;
|
using namespace anm2ed::resource;
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
|
|||||||
+12
-12
@@ -1,18 +1,18 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "canvas.h"
|
#include "canvas.hpp"
|
||||||
#include "dialog.h"
|
#include "dialog.hpp"
|
||||||
#include "imgui_.h"
|
#include "imgui_.hpp"
|
||||||
#include "manager.h"
|
#include "manager.hpp"
|
||||||
#include "resources.h"
|
#include "resources.hpp"
|
||||||
#include "settings.h"
|
#include "settings.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
|
|
||||||
#include "wizard/about.h"
|
#include "wizard/about.hpp"
|
||||||
#include "wizard/change_all_frame_properties.h"
|
#include "wizard/change_all_frame_properties.hpp"
|
||||||
#include "wizard/configure.h"
|
#include "wizard/configure.hpp"
|
||||||
#include "wizard/generate_animation_from_grid.h"
|
#include "wizard/generate_animation_from_grid.hpp"
|
||||||
#include "wizard/render_animation.h"
|
#include "wizard/render_animation.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
#include "toast.h"
|
#include "toast.hpp"
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.hpp"
|
||||||
#include <imgui/imgui.h>
|
#include <imgui/imgui.h>
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "animation_preview.h"
|
#include "animation_preview.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
@@ -10,14 +10,14 @@
|
|||||||
|
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
|
||||||
#include "imgui_.h"
|
#include "imgui_.hpp"
|
||||||
#include "log.h"
|
#include "log.hpp"
|
||||||
#include "math_.h"
|
#include "math_.hpp"
|
||||||
#include "path_.h"
|
#include "path_.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
#include "toast.h"
|
#include "toast.hpp"
|
||||||
#include "tool.h"
|
#include "tool.hpp"
|
||||||
#include "types.h"
|
#include "types.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
@@ -265,14 +265,19 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
if (auto trigger = animation->triggers.frame_generate(playback.time, anm2::TRIGGER); trigger.isVisible)
|
if (auto trigger = animation->triggers.frame_generate(playback.time, anm2::TRIGGER); trigger.isVisible)
|
||||||
{
|
{
|
||||||
auto soundID = trigger.soundIDs.size() > 1
|
if (!trigger.soundIDs.empty())
|
||||||
? (int)trigger.soundIDs[math::random_in_range(0, trigger.soundIDs.size())]
|
{
|
||||||
: (int)trigger.soundIDs.front();
|
auto soundIndex = trigger.soundIDs.size() > 1
|
||||||
|
? (size_t)math::random_in_range(0.0f, (float)trigger.soundIDs.size())
|
||||||
|
: (size_t)0;
|
||||||
|
soundIndex = std::min(soundIndex, trigger.soundIDs.size() - 1);
|
||||||
|
auto soundID = trigger.soundIDs[soundIndex];
|
||||||
|
|
||||||
if (anm2.content.sounds.contains(soundID)) anm2.content.sounds[soundID].audio.play(false, mixer);
|
if (anm2.content.sounds.contains(soundID)) anm2.content.sounds[soundID].audio.play(false, mixer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto fps = std::max(anm2.info.fps, 1);
|
auto fps = std::max(anm2.info.fps, 1);
|
||||||
auto deltaSeconds = manager.isRecording ? (1.0f / (float)fps) : (1.0f / PLAYBACK_TICK_RATE);
|
auto deltaSeconds = manager.isRecording ? (1.0f / (float)fps) : (1.0f / PLAYBACK_TICK_RATE);
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
#include "audio_stream.h"
|
#include "audio_stream.hpp"
|
||||||
#include "canvas.h"
|
#include "canvas.hpp"
|
||||||
#include "manager.h"
|
#include "manager.hpp"
|
||||||
#include "resources.h"
|
#include "resources.hpp"
|
||||||
#include "settings.h"
|
#include "settings.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
#include "animations.h"
|
#include "animations.hpp"
|
||||||
|
|
||||||
#include <format>
|
#include <format>
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
#include "toast.h"
|
#include "toast.hpp"
|
||||||
#include "vector_.h"
|
#include "vector_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
using namespace anm2ed::resource;
|
using namespace anm2ed::resource;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "clipboard.h"
|
#include "clipboard.hpp"
|
||||||
#include "manager.h"
|
#include "manager.hpp"
|
||||||
#include "resources.h"
|
#include "resources.hpp"
|
||||||
#include "settings.h"
|
#include "settings.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#include "events.h"
|
#include "events.hpp"
|
||||||
|
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.hpp"
|
||||||
#include "map_.h"
|
#include "map_.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
#include "toast.h"
|
#include "toast.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
using namespace anm2ed::resource;
|
using namespace anm2ed::resource;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "clipboard.h"
|
#include "clipboard.hpp"
|
||||||
#include "manager.h"
|
#include "manager.hpp"
|
||||||
#include "resources.h"
|
#include "resources.hpp"
|
||||||
#include "settings.h"
|
#include "settings.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#include "frame_properties.h"
|
#include "frame_properties.hpp"
|
||||||
|
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "math_.h"
|
#include "math_.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
#include "types.h"
|
#include "types.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::util::math;
|
using namespace anm2ed::util::math;
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
#include <glm/vec2.hpp>
|
#include <glm/vec2.hpp>
|
||||||
|
|
||||||
#include "manager.h"
|
#include "manager.hpp"
|
||||||
#include "wizard/change_all_frame_properties.h"
|
#include "wizard/change_all_frame_properties.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#include "layers.h"
|
#include "layers.hpp"
|
||||||
|
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.hpp"
|
||||||
#include "map_.h"
|
#include "map_.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
#include "toast.h"
|
#include "toast.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
using namespace anm2ed::resource;
|
using namespace anm2ed::resource;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "clipboard.h"
|
#include "clipboard.hpp"
|
||||||
#include "manager.h"
|
#include "manager.hpp"
|
||||||
#include "resources.h"
|
#include "resources.hpp"
|
||||||
#include "settings.h"
|
#include "settings.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#include "nulls.h"
|
#include "nulls.hpp"
|
||||||
|
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.hpp"
|
||||||
#include "map_.h"
|
#include "map_.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
#include "toast.h"
|
#include "toast.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::resource;
|
using namespace anm2ed::resource;
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "clipboard.h"
|
#include "clipboard.hpp"
|
||||||
#include "manager.h"
|
#include "manager.hpp"
|
||||||
#include "resources.h"
|
#include "resources.hpp"
|
||||||
#include "settings.h"
|
#include "settings.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#include "onionskin.h"
|
#include "onionskin.hpp"
|
||||||
|
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
|
||||||
#include "imgui_.h"
|
#include "imgui_.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
using namespace glm;
|
using namespace glm;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "manager.h"
|
#include "manager.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "regions.h"
|
#include "regions.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
@@ -6,16 +6,16 @@
|
|||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <format>
|
#include <format>
|
||||||
|
|
||||||
#include "document.h"
|
#include "document.hpp"
|
||||||
#include "log.h"
|
#include "log.hpp"
|
||||||
#include "map_.h"
|
#include "map_.hpp"
|
||||||
#include "math_.h"
|
#include "math_.hpp"
|
||||||
#include "path_.h"
|
#include "path_.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
#include "toast.h"
|
#include "toast.hpp"
|
||||||
#include "vector_.h"
|
#include "vector_.hpp"
|
||||||
|
|
||||||
#include "../../util/map_.h"
|
#include "../../util/map_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
using namespace anm2ed::resource;
|
using namespace anm2ed::resource;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "clipboard.h"
|
#include "clipboard.hpp"
|
||||||
#include "manager.h"
|
#include "manager.hpp"
|
||||||
#include "resources.h"
|
#include "resources.hpp"
|
||||||
#include "settings.h"
|
#include "settings.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#include "sounds.h"
|
#include "sounds.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.hpp"
|
||||||
#include "path_.h"
|
#include "path_.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
#include "toast.h"
|
#include "toast.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "clipboard.h"
|
#include "clipboard.hpp"
|
||||||
#include "dialog.h"
|
#include "dialog.hpp"
|
||||||
#include "manager.h"
|
#include "manager.hpp"
|
||||||
#include "resources.h"
|
#include "resources.hpp"
|
||||||
#include "settings.h"
|
#include "settings.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
#include "spritesheet_editor.h"
|
#include "spritesheet_editor.hpp"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <format>
|
#include <format>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "imgui_.h"
|
#include "imgui_.hpp"
|
||||||
#include "imgui_internal.h"
|
#include "imgui_internal.h"
|
||||||
#include "math_.h"
|
#include "math_.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
#include "tool.h"
|
#include "tool.hpp"
|
||||||
#include "types.h"
|
#include "types.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
using namespace anm2ed::resource;
|
using namespace anm2ed::resource;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "canvas.h"
|
#include "canvas.hpp"
|
||||||
#include "manager.h"
|
#include "manager.hpp"
|
||||||
#include "resources.h"
|
#include "resources.hpp"
|
||||||
#include "settings.h"
|
#include "settings.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "spritesheets.h"
|
#include "spritesheets.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
@@ -8,12 +8,12 @@
|
|||||||
#include <format>
|
#include <format>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#include "document.h"
|
#include "document.hpp"
|
||||||
#include "log.h"
|
#include "log.hpp"
|
||||||
#include "path_.h"
|
#include "path_.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
#include "toast.h"
|
#include "toast.hpp"
|
||||||
#include "working_directory.h"
|
#include "working_directory.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
using namespace anm2ed::resource;
|
using namespace anm2ed::resource;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "clipboard.h"
|
#include "clipboard.hpp"
|
||||||
#include "dialog.h"
|
#include "dialog.hpp"
|
||||||
#include "manager.h"
|
#include "manager.hpp"
|
||||||
#include "resources.h"
|
#include "resources.hpp"
|
||||||
#include "settings.h"
|
#include "settings.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "timeline.h"
|
#include "timeline.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
#include <imgui_internal.h>
|
#include <imgui_internal.h>
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.hpp"
|
||||||
#include "toast.h"
|
#include "toast.hpp"
|
||||||
|
|
||||||
#include "vector_.h"
|
#include "vector_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::resource;
|
using namespace anm2ed::resource;
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "clipboard.h"
|
#include "clipboard.hpp"
|
||||||
#include "manager.h"
|
#include "manager.hpp"
|
||||||
#include "resources.h"
|
#include "resources.hpp"
|
||||||
#include "settings.h"
|
#include "settings.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
|
|
||||||
#include "tools.h"
|
#include "tools.hpp"
|
||||||
|
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
#include "tool.h"
|
#include "tool.hpp"
|
||||||
#include "types.h"
|
#include "types.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::resource;
|
using namespace anm2ed::resource;
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "manager.h"
|
#include "manager.hpp"
|
||||||
#include "resources.h"
|
#include "resources.hpp"
|
||||||
#include "settings.h"
|
#include "settings.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#include "welcome.h"
|
#include "welcome.hpp"
|
||||||
|
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
#include "path_.h"
|
#include "path_.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
using namespace anm2ed::resource;
|
using namespace anm2ed::resource;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "documents.h"
|
#include "documents.hpp"
|
||||||
#include "manager.h"
|
#include "manager.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
#include "taskbar.h"
|
#include "taskbar.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui
|
namespace anm2ed::imgui
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
#include "about.h"
|
#include "about.hpp"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::resource;
|
using namespace anm2ed::resource;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../../resources.h"
|
#include "../../resources.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui::wizard
|
namespace anm2ed::imgui::wizard
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#include "change_all_frame_properties.h"
|
#include "change_all_frame_properties.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "math_.h"
|
#include "math_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::util::math;
|
using namespace anm2ed::util::math;
|
||||||
using namespace glm;
|
using namespace glm;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "document.h"
|
#include "document.hpp"
|
||||||
#include "settings.h"
|
#include "settings.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui::wizard
|
namespace anm2ed::imgui::wizard
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "configure.h"
|
#include "configure.hpp"
|
||||||
|
|
||||||
#include "imgui_.h"
|
#include "imgui_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "manager.h"
|
#include "manager.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui::wizard
|
namespace anm2ed::imgui::wizard
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "generate_animation_from_grid.h"
|
#include "generate_animation_from_grid.hpp"
|
||||||
|
|
||||||
#include "math_.h"
|
#include "math_.hpp"
|
||||||
#include "types.h"
|
#include "types.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "canvas.h"
|
#include "canvas.hpp"
|
||||||
#include "document.h"
|
#include "document.hpp"
|
||||||
#include "resources.h"
|
#include "resources.hpp"
|
||||||
#include "settings.h"
|
#include "settings.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui::wizard
|
namespace anm2ed::imgui::wizard
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#include "render_animation.h"
|
#include "render_animation.hpp"
|
||||||
|
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "imgui_.h"
|
#include "imgui_.hpp"
|
||||||
#include "log.h"
|
#include "log.hpp"
|
||||||
#include "path_.h"
|
#include "path_.hpp"
|
||||||
#include "process_.h"
|
#include "process_.hpp"
|
||||||
#include "toast.h"
|
#include "toast.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::resource;
|
using namespace anm2ed::resource;
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "dialog.h"
|
#include "dialog.hpp"
|
||||||
#include "manager.h"
|
#include "manager.hpp"
|
||||||
#include "resources.h"
|
#include "resources.hpp"
|
||||||
|
|
||||||
namespace anm2ed::imgui::wizard
|
namespace anm2ed::imgui::wizard
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#include "anm2_window.hpp"
|
||||||
|
|
||||||
|
#include "imgui.h"
|
||||||
|
|
||||||
|
using namespace anm2ed::resource::anm2_new;
|
||||||
|
|
||||||
|
namespace anm2ed::imgui_new
|
||||||
|
{
|
||||||
|
void Window::update(Anm2& anm2, Anm2::Type type, Settings& settings)
|
||||||
|
{
|
||||||
|
if (ImGui::Begin("TestWindow", &settings.windowIsEvents))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../anm2_new/anm2.hpp"
|
||||||
|
#include "../settings.hpp"
|
||||||
|
|
||||||
|
namespace anm2ed::imgui_new
|
||||||
|
{
|
||||||
|
class Window
|
||||||
|
{
|
||||||
|
void update(anm2ed::resource::anm2_new::Anm2&, anm2ed::resource::anm2_new::Anm2::Type type, Settings&);
|
||||||
|
};
|
||||||
|
}
|
||||||
+8
-8
@@ -1,4 +1,4 @@
|
|||||||
#include "loader.h"
|
#include "loader.hpp"
|
||||||
|
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@@ -9,18 +9,18 @@
|
|||||||
|
|
||||||
#include <SDL3_mixer/SDL_mixer.h>
|
#include <SDL3_mixer/SDL_mixer.h>
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.hpp"
|
||||||
#include "sdl.h"
|
#include "sdl.hpp"
|
||||||
|
|
||||||
#include "imgui_.h"
|
#include "imgui_.hpp"
|
||||||
|
|
||||||
#include "snapshots.h"
|
#include "snapshots.hpp"
|
||||||
#include "socket.h"
|
#include "socket.hpp"
|
||||||
|
|
||||||
#include "util/math_.h"
|
#include "util/math_.hpp"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "util/path_.h"
|
#include "util/path_.hpp"
|
||||||
#include <DbgHelp.h>
|
#include <DbgHelp.h>
|
||||||
#include <format>
|
#include <format>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|||||||
+2
-2
@@ -7,8 +7,8 @@
|
|||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
#include "settings.h"
|
#include "settings.hpp"
|
||||||
#include "socket.h"
|
#include "socket.hpp"
|
||||||
|
|
||||||
namespace anm2ed
|
namespace anm2ed
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
#include "log.h"
|
#include "log.hpp"
|
||||||
|
|
||||||
#include <print>
|
#include <print>
|
||||||
|
|
||||||
#include "sdl.h"
|
#include "sdl.hpp"
|
||||||
#include "time_.h"
|
#include "time_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
#include "loader.h"
|
#include "loader.hpp"
|
||||||
#include "state.h"
|
#include "state.hpp"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define SDL_MAIN_HANDLED
|
#define SDL_MAIN_HANDLED
|
||||||
|
|||||||
+7
-7
@@ -1,16 +1,16 @@
|
|||||||
#include "manager.h"
|
#include "manager.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
#include <format>
|
#include <format>
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.hpp"
|
||||||
#include "path_.h"
|
#include "path_.hpp"
|
||||||
#include "sdl.h"
|
#include "sdl.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
#include "toast.h"
|
#include "toast.hpp"
|
||||||
#include "vector_.h"
|
#include "vector_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::types;
|
using namespace anm2ed::types;
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
|
|||||||
+3
-3
@@ -5,9 +5,9 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "document.h"
|
#include "document.hpp"
|
||||||
#include "settings.h"
|
#include "settings.hpp"
|
||||||
#include "strings.h"
|
#include "strings.hpp"
|
||||||
|
|
||||||
namespace anm2ed
|
namespace anm2ed
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
#include "playback.h"
|
#include "playback.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|||||||
+20
-10
@@ -1,4 +1,4 @@
|
|||||||
#include "render.h"
|
#include "render.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@@ -8,11 +8,11 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.hpp"
|
||||||
#include "path_.h"
|
#include "path_.hpp"
|
||||||
#include "process_.h"
|
#include "process_.hpp"
|
||||||
#include "sdl.h"
|
#include "sdl.hpp"
|
||||||
#include "string_.h"
|
#include "string_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
|
|
||||||
@@ -56,6 +56,8 @@ namespace anm2ed
|
|||||||
std::string audioInputArguments{};
|
std::string audioInputArguments{};
|
||||||
std::string audioOutputArguments{"-an"};
|
std::string audioOutputArguments{"-an"};
|
||||||
std::string command{};
|
std::string command{};
|
||||||
|
auto temporaryDirectory = framePaths.front().parent_path();
|
||||||
|
if (temporaryDirectory.empty()) temporaryDirectory = std::filesystem::temp_directory_path();
|
||||||
|
|
||||||
auto audio_remove = [&]()
|
auto audio_remove = [&]()
|
||||||
{
|
{
|
||||||
@@ -69,8 +71,8 @@ namespace anm2ed
|
|||||||
if (type != render::GIF && !audioStream.stream.empty() && audioStream.spec.freq > 0 &&
|
if (type != render::GIF && !audioStream.stream.empty() && audioStream.spec.freq > 0 &&
|
||||||
audioStream.spec.channels > 0)
|
audioStream.spec.channels > 0)
|
||||||
{
|
{
|
||||||
auto tempFilenameUtf8 = std::format("{}.f32", pathString);
|
auto tempFilenameUtf8 = std::format("anm2ed_audio_{}_{}.f32", std::hash<std::string>{}(pathString), SDL_GetTicks());
|
||||||
audioPath = std::filesystem::temp_directory_path() / path::from_utf8(tempFilenameUtf8);
|
audioPath = temporaryDirectory / path::from_utf8(tempFilenameUtf8);
|
||||||
|
|
||||||
std::ofstream audioFile(audioPath, std::ios::binary);
|
std::ofstream audioFile(audioPath, std::ios::binary);
|
||||||
|
|
||||||
@@ -103,7 +105,7 @@ namespace anm2ed
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto framesListPath = std::filesystem::temp_directory_path() / path::from_utf8(std::format(
|
auto framesListPath = temporaryDirectory / path::from_utf8(std::format(
|
||||||
"anm2ed_frames_{}_{}.txt", std::hash<std::string>{}(pathString), SDL_GetTicks())) ;
|
"anm2ed_frames_{}_{}.txt", std::hash<std::string>{}(pathString), SDL_GetTicks())) ;
|
||||||
std::ofstream framesListFile(framesListPath);
|
std::ofstream framesListFile(framesListPath);
|
||||||
if (!framesListFile)
|
if (!framesListFile)
|
||||||
@@ -176,7 +178,15 @@ namespace anm2ed
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
process.close();
|
auto ffmpegExitCode = process.close();
|
||||||
|
if (ffmpegExitCode != 0)
|
||||||
|
{
|
||||||
|
logger.error(std::format("FFmpeg exited with code {} while exporting {}", ffmpegExitCode, pathString));
|
||||||
|
std::error_code ec;
|
||||||
|
std::filesystem::remove(framesListPath, ec);
|
||||||
|
audio_remove();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
std::filesystem::remove(framesListPath, ec);
|
std::filesystem::remove(framesListPath, ec);
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "audio_stream.h"
|
#include "audio_stream.hpp"
|
||||||
#include "texture.h"
|
#include "texture.hpp"
|
||||||
|
|
||||||
namespace anm2ed::render
|
namespace anm2ed::render
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#include "audio.h"
|
#include "audio.hpp"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "file_.h"
|
#include "file_.hpp"
|
||||||
|
|
||||||
using namespace anm2ed::util;
|
using namespace anm2ed::util;
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user