Sound drag/drop

This commit is contained in:
2025-11-30 22:25:57 -05:00
parent d0221928aa
commit 300e322b9d
49 changed files with 1280230 additions and 210091 deletions

View File

@@ -13,7 +13,7 @@ namespace anm2ed::anm2
class Animation
{
public:
std::string name{"New Animation"};
std::string name{};
int frameNum{FRAME_NUM_MIN};
bool isLoop{true};
Item rootAnimation;

View File

@@ -38,9 +38,12 @@ namespace anm2ed::anm2
std::vector<std::string> Anm2::spritesheet_labels_get()
{
std::vector<std::string> labels{};
labels.emplace_back("None");
labels.emplace_back(localize.get(BASIC_NONE));
for (auto& [id, spritesheet] : content.spritesheets)
labels.emplace_back(std::format(SPRITESHEET_FORMAT, id, spritesheet.path.string()));
{
auto string = spritesheet.path.string();
labels.emplace_back(std::vformat(localize.get(FORMAT_SPRITESHEET), std::make_format_args(id, string)));
}
return labels;
}

View File

@@ -1,6 +1,7 @@
#pragma once
#include "icon.h"
#include "strings.h"
#include <glm/glm/vec2.hpp>
#include <glm/glm/vec3.hpp>
@@ -8,28 +9,30 @@
namespace anm2ed::anm2
{
extern const glm::vec4 ROOT_COLOR;
extern const glm::vec4 ROOT_COLOR_ACTIVE;
extern const glm::vec4 ROOT_COLOR_HOVERED;
inline const glm::vec4 ROOT_COLOR = glm::vec4(0.140f, 0.310f, 0.560f, 1.000f);
inline const glm::vec4 ROOT_COLOR_ACTIVE = glm::vec4(0.240f, 0.520f, 0.880f, 1.000f);
inline const glm::vec4 ROOT_COLOR_HOVERED = glm::vec4(0.320f, 0.640f, 1.000f, 1.000f);
extern const glm::vec4 LAYER_COLOR;
extern const glm::vec4 LAYER_COLOR_ACTIVE;
extern const glm::vec4 LAYER_COLOR_HOVERED;
inline const glm::vec4 LAYER_COLOR = glm::vec4(0.640f, 0.320f, 0.110f, 1.000f);
inline const glm::vec4 LAYER_COLOR_ACTIVE = glm::vec4(0.840f, 0.450f, 0.170f, 1.000f);
inline const glm::vec4 LAYER_COLOR_HOVERED = glm::vec4(0.960f, 0.560f, 0.240f, 1.000f);
extern const glm::vec4 NULL_COLOR;
extern const glm::vec4 NULL_COLOR_ACTIVE;
extern const glm::vec4 NULL_COLOR_HOVERED;
inline const glm::vec4 NULL_COLOR = glm::vec4(0.140f, 0.430f, 0.200f, 1.000f);
inline const glm::vec4 NULL_COLOR_ACTIVE = glm::vec4(0.250f, 0.650f, 0.350f, 1.000f);
inline const glm::vec4 NULL_COLOR_HOVERED = glm::vec4(0.350f, 0.800f, 0.480f, 1.000f);
extern const glm::vec4 TRIGGER_COLOR;
extern const glm::vec4 TRIGGER_COLOR_ACTIVE;
extern const glm::vec4 TRIGGER_COLOR_HOVERED;
inline const glm::vec4 TRIGGER_COLOR = glm::vec4(0.620f, 0.150f, 0.260f, 1.000f);
inline const glm::vec4 TRIGGER_COLOR_ACTIVE = glm::vec4(0.820f, 0.250f, 0.380f, 1.000f);
inline const glm::vec4 TRIGGER_COLOR_HOVERED = glm::vec4(0.950f, 0.330f, 0.490f, 1.000f);
#define TYPE_LIST \
X(NONE, "", "", resource::icon::NONE, glm::vec4(), glm::vec4(), glm::vec4()) \
X(ROOT, "Root", "RootAnimation", resource::icon::ROOT, ROOT_COLOR, ROOT_COLOR_ACTIVE, ROOT_COLOR_HOVERED) \
X(LAYER, "Layer", "LayerAnimation", resource::icon::LAYER, LAYER_COLOR, LAYER_COLOR_ACTIVE, LAYER_COLOR_HOVERED) \
X(NULL_, "Null", "NullAnimation", resource::icon::NULL_, NULL_COLOR, NULL_COLOR_ACTIVE, NULL_COLOR_HOVERED) \
X(TRIGGER, "Trigger", "Triggers", resource::icon::TRIGGERS, TRIGGER_COLOR, TRIGGER_COLOR_ACTIVE, \
X(NONE, STRING_UNDEFINED, "", resource::icon::NONE, glm::vec4(), glm::vec4(), glm::vec4()) \
X(ROOT, BASIC_ROOT, "RootAnimation", resource::icon::ROOT, ROOT_COLOR, ROOT_COLOR_ACTIVE, ROOT_COLOR_HOVERED) \
X(LAYER, BASIC_LAYER_ANIMATION, "LayerAnimation", resource::icon::LAYER, LAYER_COLOR, LAYER_COLOR_ACTIVE, \
LAYER_COLOR_HOVERED) \
X(NULL_, BASIC_NULL_ANIMATION, "NullAnimation", resource::icon::NULL_, NULL_COLOR, NULL_COLOR_ACTIVE, \
NULL_COLOR_HOVERED) \
X(TRIGGER, BASIC_TRIGGERS, "Triggers", resource::icon::TRIGGERS, TRIGGER_COLOR, TRIGGER_COLOR_ACTIVE, \
TRIGGER_COLOR_HOVERED)
enum Type
@@ -39,7 +42,7 @@ namespace anm2ed::anm2
#undef X
};
constexpr const char* TYPE_STRINGS[] = {
constexpr StringType TYPE_STRINGS[] = {
#define X(symbol, string, itemString, icon, color, colorActive, colorHovered) string,
TYPE_LIST
#undef X
@@ -57,9 +60,23 @@ namespace anm2ed::anm2
#undef X
};
extern const glm::vec4 TYPE_COLOR[];
extern const glm::vec4 TYPE_COLOR_ACTIVE[];
extern const glm::vec4 TYPE_COLOR_HOVERED[];
inline const glm::vec4 TYPE_COLOR[] = {
#define X(symbol, string, itemString, icon, color, colorActive, colorHovered) color,
TYPE_LIST
#undef X
};
inline const glm::vec4 TYPE_COLOR_ACTIVE[] = {
#define X(symbol, string, itemString, icon, color, colorActive, colorHovered) colorActive,
TYPE_LIST
#undef X
};
inline const glm::vec4 TYPE_COLOR_HOVERED[] = {
#define X(symbol, string, itemString, icon, color, colorActive, colorHovered) colorHovered,
TYPE_LIST
#undef X
};
enum ChangeType
{
@@ -69,4 +86,4 @@ namespace anm2ed::anm2
MULTIPLY,
DIVIDE
};
}
}

View File

@@ -8,7 +8,7 @@ namespace anm2ed::anm2
class Event
{
public:
std::string name{"New Event"};
std::string name{};
int soundID{-1};
Event() = default;

View File

@@ -5,13 +5,10 @@
namespace anm2ed::anm2
{
constexpr auto LAYER_FORMAT = "#{} {} (Spritesheet: #{})";
constexpr auto LAYER_NO_SPRITESHEET_FORMAT = "#{} {} (No Spritesheet)";
class Layer
{
public:
std::string name{"New Layer"};
std::string name{};
int spritesheetID{};
Layer() = default;

View File

@@ -5,12 +5,10 @@
namespace anm2ed::anm2
{
constexpr auto NULL_FORMAT = "#{} {}";
class Null
{
public:
std::string name{"New Null"};
std::string name{};
bool isShowRect{};
Null() = default;

View File

@@ -7,8 +7,6 @@
namespace anm2ed::anm2
{
constexpr auto SOUND_FORMAT = "{}";
class Sound
{
public:

View File

@@ -8,9 +8,6 @@
namespace anm2ed::anm2
{
constexpr auto SPRITESHEET_FORMAT_C = "#%d %s";
constexpr auto SPRITESHEET_FORMAT = "#{} {}";
class Spritesheet
{
public: