Overlays, Shaders, Group Roots, Serialization Changes. Legalize Nuclear Bombs
This commit is contained in:
1 parent
555caf9f4f
commit
5792dd25a2
40 files changed
+6099
-747
No files matched your search
+1025
-76
File diff suppressed because it is too large.
Load diff
+36
-4
@@ -22,6 +22,10 @@
|
|||||||
X(CONTENT, "Content") \
|
X(CONTENT, "Content") \
|
||||||
X(SPRITESHEETS, "Spritesheets") \
|
X(SPRITESHEETS, "Spritesheets") \
|
||||||
X(SPRITESHEET, "Spritesheet") \
|
X(SPRITESHEET, "Spritesheet") \
|
||||||
|
X(OVERLAY, "Overlay") \
|
||||||
|
X(SHADER, "Shader") \
|
||||||
|
X(UNIFORM, "Uniform") \
|
||||||
|
X(COMPONENT, "Component") \
|
||||||
X(REGION, "Region") \
|
X(REGION, "Region") \
|
||||||
X(LAYERS, "Layers") \
|
X(LAYERS, "Layers") \
|
||||||
X(LAYER_ELEMENT, "Layer") \
|
X(LAYER_ELEMENT, "Layer") \
|
||||||
@@ -35,8 +39,10 @@
|
|||||||
X(ANIMATION, "Animation") \
|
X(ANIMATION, "Animation") \
|
||||||
X(ROOT_ANIMATION, "RootAnimation") \
|
X(ROOT_ANIMATION, "RootAnimation") \
|
||||||
X(LAYER_ANIMATIONS, "LayerAnimations") \
|
X(LAYER_ANIMATIONS, "LayerAnimations") \
|
||||||
|
X(LAYER_ANIMATION_GROUPS, "LayerAnimationGroups") \
|
||||||
X(LAYER_ANIMATION, "LayerAnimation") \
|
X(LAYER_ANIMATION, "LayerAnimation") \
|
||||||
X(NULL_ANIMATIONS, "NullAnimations") \
|
X(NULL_ANIMATIONS, "NullAnimations") \
|
||||||
|
X(NULL_ANIMATION_GROUPS, "NullAnimationGroups") \
|
||||||
X(NULL_ANIMATION, "NullAnimation") \
|
X(NULL_ANIMATION, "NullAnimation") \
|
||||||
X(GROUP, "Group") \
|
X(GROUP, "Group") \
|
||||||
X(TRIGGERS, "Triggers") \
|
X(TRIGGERS, "Triggers") \
|
||||||
@@ -181,7 +187,8 @@ namespace anm2ed
|
|||||||
SERIALIZE_REGIONS = 1 << 1,
|
SERIALIZE_REGIONS = 1 << 1,
|
||||||
SERIALIZE_SOUNDS = 1 << 2,
|
SERIALIZE_SOUNDS = 1 << 2,
|
||||||
SERIALIZE_REDUNDANT_FRAME_REGION_VALUES = 1 << 3,
|
SERIALIZE_REDUNDANT_FRAME_REGION_VALUES = 1 << 3,
|
||||||
SERIALIZE_BAKE_SPECIAL_INTERPOLATED_FRAMES = 1 << 4
|
SERIALIZE_BAKE_SPECIAL_INTERPOLATED_FRAMES = 1 << 4,
|
||||||
|
SERIALIZE_BAKE_GROUP_FRAMES = 1 << 5
|
||||||
};
|
};
|
||||||
|
|
||||||
using Flags = int;
|
using Flags = int;
|
||||||
@@ -189,7 +196,8 @@ namespace anm2ed
|
|||||||
constexpr bool has_flag(Flags flags, Flag flag) { return (flags & flag) != 0; }
|
constexpr bool has_flag(Flags flags, Flag flag) { return (flags & flag) != 0; }
|
||||||
constexpr Flags SERIALIZE_EDITOR_DEFAULT =
|
constexpr Flags SERIALIZE_EDITOR_DEFAULT =
|
||||||
SERIALIZE_GROUPS | SERIALIZE_REGIONS | SERIALIZE_SOUNDS | SERIALIZE_REDUNDANT_FRAME_REGION_VALUES;
|
SERIALIZE_GROUPS | SERIALIZE_REGIONS | SERIALIZE_SOUNDS | SERIALIZE_REDUNDANT_FRAME_REGION_VALUES;
|
||||||
constexpr Flags SERIALIZE_DEFAULT = SERIALIZE_EDITOR_DEFAULT | SERIALIZE_BAKE_SPECIAL_INTERPOLATED_FRAMES;
|
constexpr Flags SERIALIZE_DEFAULT =
|
||||||
|
SERIALIZE_EDITOR_DEFAULT | SERIALIZE_BAKE_SPECIAL_INTERPOLATED_FRAMES | SERIALIZE_BAKE_GROUP_FRAMES;
|
||||||
|
|
||||||
struct Options
|
struct Options
|
||||||
{
|
{
|
||||||
@@ -233,6 +241,10 @@ namespace anm2ed
|
|||||||
std::string createdBy{"robot"};
|
std::string createdBy{"robot"};
|
||||||
std::string createdOn{};
|
std::string createdOn{};
|
||||||
std::filesystem::path path{};
|
std::filesystem::path path{};
|
||||||
|
std::filesystem::path vertex{};
|
||||||
|
std::filesystem::path fragment{};
|
||||||
|
std::string binding{};
|
||||||
|
std::string value{};
|
||||||
std::string defaultAnimation{};
|
std::string defaultAnimation{};
|
||||||
int id{-1};
|
int id{-1};
|
||||||
int layerId{-1};
|
int layerId{-1};
|
||||||
@@ -247,10 +259,12 @@ namespace anm2ed
|
|||||||
int regionId{-1};
|
int regionId{-1};
|
||||||
int soundId{-1};
|
int soundId{-1};
|
||||||
int groupId{-1};
|
int groupId{-1};
|
||||||
|
int index{-1};
|
||||||
bool isLoop{true};
|
bool isLoop{true};
|
||||||
bool isVisible{true};
|
bool isVisible{true};
|
||||||
bool isShowRect{};
|
bool isShowRect{};
|
||||||
bool isExpanded{true};
|
bool isExpanded{true};
|
||||||
|
bool isEnabled{true};
|
||||||
Interpolation interpolation{Interpolation::NONE};
|
Interpolation interpolation{Interpolation::NONE};
|
||||||
Origin origin{Origin::CUSTOM};
|
Origin origin{Origin::CUSTOM};
|
||||||
float rotation{};
|
float rotation{};
|
||||||
@@ -270,6 +284,8 @@ namespace anm2ed
|
|||||||
int itemType{(int)ItemType::NONE};
|
int itemType{(int)ItemType::NONE};
|
||||||
int itemID{-1};
|
int itemID{-1};
|
||||||
int frameIndex{-1};
|
int frameIndex{-1};
|
||||||
|
int groupType{(int)ItemType::NONE};
|
||||||
|
int groupId{-1};
|
||||||
|
|
||||||
auto operator<=>(const Reference&) const = default;
|
auto operator<=>(const Reference&) const = default;
|
||||||
};
|
};
|
||||||
@@ -283,6 +299,10 @@ namespace anm2ed
|
|||||||
Flags = SERIALIZE_EDITOR_DEFAULT);
|
Flags = SERIALIZE_EDITOR_DEFAULT);
|
||||||
Element* element_child_first_get(Element&, ElementType);
|
Element* element_child_first_get(Element&, ElementType);
|
||||||
const Element* element_child_first_get(const Element&, ElementType);
|
const Element* element_child_first_get(const Element&, ElementType);
|
||||||
|
Element* shader_uniform_get(Element&, std::string_view, bool = false);
|
||||||
|
const Element* shader_uniform_get(const Element&, std::string_view);
|
||||||
|
Element* shader_uniform_component_get(Element&, int, bool = false);
|
||||||
|
const Element* shader_uniform_component_get(const Element&, int);
|
||||||
Element* element_child_id_get(Element&, ElementType, int);
|
Element* element_child_id_get(Element&, ElementType, int);
|
||||||
const Element* element_child_id_get(const Element&, ElementType, int);
|
const Element* element_child_id_get(const Element&, ElementType, int);
|
||||||
int element_child_next_id_get(const Element&, ElementType);
|
int element_child_next_id_get(const Element&, ElementType);
|
||||||
@@ -292,6 +312,13 @@ namespace anm2ed
|
|||||||
const Element* element_first_get(const Element&, ElementType);
|
const Element* element_first_get(const Element&, ElementType);
|
||||||
Element* animation_item_get(Element&, ItemType, int = -1);
|
Element* animation_item_get(Element&, ItemType, int = -1);
|
||||||
const Element* animation_item_get(const Element&, ItemType, int = -1);
|
const Element* animation_item_get(const Element&, ItemType, int = -1);
|
||||||
|
Element* animation_item_get(Element&, ItemType, int, int, int);
|
||||||
|
const Element* animation_item_get(const Element&, ItemType, int, int, int);
|
||||||
|
Element* animation_group_get(Element&, int, int);
|
||||||
|
const Element* animation_group_get(const Element&, int, int);
|
||||||
|
Element* animation_group_root_get(Element&, int, int);
|
||||||
|
const Element* animation_group_root_get(const Element&, int, int);
|
||||||
|
Element* animation_group_root_ensure(Element&, int, int);
|
||||||
ElementType item_type_to_track_type_get(ItemType);
|
ElementType item_type_to_track_type_get(ItemType);
|
||||||
Element* track_frame_get(Element&, int);
|
Element* track_frame_get(Element&, int);
|
||||||
const Element* track_frame_get(const Element&, int);
|
const Element* track_frame_get(const Element&, int);
|
||||||
@@ -326,7 +353,7 @@ namespace anm2ed
|
|||||||
void special_interpolated_frames_bake(int, bool, bool);
|
void special_interpolated_frames_bake(int, bool, bool);
|
||||||
void region_frames_sync(bool);
|
void region_frames_sync(bool);
|
||||||
void region_ids_remap();
|
void region_ids_remap();
|
||||||
Anm2 normalized_for_serialize() const;
|
Anm2 normalized_for_serialize(Flags = SERIALIZE_DEFAULT) const;
|
||||||
|
|
||||||
Element* element_get(ElementType);
|
Element* element_get(ElementType);
|
||||||
const Element* element_get(ElementType) const;
|
const Element* element_get(ElementType) const;
|
||||||
@@ -334,8 +361,12 @@ namespace anm2ed
|
|||||||
const Element* element_get(ElementType, int) const;
|
const Element* element_get(ElementType, int) const;
|
||||||
Element* element_get(int, ItemType, int = -1);
|
Element* element_get(int, ItemType, int = -1);
|
||||||
const Element* element_get(int, ItemType, int = -1) const;
|
const Element* element_get(int, ItemType, int = -1) const;
|
||||||
|
Element* element_get(int, ItemType, int, int, int);
|
||||||
|
const Element* element_get(int, ItemType, int, int, int) const;
|
||||||
Element* element_get(int, ItemType, int, int);
|
Element* element_get(int, ItemType, int, int);
|
||||||
const Element* element_get(int, ItemType, int, int) const;
|
const Element* element_get(int, ItemType, int, int) const;
|
||||||
|
Element* element_get(Reference);
|
||||||
|
const Element* element_get(Reference) const;
|
||||||
std::set<int> element_unused(ElementType) const;
|
std::set<int> element_unused(ElementType) const;
|
||||||
std::set<int> element_unused(ElementType, const Element&) const;
|
std::set<int> element_unused(ElementType, const Element&) const;
|
||||||
std::set<int> element_unused(ElementType, int) const;
|
std::set<int> element_unused(ElementType, int) const;
|
||||||
@@ -347,7 +378,8 @@ namespace anm2ed
|
|||||||
types::destination::Type = types::destination::ALL);
|
types::destination::Type = types::destination::ALL);
|
||||||
int null_animation_add(int, int = -1, std::string = {}, bool = false,
|
int null_animation_add(int, int = -1, std::string = {}, bool = false,
|
||||||
types::destination::Type = types::destination::ALL);
|
types::destination::Type = types::destination::ALL);
|
||||||
bool animations_deserialize(const std::string&, int, std::set<int>&, std::string* = nullptr);
|
bool animations_deserialize(const std::string&, int, std::set<int>&, std::string* = nullptr,
|
||||||
|
std::set<int>* = nullptr);
|
||||||
int animations_merge(int, std::set<int>&, types::merge::Type = types::merge::APPEND, bool = true);
|
int animations_merge(int, std::set<int>&, types::merge::Type = types::merge::APPEND, bool = true);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
+116
-5
@@ -165,17 +165,128 @@ namespace anm2ed
|
|||||||
canvas_blend_straight_set();
|
canvas_blend_straight_set();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void texture_uniform_vec4_set(const shader::Uniform& uniform, vec4 value)
|
||||||
|
{
|
||||||
|
if (uniform.location == -1) return;
|
||||||
|
|
||||||
|
switch (uniform.valueType)
|
||||||
|
{
|
||||||
|
case shader::UNIFORM_VALUE_FLOAT:
|
||||||
|
glUniform1f(uniform.location, value.x);
|
||||||
|
break;
|
||||||
|
case shader::UNIFORM_VALUE_VEC2:
|
||||||
|
glUniform2fv(uniform.location, 1, value_ptr(value));
|
||||||
|
break;
|
||||||
|
case shader::UNIFORM_VALUE_VEC3:
|
||||||
|
glUniform3fv(uniform.location, 1, value_ptr(value));
|
||||||
|
break;
|
||||||
|
case shader::UNIFORM_VALUE_VEC4:
|
||||||
|
glUniform4fv(uniform.location, 1, value_ptr(value));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void texture_uniform_manual_set(const shader::Uniform& uniform)
|
||||||
|
{
|
||||||
|
if (uniform.location == -1) return;
|
||||||
|
|
||||||
|
switch (uniform.valueType)
|
||||||
|
{
|
||||||
|
case shader::UNIFORM_VALUE_FLOAT:
|
||||||
|
glUniform1f(uniform.location, uniform.value.x);
|
||||||
|
break;
|
||||||
|
case shader::UNIFORM_VALUE_INT:
|
||||||
|
case shader::UNIFORM_VALUE_SAMPLER2D:
|
||||||
|
glUniform1i(uniform.location, uniform.intValue);
|
||||||
|
break;
|
||||||
|
case shader::UNIFORM_VALUE_VEC2:
|
||||||
|
glUniform2fv(uniform.location, 1, value_ptr(uniform.value));
|
||||||
|
break;
|
||||||
|
case shader::UNIFORM_VALUE_VEC3:
|
||||||
|
glUniform3fv(uniform.location, 1, value_ptr(uniform.value));
|
||||||
|
break;
|
||||||
|
case shader::UNIFORM_VALUE_VEC4:
|
||||||
|
glUniform4fv(uniform.location, 1, value_ptr(uniform.value));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float texture_uniform_component_value_get(const shader::Uniform::Component& component, float playbackTime)
|
||||||
|
{
|
||||||
|
if (component.binding == shader::UNIFORM_BINDING_PLAYBACK_TIME) return playbackTime;
|
||||||
|
return component.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 texture_uniform_component_vec4_get(const shader::Uniform& uniform, float playbackTime)
|
||||||
|
{
|
||||||
|
return {texture_uniform_component_value_get(uniform.components[0], playbackTime),
|
||||||
|
texture_uniform_component_value_get(uniform.components[1], playbackTime),
|
||||||
|
texture_uniform_component_value_get(uniform.components[2], playbackTime),
|
||||||
|
texture_uniform_component_value_get(uniform.components[3], playbackTime)};
|
||||||
|
}
|
||||||
|
|
||||||
|
void texture_uniforms_set(Shader& shader, mat4 transform, vec4 tint, vec3 colorOffset, vec2 textureSize,
|
||||||
|
float playbackTime)
|
||||||
|
{
|
||||||
|
if (shader.uniforms.empty())
|
||||||
|
{
|
||||||
|
glUniform1i(glGetUniformLocation(shader.id, shader::UNIFORM_TEXTURE), 0);
|
||||||
|
glUniform3fv(glGetUniformLocation(shader.id, shader::UNIFORM_COLOR_OFFSET), 1, value_ptr(colorOffset));
|
||||||
|
glUniform4fv(glGetUniformLocation(shader.id, shader::UNIFORM_TINT), 1, value_ptr(tint));
|
||||||
|
glUniformMatrix4fv(glGetUniformLocation(shader.id, shader::UNIFORM_TRANSFORM), 1, GL_FALSE, value_ptr(transform));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& uniform : shader.uniforms)
|
||||||
|
{
|
||||||
|
if (uniform.location == -1) continue;
|
||||||
|
|
||||||
|
switch (uniform.binding)
|
||||||
|
{
|
||||||
|
case shader::UNIFORM_BINDING_MAIN_TEXTURE:
|
||||||
|
glUniform1i(uniform.location, 0);
|
||||||
|
break;
|
||||||
|
case shader::UNIFORM_BINDING_TRANSFORM:
|
||||||
|
if (uniform.valueType == shader::UNIFORM_VALUE_MAT4)
|
||||||
|
glUniformMatrix4fv(uniform.location, 1, GL_FALSE, value_ptr(transform));
|
||||||
|
break;
|
||||||
|
case shader::UNIFORM_BINDING_FRAME_TINT:
|
||||||
|
texture_uniform_vec4_set(uniform, tint);
|
||||||
|
break;
|
||||||
|
case shader::UNIFORM_BINDING_COLOR_OFFSET:
|
||||||
|
texture_uniform_vec4_set(uniform, vec4(colorOffset, 0.0f));
|
||||||
|
break;
|
||||||
|
case shader::UNIFORM_BINDING_TEXTURE_SIZE:
|
||||||
|
texture_uniform_vec4_set(uniform, vec4(textureSize, 0.0f, 0.0f));
|
||||||
|
break;
|
||||||
|
case shader::UNIFORM_BINDING_PLAYBACK_TIME:
|
||||||
|
texture_uniform_vec4_set(uniform, vec4(playbackTime));
|
||||||
|
break;
|
||||||
|
case shader::UNIFORM_BINDING_COMPONENTS:
|
||||||
|
texture_uniform_vec4_set(uniform, texture_uniform_component_vec4_get(uniform, playbackTime));
|
||||||
|
break;
|
||||||
|
case shader::UNIFORM_BINDING_MANUAL:
|
||||||
|
texture_uniform_manual_set(uniform);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Canvas::texture_render(Shader& shader, GLuint& texture, mat4 transform, vec4 tint, vec3 colorOffset,
|
void Canvas::texture_render(Shader& shader, GLuint& texture, mat4 transform, vec4 tint, vec3 colorOffset,
|
||||||
float* vertices) const
|
float* vertices, vec2 textureSize, float playbackTime) const
|
||||||
{
|
{
|
||||||
canvas_blend_premultiplied_set();
|
canvas_blend_premultiplied_set();
|
||||||
|
|
||||||
glUseProgram(shader.id);
|
glUseProgram(shader.id);
|
||||||
|
|
||||||
glUniform1i(glGetUniformLocation(shader.id, shader::UNIFORM_TEXTURE), 0);
|
texture_uniforms_set(shader, transform, tint, colorOffset, textureSize, playbackTime);
|
||||||
glUniform3fv(glGetUniformLocation(shader.id, shader::UNIFORM_COLOR_OFFSET), 1, value_ptr(colorOffset));
|
glVertexAttrib4fv(2, value_ptr(tint));
|
||||||
glUniform4fv(glGetUniformLocation(shader.id, shader::UNIFORM_TINT), 1, value_ptr(tint));
|
|
||||||
glUniformMatrix4fv(glGetUniformLocation(shader.id, shader::UNIFORM_TRANSFORM), 1, GL_FALSE, value_ptr(transform));
|
|
||||||
|
|
||||||
glBindVertexArray(textureVAO);
|
glBindVertexArray(textureVAO);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -61,7 +61,7 @@ namespace anm2ed
|
|||||||
void grid_render(resource::Shader&, float, glm::vec2, glm::ivec2 = glm::ivec2(32, 32), glm::ivec2 = {},
|
void grid_render(resource::Shader&, float, glm::vec2, glm::ivec2 = glm::ivec2(32, 32), glm::ivec2 = {},
|
||||||
glm::vec4 = glm::vec4(1.0f)) const;
|
glm::vec4 = glm::vec4(1.0f)) const;
|
||||||
void texture_render(resource::Shader&, GLuint&, glm::mat4 = {1.0f}, glm::vec4 = glm::vec4(1.0f), glm::vec3 = {},
|
void texture_render(resource::Shader&, GLuint&, glm::mat4 = {1.0f}, glm::vec4 = glm::vec4(1.0f), glm::vec3 = {},
|
||||||
float* = (float*)TEXTURE_VERTICES) const;
|
float* = (float*)TEXTURE_VERTICES, glm::vec2 = {}, float = 0.0f) const;
|
||||||
void rect_fill_render(resource::Shader&, const glm::mat4&, const glm::mat4&,
|
void rect_fill_render(resource::Shader&, const glm::mat4&, const glm::mat4&,
|
||||||
glm::vec4 = glm::vec4(1.0f)) const;
|
glm::vec4 = glm::vec4(1.0f)) const;
|
||||||
void rect_render(resource::Shader&, const glm::mat4&, const glm::mat4&, glm::vec4 = glm::vec4(1.0f),
|
void rect_render(resource::Shader&, const glm::mat4&, const glm::mat4&, glm::vec4 = glm::vec4(1.0f),
|
||||||
|
|||||||
+2
-2
@@ -16,7 +16,7 @@ namespace anm2ed
|
|||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Clipboard::is_empty() { return get().empty(); }
|
bool Clipboard::is_empty() { return !SDL_HasClipboardText(); }
|
||||||
|
|
||||||
void Clipboard::set(const std::string& string) { SDL_SetClipboardText(string.data()); }
|
void Clipboard::set(const std::string& string) { SDL_SetClipboardText(string.c_str()); }
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,7 @@ namespace anm2ed
|
|||||||
X(NO_FILTER, {}) \
|
X(NO_FILTER, {}) \
|
||||||
X(ANM2, {"Anm2 file", "anm2;xml"}) \
|
X(ANM2, {"Anm2 file", "anm2;xml"}) \
|
||||||
X(PNG, {"PNG image", "png;PNG"}) \
|
X(PNG, {"PNG image", "png;PNG"}) \
|
||||||
|
X(SHADER, {"Shader file", "fs;vs;FS;VS"}) \
|
||||||
X(SOUND, {"WAV file;OGG file", "wav;ogg"}) \
|
X(SOUND, {"WAV file;OGG file", "wav;ogg"}) \
|
||||||
X(GIF, {"GIF image", "gif"}) \
|
X(GIF, {"GIF image", "gif"}) \
|
||||||
X(WEBM, {"WebM video", "webm"}) \
|
X(WEBM, {"WebM video", "webm"}) \
|
||||||
@@ -48,9 +49,14 @@ namespace anm2ed
|
|||||||
X(ANM2_SAVE, ANM2) \
|
X(ANM2_SAVE, ANM2) \
|
||||||
X(SOUND_OPEN, SOUND) \
|
X(SOUND_OPEN, SOUND) \
|
||||||
X(SOUND_REPLACE, SOUND) \
|
X(SOUND_REPLACE, SOUND) \
|
||||||
|
X(OVERLAY_OPEN, PNG) \
|
||||||
|
X(OVERLAY_REPLACE, PNG) \
|
||||||
|
X(OVERLAY_PATH_SET, PNG) \
|
||||||
X(SPRITESHEET_OPEN, PNG) \
|
X(SPRITESHEET_OPEN, PNG) \
|
||||||
X(SPRITESHEET_REPLACE, PNG) \
|
X(SPRITESHEET_REPLACE, PNG) \
|
||||||
X(SPRITESHEET_PATH_SET, PNG) \
|
X(SPRITESHEET_PATH_SET, PNG) \
|
||||||
|
X(SHADER_FRAGMENT_PATH_SET, SHADER) \
|
||||||
|
X(SHADER_VERTEX_PATH_SET, SHADER) \
|
||||||
X(FFMPEG_PATH_SET, EXECUTABLE) \
|
X(FFMPEG_PATH_SET, EXECUTABLE) \
|
||||||
X(PNG_DIRECTORY_SET, NO_FILTER) \
|
X(PNG_DIRECTORY_SET, NO_FILTER) \
|
||||||
X(PNG_PATH_SET, PNG) \
|
X(PNG_PATH_SET, PNG) \
|
||||||
|
|||||||
+819
-100
File diff suppressed because it is too large.
Load diff
+44
-4
@@ -12,6 +12,7 @@
|
|||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
#include "origin.hpp"
|
#include "origin.hpp"
|
||||||
|
#include "shader.hpp"
|
||||||
#include "types.hpp"
|
#include "types.hpp"
|
||||||
|
|
||||||
namespace anm2ed
|
namespace anm2ed
|
||||||
@@ -49,6 +50,7 @@ namespace anm2ed
|
|||||||
NONE,
|
NONE,
|
||||||
FRAME,
|
FRAME,
|
||||||
REGION,
|
REGION,
|
||||||
|
OVERLAY,
|
||||||
SPRITESHEET
|
SPRITESHEET
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -58,6 +60,14 @@ namespace anm2ed
|
|||||||
SET
|
SET
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum FileMergePreset
|
||||||
|
{
|
||||||
|
FILE_MERGE_PRESET_MERGE_BY_NAME,
|
||||||
|
FILE_MERGE_PRESET_APPEND_AS_NEW,
|
||||||
|
FILE_MERGE_PRESET_REPLACE_MATCHING,
|
||||||
|
FILE_MERGE_PRESET_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
std::filesystem::path path{};
|
std::filesystem::path path{};
|
||||||
uint64_t tabId{};
|
uint64_t tabId{};
|
||||||
|
|
||||||
@@ -72,10 +82,12 @@ namespace anm2ed
|
|||||||
Storage& layer = current.layer;
|
Storage& layer = current.layer;
|
||||||
Storage& merge = current.merge;
|
Storage& merge = current.merge;
|
||||||
Storage& null = current.null;
|
Storage& null = current.null;
|
||||||
|
Storage& overlay = current.overlay;
|
||||||
Storage& region = current.region;
|
Storage& region = current.region;
|
||||||
Storage& sound = current.sound;
|
Storage& sound = current.sound;
|
||||||
Storage& spritesheet = current.spritesheet;
|
Storage& spritesheet = current.spritesheet;
|
||||||
std::map<int, resource::Texture>& textures = current.textures;
|
std::map<int, resource::Texture>& textures = current.textures;
|
||||||
|
std::map<int, resource::Texture>& overlayTextures = current.overlayTextures;
|
||||||
std::map<int, resource::Audio>& sounds = current.sounds;
|
std::map<int, resource::Audio>& sounds = current.sounds;
|
||||||
Anm2& anm2 = current.anm2;
|
Anm2& anm2 = current.anm2;
|
||||||
Reference& reference = current.reference;
|
Reference& reference = current.reference;
|
||||||
@@ -100,8 +112,14 @@ namespace anm2ed
|
|||||||
bool isForceDirty{false};
|
bool isForceDirty{false};
|
||||||
std::unordered_map<int, uint64_t> spritesheetHashes{};
|
std::unordered_map<int, uint64_t> spritesheetHashes{};
|
||||||
std::unordered_map<int, uint64_t> spritesheetSaveHashes{};
|
std::unordered_map<int, uint64_t> spritesheetSaveHashes{};
|
||||||
|
std::unordered_map<int, uint64_t> overlayHashes{};
|
||||||
|
std::unordered_map<int, uint64_t> overlaySaveHashes{};
|
||||||
std::unordered_map<int, std::filesystem::path> texturePaths{};
|
std::unordered_map<int, std::filesystem::path> texturePaths{};
|
||||||
|
std::unordered_map<int, std::filesystem::path> overlayTexturePaths{};
|
||||||
std::unordered_map<int, std::filesystem::path> soundPaths{};
|
std::unordered_map<int, std::filesystem::path> soundPaths{};
|
||||||
|
std::unordered_map<int, std::filesystem::path> shaderVertexPaths{};
|
||||||
|
std::unordered_map<int, std::filesystem::path> shaderFragmentPaths{};
|
||||||
|
std::map<int, resource::Shader> shaders{};
|
||||||
bool isAnimationPreviewSet{false};
|
bool isAnimationPreviewSet{false};
|
||||||
bool isSpritesheetEditorSet{false};
|
bool isSpritesheetEditorSet{false};
|
||||||
EditTarget editTarget{EditTarget::NONE};
|
EditTarget editTarget{EditTarget::NONE};
|
||||||
@@ -115,19 +133,26 @@ namespace anm2ed
|
|||||||
void anm2_change(ChangeType);
|
void anm2_change(ChangeType);
|
||||||
void assets_sync(ChangeType = ALL);
|
void assets_sync(ChangeType = ALL);
|
||||||
void texture_change(int);
|
void texture_change(int);
|
||||||
|
void overlay_texture_change(int);
|
||||||
bool texture_reload(int);
|
bool texture_reload(int);
|
||||||
|
bool overlay_texture_reload(int);
|
||||||
bool sound_reload(int);
|
bool sound_reload(int);
|
||||||
|
bool shader_reload(int, std::string* = nullptr);
|
||||||
resource::Texture* texture_get(int);
|
resource::Texture* texture_get(int);
|
||||||
const resource::Texture* texture_get(int) const;
|
const resource::Texture* texture_get(int) const;
|
||||||
|
resource::Texture* overlay_texture_get(int);
|
||||||
|
const resource::Texture* overlay_texture_get(int) const;
|
||||||
resource::Audio* sound_get(int);
|
resource::Audio* sound_get(int);
|
||||||
const resource::Audio* sound_get(int) const;
|
const resource::Audio* sound_get(int) const;
|
||||||
|
resource::Shader* shader_get(int);
|
||||||
|
const resource::Shader* shader_get(int) const;
|
||||||
bool regions_trim(int, const std::set<int>&);
|
bool regions_trim(int, const std::set<int>&);
|
||||||
bool regions_generate_from_animations(const std::set<int>&, const std::string&, RegionFrameMapping);
|
bool regions_generate_from_animations(const std::set<int>&, const std::string&, RegionFrameMapping);
|
||||||
bool regions_generate_from_frames(const std::set<Reference>&, const std::string&, RegionFrameMapping);
|
bool regions_generate_from_frames(const std::set<Reference>&, const std::string&, RegionFrameMapping);
|
||||||
bool spritesheet_pack(int, int);
|
bool spritesheet_pack(int, int);
|
||||||
bool spritesheets_merge(const std::set<int>&, bool, bool, bool, origin::Type);
|
bool spritesheets_merge(const std::set<int>&, bool, bool, bool, origin::Type);
|
||||||
void scan_and_set_regions();
|
void scan_and_set_regions();
|
||||||
bool file_merge(const std::filesystem::path&);
|
bool file_merge(const std::filesystem::path&, FileMergePreset = FILE_MERGE_PRESET_MERGE_BY_NAME);
|
||||||
void hash_set();
|
void hash_set();
|
||||||
void clean();
|
void clean();
|
||||||
void change(ChangeType);
|
void change(ChangeType);
|
||||||
@@ -143,6 +168,12 @@ namespace anm2ed
|
|||||||
bool spritesheet_any_dirty();
|
bool spritesheet_any_dirty();
|
||||||
void spritesheet_hashes_reset();
|
void spritesheet_hashes_reset();
|
||||||
void spritesheet_hashes_sync();
|
void spritesheet_hashes_sync();
|
||||||
|
void overlay_hash_update(int);
|
||||||
|
void overlay_hash_set_saved(int);
|
||||||
|
bool overlay_is_dirty(int);
|
||||||
|
bool overlay_any_dirty();
|
||||||
|
void overlay_hashes_reset();
|
||||||
|
void overlay_hashes_sync();
|
||||||
bool is_frame_reference_valid(Reference) const;
|
bool is_frame_reference_valid(Reference) const;
|
||||||
std::set<Reference> item_frame_references_get(Reference) const;
|
std::set<Reference> item_frame_references_get(Reference) const;
|
||||||
std::set<Reference> selected_item_frame_references_get() const;
|
std::set<Reference> selected_item_frame_references_get() const;
|
||||||
@@ -154,10 +185,15 @@ namespace anm2ed
|
|||||||
Element* frame_get();
|
Element* frame_get();
|
||||||
Element* item_get();
|
Element* item_get();
|
||||||
Element* spritesheet_get();
|
Element* spritesheet_get();
|
||||||
|
Element* overlay_get(int = -1);
|
||||||
|
const Element* overlay_get(int = -1) const;
|
||||||
|
int overlay_spritesheet_id_get(int) const;
|
||||||
Element* animation_get();
|
Element* animation_get();
|
||||||
|
|
||||||
void spritesheet_add(const std::filesystem::path&);
|
void spritesheet_add(const std::filesystem::path&);
|
||||||
void spritesheets_add(const std::vector<std::filesystem::path>&);
|
void spritesheets_add(const std::vector<std::filesystem::path>&);
|
||||||
|
void overlay_add(int, const std::filesystem::path&);
|
||||||
|
void overlays_add(int, const std::vector<std::filesystem::path>&);
|
||||||
void sound_add(const std::filesystem::path&);
|
void sound_add(const std::filesystem::path&);
|
||||||
void sounds_add(const std::vector<std::filesystem::path>&);
|
void sounds_add(const std::vector<std::filesystem::path>&);
|
||||||
|
|
||||||
@@ -165,7 +201,11 @@ namespace anm2ed
|
|||||||
std::filesystem::path autosave_path_get();
|
std::filesystem::path autosave_path_get();
|
||||||
std::filesystem::path path_from_autosave_get(const std::filesystem::path&);
|
std::filesystem::path path_from_autosave_get(const std::filesystem::path&);
|
||||||
|
|
||||||
void snapshot(const std::string& message);
|
void anm2_snapshot(const std::string& message);
|
||||||
|
void frames_snapshot(const std::string& message, const std::set<Reference>&);
|
||||||
|
void regions_snapshot(const std::string& message, int, const std::set<int>&);
|
||||||
|
void textures_snapshot(const std::string& message);
|
||||||
|
void anm2_textures_snapshot(const std::string& message);
|
||||||
void undo();
|
void undo();
|
||||||
void redo();
|
void redo();
|
||||||
bool is_able_to_undo();
|
bool is_able_to_undo();
|
||||||
@@ -174,14 +214,14 @@ namespace anm2ed
|
|||||||
|
|
||||||
#define DOCUMENT_EDIT(document, message, changeType, body) \
|
#define DOCUMENT_EDIT(document, message, changeType, body) \
|
||||||
{ \
|
{ \
|
||||||
document.snapshot(message); \
|
document.anm2_snapshot(message); \
|
||||||
body; \
|
body; \
|
||||||
document.change(changeType); \
|
document.change(changeType); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DOCUMENT_EDIT_PTR(document, message, changeType, body) \
|
#define DOCUMENT_EDIT_PTR(document, message, changeType, body) \
|
||||||
{ \
|
{ \
|
||||||
document->snapshot(message); \
|
document->anm2_snapshot(message); \
|
||||||
body; \
|
body; \
|
||||||
document->change(changeType); \
|
document->change(changeType); \
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,11 @@ namespace anm2ed::imgui
|
|||||||
|
|
||||||
bool actions_context_window_draw(const char* label, Actions& actions, Settings& settings, ImGuiPopupFlags flags)
|
bool actions_context_window_draw(const char* label, Actions& actions, Settings& settings, ImGuiPopupFlags flags)
|
||||||
{
|
{
|
||||||
if (!ImGui::BeginPopupContextWindow(label, flags)) return false;
|
auto mouseButton = flags & ImGuiPopupFlags_MouseButtonMask_;
|
||||||
|
if (ImGui::IsMouseReleased(mouseButton) && ImGui::IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))
|
||||||
|
if (!(flags & ImGuiPopupFlags_NoOpenOverItems) || !ImGui::IsAnyItemHovered()) ImGui::OpenPopup(label, flags);
|
||||||
|
|
||||||
|
if (!ImGui::BeginPopup(label, ImGuiWindowFlags_NoMove)) return false;
|
||||||
actions_menu_draw(actions, settings);
|
actions_menu_draw(actions, settings);
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
return true;
|
return true;
|
||||||
@@ -87,7 +91,7 @@ namespace anm2ed::imgui
|
|||||||
|
|
||||||
bool actions_popup_draw(const char* label, Actions& actions, Settings& settings)
|
bool actions_popup_draw(const char* label, Actions& actions, Settings& settings)
|
||||||
{
|
{
|
||||||
if (!ImGui::BeginPopup(label)) return false;
|
if (!ImGui::BeginPopup(label, ImGuiWindowFlags_NoMove)) return false;
|
||||||
actions_menu_draw(actions, settings);
|
actions_menu_draw(actions, settings);
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ namespace anm2ed::imgui
|
|||||||
if (settings.windowIsLayers) window_update(layers, manager, settings, resources, dialog, clipboard);
|
if (settings.windowIsLayers) window_update(layers, manager, settings, resources, dialog, clipboard);
|
||||||
if (settings.windowIsNulls) window_update(nulls, manager, settings, resources, dialog, clipboard);
|
if (settings.windowIsNulls) window_update(nulls, manager, settings, resources, dialog, clipboard);
|
||||||
if (settings.windowIsOnionskin) onionskin.update(manager, settings);
|
if (settings.windowIsOnionskin) onionskin.update(manager, settings);
|
||||||
|
if (settings.windowIsOverlays) window_update(overlays, manager, settings, resources, dialog, clipboard);
|
||||||
|
if (settings.windowIsShaders) shaders.update(manager, settings, resources, dialog);
|
||||||
if (settings.windowIsSounds) window_update(sounds, manager, settings, resources, dialog, clipboard);
|
if (settings.windowIsSounds) window_update(sounds, manager, settings, resources, dialog, clipboard);
|
||||||
if (settings.windowIsSpritesheetEditor) spritesheetEditor.update(manager, settings, resources);
|
if (settings.windowIsSpritesheetEditor) spritesheetEditor.update(manager, settings, resources);
|
||||||
if (settings.windowIsSpritesheets)
|
if (settings.windowIsSpritesheets)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "window/animation_preview.hpp"
|
#include "window/animation_preview.hpp"
|
||||||
#include "window/frame_properties.hpp"
|
#include "window/frame_properties.hpp"
|
||||||
#include "window/onionskin.hpp"
|
#include "window/onionskin.hpp"
|
||||||
|
#include "window/shaders.hpp"
|
||||||
#include "window/spritesheet_editor.hpp"
|
#include "window/spritesheet_editor.hpp"
|
||||||
#include "window/timeline.hpp"
|
#include "window/timeline.hpp"
|
||||||
#include "window/tools.hpp"
|
#include "window/tools.hpp"
|
||||||
@@ -25,6 +26,8 @@ namespace anm2ed::imgui
|
|||||||
Window layers{layers_window_register()};
|
Window layers{layers_window_register()};
|
||||||
Window nulls{nulls_window_register()};
|
Window nulls{nulls_window_register()};
|
||||||
Onionskin onionskin;
|
Onionskin onionskin;
|
||||||
|
Window overlays{overlays_window_register()};
|
||||||
|
ShadersWindow shaders;
|
||||||
SpritesheetEditor spritesheetEditor;
|
SpritesheetEditor spritesheetEditor;
|
||||||
Window spritesheets{spritesheets_window_register()};
|
Window spritesheets{spritesheets_window_register()};
|
||||||
Window sounds{sounds_window_register()};
|
Window sounds{sounds_window_register()};
|
||||||
|
|||||||
+127
-31
@@ -1,5 +1,6 @@
|
|||||||
#include "documents.hpp"
|
#include "documents.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <format>
|
#include <format>
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -26,17 +27,46 @@ namespace anm2ed::imgui
|
|||||||
uint64_t documentId{};
|
uint64_t documentId{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define ANM2_DRAG_DROP_MERGE_PRESETS \
|
||||||
|
X(FILE_MERGE_PRESET_MERGE_BY_NAME, BASIC_MERGE, TOOLTIP_MERGE_PRESET_MERGE_BY_NAME) \
|
||||||
|
X(FILE_MERGE_PRESET_APPEND_AS_NEW, BASIC_APPEND, TOOLTIP_MERGE_PRESET_APPEND_AS_NEW) \
|
||||||
|
X(FILE_MERGE_PRESET_REPLACE_MATCHING, BASIC_REPLACE, TOOLTIP_MERGE_PRESET_REPLACE_MATCHING)
|
||||||
|
|
||||||
|
constexpr StringType ANM2_DRAG_DROP_MERGE_PRESET_LABELS[Document::FILE_MERGE_PRESET_COUNT] = {
|
||||||
|
#define X(preset, label, tooltip) label,
|
||||||
|
ANM2_DRAG_DROP_MERGE_PRESETS
|
||||||
|
#undef X
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr StringType ANM2_DRAG_DROP_MERGE_PRESET_TOOLTIPS[Document::FILE_MERGE_PRESET_COUNT] = {
|
||||||
|
#define X(preset, label, tooltip) tooltip,
|
||||||
|
ANM2_DRAG_DROP_MERGE_PRESETS
|
||||||
|
#undef X
|
||||||
|
};
|
||||||
|
|
||||||
|
#undef ANM2_DRAG_DROP_MERGE_PRESETS
|
||||||
|
|
||||||
Options save_options_get(const Settings& settings)
|
Options save_options_get(const Settings& settings)
|
||||||
{
|
{
|
||||||
Flags flags{};
|
Flags flags{SERIALIZE_GROUPS | SERIALIZE_REGIONS | SERIALIZE_SOUNDS};
|
||||||
if (settings.fileIsSerializeGroups) flags |= SERIALIZE_GROUPS;
|
|
||||||
if (settings.fileIsSerializeRegions) flags |= SERIALIZE_REGIONS;
|
|
||||||
if (settings.fileIsSerializeSounds) flags |= SERIALIZE_SOUNDS;
|
|
||||||
if (settings.fileIsKeepRedundantFrameRegionValues) flags |= SERIALIZE_REDUNDANT_FRAME_REGION_VALUES;
|
if (settings.fileIsKeepRedundantFrameRegionValues) flags |= SERIALIZE_REDUNDANT_FRAME_REGION_VALUES;
|
||||||
if (settings.fileIsBakeSpecialInterpolatedFrames) flags |= SERIALIZE_BAKE_SPECIAL_INTERPOLATED_FRAMES;
|
if (settings.fileIsBakeSpecialInterpolatedFrames) flags |= SERIALIZE_BAKE_SPECIAL_INTERPOLATED_FRAMES;
|
||||||
|
if (settings.isFileBakeGroupFrames) flags |= SERIALIZE_BAKE_GROUP_FRAMES;
|
||||||
return {.flags = flags};
|
return {.flags = flags};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void anm2_drag_drop_merge_queue(Manager& manager, const std::vector<std::filesystem::path>& paths,
|
||||||
|
Document::FileMergePreset preset)
|
||||||
|
{
|
||||||
|
manager.command_push({manager.selected,
|
||||||
|
[paths, preset](Manager&, Document& document)
|
||||||
|
{
|
||||||
|
document.anm2_snapshot(localize.get(EDIT_MERGE_ANM2));
|
||||||
|
for (auto& path : paths) document.file_merge(path, preset);
|
||||||
|
document.change(Document::ALL);
|
||||||
|
}});
|
||||||
|
}
|
||||||
|
|
||||||
void Documents::pending_document_order_apply(Manager& manager)
|
void Documents::pending_document_order_apply(Manager& manager)
|
||||||
{
|
{
|
||||||
if (pendingDocumentTabIds.size() != manager.documents.size())
|
if (pendingDocumentTabIds.size() != manager.documents.size())
|
||||||
@@ -161,7 +191,7 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
auto& document = manager.documents[i];
|
auto& document = manager.documents[i];
|
||||||
auto isDocumentDirty = document.is_dirty() || document.isForceDirty;
|
auto isDocumentDirty = document.is_dirty() || document.isForceDirty;
|
||||||
auto isSpritesheetDirty = document.spritesheet_any_dirty();
|
auto isSpritesheetDirty = document.spritesheet_any_dirty() || document.overlay_any_dirty();
|
||||||
auto isDirty = isDocumentDirty || isSpritesheetDirty;
|
auto isDirty = isDocumentDirty || isSpritesheetDirty;
|
||||||
|
|
||||||
if (!closePopup.is_open())
|
if (!closePopup.is_open())
|
||||||
@@ -258,7 +288,7 @@ namespace anm2ed::imgui
|
|||||||
|
|
||||||
auto filename = path::to_utf8(closeDocument.filename_get());
|
auto filename = path::to_utf8(closeDocument.filename_get());
|
||||||
auto isDocumentDirty = closeDocument.is_dirty() || closeDocument.isForceDirty;
|
auto isDocumentDirty = closeDocument.is_dirty() || closeDocument.isForceDirty;
|
||||||
auto isSpritesheetDirty = closeDocument.spritesheet_any_dirty();
|
auto isSpritesheetDirty = closeDocument.spritesheet_any_dirty() || closeDocument.overlay_any_dirty();
|
||||||
auto promptLabel =
|
auto promptLabel =
|
||||||
isDocumentDirty && isSpritesheetDirty
|
isDocumentDirty && isSpritesheetDirty
|
||||||
? LABEL_DOCUMENT_AND_SPRITESHEETS_MODIFIED_PROMPT
|
? LABEL_DOCUMENT_AND_SPRITESHEETS_MODIFIED_PROMPT
|
||||||
@@ -296,24 +326,51 @@ namespace anm2ed::imgui
|
|||||||
if (spritesheet.type != ElementType::SPRITESHEET) continue;
|
if (spritesheet.type != ElementType::SPRITESHEET) continue;
|
||||||
auto id = spritesheet.id;
|
auto id = spritesheet.id;
|
||||||
auto texture = closeDocument.texture_get(id);
|
auto texture = closeDocument.texture_get(id);
|
||||||
if (!texture || !closeDocument.spritesheet_is_dirty(id)) continue;
|
if (texture && closeDocument.spritesheet_is_dirty(id))
|
||||||
auto pathString = path::to_utf8(spritesheet.path);
|
|
||||||
auto savePath = closeDocument.directory_get() / spritesheet.path;
|
|
||||||
path::ensure_directory(savePath.parent_path());
|
|
||||||
if (texture->write_png(savePath))
|
|
||||||
{
|
{
|
||||||
closeDocument.spritesheet_hash_set_saved(id);
|
auto pathString = path::to_utf8(spritesheet.path);
|
||||||
toasts.push(
|
auto savePath = closeDocument.directory_get() / spritesheet.path;
|
||||||
std::vformat(localize.get(TOAST_SAVE_SPRITESHEET), std::make_format_args(id, pathString)));
|
path::ensure_directory(savePath.parent_path());
|
||||||
logger.info(std::vformat(localize.get(TOAST_SAVE_SPRITESHEET, anm2ed::ENGLISH),
|
if (texture->write_png(savePath))
|
||||||
std::make_format_args(id, pathString)));
|
{
|
||||||
|
closeDocument.spritesheet_hash_set_saved(id);
|
||||||
|
toasts.push(
|
||||||
|
std::vformat(localize.get(TOAST_SAVE_SPRITESHEET), std::make_format_args(id, pathString)));
|
||||||
|
logger.info(std::vformat(localize.get(TOAST_SAVE_SPRITESHEET, anm2ed::ENGLISH),
|
||||||
|
std::make_format_args(id, pathString)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
toasts.push(std::vformat(localize.get(TOAST_SAVE_SPRITESHEET_FAILED),
|
||||||
|
std::make_format_args(id, pathString)));
|
||||||
|
logger.error(std::vformat(localize.get(TOAST_SAVE_SPRITESHEET_FAILED, anm2ed::ENGLISH),
|
||||||
|
std::make_format_args(id, pathString)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
for (auto& overlay : spritesheet.children)
|
||||||
{
|
{
|
||||||
toasts.push(std::vformat(localize.get(TOAST_SAVE_SPRITESHEET_FAILED),
|
if (overlay.type != ElementType::OVERLAY) continue;
|
||||||
std::make_format_args(id, pathString)));
|
auto overlayTexture = closeDocument.overlay_texture_get(overlay.id);
|
||||||
logger.error(std::vformat(localize.get(TOAST_SAVE_SPRITESHEET_FAILED, anm2ed::ENGLISH),
|
if (!overlayTexture || !closeDocument.overlay_is_dirty(overlay.id)) continue;
|
||||||
std::make_format_args(id, pathString)));
|
auto pathString = path::to_utf8(overlay.path);
|
||||||
|
auto savePath = closeDocument.directory_get() / overlay.path;
|
||||||
|
path::ensure_directory(savePath.parent_path());
|
||||||
|
if (overlayTexture->write_png(savePath))
|
||||||
|
{
|
||||||
|
closeDocument.overlay_hash_set_saved(overlay.id);
|
||||||
|
toasts.push(std::vformat(localize.get(TOAST_SAVE_OVERLAY),
|
||||||
|
std::make_format_args(overlay.id, pathString)));
|
||||||
|
logger.info(std::vformat(localize.get(TOAST_SAVE_OVERLAY, anm2ed::ENGLISH),
|
||||||
|
std::make_format_args(overlay.id, pathString)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
toasts.push(std::vformat(localize.get(TOAST_SAVE_OVERLAY_FAILED),
|
||||||
|
std::make_format_args(overlay.id, pathString)));
|
||||||
|
logger.error(std::vformat(localize.get(TOAST_SAVE_OVERLAY_FAILED, anm2ed::ENGLISH),
|
||||||
|
std::make_format_args(overlay.id, pathString)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -366,17 +423,62 @@ namespace anm2ed::imgui
|
|||||||
manager.isAnm2DragDrop = false;
|
manager.isAnm2DragDrop = false;
|
||||||
manager.anm2DragDropPaths.clear();
|
manager.anm2DragDropPaths.clear();
|
||||||
manager.anm2DragDropPopup.close();
|
manager.anm2DragDropPopup.close();
|
||||||
|
manager.anm2DragDropMergePopup.close();
|
||||||
|
manager.anm2DragDropMergePreset = Document::FILE_MERGE_PRESET_MERGE_BY_NAME;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (manager.anm2DragDropPaths.empty())
|
if (manager.anm2DragDropPaths.empty())
|
||||||
drag_drop_reset();
|
drag_drop_reset();
|
||||||
|
else if (manager.anm2DragDropMergePopup.is_open())
|
||||||
|
{
|
||||||
|
manager.anm2DragDropMergePopup.trigger();
|
||||||
|
|
||||||
|
if (ImGui::BeginPopupModal(manager.anm2DragDropMergePopup.label(), &manager.anm2DragDropMergePopup.isOpen,
|
||||||
|
ImGuiWindowFlags_NoResize))
|
||||||
|
{
|
||||||
|
auto document = manager.get();
|
||||||
|
manager.anm2DragDropMergePreset =
|
||||||
|
std::clamp(manager.anm2DragDropMergePreset, 0, Document::FILE_MERGE_PRESET_COUNT - 1);
|
||||||
|
|
||||||
|
for (int preset = 0; preset < Document::FILE_MERGE_PRESET_COUNT; ++preset)
|
||||||
|
{
|
||||||
|
ImGui::RadioButton(localize.get(ANM2_DRAG_DROP_MERGE_PRESET_LABELS[preset]),
|
||||||
|
&manager.anm2DragDropMergePreset, preset);
|
||||||
|
ImGui::SetItemTooltip("%s", localize.get(ANM2_DRAG_DROP_MERGE_PRESET_TOOLTIPS[preset]));
|
||||||
|
}
|
||||||
|
|
||||||
|
auto widgetSize = widget_size_with_row_get(2);
|
||||||
|
shortcut(manager.chords[SHORTCUT_CONFIRM]);
|
||||||
|
ImGui::BeginDisabled(!document);
|
||||||
|
if (ImGui::Button(localize.get(BASIC_MERGE), widgetSize))
|
||||||
|
{
|
||||||
|
auto paths = manager.anm2DragDropPaths;
|
||||||
|
auto preset = (Document::FileMergePreset)manager.anm2DragDropMergePreset;
|
||||||
|
anm2_drag_drop_merge_queue(manager, paths, preset);
|
||||||
|
drag_drop_reset();
|
||||||
|
}
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
shortcut(manager.chords[SHORTCUT_CANCEL]);
|
||||||
|
if (ImGui::Button(localize.get(BASIC_CANCEL), widgetSize)) drag_drop_reset();
|
||||||
|
|
||||||
|
manager.anm2DragDropMergePopup.end();
|
||||||
|
ImGui::EndPopup();
|
||||||
|
|
||||||
|
if (manager.isAnm2DragDrop && !manager.anm2DragDropMergePopup.is_open()) drag_drop_reset();
|
||||||
|
}
|
||||||
|
else if (!ImGui::IsPopupOpen(manager.anm2DragDropMergePopup.label()))
|
||||||
|
drag_drop_reset();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!manager.anm2DragDropPopup.is_open()) manager.anm2DragDropPopup.open();
|
if (!manager.anm2DragDropPopup.is_open()) manager.anm2DragDropPopup.open();
|
||||||
|
|
||||||
manager.anm2DragDropPopup.trigger();
|
manager.anm2DragDropPopup.trigger();
|
||||||
|
|
||||||
if (ImGui::BeginPopupContextWindow(manager.anm2DragDropPopup.label(), ImGuiPopupFlags_None))
|
if (ImGui::BeginPopup(manager.anm2DragDropPopup.label(), ImGuiWindowFlags_NoMove))
|
||||||
{
|
{
|
||||||
auto document = manager.get();
|
auto document = manager.get();
|
||||||
if (ImGui::MenuItem(manager.anm2DragDropPaths.size() > 1 ? localize.get(LABEL_DOCUMENTS_OPEN_MANY)
|
if (ImGui::MenuItem(manager.anm2DragDropPaths.size() > 1 ? localize.get(LABEL_DOCUMENTS_OPEN_MANY)
|
||||||
@@ -396,15 +498,9 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
if (document)
|
if (document)
|
||||||
{
|
{
|
||||||
auto paths = manager.anm2DragDropPaths;
|
manager.anm2DragDropPopup.close();
|
||||||
manager.command_push({manager.selected,
|
manager.anm2DragDropMergePopup.open();
|
||||||
[paths](Manager&, Document& document)
|
ImGui::CloseCurrentPopup();
|
||||||
{
|
|
||||||
document.snapshot(localize.get(EDIT_MERGE_ANM2));
|
|
||||||
for (auto& path : paths) document.file_merge(path);
|
|
||||||
document.change(Document::ALL);
|
|
||||||
}});
|
|
||||||
drag_drop_reset();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ namespace anm2ed::imgui::popup
|
|||||||
{
|
{
|
||||||
int addId{-1};
|
int addId{-1};
|
||||||
|
|
||||||
document.snapshot(localize.get(EDIT_ADD_ITEM));
|
document.anm2_snapshot(localize.get(EDIT_ADD_ITEM));
|
||||||
if (queuedType == LAYER)
|
if (queuedType == LAYER)
|
||||||
addId = document.anm2.layer_animation_add(
|
addId = document.anm2.layer_animation_add(
|
||||||
queuedAnimationIndex, queuedAddItemID, queuedInsertBeforeID, queuedAddItemName,
|
queuedAnimationIndex, queuedAddItemID, queuedInsertBeforeID, queuedAddItemName,
|
||||||
|
|||||||
@@ -29,12 +29,10 @@ namespace anm2ed::imgui
|
|||||||
|
|
||||||
Options save_options_get(Settings& settings)
|
Options save_options_get(Settings& settings)
|
||||||
{
|
{
|
||||||
Flags flags{};
|
Flags flags{SERIALIZE_GROUPS | SERIALIZE_REGIONS | SERIALIZE_SOUNDS};
|
||||||
if (settings.fileIsSerializeGroups) flags |= SERIALIZE_GROUPS;
|
|
||||||
if (settings.fileIsSerializeRegions) flags |= SERIALIZE_REGIONS;
|
|
||||||
if (settings.fileIsSerializeSounds) flags |= SERIALIZE_SOUNDS;
|
|
||||||
if (settings.fileIsKeepRedundantFrameRegionValues) flags |= SERIALIZE_REDUNDANT_FRAME_REGION_VALUES;
|
if (settings.fileIsKeepRedundantFrameRegionValues) flags |= SERIALIZE_REDUNDANT_FRAME_REGION_VALUES;
|
||||||
if (settings.fileIsBakeSpecialInterpolatedFrames) flags |= SERIALIZE_BAKE_SPECIAL_INTERPOLATED_FRAMES;
|
if (settings.fileIsBakeSpecialInterpolatedFrames) flags |= SERIALIZE_BAKE_SPECIAL_INTERPOLATED_FRAMES;
|
||||||
|
if (settings.isFileBakeGroupFrames) flags |= SERIALIZE_BAKE_GROUP_FRAMES;
|
||||||
return {.flags = flags};
|
return {.flags = flags};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,7 +184,7 @@ namespace anm2ed::imgui
|
|||||||
manager.command_push({manager.selected,
|
manager.command_push({manager.selected,
|
||||||
[](Manager&, Document& document)
|
[](Manager&, Document& document)
|
||||||
{
|
{
|
||||||
document.snapshot(localize.get(EDIT_SCAN_AND_SET_REGIONS));
|
document.anm2_snapshot(localize.get(EDIT_SCAN_AND_SET_REGIONS));
|
||||||
document.scan_and_set_regions();
|
document.scan_and_set_regions();
|
||||||
document.change(Document::FRAMES);
|
document.change(Document::FRAMES);
|
||||||
}});
|
}});
|
||||||
@@ -301,7 +299,7 @@ namespace anm2ed::imgui
|
|||||||
[=](Manager&, Document& document)
|
[=](Manager&, Document& document)
|
||||||
{
|
{
|
||||||
if (queuedAnimationIndices.empty()) return;
|
if (queuedAnimationIndices.empty()) return;
|
||||||
document.snapshot(localize.get(EDIT_GENERATE_REGIONS_FROM_ANIMATIONS));
|
document.anm2_snapshot(localize.get(EDIT_GENERATE_REGIONS_FROM_ANIMATIONS));
|
||||||
if (document.regions_generate_from_animations(queuedAnimationIndices, queuedFormat,
|
if (document.regions_generate_from_animations(queuedAnimationIndices, queuedFormat,
|
||||||
queuedMapping))
|
queuedMapping))
|
||||||
document.anm2_change(queuedMapping == Document::RegionFrameMapping::SET
|
document.anm2_change(queuedMapping == Document::RegionFrameMapping::SET
|
||||||
|
|||||||
@@ -198,6 +198,19 @@ namespace anm2ed::imgui
|
|||||||
auto pathString = path::to_utf8(path);
|
auto pathString = path::to_utf8(path);
|
||||||
auto& type = settings.renderType;
|
auto& type = settings.renderType;
|
||||||
auto renderFrameRate = std::max(settings.playbackTickRate, 1);
|
auto renderFrameRate = std::max(settings.playbackTickRate, 1);
|
||||||
|
auto isRenderPreviewOverridden = settings.renderIsUseAnimationBounds || settings.renderIsUseIsolatedAnimation;
|
||||||
|
auto render_preview_restore = [&]()
|
||||||
|
{
|
||||||
|
if (!isRenderPreviewOverridden) return;
|
||||||
|
|
||||||
|
settings = savedSettings;
|
||||||
|
pan = savedPan;
|
||||||
|
zoom = savedZoom;
|
||||||
|
overlayIndex = savedOverlayIndex;
|
||||||
|
isSizeTrySet = true;
|
||||||
|
hasPendingZoomPanAdjust = false;
|
||||||
|
isCheckerPanInitialized = false;
|
||||||
|
};
|
||||||
|
|
||||||
if (playback.time >= (float)end + 1.0f || playback.isFinished)
|
if (playback.time >= (float)end + 1.0f || playback.isFinished)
|
||||||
{
|
{
|
||||||
@@ -223,6 +236,9 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
auto& rows = settings.renderRows;
|
auto& rows = settings.renderRows;
|
||||||
auto& columns = settings.renderColumns;
|
auto& columns = settings.renderColumns;
|
||||||
|
auto layout = render::spritesheet_layout_get(rows, columns, (int)renderTempFrames.size());
|
||||||
|
rows = layout.rows;
|
||||||
|
columns = layout.columns;
|
||||||
|
|
||||||
if (renderTempFrames.empty())
|
if (renderTempFrames.empty())
|
||||||
{
|
{
|
||||||
@@ -324,17 +340,7 @@ namespace anm2ed::imgui
|
|||||||
renderFrameSoundIDs.clear();
|
renderFrameSoundIDs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.renderIsRawAnimation)
|
render_preview_restore();
|
||||||
{
|
|
||||||
settings = savedSettings;
|
|
||||||
|
|
||||||
pan = savedPan;
|
|
||||||
zoom = savedZoom;
|
|
||||||
overlayIndex = savedOverlayIndex;
|
|
||||||
isSizeTrySet = true;
|
|
||||||
hasPendingZoomPanAdjust = false;
|
|
||||||
isCheckerPanInitialized = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
playback.isPlaying = false;
|
playback.isPlaying = false;
|
||||||
playback.isFinished = false;
|
playback.isFinished = false;
|
||||||
@@ -349,8 +355,7 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
auto soundTime = (int)std::floor(playback.time);
|
auto soundTime = (int)std::floor(playback.time);
|
||||||
auto animation = anm2.element_get(ElementType::ANIMATION, document.reference.animationIndex);
|
auto animation = anm2.element_get(ElementType::ANIMATION, document.reference.animationIndex);
|
||||||
if (soundTime != renderFrameSoundTimePrev && animation &&
|
if (soundTime != renderFrameSoundTimePrev && animation)
|
||||||
(!settings.timelineIsOnlyShowLayers || manager.isRecording))
|
|
||||||
frameSoundID = trigger_sound_id_get(animation, playback.time);
|
frameSoundID = trigger_sound_id_get(animation, playback.time);
|
||||||
renderFrameSoundTimePrev = soundTime;
|
renderFrameSoundTimePrev = soundTime;
|
||||||
}
|
}
|
||||||
@@ -358,7 +363,7 @@ namespace anm2ed::imgui
|
|||||||
|
|
||||||
bind();
|
bind();
|
||||||
auto pixels = pixels_get();
|
auto pixels = pixels_get();
|
||||||
if (settings.renderIsRawAnimation) pixels_unpremultiply_alpha(pixels);
|
if (isRenderPreviewOverridden) pixels_unpremultiply_alpha(pixels);
|
||||||
auto frameIndex = (int)renderTempFrames.size();
|
auto frameIndex = (int)renderTempFrames.size();
|
||||||
auto framePath = renderTempDirectory / render_frame_filename(settings.renderFormat, frameIndex);
|
auto framePath = renderTempDirectory / render_frame_filename(settings.renderFormat, frameIndex);
|
||||||
if (Texture::write_pixels_png(framePath, size, pixels.data()))
|
if (Texture::write_pixels_png(framePath, size, pixels.data()))
|
||||||
@@ -376,6 +381,7 @@ namespace anm2ed::imgui
|
|||||||
if (type != render::PNGS) render_temp_cleanup(renderTempDirectory, renderTempFrames);
|
if (type != render::PNGS) render_temp_cleanup(renderTempDirectory, renderTempFrames);
|
||||||
renderTempFrameDurations.clear();
|
renderTempFrameDurations.clear();
|
||||||
renderFrameSoundIDs.clear();
|
renderFrameSoundIDs.clear();
|
||||||
|
render_preview_restore();
|
||||||
playback.isPlaying = false;
|
playback.isPlaying = false;
|
||||||
playback.isFinished = false;
|
playback.isFinished = false;
|
||||||
manager.isRecording = false;
|
manager.isRecording = false;
|
||||||
@@ -388,7 +394,6 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
auto animation = anm2.element_get(ElementType::ANIMATION, document.reference.animationIndex);
|
auto animation = anm2.element_get(ElementType::ANIMATION, document.reference.animationIndex);
|
||||||
auto& isSound = settings.timelineIsSound;
|
auto& isSound = settings.timelineIsSound;
|
||||||
auto& isOnlyShowLayers = settings.timelineIsOnlyShowLayers;
|
|
||||||
|
|
||||||
if (!animation)
|
if (!animation)
|
||||||
{
|
{
|
||||||
@@ -400,9 +405,8 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
if (!manager.isRecording && !document.sounds.empty() && isSound)
|
if (!manager.isRecording && !document.sounds.empty() && isSound)
|
||||||
{
|
{
|
||||||
if (!isOnlyShowLayers || manager.isRecording)
|
if (auto soundID = trigger_sound_id_get(animation, playback.time); soundID != -1)
|
||||||
if (auto soundID = trigger_sound_id_get(animation, playback.time); soundID != -1)
|
if (auto sound = document.sound_get(soundID)) sound->play(false, mixer);
|
||||||
if (auto sound = document.sound_get(soundID)) sound->play(false, mixer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto info = element_first_get(anm2.root, ElementType::INFO);
|
auto info = element_first_get(anm2.root, ElementType::INFO);
|
||||||
@@ -628,12 +632,29 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
savedSettings = settings;
|
savedSettings = settings;
|
||||||
|
|
||||||
if (settings.renderIsRawAnimation)
|
auto isRenderPreviewOverridden = settings.renderIsUseAnimationBounds || settings.renderIsUseIsolatedAnimation;
|
||||||
|
if (isRenderPreviewOverridden)
|
||||||
{
|
{
|
||||||
savedOverlayIndex = overlayIndex;
|
savedOverlayIndex = overlayIndex;
|
||||||
savedZoom = zoom;
|
savedZoom = zoom;
|
||||||
savedPan = pan;
|
savedPan = pan;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.renderIsUseIsolatedAnimation)
|
||||||
|
{
|
||||||
|
overlayIndex = -1;
|
||||||
|
settings.animationPreviewTransparent = true;
|
||||||
|
settings.timelineIsOnlyShowLayers = true;
|
||||||
|
settings.previewIsAxes = false;
|
||||||
|
settings.previewIsGrid = false;
|
||||||
|
settings.previewIsPivots = false;
|
||||||
|
settings.previewIsAltIcons = false;
|
||||||
|
settings.previewIsBorder = false;
|
||||||
|
settings.onionskinIsEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.renderIsUseAnimationBounds)
|
||||||
|
{
|
||||||
if (animation)
|
if (animation)
|
||||||
if (auto rect = anm2.animation_rect(*animation, isRootTransform); rect != vec4(-1.0f))
|
if (auto rect = anm2.animation_rect(*animation, isRootTransform); rect != vec4(-1.0f))
|
||||||
{
|
{
|
||||||
@@ -665,6 +686,17 @@ namespace anm2ed::imgui
|
|||||||
}
|
}
|
||||||
if (renderTempDirectory.empty())
|
if (renderTempDirectory.empty())
|
||||||
{
|
{
|
||||||
|
if (isRenderPreviewOverridden)
|
||||||
|
{
|
||||||
|
settings = savedSettings;
|
||||||
|
pan = savedPan;
|
||||||
|
zoom = savedZoom;
|
||||||
|
overlayIndex = savedOverlayIndex;
|
||||||
|
isSizeTrySet = true;
|
||||||
|
hasPendingZoomPanAdjust = false;
|
||||||
|
isCheckerPanInitialized = false;
|
||||||
|
}
|
||||||
|
|
||||||
auto pathString = path::to_utf8(settings.renderPath);
|
auto pathString = path::to_utf8(settings.renderPath);
|
||||||
toasts.push(
|
toasts.push(
|
||||||
std::vformat(localize.get(TOAST_EXPORT_RENDERED_ANIMATION_FAILED), std::make_format_args(pathString)));
|
std::vformat(localize.get(TOAST_EXPORT_RENDERED_ANIMATION_FAILED), std::make_format_args(pathString)));
|
||||||
@@ -795,6 +827,27 @@ namespace anm2ed::imgui
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto group_root_frame_get = [](const Element& container, const Element& track, float t) -> std::optional<Element>
|
||||||
|
{
|
||||||
|
if (track.groupId == -1) return std::nullopt;
|
||||||
|
auto group = element_child_id_get(container, ElementType::GROUP, track.groupId);
|
||||||
|
auto root = group ? element_child_first_get(*group, ElementType::ROOT_ANIMATION) : nullptr;
|
||||||
|
if (!root) return std::nullopt;
|
||||||
|
return frame_generate(*root, t);
|
||||||
|
};
|
||||||
|
|
||||||
|
auto group_transform_for_time = [&](const Element& container, const Element& track, float t,
|
||||||
|
const glm::mat4& sampleTransform)
|
||||||
|
{
|
||||||
|
auto itemTransform = sampleTransform;
|
||||||
|
if (isRootTransform)
|
||||||
|
if (auto groupRootFrame = group_root_frame_get(container, track, t))
|
||||||
|
itemTransform *= math::quad_model_parent_get(groupRootFrame->position, {},
|
||||||
|
math::percent_to_unit(groupRootFrame->scale),
|
||||||
|
groupRootFrame->rotation);
|
||||||
|
return itemTransform;
|
||||||
|
};
|
||||||
|
|
||||||
auto draw_root =
|
auto draw_root =
|
||||||
[&](float sampleTime, const glm::mat4& sampleTransform, vec3 sampleColor, float sampleAlpha, bool isOnion)
|
[&](float sampleTime, const glm::mat4& sampleTransform, vec3 sampleColor, float sampleAlpha, bool isOnion)
|
||||||
{
|
{
|
||||||
@@ -824,12 +877,52 @@ namespace anm2ed::imgui
|
|||||||
|
|
||||||
draw_root(time, transform, {}, 0.0f, false);
|
draw_root(time, transform, {}, 0.0f, false);
|
||||||
|
|
||||||
|
auto draw_group_root = [&](Element& group, int groupType, float sampleTime,
|
||||||
|
const glm::mat4& sampleTransform, vec3 sampleColor, float sampleAlpha,
|
||||||
|
bool isOnion)
|
||||||
|
{
|
||||||
|
auto groupRoot = element_child_first_get(group, ElementType::ROOT_ANIMATION);
|
||||||
|
if (!groupRoot) return;
|
||||||
|
auto rootFrame = frame_generate(*groupRoot, sampleTime);
|
||||||
|
if (isOnlyShowLayers || !rootFrame.isVisible || !groupRoot->isVisible) return;
|
||||||
|
|
||||||
|
auto itemTransform = sampleTransform;
|
||||||
|
if (isRootTransform)
|
||||||
|
itemTransform *= math::quad_model_parent_get(rootFrame.position, {}, math::percent_to_unit(rootFrame.scale),
|
||||||
|
rootFrame.rotation);
|
||||||
|
|
||||||
|
auto rootModel = isRootTransform
|
||||||
|
? math::quad_model_get(TARGET_SIZE, {}, TARGET_SIZE * 0.5f)
|
||||||
|
: math::quad_model_get(TARGET_SIZE, rootFrame.position, TARGET_SIZE * 0.5f,
|
||||||
|
math::percent_to_unit(rootFrame.scale), rootFrame.rotation);
|
||||||
|
auto rootTransform = itemTransform * rootModel;
|
||||||
|
|
||||||
|
auto isSelected = referenceItemType == ItemType::ROOT && reference.groupType == groupType &&
|
||||||
|
reference.groupId == group.id;
|
||||||
|
vec4 color = isOnion ? vec4(sampleColor, sampleAlpha) : isSelected ? color::RED : ROOT_COLOR;
|
||||||
|
auto icon = isAltIcons ? icon::TARGET_ALT : icon::TARGET;
|
||||||
|
texture_render(shaderTexture, resources.icons[icon].id, rootTransform, color);
|
||||||
|
};
|
||||||
|
|
||||||
if (auto layerAnimations = element_child_first_get(*animation, ElementType::LAYER_ANIMATIONS))
|
if (auto layerAnimations = element_child_first_get(*animation, ElementType::LAYER_ANIMATIONS))
|
||||||
{
|
{
|
||||||
auto layer_animation_draw = [&](auto&& self, Element& layerAnimation, bool isParentVisible = true) -> void
|
auto layer_animation_draw = [&](auto&& self, Element& layerAnimation, bool isParentVisible = true) -> void
|
||||||
{
|
{
|
||||||
if (layerAnimation.type == ElementType::GROUP)
|
if (layerAnimation.type == ElementType::GROUP)
|
||||||
{
|
{
|
||||||
|
if (isParentVisible && layerAnimation.isVisible)
|
||||||
|
{
|
||||||
|
auto groupRoot = element_child_first_get(layerAnimation, ElementType::ROOT_ANIMATION);
|
||||||
|
if (layeredOnions && groupRoot)
|
||||||
|
for (auto& sample : *layeredOnions)
|
||||||
|
if (auto sampleTime = sample_time_for_item(*groupRoot, sample))
|
||||||
|
{
|
||||||
|
auto sampleTransform = transform_for_time(*sampleTime);
|
||||||
|
draw_group_root(layerAnimation, LAYER, *sampleTime, sampleTransform, sample.colorOffset,
|
||||||
|
sample.alphaOffset, true);
|
||||||
|
}
|
||||||
|
draw_group_root(layerAnimation, LAYER, time, transform, {}, 0.0f, false);
|
||||||
|
}
|
||||||
for (auto& child : layerAnimation.children)
|
for (auto& child : layerAnimation.children)
|
||||||
self(self, child, isParentVisible && layerAnimation.isVisible);
|
self(self, child, isParentVisible && layerAnimation.isVisible);
|
||||||
return;
|
return;
|
||||||
@@ -864,7 +957,9 @@ namespace anm2ed::imgui
|
|||||||
|
|
||||||
auto layerModel =
|
auto layerModel =
|
||||||
math::quad_model_get(size, frame.position, pivot, math::percent_to_unit(frame.scale), frame.rotation);
|
math::quad_model_get(size, frame.position, pivot, math::percent_to_unit(frame.scale), frame.rotation);
|
||||||
auto layerTransform = sampleTransform * layerModel;
|
auto itemTransform = group_transform_for_time(*layerAnimations, layerAnimation, sampleTime,
|
||||||
|
sampleTransform);
|
||||||
|
auto layerTransform = itemTransform * layerModel;
|
||||||
|
|
||||||
auto uvMin = crop / texSize;
|
auto uvMin = crop / texSize;
|
||||||
auto uvMax = (crop + size) / texSize;
|
auto uvMax = (crop + size) / texSize;
|
||||||
@@ -878,12 +973,38 @@ namespace anm2ed::imgui
|
|||||||
frameColorOffset += rootFrame.colorOffset;
|
frameColorOffset += rootFrame.colorOffset;
|
||||||
frameTint *= rootFrame.tint;
|
frameTint *= rootFrame.tint;
|
||||||
}
|
}
|
||||||
|
if (isRootTransform)
|
||||||
|
if (auto groupRootFrame = group_root_frame_get(*layerAnimations, layerAnimation, sampleTime))
|
||||||
|
{
|
||||||
|
frameColorOffset += groupRootFrame->colorOffset;
|
||||||
|
frameTint *= groupRootFrame->tint;
|
||||||
|
}
|
||||||
|
|
||||||
frameTint.a = std::max(0.0f, frameTint.a - (alphaOffset + sampleAlpha));
|
frameTint.a = std::max(0.0f, frameTint.a - (alphaOffset + sampleAlpha));
|
||||||
|
|
||||||
auto vertices = math::uv_vertices_get(uvMin, uvMax);
|
auto vertices = math::uv_vertices_get(uvMin, uvMax);
|
||||||
|
auto customShader = document.shader_get(layer->spritesheetId);
|
||||||
|
auto& layerShader = customShader ? *customShader : shaderTexture;
|
||||||
|
|
||||||
texture_render(shaderTexture, texture.id, layerTransform, frameTint, frameColorOffset, vertices.data());
|
texture_render(layerShader, texture.id, layerTransform, frameTint, frameColorOffset, vertices.data(),
|
||||||
|
vec2(texture.size), sampleTime);
|
||||||
|
|
||||||
|
for (auto& overlay : spritesheet->children)
|
||||||
|
{
|
||||||
|
if (overlay.type != ElementType::OVERLAY) continue;
|
||||||
|
if (!overlay.isVisible) continue;
|
||||||
|
auto overlayTexture = document.overlay_texture_get(overlay.id);
|
||||||
|
if (!overlayTexture || !overlayTexture->is_valid()) continue;
|
||||||
|
|
||||||
|
auto overlayTexSize = vec2(overlayTexture->size);
|
||||||
|
if (overlayTexSize.x <= 0.0f || overlayTexSize.y <= 0.0f) continue;
|
||||||
|
|
||||||
|
auto overlayUvMin = crop / overlayTexSize;
|
||||||
|
auto overlayUvMax = (crop + size) / overlayTexSize;
|
||||||
|
auto overlayVertices = math::uv_vertices_get(overlayUvMin, overlayUvMax);
|
||||||
|
texture_render(shaderTexture, overlayTexture->id, layerTransform, frameTint, frameColorOffset,
|
||||||
|
overlayVertices.data(), vec2(overlayTexture->size), sampleTime);
|
||||||
|
}
|
||||||
|
|
||||||
auto color = isOnion ? vec4(sampleColor, 1.0f - sampleAlpha)
|
auto color = isOnion ? vec4(sampleColor, 1.0f - sampleAlpha)
|
||||||
: is_layer_animation_selected(id) ? SELECTED_LAYER_BORDER_COLOR
|
: is_layer_animation_selected(id) ? SELECTED_LAYER_BORDER_COLOR
|
||||||
@@ -895,7 +1016,7 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
auto pivotModel = math::quad_model_get(PIVOT_SIZE, frame.position, PIVOT_SIZE * 0.5f,
|
auto pivotModel = math::quad_model_get(PIVOT_SIZE, frame.position, PIVOT_SIZE * 0.5f,
|
||||||
math::percent_to_unit(frame.scale), frame.rotation);
|
math::percent_to_unit(frame.scale), frame.rotation);
|
||||||
auto pivotTransform = sampleTransform * pivotModel;
|
auto pivotTransform = itemTransform * pivotModel;
|
||||||
|
|
||||||
texture_render(shaderTexture, resources.icons[icon::PIVOT].id, pivotTransform, color);
|
texture_render(shaderTexture, resources.icons[icon::PIVOT].id, pivotTransform, color);
|
||||||
}
|
}
|
||||||
@@ -921,6 +1042,19 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
if (nullAnimation.type == ElementType::GROUP)
|
if (nullAnimation.type == ElementType::GROUP)
|
||||||
{
|
{
|
||||||
|
if (isParentVisible && nullAnimation.isVisible)
|
||||||
|
{
|
||||||
|
auto groupRoot = element_child_first_get(nullAnimation, ElementType::ROOT_ANIMATION);
|
||||||
|
if (layeredOnions && groupRoot)
|
||||||
|
for (auto& sample : *layeredOnions)
|
||||||
|
if (auto sampleTime = sample_time_for_item(*groupRoot, sample))
|
||||||
|
{
|
||||||
|
auto sampleTransform = transform_for_time(*sampleTime);
|
||||||
|
draw_group_root(nullAnimation, NULL_, *sampleTime, sampleTransform, sample.colorOffset,
|
||||||
|
sample.alphaOffset, true);
|
||||||
|
}
|
||||||
|
draw_group_root(nullAnimation, NULL_, time, transform, {}, 0.0f, false);
|
||||||
|
}
|
||||||
for (auto& child : nullAnimation.children)
|
for (auto& child : nullAnimation.children)
|
||||||
self(self, child, isParentVisible && nullAnimation.isVisible);
|
self(self, child, isParentVisible && nullAnimation.isVisible);
|
||||||
return;
|
return;
|
||||||
@@ -950,7 +1084,9 @@ namespace anm2ed::imgui
|
|||||||
|
|
||||||
auto nullModel = math::quad_model_get(size, frame.position, size * 0.5f,
|
auto nullModel = math::quad_model_get(size, frame.position, size * 0.5f,
|
||||||
math::percent_to_unit(frame.scale), frame.rotation);
|
math::percent_to_unit(frame.scale), frame.rotation);
|
||||||
auto nullTransform = sampleTransform * nullModel;
|
auto itemTransform = group_transform_for_time(*nullAnimations, nullAnimation, sampleTime,
|
||||||
|
sampleTransform);
|
||||||
|
auto nullTransform = itemTransform * nullModel;
|
||||||
|
|
||||||
texture_render(shaderTexture, resources.icons[icon].id, nullTransform, color);
|
texture_render(shaderTexture, resources.icons[icon].id, nullTransform, color);
|
||||||
|
|
||||||
@@ -958,7 +1094,7 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
auto rectModel =
|
auto rectModel =
|
||||||
math::quad_model_get(frame.scale, frame.position, frame.scale * 0.5f, vec2(1.0f), frame.rotation);
|
math::quad_model_get(frame.scale, frame.position, frame.scale * 0.5f, vec2(1.0f), frame.rotation);
|
||||||
auto rectTransform = sampleTransform * rectModel;
|
auto rectTransform = itemTransform * rectModel;
|
||||||
|
|
||||||
rect_render(shaderLine, rectTransform, rectModel, color);
|
rect_render(shaderLine, rectTransform, rectModel, color);
|
||||||
}
|
}
|
||||||
@@ -1074,9 +1210,10 @@ namespace anm2ed::imgui
|
|||||||
editItemType = static_cast<ItemType>(editReference.itemType);
|
editItemType = static_cast<ItemType>(editReference.itemType);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto frame =
|
auto frame = anm2.element_get(editReference);
|
||||||
anm2.element_get(editReference.animationIndex, editItemType, editReference.frameIndex, editReference.itemID);
|
auto editItemReference = editReference;
|
||||||
auto item = anm2.element_get(editReference.animationIndex, editItemType, editReference.itemID);
|
editItemReference.frameIndex = -1;
|
||||||
|
auto item = anm2.element_get(editItemReference);
|
||||||
auto nulls = anm2.element_get(ElementType::NULLS);
|
auto nulls = anm2.element_get(ElementType::NULLS);
|
||||||
auto selectedNull = editItemType == ItemType::NULL_ && nulls
|
auto selectedNull = editItemType == ItemType::NULL_ && nulls
|
||||||
? element_child_id_get(*nulls, ElementType::NULL_ELEMENT, editReference.itemID)
|
? element_child_id_get(*nulls, ElementType::NULL_ELEMENT, editReference.itemID)
|
||||||
@@ -1105,8 +1242,10 @@ namespace anm2ed::imgui
|
|||||||
|
|
||||||
auto frame_snapshot = [&](auto message)
|
auto frame_snapshot = [&](auto message)
|
||||||
{
|
{
|
||||||
|
auto queuedFrameReferences = selectedFrameReferences;
|
||||||
manager.command_push({manager.selected,
|
manager.command_push({manager.selected,
|
||||||
[message](Manager&, Document& document) { document.snapshot(localize.get(message)); }});
|
[message, queuedFrameReferences](Manager&, Document& document)
|
||||||
|
{ document.frames_snapshot(localize.get(message), queuedFrameReferences); }});
|
||||||
};
|
};
|
||||||
auto frame_change_apply = [&](FrameChange frameChange, ChangeType changeType = ChangeType::ADJUST)
|
auto frame_change_apply = [&](FrameChange frameChange, ChangeType changeType = ChangeType::ADJUST)
|
||||||
{
|
{
|
||||||
@@ -1116,15 +1255,16 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
std::map<Reference, std::set<int>> groupedFrames{};
|
std::map<Reference, std::set<int>> groupedFrames{};
|
||||||
for (auto frameReference : queuedFrameReferences)
|
for (auto frameReference : queuedFrameReferences)
|
||||||
groupedFrames[{frameReference.animationIndex, frameReference.itemType,
|
{
|
||||||
frameReference.itemID, -1}]
|
auto itemReference = frameReference;
|
||||||
.insert(frameReference.frameIndex);
|
itemReference.frameIndex = -1;
|
||||||
|
groupedFrames[itemReference].insert(frameReference.frameIndex);
|
||||||
|
}
|
||||||
|
|
||||||
for (auto& [itemReference, itemFrames] : groupedFrames)
|
for (auto& [itemReference, itemFrames] : groupedFrames)
|
||||||
{
|
{
|
||||||
auto itemType = static_cast<ItemType>(itemReference.itemType);
|
auto itemType = static_cast<ItemType>(itemReference.itemType);
|
||||||
auto item = document.anm2.element_get(itemReference.animationIndex, itemType,
|
auto item = document.anm2.element_get(itemReference);
|
||||||
itemReference.itemID);
|
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
frames_change(*item, frameChange, itemType, changeType, itemFrames);
|
frames_change(*item, frameChange, itemType, changeType, itemFrames);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,29 +36,26 @@ namespace anm2ed::imgui
|
|||||||
auto& anm2 = document.anm2;
|
auto& anm2 = document.anm2;
|
||||||
auto& reference = document.reference;
|
auto& reference = document.reference;
|
||||||
auto& type = reference.itemType;
|
auto& type = reference.itemType;
|
||||||
auto itemType = static_cast<ItemType>(type);
|
auto frame = reference.frameIndex >= 0 ? anm2.element_get(reference) : nullptr;
|
||||||
auto frame = anm2.element_get(reference.animationIndex, itemType, reference.frameIndex, reference.itemID);
|
|
||||||
|
|
||||||
auto frame_edit = [&](auto message, auto behavior)
|
auto frame_edit = [&](auto message, auto behavior)
|
||||||
{
|
{
|
||||||
auto queuedReference = reference;
|
auto queuedReference = reference;
|
||||||
manager.command_push({manager.selected,
|
manager.command_push({manager.selected,
|
||||||
[=](Manager&, Document& document) mutable
|
[=](Manager&, Document& document) mutable
|
||||||
{
|
{
|
||||||
auto itemType = static_cast<ItemType>(queuedReference.itemType);
|
if (queuedReference.frameIndex < 0) return;
|
||||||
auto frame = document.anm2.element_get(queuedReference.animationIndex, itemType,
|
auto frame = document.anm2.element_get(queuedReference);
|
||||||
queuedReference.frameIndex,
|
auto itemReference = queuedReference;
|
||||||
queuedReference.itemID);
|
itemReference.frameIndex = -1;
|
||||||
auto item =
|
auto item = document.anm2.element_get(itemReference);
|
||||||
document.anm2.element_get(queuedReference.animationIndex, itemType,
|
|
||||||
queuedReference.itemID);
|
|
||||||
if (!frame) return;
|
if (!frame) return;
|
||||||
|
|
||||||
document.snapshot(localize.get(message));
|
document.frames_snapshot(localize.get(message), {queuedReference});
|
||||||
behavior(document, *frame, item, queuedReference);
|
behavior(document, *frame, item, queuedReference);
|
||||||
document.anm2_change(Document::FRAMES);
|
document.anm2_change(Document::FRAMES);
|
||||||
}});
|
}});
|
||||||
};
|
};
|
||||||
|
|
||||||
auto persistent_edit = [&](auto state, auto message, auto behavior)
|
auto persistent_edit = [&](auto state, auto message, auto behavior)
|
||||||
{
|
{
|
||||||
@@ -68,20 +65,18 @@ namespace anm2ed::imgui
|
|||||||
manager.command_push({manager.selected,
|
manager.command_push({manager.selected,
|
||||||
[=](Manager&, Document& document) mutable
|
[=](Manager&, Document& document) mutable
|
||||||
{
|
{
|
||||||
auto itemType = static_cast<ItemType>(queuedReference.itemType);
|
if (queuedReference.frameIndex < 0) return;
|
||||||
auto frame = document.anm2.element_get(queuedReference.animationIndex, itemType,
|
auto frame = document.anm2.element_get(queuedReference);
|
||||||
queuedReference.frameIndex,
|
auto itemReference = queuedReference;
|
||||||
queuedReference.itemID);
|
itemReference.frameIndex = -1;
|
||||||
auto item =
|
auto item = document.anm2.element_get(itemReference);
|
||||||
document.anm2.element_get(queuedReference.animationIndex, itemType,
|
|
||||||
queuedReference.itemID);
|
|
||||||
if (!frame) return;
|
if (!frame) return;
|
||||||
|
|
||||||
if (state == edit::START) document.snapshot(localize.get(message));
|
if (state == edit::START) document.frames_snapshot(localize.get(message), {queuedReference});
|
||||||
behavior(document, *frame, item, queuedReference);
|
behavior(document, *frame, item, queuedReference);
|
||||||
if (state == edit::END) document.anm2_change(Document::FRAMES);
|
if (state == edit::END) document.anm2_change(Document::FRAMES);
|
||||||
}});
|
}});
|
||||||
};
|
};
|
||||||
|
|
||||||
auto regionLabelsString = std::vector<std::string>{localize.get(BASIC_NONE)};
|
auto regionLabelsString = std::vector<std::string>{localize.get(BASIC_NONE)};
|
||||||
auto regionLabels = std::vector<const char*>{regionLabelsString[0].c_str()};
|
auto regionLabels = std::vector<const char*>{regionLabelsString[0].c_str()};
|
||||||
|
|||||||
@@ -0,0 +1,430 @@
|
|||||||
|
#include "shaders.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <filesystem>
|
||||||
|
#include <format>
|
||||||
|
|
||||||
|
#include <imgui/imgui.h>
|
||||||
|
|
||||||
|
#include "path.hpp"
|
||||||
|
#include "strings.hpp"
|
||||||
|
#include "util/imgui/input.hpp"
|
||||||
|
#include "util/imgui/layout.hpp"
|
||||||
|
|
||||||
|
using namespace anm2ed::resource;
|
||||||
|
using namespace anm2ed::util;
|
||||||
|
|
||||||
|
namespace anm2ed::imgui
|
||||||
|
{
|
||||||
|
#define SHADER_UNIFORM_BINDING_COMBO_VALUES \
|
||||||
|
X(resource::shader::UNIFORM_BINDING_IGNORE) \
|
||||||
|
X(resource::shader::UNIFORM_BINDING_MANUAL) \
|
||||||
|
X(resource::shader::UNIFORM_BINDING_COLOR_OFFSET) \
|
||||||
|
X(resource::shader::UNIFORM_BINDING_FRAME_TINT) \
|
||||||
|
X(resource::shader::UNIFORM_BINDING_MAIN_TEXTURE) \
|
||||||
|
X(resource::shader::UNIFORM_BINDING_COMPONENTS) \
|
||||||
|
X(resource::shader::UNIFORM_BINDING_PLAYBACK_TIME) \
|
||||||
|
X(resource::shader::UNIFORM_BINDING_TEXTURE_SIZE) \
|
||||||
|
X(resource::shader::UNIFORM_BINDING_TRANSFORM)
|
||||||
|
|
||||||
|
inline constexpr resource::shader::UniformBinding SHADER_UNIFORM_BINDING_COMBO_ORDER[] = {
|
||||||
|
#define X(binding) binding,
|
||||||
|
SHADER_UNIFORM_BINDING_COMBO_VALUES
|
||||||
|
#undef X
|
||||||
|
};
|
||||||
|
#undef SHADER_UNIFORM_BINDING_COMBO_VALUES
|
||||||
|
|
||||||
|
std::filesystem::path shader_absolute_path_get(Document& document, const std::filesystem::path& shaderPath)
|
||||||
|
{
|
||||||
|
auto loadPath = path::backslash_handle(shaderPath);
|
||||||
|
if (loadPath.empty() || loadPath.is_absolute()) return loadPath;
|
||||||
|
return document.directory_get() / loadPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_shader_reload_needed(Document& document, Element& spritesheet, Element* shader)
|
||||||
|
{
|
||||||
|
if (!shader || !shader->isEnabled || shader->fragment.empty()) return false;
|
||||||
|
if (!document.shader_get(spritesheet.id)) return true;
|
||||||
|
if (!document.shaderVertexPaths.contains(spritesheet.id) || !document.shaderFragmentPaths.contains(spritesheet.id))
|
||||||
|
return true;
|
||||||
|
return document.shaderVertexPaths.at(spritesheet.id) != shader->vertex ||
|
||||||
|
document.shaderFragmentPaths.at(spritesheet.id) != shader->fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
Element* shader_spritesheet_get(Document& document)
|
||||||
|
{
|
||||||
|
if (document.spritesheet.selection.size() == 1)
|
||||||
|
return document.anm2.element_get(ElementType::SPRITESHEET, *document.spritesheet.selection.begin());
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
Element* shader_element_get(Element& spritesheet, bool isCreate)
|
||||||
|
{
|
||||||
|
if (auto shader = element_child_first_get(spritesheet, ElementType::SHADER)) return shader;
|
||||||
|
if (!isCreate) return nullptr;
|
||||||
|
|
||||||
|
spritesheet.children.push_back(element_make(ElementType::SHADER));
|
||||||
|
return &spritesheet.children.back();
|
||||||
|
}
|
||||||
|
|
||||||
|
void shader_enabled_set(Document& document, Element& spritesheet, bool isEnabled)
|
||||||
|
{
|
||||||
|
if (auto shader = shader_element_get(spritesheet, true))
|
||||||
|
{
|
||||||
|
shader->isEnabled = isEnabled;
|
||||||
|
document.change(Document::SPRITESHEETS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::filesystem::path shader_asset_path_get(Document& document, const std::filesystem::path& path)
|
||||||
|
{
|
||||||
|
auto loadPath = path::backslash_handle(path);
|
||||||
|
return path::backslash_replace(path::make_relative(loadPath, document.directory_get()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void shader_path_edit(Document& document, Element& spritesheet, std::filesystem::path Element::* member,
|
||||||
|
const std::filesystem::path& value)
|
||||||
|
{
|
||||||
|
if (auto shader = shader_element_get(spritesheet, true))
|
||||||
|
{
|
||||||
|
shader->*member = path::backslash_replace(value);
|
||||||
|
document.change(Document::SPRITESHEETS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void shader_dialog_update(ShadersWindow& window, Manager& manager, Dialog& dialog, Dialog::Type type,
|
||||||
|
std::filesystem::path Element::* member)
|
||||||
|
{
|
||||||
|
if (!dialog.is_selected(type)) return;
|
||||||
|
|
||||||
|
auto dialogPath = dialog.path;
|
||||||
|
auto spritesheetId = window.dialogSpritesheetId;
|
||||||
|
manager.command_push({manager.selected,
|
||||||
|
[dialogPath, spritesheetId, member](Manager&, Document& document)
|
||||||
|
{
|
||||||
|
auto spritesheet = document.anm2.element_get(ElementType::SPRITESHEET, spritesheetId);
|
||||||
|
if (!spritesheet) return;
|
||||||
|
shader_path_edit(document, *spritesheet, member,
|
||||||
|
shader_asset_path_get(document, dialogPath));
|
||||||
|
}});
|
||||||
|
window.dialogSpritesheetId = -1;
|
||||||
|
dialog.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void shader_path_row_update(ShadersWindow& window, Document& document, Resources& resources, Dialog& dialog,
|
||||||
|
Element* spritesheet, std::filesystem::path Element::* member, Dialog::Type dialogType,
|
||||||
|
StringType label)
|
||||||
|
{
|
||||||
|
auto shader = spritesheet ? shader_element_get(*spritesheet, false) : nullptr;
|
||||||
|
auto shaderPath = shader ? shader->*member : std::filesystem::path{};
|
||||||
|
auto isDefault = shaderPath.empty();
|
||||||
|
auto displayPath = isDefault ? path::from_utf8(localize.get(BASIC_DEFAULT)) : shaderPath;
|
||||||
|
|
||||||
|
if (ImGui::ImageButton(std::format("##{} Path Set", localize.get(label)).c_str(),
|
||||||
|
resources.icons[icon::FOLDER].id, icon_size_get()))
|
||||||
|
{
|
||||||
|
if (spritesheet)
|
||||||
|
{
|
||||||
|
window.dialogSpritesheetId = spritesheet->id;
|
||||||
|
dialog.file_open(dialogType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
auto labelWidth = ImGui::CalcTextSize(localize.get(label)).x;
|
||||||
|
auto inputWidth = ImGui::GetContentRegionAvail().x - labelWidth - ImGui::GetStyle().ItemSpacing.x;
|
||||||
|
if (inputWidth < ImGui::GetFrameHeight()) inputWidth = ImGui::GetFrameHeight();
|
||||||
|
ImGui::SetNextItemWidth(inputWidth);
|
||||||
|
ImGui::BeginDisabled(isDefault);
|
||||||
|
auto isEdited = input_text_path(std::format("##{} Path", localize.get(label)).c_str(), &displayPath);
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
if (isEdited && spritesheet)
|
||||||
|
shader_path_edit(document, *spritesheet, member, displayPath);
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::TextUnformatted(localize.get(label));
|
||||||
|
}
|
||||||
|
|
||||||
|
void shader_uniform_config_save(Document& document, Element& shaderElement, const resource::shader::Uniform& uniform)
|
||||||
|
{
|
||||||
|
auto config = shader_uniform_get(shaderElement, uniform.name, true);
|
||||||
|
if (!config) return;
|
||||||
|
|
||||||
|
config->binding = std::string(resource::shader::uniform_binding_value_get(uniform.binding));
|
||||||
|
config->value = resource::shader::uniform_value_string_get(uniform);
|
||||||
|
if (uniform.binding == resource::shader::UNIFORM_BINDING_COMPONENTS)
|
||||||
|
{
|
||||||
|
for (int index = 0; index < (int)uniform.components.size(); ++index)
|
||||||
|
{
|
||||||
|
auto component = shader_uniform_component_get(*config, index, true);
|
||||||
|
if (!component) continue;
|
||||||
|
component->binding = std::string(resource::shader::uniform_binding_value_get(uniform.components[index].binding));
|
||||||
|
component->value = std::format("{:.6g}", uniform.components[index].value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
std::erase_if(config->children, [](const Element& child) { return child.type == ElementType::COMPONENT; });
|
||||||
|
document.change(Document::SPRITESHEETS);
|
||||||
|
}
|
||||||
|
|
||||||
|
int shader_uniform_component_count_get(resource::shader::UniformValueType type)
|
||||||
|
{
|
||||||
|
if (type == resource::shader::UNIFORM_VALUE_VEC2) return 2;
|
||||||
|
if (type == resource::shader::UNIFORM_VALUE_VEC3) return 3;
|
||||||
|
if (type == resource::shader::UNIFORM_VALUE_VEC4) return 4;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void shader_uniform_components_from_value_set(resource::shader::Uniform& uniform)
|
||||||
|
{
|
||||||
|
uniform.components[0].value = uniform.value.x;
|
||||||
|
uniform.components[1].value = uniform.value.y;
|
||||||
|
uniform.components[2].value = uniform.value.z;
|
||||||
|
uniform.components[3].value = uniform.value.w;
|
||||||
|
}
|
||||||
|
|
||||||
|
void shader_uniform_value_from_components_set(resource::shader::Uniform& uniform)
|
||||||
|
{
|
||||||
|
uniform.value.x = uniform.components[0].value;
|
||||||
|
uniform.value.y = uniform.components[1].value;
|
||||||
|
uniform.value.z = uniform.components[2].value;
|
||||||
|
uniform.value.w = uniform.components[3].value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool shader_uniform_value_update(resource::shader::Uniform& uniform)
|
||||||
|
{
|
||||||
|
ImGui::SetNextItemWidth(-1.0f);
|
||||||
|
switch (uniform.valueType)
|
||||||
|
{
|
||||||
|
case resource::shader::UNIFORM_VALUE_FLOAT:
|
||||||
|
return ImGui::DragFloat("##Value", &uniform.value.x, 0.01f);
|
||||||
|
case resource::shader::UNIFORM_VALUE_INT:
|
||||||
|
case resource::shader::UNIFORM_VALUE_SAMPLER2D:
|
||||||
|
return ImGui::InputInt("##Value", &uniform.intValue);
|
||||||
|
case resource::shader::UNIFORM_VALUE_VEC2:
|
||||||
|
return ImGui::DragFloat2("##Value", &uniform.value.x, 0.01f);
|
||||||
|
case resource::shader::UNIFORM_VALUE_VEC3:
|
||||||
|
return ImGui::DragFloat3("##Value", &uniform.value.x, 0.01f);
|
||||||
|
case resource::shader::UNIFORM_VALUE_VEC4:
|
||||||
|
return ImGui::DragFloat4("##Value", &uniform.value.x, 0.01f);
|
||||||
|
default:
|
||||||
|
ImGui::TextUnformatted(localize.get(BASIC_NONE));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool shader_uniform_component_binding_update(resource::shader::Uniform::Component& component)
|
||||||
|
{
|
||||||
|
auto bindingLabel = resource::shader::uniform_binding_label_get(component.binding);
|
||||||
|
ImGui::SetNextItemWidth(ImGui::GetFrameHeight() * 5.0f);
|
||||||
|
if (!ImGui::BeginCombo("##Component Binding", bindingLabel.data())) return false;
|
||||||
|
|
||||||
|
bool isChanged{};
|
||||||
|
constexpr resource::shader::UniformBinding bindings[] = {resource::shader::UNIFORM_BINDING_MANUAL,
|
||||||
|
resource::shader::UNIFORM_BINDING_PLAYBACK_TIME};
|
||||||
|
for (auto binding : bindings)
|
||||||
|
{
|
||||||
|
auto isSelected = component.binding == binding;
|
||||||
|
auto label = resource::shader::uniform_binding_label_get(binding);
|
||||||
|
if (ImGui::Selectable(label.data(), isSelected))
|
||||||
|
{
|
||||||
|
component.binding = binding;
|
||||||
|
isChanged = true;
|
||||||
|
}
|
||||||
|
if (isSelected) ImGui::SetItemDefaultFocus();
|
||||||
|
}
|
||||||
|
ImGui::EndCombo();
|
||||||
|
return isChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool shader_uniform_components_update(resource::shader::Uniform& uniform)
|
||||||
|
{
|
||||||
|
bool isChanged{};
|
||||||
|
constexpr const char* labels[] = {"X", "Y", "Z", "W"};
|
||||||
|
auto componentCount = shader_uniform_component_count_get(uniform.valueType);
|
||||||
|
|
||||||
|
for (int index = 0; index < componentCount; ++index)
|
||||||
|
{
|
||||||
|
auto& component = uniform.components[index];
|
||||||
|
ImGui::PushID(index);
|
||||||
|
if (index > 0) ImGui::Spacing();
|
||||||
|
ImGui::TextUnformatted(labels[index]);
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (shader_uniform_component_binding_update(component)) isChanged = true;
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::BeginDisabled(component.binding != resource::shader::UNIFORM_BINDING_MANUAL);
|
||||||
|
ImGui::SetNextItemWidth(-1.0f);
|
||||||
|
if (ImGui::DragFloat("##Component Value", &component.value, 0.01f)) isChanged = true;
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
ImGui::PopID();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isChanged) shader_uniform_value_from_components_set(uniform);
|
||||||
|
return isChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
void shader_uniforms_update(Document& document, Element* shaderElement, resource::Shader* runtime)
|
||||||
|
{
|
||||||
|
if (!shaderElement || !runtime) return;
|
||||||
|
|
||||||
|
if (runtime->uniforms.empty())
|
||||||
|
{
|
||||||
|
ImGui::TextUnformatted(localize.get(BASIC_NONE));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto flags = ImGuiTableFlags_BordersInnerV | ImGuiTableFlags_BordersOuterH | ImGuiTableFlags_RowBg |
|
||||||
|
ImGuiTableFlags_Resizable | ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_ScrollY;
|
||||||
|
auto tableSize = ImGui::GetContentRegionAvail();
|
||||||
|
if (tableSize.y < ImGui::GetFrameHeight()) tableSize.y = ImGui::GetFrameHeight();
|
||||||
|
if (!ImGui::BeginTable("##Shader Uniforms", 4, flags, tableSize)) return;
|
||||||
|
|
||||||
|
ImGui::TableSetupColumn(localize.get(BASIC_NAME));
|
||||||
|
ImGui::TableSetupColumn(localize.get(LABEL_TYPE));
|
||||||
|
ImGui::TableSetupColumn(localize.get(LABEL_BINDING));
|
||||||
|
ImGui::TableSetupColumn(localize.get(LABEL_VALUE_COLUMN));
|
||||||
|
ImGui::TableSetupScrollFreeze(0, 1);
|
||||||
|
ImGui::TableHeadersRow();
|
||||||
|
|
||||||
|
for (auto& uniform : runtime->uniforms)
|
||||||
|
{
|
||||||
|
ImGui::PushID(uniform.name.c_str());
|
||||||
|
ImGui::TableNextRow();
|
||||||
|
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::TextUnformatted(uniform.name.c_str());
|
||||||
|
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
ImGui::TextUnformatted(resource::shader::uniform_value_type_label_get(uniform.valueType).data());
|
||||||
|
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
auto bindingLabel = resource::shader::uniform_binding_label_get(uniform.binding);
|
||||||
|
ImGui::SetNextItemWidth(-1.0f);
|
||||||
|
if (ImGui::BeginCombo("##Binding", bindingLabel.data()))
|
||||||
|
{
|
||||||
|
for (auto binding : SHADER_UNIFORM_BINDING_COMBO_ORDER)
|
||||||
|
{
|
||||||
|
if (!resource::shader::is_uniform_binding_valid(binding, uniform.valueType)) continue;
|
||||||
|
auto isSelected = uniform.binding == binding;
|
||||||
|
auto label = resource::shader::uniform_binding_label_get(binding);
|
||||||
|
if (ImGui::Selectable(label.data(), isSelected))
|
||||||
|
{
|
||||||
|
uniform.binding = binding;
|
||||||
|
if (uniform.binding == resource::shader::UNIFORM_BINDING_COMPONENTS)
|
||||||
|
shader_uniform_components_from_value_set(uniform);
|
||||||
|
shader_uniform_config_save(document, *shaderElement, uniform);
|
||||||
|
}
|
||||||
|
if (isSelected) ImGui::SetItemDefaultFocus();
|
||||||
|
}
|
||||||
|
ImGui::EndCombo();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::TableNextColumn();
|
||||||
|
if (uniform.binding == resource::shader::UNIFORM_BINDING_COMPONENTS)
|
||||||
|
{
|
||||||
|
if (shader_uniform_components_update(uniform)) shader_uniform_config_save(document, *shaderElement, uniform);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::BeginDisabled(uniform.binding != resource::shader::UNIFORM_BINDING_MANUAL);
|
||||||
|
if (shader_uniform_value_update(uniform))
|
||||||
|
{
|
||||||
|
shader_uniform_components_from_value_set(uniform);
|
||||||
|
shader_uniform_config_save(document, *shaderElement, uniform);
|
||||||
|
}
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::PopID();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::EndTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShadersWindow::update(Manager& manager, Settings& settings, Resources& resources, Dialog& dialog)
|
||||||
|
{
|
||||||
|
if (ImGui::Begin(localize.get(LABEL_SHADERS_WINDOW), &settings.windowIsShaders))
|
||||||
|
{
|
||||||
|
auto document = manager.get();
|
||||||
|
auto spritesheet = document ? shader_spritesheet_get(*document) : nullptr;
|
||||||
|
auto shader = spritesheet ? shader_element_get(*spritesheet, false) : nullptr;
|
||||||
|
auto isShaderEnabled = !shader || shader->isEnabled;
|
||||||
|
auto isReloadNeeded = document && spritesheet && is_shader_reload_needed(*document, *spritesheet, shader);
|
||||||
|
|
||||||
|
shader_dialog_update(*this, manager, dialog, Dialog::SHADER_VERTEX_PATH_SET, &Element::vertex);
|
||||||
|
shader_dialog_update(*this, manager, dialog, Dialog::SHADER_FRAGMENT_PATH_SET, &Element::fragment);
|
||||||
|
|
||||||
|
if (!spritesheet)
|
||||||
|
{
|
||||||
|
ImGui::TextUnformatted(localize.get(TEXT_SELECT_SPRITESHEET));
|
||||||
|
ImGui::End();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto contentSize = size_without_footer_get();
|
||||||
|
if (contentSize.y < ImGui::GetFrameHeight()) contentSize.y = ImGui::GetFrameHeight();
|
||||||
|
if (ImGui::BeginChild("##Shaders Child", contentSize, ImGuiChildFlags_Borders))
|
||||||
|
{
|
||||||
|
ImGui::BeginDisabled(!isShaderEnabled);
|
||||||
|
if (ImGui::BeginTabBar("##Shaders Tabs"))
|
||||||
|
{
|
||||||
|
if (ImGui::BeginTabItem(localize.get(LABEL_FILES)))
|
||||||
|
{
|
||||||
|
if (document)
|
||||||
|
{
|
||||||
|
shader_path_row_update(*this, *document, resources, dialog, spritesheet, &Element::vertex,
|
||||||
|
Dialog::SHADER_VERTEX_PATH_SET, LABEL_VERTEX);
|
||||||
|
shader_path_row_update(*this, *document, resources, dialog, spritesheet, &Element::fragment,
|
||||||
|
Dialog::SHADER_FRAGMENT_PATH_SET, LABEL_FRAGMENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isReloadNeeded) ImGui::TextWrapped("%s", localize.get(LABEL_SHADER_RELOAD_NEEDED));
|
||||||
|
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
auto consoleSize = ImGui::GetContentRegionAvail();
|
||||||
|
if (consoleSize.y < ImGui::GetFrameHeight()) consoleSize.y = ImGui::GetFrameHeight();
|
||||||
|
if (ImGui::BeginChild("##Shaders Console", consoleSize, ImGuiChildFlags_Borders))
|
||||||
|
ImGui::TextWrapped("%s", status.c_str());
|
||||||
|
ImGui::EndChild();
|
||||||
|
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
if (ImGui::BeginTabItem(localize.get(LABEL_UNIFORMS)))
|
||||||
|
{
|
||||||
|
shader_uniforms_update(*document, shader, document->shader_get(spritesheet->id));
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
ImGui::EndTabBar();
|
||||||
|
}
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
}
|
||||||
|
ImGui::EndChild();
|
||||||
|
|
||||||
|
auto widgetSize = widget_size_with_row_get(2);
|
||||||
|
if (ImGui::Button(localize.get(isShaderEnabled ? BASIC_ENABLED : BASIC_DISABLED), widgetSize))
|
||||||
|
{
|
||||||
|
auto spritesheetId = spritesheet->id;
|
||||||
|
auto isNextEnabled = !isShaderEnabled;
|
||||||
|
manager.command_push({manager.selected,
|
||||||
|
[spritesheetId, isNextEnabled](Manager&, Document& document)
|
||||||
|
{
|
||||||
|
auto spritesheet = document.anm2.element_get(ElementType::SPRITESHEET, spritesheetId);
|
||||||
|
if (spritesheet) shader_enabled_set(document, *spritesheet, isNextEnabled);
|
||||||
|
}});
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
ImGui::BeginDisabled(!isShaderEnabled || !document);
|
||||||
|
if (ImGui::Button(localize.get(BASIC_RELOAD), widgetSize) && document)
|
||||||
|
{
|
||||||
|
status.clear();
|
||||||
|
document->shader_reload(spritesheet->id, &status);
|
||||||
|
}
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
}
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "dialog.hpp"
|
||||||
|
#include "manager.hpp"
|
||||||
|
#include "resources.hpp"
|
||||||
|
#include "settings.hpp"
|
||||||
|
|
||||||
|
namespace anm2ed::imgui
|
||||||
|
{
|
||||||
|
class ShadersWindow
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
std::string status{};
|
||||||
|
int dialogSpritesheetId{-1};
|
||||||
|
void update(Manager&, Settings&, Resources&, Dialog&);
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -36,7 +36,6 @@ namespace anm2ed::imgui
|
|||||||
auto& anm2 = document.anm2;
|
auto& anm2 = document.anm2;
|
||||||
auto& reference = document.reference;
|
auto& reference = document.reference;
|
||||||
auto& referenceSpritesheet = document.spritesheet.reference;
|
auto& referenceSpritesheet = document.spritesheet.reference;
|
||||||
auto referenceItemType = static_cast<ItemType>(reference.itemType);
|
|
||||||
auto& pan = document.editorPan;
|
auto& pan = document.editorPan;
|
||||||
auto& zoom = document.editorZoom;
|
auto& zoom = document.editorZoom;
|
||||||
auto& backgroundColor = settings.editorBackgroundColor;
|
auto& backgroundColor = settings.editorBackgroundColor;
|
||||||
@@ -62,10 +61,17 @@ namespace anm2ed::imgui
|
|||||||
};
|
};
|
||||||
if (auto selectedLayerSpritesheet = selected_layer_spritesheet_get();
|
if (auto selectedLayerSpritesheet = selected_layer_spritesheet_get();
|
||||||
selectedLayerSpritesheet != -1 && document.editTarget != Document::EditTarget::REGION &&
|
selectedLayerSpritesheet != -1 && document.editTarget != Document::EditTarget::REGION &&
|
||||||
document.editTarget != Document::EditTarget::SPRITESHEET)
|
document.editTarget != Document::EditTarget::OVERLAY && document.editTarget != Document::EditTarget::SPRITESHEET)
|
||||||
referenceSpritesheet = selectedLayerSpritesheet;
|
referenceSpritesheet = selectedLayerSpritesheet;
|
||||||
auto spritesheet = anm2.element_get(ElementType::SPRITESHEET, referenceSpritesheet);
|
auto spritesheet = anm2.element_get(ElementType::SPRITESHEET, referenceSpritesheet);
|
||||||
auto texture = document.texture_get(referenceSpritesheet);
|
auto baseTexture = document.texture_get(referenceSpritesheet);
|
||||||
|
auto activeOverlayId = -1;
|
||||||
|
auto activeOverlay = document.editTarget == Document::EditTarget::OVERLAY ? document.overlay_get() : nullptr;
|
||||||
|
if (activeOverlay && document.overlay_spritesheet_id_get(activeOverlay->id) == referenceSpritesheet)
|
||||||
|
activeOverlayId = activeOverlay->id;
|
||||||
|
else
|
||||||
|
activeOverlay = nullptr;
|
||||||
|
auto texture = activeOverlayId != -1 ? document.overlay_texture_get(activeOverlayId) : baseTexture;
|
||||||
auto& tool = settings.tool;
|
auto& tool = settings.tool;
|
||||||
auto& shaderGrid = resources.shaders[shader::GRID];
|
auto& shaderGrid = resources.shaders[shader::GRID];
|
||||||
auto& shaderTexture = resources.shaders[shader::TEXTURE];
|
auto& shaderTexture = resources.shaders[shader::TEXTURE];
|
||||||
@@ -226,17 +232,28 @@ namespace anm2ed::imgui
|
|||||||
viewport_set();
|
viewport_set();
|
||||||
clear(isTransparent ? vec4(0) : vec4(backgroundColor, 1.0f));
|
clear(isTransparent ? vec4(0) : vec4(backgroundColor, 1.0f));
|
||||||
|
|
||||||
auto frame =
|
auto frame = reference.frameIndex >= 0 ? anm2.element_get(reference) : nullptr;
|
||||||
anm2.element_get(reference.animationIndex, referenceItemType, reference.frameIndex, reference.itemID);
|
|
||||||
|
|
||||||
if (spritesheet && texture && texture->is_valid())
|
auto viewTexture = baseTexture && baseTexture->is_valid() ? baseTexture : texture;
|
||||||
|
|
||||||
|
if (spritesheet && viewTexture && viewTexture->is_valid())
|
||||||
{
|
{
|
||||||
auto transform = transform_get(zoom, pan);
|
auto transform = transform_get(zoom, pan);
|
||||||
|
|
||||||
auto spritesheetModel = math::quad_model_get(texture->size);
|
auto spritesheetModel = math::quad_model_get(viewTexture->size);
|
||||||
auto spritesheetTransform = transform * spritesheetModel;
|
auto spritesheetTransform = transform * spritesheetModel;
|
||||||
|
|
||||||
texture_render(shaderTexture, texture->id, spritesheetTransform);
|
if (baseTexture && baseTexture->is_valid()) texture_render(shaderTexture, baseTexture->id, spritesheetTransform);
|
||||||
|
|
||||||
|
for (auto& overlay : spritesheet->children)
|
||||||
|
{
|
||||||
|
if (overlay.type != ElementType::OVERLAY) continue;
|
||||||
|
if (!overlay.isVisible) continue;
|
||||||
|
auto overlayTexture = document.overlay_texture_get(overlay.id);
|
||||||
|
if (!overlayTexture || !overlayTexture->is_valid()) continue;
|
||||||
|
auto overlayTransform = transform * math::quad_model_get(overlayTexture->size);
|
||||||
|
texture_render(shaderTexture, overlayTexture->id, overlayTransform);
|
||||||
|
}
|
||||||
|
|
||||||
if (isGrid) grid_render(shaderGrid, zoom, pan, gridSize, gridOffset, gridColor);
|
if (isGrid) grid_render(shaderGrid, zoom, pan, gridSize, gridOffset, gridColor);
|
||||||
|
|
||||||
@@ -376,10 +393,10 @@ namespace anm2ed::imgui
|
|||||||
auto editReference = reference;
|
auto editReference = reference;
|
||||||
if (!selectedFrameReferences.contains(reference) && !selectedFrameReferences.empty())
|
if (!selectedFrameReferences.contains(reference) && !selectedFrameReferences.empty())
|
||||||
editReference = *selectedFrameReferences.begin();
|
editReference = *selectedFrameReferences.begin();
|
||||||
auto editReferenceItemType = static_cast<ItemType>(editReference.itemType);
|
auto frame = editReference.frameIndex >= 0 ? anm2.element_get(editReference) : nullptr;
|
||||||
auto frame = anm2.element_get(editReference.animationIndex, editReferenceItemType, editReference.frameIndex,
|
auto itemReference = editReference;
|
||||||
editReference.itemID);
|
itemReference.frameIndex = -1;
|
||||||
auto item = anm2.element_get(editReference.animationIndex, editReferenceItemType, editReference.itemID);
|
auto item = anm2.element_get(itemReference);
|
||||||
auto layer = anm2.element_get(ElementType::LAYER_ELEMENT, editReference.itemID);
|
auto layer = anm2.element_get(ElementType::LAYER_ELEMENT, editReference.itemID);
|
||||||
bool isReferenceLayerOnSpritesheet =
|
bool isReferenceLayerOnSpritesheet =
|
||||||
frame && editReference.itemID > -1 && layer && layer->spritesheetId == referenceSpritesheet;
|
frame && editReference.itemID > -1 && layer && layer->spritesheetId == referenceSpritesheet;
|
||||||
@@ -423,11 +440,28 @@ namespace anm2ed::imgui
|
|||||||
auto fraction = current - glm::floor(current);
|
auto fraction = current - glm::floor(current);
|
||||||
return glm::floor(value) + fraction;
|
return glm::floor(value) + fraction;
|
||||||
};
|
};
|
||||||
auto snapshot_push = [&](StringType messageType)
|
auto frame_snapshot_push = [&](StringType messageType, const std::set<Reference>& frameReferences)
|
||||||
|
{
|
||||||
|
auto message = std::string(localize.get(messageType));
|
||||||
|
auto queuedFrameReferences = frameReferences;
|
||||||
|
manager.command_push({manager.selected,
|
||||||
|
[message, queuedFrameReferences](Manager&, Document& document)
|
||||||
|
{ document.frames_snapshot(message, queuedFrameReferences); }});
|
||||||
|
};
|
||||||
|
auto region_snapshot_push = [&](StringType messageType, const std::set<int>& regionIds)
|
||||||
|
{
|
||||||
|
auto message = std::string(localize.get(messageType));
|
||||||
|
auto queuedSpritesheet = referenceSpritesheet;
|
||||||
|
auto queuedRegionIds = regionIds;
|
||||||
|
manager.command_push({manager.selected,
|
||||||
|
[message, queuedSpritesheet, queuedRegionIds](Manager&, Document& document)
|
||||||
|
{ document.regions_snapshot(message, queuedSpritesheet, queuedRegionIds); }});
|
||||||
|
};
|
||||||
|
auto texture_snapshot_push = [&](StringType messageType)
|
||||||
{
|
{
|
||||||
auto message = std::string(localize.get(messageType));
|
auto message = std::string(localize.get(messageType));
|
||||||
manager.command_push(
|
manager.command_push(
|
||||||
{manager.selected, [message](Manager&, Document& document) { document.snapshot(message); }});
|
{manager.selected, [message](Manager&, Document& document) { document.textures_snapshot(message); }});
|
||||||
};
|
};
|
||||||
auto document_change_push = [&](Document::ChangeType changeType)
|
auto document_change_push = [&](Document::ChangeType changeType)
|
||||||
{
|
{
|
||||||
@@ -443,13 +477,16 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
std::map<Reference, std::set<int>> groupedFrames{};
|
std::map<Reference, std::set<int>> groupedFrames{};
|
||||||
for (auto frameReference : queuedFrameReferences)
|
for (auto frameReference : queuedFrameReferences)
|
||||||
groupedFrames[{frameReference.animationIndex, frameReference.itemType, frameReference.itemID, -1}]
|
{
|
||||||
.insert(frameReference.frameIndex);
|
auto itemReference = frameReference;
|
||||||
|
itemReference.frameIndex = -1;
|
||||||
|
groupedFrames[itemReference].insert(frameReference.frameIndex);
|
||||||
|
}
|
||||||
|
|
||||||
for (auto& [itemReference, itemFrames] : groupedFrames)
|
for (auto& [itemReference, itemFrames] : groupedFrames)
|
||||||
{
|
{
|
||||||
auto itemType = static_cast<ItemType>(itemReference.itemType);
|
auto itemType = static_cast<ItemType>(itemReference.itemType);
|
||||||
auto item = document.anm2.element_get(itemReference.animationIndex, itemType, itemReference.itemID);
|
auto item = document.anm2.element_get(itemReference);
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
frames_change(*item, frameChange, itemType, changeType, itemFrames);
|
frames_change(*item, frameChange, itemType, changeType, itemFrames);
|
||||||
}
|
}
|
||||||
@@ -461,24 +498,26 @@ namespace anm2ed::imgui
|
|||||||
ChangeType changeType = ChangeType::ADJUST)
|
ChangeType changeType = ChangeType::ADJUST)
|
||||||
{
|
{
|
||||||
auto queuedReference = editReference;
|
auto queuedReference = editReference;
|
||||||
auto queuedReferenceItemType = editReferenceItemType;
|
|
||||||
auto queuedFrameReferences = frameReferences;
|
auto queuedFrameReferences = frameReferences;
|
||||||
manager.command_push(
|
manager.command_push(
|
||||||
{manager.selected, [=](Manager&, Document& document)
|
{manager.selected, [=](Manager&, Document& document)
|
||||||
{
|
{
|
||||||
auto frame = document.anm2.element_get(queuedReference.animationIndex, queuedReferenceItemType,
|
if (queuedReference.frameIndex < 0) return;
|
||||||
queuedReference.frameIndex, queuedReference.itemID);
|
auto frame = document.anm2.element_get(queuedReference);
|
||||||
if (!frame) return;
|
if (!frame) return;
|
||||||
|
|
||||||
std::map<Reference, std::set<int>> groupedFrames{};
|
std::map<Reference, std::set<int>> groupedFrames{};
|
||||||
for (auto frameReference : queuedFrameReferences)
|
for (auto frameReference : queuedFrameReferences)
|
||||||
groupedFrames[{frameReference.animationIndex, frameReference.itemType, frameReference.itemID, -1}]
|
{
|
||||||
.insert(frameReference.frameIndex);
|
auto itemReference = frameReference;
|
||||||
|
itemReference.frameIndex = -1;
|
||||||
|
groupedFrames[itemReference].insert(frameReference.frameIndex);
|
||||||
|
}
|
||||||
|
|
||||||
for (auto& [itemReference, itemFrames] : groupedFrames)
|
for (auto& [itemReference, itemFrames] : groupedFrames)
|
||||||
{
|
{
|
||||||
auto itemType = static_cast<ItemType>(itemReference.itemType);
|
auto itemType = static_cast<ItemType>(itemReference.itemType);
|
||||||
auto item = document.anm2.element_get(itemReference.animationIndex, itemType, itemReference.itemID);
|
auto item = document.anm2.element_get(itemReference);
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
frames_change(*item, frameChangeGet(*frame), itemType, changeType, itemFrames);
|
frames_change(*item, frameChangeGet(*frame), itemType, changeType, itemFrames);
|
||||||
}
|
}
|
||||||
@@ -602,9 +641,11 @@ namespace anm2ed::imgui
|
|||||||
auto texture_line_apply = [&](ivec2 start, ivec2 end, vec4 color)
|
auto texture_line_apply = [&](ivec2 start, ivec2 end, vec4 color)
|
||||||
{
|
{
|
||||||
auto queuedSpritesheet = referenceSpritesheet;
|
auto queuedSpritesheet = referenceSpritesheet;
|
||||||
|
auto queuedOverlay = activeOverlayId;
|
||||||
manager.command_push({manager.selected, [=](Manager&, Document& document)
|
manager.command_push({manager.selected, [=](Manager&, Document& document)
|
||||||
{
|
{
|
||||||
auto texture = document.texture_get(queuedSpritesheet);
|
auto texture = queuedOverlay != -1 ? document.overlay_texture_get(queuedOverlay)
|
||||||
|
: document.texture_get(queuedSpritesheet);
|
||||||
if (!texture) return;
|
if (!texture) return;
|
||||||
texture->pixel_line(start, end, color);
|
texture->pixel_line(start, end, color);
|
||||||
}});
|
}});
|
||||||
@@ -612,8 +653,15 @@ namespace anm2ed::imgui
|
|||||||
auto texture_change_push = [&]()
|
auto texture_change_push = [&]()
|
||||||
{
|
{
|
||||||
auto queuedSpritesheet = referenceSpritesheet;
|
auto queuedSpritesheet = referenceSpritesheet;
|
||||||
|
auto queuedOverlay = activeOverlayId;
|
||||||
manager.command_push(
|
manager.command_push(
|
||||||
{manager.selected, [=](Manager&, Document& document) { document.texture_change(queuedSpritesheet); }});
|
{manager.selected, [=](Manager&, Document& document)
|
||||||
|
{
|
||||||
|
if (queuedOverlay != -1)
|
||||||
|
document.overlay_texture_change(queuedOverlay);
|
||||||
|
else
|
||||||
|
document.texture_change(queuedSpritesheet);
|
||||||
|
}});
|
||||||
};
|
};
|
||||||
|
|
||||||
auto region_selection_set = [&](int id)
|
auto region_selection_set = [&](int id)
|
||||||
@@ -701,7 +749,7 @@ namespace anm2ed::imgui
|
|||||||
region_selection_set(hoveredRegionId);
|
region_selection_set(hoveredRegionId);
|
||||||
if (isReferenceLayerOnSpritesheet)
|
if (isReferenceLayerOnSpritesheet)
|
||||||
{
|
{
|
||||||
snapshot_push(EDIT_FRAME_REGION);
|
frame_snapshot_push(EDIT_FRAME_REGION, selectedFrameReferences);
|
||||||
FrameChange change{};
|
FrameChange change{};
|
||||||
change.regionId = hoveredRegionId;
|
change.regionId = hoveredRegionId;
|
||||||
if (auto region = region_get(hoveredRegionId))
|
if (auto region = region_get(hoveredRegionId))
|
||||||
@@ -726,7 +774,7 @@ namespace anm2ed::imgui
|
|||||||
auto region = region_get(regionReference);
|
auto region = region_get(regionReference);
|
||||||
if (!region) break;
|
if (!region) break;
|
||||||
|
|
||||||
if (isBegin) snapshot_push(EDIT_REGION_MOVE);
|
if (isBegin) region_snapshot_push(EDIT_REGION_MOVE, {regionReference});
|
||||||
if (isMouseDown) region_pivot_set(regionReference, pivot_snap(mousePos - region->crop, region->pivot));
|
if (isMouseDown) region_pivot_set(regionReference, pivot_snap(mousePos - region->crop, region->pivot));
|
||||||
if (isLeftPressed) region_pivot_offset(regionReference, vec2(-step, 0));
|
if (isLeftPressed) region_pivot_offset(regionReference, vec2(-step, 0));
|
||||||
if (isRightPressed) region_pivot_offset(regionReference, vec2(step, 0));
|
if (isRightPressed) region_pivot_offset(regionReference, vec2(step, 0));
|
||||||
@@ -749,7 +797,7 @@ namespace anm2ed::imgui
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!item || !frame || selectedFrameToolReferences.empty() || isRegionInUse) break;
|
if (!item || !frame || selectedFrameToolReferences.empty() || isRegionInUse) break;
|
||||||
if (isBegin) snapshot_push(EDIT_FRAME_PIVOT);
|
if (isBegin) frame_snapshot_push(EDIT_FRAME_PIVOT, selectedFrameToolReferences);
|
||||||
if (isMouseDown)
|
if (isMouseDown)
|
||||||
{
|
{
|
||||||
auto pivot = pivot_snap(mousePos - frame->crop, frame->pivot);
|
auto pivot = pivot_snap(mousePos - frame->crop, frame->pivot);
|
||||||
@@ -784,7 +832,7 @@ namespace anm2ed::imgui
|
|||||||
if ((isRegionEditTarget || isRegionInUse || selectedFrameToolReferences.empty()) && !regionSelection.empty())
|
if ((isRegionEditTarget || isRegionInUse || selectedFrameToolReferences.empty()) && !regionSelection.empty())
|
||||||
{
|
{
|
||||||
if (!spritesheet || regionSelection.empty()) break;
|
if (!spritesheet || regionSelection.empty()) break;
|
||||||
if (isBegin) snapshot_push(EDIT_REGION_CROP);
|
if (isBegin) region_snapshot_push(EDIT_REGION_CROP, regionSelection);
|
||||||
|
|
||||||
if (isMouseClicked)
|
if (isMouseClicked)
|
||||||
{
|
{
|
||||||
@@ -825,7 +873,7 @@ namespace anm2ed::imgui
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!item || !frame || selectedFrameToolReferences.empty() || isRegionInUse) break;
|
if (!item || !frame || selectedFrameToolReferences.empty() || isRegionInUse) break;
|
||||||
if (isBegin) snapshot_push(EDIT_FRAME_CROP);
|
if (isBegin) frame_snapshot_push(EDIT_FRAME_CROP, selectedFrameToolReferences);
|
||||||
|
|
||||||
if (isMouseClicked)
|
if (isMouseClicked)
|
||||||
{
|
{
|
||||||
@@ -880,7 +928,7 @@ namespace anm2ed::imgui
|
|||||||
{
|
{
|
||||||
if (!texture) break;
|
if (!texture) break;
|
||||||
auto color = useTool == tool::DRAW ? toolColor : vec4();
|
auto color = useTool == tool::DRAW ? toolColor : vec4();
|
||||||
if (isMouseClicked) snapshot_push(useTool == tool::DRAW ? EDIT_DRAW : EDIT_ERASE);
|
if (isMouseClicked) texture_snapshot_push(useTool == tool::DRAW ? EDIT_DRAW : EDIT_ERASE);
|
||||||
if (isMouseDown) texture_line_apply(ivec2(previousMousePos), ivec2(mousePos), color);
|
if (isMouseDown) texture_line_apply(ivec2(previousMousePos), ivec2(mousePos), color);
|
||||||
if (isMouseReleased) texture_change_push();
|
if (isMouseReleased) texture_change_push();
|
||||||
break;
|
break;
|
||||||
|
|||||||
+337
-152
File diff suppressed because it is too large.
Load diff
@@ -21,6 +21,8 @@ namespace anm2ed::imgui
|
|||||||
int type{NONE};
|
int type{NONE};
|
||||||
int id{-1};
|
int id{-1};
|
||||||
int index{-1};
|
int index{-1};
|
||||||
|
int groupType{NONE};
|
||||||
|
int groupId{-1};
|
||||||
bool isGroup{};
|
bool isGroup{};
|
||||||
|
|
||||||
auto operator<=>(const TimelineRowReference&) const = default;
|
auto operator<=>(const TimelineRowReference&) const = default;
|
||||||
@@ -31,6 +33,8 @@ namespace anm2ed::imgui
|
|||||||
int type{NONE};
|
int type{NONE};
|
||||||
int itemID{-1};
|
int itemID{-1};
|
||||||
int animationIndex{-1};
|
int animationIndex{-1};
|
||||||
|
int groupType{NONE};
|
||||||
|
int groupId{-1};
|
||||||
int frameIndex{-1};
|
int frameIndex{-1};
|
||||||
int duration{1};
|
int duration{1};
|
||||||
std::vector<int> indices{};
|
std::vector<int> indices{};
|
||||||
|
|||||||
+1448
-92
File diff suppressed because it is too large.
Load diff
@@ -29,7 +29,8 @@ namespace anm2ed::imgui
|
|||||||
WINDOW_PASTE = 1 << 8,
|
WINDOW_PASTE = 1 << 8,
|
||||||
WINDOW_RENAME = 1 << 9,
|
WINDOW_RENAME = 1 << 9,
|
||||||
WINDOW_PROPERTIES = 1 << 10,
|
WINDOW_PROPERTIES = 1 << 10,
|
||||||
WINDOW_REFERENCE_ITALIC = 1 << 11
|
WINDOW_REFERENCE_ITALIC = 1 << 11,
|
||||||
|
WINDOW_GROUP = 1 << 12
|
||||||
};
|
};
|
||||||
|
|
||||||
using WindowFlags = int;
|
using WindowFlags = int;
|
||||||
@@ -108,6 +109,7 @@ namespace anm2ed::imgui
|
|||||||
Command duplicate{};
|
Command duplicate{};
|
||||||
Command merge{};
|
Command merge{};
|
||||||
Command merge_open{};
|
Command merge_open{};
|
||||||
|
Command group{};
|
||||||
Command default_set{};
|
Command default_set{};
|
||||||
Command cut{};
|
Command cut{};
|
||||||
Command copy{};
|
Command copy{};
|
||||||
@@ -137,5 +139,6 @@ namespace anm2ed::imgui
|
|||||||
Window layers_window_register();
|
Window layers_window_register();
|
||||||
Window nulls_window_register();
|
Window nulls_window_register();
|
||||||
Window events_window_register();
|
Window events_window_register();
|
||||||
|
Window overlays_window_register();
|
||||||
void window_update(Window&, Manager&, Settings&, Resources&, Dialog&, Clipboard&);
|
void window_update(Window&, Manager&, Settings&, Resources&, Dialog&, Clipboard&);
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,11 @@ namespace anm2ed::imgui::wizard
|
|||||||
{
|
{
|
||||||
std::set<Reference> result = itemReferences;
|
std::set<Reference> result = itemReferences;
|
||||||
if (result.empty() && document.reference.itemType != NONE)
|
if (result.empty() && document.reference.itemType != NONE)
|
||||||
result.insert({document.reference.animationIndex, document.reference.itemType, document.reference.itemID});
|
{
|
||||||
|
auto itemReference = document.reference;
|
||||||
|
itemReference.frameIndex = -1;
|
||||||
|
result.insert(itemReference);
|
||||||
|
}
|
||||||
std::erase_if(result, [&](const Reference& reference) { return !is_item_reference_changeable(reference); });
|
std::erase_if(result, [&](const Reference& reference) { return !is_item_reference_changeable(reference); });
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
@@ -396,12 +400,10 @@ namespace anm2ed::imgui::wizard
|
|||||||
groupedFrames[itemReference].insert(frameReference.frameIndex);
|
groupedFrames[itemReference].insert(frameReference.frameIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
document.snapshot(localize.get(EDIT_CHANGE_FRAME_PROPERTIES));
|
document.anm2_snapshot(localize.get(EDIT_CHANGE_FRAME_PROPERTIES));
|
||||||
for (auto& [itemReference, selection] : groupedFrames)
|
for (auto& [itemReference, selection] : groupedFrames)
|
||||||
{
|
{
|
||||||
auto item = anm2.element_get(itemReference.animationIndex,
|
auto item = anm2.element_get(itemReference);
|
||||||
static_cast<ItemType>(itemReference.itemType),
|
|
||||||
itemReference.itemID);
|
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
frames_change(*item, frameChange, static_cast<ItemType>(itemReference.itemType),
|
frames_change(*item, frameChange, static_cast<ItemType>(itemReference.itemType),
|
||||||
changeType, selection);
|
changeType, selection);
|
||||||
@@ -412,13 +414,12 @@ namespace anm2ed::imgui::wizard
|
|||||||
|
|
||||||
if (queuedIsItemsDestination)
|
if (queuedIsItemsDestination)
|
||||||
{
|
{
|
||||||
document.snapshot(localize.get(EDIT_CHANGE_FRAME_PROPERTIES));
|
document.anm2_snapshot(localize.get(EDIT_CHANGE_FRAME_PROPERTIES));
|
||||||
for (auto itemReference : queuedItemReferences)
|
for (auto itemReference : queuedItemReferences)
|
||||||
{
|
{
|
||||||
if (itemReference.itemType == TRIGGER) continue;
|
if (itemReference.itemType == TRIGGER) continue;
|
||||||
auto item = anm2.element_get(itemReference.animationIndex,
|
itemReference.frameIndex = -1;
|
||||||
static_cast<ItemType>(itemReference.itemType),
|
auto item = anm2.element_get(itemReference);
|
||||||
itemReference.itemID);
|
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
auto selection = all_frames_selection(*item);
|
auto selection = all_frames_selection(*item);
|
||||||
frames_change(*item, frameChange, static_cast<ItemType>(itemReference.itemType),
|
frames_change(*item, frameChange, static_cast<ItemType>(itemReference.itemType),
|
||||||
@@ -428,7 +429,7 @@ namespace anm2ed::imgui::wizard
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.snapshot(localize.get(EDIT_CHANGE_FRAME_PROPERTIES));
|
document.anm2_snapshot(localize.get(EDIT_CHANGE_FRAME_PROPERTIES));
|
||||||
for (auto animationIndex : queuedAnimations)
|
for (auto animationIndex : queuedAnimations)
|
||||||
{
|
{
|
||||||
auto animation = anm2.element_get(ElementType::ANIMATION, animationIndex);
|
auto animation = anm2.element_get(ElementType::ANIMATION, animationIndex);
|
||||||
|
|||||||
@@ -69,15 +69,6 @@ namespace anm2ed::imgui::wizard
|
|||||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_STACK_SIZE));
|
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_STACK_SIZE));
|
||||||
|
|
||||||
ImGui::SeparatorText(localize.get(LABEL_SERIALIZATION));
|
ImGui::SeparatorText(localize.get(LABEL_SERIALIZATION));
|
||||||
ImGui::Checkbox(localize.get(LABEL_GROUPS), &temporary.fileIsSerializeGroups);
|
|
||||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SERIALIZE_GROUPS));
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::Checkbox(localize.get(LABEL_REGIONS), &temporary.fileIsSerializeRegions);
|
|
||||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SERIALIZE_REGIONS));
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::Checkbox(localize.get(LABEL_SOUNDS), &temporary.fileIsSerializeSounds);
|
|
||||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SERIALIZE_SOUNDS));
|
|
||||||
|
|
||||||
ImGui::Checkbox(localize.get(LABEL_KEEP_REDUNDANT_FRAME_REGION_VALUES),
|
ImGui::Checkbox(localize.get(LABEL_KEEP_REDUNDANT_FRAME_REGION_VALUES),
|
||||||
&temporary.fileIsKeepRedundantFrameRegionValues);
|
&temporary.fileIsKeepRedundantFrameRegionValues);
|
||||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_KEEP_REDUNDANT_FRAME_REGION_VALUES));
|
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_KEEP_REDUNDANT_FRAME_REGION_VALUES));
|
||||||
@@ -86,6 +77,9 @@ namespace anm2ed::imgui::wizard
|
|||||||
&temporary.fileIsBakeSpecialInterpolatedFrames);
|
&temporary.fileIsBakeSpecialInterpolatedFrames);
|
||||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_BAKE_SPECIAL_INTERPOLATED_FRAMES_ON_SAVE));
|
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_BAKE_SPECIAL_INTERPOLATED_FRAMES_ON_SAVE));
|
||||||
|
|
||||||
|
ImGui::Checkbox(localize.get(LABEL_BAKE_GROUP_FRAMES_ON_SAVE), &temporary.isFileBakeGroupFrames);
|
||||||
|
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_BAKE_GROUP_FRAMES_ON_SAVE));
|
||||||
|
|
||||||
ImGui::SeparatorText(localize.get(LABEL_OPTIONS));
|
ImGui::SeparatorText(localize.get(LABEL_OPTIONS));
|
||||||
ImGui::Checkbox(localize.get(LABEL_OVERWRITE_WARNING), &temporary.fileIsWarnOverwrite);
|
ImGui::Checkbox(localize.get(LABEL_OVERWRITE_WARNING), &temporary.fileIsWarnOverwrite);
|
||||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_OVERWRITE_WARNING));
|
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_OVERWRITE_WARNING));
|
||||||
|
|||||||
@@ -162,8 +162,7 @@ namespace anm2ed::imgui::wizard
|
|||||||
bool isRegionsChanged{};
|
bool isRegionsChanged{};
|
||||||
for (auto queuedReference : queuedLayerReferences)
|
for (auto queuedReference : queuedLayerReferences)
|
||||||
{
|
{
|
||||||
auto item = document.anm2.element_get(queuedReference.animationIndex, ItemType::LAYER,
|
auto item = document.anm2.element_get(queuedReference);
|
||||||
queuedReference.itemID);
|
|
||||||
auto animation =
|
auto animation =
|
||||||
document.anm2.element_get(ElementType::ANIMATION, queuedReference.animationIndex);
|
document.anm2.element_get(ElementType::ANIMATION, queuedReference.animationIndex);
|
||||||
auto layer = document.anm2.element_get(ElementType::LAYER_ELEMENT,
|
auto layer = document.anm2.element_get(ElementType::LAYER_ELEMENT,
|
||||||
@@ -175,7 +174,7 @@ namespace anm2ed::imgui::wizard
|
|||||||
|
|
||||||
if (!isChanged)
|
if (!isChanged)
|
||||||
{
|
{
|
||||||
document.snapshot(localize.get(EDIT_GENERATE_ANIMATION_FROM_GRID));
|
document.anm2_snapshot(localize.get(EDIT_GENERATE_ANIMATION_FROM_GRID));
|
||||||
isChanged = true;
|
isChanged = true;
|
||||||
}
|
}
|
||||||
auto frameIndexStart = (int)item->children.size();
|
auto frameIndexStart = (int)item->children.size();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "render_animation.hpp"
|
#include "render_animation.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -34,12 +35,14 @@ namespace anm2ed::imgui::wizard
|
|||||||
[&](const Reference& frameReference)
|
[&](const Reference& frameReference)
|
||||||
{
|
{
|
||||||
return frameReference.animationIndex != reference.animationIndex ||
|
return frameReference.animationIndex != reference.animationIndex ||
|
||||||
frameReference.itemType != reference.itemType || frameReference.itemID != reference.itemID;
|
frameReference.itemType != reference.itemType || frameReference.itemID != reference.itemID ||
|
||||||
|
frameReference.groupType != reference.groupType || frameReference.groupId != reference.groupId;
|
||||||
});
|
});
|
||||||
if (!frameReferences.empty())
|
if (!frameReferences.empty())
|
||||||
{
|
{
|
||||||
auto itemType = static_cast<ItemType>(reference.itemType);
|
auto itemReference = reference;
|
||||||
if (auto item = document.anm2.element_get(reference.animationIndex, itemType, reference.itemID))
|
itemReference.frameIndex = -1;
|
||||||
|
if (auto item = document.anm2.element_get(itemReference))
|
||||||
{
|
{
|
||||||
int duration{};
|
int duration{};
|
||||||
int frameIndex{};
|
int frameIndex{};
|
||||||
@@ -74,7 +77,8 @@ namespace anm2ed::imgui::wizard
|
|||||||
auto& path = settings.renderPath;
|
auto& path = settings.renderPath;
|
||||||
auto& format = settings.renderFormat;
|
auto& format = settings.renderFormat;
|
||||||
auto& scale = settings.renderScale;
|
auto& scale = settings.renderScale;
|
||||||
auto& isRaw = settings.renderIsRawAnimation;
|
auto& isUseAnimationBounds = settings.renderIsUseAnimationBounds;
|
||||||
|
auto& isUseIsolatedAnimation = settings.renderIsUseIsolatedAnimation;
|
||||||
auto& type = settings.renderType;
|
auto& type = settings.renderType;
|
||||||
auto& start = manager.recordingStart;
|
auto& start = manager.recordingStart;
|
||||||
auto& end = manager.recordingEnd;
|
auto& end = manager.recordingEnd;
|
||||||
@@ -83,6 +87,11 @@ namespace anm2ed::imgui::wizard
|
|||||||
auto& isRange = manager.isRecordingRange;
|
auto& isRange = manager.isRecordingRange;
|
||||||
auto& reference = document.reference;
|
auto& reference = document.reference;
|
||||||
auto& frameNum = animation->frameNum;
|
auto& frameNum = animation->frameNum;
|
||||||
|
auto animationFrameNum = std::max(frameNum, 1);
|
||||||
|
auto frameMax = animationFrameNum - 1;
|
||||||
|
start = std::clamp(start, 0, frameMax);
|
||||||
|
end = std::clamp(end, start, frameMax);
|
||||||
|
auto renderFrameNum = isRange ? render::frame_count_get(start, end) : animationFrameNum;
|
||||||
|
|
||||||
auto widgetSize = widget_size_with_row_get(2);
|
auto widgetSize = widget_size_with_row_get(2);
|
||||||
|
|
||||||
@@ -154,10 +163,10 @@ namespace anm2ed::imgui::wizard
|
|||||||
}
|
}
|
||||||
else if (type == render::SPRITESHEET)
|
else if (type == render::SPRITESHEET)
|
||||||
{
|
{
|
||||||
input_int_range(localize.get(LABEL_GENERATE_ROWS), rows, 1, frameNum - 1);
|
input_int_range(localize.get(LABEL_GENERATE_ROWS), rows, 1, renderFrameNum);
|
||||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ROWS));
|
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_ROWS));
|
||||||
|
|
||||||
input_int_range(localize.get(LABEL_GENERATE_COLUMNS), columns, 1, frameNum - 1);
|
input_int_range(localize.get(LABEL_GENERATE_COLUMNS), columns, 1, renderFrameNum);
|
||||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_COLUMNS));
|
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_COLUMNS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,19 +190,32 @@ namespace anm2ed::imgui::wizard
|
|||||||
|
|
||||||
ImGui::BeginDisabled(!isRange);
|
ImGui::BeginDisabled(!isRange);
|
||||||
{
|
{
|
||||||
input_int_range(localize.get(LABEL_START), start, 0, frameNum - 1);
|
input_int_range(localize.get(LABEL_START), start, 0, frameMax);
|
||||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_START));
|
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_START));
|
||||||
input_int_range(localize.get(LABEL_END), end, start, frameNum - 1);
|
input_int_range(localize.get(LABEL_END), end, start, frameMax);
|
||||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_END));
|
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_END));
|
||||||
}
|
}
|
||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
|
renderFrameNum = isRange ? render::frame_count_get(start, end) : animationFrameNum;
|
||||||
|
|
||||||
|
if (type == render::SPRITESHEET)
|
||||||
|
{
|
||||||
|
auto layout = render::spritesheet_layout_get(rows, columns, renderFrameNum);
|
||||||
|
rows = layout.rows;
|
||||||
|
columns = layout.columns;
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
ImGui::Checkbox(localize.get(LABEL_RAW), &isRaw);
|
ImGui::Checkbox(localize.get(LABEL_USE_ANIMATION_BOUNDS), &isUseAnimationBounds);
|
||||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_RAW));
|
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_USE_ANIMATION_BOUNDS));
|
||||||
|
|
||||||
ImGui::BeginDisabled(!isRaw);
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
ImGui::Checkbox(localize.get(LABEL_USE_ISOLATED_ANIMATION), &isUseIsolatedAnimation);
|
||||||
|
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_USE_ISOLATED_ANIMATION));
|
||||||
|
|
||||||
|
ImGui::BeginDisabled(!isUseAnimationBounds);
|
||||||
{
|
{
|
||||||
input_float_range(localize.get(BASIC_SCALE), scale, 0.1f, 100.0f, 1.0f, STEP_FAST, "%.1fx");
|
input_float_range(localize.get(BASIC_SCALE), scale, 0.1f, 100.0f, 1.0f, STEP_FAST, "%.1fx");
|
||||||
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SCALE_OUTPUT));
|
ImGui::SetItemTooltip("%s", localize.get(TOOLTIP_SCALE_OUTPUT));
|
||||||
|
|||||||
@@ -53,8 +53,11 @@ namespace anm2ed
|
|||||||
|
|
||||||
std::vector<std::filesystem::path> anm2DragDropPaths{};
|
std::vector<std::filesystem::path> anm2DragDropPaths{};
|
||||||
bool isAnm2DragDrop{};
|
bool isAnm2DragDrop{};
|
||||||
|
int anm2DragDropMergePreset{Document::FILE_MERGE_PRESET_MERGE_BY_NAME};
|
||||||
imgui::PopupHelper anm2DragDropPopup{
|
imgui::PopupHelper anm2DragDropPopup{
|
||||||
imgui::PopupHelper(LABEL_MANAGER_ANM2_DRAG_DROP, imgui::POPUP_NORMAL, imgui::POPUP_BY_CURSOR)};
|
imgui::PopupHelper(LABEL_MANAGER_ANM2_DRAG_DROP, imgui::POPUP_NORMAL, imgui::POPUP_BY_CURSOR)};
|
||||||
|
imgui::PopupHelper anm2DragDropMergePopup{
|
||||||
|
imgui::PopupHelper(LABEL_DOCUMENTS_MERGE_INTO_CURRENT, imgui::POPUP_NORMAL_NO_HEIGHT)};
|
||||||
|
|
||||||
std::filesystem::path spritesheetDragDropPath{};
|
std::filesystem::path spritesheetDragDropPath{};
|
||||||
bool isSpritesheetDragDrop{};
|
bool isSpritesheetDragDrop{};
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#include "audio_stream.hpp"
|
#include "audio_stream.hpp"
|
||||||
#include "texture.hpp"
|
#include "texture.hpp"
|
||||||
|
|
||||||
@@ -31,6 +34,40 @@ namespace anm2ed::render
|
|||||||
RENDER_LIST
|
RENDER_LIST
|
||||||
#undef X
|
#undef X
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct SpritesheetLayout
|
||||||
|
{
|
||||||
|
int rows{};
|
||||||
|
int columns{};
|
||||||
|
};
|
||||||
|
|
||||||
|
inline int frame_count_get(int start, int end) { return std::max(end - start + 1, 1); }
|
||||||
|
|
||||||
|
inline SpritesheetLayout spritesheet_layout_get(int rows, int columns, int frameCount)
|
||||||
|
{
|
||||||
|
frameCount = std::max(frameCount, 1);
|
||||||
|
rows = std::max(rows, 0);
|
||||||
|
columns = std::max(columns, 0);
|
||||||
|
|
||||||
|
if (rows == 0 && columns == 0)
|
||||||
|
{
|
||||||
|
columns = std::max((int)std::ceil(std::sqrt((float)frameCount)), 1);
|
||||||
|
rows = (frameCount + columns - 1) / columns;
|
||||||
|
}
|
||||||
|
else if (rows == 0)
|
||||||
|
rows = (frameCount + columns - 1) / columns;
|
||||||
|
else if (columns == 0)
|
||||||
|
columns = (frameCount + rows - 1) / rows;
|
||||||
|
else if (rows * columns < frameCount)
|
||||||
|
{
|
||||||
|
if (rows <= columns)
|
||||||
|
columns = (frameCount + rows - 1) / rows;
|
||||||
|
else
|
||||||
|
rows = (frameCount + columns - 1) / columns;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {rows, columns};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace anm2ed
|
namespace anm2ed
|
||||||
|
|||||||
+440
-20
@@ -1,16 +1,398 @@
|
|||||||
#include "shader.hpp"
|
#include "shader.hpp"
|
||||||
|
|
||||||
|
#include <cctype>
|
||||||
|
#include <format>
|
||||||
|
#include <sstream>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "log.hpp"
|
#include "log.hpp"
|
||||||
|
|
||||||
|
namespace anm2ed::resource::shader
|
||||||
|
{
|
||||||
|
#define SHADER_GLES_WORD_REPLACEMENTS \
|
||||||
|
X("texture2D", "texture") \
|
||||||
|
X("gl_FragColor", "fragColor")
|
||||||
|
|
||||||
|
struct UniformAlias
|
||||||
|
{
|
||||||
|
UniformBinding binding{};
|
||||||
|
const char* name{};
|
||||||
|
};
|
||||||
|
|
||||||
|
#define RESOURCE_SHADER_UNIFORM_ALIASES \
|
||||||
|
X(UNIFORM_BINDING_MAIN_TEXTURE, UNIFORM_TEXTURE) \
|
||||||
|
X(UNIFORM_BINDING_MAIN_TEXTURE, "Texture0") \
|
||||||
|
X(UNIFORM_BINDING_MAIN_TEXTURE, "texture0") \
|
||||||
|
X(UNIFORM_BINDING_MAIN_TEXTURE, "Texture") \
|
||||||
|
X(UNIFORM_BINDING_MAIN_TEXTURE, "Sampler0") \
|
||||||
|
X(UNIFORM_BINDING_MAIN_TEXTURE, "ColorMap") \
|
||||||
|
X(UNIFORM_BINDING_TRANSFORM, UNIFORM_TRANSFORM) \
|
||||||
|
X(UNIFORM_BINDING_TRANSFORM, "Transform") \
|
||||||
|
X(UNIFORM_BINDING_TRANSFORM, "MVP") \
|
||||||
|
X(UNIFORM_BINDING_TRANSFORM, "Matrix") \
|
||||||
|
X(UNIFORM_BINDING_FRAME_TINT, UNIFORM_TINT) \
|
||||||
|
X(UNIFORM_BINDING_FRAME_TINT, "Tint") \
|
||||||
|
X(UNIFORM_BINDING_FRAME_TINT, "Color") \
|
||||||
|
X(UNIFORM_BINDING_FRAME_TINT, "Color0") \
|
||||||
|
X(UNIFORM_BINDING_COLOR_OFFSET, UNIFORM_COLOR_OFFSET) \
|
||||||
|
X(UNIFORM_BINDING_COLOR_OFFSET, "ColorOffset") \
|
||||||
|
X(UNIFORM_BINDING_COLOR_OFFSET, "ColorOffset0") \
|
||||||
|
X(UNIFORM_BINDING_TEXTURE_SIZE, "u_texture_size") \
|
||||||
|
X(UNIFORM_BINDING_TEXTURE_SIZE, "TextureSize") \
|
||||||
|
X(UNIFORM_BINDING_TEXTURE_SIZE, "TexSize")
|
||||||
|
|
||||||
|
constexpr UniformAlias UNIFORM_ALIASES[] = {
|
||||||
|
#define X(binding, name) {binding, name},
|
||||||
|
RESOURCE_SHADER_UNIFORM_ALIASES
|
||||||
|
#undef X
|
||||||
|
};
|
||||||
|
|
||||||
|
bool is_shader_identifier(char character)
|
||||||
|
{
|
||||||
|
return std::isalnum((unsigned char)character) || character == '_';
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string shader_text_replace(std::string string, std::string_view from, std::string_view to)
|
||||||
|
{
|
||||||
|
if (from.empty()) return string;
|
||||||
|
std::size_t position{};
|
||||||
|
while ((position = string.find(from, position)) != std::string::npos)
|
||||||
|
{
|
||||||
|
string.replace(position, from.size(), to.data(), to.size());
|
||||||
|
position += to.size();
|
||||||
|
}
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string shader_word_replace(std::string string, std::string_view from, std::string_view to)
|
||||||
|
{
|
||||||
|
if (from.empty()) return string;
|
||||||
|
|
||||||
|
std::size_t position{};
|
||||||
|
while ((position = string.find(from, position)) != std::string::npos)
|
||||||
|
{
|
||||||
|
auto after = position + from.size();
|
||||||
|
auto isBeforeIdentifier = position > 0 && is_shader_identifier(string[position - 1]);
|
||||||
|
auto isAfterIdentifier = after < string.size() && is_shader_identifier(string[after]);
|
||||||
|
if (!isBeforeIdentifier && !isAfterIdentifier)
|
||||||
|
{
|
||||||
|
string.replace(position, from.size(), to.data(), to.size());
|
||||||
|
position += to.size();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
position = after;
|
||||||
|
}
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string shader_space_collapse(std::string_view string)
|
||||||
|
{
|
||||||
|
std::string out{};
|
||||||
|
bool isSpace{};
|
||||||
|
for (auto character : string)
|
||||||
|
{
|
||||||
|
if (std::isspace((unsigned char)character))
|
||||||
|
{
|
||||||
|
if (!out.empty() && !isSpace) out.push_back(' ');
|
||||||
|
isSpace = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
out.push_back(character);
|
||||||
|
isSpace = false;
|
||||||
|
}
|
||||||
|
if (!out.empty() && out.back() == ' ') out.pop_back();
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string shader_trim_get(std::string_view line)
|
||||||
|
{
|
||||||
|
std::size_t begin{};
|
||||||
|
while (begin < line.size() && std::isspace((unsigned char)line[begin]))
|
||||||
|
++begin;
|
||||||
|
|
||||||
|
auto end = line.size();
|
||||||
|
while (end > begin && std::isspace((unsigned char)line[end - 1]))
|
||||||
|
--end;
|
||||||
|
|
||||||
|
return std::string(line.substr(begin, end - begin));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_shader_word_present(std::string_view string, std::string_view word)
|
||||||
|
{
|
||||||
|
std::size_t position{};
|
||||||
|
while ((position = string.find(word, position)) != std::string_view::npos)
|
||||||
|
{
|
||||||
|
auto after = position + word.size();
|
||||||
|
auto isBeforeIdentifier = position > 0 && is_shader_identifier(string[position - 1]);
|
||||||
|
auto isAfterIdentifier = after < string.size() && is_shader_identifier(string[after]);
|
||||||
|
if (!isBeforeIdentifier && !isAfterIdentifier) return true;
|
||||||
|
position = after;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_shader_line_skipped(std::string_view line)
|
||||||
|
{
|
||||||
|
auto normalized = shader_space_collapse(shader_trim_get(line));
|
||||||
|
if (normalized.starts_with("#version")) return true;
|
||||||
|
if (normalized.starts_with("precision ")) return true;
|
||||||
|
if (normalized == "#define lowp" || normalized == "# define lowp") return true;
|
||||||
|
if (normalized == "#define mediump" || normalized == "# define mediump") return true;
|
||||||
|
if (normalized == "#define highp" || normalized == "# define highp") return true;
|
||||||
|
if (normalized == "#define texture texture2D" || normalized == "# define texture texture2D") return true;
|
||||||
|
if (normalized == "#define fragColor gl_FragColor" || normalized == "# define fragColor gl_FragColor") return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string shader_precision_erase(std::string line)
|
||||||
|
{
|
||||||
|
line = shader_word_replace(std::move(line), "lowp", "");
|
||||||
|
line = shader_word_replace(std::move(line), "mediump", "");
|
||||||
|
line = shader_word_replace(std::move(line), "highp", "");
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string shader_line_convert(std::string line, ShaderStage stage)
|
||||||
|
{
|
||||||
|
line = shader_precision_erase(std::move(line));
|
||||||
|
line = shader_word_replace(std::move(line), "attribute", "in");
|
||||||
|
line = shader_word_replace(std::move(line), "varying", stage == SHADER_STAGE_VERTEX ? "out" : "in");
|
||||||
|
#define X(from, to) line = shader_word_replace(std::move(line), from, to);
|
||||||
|
SHADER_GLES_WORD_REPLACEMENTS
|
||||||
|
#undef X
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string shader_fragment_declarations_get(std::string_view body)
|
||||||
|
{
|
||||||
|
if (!is_shader_word_present(body, "fragColor")) return {};
|
||||||
|
if (body.find("out vec4 fragColor") != std::string_view::npos) return {};
|
||||||
|
return "out vec4 fragColor;\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string uniform_name_clean_get(std::string name)
|
||||||
|
{
|
||||||
|
if (name.ends_with("[0]")) name.erase(name.size() - 3);
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string uniform_float_string_get(float value) { return std::format("{:.6g}", value); }
|
||||||
|
|
||||||
|
UniformBinding uniform_binding_auto_get(std::string_view name, UniformValueType type)
|
||||||
|
{
|
||||||
|
for (const auto& alias : UNIFORM_ALIASES)
|
||||||
|
if (name == alias.name && is_uniform_binding_valid(alias.binding, type)) return alias.binding;
|
||||||
|
if (type == UNIFORM_VALUE_SAMPLER2D) return UNIFORM_BINDING_MAIN_TEXTURE;
|
||||||
|
if (is_uniform_value_editable(type)) return UNIFORM_BINDING_MANUAL;
|
||||||
|
return UNIFORM_BINDING_IGNORE;
|
||||||
|
}
|
||||||
|
|
||||||
|
UniformBinding uniform_binding_get(std::string_view value)
|
||||||
|
{
|
||||||
|
for (const auto& info : UNIFORM_BINDING_INFOS)
|
||||||
|
if (value == info.value) return info.binding;
|
||||||
|
return UNIFORM_BINDING_IGNORE;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string_view uniform_binding_value_get(UniformBinding binding)
|
||||||
|
{
|
||||||
|
for (const auto& info : UNIFORM_BINDING_INFOS)
|
||||||
|
if (binding == info.binding) return info.value;
|
||||||
|
return UNIFORM_BINDING_INFOS[0].value;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string_view uniform_binding_label_get(UniformBinding binding)
|
||||||
|
{
|
||||||
|
for (const auto& info : UNIFORM_BINDING_INFOS)
|
||||||
|
if (binding == info.binding) return info.label;
|
||||||
|
return UNIFORM_BINDING_INFOS[0].label;
|
||||||
|
}
|
||||||
|
|
||||||
|
UniformValueType uniform_value_type_get(GLenum type)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case GL_FLOAT:
|
||||||
|
return UNIFORM_VALUE_FLOAT;
|
||||||
|
case GL_INT:
|
||||||
|
case GL_BOOL:
|
||||||
|
return UNIFORM_VALUE_INT;
|
||||||
|
case GL_FLOAT_VEC2:
|
||||||
|
return UNIFORM_VALUE_VEC2;
|
||||||
|
case GL_FLOAT_VEC3:
|
||||||
|
return UNIFORM_VALUE_VEC3;
|
||||||
|
case GL_FLOAT_VEC4:
|
||||||
|
return UNIFORM_VALUE_VEC4;
|
||||||
|
case GL_FLOAT_MAT4:
|
||||||
|
return UNIFORM_VALUE_MAT4;
|
||||||
|
case GL_SAMPLER_2D:
|
||||||
|
return UNIFORM_VALUE_SAMPLER2D;
|
||||||
|
default:
|
||||||
|
return UNIFORM_VALUE_UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string_view uniform_value_type_label_get(UniformValueType type)
|
||||||
|
{
|
||||||
|
for (const auto& info : UNIFORM_VALUE_TYPE_INFOS)
|
||||||
|
if (type == info.type) return info.label;
|
||||||
|
return UNIFORM_VALUE_TYPE_INFOS[0].label;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_uniform_value_editable(UniformValueType type)
|
||||||
|
{
|
||||||
|
return type == UNIFORM_VALUE_FLOAT || type == UNIFORM_VALUE_INT || type == UNIFORM_VALUE_VEC2 ||
|
||||||
|
type == UNIFORM_VALUE_VEC3 || type == UNIFORM_VALUE_VEC4 || type == UNIFORM_VALUE_SAMPLER2D;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_uniform_value_vector(UniformValueType type)
|
||||||
|
{
|
||||||
|
return type == UNIFORM_VALUE_VEC2 || type == UNIFORM_VALUE_VEC3 || type == UNIFORM_VALUE_VEC4;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_uniform_binding_valid(UniformBinding binding, UniformValueType type)
|
||||||
|
{
|
||||||
|
switch (binding)
|
||||||
|
{
|
||||||
|
case UNIFORM_BINDING_IGNORE:
|
||||||
|
return true;
|
||||||
|
case UNIFORM_BINDING_MANUAL:
|
||||||
|
return is_uniform_value_editable(type);
|
||||||
|
case UNIFORM_BINDING_MAIN_TEXTURE:
|
||||||
|
return type == UNIFORM_VALUE_SAMPLER2D;
|
||||||
|
case UNIFORM_BINDING_TRANSFORM:
|
||||||
|
return type == UNIFORM_VALUE_MAT4;
|
||||||
|
case UNIFORM_BINDING_FRAME_TINT:
|
||||||
|
case UNIFORM_BINDING_COLOR_OFFSET:
|
||||||
|
case UNIFORM_BINDING_TEXTURE_SIZE:
|
||||||
|
case UNIFORM_BINDING_PLAYBACK_TIME:
|
||||||
|
return type == UNIFORM_VALUE_FLOAT || is_uniform_value_vector(type);
|
||||||
|
case UNIFORM_BINDING_COMPONENTS:
|
||||||
|
return is_uniform_value_vector(type);
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void uniform_value_parse(Uniform& uniform, std::string_view value)
|
||||||
|
{
|
||||||
|
if (value.empty()) return;
|
||||||
|
|
||||||
|
std::stringstream stream{std::string(value)};
|
||||||
|
if (uniform.valueType == UNIFORM_VALUE_INT || uniform.valueType == UNIFORM_VALUE_SAMPLER2D)
|
||||||
|
{
|
||||||
|
stream >> uniform.intValue;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
stream >> uniform.value.x >> uniform.value.y >> uniform.value.z >> uniform.value.w;
|
||||||
|
uniform.components[0].value = uniform.value.x;
|
||||||
|
uniform.components[1].value = uniform.value.y;
|
||||||
|
uniform.components[2].value = uniform.value.z;
|
||||||
|
uniform.components[3].value = uniform.value.w;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string uniform_value_string_get(const Uniform& uniform)
|
||||||
|
{
|
||||||
|
switch (uniform.valueType)
|
||||||
|
{
|
||||||
|
case UNIFORM_VALUE_FLOAT:
|
||||||
|
return uniform_float_string_get(uniform.value.x);
|
||||||
|
case UNIFORM_VALUE_INT:
|
||||||
|
case UNIFORM_VALUE_SAMPLER2D:
|
||||||
|
return std::format("{}", uniform.intValue);
|
||||||
|
case UNIFORM_VALUE_VEC2:
|
||||||
|
return std::format("{} {}", uniform_float_string_get(uniform.value.x), uniform_float_string_get(uniform.value.y));
|
||||||
|
case UNIFORM_VALUE_VEC3:
|
||||||
|
return std::format("{} {} {}", uniform_float_string_get(uniform.value.x),
|
||||||
|
uniform_float_string_get(uniform.value.y), uniform_float_string_get(uniform.value.z));
|
||||||
|
case UNIFORM_VALUE_VEC4:
|
||||||
|
return std::format("{} {} {} {}", uniform_float_string_get(uniform.value.x),
|
||||||
|
uniform_float_string_get(uniform.value.y), uniform_float_string_get(uniform.value.z),
|
||||||
|
uniform_float_string_get(uniform.value.w));
|
||||||
|
default:
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<Uniform> uniforms_get(GLuint id)
|
||||||
|
{
|
||||||
|
GLint count{};
|
||||||
|
GLint maxLength{};
|
||||||
|
glGetProgramiv(id, GL_ACTIVE_UNIFORMS, &count);
|
||||||
|
glGetProgramiv(id, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxLength);
|
||||||
|
|
||||||
|
std::vector<Uniform> uniforms{};
|
||||||
|
if (count <= 0 || maxLength <= 0) return uniforms;
|
||||||
|
|
||||||
|
std::string name((std::size_t)maxLength, '\0');
|
||||||
|
for (GLint index = 0; index < count; ++index)
|
||||||
|
{
|
||||||
|
GLsizei length{};
|
||||||
|
GLint size{};
|
||||||
|
GLenum type{};
|
||||||
|
glGetActiveUniform(id, (GLuint)index, maxLength, &length, &size, &type, name.data());
|
||||||
|
|
||||||
|
auto uniformName = uniform_name_clean_get(std::string(name.data(), (std::size_t)length));
|
||||||
|
auto valueType = uniform_value_type_get(type);
|
||||||
|
|
||||||
|
Uniform uniform{};
|
||||||
|
uniform.name = uniformName;
|
||||||
|
uniform.location = glGetUniformLocation(id, uniformName.c_str());
|
||||||
|
uniform.glType = type;
|
||||||
|
uniform.size = size;
|
||||||
|
uniform.valueType = valueType;
|
||||||
|
uniform.binding = uniform_binding_auto_get(uniformName, valueType);
|
||||||
|
uniform.components[0].value = uniform.value.x;
|
||||||
|
uniform.components[1].value = uniform.value.y;
|
||||||
|
uniform.components[2].value = uniform.value.z;
|
||||||
|
uniform.components[3].value = uniform.value.w;
|
||||||
|
uniforms.push_back(std::move(uniform));
|
||||||
|
}
|
||||||
|
|
||||||
|
return uniforms;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string gles_convert(std::string_view source, ShaderStage stage)
|
||||||
|
{
|
||||||
|
auto normalized = shader_text_replace(std::string(source), "\r\n", "\n");
|
||||||
|
normalized = shader_text_replace(std::move(normalized), "\r", "\n");
|
||||||
|
|
||||||
|
std::string body{};
|
||||||
|
std::size_t position{};
|
||||||
|
while (position <= normalized.size())
|
||||||
|
{
|
||||||
|
auto end = normalized.find('\n', position);
|
||||||
|
auto isEnd = end == std::string::npos;
|
||||||
|
auto line = normalized.substr(position, isEnd ? std::string::npos : end - position);
|
||||||
|
if (!is_shader_line_skipped(line)) body += shader_line_convert(std::move(line), stage) + "\n";
|
||||||
|
if (isEnd) break;
|
||||||
|
position = end + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto declarations = stage == SHADER_STAGE_FRAGMENT ? shader_fragment_declarations_get(body) : std::string{};
|
||||||
|
return "#version 330 core\n" + declarations + body;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string gles_fragment_convert(std::string_view source)
|
||||||
|
{
|
||||||
|
return gles_convert(source, SHADER_STAGE_FRAGMENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string gles_vertex_convert(std::string_view source)
|
||||||
|
{
|
||||||
|
return gles_convert(source, SHADER_STAGE_VERTEX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace anm2ed::resource
|
namespace anm2ed::resource
|
||||||
{
|
{
|
||||||
Shader::Shader() = default;
|
ShaderCompileResult shader_compile(const char* vertex, const char* fragment)
|
||||||
|
|
||||||
Shader::Shader(const char* vertex, const char* fragment)
|
|
||||||
{
|
{
|
||||||
id = glCreateProgram();
|
ShaderCompileResult result{};
|
||||||
|
result.id = glCreateProgram();
|
||||||
|
|
||||||
auto compile = [&](const GLuint& id, const char* text)
|
auto compile = [&](const GLuint& id, const char* text, const char* label)
|
||||||
{
|
{
|
||||||
int isCompile{};
|
int isCompile{};
|
||||||
glShaderSource(id, 1, &text, nullptr);
|
glShaderSource(id, 1, &text, nullptr);
|
||||||
@@ -19,9 +401,12 @@ namespace anm2ed::resource
|
|||||||
|
|
||||||
if (!isCompile)
|
if (!isCompile)
|
||||||
{
|
{
|
||||||
std::string compileLog(255, '\0');
|
GLint length{};
|
||||||
glGetShaderInfoLog(id, 255, nullptr, compileLog.data());
|
glGetShaderiv(id, GL_INFO_LOG_LENGTH, &length);
|
||||||
logger.error(std::format("Unable to compile shader {}: {}", id, compileLog.c_str()));
|
if (length <= 0) length = 1;
|
||||||
|
std::string compileLog((std::size_t)length, '\0');
|
||||||
|
glGetShaderInfoLog(id, length, nullptr, compileLog.data());
|
||||||
|
result.output += std::format("{} shader compile log:\n{}\n", label, compileLog.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -30,31 +415,66 @@ namespace anm2ed::resource
|
|||||||
auto vertexHandle = glCreateShader(GL_VERTEX_SHADER);
|
auto vertexHandle = glCreateShader(GL_VERTEX_SHADER);
|
||||||
auto fragmentHandle = glCreateShader(GL_FRAGMENT_SHADER);
|
auto fragmentHandle = glCreateShader(GL_FRAGMENT_SHADER);
|
||||||
|
|
||||||
if (!(compile(vertexHandle, vertex) && compile(fragmentHandle, fragment))) return;
|
auto isVertexCompiled = compile(vertexHandle, vertex, "Vertex");
|
||||||
|
auto isFragmentCompiled = compile(fragmentHandle, fragment, "Fragment");
|
||||||
glAttachShader(id, vertexHandle);
|
result.isCompiled = isVertexCompiled && isFragmentCompiled;
|
||||||
glAttachShader(id, fragmentHandle);
|
if (result.isCompiled)
|
||||||
|
|
||||||
glLinkProgram(id);
|
|
||||||
|
|
||||||
auto isLinked = GL_FALSE;
|
|
||||||
glGetProgramiv(id, GL_LINK_STATUS, &isLinked);
|
|
||||||
if (!isLinked)
|
|
||||||
{
|
{
|
||||||
glDeleteProgram(id);
|
glAttachShader(result.id, vertexHandle);
|
||||||
id = 0;
|
glAttachShader(result.id, fragmentHandle);
|
||||||
|
|
||||||
|
for (const auto& alias : shader::ATTRIBUTE_ALIASES)
|
||||||
|
glBindAttribLocation(result.id, alias.index, alias.name);
|
||||||
|
|
||||||
|
glLinkProgram(result.id);
|
||||||
|
|
||||||
|
auto isLinked = GL_FALSE;
|
||||||
|
glGetProgramiv(result.id, GL_LINK_STATUS, &isLinked);
|
||||||
|
result.isLinked = isLinked == GL_TRUE;
|
||||||
|
if (!result.isLinked)
|
||||||
|
{
|
||||||
|
GLint length{};
|
||||||
|
glGetProgramiv(result.id, GL_INFO_LOG_LENGTH, &length);
|
||||||
|
if (length <= 0) length = 1;
|
||||||
|
std::string linkLog((std::size_t)length, '\0');
|
||||||
|
glGetProgramInfoLog(result.id, length, nullptr, linkLog.data());
|
||||||
|
result.output += std::format("Shader link log:\n{}\n", linkLog.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
result.uniforms = shader::uniforms_get(result.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
glDeleteShader(vertexHandle);
|
glDeleteShader(vertexHandle);
|
||||||
glDeleteShader(fragmentHandle);
|
glDeleteShader(fragmentHandle);
|
||||||
|
|
||||||
|
if (!result.isLinked)
|
||||||
|
{
|
||||||
|
glDeleteProgram(result.id);
|
||||||
|
result.id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Shader::Shader() = default;
|
||||||
|
|
||||||
|
Shader::Shader(const char* vertex, const char* fragment)
|
||||||
|
{
|
||||||
|
auto result = shader_compile(vertex, fragment);
|
||||||
|
id = result.id;
|
||||||
|
uniforms = std::move(result.uniforms);
|
||||||
|
if (!result.output.empty()) logger.error(result.output);
|
||||||
|
}
|
||||||
|
|
||||||
|
Shader::Shader(Shader&& other) noexcept { *this = std::move(other); }
|
||||||
|
|
||||||
Shader& Shader::operator=(Shader&& other) noexcept
|
Shader& Shader::operator=(Shader&& other) noexcept
|
||||||
{
|
{
|
||||||
if (this != &other)
|
if (this != &other)
|
||||||
{
|
{
|
||||||
if (is_valid()) glDeleteProgram(id);
|
if (is_valid()) glDeleteProgram(id);
|
||||||
id = other.id;
|
id = other.id;
|
||||||
|
uniforms = std::move(other.uniforms);
|
||||||
other.id = 0;
|
other.id = 0;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace anm2ed::resource::shader
|
namespace anm2ed::resource::shader
|
||||||
{
|
{
|
||||||
@@ -23,6 +29,24 @@ namespace anm2ed::resource::shader
|
|||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
|
||||||
|
inline constexpr auto TEXTURE_COMPATIBILITY_VERTEX = R"(
|
||||||
|
#version 330 core
|
||||||
|
layout (location = 0) in vec2 i_position;
|
||||||
|
layout (location = 1) in vec2 i_uv;
|
||||||
|
out vec2 i_uv_out;
|
||||||
|
out vec2 TexCoord0;
|
||||||
|
out vec4 Color0;
|
||||||
|
uniform mat4 u_transform;
|
||||||
|
uniform vec4 u_tint;
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
i_uv_out = i_uv;
|
||||||
|
TexCoord0 = i_uv;
|
||||||
|
Color0 = u_tint;
|
||||||
|
gl_Position = u_transform * vec4(i_position, 0.0, 1.0);
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
|
||||||
inline constexpr auto AXIS_VERTEX = R"(
|
inline constexpr auto AXIS_VERTEX = R"(
|
||||||
#version 330 core
|
#version 330 core
|
||||||
layout (location = 0) in vec2 i_position; // full screen line segment: -1..1
|
layout (location = 0) in vec2 i_position; // full screen line segment: -1..1
|
||||||
@@ -203,6 +227,122 @@ namespace anm2ed::resource::shader
|
|||||||
constexpr auto UNIFORM_DASH_GAP = "u_dash_gap";
|
constexpr auto UNIFORM_DASH_GAP = "u_dash_gap";
|
||||||
constexpr auto UNIFORM_DASH_OFFSET = "u_dash_offset";
|
constexpr auto UNIFORM_DASH_OFFSET = "u_dash_offset";
|
||||||
|
|
||||||
|
#define RESOURCE_SHADER_ATTRIBUTE_ALIASES \
|
||||||
|
X(0, "i_position") \
|
||||||
|
X(0, "a_position") \
|
||||||
|
X(0, "Position") \
|
||||||
|
X(0, "Position0") \
|
||||||
|
X(1, "i_uv") \
|
||||||
|
X(1, "a_uv") \
|
||||||
|
X(1, "TexCoord") \
|
||||||
|
X(1, "TexCoord0") \
|
||||||
|
X(1, "TextureCoord") \
|
||||||
|
X(1, "UV") \
|
||||||
|
X(1, "UV0") \
|
||||||
|
X(2, "i_color") \
|
||||||
|
X(2, "a_color") \
|
||||||
|
X(2, "Color") \
|
||||||
|
X(2, "Color0")
|
||||||
|
|
||||||
|
struct AttributeAlias
|
||||||
|
{
|
||||||
|
GLuint index{};
|
||||||
|
const char* name{};
|
||||||
|
};
|
||||||
|
|
||||||
|
inline constexpr AttributeAlias ATTRIBUTE_ALIASES[] = {
|
||||||
|
#define X(index, name) {index, name},
|
||||||
|
RESOURCE_SHADER_ATTRIBUTE_ALIASES
|
||||||
|
#undef X
|
||||||
|
};
|
||||||
|
|
||||||
|
#define RESOURCE_SHADER_UNIFORM_BINDINGS \
|
||||||
|
X(IGNORE, "Ignore", "Ignore") \
|
||||||
|
X(MAIN_TEXTURE, "MainTexture", "Main Texture") \
|
||||||
|
X(TRANSFORM, "Transform", "Transform") \
|
||||||
|
X(FRAME_TINT, "FrameTint", "Frame Tint") \
|
||||||
|
X(COLOR_OFFSET, "ColorOffset", "Color Offset") \
|
||||||
|
X(TEXTURE_SIZE, "TextureSize", "Texture Size") \
|
||||||
|
X(PLAYBACK_TIME, "PlaybackTime", "Playback Time") \
|
||||||
|
X(COMPONENTS, "Components", "Per Component") \
|
||||||
|
X(MANUAL, "Manual", "Manual")
|
||||||
|
|
||||||
|
enum UniformBinding
|
||||||
|
{
|
||||||
|
#define X(symbol, value, label) UNIFORM_BINDING_##symbol,
|
||||||
|
RESOURCE_SHADER_UNIFORM_BINDINGS
|
||||||
|
#undef X
|
||||||
|
UNIFORM_BINDING_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
struct UniformBindingInfo
|
||||||
|
{
|
||||||
|
UniformBinding binding{};
|
||||||
|
const char* value{};
|
||||||
|
const char* label{};
|
||||||
|
};
|
||||||
|
|
||||||
|
inline constexpr UniformBindingInfo UNIFORM_BINDING_INFOS[] = {
|
||||||
|
#define X(symbol, value, label) {UNIFORM_BINDING_##symbol, value, label},
|
||||||
|
RESOURCE_SHADER_UNIFORM_BINDINGS
|
||||||
|
#undef X
|
||||||
|
};
|
||||||
|
|
||||||
|
#define RESOURCE_SHADER_UNIFORM_VALUE_TYPES \
|
||||||
|
X(UNKNOWN, "Unknown") \
|
||||||
|
X(FLOAT, "Float") \
|
||||||
|
X(INT, "Int") \
|
||||||
|
X(VEC2, "Vec2") \
|
||||||
|
X(VEC3, "Vec3") \
|
||||||
|
X(VEC4, "Vec4") \
|
||||||
|
X(MAT4, "Mat4") \
|
||||||
|
X(SAMPLER2D, "Sampler2D")
|
||||||
|
|
||||||
|
enum UniformValueType
|
||||||
|
{
|
||||||
|
#define X(symbol, label) UNIFORM_VALUE_##symbol,
|
||||||
|
RESOURCE_SHADER_UNIFORM_VALUE_TYPES
|
||||||
|
#undef X
|
||||||
|
UNIFORM_VALUE_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
struct UniformValueTypeInfo
|
||||||
|
{
|
||||||
|
UniformValueType type{};
|
||||||
|
const char* label{};
|
||||||
|
};
|
||||||
|
|
||||||
|
inline constexpr UniformValueTypeInfo UNIFORM_VALUE_TYPE_INFOS[] = {
|
||||||
|
#define X(symbol, label) {UNIFORM_VALUE_##symbol, label},
|
||||||
|
RESOURCE_SHADER_UNIFORM_VALUE_TYPES
|
||||||
|
#undef X
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Uniform
|
||||||
|
{
|
||||||
|
struct Component
|
||||||
|
{
|
||||||
|
UniformBinding binding{UNIFORM_BINDING_MANUAL};
|
||||||
|
float value{};
|
||||||
|
};
|
||||||
|
|
||||||
|
std::string name{};
|
||||||
|
GLint location{-1};
|
||||||
|
GLenum glType{};
|
||||||
|
GLint size{};
|
||||||
|
UniformValueType valueType{UNIFORM_VALUE_UNKNOWN};
|
||||||
|
UniformBinding binding{UNIFORM_BINDING_IGNORE};
|
||||||
|
glm::vec4 value{};
|
||||||
|
int intValue{};
|
||||||
|
std::array<Component, 4> components{};
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ShaderStage
|
||||||
|
{
|
||||||
|
SHADER_STAGE_VERTEX,
|
||||||
|
SHADER_STAGE_FRAGMENT
|
||||||
|
};
|
||||||
|
|
||||||
enum ShaderType
|
enum ShaderType
|
||||||
{
|
{
|
||||||
LINE,
|
LINE,
|
||||||
@@ -218,17 +358,45 @@ namespace anm2ed::resource::shader
|
|||||||
{VERTEX, TEXTURE_FRAGMENT},
|
{VERTEX, TEXTURE_FRAGMENT},
|
||||||
{AXIS_VERTEX, FRAGMENT},
|
{AXIS_VERTEX, FRAGMENT},
|
||||||
{GRID_VERTEX, GRID_FRAGMENT}};
|
{GRID_VERTEX, GRID_FRAGMENT}};
|
||||||
|
|
||||||
|
UniformBinding uniform_binding_auto_get(std::string_view, UniformValueType);
|
||||||
|
UniformBinding uniform_binding_get(std::string_view);
|
||||||
|
std::string_view uniform_binding_value_get(UniformBinding);
|
||||||
|
std::string_view uniform_binding_label_get(UniformBinding);
|
||||||
|
UniformValueType uniform_value_type_get(GLenum);
|
||||||
|
std::string_view uniform_value_type_label_get(UniformValueType);
|
||||||
|
bool is_uniform_value_editable(UniformValueType);
|
||||||
|
bool is_uniform_value_vector(UniformValueType);
|
||||||
|
bool is_uniform_binding_valid(UniformBinding, UniformValueType);
|
||||||
|
void uniform_value_parse(Uniform&, std::string_view);
|
||||||
|
std::string uniform_value_string_get(const Uniform&);
|
||||||
|
std::string gles_convert(std::string_view, ShaderStage);
|
||||||
|
std::string gles_fragment_convert(std::string_view);
|
||||||
|
std::string gles_vertex_convert(std::string_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace anm2ed::resource
|
namespace anm2ed::resource
|
||||||
{
|
{
|
||||||
|
struct ShaderCompileResult
|
||||||
|
{
|
||||||
|
GLuint id{};
|
||||||
|
std::string output{};
|
||||||
|
std::vector<shader::Uniform> uniforms{};
|
||||||
|
bool isCompiled{};
|
||||||
|
bool isLinked{};
|
||||||
|
};
|
||||||
|
|
||||||
|
ShaderCompileResult shader_compile(const char*, const char*);
|
||||||
|
|
||||||
class Shader
|
class Shader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLuint id{};
|
GLuint id{};
|
||||||
|
std::vector<shader::Uniform> uniforms{};
|
||||||
|
|
||||||
Shader();
|
Shader();
|
||||||
Shader(const char*, const char*);
|
Shader(const char*, const char*);
|
||||||
|
Shader(Shader&&) noexcept;
|
||||||
Shader& operator=(Shader&&) noexcept;
|
Shader& operator=(Shader&&) noexcept;
|
||||||
~Shader();
|
~Shader();
|
||||||
bool is_valid() const;
|
bool is_valid() const;
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ namespace anm2ed
|
|||||||
X(BASIC_CROP, "Crop", "Recortar", "Обрезать", "裁剪", "자르기") \
|
X(BASIC_CROP, "Crop", "Recortar", "Обрезать", "裁剪", "자르기") \
|
||||||
X(BASIC_CUT, "Cut", "Cortar", "Вырезать", "剪切", "잘라내기") \
|
X(BASIC_CUT, "Cut", "Cortar", "Вырезать", "剪切", "잘라내기") \
|
||||||
X(BASIC_DEFAULT, "Default", "Predeterminado", "По умолчанию", "默认", "기본값") \
|
X(BASIC_DEFAULT, "Default", "Predeterminado", "По умолчанию", "默认", "기본값") \
|
||||||
|
X(BASIC_DISABLED, "Disabled", "Desactivado", "Отключено", "禁用", "비활성화") \
|
||||||
X(BASIC_DUPLICATE, "Duplicate", "Duplicar", "Дублировать", "拷贝", "복제") \
|
X(BASIC_DUPLICATE, "Duplicate", "Duplicar", "Дублировать", "拷贝", "복제") \
|
||||||
X(BASIC_DURATION, "Duration", "Duracion", "Продолжительность", "时长", "유지 시간") \
|
X(BASIC_DURATION, "Duration", "Duracion", "Продолжительность", "时长", "유지 시간") \
|
||||||
X(BASIC_ENABLED, "Enabled", "Activado", "Включено", "开启", "활성화") \
|
X(BASIC_ENABLED, "Enabled", "Activado", "Включено", "开启", "활성화") \
|
||||||
@@ -107,6 +108,7 @@ namespace anm2ed
|
|||||||
X(EDIT_ADD_ITEM, "Add Item", "Añadir Item", "Добавить предмет", "添加物品", "항목 추가") \
|
X(EDIT_ADD_ITEM, "Add Item", "Añadir Item", "Добавить предмет", "添加物品", "항목 추가") \
|
||||||
X(EDIT_ADD_LAYER, "Add Layer", "Añadir Capa", "Добавить слой", "添加动画层", "레이어 추가") \
|
X(EDIT_ADD_LAYER, "Add Layer", "Añadir Capa", "Добавить слой", "添加动画层", "레이어 추가") \
|
||||||
X(EDIT_ADD_NULL, "Add Null", "Añadir Null", "Добавить нуль", "添加Null", "Null 추가") \
|
X(EDIT_ADD_NULL, "Add Null", "Añadir Null", "Добавить нуль", "添加Null", "Null 추가") \
|
||||||
|
X(EDIT_ADD_OVERLAY, "Add Overlay", "Add Overlay", "Add Overlay", "Add Overlay", "Add Overlay") \
|
||||||
X(EDIT_ADD_SPRITESHEET, "Add Spritesheet", "Añadir Spritesheet", "Добавить спрайт-лист", "添加图集", "스프라이트 시트 추가") \
|
X(EDIT_ADD_SPRITESHEET, "Add Spritesheet", "Añadir Spritesheet", "Добавить спрайт-лист", "添加图集", "스프라이트 시트 추가") \
|
||||||
X(EDIT_ADD_SOUND, "Add Sound", "Añadir Sonido", "Добавить звук", "添加声音", "사운드 추가") \
|
X(EDIT_ADD_SOUND, "Add Sound", "Añadir Sonido", "Добавить звук", "添加声音", "사운드 추가") \
|
||||||
X(EDIT_ADD_TRIGGER_SOUND, "Add Trigger Sound", "Añadir Sonido del Trigger", "Добавить звук триггера", "添加事件触发器声音", "트리거 사운드 추가") \
|
X(EDIT_ADD_TRIGGER_SOUND, "Add Trigger Sound", "Añadir Sonido del Trigger", "Добавить звук триггера", "添加事件触发器声音", "트리거 사운드 추가") \
|
||||||
@@ -128,6 +130,7 @@ namespace anm2ed
|
|||||||
X(EDIT_FIT_ANIMATION_LENGTH, "Fit Animation Length", "Encajar Largo de animacion", "Подогнать к длине анимации", "匹配动画时长", "애니메이션 길이 맞추기") \
|
X(EDIT_FIT_ANIMATION_LENGTH, "Fit Animation Length", "Encajar Largo de animacion", "Подогнать к длине анимации", "匹配动画时长", "애니메이션 길이 맞추기") \
|
||||||
X(EDIT_FPS, "FPS", "FPS", "FPS", "每秒帧数(FPS)", "FPS") \
|
X(EDIT_FPS, "FPS", "FPS", "FPS", "每秒帧数(FPS)", "FPS") \
|
||||||
X(EDIT_GROUP_ITEMS, "Group Item(s)", "Agrupar item(s)", "Сгруппировать элементы", "将项目分组", "항목 그룹화") \
|
X(EDIT_GROUP_ITEMS, "Group Item(s)", "Agrupar item(s)", "Сгруппировать элементы", "将项目分组", "항목 그룹화") \
|
||||||
|
X(EDIT_REMOVE_GROUP, "Remove Group", "Eliminar grupo", "Удалить группу", "删除组", "그룹 삭제") \
|
||||||
X(EDIT_TOGGLE_GROUP_EXPANDED, "Toggle Group Expanded", "Alternar grupo expandido", "Развернуть/свернуть группу", "展开/折叠组", "그룹 펼침 전환") \
|
X(EDIT_TOGGLE_GROUP_EXPANDED, "Toggle Group Expanded", "Alternar grupo expandido", "Развернуть/свернуть группу", "展开/折叠组", "그룹 펼침 전환") \
|
||||||
X(EDIT_FRAME_COLOR_OFFSET, "Frame Color Offset", "Offset de color de Frame", "Смещение цвета кадра", "帧颜色偏移", "프레임 색상 오프셋") \
|
X(EDIT_FRAME_COLOR_OFFSET, "Frame Color Offset", "Offset de color de Frame", "Смещение цвета кадра", "帧颜色偏移", "프레임 색상 오프셋") \
|
||||||
X(EDIT_FRAME_CROP, "Frame Crop", "Recorte de Frame", "Обрезка кадра", "帧裁剪", "프레임 자르기") \
|
X(EDIT_FRAME_CROP, "Frame Crop", "Recorte de Frame", "Обрезка кадра", "帧裁剪", "프레임 자르기") \
|
||||||
@@ -162,8 +165,10 @@ namespace anm2ed
|
|||||||
X(EDIT_PASTE_LAYERS, "Paste Layer(s)", "Pegar Capa(s)", "Вставить слои", "粘贴动画层", "레이어 붙여넣기") \
|
X(EDIT_PASTE_LAYERS, "Paste Layer(s)", "Pegar Capa(s)", "Вставить слои", "粘贴动画层", "레이어 붙여넣기") \
|
||||||
X(EDIT_PASTE_REGIONS, "Paste Region(s)", "Pegar Región(es)", "Вставить регионы", "粘贴区域", "영역 붙여넣기") \
|
X(EDIT_PASTE_REGIONS, "Paste Region(s)", "Pegar Región(es)", "Вставить регионы", "粘贴区域", "영역 붙여넣기") \
|
||||||
X(EDIT_PASTE_NULLS, "Paste Null(s)", "Pegar Null(s)", "Вставить нули", "粘贴Null", "Null 붙여넣기") \
|
X(EDIT_PASTE_NULLS, "Paste Null(s)", "Pegar Null(s)", "Вставить нули", "粘贴Null", "Null 붙여넣기") \
|
||||||
|
X(EDIT_PASTE_OVERLAYS, "Paste Overlay(s)", "Paste Overlay(s)", "Paste Overlay(s)", "Paste Overlay(s)", "Paste Overlay(s)") \
|
||||||
X(EDIT_PASTE_SOUNDS, "Paste Sound(s)", "Pegar Sonido(s)", "Вставить звук(и)", "粘贴声音", "사운드 붙여넣기") \
|
X(EDIT_PASTE_SOUNDS, "Paste Sound(s)", "Pegar Sonido(s)", "Вставить звук(и)", "粘贴声音", "사운드 붙여넣기") \
|
||||||
X(EDIT_PASTE_SPRITESHEETS, "Paste Spritesheet(s)", "Pegar Spritesheet(s)", "Вставить спрайт-листы", "粘贴图集", "스프라이트 시트 붙여넣기") \
|
X(EDIT_PASTE_SPRITESHEETS, "Paste Spritesheet(s)", "Pegar Spritesheet(s)", "Вставить спрайт-листы", "粘贴图集", "스프라이트 시트 붙여넣기") \
|
||||||
|
X(EDIT_RELOAD_OVERLAYS, "Reload Overlay(s)", "Reload Overlay(s)", "Reload Overlay(s)", "Reload Overlay(s)", "Reload Overlay(s)") \
|
||||||
X(EDIT_RELOAD_SPRITESHEETS, "Reload Spritesheet(s)", "Recargar Spritesheet(s)", "Перезагрузить спрайт-листы", "重新加载图集", "스프라이트 시트 다시 불러오기") \
|
X(EDIT_RELOAD_SPRITESHEETS, "Reload Spritesheet(s)", "Recargar Spritesheet(s)", "Перезагрузить спрайт-листы", "重新加载图集", "스프라이트 시트 다시 불러오기") \
|
||||||
X(EDIT_RELOAD_SOUNDS, "Reload Sound(s)", "Recargar Sonido(s)", "Перезагрузить звук(и)", "重新加载声音", "사운드 다시 불러오기") \
|
X(EDIT_RELOAD_SOUNDS, "Reload Sound(s)", "Recargar Sonido(s)", "Перезагрузить звук(и)", "重新加载声音", "사운드 다시 불러오기") \
|
||||||
X(EDIT_REMOVE_ANIMATIONS, "Remove Animation(s)", "Remover Animacion(es)", "Удалить анимации", "删除动画层", "애니메이션 제거") \
|
X(EDIT_REMOVE_ANIMATIONS, "Remove Animation(s)", "Remover Animacion(es)", "Удалить анимации", "删除动画层", "애니메이션 제거") \
|
||||||
@@ -175,10 +180,13 @@ namespace anm2ed
|
|||||||
X(EDIT_REMOVE_UNUSED_NULLS, "Remove Unused Nulls", "Remover Nulls No Utilizados", "Удалить неизпользуемые нули", "删除未使用的Null", "미사용 Null 제거") \
|
X(EDIT_REMOVE_UNUSED_NULLS, "Remove Unused Nulls", "Remover Nulls No Utilizados", "Удалить неизпользуемые нули", "删除未使用的Null", "미사용 Null 제거") \
|
||||||
X(EDIT_REMOVE_UNUSED_SOUNDS, "Remove Unused Sounds", "Remover Sonidos No Utilizados", "Удалить неизпользуемые звуки", "删除未使用的声音", "미사용 사운드 제거") \
|
X(EDIT_REMOVE_UNUSED_SOUNDS, "Remove Unused Sounds", "Remover Sonidos No Utilizados", "Удалить неизпользуемые звуки", "删除未使用的声音", "미사용 사운드 제거") \
|
||||||
X(EDIT_REMOVE_UNUSED_SPRITESHEETS, "Remove Unused Spritesheets", "Remover Spritesheets No Utilizadas", "Удалить неизпользуемые спрайт-листы", "删除未使用的图集", "미사용 스프라이트 시트 제거") \
|
X(EDIT_REMOVE_UNUSED_SPRITESHEETS, "Remove Unused Spritesheets", "Remover Spritesheets No Utilizadas", "Удалить неизпользуемые спрайт-листы", "删除未使用的图集", "미사용 스프라이트 시트 제거") \
|
||||||
|
X(EDIT_REMOVE_OVERLAYS, "Remove Overlay(s)", "Remove Overlay(s)", "Remove Overlay(s)", "Remove Overlay(s)", "Remove Overlay(s)") \
|
||||||
X(EDIT_RENAME_GROUP, "Rename Group", "Renombrar grupo", "Переименовать группу", "重命名组", "그룹 이름 바꾸기") \
|
X(EDIT_RENAME_GROUP, "Rename Group", "Renombrar grupo", "Переименовать группу", "重命名组", "그룹 이름 바꾸기") \
|
||||||
X(EDIT_RENAME_EVENT, "Rename Event", "Renombrar Evento", "Переименовать событие", "重命名事件", "이벤트 이름 바꾸기") \
|
X(EDIT_RENAME_EVENT, "Rename Event", "Renombrar Evento", "Переименовать событие", "重命名事件", "이벤트 이름 바꾸기") \
|
||||||
X(EDIT_REPLACE_SPRITESHEET, "Replace Spritesheet", "Reemplazar Spritesheet", "Заменить спрайт-лист", "替换图集", "스프라이트 시트 교체") \
|
X(EDIT_REPLACE_SPRITESHEET, "Replace Spritesheet", "Reemplazar Spritesheet", "Заменить спрайт-лист", "替换图集", "스프라이트 시트 교체") \
|
||||||
|
X(EDIT_REPLACE_OVERLAY, "Replace Overlay", "Replace Overlay", "Replace Overlay", "Replace Overlay", "Replace Overlay") \
|
||||||
X(EDIT_REPLACE_SOUND, "Replace Sound", "Reemplazar Sonido", "Заменить звук", "替换声音", "사운드 교체") \
|
X(EDIT_REPLACE_SOUND, "Replace Sound", "Reemplazar Sonido", "Заменить звук", "替换声音", "사운드 교체") \
|
||||||
|
X(EDIT_SET_OVERLAY_FILE_PATH, "Set Overlay File Path", "Set Overlay File Path", "Set Overlay File Path", "Set Overlay File Path", "Set Overlay File Path") \
|
||||||
X(EDIT_SET_SPRITESHEET_FILE_PATH, "Set Spritesheet File Path", "Set Spritesheet File Path", "Set Spritesheet File Path", "Set Spritesheet File Path", "Set Spritesheet File Path") \
|
X(EDIT_SET_SPRITESHEET_FILE_PATH, "Set Spritesheet File Path", "Set Spritesheet File Path", "Set Spritesheet File Path", "Set Spritesheet File Path", "Set Spritesheet File Path") \
|
||||||
X(EDIT_SET_LAYER_PROPERTIES, "Set Layer Properties", "Establecer Propiedades de Capa", "Установить свойства слоя", "更改动画层属性", "레이어 속성 설정") \
|
X(EDIT_SET_LAYER_PROPERTIES, "Set Layer Properties", "Establecer Propiedades de Capa", "Установить свойства слоя", "更改动画层属性", "레이어 속성 설정") \
|
||||||
X(EDIT_SET_REGION_PROPERTIES, "Set Region Properties", "Establecer propiedades de región", "Установить свойства региона", "更改区域属性", "영역 속성 설정") \
|
X(EDIT_SET_REGION_PROPERTIES, "Set Region Properties", "Establecer propiedades de región", "Установить свойства региона", "更改区域属性", "영역 속성 설정") \
|
||||||
@@ -211,6 +219,7 @@ namespace anm2ed
|
|||||||
X(FORMAT_LOOP, "Loop: {0}", "Loop: {0}", "Цикл: {0}", "循环: {0}", "반복: {0}") \
|
X(FORMAT_LOOP, "Loop: {0}", "Loop: {0}", "Цикл: {0}", "循环: {0}", "반복: {0}") \
|
||||||
X(FORMAT_NOT_SAVED, "{0} [Not Saved]", "{0} [Not Saved]", "{0} [Не сохранено]", "{0} [未保存]", "{0} [저장되지 않음]") \
|
X(FORMAT_NOT_SAVED, "{0} [Not Saved]", "{0} [Not Saved]", "{0} [Не сохранено]", "{0} [未保存]", "{0} [저장되지 않음]") \
|
||||||
X(FORMAT_NULL, "#{0} {1}", "#{0} {1}", "#{0} {1}", "#{0} {1}", "#{0} {1}") \
|
X(FORMAT_NULL, "#{0} {1}", "#{0} {1}", "#{0} {1}", "#{0} {1}", "#{0} {1}") \
|
||||||
|
X(FORMAT_OVERLAY, "#{0} {1}", "#{0} {1}", "#{0} {1}", "#{0} {1}", "#{0} {1}") \
|
||||||
X(FORMAT_PIVOT, "Pivot: ({0}, {1})", "Pivote", "Точка вращения: ({0}, {1})", "枢轴: ({0}, {1})", "중심점: ({0}, {1})") \
|
X(FORMAT_PIVOT, "Pivot: ({0}, {1})", "Pivote", "Точка вращения: ({0}, {1})", "枢轴: ({0}, {1})", "중심점: ({0}, {1})") \
|
||||||
X(FORMAT_POSITION, "Position: ({0}, {1})", "Posicion: ({0}, {1})", "Позиция: ({0}, {1})", "位置: ({0}, {1})", "위치: ({0}, {1})") \
|
X(FORMAT_POSITION, "Position: ({0}, {1})", "Posicion: ({0}, {1})", "Позиция: ({0}, {1})", "位置: ({0}, {1})", "위치: ({0}, {1})") \
|
||||||
X(FORMAT_POSITION_SPACED, "Position: ({0:3}, {1:3})", "Posicion: ({0:3}, {1:3})", "Позиция: ({0:3}, {1:3})", "位置: ({0:3}, {1:3})", "위치: ({0:3}, {1:3})") \
|
X(FORMAT_POSITION_SPACED, "Position: ({0:3}, {1:3})", "Posicion: ({0:3}, {1:3})", "Позиция: ({0:3}, {1:3})", "位置: ({0:3}, {1:3})", "위치: ({0:3}, {1:3})") \
|
||||||
@@ -243,7 +252,7 @@ namespace anm2ed
|
|||||||
X(LABEL_ANIMATION_LENGTH, "Animation Length", "Duracion de Animacion", "Длина анимации", "动画时长", "애니메이션 길이") \
|
X(LABEL_ANIMATION_LENGTH, "Animation Length", "Duracion de Animacion", "Длина анимации", "动画时长", "애니메이션 길이") \
|
||||||
X(LABEL_ANIMATION_PREVIEW_WINDOW, "Animation Preview###Animation Preview", "Vista Previa de Animacion###Animation Preview", "Предпросмотр анимации###Animation Preview", "动画预放###Animation Preview", "애니메이션 프리뷰###Animation Preview") \
|
X(LABEL_ANIMATION_PREVIEW_WINDOW, "Animation Preview###Animation Preview", "Vista Previa de Animacion###Animation Preview", "Предпросмотр анимации###Animation Preview", "动画预放###Animation Preview", "애니메이션 프리뷰###Animation Preview") \
|
||||||
X(LABEL_APPEND_FRAMES, "Append Frames", "Anteponer Frames", "Добавить кадры к концу", "在后面添加帧", "뒷프레임에 추가") \
|
X(LABEL_APPEND_FRAMES, "Append Frames", "Anteponer Frames", "Добавить кадры к концу", "在后面添加帧", "뒷프레임에 추가") \
|
||||||
X(LABEL_APPLICATION_NAME, "Anm2Ed Version 2.5", "Anm2Ed Version 2.5", "Anm2Ed Версия 2.5", "Anm2Ed 2.5版本", "Anm2Ed 버전 2.5") \
|
X(LABEL_APPLICATION_NAME, "Anm2Ed", "Anm2Ed", "Anm2Ed", "Anm2Ed", "Anm2Ed") \
|
||||||
X(LABEL_AUTHOR, "Author", "Autor", "Автор", "制作者", "작성자") \
|
X(LABEL_AUTHOR, "Author", "Autor", "Автор", "制作者", "작성자") \
|
||||||
X(LABEL_AUTOSAVE, "Autosave", "Autoguardado", "Автосохранение", "自动保存", "자동저장") \
|
X(LABEL_AUTOSAVE, "Autosave", "Autoguardado", "Автосохранение", "自动保存", "자동저장") \
|
||||||
X(LABEL_AXES, "Axes", "Ejes", "Оси", "坐标轴", "가로/세로 축") \
|
X(LABEL_AXES, "Axes", "Ejes", "Оси", "坐标轴", "가로/세로 축") \
|
||||||
@@ -252,6 +261,7 @@ namespace anm2ed
|
|||||||
X(LABEL_BAKE_INTO_OTHER_FRAMES, "Bake into Other Frames", "Bake en otros frames", "Запечь в другие кадры", "烘焙到其他帧", "다른 프레임에 베이크") \
|
X(LABEL_BAKE_INTO_OTHER_FRAMES, "Bake into Other Frames", "Bake en otros frames", "Запечь в другие кадры", "烘焙到其他帧", "다른 프레임에 베이크") \
|
||||||
X(LABEL_BAKE_MATCH_ROOT_INTERPOLATION, "Bake other frames to match interpolation", "Bake otros frames para coincidir con interpolación", "Запечь другие кадры для соответствия интерполяции", "烘焙其他帧以匹配插值", "보간에 맞게 다른 프레임 베이크") \
|
X(LABEL_BAKE_MATCH_ROOT_INTERPOLATION, "Bake other frames to match interpolation", "Bake otros frames para coincidir con interpolación", "Запечь другие кадры для соответствия интерполяции", "烘焙其他帧以匹配插值", "보간에 맞게 다른 프레임 베이크") \
|
||||||
X(LABEL_BAKE_USE_ROOT_PIVOT, "Use root pivot", "Usar pivote root", "Использовать корневой пивот", "使用根枢轴", "Root 중심점 사용") \
|
X(LABEL_BAKE_USE_ROOT_PIVOT, "Use root pivot", "Usar pivote root", "Использовать корневой пивот", "使用根枢轴", "Root 중심점 사용") \
|
||||||
|
X(LABEL_BINDING, "Binding", "Binding", "Binding", "Binding", "Binding") \
|
||||||
X(LABEL_SPLIT, "Split", "Dividir", "Разделить", "拆分", "분할") \
|
X(LABEL_SPLIT, "Split", "Dividir", "Разделить", "拆分", "분할") \
|
||||||
X(LABEL_BORDER, "Border", "Borde", "Границы", "边框", "경계선") \
|
X(LABEL_BORDER, "Border", "Borde", "Границы", "边框", "경계선") \
|
||||||
X(LABEL_CHANGE_ALL_FRAME_PROPERTIES, "Change All Frame Properties", "Cambiar todas las propiedades de frame", "Изменить все свойства кадра", "更改所有帧属性", "모든 프레임 속성 변경") \
|
X(LABEL_CHANGE_ALL_FRAME_PROPERTIES, "Change All Frame Properties", "Cambiar todas las propiedades de frame", "Изменить все свойства кадра", "更改所有帧属性", "모든 프레임 속성 변경") \
|
||||||
@@ -265,6 +275,7 @@ namespace anm2ed
|
|||||||
X(LABEL_REGIONS, "Regions", "Regiones", "Регионы", "区域", "영역") \
|
X(LABEL_REGIONS, "Regions", "Regiones", "Регионы", "区域", "영역") \
|
||||||
X(LABEL_KEEP_REDUNDANT_FRAME_REGION_VALUES, "Keep redundant frame information for frames with regions", "Mantener información redundante en frames con regiones", "Сохранять избыточные данные кадров с регионами", "保留带区域帧的冗余信息", "영역이 있는 프레임의 중복 정보 유지") \
|
X(LABEL_KEEP_REDUNDANT_FRAME_REGION_VALUES, "Keep redundant frame information for frames with regions", "Mantener información redundante en frames con regiones", "Сохранять избыточные данные кадров с регионами", "保留带区域帧的冗余信息", "영역이 있는 프레임의 중복 정보 유지") \
|
||||||
X(LABEL_BAKE_SPECIAL_INTERPOLATED_FRAMES_ON_SAVE, "Automatically bake frames with special interpolation modes", "Hornear frames con interpolación especial al guardar", "Запекать кадры со специальной интерполяцией при сохранении", "保存时烘焙特殊插值帧", "저장 시 특수 보간 프레임 베이크") \
|
X(LABEL_BAKE_SPECIAL_INTERPOLATED_FRAMES_ON_SAVE, "Automatically bake frames with special interpolation modes", "Hornear frames con interpolación especial al guardar", "Запекать кадры со специальной интерполяцией при сохранении", "保存时烘焙特殊插值帧", "저장 시 특수 보간 프레임 베이크") \
|
||||||
|
X(LABEL_BAKE_GROUP_FRAMES_ON_SAVE, "Bake frames inside groups if applicable", "Hornear frames dentro de grupos si corresponde", "Запекать кадры внутри групп при необходимости", "适用时烘焙组内帧", "필요 시 그룹 안의 프레임 베이크") \
|
||||||
X(LABEL_CUSTOM_RANGE, "Custom Range", "Rango Personalizado", "Пользовательский диапазон", "自定义范围", "길이 맞춤설정") \
|
X(LABEL_CUSTOM_RANGE, "Custom Range", "Rango Personalizado", "Пользовательский диапазон", "自定义范围", "길이 맞춤설정") \
|
||||||
X(LABEL_DELETE, "Delete", "Borrar", "Удалить", "删除", "삭제") \
|
X(LABEL_DELETE, "Delete", "Borrar", "Удалить", "删除", "삭제") \
|
||||||
X(LABEL_DELETE_ANIMATIONS_AFTER, "Delete Animations After", "Borrar Animaciones Despues", "Удалить анимации после", "删除之后的动画", "기존 애니메이션 삭제") \
|
X(LABEL_DELETE_ANIMATIONS_AFTER, "Delete Animations After", "Borrar Animaciones Despues", "Удалить анимации после", "删除之后的动画", "기존 애니메이션 삭제") \
|
||||||
@@ -285,11 +296,13 @@ namespace anm2ed
|
|||||||
X(LABEL_EXPLORE_XML_LOCATION, "Explore XML Location", "Explorar Localizacion de XML", "Открыть местоположение XML", "探索XML位置", "XML 경로로 탐색기 열기") \
|
X(LABEL_EXPLORE_XML_LOCATION, "Explore XML Location", "Explorar Localizacion de XML", "Открыть местоположение XML", "探索XML位置", "XML 경로로 탐색기 열기") \
|
||||||
X(LABEL_FFMPEG_PATH, "FFmpeg Path", "Localizacion de FFmpeg", "Путь к FFmpeg", "FFmpeg路径", "FFmpeg 경로") \
|
X(LABEL_FFMPEG_PATH, "FFmpeg Path", "Localizacion de FFmpeg", "Путь к FFmpeg", "FFmpeg路径", "FFmpeg 경로") \
|
||||||
X(LABEL_FILE_MENU, "File", "Archivo", "Файл", "文件", "파일") \
|
X(LABEL_FILE_MENU, "File", "Archivo", "Файл", "文件", "파일") \
|
||||||
|
X(LABEL_FILES, "Files", "Archivos", "Файлы", "文件", "파일") \
|
||||||
X(LABEL_FIT, "Fit", "Encajar", "Подогнать по размеру", "匹配", "맞추기") \
|
X(LABEL_FIT, "Fit", "Encajar", "Подогнать по размеру", "匹配", "맞추기") \
|
||||||
X(LABEL_FIT_ANIMATION_LENGTH, "Fit Animation Length", "Encajar Largo de animacion", "Подогнать к длине анимации", "匹配动画时长", "애니메이션 길이 맞추기") \
|
X(LABEL_FIT_ANIMATION_LENGTH, "Fit Animation Length", "Encajar Largo de animacion", "Подогнать к длине анимации", "匹配动画时长", "애니메이션 길이 맞추기") \
|
||||||
X(LABEL_FLIP_X, "Flip X", "Invertir X", "Отразить по X", "X轴翻转", "수평 뒤집기") \
|
X(LABEL_FLIP_X, "Flip X", "Invertir X", "Отразить по X", "X轴翻转", "수평 뒤집기") \
|
||||||
X(LABEL_FLIP_Y, "Flip Y", "Invertir Y", "Отразить по Y", "Y轴翻转", "수직 뒤집기") \
|
X(LABEL_FLIP_Y, "Flip Y", "Invertir Y", "Отразить по Y", "Y轴翻转", "수직 뒤집기") \
|
||||||
X(LABEL_FORMAT, "Format", "Formato", "Формат", "格式", "파일 포맷") \
|
X(LABEL_FORMAT, "Format", "Formato", "Формат", "格式", "파일 포맷") \
|
||||||
|
X(LABEL_FRAGMENT, "Fragment", "Fragment", "Fragment", "Fragment", "Fragment") \
|
||||||
X(LABEL_FPS, "FPS", "FPS", "FPS", "FPS", "FPS") \
|
X(LABEL_FPS, "FPS", "FPS", "FPS", "FPS", "FPS") \
|
||||||
X(LABEL_FRAME_PROPERTIES_WINDOW, "Frame Properties###Frame Properties", "Propiedades de Frame###Frame Properties", "Свойства кадра###Frame Properties", "帧属性###Frame Properties", "프레임 속성###Frame Properties") \
|
X(LABEL_FRAME_PROPERTIES_WINDOW, "Frame Properties###Frame Properties", "Propiedades de Frame###Frame Properties", "Свойства кадра###Frame Properties", "帧属性###Frame Properties", "프레임 속성###Frame Properties") \
|
||||||
X(LABEL_GENERATE, "Generate", "Generar", "Сгенерировать", "生成", "생성") \
|
X(LABEL_GENERATE, "Generate", "Generar", "Сгенерировать", "生成", "생성") \
|
||||||
@@ -300,6 +313,7 @@ namespace anm2ed
|
|||||||
X(LABEL_GENERATE_REGIONS_FROM_ANIMATIONS, "Generate Regions from Animations", "Generar regiones desde animaciones", "Создать регионы из анимаций", "从动画生成区域", "애니메이션에서 영역 생성") \
|
X(LABEL_GENERATE_REGIONS_FROM_ANIMATIONS, "Generate Regions from Animations", "Generar regiones desde animaciones", "Создать регионы из анимаций", "从动画生成区域", "애니메이션에서 영역 생성") \
|
||||||
X(LABEL_GENERATE_ROWS, "Rows", "Filas", "Ряды", "行", "행") \
|
X(LABEL_GENERATE_ROWS, "Rows", "Filas", "Ряды", "行", "행") \
|
||||||
X(LABEL_GENERATE_START_POSITION, "Start Position", "Poscicion de Inicio", "Начальная позиция", "起始位置", "시작 위치") \
|
X(LABEL_GENERATE_START_POSITION, "Start Position", "Poscicion de Inicio", "Начальная позиция", "起始位置", "시작 위치") \
|
||||||
|
X(LABEL_GENERAL, "General", "General", "General", "General", "General") \
|
||||||
X(LABEL_ALL, "All", "Todo", "Все", "全部", "전체") \
|
X(LABEL_ALL, "All", "Todo", "Все", "全部", "전체") \
|
||||||
X(LABEL_ALL_ANIMATIONS, "All Animations", "Todas las Animaciones", "Все анимации", "所有动画", "모든 애니메이션") \
|
X(LABEL_ALL_ANIMATIONS, "All Animations", "Todas las Animaciones", "Все анимации", "所有动画", "모든 애니메이션") \
|
||||||
X(LABEL_HELP_MENU, "Help", "Ayuda", "Помощь", "帮助", "도움말") \
|
X(LABEL_HELP_MENU, "Help", "Ayuda", "Помощь", "帮助", "도움말") \
|
||||||
@@ -334,6 +348,10 @@ namespace anm2ed
|
|||||||
X(LABEL_MANAGER_NULL_PROPERTIES, "Null Properties", "Propiedades Null", "Свойства нуля", "Null属性", "Null 속성") \
|
X(LABEL_MANAGER_NULL_PROPERTIES, "Null Properties", "Propiedades Null", "Свойства нуля", "Null属性", "Null 속성") \
|
||||||
X(LABEL_MANAGER_RENDERING_PROGRESS, "Rendering...", "Renderizando...", "Рендеринг...", "渲染中...", "렌더링 중...") \
|
X(LABEL_MANAGER_RENDERING_PROGRESS, "Rendering...", "Renderizando...", "Рендеринг...", "渲染中...", "렌더링 중...") \
|
||||||
X(LABEL_MERGE, "Merge", "Combinar", "Соединить", "合并", "병합") \
|
X(LABEL_MERGE, "Merge", "Combinar", "Соединить", "合并", "병합") \
|
||||||
|
X(LABEL_MERGE_PRESET, "Preset", "Preset", "Preset", "Preset", "Preset") \
|
||||||
|
X(LABEL_MERGE_PRESET_APPEND_AS_NEW, "Append as New", "Append as New", "Append as New", "Append as New", "Append as New") \
|
||||||
|
X(LABEL_MERGE_PRESET_MERGE_BY_NAME, "Merge by Name", "Merge by Name", "Merge by Name", "Merge by Name", "Merge by Name") \
|
||||||
|
X(LABEL_MERGE_PRESET_REPLACE_MATCHING, "Replace Matching", "Replace Matching", "Replace Matching", "Replace Matching", "Replace Matching") \
|
||||||
X(LABEL_MERGE_SPRITESHEETS_APPEND_RIGHT, "Top Right", "Arriba a la derecha", "Сверху справа", "右上", "우측 상단") \
|
X(LABEL_MERGE_SPRITESHEETS_APPEND_RIGHT, "Top Right", "Arriba a la derecha", "Сверху справа", "右上", "우측 상단") \
|
||||||
X(LABEL_MERGE_SPRITESHEETS_APPEND_BOTTOM, "Bottom Left", "Abajo a la izquierda", "Снизу слева", "左下", "좌측 하단") \
|
X(LABEL_MERGE_SPRITESHEETS_APPEND_BOTTOM, "Bottom Left", "Abajo a la izquierda", "Снизу слева", "左下", "좌측 하단") \
|
||||||
X(LABEL_MERGE_MAKE_SPRITESHEET_REGIONS, "Make Spritesheet Regions", "Crear regiones de spritesheet", "Создать регионы спрайт-листа", "生成图集区域", "스프라이트 시트 영역 만들기") \
|
X(LABEL_MERGE_MAKE_SPRITESHEET_REGIONS, "Make Spritesheet Regions", "Crear regiones de spritesheet", "Создать регионы спрайт-листа", "生成图集区域", "스프라이트 시트 영역 만들기") \
|
||||||
@@ -349,6 +367,7 @@ namespace anm2ed
|
|||||||
X(LABEL_OUTPUT_DIRECTORY, "Directory", "Directorio", "Директория", "目录", "디렉터리") \
|
X(LABEL_OUTPUT_DIRECTORY, "Directory", "Directorio", "Директория", "目录", "디렉터리") \
|
||||||
X(LABEL_OUTPUT_PATH, "Path", "Ruta", "Путь", "路径", "경로") \
|
X(LABEL_OUTPUT_PATH, "Path", "Ruta", "Путь", "路径", "경로") \
|
||||||
X(LABEL_OVERLAY, "Overlay", "Overlay", "Наложение", "动画叠加", "오버레이") \
|
X(LABEL_OVERLAY, "Overlay", "Overlay", "Наложение", "动画叠加", "오버레이") \
|
||||||
|
X(LABEL_OVERLAYS_WINDOW, "Overlays###Overlays", "Overlays###Overlays", "Overlays###Overlays", "Overlays###Overlays", "Overlays###Overlays") \
|
||||||
X(LABEL_OVERWRITE_CONFIRMATION, "Are you sure? This will overwrite the existing file.", "¿Estas Seguro? Esto sobreescribira el archivo existente.", "Вы уверены? Это перезапишет существующий файл.", "你确定吗? 这样会覆盖原本的文件.", "저장하시겠습니까? 기존 파일을 덮어쓰게 됩니다.") \
|
X(LABEL_OVERWRITE_CONFIRMATION, "Are you sure? This will overwrite the existing file.", "¿Estas Seguro? Esto sobreescribira el archivo existente.", "Вы уверены? Это перезапишет существующий файл.", "你确定吗? 这样会覆盖原本的文件.", "저장하시겠습니까? 기존 파일을 덮어쓰게 됩니다.") \
|
||||||
X(LABEL_OVERWRITE_WARNING, "Overwrite Warning", "Alerta de Sobreescribir", "Предупреждение о перезаписи", "覆盖提醒", "덮어쓰기 경고") \
|
X(LABEL_OVERWRITE_WARNING, "Overwrite Warning", "Alerta de Sobreescribir", "Предупреждение о перезаписи", "覆盖提醒", "덮어쓰기 경고") \
|
||||||
X(LABEL_PAUSE, "Pause", "Pausar", "Пауза", "暂停", "일시정지") \
|
X(LABEL_PAUSE, "Pause", "Pausar", "Пауза", "暂停", "일시정지") \
|
||||||
@@ -357,7 +376,6 @@ namespace anm2ed
|
|||||||
X(LABEL_PLAYBACK_ALWAYS_LOOP, "Always Loop", "Siempre Loopear", "Всегда воспроизводить циклично", "持续循环", "항상 반복") \
|
X(LABEL_PLAYBACK_ALWAYS_LOOP, "Always Loop", "Siempre Loopear", "Всегда воспроизводить циклично", "持续循环", "항상 반복") \
|
||||||
X(LABEL_PLAYBACK_MENU, "Playback", "Reproduccion", "Возпроизведение", "回放", "재생") \
|
X(LABEL_PLAYBACK_MENU, "Playback", "Reproduccion", "Возпроизведение", "回放", "재생") \
|
||||||
X(LABEL_PREPEND_FRAMES, "Prepend Frames", "Anteponer Frames", "Добавить кадры", "在前面插入帧", "뒷프레임에 추가") \
|
X(LABEL_PREPEND_FRAMES, "Prepend Frames", "Anteponer Frames", "Добавить кадры", "在前面插入帧", "뒷프레임에 추가") \
|
||||||
X(LABEL_RAW, "Raw", "En Crudo", "Необработанный", "原始", "Raw만") \
|
|
||||||
X(LABEL_RECT, "Rect", "Rect", "Прямоугольник", "矩形", "사각형") \
|
X(LABEL_RECT, "Rect", "Rect", "Прямоугольник", "矩形", "사각형") \
|
||||||
X(LABEL_RENDER, "Render", "Renderizar", "Рендер", "渲染", "렌더링") \
|
X(LABEL_RENDER, "Render", "Renderizar", "Рендер", "渲染", "렌더링") \
|
||||||
X(LABEL_REPEAT_DELAY, "Repeat Delay (seconds)", "Repetir Delay (segundos)", "Задержка повторения (секунды)", "键盘按键重复延迟 (秒)", "반복 입력 지연 시간 (초)") \
|
X(LABEL_REPEAT_DELAY, "Repeat Delay (seconds)", "Repetir Delay (segundos)", "Задержка повторения (секунды)", "键盘按键重复延迟 (秒)", "반복 입력 지연 시간 (초)") \
|
||||||
@@ -377,6 +395,14 @@ namespace anm2ed
|
|||||||
X(LABEL_SOUND, "Sound", "Sonido", "Звук", "声音", "사운드") \
|
X(LABEL_SOUND, "Sound", "Sonido", "Звук", "声音", "사운드") \
|
||||||
X(LABEL_SOUNDS, "Sounds", "Sonidos", "Звук", "声音", "사운드") \
|
X(LABEL_SOUNDS, "Sounds", "Sonidos", "Звук", "声音", "사운드") \
|
||||||
X(LABEL_SOUNDS_WINDOW, "Sounds###Sounds", "Sonidos###Sounds", "Звук###Sounds", "声音###Sounds", "사운드###Sounds") \
|
X(LABEL_SOUNDS_WINDOW, "Sounds###Sounds", "Sonidos###Sounds", "Звук###Sounds", "声音###Sounds", "사운드###Sounds") \
|
||||||
|
X(LABEL_SHADERS_WINDOW, "Shaders###Shaders", "Shaders###Shaders", "Shaders###Shaders", "Shaders###Shaders", "Shaders###Shaders") \
|
||||||
|
X(LABEL_SHADER_COMPILE_FAILED, "Shader compilation failed.", "Shader compilation failed.", "Shader compilation failed.", "Shader compilation failed.", "Shader compilation failed.") \
|
||||||
|
X(LABEL_SHADER_COMPILE_SUCCEEDED, "Shader compilation succeeded.", "Shader compilation succeeded.", "Shader compilation succeeded.", "Shader compilation succeeded.", "Shader compilation succeeded.") \
|
||||||
|
X(LABEL_SHADER_LINK_FAILED, "Shader linking failed.", "Shader linking failed.", "Shader linking failed.", "Shader linking failed.", "Shader linking failed.") \
|
||||||
|
X(LABEL_SHADER_LINK_SUCCEEDED, "Shader linking succeeded.", "Shader linking succeeded.", "Shader linking succeeded.", "Shader linking succeeded.", "Shader linking succeeded.") \
|
||||||
|
X(LABEL_SHADER_PATH_EMPTY, "Shader path is empty: {0}", "Shader path is empty: {0}", "Shader path is empty: {0}", "Shader path is empty: {0}", "Shader path is empty: {0}") \
|
||||||
|
X(LABEL_SHADER_READ_FAILED, "Failed to read shader file: {0}", "Failed to read shader file: {0}", "Failed to read shader file: {0}", "Failed to read shader file: {0}", "Failed to read shader file: {0}") \
|
||||||
|
X(LABEL_SHADER_RELOAD_NEEDED, "Shader changed; reload to apply.", "Shader changed; reload to apply.", "Shader changed; reload to apply.", "Shader changed; reload to apply.", "Shader changed; reload to apply.") \
|
||||||
X(LABEL_SOURCE, "Source", "Fuente", "Източник", "动画层来源", "소스") \
|
X(LABEL_SOURCE, "Source", "Fuente", "Източник", "动画层来源", "소스") \
|
||||||
X(LABEL_SPRITESHEET, "Spritesheet", "Spritesheet", "Спрайт-лист", "图集", "스프라이트 시트") \
|
X(LABEL_SPRITESHEET, "Spritesheet", "Spritesheet", "Спрайт-лист", "图集", "스프라이트 시트") \
|
||||||
X(LABEL_SPRITESHEETS_WINDOW, "Spritesheets###Spritesheets", "Spritesheets###Spritesheets", "Спрайт-листы###Spritesheets", "图集###Spritesheets", "스프라이트 시트###Spritesheets") \
|
X(LABEL_SPRITESHEETS_WINDOW, "Spritesheets###Spritesheets", "Spritesheets###Spritesheets", "Спрайт-листы###Spritesheets", "图集###Spritesheets", "스프라이트 시트###Spritesheets") \
|
||||||
@@ -406,9 +432,13 @@ namespace anm2ed
|
|||||||
X(LABEL_TO_SELECTED_FRAMES, "To Selected Frames", "A Frames Selecionados", "К выбранным кадрам", "跳到所选的帧", "선택한 프레임에 맞춤") \
|
X(LABEL_TO_SELECTED_FRAMES, "To Selected Frames", "A Frames Selecionados", "К выбранным кадрам", "跳到所选的帧", "선택한 프레임에 맞춤") \
|
||||||
X(LABEL_TRANSPARENT, "Transparent", "Transparentes", "Прозрачный", "透明", "투명도") \
|
X(LABEL_TRANSPARENT, "Transparent", "Transparentes", "Прозрачный", "透明", "투명도") \
|
||||||
X(LABEL_TYPE, "Type", "Tipo", "Тип", "类型", "유형") \
|
X(LABEL_TYPE, "Type", "Tipo", "Тип", "类型", "유형") \
|
||||||
|
X(LABEL_UNIFORMS, "Uniforms", "Uniforms", "Uniforms", "Uniforms", "Uniforms") \
|
||||||
X(LABEL_UI_SCALE, "UI Scale", "Escala de la Interfaz", "Размер UI", "界面缩放", "UI 비율") \
|
X(LABEL_UI_SCALE, "UI Scale", "Escala de la Interfaz", "Размер UI", "界面缩放", "UI 비율") \
|
||||||
|
X(LABEL_USE_ANIMATION_BOUNDS, "Use Animation Bounds", "Use Animation Bounds", "Use Animation Bounds", "Use Animation Bounds", "Use Animation Bounds") \
|
||||||
X(LABEL_USE_DEFAULT_SETTINGS, "Use Default Settings", "Usar Opciones Predeterminadas", "Изпользовать настройки по умолчанию", "使用默认设置", "기본값으로 사용") \
|
X(LABEL_USE_DEFAULT_SETTINGS, "Use Default Settings", "Usar Opciones Predeterminadas", "Изпользовать настройки по умолчанию", "使用默认设置", "기본값으로 사용") \
|
||||||
|
X(LABEL_USE_ISOLATED_ANIMATION, "Use Isolated Animation", "Use Isolated Animation", "Use Isolated Animation", "Use Isolated Animation", "Use Isolated Animation") \
|
||||||
X(LABEL_VALUE_COLUMN, "Value", "Valor", "Значение", "数值", "값") \
|
X(LABEL_VALUE_COLUMN, "Value", "Valor", "Значение", "数值", "값") \
|
||||||
|
X(LABEL_VERTEX, "Vertex", "Vertex", "Vertex", "Vertex", "Vertex") \
|
||||||
X(LABEL_VSYNC, "Vsync", "Vsync", "Вертикальная синхронизация (V-sync)", "垂直同步", "수직 동기화") \
|
X(LABEL_VSYNC, "Vsync", "Vsync", "Вертикальная синхронизация (V-sync)", "垂直同步", "수직 동기화") \
|
||||||
X(LABEL_WELCOME_DESCRIPTION, "Select a recent file or open a new or existing document. You can also drag and drop files into the window to open them.", "Selecciona un archivo reciente o abre un documento existente o nuevo. También puedes arrastrar y soltar archivos a la ventana para abrirlos.", "Выберите недавний файл или откройте новый или существующий документ. Вы также можете перетащить файлы в это окно, чтобы их открыть.", "选择最近的文件, 或打开新的/已有的文档. 你也可以将文件拖拽到窗口中以打开它们.", "최근 파일을 선택하거나 새 파일 또는 기존 파일을 엽니다. 파일을 여기로 드래그하여 열 수 있습니다.") \
|
X(LABEL_WELCOME_DESCRIPTION, "Select a recent file or open a new or existing document. You can also drag and drop files into the window to open them.", "Selecciona un archivo reciente o abre un documento existente o nuevo. También puedes arrastrar y soltar archivos a la ventana para abrirlos.", "Выберите недавний файл или откройте новый или существующий документ. Вы также можете перетащить файлы в это окно, чтобы их открыть.", "选择最近的文件, 或打开新的/已有的文档. 你也可以将文件拖拽到窗口中以打开它们.", "최근 파일을 선택하거나 새 파일 또는 기존 파일을 엽니다. 파일을 여기로 드래그하여 열 수 있습니다.") \
|
||||||
X(LABEL_WELCOME_RESTORE_POPUP, "Restore", "Restaurar", "Восстановиь", "恢复", "복원") \
|
X(LABEL_WELCOME_RESTORE_POPUP, "Restore", "Restaurar", "Восстановиь", "恢复", "복원") \
|
||||||
@@ -486,6 +516,7 @@ namespace anm2ed
|
|||||||
X(TOAST_DESERIALIZE_LAYERS_FAILED, "Failed to deserialize layer(s):", "Falla al deserializar capas(s):", "Не удалось десериализировать слои: {0}", "反序列化动画层失败: {0}", "레이어 역직렬화 실패: {0}") \
|
X(TOAST_DESERIALIZE_LAYERS_FAILED, "Failed to deserialize layer(s):", "Falla al deserializar capas(s):", "Не удалось десериализировать слои: {0}", "反序列化动画层失败: {0}", "레이어 역직렬화 실패: {0}") \
|
||||||
X(TOAST_DESERIALIZE_REGIONS_FAILED, "Failed to deserialize region(s): {0}", "Falla al deserializar región(es): {0}", "Не удалось десериализировать регионы: {0}", "反序列化区域失败: {0}", "영역 역직렬화 실패: {0}") \
|
X(TOAST_DESERIALIZE_REGIONS_FAILED, "Failed to deserialize region(s): {0}", "Falla al deserializar región(es): {0}", "Не удалось десериализировать регионы: {0}", "反序列化区域失败: {0}", "영역 역직렬화 실패: {0}") \
|
||||||
X(TOAST_DESERIALIZE_NULLS_FAILED, "Failed to deserialize null(s): {0}", "Falla al deserializar null(s): {0}", "Не удалось десериализировать нули: {0}", "反序列化Null失败: {0}", "Null 역직렬화 실패: {0}") \
|
X(TOAST_DESERIALIZE_NULLS_FAILED, "Failed to deserialize null(s): {0}", "Falla al deserializar null(s): {0}", "Не удалось десериализировать нули: {0}", "反序列化Null失败: {0}", "Null 역직렬화 실패: {0}") \
|
||||||
|
X(TOAST_DESERIALIZE_OVERLAYS_FAILED, "Failed to deserialize overlay(s): {0}", "Failed to deserialize overlay(s): {0}", "Failed to deserialize overlay(s): {0}", "Failed to deserialize overlay(s): {0}", "Failed to deserialize overlay(s): {0}") \
|
||||||
X(TOAST_DESERIALIZE_SPRITESHEETS_FAILED, "Failed to deserialize spritesheet(s): {0}", "Falla al deserializar spritesheet(s): {0}", "Не удалось десериализировать спрайт-листы: {0}", "反序列化图集失败: {0}", "스프라이트 시트 역직렬화 실패: {0}") \
|
X(TOAST_DESERIALIZE_SPRITESHEETS_FAILED, "Failed to deserialize spritesheet(s): {0}", "Falla al deserializar spritesheet(s): {0}", "Не удалось десериализировать спрайт-листы: {0}", "反序列化图集失败: {0}", "스프라이트 시트 역직렬화 실패: {0}") \
|
||||||
X(TOAST_EXPORT_RENDERED_ANIMATION, "Exported rendered animation to: {0}", "Se ha exportado la animacion renderizada a: {0}", "Рендерированные анимации экспортированы в: {0}", "渲染动画导出至: {0}", "{0}에 렌더링 된 애니메이션을 내보내기 했습니다.") \
|
X(TOAST_EXPORT_RENDERED_ANIMATION, "Exported rendered animation to: {0}", "Se ha exportado la animacion renderizada a: {0}", "Рендерированные анимации экспортированы в: {0}", "渲染动画导出至: {0}", "{0}에 렌더링 된 애니메이션을 내보내기 했습니다.") \
|
||||||
X(TOAST_EXPORT_RENDERED_ANIMATION_FAILED, "Could not output rendered animation: {0}", "No se pudo emitir la animacion renderizada: {0}", "Не удалось вывести рендерированную анимацию: {0}", "无法输出渲染动画: {0}", "{0}에 렌더링 된 애니메이션을 내보내기 할 수 없습니다.") \
|
X(TOAST_EXPORT_RENDERED_ANIMATION_FAILED, "Could not output rendered animation: {0}", "No se pudo emitir la animacion renderizada: {0}", "Не удалось вывести рендерированную анимацию: {0}", "无法输出渲染动画: {0}", "{0}에 렌더링 된 애니메이션을 내보내기 할 수 없습니다.") \
|
||||||
@@ -493,6 +524,8 @@ namespace anm2ed
|
|||||||
X(TOAST_EXPORT_RENDERED_FRAMES_FAILED, "Could not export frames to: {0}", "No se pdo exportar Frames a: {0}", "Не удалось экспортировать кадры в: {0}", "无法导出帧至: {0}", "프레임을 내보내기 할 수 없습니다. {0}") \
|
X(TOAST_EXPORT_RENDERED_FRAMES_FAILED, "Could not export frames to: {0}", "No se pdo exportar Frames a: {0}", "Не удалось экспортировать кадры в: {0}", "无法导出帧至: {0}", "프레임을 내보내기 할 수 없습니다. {0}") \
|
||||||
X(TOAST_EXPORT_SPRITESHEET, "Exported spritesheet to: {0}", "Se ha exportado spritesheet a: {0}", "Спрайт-лист экспортирован в: {0}", "导出图集至: {0}", "{0}에 스프라이트 시트를 내보내기 했습니다.") \
|
X(TOAST_EXPORT_SPRITESHEET, "Exported spritesheet to: {0}", "Se ha exportado spritesheet a: {0}", "Спрайт-лист экспортирован в: {0}", "导出图集至: {0}", "{0}에 스프라이트 시트를 내보내기 했습니다.") \
|
||||||
X(TOAST_EXPORT_SPRITESHEET_FAILED, "Could not export spritesheet to: {0}", "No se pudo exportar spritesheet a: {0}", "Не удалось экспортировать спрайт-лист в: {0}", "无法导出图集至: {0}", "{0}에 스프라이트 시트를 내보내기 할 수 없습니다.") \
|
X(TOAST_EXPORT_SPRITESHEET_FAILED, "Could not export spritesheet to: {0}", "No se pudo exportar spritesheet a: {0}", "Не удалось экспортировать спрайт-лист в: {0}", "无法导出图集至: {0}", "{0}에 스프라이트 시트를 내보내기 할 수 없습니다.") \
|
||||||
|
X(TOAST_OVERLAY_INIT_FAILED, "Failed to initialize overlay: {0}", "Failed to initialize overlay: {0}", "Failed to initialize overlay: {0}", "Failed to initialize overlay: {0}", "Failed to initialize overlay: {0}") \
|
||||||
|
X(TOAST_OVERLAY_INITIALIZED, "Initialized overlay #{0}: {1}", "Initialized overlay #{0}: {1}", "Initialized overlay #{0}: {1}", "Initialized overlay #{0}: {1}", "Initialized overlay #{0}: {1}") \
|
||||||
X(TOAST_ADD_SPRITESHEET_FAILED, "Failed to add spritesheet! Open a document first.", "¡Error a añadir spritesheet! Abre un documento primero.", "Не удалось добавить спрайт-лист! Сначала откройте документ.", "无法添加图集!请先打开文档。", "스프라이트 시트를 추가할 수 없습니다! 먼저 문서를 여세요.") \
|
X(TOAST_ADD_SPRITESHEET_FAILED, "Failed to add spritesheet! Open a document first.", "¡Error a añadir spritesheet! Abre un documento primero.", "Не удалось добавить спрайт-лист! Сначала откройте документ.", "无法添加图集!请先打开文档。", "스프라이트 시트를 추가할 수 없습니다! 먼저 문서를 여세요.") \
|
||||||
X(TOAST_ADD_SOUND_FAILED, "Failed to add sound! Open a document first.", "¡Error al añadir sonido! Abre un documento primero.", "Не удалось добавить звук! Сначала откройте документ.", "无法添加声音!请先打开文档。", "사운드를 추가할 수 없습니다! 먼저 문서를 여세요.") \
|
X(TOAST_ADD_SOUND_FAILED, "Failed to add sound! Open a document first.", "¡Error al añadir sonido! Abre un documento primero.", "Не удалось добавить звук! Сначала откройте документ.", "无法添加声音!请先打开文档。", "사운드를 추가할 수 없습니다! 먼저 문서를 여세요.") \
|
||||||
X(TOAST_INVALID_FFMPEG, "Unable to run FFmpeg. Make sure the executable exists, has the proper permissions, and is a valid FFmpeg executable.", "No se pudo ejecutar FFmpeg. Asegúrate de que el ejecutable exista, tenga los permisos adecuados y sea un FFmpeg válido.", "Не удалось запустить FFmpeg. Убедитесь, что исполняемый файл существует, имеет нужные права и является корректным исполняемым FFmpeg.", "无法运行 FFmpeg。请确保可执行文件存在,具有正确的权限,并且是有效的 FFmpeg 可执行文件。", "FFmpeg을 실행할 수 없습니다. 실행 파일이 존재하고 올바른 권한을 가지며 유효한 FFmpeg 실행 파일인지 확인하세요.") \
|
X(TOAST_INVALID_FFMPEG, "Unable to run FFmpeg. Make sure the executable exists, has the proper permissions, and is a valid FFmpeg executable.", "No se pudo ejecutar FFmpeg. Asegúrate de que el ejecutable exista, tenga los permisos adecuados y sea un FFmpeg válido.", "Не удалось запустить FFmpeg. Убедитесь, что исполняемый файл существует, имеет нужные права и является корректным исполняемым FFmpeg.", "无法运行 FFmpeg。请确保可执行文件存在,具有正确的权限,并且是有效的 FFmpeg 可执行文件。", "FFmpeg을 실행할 수 없습니다. 실행 파일이 존재하고 올바른 권한을 가지며 유효한 FFmpeg 실행 파일인지 확인하세요.") \
|
||||||
@@ -504,6 +537,7 @@ namespace anm2ed
|
|||||||
X(TOAST_REDO, "Redo: {0}", "Rehacer: {0}", "Повтор: {0}", "重做: {0}", "다시 실행: {0}") \
|
X(TOAST_REDO, "Redo: {0}", "Rehacer: {0}", "Повтор: {0}", "重做: {0}", "다시 실행: {0}") \
|
||||||
X(ERROR_FILE_NOT_FOUND, "File not found!", "¡Archivo no encontrado!", "Файл не найден!", "找不到文件!", "파일을 찾을 수 없습니다!") \
|
X(ERROR_FILE_NOT_FOUND, "File not found!", "¡Archivo no encontrado!", "Файл не найден!", "找不到文件!", "파일을 찾을 수 없습니다!") \
|
||||||
X(ERROR_FILE_PERMISSIONS, "File does not have write permissions!", "¡El archivo no tiene permisos de escritura!", "У файла нет прав на запись!", "文件没有写入权限!", "파일에 쓰기 권한이 없습니다!") \
|
X(ERROR_FILE_PERMISSIONS, "File does not have write permissions!", "¡El archivo no tiene permisos de escritura!", "У файла нет прав на запись!", "文件没有写入权限!", "파일에 쓰기 권한이 없습니다!") \
|
||||||
|
X(TOAST_RELOAD_OVERLAY, "Reloaded overlay #{0}: {1}", "Reloaded overlay #{0}: {1}", "Reloaded overlay #{0}: {1}", "Reloaded overlay #{0}: {1}", "Reloaded overlay #{0}: {1}") \
|
||||||
X(TOAST_RELOAD_SPRITESHEET, "Reloaded spritesheet #{0}: {1}", "Se ha recargado spritesheet #{0}: {1}", "Спрайт-лист #{0} перезагружен: {1}", "重新加载了图集 #{0}: {1}", "{0}번 스프라이트 시트 다시 불러옴: {1}") \
|
X(TOAST_RELOAD_SPRITESHEET, "Reloaded spritesheet #{0}: {1}", "Se ha recargado spritesheet #{0}: {1}", "Спрайт-лист #{0} перезагружен: {1}", "重新加载了图集 #{0}: {1}", "{0}번 스프라이트 시트 다시 불러옴: {1}") \
|
||||||
X(TOAST_MERGE_SPRITESHEETS, "Merged selected spritesheets.", "Spritesheets seleccionados combinados.", "Выбранные спрайт-листы объединены.", "已合并所选图集。", "선택된 스프라이트 시트를 병합했습니다.") \
|
X(TOAST_MERGE_SPRITESHEETS, "Merged selected spritesheets.", "Spritesheets seleccionados combinados.", "Выбранные спрайт-листы объединены.", "已合并所选图集。", "선택된 스프라이트 시트를 병합했습니다.") \
|
||||||
X(TOAST_MERGE_SPRITESHEETS_FAILED, "Failed to merge selected spritesheets.", "No se pudieron combinar los spritesheets seleccionados.", "Не удалось объединить выбранные спрайт-листы.", "合并所选图集失败。", "선택된 스프라이트 시트 병합에 실패했습니다.") \
|
X(TOAST_MERGE_SPRITESHEETS_FAILED, "Failed to merge selected spritesheets.", "No se pudieron combinar los spritesheets seleccionados.", "Не удалось объединить выбранные спрайт-листы.", "合并所选图集失败。", "선택된 스프라이트 시트 병합에 실패했습니다.") \
|
||||||
@@ -511,11 +545,15 @@ namespace anm2ed
|
|||||||
X(TOAST_PACK_SPRITESHEET_FAILED, "Failed to pack spritesheet.", "No se pudo empaquetar el spritesheet.", "Не удалось упаковать спрайт-лист.", "图集打包失败。", "스프라이트 시트 패킹에 실패했습니다.") \
|
X(TOAST_PACK_SPRITESHEET_FAILED, "Failed to pack spritesheet.", "No se pudo empaquetar el spritesheet.", "Не удалось упаковать спрайт-лист.", "图集打包失败。", "스프라이트 시트 패킹에 실패했습니다.") \
|
||||||
X(TOAST_RELOAD_SOUND, "Reloaded sound #{0}: {1}", "Se ha recargado sonido #{0}: {1}", "Звук #{0} перезагружен: {1}", "重新加载了声音 #{0}: {1}", "{0}번 사운드 다시 불러옴: {1}") \
|
X(TOAST_RELOAD_SOUND, "Reloaded sound #{0}: {1}", "Se ha recargado sonido #{0}: {1}", "Звук #{0} перезагружен: {1}", "重新加载了声音 #{0}: {1}", "{0}번 사운드 다시 불러옴: {1}") \
|
||||||
X(TOAST_SCAN_AND_SET_REGIONS, "Matched regionless frames to candidate regions.", "Se emparejaron frames sin region con regiones candidatas.", "Кадры без региона сопоставлены с подходящими регионами.", "已将无区域帧匹配到候选区域。", "영역이 없는 프레임을 후보 영역에 매칭했습니다.") \
|
X(TOAST_SCAN_AND_SET_REGIONS, "Matched regionless frames to candidate regions.", "Se emparejaron frames sin region con regiones candidatas.", "Кадры без региона сопоставлены с подходящими регионами.", "已将无区域帧匹配到候选区域。", "영역이 없는 프레임을 후보 영역에 매칭했습니다.") \
|
||||||
|
X(TOAST_REMOVE_OVERLAY, "Removed overlay #{0}: {1}", "Removed overlay #{0}: {1}", "Removed overlay #{0}: {1}", "Removed overlay #{0}: {1}", "Removed overlay #{0}: {1}") \
|
||||||
X(TOAST_REMOVE_SPRITESHEET, "Removed spritesheet #{0}: {1}", "Se ha removido spritesheet #{0}: {1}", "Спрайт-лист #{0} удален: {1}", "去除了图集 #{0}: {1}", "{0}번 스프라이트 시트 제거됨: {1}") \
|
X(TOAST_REMOVE_SPRITESHEET, "Removed spritesheet #{0}: {1}", "Se ha removido spritesheet #{0}: {1}", "Спрайт-лист #{0} удален: {1}", "去除了图集 #{0}: {1}", "{0}번 스프라이트 시트 제거됨: {1}") \
|
||||||
|
X(TOAST_REPLACE_OVERLAY, "Replaced overlay #{0}: {1}", "Replaced overlay #{0}: {1}", "Replaced overlay #{0}: {1}", "Replaced overlay #{0}: {1}", "Replaced overlay #{0}: {1}") \
|
||||||
X(TOAST_REPLACE_SPRITESHEET, "Replaced spritesheet #{0}: {1}", "Se ha reemplazado spritesheet #{0}: {1}", "Спрайт-лист #{0} заменен: {1}", "替换了图集 #{0}: {1}", "{0}번 스프라이트 시트 교체됨: {1}") \
|
X(TOAST_REPLACE_SPRITESHEET, "Replaced spritesheet #{0}: {1}", "Se ha reemplazado spritesheet #{0}: {1}", "Спрайт-лист #{0} заменен: {1}", "替换了图集 #{0}: {1}", "{0}번 스프라이트 시트 교체됨: {1}") \
|
||||||
X(TOAST_REPLACE_SOUND, "Replaced sound #{0}: {1}", "Se ha reemplazado sonido #{0}: {1}", "Звук #{0} заменен: {1}", "已替换声音 #{0}: {1}", "{0}번 사운드 교체됨: {1}") \
|
X(TOAST_REPLACE_SOUND, "Replaced sound #{0}: {1}", "Se ha reemplazado sonido #{0}: {1}", "Звук #{0} заменен: {1}", "已替换声音 #{0}: {1}", "{0}번 사운드 교체됨: {1}") \
|
||||||
X(TOAST_SAVE_DOCUMENT, "Saved document to: {0}", "Documento Guardado en: {0}", "Документ сохранен в: {0}", "保存文件至: {0}", "{0}에 파일을 저장했습니다.") \
|
X(TOAST_SAVE_DOCUMENT, "Saved document to: {0}", "Documento Guardado en: {0}", "Документ сохранен в: {0}", "保存文件至: {0}", "{0}에 파일을 저장했습니다.") \
|
||||||
X(TOAST_SAVE_DOCUMENT_FAILED, "Could not save document to: {0} ({1})", "No se pudo guardar el documento en: {0} ({1})", "Не удалось сохранить документ в: {0} ({1})", "无法保存文件至: {0} ({1})", "{0}에 파일을 저장할 수 없습니다.") \
|
X(TOAST_SAVE_DOCUMENT_FAILED, "Could not save document to: {0} ({1})", "No se pudo guardar el documento en: {0} ({1})", "Не удалось сохранить документ в: {0} ({1})", "无法保存文件至: {0} ({1})", "{0}에 파일을 저장할 수 없습니다.") \
|
||||||
|
X(TOAST_SAVE_OVERLAY, "Saved overlay #{0}: {1}", "Saved overlay #{0}: {1}", "Saved overlay #{0}: {1}", "Saved overlay #{0}: {1}", "Saved overlay #{0}: {1}") \
|
||||||
|
X(TOAST_SAVE_OVERLAY_FAILED, "Unable to save overlay #{0}: {1}", "Unable to save overlay #{0}: {1}", "Unable to save overlay #{0}: {1}", "Unable to save overlay #{0}: {1}", "Unable to save overlay #{0}: {1}") \
|
||||||
X(TOAST_SAVE_SPRITESHEET, "Saved spritesheet #{0}: {1}", "Spritesheet Guardada #{0}: {1}", "Спрайт-лист #{0} сохранен: {1}", "已保存图集 #{0}: {1}", "{1}에 {0}번 스프라이트 시트를 저장했습니다.") \
|
X(TOAST_SAVE_SPRITESHEET, "Saved spritesheet #{0}: {1}", "Spritesheet Guardada #{0}: {1}", "Спрайт-лист #{0} сохранен: {1}", "已保存图集 #{0}: {1}", "{1}에 {0}번 스프라이트 시트를 저장했습니다.") \
|
||||||
X(TOAST_SAVE_SPRITESHEET_FAILED, "Unable to save spritesheet #{0}: {1}", "No se pudo guardar spritesheet #{0}: {1}", "Не удалось сохранить спрайт-лист #{0}: {1}", "无法保存图集 #{0}: {1}", "{0}번 스프라이트 시트를 저장할 수 없습니다. {1}") \
|
X(TOAST_SAVE_SPRITESHEET_FAILED, "Unable to save spritesheet #{0}: {1}", "No se pudo guardar spritesheet #{0}: {1}", "Не удалось сохранить спрайт-лист #{0}: {1}", "无法保存图集 #{0}: {1}", "{0}번 스프라이트 시트를 저장할 수 없습니다. {1}") \
|
||||||
X(TOAST_SOUNDS_DESERIALIZE_ERROR, "Failed to deserialize sound(s): {0}", "Error al deserializar sonido(s): {0}", "Не удалось десериализировать звуки: {0}", "反序列化声音失败: {0}", "사운드 역직렬화 실패: {0}") \
|
X(TOAST_SOUNDS_DESERIALIZE_ERROR, "Failed to deserialize sound(s): {0}", "Error al deserializar sonido(s): {0}", "Не удалось десериализировать звуки: {0}", "反序列化声音失败: {0}", "사운드 역직렬화 실패: {0}") \
|
||||||
@@ -535,6 +573,7 @@ namespace anm2ed
|
|||||||
X(TOOLTIP_ADD_LAYER, "Add a layer.", "Añadir una capa.", "Добавить слой.", "添加一个动画层.", "레이어를 추가합니다.") \
|
X(TOOLTIP_ADD_LAYER, "Add a layer.", "Añadir una capa.", "Добавить слой.", "添加一个动画层.", "레이어를 추가합니다.") \
|
||||||
X(TOOLTIP_ADD_NULL, "Add a null.", "Añadir Null.", "Добавить нуль.", "添加一个Null.", "Null을 추가합니다.") \
|
X(TOOLTIP_ADD_NULL, "Add a null.", "Añadir Null.", "Добавить нуль.", "添加一个Null.", "Null을 추가합니다.") \
|
||||||
X(TOOLTIP_ADD_SPRITESHEET, "Add a new spritesheet.", "Añadir nueva spritesheet.", "Добавить новый спрайт-лист.", "添加一个新图集.", "새 스프라이트 시트를 추가합니다.") \
|
X(TOOLTIP_ADD_SPRITESHEET, "Add a new spritesheet.", "Añadir nueva spritesheet.", "Добавить новый спрайт-лист.", "添加一个新图集.", "새 스프라이트 시트를 추가합니다.") \
|
||||||
|
X(TOOLTIP_ADD_OVERLAY, "Add a new overlay to the selected spritesheet.", "Add a new overlay to the selected spritesheet.", "Add a new overlay to the selected spritesheet.", "Add a new overlay to the selected spritesheet.", "Add a new overlay to the selected spritesheet.") \
|
||||||
X(TOOLTIP_ADD_VALUES, "Add the specified values onto each frame.\n(Boolean/mapped values will simply be set.)", "Añadir los valores especifiados a cada Frame.\n(Los valores booleanos/mapeados simplemente se estableceran.)", "Добавить указанные значения к каждому кадру.\n(Булевы/сопоставленные значения будут просто установлены.)", "将指定的数值添加到每一帧上. (布尔/映射值将直接被设置.)", "각 프레임의 속성에 지정한 값을 더합니다.\n(불리언/매핑 값은 그대로 설정됩니다.)") \
|
X(TOOLTIP_ADD_VALUES, "Add the specified values onto each frame.\n(Boolean/mapped values will simply be set.)", "Añadir los valores especifiados a cada Frame.\n(Los valores booleanos/mapeados simplemente se estableceran.)", "Добавить указанные значения к каждому кадру.\n(Булевы/сопоставленные значения будут просто установлены.)", "将指定的数值添加到每一帧上. (布尔/映射值将直接被设置.)", "각 프레임의 속성에 지정한 값을 더합니다.\n(불리언/매핑 값은 그대로 설정됩니다.)") \
|
||||||
X(TOOLTIP_ADJUST, "Set the value of each specified value onto the frame's equivalent.", "Ajustar el valor de cada valor especificado a el equivalente del Frame.", "Установить значение каждого указанного значения к эквиваленту кадра.", "将每个指定的数值设置到对应帧的相等的属性上.", "지정된 각 값을 프레임의 대응 값으로 설정합니다.") \
|
X(TOOLTIP_ADJUST, "Set the value of each specified value onto the frame's equivalent.", "Ajustar el valor de cada valor especificado a el equivalente del Frame.", "Установить значение каждого указанного значения к эквиваленту кадра.", "将每个指定的数值设置到对应帧的相等的属性上.", "지정된 각 값을 프레임의 대응 값으로 설정합니다.") \
|
||||||
X(TOOLTIP_ALL_ITEMS_VISIBLE, "All items are visible. Press to only show layers.", "Todos los items son visibles. Presiona solo para mostrar capas.", "Все предметы видимы. Нажмите, чтобы только показать слои.", "所有物品均可见. 点击即可仅显示动画层.", "모든 항목이 표시됩니다. 레이어만 표시하려면 누르세요.") \
|
X(TOOLTIP_ALL_ITEMS_VISIBLE, "All items are visible. Press to only show layers.", "Todos los items son visibles. Presiona solo para mostrar capas.", "Все предметы видимы. Нажмите, чтобы только показать слои.", "所有物品均可见. 点击即可仅显示动画层.", "모든 항목이 표시됩니다. 레이어만 표시하려면 누르세요.") \
|
||||||
@@ -562,14 +601,15 @@ namespace anm2ed
|
|||||||
X(TOOLTIP_CHANGE_ALL_NULLS, "The frame property changes will apply to null frames.", "Los cambios de propiedades de frame se aplicaran a los frames null.", "Изменения свойств кадра будут применены к нулевым кадрам.", "帧属性更改将应用于 Null 帧。", "프레임 속성 변경 사항을 Null 프레임에 적용합니다.") \
|
X(TOOLTIP_CHANGE_ALL_NULLS, "The frame property changes will apply to null frames.", "Los cambios de propiedades de frame se aplicaran a los frames null.", "Изменения свойств кадра будут применены к нулевым кадрам.", "帧属性更改将应用于 Null 帧。", "프레임 속성 변경 사항을 Null 프레임에 적용합니다.") \
|
||||||
X(TOOLTIP_CENTER_VIEW, "Centers the view.", "Centra la vista.", "Центрирует вид.", "居中视角.", "미리보기 화면을 가운데에 맞춥니다.") \
|
X(TOOLTIP_CENTER_VIEW, "Centers the view.", "Centra la vista.", "Центрирует вид.", "居中视角.", "미리보기 화면을 가운데에 맞춥니다.") \
|
||||||
X(TOOLTIP_CLOSE_SETTINGS, "Close without updating settings.", "Cerrar sin actualizar las configuraciones.", "Закрыть без обновления настройки.", "关闭但不保存设置.", "설정을 갱신하지 않고 닫습니다.") \
|
X(TOOLTIP_CLOSE_SETTINGS, "Close without updating settings.", "Cerrar sin actualizar las configuraciones.", "Закрыть без обновления настройки.", "关闭但不保存设置.", "설정을 갱신하지 않고 닫습니다.") \
|
||||||
X(TOOLTIP_SERIALIZE_GROUPS, "Serialize animation groups.\nThe Binding of Isaac: Rebirth does not support groups.", "Serializa grupos de animación.\nThe Binding of Isaac: Rebirth no admite grupos.", "Сериализует группы анимации.\nThe Binding of Isaac: Rebirth не поддерживает группы.", "序列化动画组。\nThe Binding of Isaac: Rebirth 不支持组。", "애니메이션 그룹을 직렬화합니다.\nThe Binding of Isaac: Rebirth는 그룹을 지원하지 않습니다.") \
|
X(TOOLTIP_KEEP_REDUNDANT_FRAME_REGION_VALUES, "Keep crop, size, and pivot values on frames with regions.\nIf disabled, The Binding of Isaac: Rebirth may have parsing or playback issues.", "Mantiene los valores de recorte, tamaño y pivote en frames con regiones.\nSi se desactiva, The Binding of Isaac: Rebirth puede tener problemas de análisis o reproducción.", "Сохраняет значения обрезки, размера и точки вращения в кадрах с регионами.\nЕсли отключить, в The Binding of Isaac: Rebirth возможны проблемы разбора или воспроизведения.", "保留带区域帧的裁剪、大小和枢轴值。\n如果禁用,The Binding of Isaac: Rebirth 可能出现解析或播放问题。", "영역이 있는 프레임의 자르기, 크기, 중심점 값을 유지합니다.\n끄면 The Binding of Isaac: Rebirth에서 파싱 또는 재생 문제가 생길 수 있습니다.") \
|
||||||
X(TOOLTIP_SERIALIZE_REGIONS, "Serialize spritesheet regions.\nThe Binding of Isaac: Rebirth does not support regions.", "Serializa regiones de spritesheet.\nThe Binding of Isaac: Rebirth no admite regiones.", "Сериализует регионы спрайт-листа.\nThe Binding of Isaac: Rebirth не поддерживает регионы.", "序列化图集区域。\nThe Binding of Isaac: Rebirth 不支持区域。", "스프라이트 시트 영역을 직렬화합니다.\nThe Binding of Isaac: Rebirth는 영역을 지원하지 않습니다.") \
|
X(TOOLTIP_BAKE_SPECIAL_INTERPOLATED_FRAMES_ON_SAVE, "Bake frames with special interpolation modes only in the saved file.\nIf disabled, The Binding of Isaac: Rebirth may have parsing or playback issues.", "Hornea frames con modos de interpolación especial solo en el archivo guardado.\nSi se desactiva, The Binding of Isaac: Rebirth puede tener problemas de análisis o reproducción.", "Запекает кадры со специальными режимами интерполяции только в сохраняемом файле.\nЕсли отключить, в The Binding of Isaac: Rebirth возможны проблемы разбора или воспроизведения.", "仅在保存的文件中烘焙带特殊插值模式的帧。\n如果禁用,The Binding of Isaac: Rebirth 可能出现解析或播放问题。", "저장되는 파일에서만 특수 보간 모드 프레임을 베이크합니다.\n끄면 The Binding of Isaac: Rebirth에서 파싱 또는 재생 문제가 생길 수 있습니다.") \
|
||||||
X(TOOLTIP_SERIALIZE_SOUNDS, "Serialize sounds.\nThe Binding of Isaac: Rebirth does not support sounds in Anm2 files.", "Serializa sonidos.\nThe Binding of Isaac: Rebirth no admite sonidos en archivos Anm2.", "Сериализует звуки.\nThe Binding of Isaac: Rebirth не поддерживает звуки в Anm2-файлах.", "序列化声音。\nThe Binding of Isaac: Rebirth 不支持 Anm2 文件中的声音。", "사운드를 직렬화합니다.\nThe Binding of Isaac: Rebirth는 Anm2 파일의 사운드를 지원하지 않습니다.") \
|
X(TOOLTIP_BAKE_GROUP_FRAMES_ON_SAVE, "Bake child layer/null frames when their group root has non-default transform or color values.\nIf disabled, The Binding of Isaac: Rebirth may have parsing or playback issues.", "Hornea frames de capas/null hijos cuando la raíz del grupo tenga transformaciones o valores de color no predeterminados.\nSi se desactiva, The Binding of Isaac: Rebirth puede tener problemas de análisis o reproducción.", "Запекает дочерние кадры слоев/null, когда корень группы имеет нестандартные преобразования или цветовые значения.\nЕсли отключить, в The Binding of Isaac: Rebirth возможны проблемы разбора или воспроизведения.", "当组根具有非默认变换或颜色值时,烘焙子图层/null 帧。\n如果禁用,The Binding of Isaac: Rebirth 可能出现解析或播放问题。", "그룹 루트에 기본값이 아닌 변형 또는 색상 값이 있을 때 하위 레이어/null 프레임을 베이크합니다.\n끄면 The Binding of Isaac: Rebirth에서 파싱 또는 재생 문제가 생길 수 있습니다.") \
|
||||||
X(TOOLTIP_KEEP_REDUNDANT_FRAME_REGION_VALUES, "Keep crop, size, and pivot values on frames with regions.\nThis saves information; The Binding of Isaac: Rebirth still needs these values.", "Mantiene los valores de recorte, tamaño y pivote en frames con regiones.\nEsto guarda información; The Binding of Isaac: Rebirth todavía necesita estos valores.", "Сохраняет значения обрезки, размера и точки вращения в кадрах с регионами.\nЭто сохраняет информацию; The Binding of Isaac: Rebirth всё равно нужны эти значения.", "保留带区域帧的裁剪、大小和枢轴值。\n这会保存信息;The Binding of Isaac: Rebirth 仍然需要这些值。", "영역이 있는 프레임의 자르기, 크기, 중심점 값을 유지합니다.\n이 정보는 저장됩니다; The Binding of Isaac: Rebirth에도 이 값들이 필요합니다.") \
|
|
||||||
X(TOOLTIP_BAKE_SPECIAL_INTERPOLATED_FRAMES_ON_SAVE, "Bake frames with special interpolation modes only in the saved file.\nAnm2Ed restores them when loading, and the file works in The Binding of Isaac: Rebirth as-is.", "Hornea frames con modos de interpolación especial solo en el archivo guardado.\nAnm2Ed los restaura al cargar, y el archivo funciona en The Binding of Isaac: Rebirth tal cual.", "Запекает кадры со специальными режимами интерполяции только в сохраняемом файле.\nAnm2Ed восстанавливает их при загрузке, а файл сразу работает в The Binding of Isaac: Rebirth.", "仅在保存的文件中烘焙带特殊插值模式的帧。\nAnm2Ed 加载时会还原它们,文件可直接用于 The Binding of Isaac: Rebirth。", "저장되는 파일에서만 특수 보간 모드 프레임을 베이크합니다.\nAnm2Ed는 로드할 때 이를 복원하며, 파일은 The Binding of Isaac: Rebirth에서 그대로 작동합니다.") \
|
|
||||||
X(TOOLTIP_COLOR_OFFSET, "Change the color added onto the frame.", "Cambia el color añadido al Frame.", "Изменить цвет, который добавлен на кадр.", "更改覆盖在帧上的颜色.", "프레임에 더해지는 색을 변경합니다.") \
|
X(TOOLTIP_COLOR_OFFSET, "Change the color added onto the frame.", "Cambia el color añadido al Frame.", "Изменить цвет, который добавлен на кадр.", "更改覆盖在帧上的颜色.", "프레임에 더해지는 색을 변경합니다.") \
|
||||||
X(TOOLTIP_REGION, "Set the spritesheet region the frame will use.", "Establece la región del spritesheet que usará el frame.", "Установить регион спрайт-листа, который будет использовать кадр.", "设置帧将使用的图集区域.", "프레임이 사용할 스프라이트 시트 영역을 설정합니다.") \
|
X(TOOLTIP_REGION, "Set the spritesheet region the frame will use.", "Establece la región del spritesheet que usará el frame.", "Установить регион спрайт-листа, который будет использовать кадр.", "设置帧将使用的图集区域.", "프레임이 사용할 스프라이트 시트 영역을 설정합니다.") \
|
||||||
X(TOOLTIP_REGION_PROPERTIES_ORIGIN, "Use a preset origin for the region.", "Usa un origen predefinido para la región.", "Использовать предустановленную точку отсчета для региона.", "为区域使用预设原点。", "영역에 사전 설정된 원점을 사용합니다.") \
|
X(TOOLTIP_REGION_PROPERTIES_ORIGIN, "Use a preset origin for the region.", "Usa un origen predefinido para la región.", "Использовать предустановленную точку отсчета для региона.", "为区域使用预设原点。", "영역에 사전 설정된 원점을 사용합니다.") \
|
||||||
|
X(TOOLTIP_MERGE_PRESET_APPEND_AS_NEW, "Add incoming content as new entries. Matching names are renamed before import.", "Add incoming content as new entries. Matching names are renamed before import.", "Add incoming content as new entries. Matching names are renamed before import.", "Add incoming content as new entries. Matching names are renamed before import.", "Add incoming content as new entries. Matching names are renamed before import.") \
|
||||||
|
X(TOOLTIP_MERGE_PRESET_MERGE_BY_NAME, "Keep existing content and update matching names with incoming definitions and tracks.", "Keep existing content and update matching names with incoming definitions and tracks.", "Keep existing content and update matching names with incoming definitions and tracks.", "Keep existing content and update matching names with incoming definitions and tracks.", "Keep existing content and update matching names with incoming definitions and tracks.") \
|
||||||
|
X(TOOLTIP_MERGE_PRESET_REPLACE_MATCHING, "Replace same-named animations and definitions with incoming content, and add anything missing.", "Replace same-named animations and definitions with incoming content, and add anything missing.", "Replace same-named animations and definitions with incoming content, and add anything missing.", "Replace same-named animations and definitions with incoming content, and add anything missing.", "Replace same-named animations and definitions with incoming content, and add anything missing.") \
|
||||||
X(TOOLTIP_COLUMNS, "Set how many columns the spritesheet will have.", "Ajusta cuantas columnas va a tener el spritesheet.", "Установить сколько колонн будет иметь спрайт-лист.", "设置图集有多少列.", "스프라이트 시트의 열 수를 설정합니다.") \
|
X(TOOLTIP_COLUMNS, "Set how many columns the spritesheet will have.", "Ajusta cuantas columnas va a tener el spritesheet.", "Установить сколько колонн будет иметь спрайт-лист.", "设置图集有多少列.", "스프라이트 시트의 열 수를 설정합니다.") \
|
||||||
X(TOOLTIP_CROP, "Change the crop position the frame uses.", "Cambiar la poscicion de recortado que usa el Frame.", "Изменить позицию обрезки, которую использует кадр.", "更改当前帧的裁剪位置.", "프레임에 대응되는 스프라이트 시트를 어느 지점부터 사용할지 변경합니다.") \
|
X(TOOLTIP_CROP, "Change the crop position the frame uses.", "Cambiar la poscicion de recortado que usa el Frame.", "Изменить позицию обрезки, которую использует кадр.", "更改当前帧的裁剪位置.", "프레임에 대응되는 스프라이트 시트를 어느 지점부터 사용할지 변경합니다.") \
|
||||||
X(TOOLTIP_CUSTOM_RANGE, "Toggle using a custom range for the animation.", "Alterna usando un rango personalizado para la animacion.", "Переключить использование пользовательского диапазона для анимации.", "切换是否让动画使用自定义区间.", "애니메이션에 사용자 지정 길이를 사용할지 정합니다.") \
|
X(TOOLTIP_CUSTOM_RANGE, "Toggle using a custom range for the animation.", "Alterna usando un rango personalizado para la animacion.", "Переключить использование пользовательского диапазона для анимации.", "切换是否让动画使用自定义区间.", "애니메이션에 사용자 지정 길이를 사용할지 정합니다.") \
|
||||||
@@ -642,7 +682,9 @@ namespace anm2ed
|
|||||||
X(TOOLTIP_POSITION, "Change the position of the frame.", "Cambia la posicion del Frame.", "Изменить позицию кадра.", "更改此帧的位置.", "프레임의 위치를 변경합니다.") \
|
X(TOOLTIP_POSITION, "Change the position of the frame.", "Cambia la posicion del Frame.", "Изменить позицию кадра.", "更改此帧的位置.", "프레임의 위치를 변경합니다.") \
|
||||||
X(TOOLTIP_PREVIEW_ZOOM, "Change the zoom of the preview.", "Cambia el zoom de la vista previa.", "Изменить масштаб предпросмотра.", "更改预览视图的缩放.", "미리보기의 줌을 변경합니다.") \
|
X(TOOLTIP_PREVIEW_ZOOM, "Change the zoom of the preview.", "Cambia el zoom de la vista previa.", "Изменить масштаб предпросмотра.", "更改预览视图的缩放.", "미리보기의 줌을 변경합니다.") \
|
||||||
X(TOOLTIP_PREVIEW_TRANSPARENT, "Toggle the animation preview background being transparent.", "Alterna la transparencia del fondo de la vista previa de animacion.", "Переключить прозрачность фона предпросмотра анимации.", "切换动画预览背景是否透明.", "애니메이션 미리보기 배경을 투명하게 전환합니다.") \
|
X(TOOLTIP_PREVIEW_TRANSPARENT, "Toggle the animation preview background being transparent.", "Alterna la transparencia del fondo de la vista previa de animacion.", "Переключить прозрачность фона предпросмотра анимации.", "切换动画预览背景是否透明.", "애니메이션 미리보기 배경을 투명하게 전환합니다.") \
|
||||||
X(TOOLTIP_RAW, "Record only the raw animation; i.e., only its layers, to its bounds.", "Graba solo la animacion cruda; i. e., Solo sus capas.", "Записывать только «сырую» анимацию, т. е. только ее слои.", "仅保存原生动画; 比如只保存动画层.", "Raw 애니메이션만 녹화합니다. 즉, 레이어만 녹화합니다.") \
|
X(TOOLTIP_USE_ANIMATION_BOUNDS, "Render using the animation's bounds instead of the preview viewport.", "Render using the animation's bounds instead of the preview viewport.", "Render using the animation's bounds instead of the preview viewport.", "Render using the animation's bounds instead of the preview viewport.", "Render using the animation's bounds instead of the preview viewport.") \
|
||||||
|
X(TOOLTIP_USE_ISOLATED_ANIMATION, "Render only animation layers with a transparent background and preview helpers hidden.", "Render only animation layers with a transparent background and preview helpers hidden.", "Render only animation layers with a transparent background and preview helpers hidden.", "Render only animation layers with a transparent background and preview helpers hidden.", "Render only animation layers with a transparent background and preview helpers hidden.") \
|
||||||
|
X(TOOLTIP_RELOAD_OVERLAYS, "Reloads the selected overlays.", "Reloads the selected overlays.", "Reloads the selected overlays.", "Reloads the selected overlays.", "Reloads the selected overlays.") \
|
||||||
X(TOOLTIP_RELOAD_SPRITESHEETS, "Reloads the selected spritesheets.", "Recarga la spritesheet seleccionada.", "Перезагружает выбранные спрайт-листы.", "重新加载所选图集.", "선택한 스프라이트 시트를 다시 불러옵니다.") \
|
X(TOOLTIP_RELOAD_SPRITESHEETS, "Reloads the selected spritesheets.", "Recarga la spritesheet seleccionada.", "Перезагружает выбранные спрайт-листы.", "重新加载所选图集.", "선택한 스프라이트 시트를 다시 불러옵니다.") \
|
||||||
X(TOOLTIP_RELOAD_SOUNDS, "Reloads the selected sounds.", "Recarga los sonidos seleccionados.", "Перезагружает выбранные звуки.", "重新加载所选声音.", "선택한 사운드를 다시 불러옵니다.") \
|
X(TOOLTIP_RELOAD_SOUNDS, "Reloads the selected sounds.", "Recarga los sonidos seleccionados.", "Перезагружает выбранные звуки.", "重新加载所选声音.", "선택한 사운드를 다시 불러옵니다.") \
|
||||||
X(TOOLTIP_REMOVE_ANIMATION, "Remove the selected animation(s).", "Remueve la(s) animacion(es) seleccionada(s).", "Удалить выбранные анимации.", "去除所选动画.", "선택한 애니메이션을 제거합니다.") \
|
X(TOOLTIP_REMOVE_ANIMATION, "Remove the selected animation(s).", "Remueve la(s) animacion(es) seleccionada(s).", "Удалить выбранные анимации.", "去除所选动画.", "선택한 애니메이션을 제거합니다.") \
|
||||||
@@ -654,10 +696,12 @@ namespace anm2ed
|
|||||||
X(TOOLTIP_REMOVE_UNUSED_NULLS, "Remove unused nulls (i.e., ones not used in any animation.)", "Remueve nulls no utilizados (i. e., aquellos no usados en ninguna animacion.)", "Удалить неиспользуемые нули (т. е. нули, которые не используются ни одной анимацией.)", "去除未使用的Null (未被任何动画使用的那些.)", "사용되지 않는 Null(어떤 애니메이션에서도 사용되지 않는 것)을 제거합니다.") \
|
X(TOOLTIP_REMOVE_UNUSED_NULLS, "Remove unused nulls (i.e., ones not used in any animation.)", "Remueve nulls no utilizados (i. e., aquellos no usados en ninguna animacion.)", "Удалить неиспользуемые нули (т. е. нули, которые не используются ни одной анимацией.)", "去除未使用的Null (未被任何动画使用的那些.)", "사용되지 않는 Null(어떤 애니메이션에서도 사용되지 않는 것)을 제거합니다.") \
|
||||||
X(TOOLTIP_REMOVE_UNUSED_SOUNDS, "Remove unused sounds (i.e., ones not used in any trigger.)", "Remueve sonidos no utilizados (i. e., aquellos no usados en ningun trigger.)", "Удалить неиспользуемые звуки (т. е. звуки, которые не используются ни одным триггером.)", "去除未使用的声音 (未被任何触发器使用的那些.)", "사용되지 않는 사운드(어떤 트리거에서도 사용되지 않는 것)를 제거합니다.") \
|
X(TOOLTIP_REMOVE_UNUSED_SOUNDS, "Remove unused sounds (i.e., ones not used in any trigger.)", "Remueve sonidos no utilizados (i. e., aquellos no usados en ningun trigger.)", "Удалить неиспользуемые звуки (т. е. звуки, которые не используются ни одным триггером.)", "去除未使用的声音 (未被任何触发器使用的那些.)", "사용되지 않는 사운드(어떤 트리거에서도 사용되지 않는 것)를 제거합니다.") \
|
||||||
X(TOOLTIP_REMOVE_UNUSED_SPRITESHEETS, "Remove all unused spritesheets (i.e., not used in any layer.).", "Remueve todos los spritesheets no utilizados (i. e., aquellos no usados en ninguna capa.)", "Удалить неиспользуемые спрайт-листы (т. е. те, которые не используются ни одним слоем.)", "去除未使用的图集 (未被任何动画层使用的那些.)", "사용되지 않는 모든 스프라이트 시트(어떤 레이어에서도 사용되지 않는 것)를 제거합니다.") \
|
X(TOOLTIP_REMOVE_UNUSED_SPRITESHEETS, "Remove all unused spritesheets (i.e., not used in any layer.).", "Remueve todos los spritesheets no utilizados (i. e., aquellos no usados en ninguna capa.)", "Удалить неиспользуемые спрайт-листы (т. е. те, которые не используются ни одним слоем.)", "去除未使用的图集 (未被任何动画层使用的那些.)", "사용되지 않는 모든 스프라이트 시트(어떤 레이어에서도 사용되지 않는 것)를 제거합니다.") \
|
||||||
|
X(TOOLTIP_REMOVE_OVERLAYS, "Remove the selected overlays.", "Remove the selected overlays.", "Remove the selected overlays.", "Remove the selected overlays.", "Remove the selected overlays.") \
|
||||||
X(TOOLTIP_RENDER_BUTTON, "Render the animation using the current settings.", "Renderiza la animacion usando la configuracion actual", "Рендерировать анимацию, используя текущие настройки.", "应用当前设置去渲染动画.", "현재 설정으로 애니메이션을 렌더링합니다.") \
|
X(TOOLTIP_RENDER_BUTTON, "Render the animation using the current settings.", "Renderiza la animacion usando la configuracion actual", "Рендерировать анимацию, используя текущие настройки.", "应用当前设置去渲染动画.", "현재 설정으로 애니메이션을 렌더링합니다.") \
|
||||||
X(TOOLTIP_RENDER_TYPE, "Set the type of the output.", "Ajusta el tipo de la salida", "Установить тип вывода.", "设置输出的类型.", "출력 유형을 설정합니다.") \
|
X(TOOLTIP_RENDER_TYPE, "Set the type of the output.", "Ajusta el tipo de la salida", "Установить тип вывода.", "设置输出的类型.", "출력 유형을 설정합니다.") \
|
||||||
X(TOOLTIP_REPEAT_DELAY, "Set how often, after repeating begins, key inputs will be fired.", "Ajusta que tanto, despues de que empieza la repeticion, seran disparadas las entradas clave.", "Установить, как часто после начала повторения будут срабатывать нажатия клавиш.", "更改键盘按键开启重复时, 重复的速率.", "반복 입력이 시작된 후 입력이 얼마나 자주 들어갈지 설정합니다.") \
|
X(TOOLTIP_REPEAT_DELAY, "Set how often, after repeating begins, key inputs will be fired.", "Ajusta que tanto, despues de que empieza la repeticion, seran disparadas las entradas clave.", "Установить, как часто после начала повторения будут срабатывать нажатия клавиш.", "更改键盘按键开启重复时, 重复的速率.", "반복 입력이 시작된 후 입력이 얼마나 자주 들어갈지 설정합니다.") \
|
||||||
X(TOOLTIP_REPLACE_SPRITESHEET, "Replace the selected spritesheet with a new one.", "Reemplaza la spritesheet seleccionada con una nueva.", "Заменить выбранный спрайт-лист на новый.", "替换所选旧图集为新图集.", "선택된 스프라이트 시트를 새 시트로 교체합니다.") \
|
X(TOOLTIP_REPLACE_SPRITESHEET, "Replace the selected spritesheet with a new one.", "Reemplaza la spritesheet seleccionada con una nueva.", "Заменить выбранный спрайт-лист на новый.", "替换所选旧图集为新图集.", "선택된 스프라이트 시트를 새 시트로 교체합니다.") \
|
||||||
|
X(TOOLTIP_REPLACE_OVERLAY, "Replace the selected overlay with a new one.", "Replace the selected overlay with a new one.", "Replace the selected overlay with a new one.", "Replace the selected overlay with a new one.", "Replace the selected overlay with a new one.") \
|
||||||
X(TOOLTIP_REPLACE_SOUND, "Replace the selected sound with a new one.", "Reemplaza el sonido seleccionado con uno nuevo.", "Заменяет выбранный звук новым.", "用新的声音替换所选声音.", "선택한 사운드를 새 사운드로 교체합니다.") \
|
X(TOOLTIP_REPLACE_SOUND, "Replace the selected sound with a new one.", "Reemplaza el sonido seleccionado con uno nuevo.", "Заменяет выбранный звук новым.", "用新的声音替换所选声音.", "선택한 사운드를 새 사운드로 교체합니다.") \
|
||||||
X(TOOLTIP_ROOT_TRANSFORM, "Root frames will transform the rest of the animation.", "Los Frames root transformaran el resto de la animacion.", "Корневые кадры трансформируют остаток анимации.", "与“根”有关的帧会跟随整个动画而变换.", "Root 프레임이 나머지 애니메이션을 변형합니다.") \
|
X(TOOLTIP_ROOT_TRANSFORM, "Root frames will transform the rest of the animation.", "Los Frames root transformaran el resto de la animacion.", "Корневые кадры трансформируют остаток анимации.", "与“根”有关的帧会跟随整个动画而变换.", "Root 프레임이 나머지 애니메이션을 변형합니다.") \
|
||||||
X(TOOLTIP_ROTATION, "Change the rotation of the frame.", "Cambia la rotacion del Frame.", "Изменить поворот кадра.", "更改此帧的旋转.", "프레임의 회전값을 변경합니다.") \
|
X(TOOLTIP_ROTATION, "Change the rotation of the frame.", "Cambia la rotacion del Frame.", "Изменить поворот кадра.", "更改此帧的旋转.", "프레임의 회전값을 변경합니다.") \
|
||||||
@@ -665,6 +709,7 @@ namespace anm2ed
|
|||||||
X(TOOLTIP_ROUND_SCALE, "Scale will be rounded to the nearest whole number.", "La escala sera aproximada al numero entero mas cercano.", "Масштаб будет округлен к самому близкому целому числу.", "缩放数值会被取整.", "비율을 가장 가까운 정수로 반올림합니다.") \
|
X(TOOLTIP_ROUND_SCALE, "Scale will be rounded to the nearest whole number.", "La escala sera aproximada al numero entero mas cercano.", "Масштаб будет округлен к самому близкому целому числу.", "缩放数值会被取整.", "비율을 가장 가까운 정수로 반올림합니다.") \
|
||||||
X(TOOLTIP_ROWS, "Set how many rows the spritesheet will have.", "Ajusta cuantas filas tendra el spritsheet.", "Установить сколько рядов будет иметь спрайт-лист.", "设置图集的行数量.", "스프라이트 시트의 행 수를 설정합니다.") \
|
X(TOOLTIP_ROWS, "Set how many rows the spritesheet will have.", "Ajusta cuantas filas tendra el spritsheet.", "Установить сколько рядов будет иметь спрайт-лист.", "设置图集的行数量.", "스프라이트 시트의 행 수를 설정합니다.") \
|
||||||
X(TOOLTIP_SAVE_SPRITESHEETS, "Save the selected spritesheets.", "Guarda los spritesheets seleccionados.", "Сохранить выбранные спрайт-листы.", "保存所选图集.", "선택한 스프라이트 시트를 저장합니다.") \
|
X(TOOLTIP_SAVE_SPRITESHEETS, "Save the selected spritesheets.", "Guarda los spritesheets seleccionados.", "Сохранить выбранные спрайт-листы.", "保存所选图集.", "선택한 스프라이트 시트를 저장합니다.") \
|
||||||
|
X(TOOLTIP_SAVE_OVERLAYS, "Save the selected overlays.", "Save the selected overlays.", "Save the selected overlays.", "Save the selected overlays.", "Save the selected overlays.") \
|
||||||
X(TOOLTIP_SCALE, "Change the scale of the frame, in percent.", "Cambia la escala del Frame, en porcentaje.", "Изменить масштаб кадра.", "修改此帧的缩放.", "프레임의 비율을 변경합니다.") \
|
X(TOOLTIP_SCALE, "Change the scale of the frame, in percent.", "Cambia la escala del Frame, en porcentaje.", "Изменить масштаб кадра.", "修改此帧的缩放.", "프레임의 비율을 변경합니다.") \
|
||||||
X(TOOLTIP_SCALE_OUTPUT, "Set the output scale of the animation.", "Ajusta la escala de salida de la animacion.", "Установить масштаб анимации при выводе.", "设置输出动画的缩放.", "애니메이션의 출력 비율을 설정합니다.") \
|
X(TOOLTIP_SCALE_OUTPUT, "Set the output scale of the animation.", "Ajusta la escala de salida de la animacion.", "Установить масштаб анимации при выводе.", "设置输出动画的缩放.", "애니메이션의 출력 비율을 설정합니다.") \
|
||||||
X(TOOLTIP_SETTINGS_SAVE, "Use the configured settings.", "Usa las opciones configuradas.", "Использовать настроенные настройки.", "应用更改的设置.", "구성된 설정을 사용합니다.") \
|
X(TOOLTIP_SETTINGS_SAVE, "Use the configured settings.", "Usa las opciones configuradas.", "Использовать настроенные настройки.", "应用更改的设置.", "구성된 설정을 사용합니다.") \
|
||||||
|
|||||||
+88
-57
@@ -14,119 +14,150 @@ namespace anm2ed
|
|||||||
constexpr auto IMGUI_DEFAULT = R"(
|
constexpr auto IMGUI_DEFAULT = R"(
|
||||||
[Window][##DockSpace]
|
[Window][##DockSpace]
|
||||||
Pos=0,54
|
Pos=0,54
|
||||||
Size=1512,876
|
Size=1918,1007
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
|
|
||||||
[Window][##Documents]
|
[Window][##Documents]
|
||||||
Pos=0,22
|
Pos=0,22
|
||||||
Size=1512,32
|
Size=1918,32
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
|
|
||||||
|
[Window][###Onionskin]
|
||||||
|
Pos=8,724
|
||||||
|
Size=1902,329
|
||||||
|
Collapsed=0
|
||||||
|
DockId=0x00000016,1
|
||||||
|
|
||||||
[Window][###Animation Preview]
|
[Window][###Animation Preview]
|
||||||
Pos=60,62
|
Pos=60,62
|
||||||
Size=949,583
|
Size=898,660
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000013,0
|
DockId=0x00000013,0
|
||||||
|
|
||||||
[Window][###Onionskin]
|
|
||||||
Pos=8,647
|
|
||||||
Size=1496,275
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000006,1
|
|
||||||
|
|
||||||
[Window][###Sounds]
|
[Window][###Sounds]
|
||||||
Pos=1364,62
|
Pos=1166,62
|
||||||
Size=140,128
|
Size=744,305
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x0000000F,1
|
DockId=0x0000000F,1
|
||||||
|
|
||||||
[Window][###Animations]
|
[Window][###Animations]
|
||||||
Pos=1364,192
|
Pos=1166,369
|
||||||
Size=64,453
|
Size=179,353
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000011,0
|
DockId=0x00000011,0
|
||||||
|
|
||||||
[Window][###Events]
|
[Window][###Events]
|
||||||
Pos=1011,402
|
Pos=960,413
|
||||||
Size=351,243
|
Size=204,309
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x0000000E,1
|
DockId=0x00000006,1
|
||||||
|
|
||||||
[Window][###Frame Properties]
|
[Window][###Frame Properties]
|
||||||
Pos=1011,62
|
Pos=960,62
|
||||||
Size=351,338
|
Size=204,349
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x0000000D,0
|
DockId=0x00000005,0
|
||||||
|
|
||||||
[Window][###Layers]
|
[Window][###Layers]
|
||||||
Pos=1011,402
|
Pos=960,413
|
||||||
Size=351,243
|
Size=204,309
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x0000000E,0
|
DockId=0x00000006,0
|
||||||
|
|
||||||
[Window][###Nulls]
|
[Window][###Nulls]
|
||||||
Pos=1011,402
|
Pos=960,413
|
||||||
Size=351,243
|
Size=204,309
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x0000000E,2
|
DockId=0x00000006,2
|
||||||
|
|
||||||
[Window][###Spritesheet Editor]
|
[Window][###Spritesheet Editor]
|
||||||
Pos=60,62
|
Pos=60,62
|
||||||
Size=949,583
|
Size=898,660
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000013,1
|
DockId=0x00000013,1
|
||||||
|
|
||||||
[Window][###Spritesheets]
|
[Window][###Spritesheets]
|
||||||
Pos=1364,62
|
Pos=1166,62
|
||||||
Size=140,128
|
Size=744,305
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x0000000F,0
|
DockId=0x0000000F,0
|
||||||
|
|
||||||
[Window][###Tools]
|
[Window][###Tools]
|
||||||
Pos=8,62
|
Pos=8,62
|
||||||
Size=50,583
|
Size=50,660
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000012,0
|
DockId=0x00000004,0
|
||||||
|
|
||||||
[Window][###Welcome]
|
[Window][###Welcome]
|
||||||
Pos=0,54
|
Pos=0,54
|
||||||
Size=1512,876
|
Size=1918,1007
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
|
|
||||||
[Window][###Timeline]
|
[Window][###Timeline]
|
||||||
Pos=8,647
|
Pos=8,724
|
||||||
Size=1496,275
|
Size=1902,329
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000006,0
|
DockId=0x00000016,0
|
||||||
|
|
||||||
[Window][###Regions]
|
[Window][###Regions]
|
||||||
Pos=1430,192
|
Pos=1347,369
|
||||||
Size=74,453
|
Size=563,353
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000014,0
|
DockId=0x00000014,0
|
||||||
|
|
||||||
|
[Window][###Shaders]
|
||||||
|
Pos=1347,369
|
||||||
|
Size=563,353
|
||||||
|
Collapsed=0
|
||||||
|
DockId=0x00000014,1
|
||||||
|
|
||||||
|
[Window][###Overlays]
|
||||||
|
Pos=1347,369
|
||||||
|
Size=563,353
|
||||||
|
Collapsed=0
|
||||||
|
DockId=0x00000014,2
|
||||||
|
|
||||||
|
[Table][0xE5891919,5]
|
||||||
|
Column 0 Weight=1.3608
|
||||||
|
Column 1 Weight=0.8522
|
||||||
|
Column 2 Weight=0.7973
|
||||||
|
Column 3 Weight=0.9897
|
||||||
|
Column 4 Weight=0.5671
|
||||||
|
|
||||||
|
[Table][0xB03AD869,4]
|
||||||
|
Column 0 Weight=0.9635
|
||||||
|
Column 1 Weight=0.6034
|
||||||
|
Column 2 Weight=0.5742
|
||||||
|
Column 3 Weight=1.8589
|
||||||
|
|
||||||
|
[Table][0x6BD17CEE,4]
|
||||||
|
Column 0 Weight=0.9451
|
||||||
|
Column 1 Weight=0.5919
|
||||||
|
Column 2 Weight=0.5823
|
||||||
|
Column 3 Weight=1.8807
|
||||||
|
|
||||||
[Docking][Data]
|
[Docking][Data]
|
||||||
DockSpace ID=0x123F8F08 Window=0x6D581B32 Pos=8,62 Size=1496,860 Split=Y Selected=0x4EFD0020
|
DockSpace ID=0x123F8F08 Window=0x6D581B32 Pos=8,62 Size=1902,991 Split=Y Selected=0x4EFD0020
|
||||||
DockNode ID=0x00000005 Parent=0x123F8F08 SizeRef=1910,714 Split=X
|
DockNode ID=0x00000015 Parent=0x123F8F08 SizeRef=1902,660 Split=X
|
||||||
DockNode ID=0x00000001 Parent=0x00000005 SizeRef=50,994 Selected=0x18A5FDB9
|
DockNode ID=0x00000004 Parent=0x00000015 SizeRef=50,991 Selected=0xA82FD886
|
||||||
DockNode ID=0x00000002 Parent=0x00000005 SizeRef=1850,994 Split=X Selected=0x4EFD0020
|
DockNode ID=0x00000012 Parent=0x00000015 SizeRef=1850,991 Split=X
|
||||||
DockNode ID=0x00000003 Parent=0x00000002 SizeRef=1001,994 Split=X Selected=0xDDB7ACD5
|
DockNode ID=0x00000013 Parent=0x00000012 SizeRef=898,991 Selected=0xDDB7ACD5
|
||||||
DockNode ID=0x00000012 Parent=0x00000003 SizeRef=50,555 Selected=0xA82FD886
|
DockNode ID=0x00000003 Parent=0x00000012 SizeRef=950,991 Split=X
|
||||||
DockNode ID=0x00000013 Parent=0x00000003 SizeRef=949,555 Selected=0xDDB7ACD5
|
DockNode ID=0x00000001 Parent=0x00000003 SizeRef=50,994 Selected=0x18A5FDB9
|
||||||
DockNode ID=0x00000004 Parent=0x00000002 SizeRef=899,994 Split=X Selected=0x4EFD0020
|
DockNode ID=0x00000002 Parent=0x00000003 SizeRef=1850,994 Split=X Selected=0x4EFD0020
|
||||||
DockNode ID=0x00000009 Parent=0x00000004 SizeRef=351,497 Split=Y Selected=0xCD8384B1
|
DockNode ID=0x00000009 Parent=0x00000002 SizeRef=204,497 Split=Y Selected=0xCD8384B1
|
||||||
DockNode ID=0x00000007 Parent=0x00000009 SizeRef=181,275 Selected=0x754E368F
|
DockNode ID=0x00000007 Parent=0x00000009 SizeRef=181,275 Selected=0x754E368F
|
||||||
DockNode ID=0x00000008 Parent=0x00000009 SizeRef=181,278 Split=Y Selected=0xA4818A79
|
DockNode ID=0x00000008 Parent=0x00000009 SizeRef=181,278 Split=Y Selected=0xE42526D3
|
||||||
DockNode ID=0x0000000D Parent=0x00000008 SizeRef=342,414 Selected=0x6DE1CB13
|
DockNode ID=0x00000005 Parent=0x00000008 SizeRef=204,349 Selected=0x6DE1CB13
|
||||||
DockNode ID=0x0000000E Parent=0x00000008 SizeRef=342,298 Selected=0x64F6E1D7
|
DockNode ID=0x00000006 Parent=0x00000008 SizeRef=204,309 Selected=0xE42526D3
|
||||||
DockNode ID=0x0000000A Parent=0x00000004 SizeRef=546,497 Split=Y Selected=0x4EFD0020
|
DockNode ID=0x0000000A Parent=0x00000002 SizeRef=744,497 Split=Y Selected=0x4EFD0020
|
||||||
DockNode ID=0x0000000B Parent=0x0000000A SizeRef=459,303 Split=Y Selected=0xD302131E
|
DockNode ID=0x0000000B Parent=0x0000000A SizeRef=459,303 Split=Y Selected=0xD302131E
|
||||||
DockNode ID=0x0000000F Parent=0x0000000B SizeRef=586,259 CentralNode=1 Selected=0xD302131E
|
DockNode ID=0x0000000F Parent=0x0000000B SizeRef=586,305 CentralNode=1 Selected=0xD302131E
|
||||||
DockNode ID=0x00000010 Parent=0x0000000B SizeRef=586,453 Split=X Selected=0x9B32B74A
|
DockNode ID=0x00000010 Parent=0x0000000B SizeRef=586,353 Split=X Selected=0x9B32B74A
|
||||||
DockNode ID=0x00000011 Parent=0x00000010 SizeRef=252,316 Selected=0x0ED5C382
|
DockNode ID=0x00000011 Parent=0x00000010 SizeRef=179,293 Selected=0x0ED5C382
|
||||||
DockNode ID=0x00000014 Parent=0x00000010 SizeRef=292,316 Selected=0x9B32B74A
|
DockNode ID=0x00000014 Parent=0x00000010 SizeRef=563,293 Selected=0x3732FDF0
|
||||||
DockNode ID=0x0000000C Parent=0x0000000A SizeRef=459,250 Selected=0xC1986EE2
|
DockNode ID=0x0000000C Parent=0x0000000A SizeRef=459,250 Selected=0xC1986EE2
|
||||||
DockNode ID=0x00000006 Parent=0x123F8F08 SizeRef=1910,275 Selected=0x597925B7
|
DockNode ID=0x00000016 Parent=0x123F8F08 SizeRef=1902,329 Selected=0x597925B7
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+5
-4
@@ -65,11 +65,9 @@ namespace anm2ed
|
|||||||
X(FILE_IS_AUTOSAVE, fileIsAutosave, STRING_UNDEFINED, BOOL, true) \
|
X(FILE_IS_AUTOSAVE, fileIsAutosave, STRING_UNDEFINED, BOOL, true) \
|
||||||
X(FILE_IS_WARN_OVERWRITE, fileIsWarnOverwrite, STRING_UNDEFINED, BOOL, true) \
|
X(FILE_IS_WARN_OVERWRITE, fileIsWarnOverwrite, STRING_UNDEFINED, BOOL, true) \
|
||||||
X(FILE_SNAPSHOT_STACK_SIZE, fileSnapshotStackSize, STRING_UNDEFINED, INT, 50) \
|
X(FILE_SNAPSHOT_STACK_SIZE, fileSnapshotStackSize, STRING_UNDEFINED, INT, 50) \
|
||||||
X(FILE_IS_SERIALIZE_GROUPS, fileIsSerializeGroups, STRING_UNDEFINED, BOOL, true) \
|
|
||||||
X(FILE_IS_SERIALIZE_REGIONS, fileIsSerializeRegions, STRING_UNDEFINED, BOOL, true) \
|
|
||||||
X(FILE_IS_SERIALIZE_SOUNDS, fileIsSerializeSounds, STRING_UNDEFINED, BOOL, true) \
|
|
||||||
X(FILE_IS_KEEP_REDUNDANT_FRAME_REGION_VALUES, fileIsKeepRedundantFrameRegionValues, STRING_UNDEFINED, BOOL, true) \
|
X(FILE_IS_KEEP_REDUNDANT_FRAME_REGION_VALUES, fileIsKeepRedundantFrameRegionValues, STRING_UNDEFINED, BOOL, true) \
|
||||||
X(FILE_IS_BAKE_SPECIAL_INTERPOLATED_FRAMES, fileIsBakeSpecialInterpolatedFrames, STRING_UNDEFINED, BOOL, true) \
|
X(FILE_IS_BAKE_SPECIAL_INTERPOLATED_FRAMES, fileIsBakeSpecialInterpolatedFrames, STRING_UNDEFINED, BOOL, true) \
|
||||||
|
X(IS_FILE_BAKE_GROUP_FRAMES, isFileBakeGroupFrames, STRING_UNDEFINED, BOOL, true) \
|
||||||
\
|
\
|
||||||
X(KEYBOARD_REPEAT_DELAY, keyboardRepeatDelay, STRING_UNDEFINED, FLOAT, 0.300f) \
|
X(KEYBOARD_REPEAT_DELAY, keyboardRepeatDelay, STRING_UNDEFINED, FLOAT, 0.300f) \
|
||||||
X(KEYBOARD_REPEAT_RATE, keyboardRepeatRate, STRING_UNDEFINED, FLOAT, 0.050f) \
|
X(KEYBOARD_REPEAT_RATE, keyboardRepeatRate, STRING_UNDEFINED, FLOAT, 0.050f) \
|
||||||
@@ -201,7 +199,8 @@ namespace anm2ed
|
|||||||
X(RENDER_ROWS, renderRows, STRING_UNDEFINED, INT, 0) \
|
X(RENDER_ROWS, renderRows, STRING_UNDEFINED, INT, 0) \
|
||||||
X(RENDER_COLUMNS, renderColumns, STRING_UNDEFINED, INT, 0) \
|
X(RENDER_COLUMNS, renderColumns, STRING_UNDEFINED, INT, 0) \
|
||||||
X(RENDER_FORMAT, renderFormat, STRING_UNDEFINED, PATH, "{}.png") \
|
X(RENDER_FORMAT, renderFormat, STRING_UNDEFINED, PATH, "{}.png") \
|
||||||
X(RENDER_IS_RAW_ANIMATION, renderIsRawAnimation, STRING_UNDEFINED, BOOL, true) \
|
X(RENDER_IS_USE_ANIMATION_BOUNDS, renderIsUseAnimationBounds, STRING_UNDEFINED, BOOL, true) \
|
||||||
|
X(RENDER_IS_USE_ISOLATED_ANIMATION, renderIsUseIsolatedAnimation, STRING_UNDEFINED, BOOL, false) \
|
||||||
X(RENDER_SCALE, renderScale, STRING_UNDEFINED, FLOAT, 1.0f) \
|
X(RENDER_SCALE, renderScale, STRING_UNDEFINED, FLOAT, 1.0f) \
|
||||||
X(RENDER_FFMPEG_PATH, renderFFmpegPath, STRING_UNDEFINED, PATH, FFMPEG_PATH_DEFAULT)
|
X(RENDER_FFMPEG_PATH, renderFFmpegPath, STRING_UNDEFINED, PATH, FFMPEG_PATH_DEFAULT)
|
||||||
|
|
||||||
@@ -274,7 +273,9 @@ namespace anm2ed
|
|||||||
X(WINDOW_LAYERS, windowIsLayers, LABEL_LAYERS_WINDOW, BOOL, true) \
|
X(WINDOW_LAYERS, windowIsLayers, LABEL_LAYERS_WINDOW, BOOL, true) \
|
||||||
X(WINDOW_NULLS, windowIsNulls, LABEL_NULLS_WINDOW, BOOL, true) \
|
X(WINDOW_NULLS, windowIsNulls, LABEL_NULLS_WINDOW, BOOL, true) \
|
||||||
X(WINDOW_ONIONSKIN, windowIsOnionskin, LABEL_ONIONSKIN_WINDOW, BOOL, true) \
|
X(WINDOW_ONIONSKIN, windowIsOnionskin, LABEL_ONIONSKIN_WINDOW, BOOL, true) \
|
||||||
|
X(WINDOW_OVERLAYS, windowIsOverlays, LABEL_OVERLAYS_WINDOW, BOOL, true) \
|
||||||
X(WINDOW_PREVIEW, windowIsSpritesheets, LABEL_SPRITESHEETS_WINDOW, BOOL, true) \
|
X(WINDOW_PREVIEW, windowIsSpritesheets, LABEL_SPRITESHEETS_WINDOW, BOOL, true) \
|
||||||
|
X(WINDOW_SHADERS, windowIsShaders, LABEL_SHADERS_WINDOW, BOOL, true) \
|
||||||
X(WINDOW_SOUNDS, windowIsSounds, LABEL_SOUNDS_WINDOW, BOOL, true) \
|
X(WINDOW_SOUNDS, windowIsSounds, LABEL_SOUNDS_WINDOW, BOOL, true) \
|
||||||
X(WINDOW_SPRITESHEET_EDITOR, windowIsSpritesheetEditor, LABEL_SPRITESHEET_EDITOR_WINDOW, BOOL, true) \
|
X(WINDOW_SPRITESHEET_EDITOR, windowIsSpritesheetEditor, LABEL_SPRITESHEET_EDITOR_WINDOW, BOOL, true) \
|
||||||
X(WINDOW_TIMELINE, windowIsTimeline, LABEL_TIMELINE_WINDOW, BOOL, true) \
|
X(WINDOW_TIMELINE, windowIsTimeline, LABEL_TIMELINE_WINDOW, BOOL, true) \
|
||||||
|
|||||||
+381
-35
@@ -1,40 +1,297 @@
|
|||||||
#include "snapshots.hpp"
|
#include "snapshots.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
using namespace anm2ed::snapshots;
|
#include <glm/common.hpp>
|
||||||
|
|
||||||
|
namespace anm2ed::snapshots
|
||||||
|
{
|
||||||
|
bool is_vec2_equal(const glm::vec2& left, const glm::vec2& right) { return glm::all(glm::equal(left, right)); }
|
||||||
|
|
||||||
|
bool is_vec3_equal(const glm::vec3& left, const glm::vec3& right) { return glm::all(glm::equal(left, right)); }
|
||||||
|
|
||||||
|
bool is_vec4_equal(const glm::vec4& left, const glm::vec4& right) { return glm::all(glm::equal(left, right)); }
|
||||||
|
|
||||||
|
bool is_playback_equal(const Playback& left, const Playback& right)
|
||||||
|
{
|
||||||
|
return left.time == right.time && left.isPlaying == right.isPlaying && left.isFinished == right.isFinished;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_storage_equal(const Storage& left, const Storage& right)
|
||||||
|
{
|
||||||
|
return left.reference == right.reference && left.hovered == right.hovered && left.labelsString == right.labelsString &&
|
||||||
|
left.ids == right.ids && static_cast<const std::set<int>&>(left.selection) ==
|
||||||
|
static_cast<const std::set<int>&>(right.selection) &&
|
||||||
|
left.references == right.references;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_texture_equal(const resource::Texture& left, const resource::Texture& right)
|
||||||
|
{
|
||||||
|
return left.size == right.size && left.filter == right.filter && left.channels == right.channels &&
|
||||||
|
left.pixels == right.pixels;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_audio_equal(const resource::Audio& left, const resource::Audio& right)
|
||||||
|
{
|
||||||
|
return const_cast<resource::Audio&>(left).is_valid() == const_cast<resource::Audio&>(right).is_valid();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename Compare>
|
||||||
|
bool is_map_equal(const std::map<int, T>& left, const std::map<int, T>& right, Compare compare)
|
||||||
|
{
|
||||||
|
if (left.size() != right.size()) return false;
|
||||||
|
|
||||||
|
auto leftIt = left.begin();
|
||||||
|
auto rightIt = right.begin();
|
||||||
|
while (leftIt != left.end() && rightIt != right.end())
|
||||||
|
{
|
||||||
|
if (leftIt->first != rightIt->first) return false;
|
||||||
|
if (!compare(leftIt->second, rightIt->second)) return false;
|
||||||
|
++leftIt;
|
||||||
|
++rightIt;
|
||||||
|
}
|
||||||
|
|
||||||
|
return leftIt == left.end() && rightIt == right.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T> bool is_value_equal(const T& left, const T& right) { return left == right; }
|
||||||
|
|
||||||
|
bool is_value_equal(const Playback& left, const Playback& right) { return is_playback_equal(left, right); }
|
||||||
|
|
||||||
|
bool is_value_equal(const Storage& left, const Storage& right) { return is_storage_equal(left, right); }
|
||||||
|
|
||||||
|
bool is_value_equal(const std::map<int, resource::Texture>& left, const std::map<int, resource::Texture>& right)
|
||||||
|
{
|
||||||
|
return is_map_equal(left, right, is_texture_equal);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_value_equal(const std::map<int, resource::Audio>& left, const std::map<int, resource::Audio>& right)
|
||||||
|
{
|
||||||
|
return is_map_equal(left, right, is_audio_equal);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_element_shallow_equal(const Element& left, const Element& right)
|
||||||
|
{
|
||||||
|
return left.type == right.type && left.tag == right.tag && left.name == right.name &&
|
||||||
|
left.createdBy == right.createdBy && left.createdOn == right.createdOn && left.path == right.path &&
|
||||||
|
left.vertex == right.vertex && left.fragment == right.fragment && left.binding == right.binding &&
|
||||||
|
left.value == right.value && left.defaultAnimation == right.defaultAnimation && left.id == right.id &&
|
||||||
|
left.layerId == right.layerId && left.nullId == right.nullId &&
|
||||||
|
left.spritesheetId == right.spritesheetId && left.fps == right.fps && left.version == right.version &&
|
||||||
|
left.frameNum == right.frameNum && left.duration == right.duration && left.atFrame == right.atFrame &&
|
||||||
|
left.eventId == right.eventId && left.regionId == right.regionId && left.soundId == right.soundId &&
|
||||||
|
left.groupId == right.groupId && left.index == right.index && left.isLoop == right.isLoop &&
|
||||||
|
left.isVisible == right.isVisible && left.isShowRect == right.isShowRect && left.isExpanded == right.isExpanded &&
|
||||||
|
left.isEnabled == right.isEnabled && left.interpolation == right.interpolation && left.origin == right.origin &&
|
||||||
|
left.rotation == right.rotation && left.soundIds == right.soundIds && is_vec2_equal(left.pivot, right.pivot) &&
|
||||||
|
is_vec2_equal(left.crop, right.crop) && is_vec2_equal(left.position, right.position) &&
|
||||||
|
is_vec2_equal(left.size, right.size) && is_vec2_equal(left.scale, right.scale) &&
|
||||||
|
is_vec3_equal(left.colorOffset, right.colorOffset) && is_vec4_equal(left.tint, right.tint);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_element_recurseable(const Element& left, const Element& right)
|
||||||
|
{
|
||||||
|
if (left.type != right.type) return false;
|
||||||
|
if (left.children.size() != right.children.size()) return false;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < left.children.size(); ++i)
|
||||||
|
if (left.children[i].type != right.children[i].type) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_element_equal(const Element& left, const Element& right)
|
||||||
|
{
|
||||||
|
if (!is_element_shallow_equal(left, right)) return false;
|
||||||
|
if (left.children.size() != right.children.size()) return false;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < left.children.size(); ++i)
|
||||||
|
if (!is_element_equal(left.children[i], right.children[i])) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void element_steps_build(std::vector<SnapshotElementStep>& out, const Element& before, const Element& after,
|
||||||
|
std::vector<int>& path)
|
||||||
|
{
|
||||||
|
if (!is_element_recurseable(before, after) || !is_element_shallow_equal(before, after))
|
||||||
|
{
|
||||||
|
out.push_back({path, before, after});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = 0; i < before.children.size(); ++i)
|
||||||
|
{
|
||||||
|
path.push_back((int)i);
|
||||||
|
element_steps_build(out, before.children[i], after.children[i], path);
|
||||||
|
path.pop_back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Element* element_get(Element& root, const std::vector<int>& path)
|
||||||
|
{
|
||||||
|
auto* element = &root;
|
||||||
|
for (auto index : path)
|
||||||
|
{
|
||||||
|
if (index < 0 || index >= (int)element->children.size()) return nullptr;
|
||||||
|
element = &element->children[index];
|
||||||
|
}
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Element* element_get(const Element& root, const std::vector<int>& path)
|
||||||
|
{
|
||||||
|
auto* element = &root;
|
||||||
|
for (auto index : path)
|
||||||
|
{
|
||||||
|
if (index < 0 || index >= (int)element->children.size()) return nullptr;
|
||||||
|
element = &element->children[index];
|
||||||
|
}
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool element_path_get(const Element& element, const Element* target, std::vector<int>& path)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < element.children.size(); ++i)
|
||||||
|
{
|
||||||
|
path.push_back((int)i);
|
||||||
|
if (&element.children[i] == target) return true;
|
||||||
|
if (element_path_get(element.children[i], target, path)) return true;
|
||||||
|
path.pop_back();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<std::vector<int>> frame_path_get(const Anm2& anm2, Reference frameReference)
|
||||||
|
{
|
||||||
|
auto frame = anm2.element_get(frameReference);
|
||||||
|
if (!frame) return std::nullopt;
|
||||||
|
|
||||||
|
std::vector<int> path{};
|
||||||
|
if (!element_path_get(anm2.root, frame, path)) return std::nullopt;
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<std::vector<int>> region_path_get(const Anm2& anm2, int spritesheetId, int regionId)
|
||||||
|
{
|
||||||
|
auto spritesheet = anm2.element_get(ElementType::SPRITESHEET, spritesheetId);
|
||||||
|
if (!spritesheet) return std::nullopt;
|
||||||
|
auto region = element_child_id_get(*spritesheet, ElementType::REGION, regionId);
|
||||||
|
if (!region) return std::nullopt;
|
||||||
|
|
||||||
|
std::vector<int> path{};
|
||||||
|
if (!element_path_get(anm2.root, region, path)) return std::nullopt;
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
void step_state_seed(SnapshotStep& step, const Snapshot& snapshot)
|
||||||
|
{
|
||||||
|
#define X(type, name) step.name = SnapshotStepValue<type>{snapshot.name, {}};
|
||||||
|
SNAPSHOT_STEP_STATE_FIELDS
|
||||||
|
#undef X
|
||||||
|
}
|
||||||
|
|
||||||
|
void step_textures_seed(SnapshotStep& step, const Snapshot& snapshot)
|
||||||
|
{
|
||||||
|
step.textures = SnapshotStepValue<SnapshotTextureMap>{snapshot.textures, {}};
|
||||||
|
step.overlayTextures = SnapshotStepValue<SnapshotOverlayTextureMap>{snapshot.overlayTextures, {}};
|
||||||
|
}
|
||||||
|
|
||||||
|
SnapshotStep step_anm2_seed(const Snapshot& snapshot, const std::string& message)
|
||||||
|
{
|
||||||
|
SnapshotStep step{};
|
||||||
|
step.message = message;
|
||||||
|
step.anm2.isValid = SnapshotStepValue<bool>{snapshot.anm2.isValid, {}};
|
||||||
|
step.anm2.elements.push_back({{}, snapshot.anm2.root, {}});
|
||||||
|
step_state_seed(step, snapshot);
|
||||||
|
return step;
|
||||||
|
}
|
||||||
|
|
||||||
|
void frames_step_add(SnapshotStep& step, const Snapshot& snapshot, Reference frameReference)
|
||||||
|
{
|
||||||
|
auto path = frame_path_get(snapshot.anm2, frameReference);
|
||||||
|
if (!path) return;
|
||||||
|
for (auto& elementStep : step.anm2.elements)
|
||||||
|
if (elementStep.path == *path) return;
|
||||||
|
|
||||||
|
auto frame = snapshot.anm2.element_get(frameReference);
|
||||||
|
if (!frame) return;
|
||||||
|
|
||||||
|
step.anm2.elements.push_back({std::move(*path), *frame, {}});
|
||||||
|
}
|
||||||
|
|
||||||
|
void regions_step_add(SnapshotStep& step, const Snapshot& snapshot, int spritesheetId, int regionId)
|
||||||
|
{
|
||||||
|
auto path = region_path_get(snapshot.anm2, spritesheetId, regionId);
|
||||||
|
if (!path) return;
|
||||||
|
for (auto& elementStep : step.anm2.elements)
|
||||||
|
if (elementStep.path == *path) return;
|
||||||
|
|
||||||
|
auto spritesheet = snapshot.anm2.element_get(ElementType::SPRITESHEET, spritesheetId);
|
||||||
|
if (!spritesheet) return;
|
||||||
|
auto region = element_child_id_get(*spritesheet, ElementType::REGION, regionId);
|
||||||
|
if (!region) return;
|
||||||
|
|
||||||
|
step.anm2.elements.push_back({std::move(*path), *region, {}});
|
||||||
|
}
|
||||||
|
|
||||||
|
SnapshotAnm2Step anm2_step_make(const Anm2& before, const Anm2& after)
|
||||||
|
{
|
||||||
|
SnapshotAnm2Step step{};
|
||||||
|
if (before.isValid != after.isValid) step.isValid = SnapshotStepValue<bool>{before.isValid, after.isValid};
|
||||||
|
|
||||||
|
std::vector<int> path{};
|
||||||
|
element_steps_build(step.elements, before.root, after.root, path);
|
||||||
|
return step;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
namespace anm2ed
|
namespace anm2ed
|
||||||
{
|
{
|
||||||
int SnapshotStack::maxSize = snapshots::MAX;
|
int SnapshotStack::maxSize = snapshots::MAX;
|
||||||
|
|
||||||
Snapshot Snapshot::stack_copy_get() const
|
bool SnapshotAnm2Step::is_empty() const { return !isValid && elements.empty(); }
|
||||||
|
|
||||||
|
void SnapshotAnm2Step::apply(Anm2& anm2, SnapshotStepDirection direction) const
|
||||||
{
|
{
|
||||||
Snapshot out{};
|
if (isValid) anm2.isValid = direction == SnapshotStepDirection::UNDO ? isValid->undo : isValid->redo;
|
||||||
out.playback = playback;
|
|
||||||
out.animation = animation;
|
for (auto& elementStep : elements)
|
||||||
out.event = event;
|
if (auto* element = snapshots::element_get(anm2.root, elementStep.path); element)
|
||||||
out.frames = frames;
|
*element = direction == SnapshotStepDirection::UNDO ? elementStep.undo : elementStep.redo;
|
||||||
out.items = items;
|
}
|
||||||
out.layer = layer;
|
|
||||||
out.merge = merge;
|
bool SnapshotStep::is_empty() const
|
||||||
out.null = null;
|
{
|
||||||
out.region = region;
|
if (!anm2.is_empty()) return false;
|
||||||
out.sound = sound;
|
|
||||||
out.spritesheet = spritesheet;
|
#define X(type, name) \
|
||||||
out.textures = textures;
|
if (this->name) return false;
|
||||||
out.sounds = sounds;
|
SNAPSHOT_STEP_STATE_FIELDS
|
||||||
out.anm2 = anm2;
|
SNAPSHOT_STEP_RESOURCE_FIELDS
|
||||||
out.reference = reference;
|
#undef X
|
||||||
out.groupReferences = groupReferences;
|
|
||||||
out.frameTime = frameTime;
|
return true;
|
||||||
out.message = message;
|
}
|
||||||
return out;
|
|
||||||
|
void SnapshotStep::apply(Snapshot& snapshot, SnapshotStepDirection direction) const
|
||||||
|
{
|
||||||
|
snapshot.message = message;
|
||||||
|
anm2.apply(snapshot.anm2, direction);
|
||||||
|
|
||||||
|
#define X(type, name) \
|
||||||
|
if (this->name) snapshot.name = direction == SnapshotStepDirection::UNDO ? this->name->undo : this->name->redo;
|
||||||
|
SNAPSHOT_STEP_STATE_FIELDS
|
||||||
|
SNAPSHOT_STEP_RESOURCE_FIELDS
|
||||||
|
#undef X
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SnapshotStack::is_empty() { return stack.empty(); }
|
bool SnapshotStack::is_empty() { return stack.empty(); }
|
||||||
|
|
||||||
void SnapshotStack::push(const Snapshot& snapshot)
|
void SnapshotStack::push(SnapshotStep step)
|
||||||
{
|
{
|
||||||
if (maxSize <= 0)
|
if (maxSize <= 0)
|
||||||
{
|
{
|
||||||
@@ -42,13 +299,13 @@ namespace anm2ed
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((int)stack.size() >= maxSize) stack.pop_front();
|
if ((int)stack.size() >= maxSize) stack.pop_front();
|
||||||
stack.push_back(snapshot.stack_copy_get());
|
stack.push_back(std::move(step));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<Snapshot> SnapshotStack::pop()
|
std::optional<SnapshotStep> SnapshotStack::pop()
|
||||||
{
|
{
|
||||||
if (is_empty()) return std::nullopt;
|
if (is_empty()) return std::nullopt;
|
||||||
auto snapshot = stack.back();
|
auto snapshot = std::move(stack.back());
|
||||||
stack.pop_back();
|
stack.pop_back();
|
||||||
return snapshot;
|
return snapshot;
|
||||||
}
|
}
|
||||||
@@ -71,18 +328,105 @@ namespace anm2ed
|
|||||||
|
|
||||||
int SnapshotStack::max_size_get() { return maxSize; }
|
int SnapshotStack::max_size_get() { return maxSize; }
|
||||||
|
|
||||||
void Snapshots::push(const Snapshot& snapshot)
|
Snapshot* Snapshots::get() { return ¤t; }
|
||||||
|
|
||||||
|
void Snapshots::anm2_push(const Snapshot& snapshot, const std::string& message)
|
||||||
{
|
{
|
||||||
undoStack.push(snapshot);
|
pendingStep = snapshots::step_anm2_seed(snapshot, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Snapshots::frames_push(const Snapshot& snapshot, const std::string& message,
|
||||||
|
const std::set<Reference>& frameReferences)
|
||||||
|
{
|
||||||
|
SnapshotStep step{};
|
||||||
|
step.message = message;
|
||||||
|
for (auto frameReference : frameReferences)
|
||||||
|
snapshots::frames_step_add(step, snapshot, frameReference);
|
||||||
|
|
||||||
|
pendingStep = step.is_empty() ? std::nullopt : std::optional<SnapshotStep>(std::move(step));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Snapshots::regions_push(const Snapshot& snapshot, const std::string& message, int spritesheetId,
|
||||||
|
const std::set<int>& regionIds)
|
||||||
|
{
|
||||||
|
SnapshotStep step{};
|
||||||
|
step.message = message;
|
||||||
|
for (auto regionId : regionIds)
|
||||||
|
snapshots::regions_step_add(step, snapshot, spritesheetId, regionId);
|
||||||
|
|
||||||
|
pendingStep = step.is_empty() ? std::nullopt : std::optional<SnapshotStep>(std::move(step));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Snapshots::textures_push(const Snapshot& snapshot, const std::string& message)
|
||||||
|
{
|
||||||
|
SnapshotStep step{};
|
||||||
|
step.message = message;
|
||||||
|
snapshots::step_textures_seed(step, snapshot);
|
||||||
|
pendingStep = std::move(step);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Snapshots::anm2_textures_push(const Snapshot& snapshot, const std::string& message)
|
||||||
|
{
|
||||||
|
auto step = snapshots::step_anm2_seed(snapshot, message);
|
||||||
|
snapshots::step_textures_seed(step, snapshot);
|
||||||
|
pendingStep = std::move(step);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Snapshots::commit(const Snapshot& snapshot)
|
||||||
|
{
|
||||||
|
if (!pendingStep) return;
|
||||||
|
|
||||||
|
auto step = std::move(*pendingStep);
|
||||||
|
pendingStep.reset();
|
||||||
|
|
||||||
|
if (step.anm2.isValid)
|
||||||
|
{
|
||||||
|
step.anm2.isValid->redo = snapshot.anm2.isValid;
|
||||||
|
if (step.anm2.isValid->undo == step.anm2.isValid->redo) step.anm2.isValid.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto it = step.anm2.elements.begin(); it != step.anm2.elements.end();)
|
||||||
|
{
|
||||||
|
auto* element = snapshots::element_get(snapshot.anm2.root, it->path);
|
||||||
|
if (!element)
|
||||||
|
{
|
||||||
|
it = step.anm2.elements.erase(it);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
it->redo = *element;
|
||||||
|
if (snapshots::is_element_equal(it->undo, it->redo))
|
||||||
|
{
|
||||||
|
it = step.anm2.elements.erase(it);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define X(type, name) \
|
||||||
|
if (step.name) \
|
||||||
|
{ \
|
||||||
|
step.name->redo = snapshot.name; \
|
||||||
|
if (snapshots::is_value_equal(step.name->undo, step.name->redo)) step.name.reset(); \
|
||||||
|
}
|
||||||
|
SNAPSHOT_STEP_STATE_FIELDS
|
||||||
|
SNAPSHOT_STEP_RESOURCE_FIELDS
|
||||||
|
#undef X
|
||||||
|
|
||||||
|
if (step.is_empty()) return;
|
||||||
|
|
||||||
|
undoStack.push(std::move(step));
|
||||||
redoStack.clear();
|
redoStack.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Snapshots::undo()
|
bool Snapshots::undo()
|
||||||
{
|
{
|
||||||
if (auto snapshot = undoStack.pop())
|
pendingStep.reset();
|
||||||
|
if (auto step = undoStack.pop())
|
||||||
{
|
{
|
||||||
redoStack.push(current);
|
step->apply(current, SnapshotStepDirection::UNDO);
|
||||||
current = *snapshot;
|
redoStack.push(std::move(*step));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -90,10 +434,11 @@ namespace anm2ed
|
|||||||
|
|
||||||
bool Snapshots::redo()
|
bool Snapshots::redo()
|
||||||
{
|
{
|
||||||
if (auto snapshot = redoStack.pop())
|
pendingStep.reset();
|
||||||
|
if (auto step = redoStack.pop())
|
||||||
{
|
{
|
||||||
undoStack.push(current);
|
step->apply(current, SnapshotStepDirection::REDO);
|
||||||
current = *snapshot;
|
undoStack.push(std::move(*step));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -103,6 +448,7 @@ namespace anm2ed
|
|||||||
{
|
{
|
||||||
undoStack.clear();
|
undoStack.clear();
|
||||||
redoStack.clear();
|
redoStack.clear();
|
||||||
|
pendingStep.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Snapshots::apply_limit()
|
void Snapshots::apply_limit()
|
||||||
@@ -110,4 +456,4 @@ namespace anm2ed
|
|||||||
undoStack.trim_to_limit();
|
undoStack.trim_to_limit();
|
||||||
redoStack.trim_to_limit();
|
redoStack.trim_to_limit();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
+80
-5
@@ -4,6 +4,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "anm2/anm2.hpp"
|
#include "anm2/anm2.hpp"
|
||||||
#include "audio.hpp"
|
#include "audio.hpp"
|
||||||
@@ -19,6 +20,34 @@ namespace anm2ed::snapshots
|
|||||||
|
|
||||||
namespace anm2ed
|
namespace anm2ed
|
||||||
{
|
{
|
||||||
|
enum class SnapshotStepDirection
|
||||||
|
{
|
||||||
|
UNDO,
|
||||||
|
REDO
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T> struct SnapshotStepValue
|
||||||
|
{
|
||||||
|
T undo{};
|
||||||
|
T redo{};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SnapshotElementStep
|
||||||
|
{
|
||||||
|
std::vector<int> path{};
|
||||||
|
Element undo{};
|
||||||
|
Element redo{};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SnapshotAnm2Step
|
||||||
|
{
|
||||||
|
std::optional<SnapshotStepValue<bool>> isValid{};
|
||||||
|
std::vector<SnapshotElementStep> elements{};
|
||||||
|
|
||||||
|
bool is_empty() const;
|
||||||
|
void apply(Anm2&, SnapshotStepDirection) const;
|
||||||
|
};
|
||||||
|
|
||||||
class Snapshot
|
class Snapshot
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -30,18 +59,58 @@ namespace anm2ed
|
|||||||
Storage layer{};
|
Storage layer{};
|
||||||
Storage merge{};
|
Storage merge{};
|
||||||
Storage null{};
|
Storage null{};
|
||||||
|
Storage overlay{};
|
||||||
Storage region{};
|
Storage region{};
|
||||||
Storage sound{};
|
Storage sound{};
|
||||||
Storage spritesheet{};
|
Storage spritesheet{};
|
||||||
std::map<int, resource::Texture> textures{};
|
std::map<int, resource::Texture> textures{};
|
||||||
|
std::map<int, resource::Texture> overlayTextures{};
|
||||||
std::map<int, resource::Audio> sounds{};
|
std::map<int, resource::Audio> sounds{};
|
||||||
Anm2 anm2{};
|
Anm2 anm2{};
|
||||||
Reference reference{};
|
Reference reference{};
|
||||||
std::set<Reference> groupReferences{};
|
std::set<Reference> groupReferences{};
|
||||||
float frameTime{};
|
float frameTime{};
|
||||||
std::string message = snapshots::ACTION;
|
std::string message = snapshots::ACTION;
|
||||||
|
};
|
||||||
|
|
||||||
Snapshot stack_copy_get() const;
|
using SnapshotTextureMap = std::map<int, resource::Texture>;
|
||||||
|
using SnapshotOverlayTextureMap = std::map<int, resource::Texture>;
|
||||||
|
using SnapshotSoundMap = std::map<int, resource::Audio>;
|
||||||
|
|
||||||
|
#define SNAPSHOT_STEP_STATE_FIELDS \
|
||||||
|
X(Playback, playback) \
|
||||||
|
X(Storage, animation) \
|
||||||
|
X(Storage, event) \
|
||||||
|
X(Storage, frames) \
|
||||||
|
X(Storage, items) \
|
||||||
|
X(Storage, layer) \
|
||||||
|
X(Storage, merge) \
|
||||||
|
X(Storage, null) \
|
||||||
|
X(Storage, overlay) \
|
||||||
|
X(Storage, region) \
|
||||||
|
X(Storage, sound) \
|
||||||
|
X(Storage, spritesheet) \
|
||||||
|
X(Reference, reference) \
|
||||||
|
X(std::set<Reference>, groupReferences) \
|
||||||
|
X(float, frameTime)
|
||||||
|
|
||||||
|
#define SNAPSHOT_STEP_RESOURCE_FIELDS \
|
||||||
|
X(SnapshotTextureMap, textures) \
|
||||||
|
X(SnapshotOverlayTextureMap, overlayTextures) \
|
||||||
|
X(SnapshotSoundMap, sounds)
|
||||||
|
|
||||||
|
struct SnapshotStep
|
||||||
|
{
|
||||||
|
std::string message = snapshots::ACTION;
|
||||||
|
SnapshotAnm2Step anm2{};
|
||||||
|
|
||||||
|
#define X(type, name) std::optional<SnapshotStepValue<type>> name{};
|
||||||
|
SNAPSHOT_STEP_STATE_FIELDS
|
||||||
|
SNAPSHOT_STEP_RESOURCE_FIELDS
|
||||||
|
#undef X
|
||||||
|
|
||||||
|
bool is_empty() const;
|
||||||
|
void apply(Snapshot&, SnapshotStepDirection) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SnapshotStack
|
class SnapshotStack
|
||||||
@@ -50,8 +119,8 @@ namespace anm2ed
|
|||||||
SnapshotStack() = default;
|
SnapshotStack() = default;
|
||||||
|
|
||||||
bool is_empty();
|
bool is_empty();
|
||||||
void push(const Snapshot&);
|
void push(SnapshotStep);
|
||||||
std::optional<Snapshot> pop();
|
std::optional<SnapshotStep> pop();
|
||||||
void clear();
|
void clear();
|
||||||
void trim_to_limit();
|
void trim_to_limit();
|
||||||
|
|
||||||
@@ -60,7 +129,7 @@ namespace anm2ed
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static int maxSize;
|
static int maxSize;
|
||||||
std::deque<Snapshot> stack;
|
std::deque<SnapshotStep> stack;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Snapshots
|
class Snapshots
|
||||||
@@ -69,9 +138,15 @@ namespace anm2ed
|
|||||||
SnapshotStack undoStack{};
|
SnapshotStack undoStack{};
|
||||||
SnapshotStack redoStack{};
|
SnapshotStack redoStack{};
|
||||||
Snapshot current{};
|
Snapshot current{};
|
||||||
|
std::optional<SnapshotStep> pendingStep{};
|
||||||
|
|
||||||
Snapshot* get();
|
Snapshot* get();
|
||||||
void push(const Snapshot&);
|
void anm2_push(const Snapshot&, const std::string&);
|
||||||
|
void frames_push(const Snapshot&, const std::string&, const std::set<Reference>&);
|
||||||
|
void regions_push(const Snapshot&, const std::string&, int, const std::set<int>&);
|
||||||
|
void textures_push(const Snapshot&, const std::string&);
|
||||||
|
void anm2_textures_push(const Snapshot&, const std::string&);
|
||||||
|
void commit(const Snapshot&);
|
||||||
bool undo();
|
bool undo();
|
||||||
bool redo();
|
bool redo();
|
||||||
void reset();
|
void reset();
|
||||||
|
|||||||
@@ -14,6 +14,32 @@ namespace anm2ed::imgui
|
|||||||
return editID;
|
return editID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool input_text_rename_update(std::string& text, RenameState& state, float width)
|
||||||
|
{
|
||||||
|
bool isActivated{};
|
||||||
|
|
||||||
|
auto finish = [&]()
|
||||||
|
{
|
||||||
|
selectable_input_text_id().clear();
|
||||||
|
isActivated = true;
|
||||||
|
state = RENAME_FINISHED;
|
||||||
|
isSelectableInputTextRenaming = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (state == RENAME_BEGIN)
|
||||||
|
{
|
||||||
|
ImGui::SetKeyboardFocusHere();
|
||||||
|
state = RENAME_EDITING;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::SetNextItemWidth(width);
|
||||||
|
if (input_text_string("##Edit", &text, ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll))
|
||||||
|
finish();
|
||||||
|
if (ImGui::IsItemDeactivatedAfterEdit() || ImGui::IsKeyPressed(ImGuiKey_Escape)) finish();
|
||||||
|
|
||||||
|
return isActivated;
|
||||||
|
}
|
||||||
|
|
||||||
bool selectable_input_text(const std::string& label, const std::string& id, std::string& text, bool isSelected,
|
bool selectable_input_text(const std::string& label, const std::string& id, std::string& text, bool isSelected,
|
||||||
ImGuiSelectableFlags flags, RenameState& state)
|
ImGuiSelectableFlags flags, RenameState& state)
|
||||||
{
|
{
|
||||||
@@ -22,26 +48,7 @@ namespace anm2ed::imgui
|
|||||||
bool isActivated{};
|
bool isActivated{};
|
||||||
|
|
||||||
if (isRename)
|
if (isRename)
|
||||||
{
|
isActivated = input_text_rename_update(text, state);
|
||||||
auto finish = [&]()
|
|
||||||
{
|
|
||||||
editID.clear();
|
|
||||||
isActivated = true;
|
|
||||||
state = RENAME_FINISHED;
|
|
||||||
isSelectableInputTextRenaming = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (state == RENAME_BEGIN)
|
|
||||||
{
|
|
||||||
ImGui::SetKeyboardFocusHere();
|
|
||||||
state = RENAME_EDITING;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::SetNextItemWidth(-FLT_MIN);
|
|
||||||
if (input_text_string("##Edit", &text, ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_AutoSelectAll))
|
|
||||||
finish();
|
|
||||||
if (ImGui::IsItemDeactivatedAfterEdit() || ImGui::IsKeyPressed(ImGuiKey_Escape)) finish();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ImGui::Selectable(label.c_str(), isSelected, flags)) isActivated = true;
|
if (ImGui::Selectable(label.c_str(), isSelected, flags)) isActivated = true;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <cfloat>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <imgui/imgui.h>
|
#include <imgui/imgui.h>
|
||||||
@@ -16,6 +17,7 @@ namespace anm2ed::imgui
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::string& selectable_input_text_id();
|
std::string& selectable_input_text_id();
|
||||||
|
bool input_text_rename_update(std::string&, RenameState&, float = -FLT_MIN);
|
||||||
bool selectable_input_text(const std::string&, const std::string&, std::string&, bool, ImGuiSelectableFlags,
|
bool selectable_input_text(const std::string&, const std::string&, std::string&, bool, ImGuiSelectableFlags,
|
||||||
RenameState&);
|
RenameState&);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
#include "tree.hpp"
|
||||||
|
|
||||||
|
namespace anm2ed::imgui
|
||||||
|
{
|
||||||
|
TreeNodeInputTextResult tree_node_input_text(const std::string& label, const std::string& id, std::string& text,
|
||||||
|
bool isSelected, ImGuiTreeNodeFlags flags, RenameState& state)
|
||||||
|
{
|
||||||
|
TreeNodeInputTextResult result{};
|
||||||
|
auto& editID = selectable_input_text_id();
|
||||||
|
auto isRename = editID == id;
|
||||||
|
auto treeFlags = flags | ImGuiTreeNodeFlags_FramePadding | (isSelected ? ImGuiTreeNodeFlags_Selected : 0);
|
||||||
|
|
||||||
|
if (!isRename)
|
||||||
|
{
|
||||||
|
result.isOpen = ImGui::TreeNodeEx(id.c_str(), treeFlags, "%s", label.c_str());
|
||||||
|
result.isClicked =
|
||||||
|
ImGui::IsItemClicked(ImGuiMouseButton_Left) || ImGui::IsItemClicked(ImGuiMouseButton_Right);
|
||||||
|
result.isActivated = result.isClicked;
|
||||||
|
|
||||||
|
if (state == RENAME_FORCE_EDIT || (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)))
|
||||||
|
{
|
||||||
|
state = RENAME_BEGIN;
|
||||||
|
editID = id;
|
||||||
|
result.isActivated = true;
|
||||||
|
result.isRenameStarted = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result.isOpen = ImGui::TreeNodeEx(id.c_str(), treeFlags, "%s", "");
|
||||||
|
auto itemMin = ImGui::GetItemRectMin();
|
||||||
|
auto itemMax = ImGui::GetItemRectMax();
|
||||||
|
auto labelX = itemMin.x + ImGui::GetTreeNodeToLabelSpacing();
|
||||||
|
ImGui::SetCursorScreenPos(ImVec2(labelX, itemMin.y));
|
||||||
|
auto width = itemMax.x > labelX ? itemMax.x - labelX : 1.0f;
|
||||||
|
result.isActivated = input_text_rename_update(text, state, width);
|
||||||
|
result.isRenameFinished = state == RENAME_FINISHED;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <imgui/imgui.h>
|
||||||
|
|
||||||
|
#include "selectable.hpp"
|
||||||
|
|
||||||
|
namespace anm2ed::imgui
|
||||||
|
{
|
||||||
|
struct TreeNodeInputTextResult
|
||||||
|
{
|
||||||
|
bool isOpen{};
|
||||||
|
bool isActivated{};
|
||||||
|
bool isClicked{};
|
||||||
|
bool isRenameStarted{};
|
||||||
|
bool isRenameFinished{};
|
||||||
|
};
|
||||||
|
|
||||||
|
TreeNodeInputTextResult tree_node_input_text(const std::string&, const std::string&, std::string&, bool,
|
||||||
|
ImGuiTreeNodeFlags, RenameState&);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user