mirror of
https://github.com/aseprite/aseprite.git
synced 2024-10-06 06:50:07 +00:00
Rename FrameTag -> Tag
This commit is contained in:
parent
c25c67733b
commit
1c8b8051a8
@ -1024,7 +1024,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
<menu id="frame_tag_popup_menu">
|
<menu id="tag_popup_menu">
|
||||||
<item command="FrameTagProperties" text="@main_menu.frame_tags_tag_properties" />
|
<item command="FrameTagProperties" text="@main_menu.frame_tags_tag_properties" />
|
||||||
<item command="RemoveFrameTag" text="@main_menu.frame_tags_delete_tag" />
|
<item command="RemoveFrameTag" text="@main_menu.frame_tags_delete_tag" />
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -75,7 +75,7 @@ Warning
|
|||||||
||&Yes||&No
|
||&Yes||&No
|
||||||
END
|
END
|
||||||
file_format_alpha_channel = Alpha channel
|
file_format_alpha_channel = Alpha channel
|
||||||
file_format_frame_tags = Frame tags
|
file_format_tags = Tags
|
||||||
file_format_frames = Frames
|
file_format_frames = Frames
|
||||||
file_format_grayscale_mode = Grayscale mode
|
file_format_grayscale_mode = Grayscale mode
|
||||||
file_format_indexed_mode = Indexed mode
|
file_format_indexed_mode = Indexed mode
|
||||||
@ -273,7 +273,7 @@ Flip_Horizontally = Horizontally
|
|||||||
Flip_Selection = Selection
|
Flip_Selection = Selection
|
||||||
Flip_Vertically = Vertically
|
Flip_Vertically = Vertically
|
||||||
FrameProperties = Frame Properties
|
FrameProperties = Frame Properties
|
||||||
FrameTagProperties = Frame Tag Properties
|
FrameTagProperties = Tag Properties
|
||||||
FullscreenPreview = Fullscreen Preview
|
FullscreenPreview = Fullscreen Preview
|
||||||
GotoFirstFrame = Go to First Frame
|
GotoFirstFrame = Go to First Frame
|
||||||
GotoFirstFrameInTag = Go to First Frame In Tag
|
GotoFirstFrameInTag = Go to First Frame In Tag
|
||||||
@ -340,7 +340,7 @@ NewFrame_NewEmptyFrame = New Empty Frame
|
|||||||
NewFrame_DuplicateCels = Duplicate Cels w/Layer Mode
|
NewFrame_DuplicateCels = Duplicate Cels w/Layer Mode
|
||||||
NewFrame_DuplicateCelsCopies = Duplicate Cels
|
NewFrame_DuplicateCelsCopies = Duplicate Cels
|
||||||
NewFrame_DuplicateCelsLinked = Duplicate Linked Cels
|
NewFrame_DuplicateCelsLinked = Duplicate Linked Cels
|
||||||
NewFrameTag = New Frame Tag
|
NewFrameTag = New Tag
|
||||||
NewLayer = New {}
|
NewLayer = New {}
|
||||||
NewLayer_BeforeActiveLayer = New {} Below
|
NewLayer_BeforeActiveLayer = New {} Below
|
||||||
NewLayer_Layer = Layer
|
NewLayer_Layer = Layer
|
||||||
@ -379,7 +379,7 @@ PlayPreviewAnimation = Play Preview Animation
|
|||||||
Redo = Redo
|
Redo = Redo
|
||||||
Refresh = Refresh
|
Refresh = Refresh
|
||||||
RemoveFrame = Remove Frame
|
RemoveFrame = Remove Frame
|
||||||
RemoveFrameTag = Remove Frame Tag
|
RemoveFrameTag = Remove Tag
|
||||||
RemoveLayer = Remove Layer
|
RemoveLayer = Remove Layer
|
||||||
RemoveSlice = Remove Slice
|
RemoveSlice = Remove Slice
|
||||||
ReopenClosedFile = Reopen Closed File
|
ReopenClosedFile = Reopen Closed File
|
||||||
@ -555,7 +555,7 @@ json_data_hash = Hash
|
|||||||
json_data_array = Array
|
json_data_array = Array
|
||||||
meta = Meta:
|
meta = Meta:
|
||||||
meta_layers = Layers
|
meta_layers = Layers
|
||||||
meta_frame_tags = Frame Tags
|
meta_tags = Tags
|
||||||
meta_slices = Slices
|
meta_slices = Slices
|
||||||
open_sprite_sheet = Open generated sprite sheet
|
open_sprite_sheet = Open generated sprite sheet
|
||||||
export = &Export
|
export = &Export
|
||||||
@ -588,14 +588,6 @@ title = Frame Properties
|
|||||||
frame_number = Frame number:
|
frame_number = Frame number:
|
||||||
duration = Duration (milliseconds):
|
duration = Duration (milliseconds):
|
||||||
|
|
||||||
[frame_tag_properties]
|
|
||||||
title = Frame Tag Properties
|
|
||||||
name = Name:
|
|
||||||
from = From:
|
|
||||||
to = To:
|
|
||||||
color = Color:
|
|
||||||
ani_dir = Animation Direction:
|
|
||||||
|
|
||||||
[general]
|
[general]
|
||||||
ok = &OK
|
ok = &OK
|
||||||
close = &Close
|
close = &Close
|
||||||
@ -1361,6 +1353,14 @@ pixel_scale = Pixel Scale:
|
|||||||
[tab_popup_menu]
|
[tab_popup_menu]
|
||||||
close = &Close
|
close = &Close
|
||||||
|
|
||||||
|
[tag_properties]
|
||||||
|
title = Tag Properties
|
||||||
|
name = Name:
|
||||||
|
from = From:
|
||||||
|
to = To:
|
||||||
|
color = Color:
|
||||||
|
ani_dir = Animation Direction:
|
||||||
|
|
||||||
[timeline_conf]
|
[timeline_conf]
|
||||||
position = Position:
|
position = Position:
|
||||||
left = &Left
|
left = &Left
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<!-- Aseprite -->
|
<!-- Aseprite -->
|
||||||
<!-- Copyright (C) 2001-2018 by David Capello -->
|
<!-- Copyright (C) 2019 Igara Studio S.A. -->
|
||||||
|
<!-- Copyright (C) 2001-2018 David Capello -->
|
||||||
<gui>
|
<gui>
|
||||||
<window id="export_sprite_sheet" text="@.title">
|
<window id="export_sprite_sheet" text="@.title">
|
||||||
<grid columns="4">
|
<grid columns="4">
|
||||||
@ -61,7 +62,7 @@
|
|||||||
</combobox>
|
</combobox>
|
||||||
<label text="@.meta" />
|
<label text="@.meta" />
|
||||||
<check id="list_layers" text="@.meta_layers" />
|
<check id="list_layers" text="@.meta_layers" />
|
||||||
<check id="list_tags" text="@.meta_frame_tags" />
|
<check id="list_tags" text="@.meta_tags" />
|
||||||
<check id="list_slices" text="@.meta_slices" />
|
<check id="list_slices" text="@.meta_slices" />
|
||||||
</hbox>
|
</hbox>
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Aseprite -->
|
<!-- Aseprite -->
|
||||||
<!-- Copyright (C) 2015-2018 by David Capello -->
|
<!-- Copyright (C) 2019 Igara Studio S.A. -->
|
||||||
|
<!-- Copyright (C) 2015-2018 David Capello -->
|
||||||
<gui>
|
<gui>
|
||||||
<window id="frame_tag_properties" text="@.title">
|
<window id="tag_properties" text="@.title">
|
||||||
<grid columns="2">
|
<grid columns="2">
|
||||||
<label text="@.name" />
|
<label text="@.name" />
|
||||||
<entry maxsize="256" id="name" magnet="true" />
|
<entry maxsize="256" id="name" magnet="true" />
|
@ -347,7 +347,6 @@ if(ENABLE_UI)
|
|||||||
ui/file_selector.cpp
|
ui/file_selector.cpp
|
||||||
ui/filename_field.cpp
|
ui/filename_field.cpp
|
||||||
ui/font_popup.cpp
|
ui/font_popup.cpp
|
||||||
ui/frame_tag_window.cpp
|
|
||||||
ui/hex_color_entry.cpp
|
ui/hex_color_entry.cpp
|
||||||
ui/home_view.cpp
|
ui/home_view.cpp
|
||||||
ui/icon_button.cpp
|
ui/icon_button.cpp
|
||||||
@ -377,6 +376,7 @@ if(ENABLE_UI)
|
|||||||
ui/slider2.cpp
|
ui/slider2.cpp
|
||||||
ui/status_bar.cpp
|
ui/status_bar.cpp
|
||||||
ui/tabs.cpp
|
ui/tabs.cpp
|
||||||
|
ui/tag_window.cpp
|
||||||
ui/task_widget.cpp
|
ui/task_widget.cpp
|
||||||
ui/timeline/ani_controls.cpp
|
ui/timeline/ani_controls.cpp
|
||||||
ui/timeline/timeline.cpp
|
ui/timeline/timeline.cpp
|
||||||
@ -411,10 +411,10 @@ add_library(app-lib
|
|||||||
cmd.cpp
|
cmd.cpp
|
||||||
cmd/add_cel.cpp
|
cmd/add_cel.cpp
|
||||||
cmd/add_frame.cpp
|
cmd/add_frame.cpp
|
||||||
cmd/add_frame_tag.cpp
|
|
||||||
cmd/add_layer.cpp
|
cmd/add_layer.cpp
|
||||||
cmd/add_palette.cpp
|
cmd/add_palette.cpp
|
||||||
cmd/add_slice.cpp
|
cmd/add_slice.cpp
|
||||||
|
cmd/add_tag.cpp
|
||||||
cmd/assign_color_profile.cpp
|
cmd/assign_color_profile.cpp
|
||||||
cmd/background_from_layer.cpp
|
cmd/background_from_layer.cpp
|
||||||
cmd/clear_cel.cpp
|
cmd/clear_cel.cpp
|
||||||
@ -440,10 +440,10 @@ add_library(app-lib
|
|||||||
cmd/remap_colors.cpp
|
cmd/remap_colors.cpp
|
||||||
cmd/remove_cel.cpp
|
cmd/remove_cel.cpp
|
||||||
cmd/remove_frame.cpp
|
cmd/remove_frame.cpp
|
||||||
cmd/remove_frame_tag.cpp
|
|
||||||
cmd/remove_layer.cpp
|
cmd/remove_layer.cpp
|
||||||
cmd/remove_palette.cpp
|
cmd/remove_palette.cpp
|
||||||
cmd/remove_slice.cpp
|
cmd/remove_slice.cpp
|
||||||
|
cmd/remove_tag.cpp
|
||||||
cmd/replace_image.cpp
|
cmd/replace_image.cpp
|
||||||
cmd/reselect_mask.cpp
|
cmd/reselect_mask.cpp
|
||||||
cmd/set_cel_bounds.cpp
|
cmd/set_cel_bounds.cpp
|
||||||
@ -452,10 +452,6 @@ add_library(app-lib
|
|||||||
cmd/set_cel_opacity.cpp
|
cmd/set_cel_opacity.cpp
|
||||||
cmd/set_cel_position.cpp
|
cmd/set_cel_position.cpp
|
||||||
cmd/set_frame_duration.cpp
|
cmd/set_frame_duration.cpp
|
||||||
cmd/set_frame_tag_anidir.cpp
|
|
||||||
cmd/set_frame_tag_color.cpp
|
|
||||||
cmd/set_frame_tag_name.cpp
|
|
||||||
cmd/set_frame_tag_range.cpp
|
|
||||||
cmd/set_last_point.cpp
|
cmd/set_last_point.cpp
|
||||||
cmd/set_layer_blend_mode.cpp
|
cmd/set_layer_blend_mode.cpp
|
||||||
cmd/set_layer_flags.cpp
|
cmd/set_layer_flags.cpp
|
||||||
@ -469,6 +465,10 @@ add_library(app-lib
|
|||||||
cmd/set_slice_key.cpp
|
cmd/set_slice_key.cpp
|
||||||
cmd/set_slice_name.cpp
|
cmd/set_slice_name.cpp
|
||||||
cmd/set_sprite_size.cpp
|
cmd/set_sprite_size.cpp
|
||||||
|
cmd/set_tag_anidir.cpp
|
||||||
|
cmd/set_tag_color.cpp
|
||||||
|
cmd/set_tag_name.cpp
|
||||||
|
cmd/set_tag_range.cpp
|
||||||
cmd/set_total_frames.cpp
|
cmd/set_total_frames.cpp
|
||||||
cmd/set_transparent_color.cpp
|
cmd/set_transparent_color.cpp
|
||||||
cmd/set_user_data.cpp
|
cmd/set_user_data.cpp
|
||||||
@ -477,11 +477,11 @@ add_library(app-lib
|
|||||||
cmd/unlink_cel.cpp
|
cmd/unlink_cel.cpp
|
||||||
cmd/with_cel.cpp
|
cmd/with_cel.cpp
|
||||||
cmd/with_document.cpp
|
cmd/with_document.cpp
|
||||||
cmd/with_frame_tag.cpp
|
|
||||||
cmd/with_image.cpp
|
cmd/with_image.cpp
|
||||||
cmd/with_layer.cpp
|
cmd/with_layer.cpp
|
||||||
cmd/with_slice.cpp
|
cmd/with_slice.cpp
|
||||||
cmd/with_sprite.cpp
|
cmd/with_sprite.cpp
|
||||||
|
cmd/with_tag.cpp
|
||||||
cmd_sequence.cpp
|
cmd_sequence.cpp
|
||||||
cmd_transaction.cpp
|
cmd_transaction.cpp
|
||||||
color.cpp
|
color.cpp
|
||||||
|
@ -343,7 +343,7 @@ void AppMenus::reload()
|
|||||||
m_framePopupMenu.reset(loadMenuById(handle, "frame_popup_menu"));
|
m_framePopupMenu.reset(loadMenuById(handle, "frame_popup_menu"));
|
||||||
m_celPopupMenu.reset(loadMenuById(handle, "cel_popup_menu"));
|
m_celPopupMenu.reset(loadMenuById(handle, "cel_popup_menu"));
|
||||||
m_celMovementPopupMenu.reset(loadMenuById(handle, "cel_movement_popup_menu"));
|
m_celMovementPopupMenu.reset(loadMenuById(handle, "cel_movement_popup_menu"));
|
||||||
m_frameTagPopupMenu.reset(loadMenuById(handle, "frame_tag_popup_menu"));
|
m_tagPopupMenu.reset(loadMenuById(handle, "tag_popup_menu"));
|
||||||
m_slicePopupMenu.reset(loadMenuById(handle, "slice_popup_menu"));
|
m_slicePopupMenu.reset(loadMenuById(handle, "slice_popup_menu"));
|
||||||
m_palettePopupMenu.reset(loadMenuById(handle, "palette_popup_menu"));
|
m_palettePopupMenu.reset(loadMenuById(handle, "palette_popup_menu"));
|
||||||
m_inkPopupMenu.reset(loadMenuById(handle, "ink_popup_menu"));
|
m_inkPopupMenu.reset(loadMenuById(handle, "ink_popup_menu"));
|
||||||
@ -706,7 +706,7 @@ void AppMenus::updateMenusList()
|
|||||||
m_menus.push_back(m_framePopupMenu.get());
|
m_menus.push_back(m_framePopupMenu.get());
|
||||||
m_menus.push_back(m_celPopupMenu.get());
|
m_menus.push_back(m_celPopupMenu.get());
|
||||||
m_menus.push_back(m_celMovementPopupMenu.get());
|
m_menus.push_back(m_celMovementPopupMenu.get());
|
||||||
m_menus.push_back(m_frameTagPopupMenu.get());
|
m_menus.push_back(m_tagPopupMenu.get());
|
||||||
m_menus.push_back(m_slicePopupMenu.get());
|
m_menus.push_back(m_slicePopupMenu.get());
|
||||||
m_menus.push_back(m_palettePopupMenu.get());
|
m_menus.push_back(m_palettePopupMenu.get());
|
||||||
m_menus.push_back(m_inkPopupMenu.get());
|
m_menus.push_back(m_inkPopupMenu.get());
|
||||||
|
@ -56,7 +56,7 @@ namespace app {
|
|||||||
Menu* getFramePopupMenu() { return m_framePopupMenu.get(); }
|
Menu* getFramePopupMenu() { return m_framePopupMenu.get(); }
|
||||||
Menu* getCelPopupMenu() { return m_celPopupMenu.get(); }
|
Menu* getCelPopupMenu() { return m_celPopupMenu.get(); }
|
||||||
Menu* getCelMovementPopupMenu() { return m_celMovementPopupMenu.get(); }
|
Menu* getCelMovementPopupMenu() { return m_celMovementPopupMenu.get(); }
|
||||||
Menu* getFrameTagPopupMenu() { return m_frameTagPopupMenu.get(); }
|
Menu* getTagPopupMenu() { return m_tagPopupMenu.get(); }
|
||||||
Menu* getSlicePopupMenu() { return m_slicePopupMenu.get(); }
|
Menu* getSlicePopupMenu() { return m_slicePopupMenu.get(); }
|
||||||
Menu* getPalettePopupMenu() { return m_palettePopupMenu.get(); }
|
Menu* getPalettePopupMenu() { return m_palettePopupMenu.get(); }
|
||||||
Menu* getInkPopupMenu() { return m_inkPopupMenu.get(); }
|
Menu* getInkPopupMenu() { return m_inkPopupMenu.get(); }
|
||||||
@ -92,7 +92,7 @@ namespace app {
|
|||||||
std::unique_ptr<Menu> m_framePopupMenu;
|
std::unique_ptr<Menu> m_framePopupMenu;
|
||||||
std::unique_ptr<Menu> m_celPopupMenu;
|
std::unique_ptr<Menu> m_celPopupMenu;
|
||||||
std::unique_ptr<Menu> m_celMovementPopupMenu;
|
std::unique_ptr<Menu> m_celMovementPopupMenu;
|
||||||
std::unique_ptr<Menu> m_frameTagPopupMenu;
|
std::unique_ptr<Menu> m_tagPopupMenu;
|
||||||
std::unique_ptr<Menu> m_slicePopupMenu;
|
std::unique_ptr<Menu> m_slicePopupMenu;
|
||||||
std::unique_ptr<Menu> m_palettePopupMenu;
|
std::unique_ptr<Menu> m_palettePopupMenu;
|
||||||
std::unique_ptr<Menu> m_inkPopupMenu;
|
std::unique_ptr<Menu> m_inkPopupMenu;
|
||||||
|
@ -52,7 +52,7 @@ AppOptions::AppOptions(int argc, const char* argv[])
|
|||||||
, m_layer(m_po.add("layer").alias("import-layer").requiresValue("<name>").description("Include just the given layer in the sheet\nor save as operation"))
|
, m_layer(m_po.add("layer").alias("import-layer").requiresValue("<name>").description("Include just the given layer in the sheet\nor save as operation"))
|
||||||
, m_allLayers(m_po.add("all-layers").description("Make all layers visible\nBy default hidden layers will be ignored"))
|
, m_allLayers(m_po.add("all-layers").description("Make all layers visible\nBy default hidden layers will be ignored"))
|
||||||
, m_ignoreLayer(m_po.add("ignore-layer").requiresValue("<name>").description("Exclude the given layer in the sheet\nor save as operation"))
|
, m_ignoreLayer(m_po.add("ignore-layer").requiresValue("<name>").description("Exclude the given layer in the sheet\nor save as operation"))
|
||||||
, m_frameTag(m_po.add("frame-tag").requiresValue("<name>").description("Include tagged frames in the sheet"))
|
, m_tag(m_po.add("tag").alias("frame-tag").requiresValue("<name>").description("Include tagged frames in the sheet"))
|
||||||
, m_frameRange(m_po.add("frame-range").requiresValue("from,to").description("Only export frames in the [from,to] range"))
|
, m_frameRange(m_po.add("frame-range").requiresValue("from,to").description("Only export frames in the [from,to] range"))
|
||||||
, m_ignoreEmpty(m_po.add("ignore-empty").description("Do not export empty frames/cels"))
|
, m_ignoreEmpty(m_po.add("ignore-empty").description("Do not export empty frames/cels"))
|
||||||
, m_borderPadding(m_po.add("border-padding").requiresValue("<value>").description("Add padding on the texture borders"))
|
, m_borderPadding(m_po.add("border-padding").requiresValue("<value>").description("Add padding on the texture borders"))
|
||||||
|
@ -66,7 +66,7 @@ public:
|
|||||||
const Option& layer() const { return m_layer; }
|
const Option& layer() const { return m_layer; }
|
||||||
const Option& allLayers() const { return m_allLayers; }
|
const Option& allLayers() const { return m_allLayers; }
|
||||||
const Option& ignoreLayer() const { return m_ignoreLayer; }
|
const Option& ignoreLayer() const { return m_ignoreLayer; }
|
||||||
const Option& frameTag() const { return m_frameTag; }
|
const Option& tag() const { return m_tag; }
|
||||||
const Option& frameRange() const { return m_frameRange; }
|
const Option& frameRange() const { return m_frameRange; }
|
||||||
const Option& ignoreEmpty() const { return m_ignoreEmpty; }
|
const Option& ignoreEmpty() const { return m_ignoreEmpty; }
|
||||||
const Option& borderPadding() const { return m_borderPadding; }
|
const Option& borderPadding() const { return m_borderPadding; }
|
||||||
@ -126,7 +126,7 @@ private:
|
|||||||
Option& m_layer;
|
Option& m_layer;
|
||||||
Option& m_allLayers;
|
Option& m_allLayers;
|
||||||
Option& m_ignoreLayer;
|
Option& m_ignoreLayer;
|
||||||
Option& m_frameTag;
|
Option& m_tag;
|
||||||
Option& m_frameRange;
|
Option& m_frameRange;
|
||||||
Option& m_ignoreEmpty;
|
Option& m_ignoreEmpty;
|
||||||
Option& m_borderPadding;
|
Option& m_borderPadding;
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
|
|
||||||
#include "app/doc.h"
|
#include "app/doc.h"
|
||||||
#include "app/file/file.h"
|
#include "app/file/file.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/frame_tags.h"
|
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
|
#include "doc/tags.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ FileOpROI CliOpenFile::roi() const
|
|||||||
|
|
||||||
return FileOpROI(document,
|
return FileOpROI(document,
|
||||||
slice,
|
slice,
|
||||||
frameTag,
|
tag,
|
||||||
selFrames,
|
selFrames,
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ namespace app {
|
|||||||
Doc* document;
|
Doc* document;
|
||||||
std::string filename;
|
std::string filename;
|
||||||
std::string filenameFormat;
|
std::string filenameFormat;
|
||||||
std::string frameTag;
|
std::string tag;
|
||||||
std::string slice;
|
std::string slice;
|
||||||
std::vector<std::string> includeLayers;
|
std::vector<std::string> includeLayers;
|
||||||
std::vector<std::string> excludeLayers;
|
std::vector<std::string> excludeLayers;
|
||||||
@ -44,8 +44,8 @@ namespace app {
|
|||||||
|
|
||||||
CliOpenFile();
|
CliOpenFile();
|
||||||
|
|
||||||
bool hasFrameTag() const {
|
bool hasTag() const {
|
||||||
return (!frameTag.empty());
|
return (!tag.empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasSlice() const {
|
bool hasSlice() const {
|
||||||
|
@ -26,12 +26,12 @@
|
|||||||
#include "base/convert_to.h"
|
#include "base/convert_to.h"
|
||||||
#include "base/fs.h"
|
#include "base/fs.h"
|
||||||
#include "base/split_string.h"
|
#include "base/split_string.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/frame_tags.h"
|
|
||||||
#include "doc/layer.h"
|
#include "doc/layer.h"
|
||||||
#include "doc/selected_frames.h"
|
#include "doc/selected_frames.h"
|
||||||
#include "doc/selected_layers.h"
|
#include "doc/selected_layers.h"
|
||||||
#include "doc/slice.h"
|
#include "doc/slice.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
|
#include "doc/tags.h"
|
||||||
#include "render/dithering_algorithm.h"
|
#include "render/dithering_algorithm.h"
|
||||||
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
@ -283,9 +283,9 @@ void CliProcessor::process(Context* ctx)
|
|||||||
else if (opt == &m_options.allLayers()) {
|
else if (opt == &m_options.allLayers()) {
|
||||||
cof.allLayers = true;
|
cof.allLayers = true;
|
||||||
}
|
}
|
||||||
// --frame-tag <tag-name>
|
// --tag <tag-name>
|
||||||
else if (opt == &m_options.frameTag()) {
|
else if (opt == &m_options.tag()) {
|
||||||
cof.frameTag = value.value();
|
cof.tag = value.value();
|
||||||
}
|
}
|
||||||
// --frame-range from,to
|
// --frame-range from,to
|
||||||
else if (opt == &m_options.frameRange()) {
|
else if (opt == &m_options.frameRange()) {
|
||||||
@ -531,7 +531,7 @@ void CliProcessor::process(Context* ctx)
|
|||||||
// --list-tags
|
// --list-tags
|
||||||
else if (opt == &m_options.listTags()) {
|
else if (opt == &m_options.listTags()) {
|
||||||
if (m_exporter)
|
if (m_exporter)
|
||||||
m_exporter->setListFrameTags(true);
|
m_exporter->setListTags(true);
|
||||||
else
|
else
|
||||||
cof.listTags = true;
|
cof.listTags = true;
|
||||||
}
|
}
|
||||||
@ -606,18 +606,18 @@ bool CliProcessor::openFile(Context* ctx, CliOpenFile& cof)
|
|||||||
|
|
||||||
// Add document to exporter
|
// Add document to exporter
|
||||||
if (m_exporter) {
|
if (m_exporter) {
|
||||||
FrameTag* frameTag = nullptr;
|
Tag* tag = nullptr;
|
||||||
SelectedFrames selFrames;
|
SelectedFrames selFrames;
|
||||||
|
|
||||||
if (cof.hasFrameTag()) {
|
if (cof.hasTag()) {
|
||||||
frameTag = doc->sprite()->frameTags().getByName(cof.frameTag);
|
tag = doc->sprite()->tags().getByName(cof.tag);
|
||||||
}
|
}
|
||||||
if (cof.hasFrameRange()) {
|
if (cof.hasFrameRange()) {
|
||||||
// --frame-range with --frame-tag
|
// --frame-range with --frame-tag
|
||||||
if (frameTag) {
|
if (tag) {
|
||||||
selFrames.insert(
|
selFrames.insert(
|
||||||
frameTag->fromFrame()+MID(0, cof.fromFrame, frameTag->frames()-1),
|
tag->fromFrame()+MID(0, cof.fromFrame, tag->frames()-1),
|
||||||
frameTag->fromFrame()+MID(0, cof.toFrame, frameTag->frames()-1));
|
tag->fromFrame()+MID(0, cof.toFrame, tag->frames()-1));
|
||||||
}
|
}
|
||||||
// --frame-range without --frame-tag
|
// --frame-range without --frame-tag
|
||||||
else {
|
else {
|
||||||
@ -634,12 +634,12 @@ bool CliProcessor::openFile(Context* ctx, CliOpenFile& cof)
|
|||||||
SelectedLayers oneLayer;
|
SelectedLayers oneLayer;
|
||||||
oneLayer.insert(layer);
|
oneLayer.insert(layer);
|
||||||
|
|
||||||
m_exporter->addDocument(doc, frameTag, &oneLayer,
|
m_exporter->addDocument(doc, tag, &oneLayer,
|
||||||
(!selFrames.empty() ? &selFrames: nullptr));
|
(!selFrames.empty() ? &selFrames: nullptr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_exporter->addDocument(doc, frameTag, &filteredLayers,
|
m_exporter->addDocument(doc, tag, &filteredLayers,
|
||||||
(!selFrames.empty() ? &selFrames: nullptr));
|
(!selFrames.empty() ? &selFrames: nullptr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -648,12 +648,12 @@ bool CliProcessor::openFile(Context* ctx, CliOpenFile& cof)
|
|||||||
SelectedLayers oneLayer;
|
SelectedLayers oneLayer;
|
||||||
oneLayer.insert(layer);
|
oneLayer.insert(layer);
|
||||||
|
|
||||||
m_exporter->addDocument(doc, frameTag, &oneLayer,
|
m_exporter->addDocument(doc, tag, &oneLayer,
|
||||||
(!selFrames.empty() ? &selFrames: nullptr));
|
(!selFrames.empty() ? &selFrames: nullptr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_exporter->addDocument(doc, frameTag, nullptr,
|
m_exporter->addDocument(doc, tag, nullptr,
|
||||||
(!selFrames.empty() ? &selFrames: nullptr));
|
(!selFrames.empty() ? &selFrames: nullptr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -712,26 +712,26 @@ void CliProcessor::saveFile(Context* ctx, const CliOpenFile& cof)
|
|||||||
layers.push_back(nullptr);
|
layers.push_back(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<doc::FrameTag*> frameTags;
|
std::vector<doc::Tag*> tags;
|
||||||
if (cof.hasFrameTag()) {
|
if (cof.hasTag()) {
|
||||||
frameTags.push_back(
|
tags.push_back(
|
||||||
doc->sprite()->frameTags().getByName(cof.frameTag));
|
doc->sprite()->tags().getByName(cof.tag));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
doc::FrameTags& origFrameTags = cof.document->sprite()->frameTags();
|
doc::Tags& origTags = cof.document->sprite()->tags();
|
||||||
if (cof.splitTags && !origFrameTags.empty()) {
|
if (cof.splitTags && !origTags.empty()) {
|
||||||
for (doc::FrameTag* frameTag : origFrameTags) {
|
for (doc::Tag* tag : origTags) {
|
||||||
// In case the tag is outside the given --frame-range
|
// In case the tag is outside the given --frame-range
|
||||||
if (cof.hasFrameRange()) {
|
if (cof.hasFrameRange()) {
|
||||||
if (frameTag->toFrame() < cof.fromFrame ||
|
if (tag->toFrame() < cof.fromFrame ||
|
||||||
frameTag->fromFrame() > cof.toFrame)
|
tag->fromFrame() > cof.toFrame)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
frameTags.push_back(frameTag);
|
tags.push_back(tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
frameTags.push_back(nullptr);
|
tags.push_back(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<doc::Slice*> slices;
|
std::vector<doc::Slice*> slices;
|
||||||
@ -753,7 +753,7 @@ void CliProcessor::saveFile(Context* ctx, const CliOpenFile& cof)
|
|||||||
bool groupInFormat = is_group_in_filename_format(fn);
|
bool groupInFormat = is_group_in_filename_format(fn);
|
||||||
|
|
||||||
for (doc::Slice* slice : slices) {
|
for (doc::Slice* slice : slices) {
|
||||||
for (doc::FrameTag* frameTag : frameTags) {
|
for (doc::Tag* tag : tags) {
|
||||||
// For each layer, hide other ones and save the sprite.
|
// For each layer, hide other ones and save the sprite.
|
||||||
for (doc::Layer* layer : layers) {
|
for (doc::Layer* layer : layers) {
|
||||||
RestoreVisibleLayers layersVisibility;
|
RestoreVisibleLayers layersVisibility;
|
||||||
@ -804,11 +804,11 @@ void CliProcessor::saveFile(Context* ctx, const CliOpenFile& cof)
|
|||||||
|
|
||||||
itemCof.includeLayers.push_back(layer->name());
|
itemCof.includeLayers.push_back(layer->name());
|
||||||
}
|
}
|
||||||
if (frameTag) {
|
if (tag) {
|
||||||
fnInfo
|
fnInfo
|
||||||
.innerTagName(frameTag->name())
|
.innerTagName(tag->name())
|
||||||
.outerTagName(frameTag->name());
|
.outerTagName(tag->name());
|
||||||
itemCof.frameTag = frameTag->name();
|
itemCof.tag = tag->name();
|
||||||
}
|
}
|
||||||
if (slice) {
|
if (slice) {
|
||||||
fnInfo.sliceName(slice->name());
|
fnInfo.sliceName(slice->name());
|
||||||
|
@ -21,11 +21,11 @@
|
|||||||
#include "app/file/palette_file.h"
|
#include "app/file/palette_file.h"
|
||||||
#include "app/ui_context.h"
|
#include "app/ui_context.h"
|
||||||
#include "base/convert_to.h"
|
#include "base/convert_to.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/layer.h"
|
#include "doc/layer.h"
|
||||||
#include "doc/palette.h"
|
#include "doc/palette.h"
|
||||||
#include "doc/slice.h"
|
#include "doc/slice.h"
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
|
|
||||||
#ifdef ENABLE_SCRIPTING
|
#ifdef ENABLE_SCRIPTING
|
||||||
#include "app/app.h"
|
#include "app/app.h"
|
||||||
@ -65,7 +65,7 @@ void DefaultCliDelegate::afterOpenFile(const CliOpenFile& cof)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cof.listTags) {
|
if (cof.listTags) {
|
||||||
for (doc::FrameTag* tag : cof.document->sprite()->frameTags())
|
for (doc::Tag* tag : cof.document->sprite()->tags())
|
||||||
std::cout << tag->name() << "\n";
|
std::cout << tag->name() << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,8 +82,8 @@ void DefaultCliDelegate::saveFile(Context* ctx, const CliOpenFile& cof)
|
|||||||
params.set("filename", cof.filename.c_str());
|
params.set("filename", cof.filename.c_str());
|
||||||
params.set("filename-format", cof.filenameFormat.c_str());
|
params.set("filename-format", cof.filenameFormat.c_str());
|
||||||
|
|
||||||
if (cof.hasFrameTag()) {
|
if (cof.hasTag()) {
|
||||||
params.set("frame-tag", cof.frameTag.c_str());
|
params.set("frame-tag", cof.tag.c_str());
|
||||||
}
|
}
|
||||||
if (cof.hasFrameRange()) {
|
if (cof.hasFrameRange()) {
|
||||||
params.set("from-frame", base::convert_to<std::string>(cof.fromFrame).c_str());
|
params.set("from-frame", base::convert_to<std::string>(cof.fromFrame).c_str());
|
||||||
|
@ -115,8 +115,8 @@ void PreviewCliDelegate::saveFile(Context* ctx, const CliOpenFile& cof)
|
|||||||
std::cout << " - Visible Layer:\n";
|
std::cout << " - Visible Layer:\n";
|
||||||
showLayerVisibility(cof.document->sprite()->root(), " ");
|
showLayerVisibility(cof.document->sprite()->root(), " ");
|
||||||
|
|
||||||
if (cof.hasFrameTag()) {
|
if (cof.hasTag()) {
|
||||||
std::cout << " - Frame tag: '" << cof.frameTag << "'\n";
|
std::cout << " - Tag: '" << cof.tag << "'\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cof.hasSlice()) {
|
if (cof.hasSlice()) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -8,47 +9,47 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "app/cmd/add_frame_tag.h"
|
#include "app/cmd/add_tag.h"
|
||||||
|
|
||||||
#include "app/doc.h"
|
#include "app/doc.h"
|
||||||
#include "app/doc_event.h"
|
#include "app/doc_event.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/frame_tag_io.h"
|
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
|
#include "doc/tag_io.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
namespace cmd {
|
namespace cmd {
|
||||||
|
|
||||||
using namespace doc;
|
using namespace doc;
|
||||||
|
|
||||||
AddFrameTag::AddFrameTag(Sprite* sprite, FrameTag* frameTag)
|
AddTag::AddTag(Sprite* sprite, Tag* tag)
|
||||||
: WithSprite(sprite)
|
: WithSprite(sprite)
|
||||||
, WithFrameTag(frameTag)
|
, WithTag(tag)
|
||||||
, m_size(0)
|
, m_size(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddFrameTag::onExecute()
|
void AddTag::onExecute()
|
||||||
{
|
{
|
||||||
Sprite* sprite = this->sprite();
|
Sprite* sprite = this->sprite();
|
||||||
FrameTag* frameTag = this->frameTag();
|
Tag* tag = this->tag();
|
||||||
|
|
||||||
sprite->frameTags().add(frameTag);
|
sprite->tags().add(tag);
|
||||||
sprite->incrementVersion();
|
sprite->incrementVersion();
|
||||||
|
|
||||||
// Notify observers about the new frame.
|
// Notify observers about the new frame.
|
||||||
Doc* doc = static_cast<Doc*>(sprite->document());
|
Doc* doc = static_cast<Doc*>(sprite->document());
|
||||||
DocEvent ev(doc);
|
DocEvent ev(doc);
|
||||||
ev.sprite(sprite);
|
ev.sprite(sprite);
|
||||||
ev.frameTag(frameTag);
|
ev.tag(tag);
|
||||||
doc->notify_observers<DocEvent&>(&DocObserver::onAddFrameTag, ev);
|
doc->notify_observers<DocEvent&>(&DocObserver::onAddTag, ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddFrameTag::onUndo()
|
void AddTag::onUndo()
|
||||||
{
|
{
|
||||||
Sprite* sprite = this->sprite();
|
Sprite* sprite = this->sprite();
|
||||||
FrameTag* frameTag = this->frameTag();
|
Tag* tag = this->tag();
|
||||||
write_frame_tag(m_stream, frameTag);
|
write_tag(m_stream, tag);
|
||||||
m_size = size_t(m_stream.tellp());
|
m_size = size_t(m_stream.tellp());
|
||||||
|
|
||||||
// Notify observers about the new frame.
|
// Notify observers about the new frame.
|
||||||
@ -56,21 +57,21 @@ void AddFrameTag::onUndo()
|
|||||||
Doc* doc = static_cast<Doc*>(sprite->document());
|
Doc* doc = static_cast<Doc*>(sprite->document());
|
||||||
DocEvent ev(doc);
|
DocEvent ev(doc);
|
||||||
ev.sprite(sprite);
|
ev.sprite(sprite);
|
||||||
ev.frameTag(frameTag);
|
ev.tag(tag);
|
||||||
doc->notify_observers<DocEvent&>(&DocObserver::onRemoveFrameTag, ev);
|
doc->notify_observers<DocEvent&>(&DocObserver::onRemoveTag, ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprite->frameTags().remove(frameTag);
|
sprite->tags().remove(tag);
|
||||||
sprite->incrementVersion();
|
sprite->incrementVersion();
|
||||||
delete frameTag;
|
delete tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddFrameTag::onRedo()
|
void AddTag::onRedo()
|
||||||
{
|
{
|
||||||
Sprite* sprite = this->sprite();
|
Sprite* sprite = this->sprite();
|
||||||
FrameTag* frameTag = read_frame_tag(m_stream);
|
Tag* tag = read_tag(m_stream);
|
||||||
|
|
||||||
sprite->frameTags().add(frameTag);
|
sprite->tags().add(tag);
|
||||||
sprite->incrementVersion();
|
sprite->incrementVersion();
|
||||||
|
|
||||||
m_stream.str(std::string());
|
m_stream.str(std::string());
|
||||||
@ -81,8 +82,8 @@ void AddFrameTag::onRedo()
|
|||||||
Doc* doc = static_cast<Doc*>(sprite->document());
|
Doc* doc = static_cast<Doc*>(sprite->document());
|
||||||
DocEvent ev(doc);
|
DocEvent ev(doc);
|
||||||
ev.sprite(sprite);
|
ev.sprite(sprite);
|
||||||
ev.frameTag(frameTag);
|
ev.tag(tag);
|
||||||
doc->notify_observers<DocEvent&>(&DocObserver::onAddFrameTag, ev);
|
doc->notify_observers<DocEvent&>(&DocObserver::onAddTag, ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace cmd
|
} // namespace cmd
|
@ -1,15 +1,16 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
|
|
||||||
#ifndef APP_CMD_ADD_FRAME_TAG_H_INCLUDED
|
#ifndef APP_CMD_ADD_TAG_H_INCLUDED
|
||||||
#define APP_CMD_ADD_FRAME_TAG_H_INCLUDED
|
#define APP_CMD_ADD_TAG_H_INCLUDED
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "app/cmd.h"
|
#include "app/cmd.h"
|
||||||
#include "app/cmd/with_frame_tag.h"
|
#include "app/cmd/with_tag.h"
|
||||||
#include "app/cmd/with_sprite.h"
|
#include "app/cmd/with_sprite.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@ -18,11 +19,11 @@ namespace app {
|
|||||||
namespace cmd {
|
namespace cmd {
|
||||||
using namespace doc;
|
using namespace doc;
|
||||||
|
|
||||||
class AddFrameTag : public Cmd
|
class AddTag : public Cmd
|
||||||
, public WithSprite
|
, public WithSprite
|
||||||
, public WithFrameTag {
|
, public WithTag {
|
||||||
public:
|
public:
|
||||||
AddFrameTag(Sprite* sprite, FrameTag* tag);
|
AddTag(Sprite* sprite, Tag* tag);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onExecute() override;
|
void onExecute() override;
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2015 David Capello
|
// Copyright (C) 2001-2015 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -8,31 +9,31 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "app/cmd/remove_frame_tag.h"
|
#include "app/cmd/remove_tag.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
namespace cmd {
|
namespace cmd {
|
||||||
|
|
||||||
using namespace doc;
|
using namespace doc;
|
||||||
|
|
||||||
RemoveFrameTag::RemoveFrameTag(Sprite* sprite, FrameTag* tag)
|
RemoveTag::RemoveTag(Sprite* sprite, Tag* tag)
|
||||||
: AddFrameTag(sprite, tag)
|
: AddTag(sprite, tag)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveFrameTag::onExecute()
|
void RemoveTag::onExecute()
|
||||||
{
|
{
|
||||||
AddFrameTag::onUndo();
|
AddTag::onUndo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveFrameTag::onUndo()
|
void RemoveTag::onUndo()
|
||||||
{
|
{
|
||||||
AddFrameTag::onRedo();
|
AddTag::onRedo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveFrameTag::onRedo()
|
void RemoveTag::onRedo()
|
||||||
{
|
{
|
||||||
AddFrameTag::onUndo();
|
AddTag::onUndo();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace cmd
|
} // namespace cmd
|
@ -1,22 +1,23 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2015 David Capello
|
// Copyright (C) 2001-2015 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
|
|
||||||
#ifndef APP_CMD_REMOVE_FRAME_TAG_H_INCLUDED
|
#ifndef APP_CMD_REMOVE_TAG_H_INCLUDED
|
||||||
#define APP_CMD_REMOVE_FRAME_TAG_H_INCLUDED
|
#define APP_CMD_REMOVE_TAG_H_INCLUDED
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "app/cmd/add_frame_tag.h"
|
#include "app/cmd/add_tag.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
namespace cmd {
|
namespace cmd {
|
||||||
using namespace doc;
|
using namespace doc;
|
||||||
|
|
||||||
class RemoveFrameTag : public AddFrameTag {
|
class RemoveTag : public AddTag {
|
||||||
public:
|
public:
|
||||||
RemoveFrameTag(Sprite* sprite, FrameTag* tag);
|
RemoveTag(Sprite* sprite, Tag* tag);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onExecute() override;
|
void onExecute() override;
|
@ -1,38 +0,0 @@
|
|||||||
// Aseprite
|
|
||||||
// Copyright (C) 2001-2015 David Capello
|
|
||||||
//
|
|
||||||
// This program is distributed under the terms of
|
|
||||||
// the End-User License Agreement for Aseprite.
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "app/cmd/set_frame_tag_anidir.h"
|
|
||||||
|
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
|
|
||||||
namespace app {
|
|
||||||
namespace cmd {
|
|
||||||
|
|
||||||
SetFrameTagAniDir::SetFrameTagAniDir(FrameTag* tag, doc::AniDir anidir)
|
|
||||||
: WithFrameTag(tag)
|
|
||||||
, m_oldAniDir(tag->aniDir())
|
|
||||||
, m_newAniDir(anidir)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetFrameTagAniDir::onExecute()
|
|
||||||
{
|
|
||||||
frameTag()->setAniDir(m_newAniDir);
|
|
||||||
frameTag()->incrementVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetFrameTagAniDir::onUndo()
|
|
||||||
{
|
|
||||||
frameTag()->setAniDir(m_oldAniDir);
|
|
||||||
frameTag()->incrementVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace cmd
|
|
||||||
} // namespace app
|
|
@ -1,38 +0,0 @@
|
|||||||
// Aseprite
|
|
||||||
// Copyright (C) 2001-2015 David Capello
|
|
||||||
//
|
|
||||||
// This program is distributed under the terms of
|
|
||||||
// the End-User License Agreement for Aseprite.
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "app/cmd/set_frame_tag_color.h"
|
|
||||||
|
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
|
|
||||||
namespace app {
|
|
||||||
namespace cmd {
|
|
||||||
|
|
||||||
SetFrameTagColor::SetFrameTagColor(FrameTag* tag, doc::color_t color)
|
|
||||||
: WithFrameTag(tag)
|
|
||||||
, m_oldColor(tag->color())
|
|
||||||
, m_newColor(color)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetFrameTagColor::onExecute()
|
|
||||||
{
|
|
||||||
frameTag()->setColor(m_newColor);
|
|
||||||
frameTag()->incrementVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetFrameTagColor::onUndo()
|
|
||||||
{
|
|
||||||
frameTag()->setColor(m_oldColor);
|
|
||||||
frameTag()->incrementVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace cmd
|
|
||||||
} // namespace app
|
|
@ -1,38 +0,0 @@
|
|||||||
// Aseprite
|
|
||||||
// Copyright (C) 2001-2015 David Capello
|
|
||||||
//
|
|
||||||
// This program is distributed under the terms of
|
|
||||||
// the End-User License Agreement for Aseprite.
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "app/cmd/set_frame_tag_name.h"
|
|
||||||
|
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
|
|
||||||
namespace app {
|
|
||||||
namespace cmd {
|
|
||||||
|
|
||||||
SetFrameTagName::SetFrameTagName(FrameTag* tag, const std::string& name)
|
|
||||||
: WithFrameTag(tag)
|
|
||||||
, m_oldName(tag->name())
|
|
||||||
, m_newName(name)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetFrameTagName::onExecute()
|
|
||||||
{
|
|
||||||
frameTag()->setName(m_newName);
|
|
||||||
frameTag()->incrementVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetFrameTagName::onUndo()
|
|
||||||
{
|
|
||||||
frameTag()->setName(m_oldName);
|
|
||||||
frameTag()->incrementVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace cmd
|
|
||||||
} // namespace app
|
|
@ -1,40 +0,0 @@
|
|||||||
// Aseprite
|
|
||||||
// Copyright (C) 2001-2015 David Capello
|
|
||||||
//
|
|
||||||
// This program is distributed under the terms of
|
|
||||||
// the End-User License Agreement for Aseprite.
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "app/cmd/set_frame_tag_range.h"
|
|
||||||
|
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
|
|
||||||
namespace app {
|
|
||||||
namespace cmd {
|
|
||||||
|
|
||||||
SetFrameTagRange::SetFrameTagRange(FrameTag* tag, frame_t from, frame_t to)
|
|
||||||
: WithFrameTag(tag)
|
|
||||||
, m_oldFrom(tag->fromFrame())
|
|
||||||
, m_oldTo(tag->toFrame())
|
|
||||||
, m_newFrom(from)
|
|
||||||
, m_newTo(to)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetFrameTagRange::onExecute()
|
|
||||||
{
|
|
||||||
frameTag()->setFrameRange(m_newFrom, m_newTo);
|
|
||||||
frameTag()->incrementVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetFrameTagRange::onUndo()
|
|
||||||
{
|
|
||||||
frameTag()->setFrameRange(m_oldFrom, m_oldTo);
|
|
||||||
frameTag()->incrementVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace cmd
|
|
||||||
} // namespace app
|
|
39
src/app/cmd/set_tag_anidir.cpp
Normal file
39
src/app/cmd/set_tag_anidir.cpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
|
// Copyright (C) 2001-2015 David Capello
|
||||||
|
//
|
||||||
|
// This program is distributed under the terms of
|
||||||
|
// the End-User License Agreement for Aseprite.
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "app/cmd/set_tag_anidir.h"
|
||||||
|
|
||||||
|
#include "doc/tag.h"
|
||||||
|
|
||||||
|
namespace app {
|
||||||
|
namespace cmd {
|
||||||
|
|
||||||
|
SetTagAniDir::SetTagAniDir(Tag* tag, doc::AniDir anidir)
|
||||||
|
: WithTag(tag)
|
||||||
|
, m_oldAniDir(tag->aniDir())
|
||||||
|
, m_newAniDir(anidir)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetTagAniDir::onExecute()
|
||||||
|
{
|
||||||
|
tag()->setAniDir(m_newAniDir);
|
||||||
|
tag()->incrementVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetTagAniDir::onUndo()
|
||||||
|
{
|
||||||
|
tag()->setAniDir(m_oldAniDir);
|
||||||
|
tag()->incrementVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace cmd
|
||||||
|
} // namespace app
|
@ -1,25 +1,26 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2015 David Capello
|
// Copyright (C) 2001-2015 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
|
|
||||||
#ifndef APP_CMD_SET_FRAME_TAG_ANIDIR_H_INCLUDED
|
#ifndef APP_CMD_SET_TAG_ANIDIR_H_INCLUDED
|
||||||
#define APP_CMD_SET_FRAME_TAG_ANIDIR_H_INCLUDED
|
#define APP_CMD_SET_TAG_ANIDIR_H_INCLUDED
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "app/cmd.h"
|
#include "app/cmd.h"
|
||||||
#include "app/cmd/with_frame_tag.h"
|
#include "app/cmd/with_tag.h"
|
||||||
#include "doc/anidir.h"
|
#include "doc/anidir.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
namespace cmd {
|
namespace cmd {
|
||||||
using namespace doc;
|
using namespace doc;
|
||||||
|
|
||||||
class SetFrameTagAniDir : public Cmd
|
class SetTagAniDir : public Cmd
|
||||||
, public WithFrameTag {
|
, public WithTag {
|
||||||
public:
|
public:
|
||||||
SetFrameTagAniDir(FrameTag* tag, doc::AniDir anidir);
|
SetTagAniDir(Tag* tag, doc::AniDir anidir);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onExecute() override;
|
void onExecute() override;
|
39
src/app/cmd/set_tag_color.cpp
Normal file
39
src/app/cmd/set_tag_color.cpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
|
// Copyright (C) 2001-2015 David Capello
|
||||||
|
//
|
||||||
|
// This program is distributed under the terms of
|
||||||
|
// the End-User License Agreement for Aseprite.
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "app/cmd/set_tag_color.h"
|
||||||
|
|
||||||
|
#include "doc/tag.h"
|
||||||
|
|
||||||
|
namespace app {
|
||||||
|
namespace cmd {
|
||||||
|
|
||||||
|
SetTagColor::SetTagColor(Tag* tag, doc::color_t color)
|
||||||
|
: WithTag(tag)
|
||||||
|
, m_oldColor(tag->color())
|
||||||
|
, m_newColor(color)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetTagColor::onExecute()
|
||||||
|
{
|
||||||
|
tag()->setColor(m_newColor);
|
||||||
|
tag()->incrementVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetTagColor::onUndo()
|
||||||
|
{
|
||||||
|
tag()->setColor(m_oldColor);
|
||||||
|
tag()->incrementVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace cmd
|
||||||
|
} // namespace app
|
@ -1,25 +1,26 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2015 David Capello
|
// Copyright (C) 2001-2015 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
|
|
||||||
#ifndef APP_CMD_SET_FRAME_TAG_COLOR_H_INCLUDED
|
#ifndef APP_CMD_SET_TAG_COLOR_H_INCLUDED
|
||||||
#define APP_CMD_SET_FRAME_TAG_COLOR_H_INCLUDED
|
#define APP_CMD_SET_TAG_COLOR_H_INCLUDED
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "app/cmd.h"
|
#include "app/cmd.h"
|
||||||
#include "app/cmd/with_frame_tag.h"
|
#include "app/cmd/with_tag.h"
|
||||||
#include "doc/color.h"
|
#include "doc/color.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
namespace cmd {
|
namespace cmd {
|
||||||
using namespace doc;
|
using namespace doc;
|
||||||
|
|
||||||
class SetFrameTagColor : public Cmd
|
class SetTagColor : public Cmd
|
||||||
, public WithFrameTag {
|
, public WithTag {
|
||||||
public:
|
public:
|
||||||
SetFrameTagColor(FrameTag* tag, doc::color_t color);
|
SetTagColor(Tag* tag, doc::color_t color);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onExecute() override;
|
void onExecute() override;
|
39
src/app/cmd/set_tag_name.cpp
Normal file
39
src/app/cmd/set_tag_name.cpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
|
// Copyright (C) 2001-2015 David Capello
|
||||||
|
//
|
||||||
|
// This program is distributed under the terms of
|
||||||
|
// the End-User License Agreement for Aseprite.
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "app/cmd/set_tag_name.h"
|
||||||
|
|
||||||
|
#include "doc/tag.h"
|
||||||
|
|
||||||
|
namespace app {
|
||||||
|
namespace cmd {
|
||||||
|
|
||||||
|
SetTagName::SetTagName(doc::Tag* tag, const std::string& name)
|
||||||
|
: WithTag(tag)
|
||||||
|
, m_oldName(tag->name())
|
||||||
|
, m_newName(name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetTagName::onExecute()
|
||||||
|
{
|
||||||
|
tag()->setName(m_newName);
|
||||||
|
tag()->incrementVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetTagName::onUndo()
|
||||||
|
{
|
||||||
|
tag()->setName(m_oldName);
|
||||||
|
tag()->incrementVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace cmd
|
||||||
|
} // namespace app
|
@ -1,15 +1,16 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2015 David Capello
|
// Copyright (C) 2001-2015 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
|
|
||||||
#ifndef APP_CMD_SET_FRAME_TAG_NAME_H_INCLUDED
|
#ifndef APP_CMD_SET_TAG_NAME_H_INCLUDED
|
||||||
#define APP_CMD_SET_FRAME_TAG_NAME_H_INCLUDED
|
#define APP_CMD_SET_TAG_NAME_H_INCLUDED
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "app/cmd.h"
|
#include "app/cmd.h"
|
||||||
#include "app/cmd/with_frame_tag.h"
|
#include "app/cmd/with_tag.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -17,10 +18,10 @@ namespace app {
|
|||||||
namespace cmd {
|
namespace cmd {
|
||||||
using namespace doc;
|
using namespace doc;
|
||||||
|
|
||||||
class SetFrameTagName : public Cmd
|
class SetTagName : public Cmd
|
||||||
, public WithFrameTag {
|
, public WithTag {
|
||||||
public:
|
public:
|
||||||
SetFrameTagName(FrameTag* tag, const std::string& name);
|
SetTagName(Tag* tag, const std::string& name);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onExecute() override;
|
void onExecute() override;
|
41
src/app/cmd/set_tag_range.cpp
Normal file
41
src/app/cmd/set_tag_range.cpp
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
|
// Copyright (C) 2001-2015 David Capello
|
||||||
|
//
|
||||||
|
// This program is distributed under the terms of
|
||||||
|
// the End-User License Agreement for Aseprite.
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "app/cmd/set_tag_range.h"
|
||||||
|
|
||||||
|
#include "doc/tag.h"
|
||||||
|
|
||||||
|
namespace app {
|
||||||
|
namespace cmd {
|
||||||
|
|
||||||
|
SetTagRange::SetTagRange(Tag* tag, frame_t from, frame_t to)
|
||||||
|
: WithTag(tag)
|
||||||
|
, m_oldFrom(tag->fromFrame())
|
||||||
|
, m_oldTo(tag->toFrame())
|
||||||
|
, m_newFrom(from)
|
||||||
|
, m_newTo(to)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetTagRange::onExecute()
|
||||||
|
{
|
||||||
|
tag()->setFrameRange(m_newFrom, m_newTo);
|
||||||
|
tag()->incrementVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetTagRange::onUndo()
|
||||||
|
{
|
||||||
|
tag()->setFrameRange(m_oldFrom, m_oldTo);
|
||||||
|
tag()->incrementVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace cmd
|
||||||
|
} // namespace app
|
@ -1,25 +1,26 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2015 David Capello
|
// Copyright (C) 2001-2015 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
|
|
||||||
#ifndef APP_CMD_SET_FRAME_TAG_RANGE_H_INCLUDED
|
#ifndef APP_CMD_SET_TAG_RANGE_H_INCLUDED
|
||||||
#define APP_CMD_SET_FRAME_TAG_RANGE_H_INCLUDED
|
#define APP_CMD_SET_TAG_RANGE_H_INCLUDED
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "app/cmd.h"
|
#include "app/cmd.h"
|
||||||
#include "app/cmd/with_frame_tag.h"
|
#include "app/cmd/with_tag.h"
|
||||||
#include "doc/frame.h"
|
#include "doc/frame.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
namespace cmd {
|
namespace cmd {
|
||||||
using namespace doc;
|
using namespace doc;
|
||||||
|
|
||||||
class SetFrameTagRange : public Cmd
|
class SetTagRange : public Cmd
|
||||||
, public WithFrameTag {
|
, public WithTag {
|
||||||
public:
|
public:
|
||||||
SetFrameTagRange(FrameTag* tag, frame_t from, frame_t to);
|
SetTagRange(Tag* tag, frame_t from, frame_t to);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onExecute() override;
|
void onExecute() override;
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2015 David Capello
|
// Copyright (C) 2001-2015 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -8,23 +9,23 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "app/cmd/with_frame_tag.h"
|
#include "app/cmd/with_tag.h"
|
||||||
|
|
||||||
#include "doc/frame_tag.h"
|
#include "doc/tag.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
namespace cmd {
|
namespace cmd {
|
||||||
|
|
||||||
using namespace doc;
|
using namespace doc;
|
||||||
|
|
||||||
WithFrameTag::WithFrameTag(FrameTag* frameTag)
|
WithTag::WithTag(Tag* tag)
|
||||||
: m_frameTagId(frameTag->id())
|
: m_tagId(tag->id())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameTag* WithFrameTag::frameTag()
|
Tag* WithTag::tag()
|
||||||
{
|
{
|
||||||
return get<FrameTag>(m_frameTagId);
|
return get<Tag>(m_tagId);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace cmd
|
} // namespace cmd
|
@ -1,30 +1,31 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2015 David Capello
|
// Copyright (C) 2001-2015 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
|
|
||||||
#ifndef APP_CMD_WITH_FRAME_TAG_H_INCLUDED
|
#ifndef APP_CMD_WITH_TAG_H_INCLUDED
|
||||||
#define APP_CMD_WITH_FRAME_TAG_H_INCLUDED
|
#define APP_CMD_WITH_TAG_H_INCLUDED
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "doc/object_id.h"
|
#include "doc/object_id.h"
|
||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
class FrameTag;
|
class Tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
namespace cmd {
|
namespace cmd {
|
||||||
using namespace doc;
|
using namespace doc;
|
||||||
|
|
||||||
class WithFrameTag {
|
class WithTag {
|
||||||
public:
|
public:
|
||||||
WithFrameTag(FrameTag* tag);
|
WithTag(Tag* tag);
|
||||||
FrameTag* frameTag();
|
Tag* tag();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ObjectId m_frameTagId;
|
ObjectId m_tagId;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cmd
|
} // namespace cmd
|
@ -31,8 +31,8 @@
|
|||||||
#include "base/convert_to.h"
|
#include "base/convert_to.h"
|
||||||
#include "base/fs.h"
|
#include "base/fs.h"
|
||||||
#include "base/string.h"
|
#include "base/string.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/layer.h"
|
#include "doc/layer.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
|
|
||||||
#include "export_sprite_sheet.xml.h"
|
#include "export_sprite_sheet.xml.h"
|
||||||
@ -427,7 +427,7 @@ public:
|
|||||||
return layers()->getValue();
|
return layers()->getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string frameTagValue() const {
|
std::string tagValue() const {
|
||||||
return frames()->getValue();
|
return frames()->getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,7 +435,7 @@ public:
|
|||||||
return listLayers()->isSelected();
|
return listLayers()->isSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool listFrameTagsValue() const {
|
bool listTagsValue() const {
|
||||||
return listTags()->isSelected();
|
return listTags()->isSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -602,7 +602,7 @@ private:
|
|||||||
void updateSizeFields() {
|
void updateSizeFields() {
|
||||||
SelectedFrames selFrames;
|
SelectedFrames selFrames;
|
||||||
calculate_selected_frames(m_site,
|
calculate_selected_frames(m_site,
|
||||||
frameTagValue(),
|
tagValue(),
|
||||||
selFrames);
|
selFrames);
|
||||||
|
|
||||||
frame_t nframes = selFrames.size();
|
frame_t nframes = selFrames.size();
|
||||||
@ -737,9 +737,9 @@ void ExportSpriteSheetCommand::onExecute(Context* context)
|
|||||||
docPref.spriteSheet.extrude (params.extrude (window.extrudeValue()));
|
docPref.spriteSheet.extrude (params.extrude (window.extrudeValue()));
|
||||||
docPref.spriteSheet.openGenerated (params.openGenerated (window.openGeneratedValue()));
|
docPref.spriteSheet.openGenerated (params.openGenerated (window.openGeneratedValue()));
|
||||||
docPref.spriteSheet.layer (params.layer (window.layerValue()));
|
docPref.spriteSheet.layer (params.layer (window.layerValue()));
|
||||||
docPref.spriteSheet.frameTag (params.tag (window.frameTagValue()));
|
docPref.spriteSheet.frameTag (params.tag (window.tagValue()));
|
||||||
docPref.spriteSheet.listLayers (params.listLayers (window.listLayersValue()));
|
docPref.spriteSheet.listLayers (params.listLayers (window.listLayersValue()));
|
||||||
docPref.spriteSheet.listFrameTags (params.listTags (window.listFrameTagsValue()));
|
docPref.spriteSheet.listFrameTags (params.listTags (window.listTagsValue()));
|
||||||
docPref.spriteSheet.listSlices (params.listSlices (window.listSlicesValue()));
|
docPref.spriteSheet.listSlices (params.listSlices (window.listSlicesValue()));
|
||||||
|
|
||||||
// Default preferences for future sprites
|
// Default preferences for future sprites
|
||||||
@ -787,8 +787,7 @@ void ExportSpriteSheetCommand::onExecute(Context* context)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
SelectedFrames selFrames;
|
SelectedFrames selFrames;
|
||||||
FrameTag* frameTag =
|
Tag* tag = calculate_selected_frames(site, tagName, selFrames);
|
||||||
calculate_selected_frames(site, tagName, selFrames);
|
|
||||||
|
|
||||||
frame_t nframes = selFrames.size();
|
frame_t nframes = selFrames.size();
|
||||||
ASSERT(nframes > 0);
|
ASSERT(nframes > 0);
|
||||||
@ -861,9 +860,9 @@ void ExportSpriteSheetCommand::onExecute(Context* context)
|
|||||||
exporter.setTrimByGrid(trimByGrid);
|
exporter.setTrimByGrid(trimByGrid);
|
||||||
exporter.setExtrude(extrude);
|
exporter.setExtrude(extrude);
|
||||||
if (listLayers) exporter.setListLayers(true);
|
if (listLayers) exporter.setListLayers(true);
|
||||||
if (listTags) exporter.setListFrameTags(true);
|
if (listTags) exporter.setListTags(true);
|
||||||
if (listSlices) exporter.setListSlices(true);
|
if (listSlices) exporter.setListSlices(true);
|
||||||
exporter.addDocument(document, frameTag,
|
exporter.addDocument(document, tag,
|
||||||
(!selLayers.empty() ? &selLayers: nullptr),
|
(!selLayers.empty() ? &selLayers: nullptr),
|
||||||
(!selFrames.empty() ? &selFrames: nullptr));
|
(!selFrames.empty() ? &selFrames: nullptr));
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -8,21 +9,21 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "app/cmd/set_frame_tag_anidir.h"
|
#include "app/cmd/set_tag_anidir.h"
|
||||||
#include "app/cmd/set_frame_tag_color.h"
|
#include "app/cmd/set_tag_color.h"
|
||||||
#include "app/cmd/set_frame_tag_name.h"
|
#include "app/cmd/set_tag_name.h"
|
||||||
#include "app/cmd/set_frame_tag_range.h"
|
#include "app/cmd/set_tag_range.h"
|
||||||
#include "app/color.h"
|
#include "app/color.h"
|
||||||
#include "app/commands/command.h"
|
#include "app/commands/command.h"
|
||||||
#include "app/commands/params.h"
|
#include "app/commands/params.h"
|
||||||
#include "app/context_access.h"
|
#include "app/context_access.h"
|
||||||
#include "app/loop_tag.h"
|
#include "app/loop_tag.h"
|
||||||
#include "app/tx.h"
|
#include "app/tx.h"
|
||||||
#include "app/ui/frame_tag_window.h"
|
#include "app/ui/tag_window.h"
|
||||||
#include "base/convert_to.h"
|
#include "base/convert_to.h"
|
||||||
#include "doc/anidir.h"
|
#include "doc/anidir.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
@ -69,44 +70,44 @@ void FrameTagPropertiesCommand::onExecute(Context* context)
|
|||||||
const ContextReader reader(context);
|
const ContextReader reader(context);
|
||||||
const Sprite* sprite = reader.sprite();
|
const Sprite* sprite = reader.sprite();
|
||||||
frame_t frame = reader.frame();
|
frame_t frame = reader.frame();
|
||||||
const FrameTag* foundTag = nullptr;
|
const Tag* foundTag = nullptr;
|
||||||
|
|
||||||
if (!m_tagName.empty())
|
if (!m_tagName.empty())
|
||||||
foundTag = sprite->frameTags().getByName(m_tagName);
|
foundTag = sprite->tags().getByName(m_tagName);
|
||||||
else if (m_tagId != NullId)
|
else if (m_tagId != NullId)
|
||||||
foundTag = sprite->frameTags().getById(m_tagId);
|
foundTag = sprite->tags().getById(m_tagId);
|
||||||
else
|
else
|
||||||
foundTag = sprite->frameTags().innerTag(frame);
|
foundTag = sprite->tags().innerTag(frame);
|
||||||
|
|
||||||
if (!foundTag)
|
if (!foundTag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FrameTagWindow window(sprite, foundTag);
|
TagWindow window(sprite, foundTag);
|
||||||
if (!window.show())
|
if (!window.show())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ContextWriter writer(reader);
|
ContextWriter writer(reader);
|
||||||
Tx tx(writer.context(), "Change Frame Tag Properties");
|
Tx tx(writer.context(), friendlyName());
|
||||||
FrameTag* tag = const_cast<FrameTag*>(foundTag);
|
Tag* tag = const_cast<Tag*>(foundTag);
|
||||||
|
|
||||||
std::string name = window.nameValue();
|
std::string name = window.nameValue();
|
||||||
if (tag->name() != name)
|
if (tag->name() != name)
|
||||||
tx(new cmd::SetFrameTagName(tag, name));
|
tx(new cmd::SetTagName(tag, name));
|
||||||
|
|
||||||
doc::frame_t from, to;
|
doc::frame_t from, to;
|
||||||
window.rangeValue(from, to);
|
window.rangeValue(from, to);
|
||||||
if (tag->fromFrame() != from ||
|
if (tag->fromFrame() != from ||
|
||||||
tag->toFrame() != to) {
|
tag->toFrame() != to) {
|
||||||
tx(new cmd::SetFrameTagRange(tag, from, to));
|
tx(new cmd::SetTagRange(tag, from, to));
|
||||||
}
|
}
|
||||||
|
|
||||||
doc::color_t docColor = window.colorValue();
|
doc::color_t docColor = window.colorValue();
|
||||||
if (tag->color() != docColor)
|
if (tag->color() != docColor)
|
||||||
tx(new cmd::SetFrameTagColor(tag, docColor));
|
tx(new cmd::SetTagColor(tag, docColor));
|
||||||
|
|
||||||
doc::AniDir anidir = window.aniDirValue();
|
doc::AniDir anidir = window.aniDirValue();
|
||||||
if (tag->aniDir() != anidir)
|
if (tag->aniDir() != anidir)
|
||||||
tx(new cmd::SetFrameTagAniDir(tag, anidir));
|
tx(new cmd::SetTagAniDir(tag, anidir));
|
||||||
|
|
||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -17,8 +18,8 @@
|
|||||||
#include "app/ui/editor/editor.h"
|
#include "app/ui/editor/editor.h"
|
||||||
#include "app/ui/editor/editor_customization_delegate.h"
|
#include "app/ui/editor/editor_customization_delegate.h"
|
||||||
#include "app/ui/search_entry.h"
|
#include "app/ui/search_entry.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
#include "ui/combobox.h"
|
#include "ui/combobox.h"
|
||||||
#include "ui/window.h"
|
#include "ui/window.h"
|
||||||
|
|
||||||
@ -66,10 +67,10 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
frame_t onGetFrame(Editor* editor) override {
|
frame_t onGetFrame(Editor* editor) override {
|
||||||
frame_t frame = editor->frame();
|
frame_t frame = editor->frame();
|
||||||
FrameTag* tag = editor
|
Tag* tag = editor
|
||||||
->getCustomizationDelegate()
|
->getCustomizationDelegate()
|
||||||
->getFrameTagProvider()
|
->getTagProvider()
|
||||||
->getFrameTagByFrame(frame, false);
|
->getTagByFrame(frame, false);
|
||||||
return (tag ? tag->fromFrame(): 0);
|
return (tag ? tag->fromFrame(): 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -108,10 +109,10 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
frame_t onGetFrame(Editor* editor) override {
|
frame_t onGetFrame(Editor* editor) override {
|
||||||
frame_t frame = editor->frame();
|
frame_t frame = editor->frame();
|
||||||
FrameTag* tag = editor
|
Tag* tag = editor
|
||||||
->getCustomizationDelegate()
|
->getCustomizationDelegate()
|
||||||
->getFrameTagProvider()
|
->getTagProvider()
|
||||||
->getFrameTagByFrame(frame, false);
|
->getTagByFrame(frame, false);
|
||||||
frame_t first = (tag ? tag->fromFrame(): 0);
|
frame_t first = (tag ? tag->fromFrame(): 0);
|
||||||
frame_t last = (tag ? tag->toFrame(): editor->sprite()->lastFrame());
|
frame_t last = (tag ? tag->toFrame(): editor->sprite()->lastFrame());
|
||||||
|
|
||||||
@ -126,10 +127,10 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
frame_t onGetFrame(Editor* editor) override {
|
frame_t onGetFrame(Editor* editor) override {
|
||||||
frame_t frame = editor->frame();
|
frame_t frame = editor->frame();
|
||||||
FrameTag* tag = editor
|
Tag* tag = editor
|
||||||
->getCustomizationDelegate()
|
->getCustomizationDelegate()
|
||||||
->getFrameTagProvider()
|
->getTagProvider()
|
||||||
->getFrameTagByFrame(frame, false);
|
->getTagByFrame(frame, false);
|
||||||
frame_t first = (tag ? tag->fromFrame(): 0);
|
frame_t first = (tag ? tag->fromFrame(): 0);
|
||||||
frame_t last = (tag ? tag->toFrame(): editor->sprite()->lastFrame());
|
frame_t last = (tag ? tag->toFrame(): editor->sprite()->lastFrame());
|
||||||
|
|
||||||
@ -155,10 +156,10 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
frame_t onGetFrame(Editor* editor) override {
|
frame_t onGetFrame(Editor* editor) override {
|
||||||
frame_t frame = editor->frame();
|
frame_t frame = editor->frame();
|
||||||
FrameTag* tag = editor
|
Tag* tag = editor
|
||||||
->getCustomizationDelegate()
|
->getCustomizationDelegate()
|
||||||
->getFrameTagProvider()
|
->getTagProvider()
|
||||||
->getFrameTagByFrame(frame, false);
|
->getTagByFrame(frame, false);
|
||||||
return (tag ? tag->toFrame(): editor->sprite()->lastFrame());
|
return (tag ? tag->toFrame(): editor->sprite()->lastFrame());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -173,8 +174,8 @@ private:
|
|||||||
// TODO this combobox is similar to FileSelector::CustomFileNameEntry
|
// TODO this combobox is similar to FileSelector::CustomFileNameEntry
|
||||||
class TagsEntry : public ComboBox {
|
class TagsEntry : public ComboBox {
|
||||||
public:
|
public:
|
||||||
TagsEntry(FrameTags& frameTags)
|
TagsEntry(Tags& tags)
|
||||||
: m_frameTags(frameTags) {
|
: m_tags(tags) {
|
||||||
setEditable(true);
|
setEditable(true);
|
||||||
getEntryWidget()->Change.connect(&TagsEntry::onEntryChange, this);
|
getEntryWidget()->Change.connect(&TagsEntry::onEntryChange, this);
|
||||||
fill(true);
|
fill(true);
|
||||||
@ -187,15 +188,15 @@ private:
|
|||||||
MatchWords match(getEntryWidget()->text());
|
MatchWords match(getEntryWidget()->text());
|
||||||
|
|
||||||
bool matchAny = false;
|
bool matchAny = false;
|
||||||
for (const auto& frameTag : m_frameTags) {
|
for (const auto& tag : m_tags) {
|
||||||
if (match(frameTag->name())) {
|
if (match(tag->name())) {
|
||||||
matchAny = true;
|
matchAny = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const auto& frameTag : m_frameTags) {
|
for (const auto& tag : m_tags) {
|
||||||
if (all || !matchAny || match(frameTag->name()))
|
if (all || !matchAny || match(tag->name()))
|
||||||
addItem(frameTag->name());
|
addItem(tag->name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +207,7 @@ private:
|
|||||||
openListBox();
|
openListBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameTags& m_frameTags;
|
Tags& m_tags;
|
||||||
};
|
};
|
||||||
|
|
||||||
void onLoadParams(const Params& params) override {
|
void onLoadParams(const Params& params) override {
|
||||||
@ -224,7 +225,7 @@ private:
|
|||||||
|
|
||||||
if (m_showUI) {
|
if (m_showUI) {
|
||||||
app::gen::GotoFrame window;
|
app::gen::GotoFrame window;
|
||||||
TagsEntry combobox(editor->sprite()->frameTags());
|
TagsEntry combobox(editor->sprite()->tags());
|
||||||
|
|
||||||
window.framePlaceholder()->addChild(&combobox);
|
window.framePlaceholder()->addChild(&combobox);
|
||||||
|
|
||||||
@ -245,10 +246,10 @@ private:
|
|||||||
// Search a tag name
|
// Search a tag name
|
||||||
else {
|
else {
|
||||||
MatchWords match(text);
|
MatchWords match(text);
|
||||||
for (const auto& frameTag : editor->sprite()->frameTags()) {
|
for (const auto& tag : editor->sprite()->tags()) {
|
||||||
if (match(frameTag->name())) {
|
if (match(tag->name())) {
|
||||||
m_frame =
|
m_frame =
|
||||||
frameTag->fromFrame()+docPref.timeline.firstFrame();
|
tag->fromFrame()+docPref.timeline.firstFrame();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -9,14 +10,14 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "app/app.h"
|
#include "app/app.h"
|
||||||
#include "app/cmd/add_frame_tag.h"
|
#include "app/cmd/add_tag.h"
|
||||||
#include "app/commands/command.h"
|
#include "app/commands/command.h"
|
||||||
#include "app/context.h"
|
#include "app/context.h"
|
||||||
#include "app/context_access.h"
|
#include "app/context_access.h"
|
||||||
#include "app/tx.h"
|
#include "app/tx.h"
|
||||||
#include "app/ui/frame_tag_window.h"
|
#include "app/ui/tag_window.h"
|
||||||
#include "app/ui/timeline/timeline.h"
|
#include "app/ui/timeline/timeline.h"
|
||||||
#include "doc/frame_tag.h"
|
#include "doc/tag.h"
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
@ -59,22 +60,22 @@ void NewFrameTagCommand::onExecute(Context* context)
|
|||||||
to = range.selectedFrames().lastFrame();
|
to = range.selectedFrames().lastFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<FrameTag> frameTag(new FrameTag(from, to));
|
std::unique_ptr<Tag> tag(new Tag(from, to));
|
||||||
FrameTagWindow window(sprite, frameTag.get());
|
TagWindow window(sprite, tag.get());
|
||||||
if (!window.show())
|
if (!window.show())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
window.rangeValue(from, to);
|
window.rangeValue(from, to);
|
||||||
frameTag->setFrameRange(from, to);
|
tag->setFrameRange(from, to);
|
||||||
frameTag->setName(window.nameValue());
|
tag->setName(window.nameValue());
|
||||||
frameTag->setColor(window.colorValue());
|
tag->setColor(window.colorValue());
|
||||||
frameTag->setAniDir(window.aniDirValue());
|
tag->setAniDir(window.aniDirValue());
|
||||||
|
|
||||||
{
|
{
|
||||||
ContextWriter writer(reader);
|
ContextWriter writer(reader);
|
||||||
Tx tx(writer.context(), "New Frames Tag");
|
Tx tx(writer.context(), friendlyName());
|
||||||
tx(new cmd::AddFrameTag(writer.sprite(), frameTag.get()));
|
tx(new cmd::AddTag(writer.sprite(), tag.get()));
|
||||||
frameTag.release();
|
tag.release();
|
||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -9,7 +10,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "app/app.h"
|
#include "app/app.h"
|
||||||
#include "app/cmd/remove_frame_tag.h"
|
#include "app/cmd/remove_tag.h"
|
||||||
#include "app/commands/command.h"
|
#include "app/commands/command.h"
|
||||||
#include "app/commands/params.h"
|
#include "app/commands/params.h"
|
||||||
#include "app/context.h"
|
#include "app/context.h"
|
||||||
@ -18,7 +19,7 @@
|
|||||||
#include "app/tx.h"
|
#include "app/tx.h"
|
||||||
#include "app/ui/timeline/timeline.h"
|
#include "app/ui/timeline/timeline.h"
|
||||||
#include "base/convert_to.h"
|
#include "base/convert_to.h"
|
||||||
#include "doc/frame_tag.h"
|
#include "doc/tag.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
@ -64,20 +65,20 @@ void RemoveFrameTagCommand::onExecute(Context* context)
|
|||||||
ContextWriter writer(context);
|
ContextWriter writer(context);
|
||||||
Sprite* sprite(writer.sprite());
|
Sprite* sprite(writer.sprite());
|
||||||
frame_t frame = writer.frame();
|
frame_t frame = writer.frame();
|
||||||
FrameTag* foundTag = nullptr;
|
Tag* foundTag = nullptr;
|
||||||
|
|
||||||
if (!m_tagName.empty())
|
if (!m_tagName.empty())
|
||||||
foundTag = sprite->frameTags().getByName(m_tagName);
|
foundTag = sprite->tags().getByName(m_tagName);
|
||||||
else if (m_tagId != NullId)
|
else if (m_tagId != NullId)
|
||||||
foundTag = sprite->frameTags().getById(m_tagId);
|
foundTag = sprite->tags().getById(m_tagId);
|
||||||
else
|
else
|
||||||
foundTag = sprite->frameTags().innerTag(frame);
|
foundTag = sprite->tags().innerTag(frame);
|
||||||
|
|
||||||
if (!foundTag)
|
if (!foundTag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Tx tx(writer.context(), "Remove Frame Tag");
|
Tx tx(writer.context(), friendlyName());
|
||||||
tx(new cmd::RemoveFrameTag(sprite, foundTag));
|
tx(new cmd::RemoveTag(sprite, foundTag));
|
||||||
tx.commit();
|
tx.commit();
|
||||||
|
|
||||||
App::instance()->timeline()->invalidate();
|
App::instance()->timeline()->invalidate();
|
||||||
|
@ -38,8 +38,8 @@
|
|||||||
#include "base/fs.h"
|
#include "base/fs.h"
|
||||||
#include "base/scoped_value.h"
|
#include "base/scoped_value.h"
|
||||||
#include "base/thread.h"
|
#include "base/thread.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
#include "undo/undo_state.h"
|
#include "undo/undo_state.h"
|
||||||
@ -97,7 +97,7 @@ void SaveFileBaseCommand::onLoadParams(const Params& params)
|
|||||||
{
|
{
|
||||||
m_filename = params.get("filename");
|
m_filename = params.get("filename");
|
||||||
m_filenameFormat = params.get("filename-format");
|
m_filenameFormat = params.get("filename-format");
|
||||||
m_frameTag = params.get("frame-tag");
|
m_tag = params.get("frame-tag");
|
||||||
m_aniDir = params.get("ani-dir");
|
m_aniDir = params.get("ani-dir");
|
||||||
m_slice = params.get("slice");
|
m_slice = params.get("slice");
|
||||||
|
|
||||||
@ -106,11 +106,11 @@ void SaveFileBaseCommand::onLoadParams(const Params& params)
|
|||||||
doc::frame_t fromFrame = params.get_as<doc::frame_t>("from-frame");
|
doc::frame_t fromFrame = params.get_as<doc::frame_t>("from-frame");
|
||||||
doc::frame_t toFrame = params.get_as<doc::frame_t>("to-frame");
|
doc::frame_t toFrame = params.get_as<doc::frame_t>("to-frame");
|
||||||
m_selFrames.insert(fromFrame, toFrame);
|
m_selFrames.insert(fromFrame, toFrame);
|
||||||
m_adjustFramesByFrameTag = true;
|
m_adjustFramesByTag = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_selFrames.clear();
|
m_selFrames.clear();
|
||||||
m_adjustFramesByFrameTag = false;
|
m_adjustFramesByTag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string useUI = params.get("useUI");
|
std::string useUI = params.get("useUI");
|
||||||
@ -218,8 +218,8 @@ void SaveFileBaseCommand::saveDocumentInBackground(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FileOpROI roi(document, m_slice, m_frameTag,
|
FileOpROI roi(document, m_slice, m_tag,
|
||||||
m_selFrames, m_adjustFramesByFrameTag);
|
m_selFrames, m_adjustFramesByTag);
|
||||||
|
|
||||||
std::unique_ptr<FileOp> fop(
|
std::unique_ptr<FileOp> fop(
|
||||||
FileOp::createSaveDocumentOperation(
|
FileOp::createSaveDocumentOperation(
|
||||||
@ -446,12 +446,12 @@ void SaveFileCopyAsCommand::onExecute(Context* context)
|
|||||||
|
|
||||||
// Selected frames to export
|
// Selected frames to export
|
||||||
SelectedFrames selFrames;
|
SelectedFrames selFrames;
|
||||||
FrameTag* frameTag = calculate_selected_frames(
|
Tag* tag = calculate_selected_frames(
|
||||||
site, frames, selFrames);
|
site, frames, selFrames);
|
||||||
if (frameTag)
|
if (tag)
|
||||||
m_frameTag = frameTag->name();
|
m_tag = tag->name();
|
||||||
m_selFrames = selFrames;
|
m_selFrames = selFrames;
|
||||||
m_adjustFramesByFrameTag = false;
|
m_adjustFramesByTag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
base::ScopedValue<std::string> restoreAniDir(
|
base::ScopedValue<std::string> restoreAniDir(
|
||||||
|
@ -39,11 +39,11 @@ namespace app {
|
|||||||
|
|
||||||
std::string m_filename;
|
std::string m_filename;
|
||||||
std::string m_filenameFormat;
|
std::string m_filenameFormat;
|
||||||
std::string m_frameTag;
|
std::string m_tag;
|
||||||
std::string m_aniDir;
|
std::string m_aniDir;
|
||||||
std::string m_slice;
|
std::string m_slice;
|
||||||
doc::SelectedFrames m_selFrames;
|
doc::SelectedFrames m_selFrames;
|
||||||
bool m_adjustFramesByFrameTag;
|
bool m_adjustFramesByTag;
|
||||||
bool m_useUI;
|
bool m_useUI;
|
||||||
bool m_ignoreEmpty;
|
bool m_ignoreEmpty;
|
||||||
};
|
};
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "app/app.h"
|
#include "app/app.h"
|
||||||
#include "app/cmd/add_frame_tag.h"
|
#include "app/cmd/add_tag.h"
|
||||||
#include "app/cmd/remove_frame_tag.h"
|
#include "app/cmd/remove_tag.h"
|
||||||
#include "app/cmd/set_frame_tag_range.h"
|
#include "app/cmd/set_tag_range.h"
|
||||||
#include "app/commands/command.h"
|
#include "app/commands/command.h"
|
||||||
#include "app/commands/commands.h"
|
#include "app/commands/commands.h"
|
||||||
#include "app/commands/params.h"
|
#include "app/commands/params.h"
|
||||||
@ -19,7 +19,7 @@
|
|||||||
#include "app/loop_tag.h"
|
#include "app/loop_tag.h"
|
||||||
#include "app/tx.h"
|
#include "app/tx.h"
|
||||||
#include "app/ui/timeline/timeline.h"
|
#include "app/ui/timeline/timeline.h"
|
||||||
#include "doc/frame_tag.h"
|
#include "doc/tag.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
@ -101,21 +101,21 @@ void SetLoopSectionCommand::onExecute(Context* ctx)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
doc::FrameTag* loopTag = get_loop_tag(sprite);
|
doc::Tag* loopTag = get_loop_tag(sprite);
|
||||||
if (on) {
|
if (on) {
|
||||||
if (!loopTag) {
|
if (!loopTag) {
|
||||||
loopTag = create_loop_tag(begin, end);
|
loopTag = create_loop_tag(begin, end);
|
||||||
|
|
||||||
ContextWriter writer(ctx);
|
ContextWriter writer(ctx);
|
||||||
Tx tx(writer.context(), "Add Loop");
|
Tx tx(writer.context(), "Add Loop");
|
||||||
tx(new cmd::AddFrameTag(sprite, loopTag));
|
tx(new cmd::AddTag(sprite, loopTag));
|
||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
else if (loopTag->fromFrame() != begin ||
|
else if (loopTag->fromFrame() != begin ||
|
||||||
loopTag->toFrame() != end) {
|
loopTag->toFrame() != end) {
|
||||||
ContextWriter writer(ctx);
|
ContextWriter writer(ctx);
|
||||||
Tx tx(writer.context(), "Set Loop Range");
|
Tx tx(writer.context(), "Set Loop Range");
|
||||||
tx(new cmd::SetFrameTagRange(loopTag, begin, end));
|
tx(new cmd::SetTagRange(loopTag, begin, end));
|
||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -127,7 +127,7 @@ void SetLoopSectionCommand::onExecute(Context* ctx)
|
|||||||
if (loopTag) {
|
if (loopTag) {
|
||||||
ContextWriter writer(ctx);
|
ContextWriter writer(ctx);
|
||||||
Tx tx(writer.context(), "Remove Loop");
|
Tx tx(writer.context(), "Remove Loop");
|
||||||
tx(new cmd::RemoveFrameTag(sprite, loopTag));
|
tx(new cmd::RemoveTag(sprite, loopTag));
|
||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,6 @@
|
|||||||
#include "doc/cel_io.h"
|
#include "doc/cel_io.h"
|
||||||
#include "doc/cels_range.h"
|
#include "doc/cels_range.h"
|
||||||
#include "doc/frame.h"
|
#include "doc/frame.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/frame_tag_io.h"
|
|
||||||
#include "doc/image_io.h"
|
#include "doc/image_io.h"
|
||||||
#include "doc/layer.h"
|
#include "doc/layer.h"
|
||||||
#include "doc/palette.h"
|
#include "doc/palette.h"
|
||||||
@ -36,6 +34,8 @@
|
|||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
#include "doc/string_io.h"
|
#include "doc/string_io.h"
|
||||||
#include "doc/subobjects_io.h"
|
#include "doc/subobjects_io.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
|
#include "doc/tag_io.h"
|
||||||
#include "fixmath/fixmath.h"
|
#include "fixmath/fixmath.h"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@ -320,9 +320,9 @@ private:
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
ObjectId tagId = read32(s);
|
ObjectId tagId = read32(s);
|
||||||
FrameTag* tag = loadObject<FrameTag*>("frtag", tagId, &Reader::readFrameTag);
|
Tag* tag = loadObject<Tag*>("frtag", tagId, &Reader::readTag);
|
||||||
if (tag)
|
if (tag)
|
||||||
spr->frameTags().add(tag);
|
spr->tags().add(tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,8 +423,8 @@ private:
|
|||||||
return read_palette(s);
|
return read_palette(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameTag* readFrameTag(std::ifstream& s) {
|
Tag* readTag(std::ifstream& s) {
|
||||||
return read_frame_tag(s, false);
|
return read_tag(s, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Slice* readSlice(std::ifstream& s) {
|
Slice* readSlice(std::ifstream& s) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018 Igara Studio S.A.
|
// Copyright (C) 2018-2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -24,8 +24,6 @@
|
|||||||
#include "doc/cel_io.h"
|
#include "doc/cel_io.h"
|
||||||
#include "doc/cels_range.h"
|
#include "doc/cels_range.h"
|
||||||
#include "doc/frame.h"
|
#include "doc/frame.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/frame_tag_io.h"
|
|
||||||
#include "doc/image_io.h"
|
#include "doc/image_io.h"
|
||||||
#include "doc/layer.h"
|
#include "doc/layer.h"
|
||||||
#include "doc/palette.h"
|
#include "doc/palette.h"
|
||||||
@ -34,6 +32,8 @@
|
|||||||
#include "doc/slice_io.h"
|
#include "doc/slice_io.h"
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
#include "doc/string_io.h"
|
#include "doc/string_io.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
|
#include "doc/tag_io.h"
|
||||||
#include "fixmath/fixmath.h"
|
#include "fixmath/fixmath.h"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
@ -71,7 +71,7 @@ public:
|
|||||||
if (!saveObject("pal", pal, &Writer::writePalette))
|
if (!saveObject("pal", pal, &Writer::writePalette))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (FrameTag* frtag : spr->frameTags())
|
for (Tag* frtag : spr->tags())
|
||||||
if (!saveObject("frtag", frtag, &Writer::writeFrameTag))
|
if (!saveObject("frtag", frtag, &Writer::writeFrameTag))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -158,8 +158,8 @@ private:
|
|||||||
write32(s, pal->id());
|
write32(s, pal->id());
|
||||||
|
|
||||||
// IDs of all frame tags
|
// IDs of all frame tags
|
||||||
write32(s, spr->frameTags().size());
|
write32(s, spr->tags().size());
|
||||||
for (FrameTag* frtag : spr->frameTags())
|
for (Tag* frtag : spr->tags())
|
||||||
write32(s, frtag->id());
|
write32(s, frtag->id());
|
||||||
|
|
||||||
// IDs of all slices
|
// IDs of all slices
|
||||||
@ -248,8 +248,8 @@ private:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool writeFrameTag(std::ofstream& s, FrameTag* frameTag) {
|
bool writeFrameTag(std::ofstream& s, Tag* frameTag) {
|
||||||
write_frame_tag(s, frameTag);
|
write_tag(s, frameTag);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,12 +26,12 @@
|
|||||||
#include "app/util/create_cel_copy.h"
|
#include "app/util/create_cel_copy.h"
|
||||||
#include "base/memory.h"
|
#include "base/memory.h"
|
||||||
#include "doc/cel.h"
|
#include "doc/cel.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/layer.h"
|
#include "doc/layer.h"
|
||||||
#include "doc/mask.h"
|
#include "doc/mask.h"
|
||||||
#include "doc/mask_boundaries.h"
|
#include "doc/mask_boundaries.h"
|
||||||
#include "doc/palette.h"
|
#include "doc/palette.h"
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
#include "os/display.h"
|
#include "os/display.h"
|
||||||
#include "os/system.h"
|
#include "os/system.h"
|
||||||
#include "ui/system.h"
|
#include "ui/system.h"
|
||||||
@ -460,8 +460,8 @@ Doc* Doc::duplicate(DuplicateType type) const
|
|||||||
spriteCopy->setFrameDuration(i, sourceSprite->frameDuration(i));
|
spriteCopy->setFrameDuration(i, sourceSprite->frameDuration(i));
|
||||||
|
|
||||||
// Copy frame tags
|
// Copy frame tags
|
||||||
for (const FrameTag* tag : sourceSprite->frameTags())
|
for (const Tag* tag : sourceSprite->tags())
|
||||||
spriteCopy->frameTags().add(new FrameTag(*tag));
|
spriteCopy->tags().add(new Tag(*tag));
|
||||||
|
|
||||||
// Copy color palettes
|
// Copy color palettes
|
||||||
{
|
{
|
||||||
|
@ -26,20 +26,20 @@
|
|||||||
#include "app/cmd/move_layer.h"
|
#include "app/cmd/move_layer.h"
|
||||||
#include "app/cmd/remove_cel.h"
|
#include "app/cmd/remove_cel.h"
|
||||||
#include "app/cmd/remove_frame.h"
|
#include "app/cmd/remove_frame.h"
|
||||||
#include "app/cmd/remove_frame_tag.h"
|
|
||||||
#include "app/cmd/remove_layer.h"
|
#include "app/cmd/remove_layer.h"
|
||||||
|
#include "app/cmd/remove_tag.h"
|
||||||
#include "app/cmd/replace_image.h"
|
#include "app/cmd/replace_image.h"
|
||||||
#include "app/cmd/set_cel_bounds.h"
|
#include "app/cmd/set_cel_bounds.h"
|
||||||
#include "app/cmd/set_cel_frame.h"
|
#include "app/cmd/set_cel_frame.h"
|
||||||
#include "app/cmd/set_cel_opacity.h"
|
#include "app/cmd/set_cel_opacity.h"
|
||||||
#include "app/cmd/set_cel_position.h"
|
#include "app/cmd/set_cel_position.h"
|
||||||
#include "app/cmd/set_frame_duration.h"
|
#include "app/cmd/set_frame_duration.h"
|
||||||
#include "app/cmd/set_frame_tag_range.h"
|
|
||||||
#include "app/cmd/set_mask.h"
|
#include "app/cmd/set_mask.h"
|
||||||
#include "app/cmd/set_mask_position.h"
|
#include "app/cmd/set_mask_position.h"
|
||||||
#include "app/cmd/set_palette.h"
|
#include "app/cmd/set_palette.h"
|
||||||
#include "app/cmd/set_slice_key.h"
|
#include "app/cmd/set_slice_key.h"
|
||||||
#include "app/cmd/set_sprite_size.h"
|
#include "app/cmd/set_sprite_size.h"
|
||||||
|
#include "app/cmd/set_tag_range.h"
|
||||||
#include "app/cmd/set_total_frames.h"
|
#include "app/cmd/set_total_frames.h"
|
||||||
#include "app/cmd/set_transparent_color.h"
|
#include "app/cmd/set_transparent_color.h"
|
||||||
#include "app/color_target.h"
|
#include "app/color_target.h"
|
||||||
@ -52,11 +52,11 @@
|
|||||||
#include "doc/algorithm/flip_image.h"
|
#include "doc/algorithm/flip_image.h"
|
||||||
#include "doc/algorithm/shrink_bounds.h"
|
#include "doc/algorithm/shrink_bounds.h"
|
||||||
#include "doc/cel.h"
|
#include "doc/cel.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/frame_tags.h"
|
|
||||||
#include "doc/mask.h"
|
#include "doc/mask.h"
|
||||||
#include "doc/palette.h"
|
#include "doc/palette.h"
|
||||||
#include "doc/slice.h"
|
#include "doc/slice.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
|
#include "doc/tags.h"
|
||||||
#include "render/render.h"
|
#include "render/render.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -361,9 +361,9 @@ void DocApi::addFrame(Sprite* sprite, frame_t newFrame)
|
|||||||
void DocApi::addEmptyFrame(Sprite* sprite, frame_t newFrame)
|
void DocApi::addEmptyFrame(Sprite* sprite, frame_t newFrame)
|
||||||
{
|
{
|
||||||
m_transaction.execute(new cmd::AddFrame(sprite, newFrame));
|
m_transaction.execute(new cmd::AddFrame(sprite, newFrame));
|
||||||
adjustFrameTags(sprite, newFrame, +1,
|
adjustTags(sprite, newFrame, +1,
|
||||||
kDropBeforeFrame,
|
kDropBeforeFrame,
|
||||||
kDefaultTagsAdjustment);
|
kDefaultTagsAdjustment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DocApi::addEmptyFramesTo(Sprite* sprite, frame_t newFrame)
|
void DocApi::addEmptyFramesTo(Sprite* sprite, frame_t newFrame)
|
||||||
@ -399,18 +399,18 @@ void DocApi::copyFrame(Sprite* sprite,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
adjustFrameTags(sprite, newFrame0, +1,
|
adjustTags(sprite, newFrame0, +1,
|
||||||
dropFramePlace,
|
dropFramePlace,
|
||||||
tagsHandling);
|
tagsHandling);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DocApi::removeFrame(Sprite* sprite, frame_t frame)
|
void DocApi::removeFrame(Sprite* sprite, frame_t frame)
|
||||||
{
|
{
|
||||||
ASSERT(frame >= 0);
|
ASSERT(frame >= 0);
|
||||||
m_transaction.execute(new cmd::RemoveFrame(sprite, frame));
|
m_transaction.execute(new cmd::RemoveFrame(sprite, frame));
|
||||||
adjustFrameTags(sprite, frame, -1,
|
adjustTags(sprite, frame, -1,
|
||||||
kDropBeforeFrame,
|
kDropBeforeFrame,
|
||||||
kDefaultTagsAdjustment);
|
kDefaultTagsAdjustment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DocApi::setTotalFrames(Sprite* sprite, frame_t frames)
|
void DocApi::setTotalFrames(Sprite* sprite, frame_t frames)
|
||||||
@ -446,7 +446,7 @@ void DocApi::moveFrame(Sprite* sprite,
|
|||||||
if (frame >= 0 && frame <= sprite->lastFrame() &&
|
if (frame >= 0 && frame <= sprite->lastFrame() &&
|
||||||
beforeFrame >= 0 && beforeFrame <= sprite->lastFrame()+1 &&
|
beforeFrame >= 0 && beforeFrame <= sprite->lastFrame()+1 &&
|
||||||
((frame != beforeFrame) ||
|
((frame != beforeFrame) ||
|
||||||
(!sprite->frameTags().empty() &&
|
(!sprite->tags().empty() &&
|
||||||
tagsHandling != kDontAdjustTags))) {
|
tagsHandling != kDontAdjustTags))) {
|
||||||
// Change the frame-lengths.
|
// Change the frame-lengths.
|
||||||
int frlen_aux = sprite->frameDuration(frame);
|
int frlen_aux = sprite->frameDuration(frame);
|
||||||
@ -465,10 +465,10 @@ void DocApi::moveFrame(Sprite* sprite,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tagsHandling != kDontAdjustTags) {
|
if (tagsHandling != kDontAdjustTags) {
|
||||||
adjustFrameTags(sprite, frame, -1, dropFramePlace, tagsHandling);
|
adjustTags(sprite, frame, -1, dropFramePlace, tagsHandling);
|
||||||
if (targetFrame >= frame)
|
if (targetFrame >= frame)
|
||||||
--targetFrame;
|
--targetFrame;
|
||||||
adjustFrameTags(sprite, targetFrame, +1, dropFramePlace, tagsHandling);
|
adjustTags(sprite, targetFrame, +1, dropFramePlace, tagsHandling);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change cel positions.
|
// Change cel positions.
|
||||||
@ -806,14 +806,14 @@ void DocApi::setPalette(Sprite* sprite, frame_t frame, const Palette* newPalette
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DocApi::adjustFrameTags(Sprite* sprite,
|
void DocApi::adjustTags(Sprite* sprite,
|
||||||
const frame_t frame,
|
const frame_t frame,
|
||||||
const frame_t delta,
|
const frame_t delta,
|
||||||
const DropFramePlace dropFramePlace,
|
const DropFramePlace dropFramePlace,
|
||||||
const TagsHandling tagsHandling)
|
const TagsHandling tagsHandling)
|
||||||
{
|
{
|
||||||
TRACE_DOCAPI(
|
TRACE_DOCAPI(
|
||||||
"\n adjustFrameTags %s frame %d delta=%d tags=%s:\n",
|
"\n adjustTags %s frame %d delta=%d tags=%s:\n",
|
||||||
(dropFramePlace == kDropBeforeFrame ? "before": "after"),
|
(dropFramePlace == kDropBeforeFrame ? "before": "after"),
|
||||||
frame, delta,
|
frame, delta,
|
||||||
(tagsHandling == kDefaultTagsAdjustment ? "default":
|
(tagsHandling == kDefaultTagsAdjustment ? "default":
|
||||||
@ -823,9 +823,9 @@ void DocApi::adjustFrameTags(Sprite* sprite,
|
|||||||
|
|
||||||
// As FrameTag::setFrameRange() changes m_frameTags, we need to use
|
// As FrameTag::setFrameRange() changes m_frameTags, we need to use
|
||||||
// a copy of this collection
|
// a copy of this collection
|
||||||
std::vector<FrameTag*> tags(sprite->frameTags().begin(), sprite->frameTags().end());
|
std::vector<Tag*> tags(sprite->tags().begin(), sprite->tags().end());
|
||||||
|
|
||||||
for (FrameTag* tag : tags) {
|
for (Tag* tag : tags) {
|
||||||
frame_t from = tag->fromFrame();
|
frame_t from = tag->fromFrame();
|
||||||
frame_t to = tag->toFrame();
|
frame_t to = tag->toFrame();
|
||||||
|
|
||||||
@ -866,9 +866,9 @@ void DocApi::adjustFrameTags(Sprite* sprite,
|
|||||||
if (from != tag->fromFrame() ||
|
if (from != tag->fromFrame() ||
|
||||||
to != tag->toFrame()) {
|
to != tag->toFrame()) {
|
||||||
if (from > to)
|
if (from > to)
|
||||||
m_transaction.execute(new cmd::RemoveFrameTag(sprite, tag));
|
m_transaction.execute(new cmd::RemoveTag(sprite, tag));
|
||||||
else
|
else
|
||||||
m_transaction.execute(new cmd::SetFrameTagRange(tag, from, to));
|
m_transaction.execute(new cmd::SetTagRange(tag, from, to));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,11 +126,11 @@ namespace app {
|
|||||||
const bool trimOutside);
|
const bool trimOutside);
|
||||||
void setCelFramePosition(Cel* cel, frame_t frame);
|
void setCelFramePosition(Cel* cel, frame_t frame);
|
||||||
void moveFrameLayer(Layer* layer, frame_t frame, frame_t beforeFrame);
|
void moveFrameLayer(Layer* layer, frame_t frame, frame_t beforeFrame);
|
||||||
void adjustFrameTags(Sprite* sprite,
|
void adjustTags(Sprite* sprite,
|
||||||
const frame_t frame,
|
const frame_t frame,
|
||||||
const frame_t delta,
|
const frame_t delta,
|
||||||
const DropFramePlace dropFramePlace,
|
const DropFramePlace dropFramePlace,
|
||||||
const TagsHandling tagsHandling);
|
const TagsHandling tagsHandling);
|
||||||
|
|
||||||
class HandleLinkedCels {
|
class HandleLinkedCels {
|
||||||
public:
|
public:
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2018 David Capello
|
// Copyright (C) 2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -12,12 +13,12 @@
|
|||||||
|
|
||||||
#include "app/doc.h"
|
#include "app/doc.h"
|
||||||
#include "doc/cel.h"
|
#include "doc/cel.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/image.h"
|
#include "doc/image.h"
|
||||||
#include "doc/layer.h"
|
#include "doc/layer.h"
|
||||||
#include "doc/palette.h"
|
#include "doc/palette.h"
|
||||||
#include "doc/primitives.h"
|
#include "doc/primitives.h"
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
@ -50,21 +51,21 @@ DocDiff compare_docs(const Doc* a,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tags
|
// Tags
|
||||||
if (a->sprite()->frameTags().size() != b->sprite()->frameTags().size()) {
|
if (a->sprite()->tags().size() != b->sprite()->tags().size()) {
|
||||||
diff.anything = diff.frameTags = true;
|
diff.anything = diff.tags = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
auto aIt = a->sprite()->frameTags().begin(), aEnd = a->sprite()->frameTags().end();
|
auto aIt = a->sprite()->tags().begin(), aEnd = a->sprite()->tags().end();
|
||||||
auto bIt = b->sprite()->frameTags().begin(), bEnd = b->sprite()->frameTags().end();
|
auto bIt = b->sprite()->tags().begin(), bEnd = b->sprite()->tags().end();
|
||||||
for (; aIt != aEnd && bIt != bEnd; ++aIt, ++bIt) {
|
for (; aIt != aEnd && bIt != bEnd; ++aIt, ++bIt) {
|
||||||
const FrameTag* aTag = *aIt;
|
const Tag* aTag = *aIt;
|
||||||
const FrameTag* bTag = *bIt;
|
const Tag* bTag = *bIt;
|
||||||
if (aTag->fromFrame() != bTag->fromFrame() ||
|
if (aTag->fromFrame() != bTag->fromFrame() ||
|
||||||
aTag->toFrame() != bTag->toFrame() ||
|
aTag->toFrame() != bTag->toFrame() ||
|
||||||
aTag->name() != bTag->name() ||
|
aTag->name() != bTag->name() ||
|
||||||
aTag->color() != bTag->color() ||
|
aTag->color() != bTag->color() ||
|
||||||
aTag->aniDir() != bTag->aniDir()) {
|
aTag->aniDir() != bTag->aniDir()) {
|
||||||
diff.anything = diff.frameTags = true;
|
diff.anything = diff.tags = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ namespace app {
|
|||||||
bool canvas : 1;
|
bool canvas : 1;
|
||||||
bool totalFrames : 1;
|
bool totalFrames : 1;
|
||||||
bool frameDuration : 1;
|
bool frameDuration : 1;
|
||||||
bool frameTags : 1;
|
bool tags : 1;
|
||||||
bool palettes : 1;
|
bool palettes : 1;
|
||||||
bool layers : 1;
|
bool layers : 1;
|
||||||
bool cels : 1;
|
bool cels : 1;
|
||||||
@ -28,7 +28,7 @@ namespace app {
|
|||||||
canvas(false),
|
canvas(false),
|
||||||
totalFrames(false),
|
totalFrames(false),
|
||||||
frameDuration(false),
|
frameDuration(false),
|
||||||
frameTags(false),
|
tags(false),
|
||||||
palettes(false),
|
palettes(false),
|
||||||
layers(false),
|
layers(false),
|
||||||
cels(false),
|
cels(false),
|
||||||
|
@ -14,80 +14,78 @@
|
|||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
class Cel;
|
class Cel;
|
||||||
class FrameTag;
|
|
||||||
class Image;
|
class Image;
|
||||||
class Layer;
|
class Layer;
|
||||||
class LayerImage;
|
class LayerImage;
|
||||||
class Slice;
|
class Slice;
|
||||||
class Sprite;
|
class Sprite;
|
||||||
|
class Tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
class Doc;
|
class Doc;
|
||||||
|
|
||||||
using namespace doc;
|
|
||||||
|
|
||||||
class DocEvent {
|
class DocEvent {
|
||||||
public:
|
public:
|
||||||
DocEvent(Doc* document)
|
DocEvent(Doc* doc)
|
||||||
: m_document(document)
|
: m_doc(doc)
|
||||||
, m_sprite(NULL)
|
, m_sprite(nullptr)
|
||||||
, m_layer(NULL)
|
, m_layer(nullptr)
|
||||||
, m_cel(NULL)
|
, m_cel(nullptr)
|
||||||
, m_image(NULL)
|
, m_image(nullptr)
|
||||||
, m_imageIndex(-1)
|
, m_imageIndex(-1)
|
||||||
, m_frame(0)
|
, m_frame(0)
|
||||||
, m_frameTag(nullptr)
|
, m_tag(nullptr)
|
||||||
, m_slice(nullptr)
|
, m_slice(nullptr)
|
||||||
, m_targetLayer(NULL)
|
, m_targetLayer(nullptr)
|
||||||
, m_targetFrame(0) {
|
, m_targetFrame(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Source of the event.
|
// Source of the event.
|
||||||
Doc* document() const { return m_document; }
|
Doc* document() const { return m_doc; }
|
||||||
Sprite* sprite() const { return m_sprite; }
|
doc::Sprite* sprite() const { return m_sprite; }
|
||||||
Layer* layer() const { return m_layer; }
|
doc::Layer* layer() const { return m_layer; }
|
||||||
Cel* cel() const { return m_cel; }
|
doc::Cel* cel() const { return m_cel; }
|
||||||
Image* image() const { return m_image; }
|
doc::Image* image() const { return m_image; }
|
||||||
int imageIndex() const { return m_imageIndex; }
|
int imageIndex() const { return m_imageIndex; }
|
||||||
frame_t frame() const { return m_frame; }
|
doc::frame_t frame() const { return m_frame; }
|
||||||
FrameTag* frameTag() const { return m_frameTag; }
|
doc::Tag* tag() const { return m_tag; }
|
||||||
Slice* slice() const { return m_slice; }
|
doc::Slice* slice() const { return m_slice; }
|
||||||
const gfx::Region& region() const { return m_region; }
|
const gfx::Region& region() const { return m_region; }
|
||||||
|
|
||||||
void sprite(Sprite* sprite) { m_sprite = sprite; }
|
void sprite(doc::Sprite* sprite) { m_sprite = sprite; }
|
||||||
void layer(Layer* layer) { m_layer = layer; }
|
void layer(doc::Layer* layer) { m_layer = layer; }
|
||||||
void cel(Cel* cel) { m_cel = cel; }
|
void cel(doc::Cel* cel) { m_cel = cel; }
|
||||||
void image(Image* image) { m_image = image; }
|
void image(doc::Image* image) { m_image = image; }
|
||||||
void imageIndex(int imageIndex) { m_imageIndex = imageIndex; }
|
void imageIndex(int imageIndex) { m_imageIndex = imageIndex; }
|
||||||
void frame(frame_t frame) { m_frame = frame; }
|
void frame(doc::frame_t frame) { m_frame = frame; }
|
||||||
void frameTag(FrameTag* frameTag) { m_frameTag = frameTag; }
|
void tag(doc::Tag* tag) { m_tag = tag; }
|
||||||
void slice(Slice* slice) { m_slice = slice; }
|
void slice(doc::Slice* slice) { m_slice = slice; }
|
||||||
void region(const gfx::Region& rgn) { m_region = rgn; }
|
void region(const gfx::Region& rgn) { m_region = rgn; }
|
||||||
|
|
||||||
// Destination of the operation.
|
// Destination of the operation.
|
||||||
Layer* targetLayer() const { return m_targetLayer; }
|
doc::Layer* targetLayer() const { return m_targetLayer; }
|
||||||
frame_t targetFrame() const { return m_targetFrame; }
|
doc::frame_t targetFrame() const { return m_targetFrame; }
|
||||||
|
|
||||||
void targetLayer(Layer* layer) { m_targetLayer = layer; }
|
void targetLayer(doc::Layer* layer) { m_targetLayer = layer; }
|
||||||
void targetFrame(frame_t frame) { m_targetFrame = frame; }
|
void targetFrame(doc::frame_t frame) { m_targetFrame = frame; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Doc* m_document;
|
Doc* m_doc;
|
||||||
Sprite* m_sprite;
|
doc::Sprite* m_sprite;
|
||||||
Layer* m_layer;
|
doc::Layer* m_layer;
|
||||||
Cel* m_cel;
|
doc::Cel* m_cel;
|
||||||
Image* m_image;
|
doc::Image* m_image;
|
||||||
int m_imageIndex;
|
int m_imageIndex;
|
||||||
frame_t m_frame;
|
doc::frame_t m_frame;
|
||||||
FrameTag* m_frameTag;
|
doc::Tag* m_tag;
|
||||||
Slice* m_slice;
|
doc::Slice* m_slice;
|
||||||
gfx::Region m_region;
|
gfx::Region m_region;
|
||||||
|
|
||||||
// For copy/move commands, the m_layer/m_frame are source of the
|
// For copy/move commands, the m_layer/m_frame are source of the
|
||||||
// operation, and these are the destination of the operation.
|
// operation, and these are the destination of the operation.
|
||||||
Layer* m_targetLayer;
|
doc::Layer* m_targetLayer;
|
||||||
frame_t m_targetFrame;
|
doc::frame_t m_targetFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "base/string.h"
|
#include "base/string.h"
|
||||||
#include "doc/algorithm/shrink_bounds.h"
|
#include "doc/algorithm/shrink_bounds.h"
|
||||||
#include "doc/cel.h"
|
#include "doc/cel.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/image.h"
|
#include "doc/image.h"
|
||||||
#include "doc/layer.h"
|
#include "doc/layer.h"
|
||||||
#include "doc/palette.h"
|
#include "doc/palette.h"
|
||||||
@ -36,6 +35,7 @@
|
|||||||
#include "doc/selected_layers.h"
|
#include "doc/selected_layers.h"
|
||||||
#include "doc/slice.h"
|
#include "doc/slice.h"
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
#include "gfx/packing_rects.h"
|
#include "gfx/packing_rects.h"
|
||||||
#include "gfx/size.h"
|
#include "gfx/size.h"
|
||||||
#include "render/dithering.h"
|
#include "render/dithering.h"
|
||||||
@ -114,11 +114,11 @@ private:
|
|||||||
typedef std::shared_ptr<SampleBounds> SampleBoundsPtr;
|
typedef std::shared_ptr<SampleBounds> SampleBoundsPtr;
|
||||||
|
|
||||||
DocExporter::Item::Item(Doc* doc,
|
DocExporter::Item::Item(Doc* doc,
|
||||||
doc::FrameTag* frameTag,
|
doc::Tag* tag,
|
||||||
doc::SelectedLayers* selLayers,
|
doc::SelectedLayers* selLayers,
|
||||||
doc::SelectedFrames* selFrames)
|
doc::SelectedFrames* selFrames)
|
||||||
: doc(doc)
|
: doc(doc)
|
||||||
, frameTag(frameTag)
|
, tag(tag)
|
||||||
, selLayers(selLayers ? new doc::SelectedLayers(*selLayers): nullptr)
|
, selLayers(selLayers ? new doc::SelectedLayers(*selLayers): nullptr)
|
||||||
, selFrames(selFrames ? new doc::SelectedFrames(*selFrames): nullptr)
|
, selFrames(selFrames ? new doc::SelectedFrames(*selFrames): nullptr)
|
||||||
{
|
{
|
||||||
@ -126,7 +126,7 @@ DocExporter::Item::Item(Doc* doc,
|
|||||||
|
|
||||||
DocExporter::Item::Item(Item&& other)
|
DocExporter::Item::Item(Item&& other)
|
||||||
: doc(other.doc)
|
: doc(other.doc)
|
||||||
, frameTag(other.frameTag)
|
, tag(other.tag)
|
||||||
, selLayers(other.selLayers)
|
, selLayers(other.selLayers)
|
||||||
, selFrames(other.selFrames)
|
, selFrames(other.selFrames)
|
||||||
{
|
{
|
||||||
@ -144,8 +144,8 @@ int DocExporter::Item::frames() const
|
|||||||
{
|
{
|
||||||
if (selFrames)
|
if (selFrames)
|
||||||
return selFrames->size();
|
return selFrames->size();
|
||||||
else if (frameTag) {
|
else if (tag) {
|
||||||
int result = frameTag->toFrame() - frameTag->fromFrame() + 1;
|
int result = tag->toFrame() - tag->fromFrame() + 1;
|
||||||
return MID(1, result, doc->sprite()->totalFrames());
|
return MID(1, result, doc->sprite()->totalFrames());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -158,9 +158,9 @@ doc::SelectedFrames DocExporter::Item::getSelectedFrames() const
|
|||||||
return *selFrames;
|
return *selFrames;
|
||||||
|
|
||||||
doc::SelectedFrames frames;
|
doc::SelectedFrames frames;
|
||||||
if (frameTag) {
|
if (tag) {
|
||||||
frames.insert(MID(0, frameTag->fromFrame(), doc->sprite()->lastFrame()),
|
frames.insert(MID(0, tag->fromFrame(), doc->sprite()->lastFrame()),
|
||||||
MID(0, frameTag->toFrame(), doc->sprite()->lastFrame()));
|
MID(0, tag->toFrame(), doc->sprite()->lastFrame()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
frames.insert(0, doc->sprite()->lastFrame());
|
frames.insert(0, doc->sprite()->lastFrame());
|
||||||
@ -398,7 +398,7 @@ DocExporter::DocExporter()
|
|||||||
, m_trimCels(false)
|
, m_trimCels(false)
|
||||||
, m_trimByGrid(false)
|
, m_trimByGrid(false)
|
||||||
, m_extrude(false)
|
, m_extrude(false)
|
||||||
, m_listFrameTags(false)
|
, m_listTags(false)
|
||||||
, m_listLayers(false)
|
, m_listLayers(false)
|
||||||
, m_listSlices(false)
|
, m_listSlices(false)
|
||||||
{
|
{
|
||||||
@ -487,7 +487,7 @@ void DocExporter::captureSamples(Samples& samples)
|
|||||||
Sprite* sprite = doc->sprite();
|
Sprite* sprite = doc->sprite();
|
||||||
Layer* layer = (item.selLayers && item.selLayers->size() == 1 ?
|
Layer* layer = (item.selLayers && item.selLayers->size() == 1 ?
|
||||||
*item.selLayers->begin(): nullptr);
|
*item.selLayers->begin(): nullptr);
|
||||||
FrameTag* frameTag = item.frameTag;
|
Tag* tag = item.tag;
|
||||||
int frames = item.frames();
|
int frames = item.frames();
|
||||||
|
|
||||||
std::string format = m_filenameFormat;
|
std::string format = m_filenameFormat;
|
||||||
@ -496,13 +496,13 @@ void DocExporter::captureSamples(Samples& samples)
|
|||||||
doc->filename(),
|
doc->filename(),
|
||||||
(frames > 1), // Has frames
|
(frames > 1), // Has frames
|
||||||
(layer != nullptr), // Has layer
|
(layer != nullptr), // Has layer
|
||||||
(frameTag != nullptr)); // Has frame tag
|
(tag != nullptr)); // Has tag
|
||||||
}
|
}
|
||||||
|
|
||||||
frame_t outputFrame = 0;
|
frame_t outputFrame = 0;
|
||||||
for (frame_t frame : item.getSelectedFrames()) {
|
for (frame_t frame : item.getSelectedFrames()) {
|
||||||
FrameTag* innerTag = (frameTag ? frameTag: sprite->frameTags().innerTag(frame));
|
Tag* innerTag = (tag ? tag: sprite->tags().innerTag(frame));
|
||||||
FrameTag* outerTag = sprite->frameTags().outerTag(frame);
|
Tag* outerTag = sprite->tags().outerTag(frame);
|
||||||
FilenameInfo fnInfo;
|
FilenameInfo fnInfo;
|
||||||
fnInfo
|
fnInfo
|
||||||
.filename(doc->filename())
|
.filename(doc->filename())
|
||||||
@ -543,7 +543,7 @@ void DocExporter::captureSamples(Samples& samples)
|
|||||||
}
|
}
|
||||||
// "done" variable can be false here, e.g. when we export a
|
// "done" variable can be false here, e.g. when we export a
|
||||||
// frame tag and the first linked cel is outside the tag range.
|
// frame tag and the first linked cel is outside the tag range.
|
||||||
ASSERT(done || (!done && frameTag));
|
ASSERT(done || (!done && tag));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!done && (m_ignoreEmptyCels || m_trimCels)) {
|
if (!done && (m_ignoreEmptyCels || m_trimCels)) {
|
||||||
@ -586,7 +586,7 @@ void DocExporter::captureSamples(Samples& samples)
|
|||||||
// Should we ignore this empty frame? (i.e. don't include
|
// Should we ignore this empty frame? (i.e. don't include
|
||||||
// the frame in the sprite sheet)
|
// the frame in the sprite sheet)
|
||||||
if (m_ignoreEmptyCels) {
|
if (m_ignoreEmptyCels) {
|
||||||
for (FrameTag* tag : sprite->frameTags()) {
|
for (Tag* tag : sprite->tags()) {
|
||||||
auto& delta = m_tagDelta[tag->id()];
|
auto& delta = m_tagDelta[tag->id()];
|
||||||
|
|
||||||
if (frame < tag->fromFrame()) --delta.first;
|
if (frame < tag->fromFrame()) --delta.first;
|
||||||
@ -852,16 +852,16 @@ void DocExporter::createDataFile(const Samples& samples, std::ostream& os, Image
|
|||||||
<< " \"scale\": \"1\"";
|
<< " \"scale\": \"1\"";
|
||||||
|
|
||||||
// meta.frameTags
|
// meta.frameTags
|
||||||
if (m_listFrameTags) {
|
if (m_listTags) {
|
||||||
os << ",\n"
|
os << ",\n"
|
||||||
<< " \"frameTags\": [";
|
<< " \"frameTags\": ["; // TODO rename this someday in the future
|
||||||
|
|
||||||
bool firstTag = true;
|
bool firstTag = true;
|
||||||
for (auto& item : m_documents) {
|
for (auto& item : m_documents) {
|
||||||
Doc* doc = item.doc;
|
Doc* doc = item.doc;
|
||||||
Sprite* sprite = doc->sprite();
|
Sprite* sprite = doc->sprite();
|
||||||
|
|
||||||
for (FrameTag* tag : sprite->frameTags()) {
|
for (Tag* tag : sprite->tags()) {
|
||||||
if (firstTag)
|
if (firstTag)
|
||||||
firstTag = false;
|
firstTag = false;
|
||||||
else
|
else
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -22,10 +23,10 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
class FrameTag;
|
|
||||||
class Image;
|
class Image;
|
||||||
class SelectedLayers;
|
|
||||||
class SelectedFrames;
|
class SelectedFrames;
|
||||||
|
class SelectedLayers;
|
||||||
|
class Tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
@ -57,7 +58,7 @@ namespace app {
|
|||||||
bool trimByGrid() const { return m_trimByGrid; }
|
bool trimByGrid() const { return m_trimByGrid; }
|
||||||
bool extrude() const { return m_extrude; }
|
bool extrude() const { return m_extrude; }
|
||||||
const std::string& filenameFormat() const { return m_filenameFormat; }
|
const std::string& filenameFormat() const { return m_filenameFormat; }
|
||||||
bool listFrameTags() const { return m_listFrameTags; }
|
bool listTags() const { return m_listTags; }
|
||||||
bool listLayers() const { return m_listLayers; }
|
bool listLayers() const { return m_listLayers; }
|
||||||
|
|
||||||
void setDataFormat(DataFormat format) { m_dataFormat = format; }
|
void setDataFormat(DataFormat format) { m_dataFormat = format; }
|
||||||
@ -74,12 +75,12 @@ namespace app {
|
|||||||
void setTrimByGrid(bool trimByGrid) { m_trimByGrid = trimByGrid; }
|
void setTrimByGrid(bool trimByGrid) { m_trimByGrid = trimByGrid; }
|
||||||
void setExtrude(bool extrude) { m_extrude = extrude; }
|
void setExtrude(bool extrude) { m_extrude = extrude; }
|
||||||
void setFilenameFormat(const std::string& format) { m_filenameFormat = format; }
|
void setFilenameFormat(const std::string& format) { m_filenameFormat = format; }
|
||||||
void setListFrameTags(bool value) { m_listFrameTags = value; }
|
void setListTags(bool value) { m_listTags = value; }
|
||||||
void setListLayers(bool value) { m_listLayers = value; }
|
void setListLayers(bool value) { m_listLayers = value; }
|
||||||
void setListSlices(bool value) { m_listSlices = value; }
|
void setListSlices(bool value) { m_listSlices = value; }
|
||||||
|
|
||||||
void addDocument(Doc* document,
|
void addDocument(Doc* document,
|
||||||
doc::FrameTag* tag,
|
doc::Tag* tag,
|
||||||
doc::SelectedLayers* selLayers,
|
doc::SelectedLayers* selLayers,
|
||||||
doc::SelectedFrames* selFrames) {
|
doc::SelectedFrames* selFrames) {
|
||||||
m_documents.push_back(Item(document, tag, selLayers, selFrames));
|
m_documents.push_back(Item(document, tag, selLayers, selFrames));
|
||||||
@ -106,12 +107,12 @@ namespace app {
|
|||||||
class Item {
|
class Item {
|
||||||
public:
|
public:
|
||||||
Doc* doc;
|
Doc* doc;
|
||||||
doc::FrameTag* frameTag;
|
doc::Tag* tag;
|
||||||
doc::SelectedLayers* selLayers;
|
doc::SelectedLayers* selLayers;
|
||||||
doc::SelectedFrames* selFrames;
|
doc::SelectedFrames* selFrames;
|
||||||
|
|
||||||
Item(Doc* doc,
|
Item(Doc* doc,
|
||||||
doc::FrameTag* frameTag,
|
doc::Tag* tag,
|
||||||
doc::SelectedLayers* selLayers,
|
doc::SelectedLayers* selLayers,
|
||||||
doc::SelectedFrames* selFrames);
|
doc::SelectedFrames* selFrames);
|
||||||
Item(Item&& other);
|
Item(Item&& other);
|
||||||
@ -142,7 +143,7 @@ namespace app {
|
|||||||
Items m_documents;
|
Items m_documents;
|
||||||
std::string m_filenameFormat;
|
std::string m_filenameFormat;
|
||||||
doc::ImageBufferPtr m_sampleRenderBuf;
|
doc::ImageBufferPtr m_sampleRenderBuf;
|
||||||
bool m_listFrameTags;
|
bool m_listTags;
|
||||||
bool m_listLayers;
|
bool m_listLayers;
|
||||||
bool m_listSlices;
|
bool m_listSlices;
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ namespace app {
|
|||||||
virtual void onAddFrame(DocEvent& ev) { }
|
virtual void onAddFrame(DocEvent& ev) { }
|
||||||
virtual void onAddCel(DocEvent& ev) { }
|
virtual void onAddCel(DocEvent& ev) { }
|
||||||
virtual void onAddSlice(DocEvent& ev) { }
|
virtual void onAddSlice(DocEvent& ev) { }
|
||||||
virtual void onAddFrameTag(DocEvent& ev) { }
|
virtual void onAddTag(DocEvent& ev) { }
|
||||||
|
|
||||||
virtual void onBeforeRemoveLayer(DocEvent& ev) { }
|
virtual void onBeforeRemoveLayer(DocEvent& ev) { }
|
||||||
virtual void onAfterRemoveLayer(DocEvent& ev) { }
|
virtual void onAfterRemoveLayer(DocEvent& ev) { }
|
||||||
@ -39,7 +39,7 @@ namespace app {
|
|||||||
// Called when a frame is removed. It's called after the frame was
|
// Called when a frame is removed. It's called after the frame was
|
||||||
// removed, and the sprite's total number of frames is modified.
|
// removed, and the sprite's total number of frames is modified.
|
||||||
virtual void onRemoveFrame(DocEvent& ev) { }
|
virtual void onRemoveFrame(DocEvent& ev) { }
|
||||||
virtual void onRemoveFrameTag(DocEvent& ev) { }
|
virtual void onRemoveTag(DocEvent& ev) { }
|
||||||
virtual void onRemoveCel(DocEvent& ev) { }
|
virtual void onRemoveCel(DocEvent& ev) { }
|
||||||
virtual void onRemoveSlice(DocEvent& ev) { }
|
virtual void onRemoveSlice(DocEvent& ev) { }
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ static DocRange drop_range_op(
|
|||||||
(place == kDocRangeBefore && to.firstFrame() == from.lastFrame()+1) ||
|
(place == kDocRangeBefore && to.firstFrame() == from.lastFrame()+1) ||
|
||||||
(place == kDocRangeAfter && to.lastFrame() == from.firstFrame()-1)) &&
|
(place == kDocRangeAfter && to.lastFrame() == from.firstFrame()-1)) &&
|
||||||
// If there are tags, this might not be a no-op
|
// If there are tags, this might not be a no-op
|
||||||
(sprite->frameTags().empty() ||
|
(sprite->tags().empty() ||
|
||||||
tagsHandling == kDontAdjustTags)) {
|
tagsHandling == kDontAdjustTags)) {
|
||||||
return from;
|
return from;
|
||||||
}
|
}
|
||||||
|
@ -1285,10 +1285,10 @@ TEST(DocRangeOps2, DropInsideBugs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DocRangeOps, MoveRangeWithTags) {
|
TEST_F(DocRangeOps, MoveRangeWithTags) {
|
||||||
FrameTag* a = new FrameTag(0, 2);
|
auto a = new Tag(0, 2);
|
||||||
FrameTag* b = new FrameTag(3, 5);
|
auto b = new Tag(3, 5);
|
||||||
sprite->frameTags().add(a);
|
sprite->tags().add(a);
|
||||||
sprite->frameTags().add(b);
|
sprite->tags().add(b);
|
||||||
|
|
||||||
EXPECT_EQ(0, a->fromFrame());
|
EXPECT_EQ(0, a->fromFrame());
|
||||||
EXPECT_EQ(2, a->toFrame());
|
EXPECT_EQ(2, a->toFrame());
|
||||||
@ -1467,10 +1467,10 @@ TEST_F(DocRangeOps, MoveRangeWithTags) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DocRangeOps, CopyRangeWithTags) {
|
TEST_F(DocRangeOps, CopyRangeWithTags) {
|
||||||
FrameTag* a = new FrameTag(0, 2);
|
auto a = new Tag(0, 2);
|
||||||
FrameTag* b = new FrameTag(3, 5);
|
auto b = new Tag(3, 5);
|
||||||
sprite->frameTags().add(a);
|
sprite->tags().add(a);
|
||||||
sprite->frameTags().add(b);
|
sprite->tags().add(b);
|
||||||
|
|
||||||
EXPECT_EQ(0, a->fromFrame());
|
EXPECT_EQ(0, a->fromFrame());
|
||||||
EXPECT_EQ(2, a->toFrame());
|
EXPECT_EQ(2, a->toFrame());
|
||||||
|
@ -120,7 +120,7 @@ static void ase_file_write_color_profile(FILE* f,
|
|||||||
#if 0
|
#if 0
|
||||||
static void ase_file_write_mask_chunk(FILE* f, dio::AsepriteFrameHeader* frame_header, Mask* mask);
|
static void ase_file_write_mask_chunk(FILE* f, dio::AsepriteFrameHeader* frame_header, Mask* mask);
|
||||||
#endif
|
#endif
|
||||||
static void ase_file_write_tags_chunk(FILE* f, dio::AsepriteFrameHeader* frame_header, const FrameTags* frameTags,
|
static void ase_file_write_tags_chunk(FILE* f, dio::AsepriteFrameHeader* frame_header, const Tags* tags,
|
||||||
const frame_t fromFrame, const frame_t toFrame);
|
const frame_t fromFrame, const frame_t toFrame);
|
||||||
static void ase_file_write_slice_chunks(FILE* f, dio::AsepriteFrameHeader* frame_header, const Slices& slices,
|
static void ase_file_write_slice_chunks(FILE* f, dio::AsepriteFrameHeader* frame_header, const Slices& slices,
|
||||||
const frame_t fromFrame, const frame_t toFrame);
|
const frame_t fromFrame, const frame_t toFrame);
|
||||||
@ -172,7 +172,7 @@ class AseFormat : public FileFormat {
|
|||||||
FILE_SUPPORT_LAYERS |
|
FILE_SUPPORT_LAYERS |
|
||||||
FILE_SUPPORT_FRAMES |
|
FILE_SUPPORT_FRAMES |
|
||||||
FILE_SUPPORT_PALETTES |
|
FILE_SUPPORT_PALETTES |
|
||||||
FILE_SUPPORT_FRAME_TAGS |
|
FILE_SUPPORT_TAGS |
|
||||||
FILE_SUPPORT_BIG_PALETTES |
|
FILE_SUPPORT_BIG_PALETTES |
|
||||||
FILE_SUPPORT_PALETTE_WITH_ALPHA;
|
FILE_SUPPORT_PALETTE_WITH_ALPHA;
|
||||||
}
|
}
|
||||||
@ -304,8 +304,8 @@ bool AseFormat::onSave(FileOp* fop)
|
|||||||
ase_file_write_layers(f, &frame_header, child, 0);
|
ase_file_write_layers(f, &frame_header, child, 0);
|
||||||
|
|
||||||
// Writer frame tags
|
// Writer frame tags
|
||||||
if (sprite->frameTags().size() > 0)
|
if (sprite->tags().size() > 0)
|
||||||
ase_file_write_tags_chunk(f, &frame_header, &sprite->frameTags(),
|
ase_file_write_tags_chunk(f, &frame_header, &sprite->tags(),
|
||||||
fop->roi().fromFrame(),
|
fop->roi().fromFrame(),
|
||||||
fop->roi().toFrame());
|
fop->roi().toFrame());
|
||||||
|
|
||||||
@ -921,25 +921,28 @@ static void ase_file_write_mask_chunk(FILE* f, dio::AsepriteFrameHeader* frame_h
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void ase_file_write_tags_chunk(FILE* f, dio::AsepriteFrameHeader* frame_header, const FrameTags* frameTags,
|
static void ase_file_write_tags_chunk(FILE* f,
|
||||||
const frame_t fromFrame, const frame_t toFrame)
|
dio::AsepriteFrameHeader* frame_header,
|
||||||
|
const Tags* tags,
|
||||||
|
const frame_t fromFrame,
|
||||||
|
const frame_t toFrame)
|
||||||
{
|
{
|
||||||
ChunkWriter chunk(f, frame_header, ASE_FILE_CHUNK_TAGS);
|
ChunkWriter chunk(f, frame_header, ASE_FILE_CHUNK_TAGS);
|
||||||
|
|
||||||
int tags = 0;
|
int ntags = 0;
|
||||||
for (const FrameTag* tag : *frameTags) {
|
for (const Tag* tag : *tags) {
|
||||||
// Skip tags that are outside of the given ROI
|
// Skip tags that are outside of the given ROI
|
||||||
if (tag->fromFrame() > toFrame ||
|
if (tag->fromFrame() > toFrame ||
|
||||||
tag->toFrame() < fromFrame)
|
tag->toFrame() < fromFrame)
|
||||||
continue;
|
continue;
|
||||||
++tags;
|
++ntags;
|
||||||
}
|
}
|
||||||
|
|
||||||
fputw(tags, f);
|
fputw(ntags, f);
|
||||||
fputl(0, f); // 8 reserved bytes
|
fputl(0, f); // 8 reserved bytes
|
||||||
fputl(0, f);
|
fputl(0, f);
|
||||||
|
|
||||||
for (const FrameTag* tag : *frameTags) {
|
for (const Tag* tag : *tags) {
|
||||||
if (tag->fromFrame() > toFrame ||
|
if (tag->fromFrame() > toFrame ||
|
||||||
tag->toFrame() < fromFrame)
|
tag->toFrame() < fromFrame)
|
||||||
continue;
|
continue;
|
||||||
|
@ -138,18 +138,18 @@ bool is_static_image_format(const std::string& filename)
|
|||||||
FileOpROI::FileOpROI()
|
FileOpROI::FileOpROI()
|
||||||
: m_document(nullptr)
|
: m_document(nullptr)
|
||||||
, m_slice(nullptr)
|
, m_slice(nullptr)
|
||||||
, m_frameTag(nullptr)
|
, m_tag(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
FileOpROI::FileOpROI(const Doc* doc,
|
FileOpROI::FileOpROI(const Doc* doc,
|
||||||
const std::string& sliceName,
|
const std::string& sliceName,
|
||||||
const std::string& frameTagName,
|
const std::string& tagName,
|
||||||
const doc::SelectedFrames& selFrames,
|
const doc::SelectedFrames& selFrames,
|
||||||
const bool adjustByFrameTag)
|
const bool adjustByTag)
|
||||||
: m_document(doc)
|
: m_document(doc)
|
||||||
, m_slice(nullptr)
|
, m_slice(nullptr)
|
||||||
, m_frameTag(nullptr)
|
, m_tag(nullptr)
|
||||||
, m_selFrames(selFrames)
|
, m_selFrames(selFrames)
|
||||||
{
|
{
|
||||||
if (doc) {
|
if (doc) {
|
||||||
@ -157,18 +157,18 @@ FileOpROI::FileOpROI(const Doc* doc,
|
|||||||
m_slice = doc->sprite()->slices().getByName(sliceName);
|
m_slice = doc->sprite()->slices().getByName(sliceName);
|
||||||
|
|
||||||
// Don't allow exporting frame tags with empty names
|
// Don't allow exporting frame tags with empty names
|
||||||
if (!frameTagName.empty())
|
if (!tagName.empty())
|
||||||
m_frameTag = doc->sprite()->frameTags().getByName(frameTagName);
|
m_tag = doc->sprite()->tags().getByName(tagName);
|
||||||
|
|
||||||
if (m_frameTag) {
|
if (m_tag) {
|
||||||
if (m_selFrames.empty())
|
if (m_selFrames.empty())
|
||||||
m_selFrames.insert(m_frameTag->fromFrame(), m_frameTag->toFrame());
|
m_selFrames.insert(m_tag->fromFrame(), m_tag->toFrame());
|
||||||
else if (adjustByFrameTag)
|
else if (adjustByTag)
|
||||||
m_selFrames.displace(m_frameTag->fromFrame());
|
m_selFrames.displace(m_tag->fromFrame());
|
||||||
|
|
||||||
m_selFrames =
|
m_selFrames =
|
||||||
m_selFrames.filter(MAX(0, m_frameTag->fromFrame()),
|
m_selFrames.filter(MAX(0, m_tag->fromFrame()),
|
||||||
MIN(m_frameTag->toFrame(), doc->sprite()->lastFrame()));
|
MIN(m_tag->toFrame(), doc->sprite()->lastFrame()));
|
||||||
}
|
}
|
||||||
// All frames if selected frames is empty
|
// All frames if selected frames is empty
|
||||||
else if (m_selFrames.empty())
|
else if (m_selFrames.empty())
|
||||||
@ -424,9 +424,9 @@ FileOp* FileOp::createSaveDocumentOperation(const Context* context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check frames support
|
// Check frames support
|
||||||
if (!fop->m_document->sprite()->frameTags().empty()) {
|
if (!fop->m_document->sprite()->tags().empty()) {
|
||||||
if (!fop->m_format->support(FILE_SUPPORT_FRAME_TAGS)) {
|
if (!fop->m_format->support(FILE_SUPPORT_TAGS)) {
|
||||||
warnings += "<<- " + Strings::alerts_file_format_frame_tags();
|
warnings += "<<- " + Strings::alerts_file_format_tags();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,8 +507,8 @@ FileOp* FileOp::createSaveDocumentOperation(const Context* context,
|
|||||||
frame_t outputFrame = 0;
|
frame_t outputFrame = 0;
|
||||||
|
|
||||||
for (frame_t frame : fop->m_roi.selectedFrames()) {
|
for (frame_t frame : fop->m_roi.selectedFrames()) {
|
||||||
FrameTag* innerTag = (fop->m_roi.frameTag() ? fop->m_roi.frameTag(): spr->frameTags().innerTag(frame));
|
Tag* innerTag = (fop->m_roi.tag() ? fop->m_roi.tag(): spr->tags().innerTag(frame));
|
||||||
FrameTag* outerTag = (fop->m_roi.frameTag() ? fop->m_roi.frameTag(): spr->frameTags().outerTag(frame));
|
Tag* outerTag = (fop->m_roi.tag() ? fop->m_roi.tag(): spr->tags().outerTag(frame));
|
||||||
FilenameInfo fnInfo;
|
FilenameInfo fnInfo;
|
||||||
fnInfo
|
fnInfo
|
||||||
.filename(fn)
|
.filename(fn)
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#define FILE_LOAD_CREATE_PALETTE 0x00000040
|
#define FILE_LOAD_CREATE_PALETTE 0x00000040
|
||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
class FrameTag;
|
class Tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
@ -72,13 +72,13 @@ namespace app {
|
|||||||
FileOpROI();
|
FileOpROI();
|
||||||
FileOpROI(const Doc* doc,
|
FileOpROI(const Doc* doc,
|
||||||
const std::string& sliceName,
|
const std::string& sliceName,
|
||||||
const std::string& frameTagName,
|
const std::string& tagName,
|
||||||
const doc::SelectedFrames& selFrames,
|
const doc::SelectedFrames& selFrames,
|
||||||
const bool adjustByFrameTag);
|
const bool adjustByTag);
|
||||||
|
|
||||||
const Doc* document() const { return m_document; }
|
const Doc* document() const { return m_document; }
|
||||||
doc::Slice* slice() const { return m_slice; }
|
doc::Slice* slice() const { return m_slice; }
|
||||||
doc::FrameTag* frameTag() const { return m_frameTag; }
|
doc::Tag* tag() const { return m_tag; }
|
||||||
doc::frame_t fromFrame() const { return m_selFrames.firstFrame(); }
|
doc::frame_t fromFrame() const { return m_selFrames.firstFrame(); }
|
||||||
doc::frame_t toFrame() const { return m_selFrames.lastFrame(); }
|
doc::frame_t toFrame() const { return m_selFrames.lastFrame(); }
|
||||||
const doc::SelectedFrames& selectedFrames() const { return m_selFrames; }
|
const doc::SelectedFrames& selectedFrames() const { return m_selFrames; }
|
||||||
@ -90,7 +90,7 @@ namespace app {
|
|||||||
private:
|
private:
|
||||||
const Doc* m_document;
|
const Doc* m_document;
|
||||||
doc::Slice* m_slice;
|
doc::Slice* m_slice;
|
||||||
doc::FrameTag* m_frameTag;
|
doc::Tag* m_tag;
|
||||||
doc::SelectedFrames m_selFrames;
|
doc::SelectedFrames m_selFrames;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#define FILE_SUPPORT_PALETTES 0x00000200
|
#define FILE_SUPPORT_PALETTES 0x00000200
|
||||||
#define FILE_SUPPORT_SEQUENCES 0x00000400
|
#define FILE_SUPPORT_SEQUENCES 0x00000400
|
||||||
#define FILE_SUPPORT_GET_FORMAT_OPTIONS 0x00000800
|
#define FILE_SUPPORT_GET_FORMAT_OPTIONS 0x00000800
|
||||||
#define FILE_SUPPORT_FRAME_TAGS 0x00001000
|
#define FILE_SUPPORT_TAGS 0x00001000
|
||||||
#define FILE_SUPPORT_BIG_PALETTES 0x00002000 // Palettes w/more than 256 colors
|
#define FILE_SUPPORT_BIG_PALETTES 0x00002000 // Palettes w/more than 256 colors
|
||||||
#define FILE_SUPPORT_PALETTE_WITH_ALPHA 0x00004000
|
#define FILE_SUPPORT_PALETTE_WITH_ALPHA 0x00004000
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ std::string get_default_filename_format(
|
|||||||
const bool withPath,
|
const bool withPath,
|
||||||
const bool hasFrames,
|
const bool hasFrames,
|
||||||
const bool hasLayer,
|
const bool hasLayer,
|
||||||
const bool hasFrameTag)
|
const bool hasTag)
|
||||||
{
|
{
|
||||||
std::string format;
|
std::string format;
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ std::string get_default_filename_format(
|
|||||||
if (hasLayer)
|
if (hasLayer)
|
||||||
format += " ({layer})";
|
format += " ({layer})";
|
||||||
|
|
||||||
if (hasFrameTag)
|
if (hasTag)
|
||||||
format += " #{tag}";
|
format += " #{tag}";
|
||||||
|
|
||||||
if (hasFrames && is_static_image_format(filename) &&
|
if (hasFrames && is_static_image_format(filename) &&
|
||||||
@ -149,7 +149,7 @@ std::string get_default_filename_format(
|
|||||||
filename.find("{tagframe") == std::string::npos) {
|
filename.find("{tagframe") == std::string::npos) {
|
||||||
const bool autoFrameFromLastDigit =
|
const bool autoFrameFromLastDigit =
|
||||||
(!hasLayer &&
|
(!hasLayer &&
|
||||||
!hasFrameTag);
|
!hasTag);
|
||||||
|
|
||||||
// Check if we already have a frame number at the end of the
|
// Check if we already have a frame number at the end of the
|
||||||
// filename (e.g. output01.png)
|
// filename (e.g. output01.png)
|
||||||
@ -161,7 +161,7 @@ std::string get_default_filename_format(
|
|||||||
std::vector<char> buf(32);
|
std::vector<char> buf(32);
|
||||||
std::sprintf(&buf[0], "{frame%0*d}", frameWidth, frameBase);
|
std::sprintf(&buf[0], "{frame%0*d}", frameWidth, frameBase);
|
||||||
|
|
||||||
if (hasLayer || hasFrameTag)
|
if (hasLayer || hasTag)
|
||||||
format += " ";
|
format += " ";
|
||||||
format += &buf[0];
|
format += &buf[0];
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ std::string get_default_filename_format(
|
|||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (hasLayer || hasFrameTag)
|
if (hasLayer || hasTag)
|
||||||
format += " {frame}";
|
format += " {frame}";
|
||||||
else
|
else
|
||||||
format += "{frame1}";
|
format += "{frame1}";
|
||||||
@ -189,14 +189,14 @@ std::string get_default_filename_format_for_sheet(
|
|||||||
const std::string& filename,
|
const std::string& filename,
|
||||||
const bool hasFrames,
|
const bool hasFrames,
|
||||||
const bool hasLayer,
|
const bool hasLayer,
|
||||||
const bool hasFrameTag)
|
const bool hasTag)
|
||||||
{
|
{
|
||||||
std::string format = "{title}";
|
std::string format = "{title}";
|
||||||
|
|
||||||
if (hasLayer)
|
if (hasLayer)
|
||||||
format += " ({layer})";
|
format += " ({layer})";
|
||||||
|
|
||||||
if (hasFrameTag)
|
if (hasTag)
|
||||||
format += " #{tag}";
|
format += " #{tag}";
|
||||||
|
|
||||||
if (hasFrames) {
|
if (hasFrames) {
|
||||||
|
@ -100,13 +100,13 @@ namespace app {
|
|||||||
const bool withPath,
|
const bool withPath,
|
||||||
const bool hasFrames,
|
const bool hasFrames,
|
||||||
const bool hasLayer,
|
const bool hasLayer,
|
||||||
const bool hasFrameTag);
|
const bool hasTag);
|
||||||
|
|
||||||
std::string get_default_filename_format_for_sheet(
|
std::string get_default_filename_format_for_sheet(
|
||||||
const std::string& filename,
|
const std::string& filename,
|
||||||
const bool hasFrames,
|
const bool hasFrames,
|
||||||
const bool hasLayer,
|
const bool hasLayer,
|
||||||
const bool hasFrameTag);
|
const bool hasTag);
|
||||||
|
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -11,30 +12,30 @@
|
|||||||
#include "app/loop_tag.h"
|
#include "app/loop_tag.h"
|
||||||
|
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
#include "doc/frame_tag.h"
|
#include "doc/tag.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
const char* kLoopTagName = "Loop";
|
const char* kLoopTagName = "Loop";
|
||||||
|
|
||||||
doc::FrameTag* get_animation_tag(const doc::Sprite* sprite, doc::frame_t frame)
|
doc::Tag* get_animation_tag(const doc::Sprite* sprite, doc::frame_t frame)
|
||||||
{
|
{
|
||||||
return sprite->frameTags().innerTag(frame);
|
return sprite->tags().innerTag(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
doc::FrameTag* get_loop_tag(const doc::Sprite* sprite)
|
doc::Tag* get_loop_tag(const doc::Sprite* sprite)
|
||||||
{
|
{
|
||||||
// Get tag with special "Loop" name
|
// Get tag with special "Loop" name
|
||||||
for (doc::FrameTag* tag : sprite->frameTags())
|
for (doc::Tag* tag : sprite->tags())
|
||||||
if (tag->name() == kLoopTagName)
|
if (tag->name() == kLoopTagName)
|
||||||
return tag;
|
return tag;
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
doc::FrameTag* create_loop_tag(doc::frame_t from, doc::frame_t to)
|
doc::Tag* create_loop_tag(doc::frame_t from, doc::frame_t to)
|
||||||
{
|
{
|
||||||
doc::FrameTag* tag = new doc::FrameTag(from, to);
|
doc::Tag* tag = new doc::Tag(from, to);
|
||||||
tag->setName(kLoopTagName);
|
tag->setName(kLoopTagName);
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -11,22 +12,22 @@
|
|||||||
#include "doc/frame.h"
|
#include "doc/frame.h"
|
||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
class FrameTag;
|
|
||||||
class Sprite;
|
class Sprite;
|
||||||
|
class Tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
class FrameTagProvider {
|
class TagProvider {
|
||||||
public:
|
public:
|
||||||
virtual ~FrameTagProvider() { }
|
virtual ~TagProvider() { }
|
||||||
virtual doc::FrameTag* getFrameTagByFrame(const doc::frame_t frame,
|
virtual doc::Tag* getTagByFrame(const doc::frame_t frame,
|
||||||
const bool getLoopTagIfNone) = 0;
|
const bool getLoopTagIfNone) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
doc::FrameTag* get_animation_tag(const doc::Sprite* sprite, doc::frame_t frame);
|
doc::Tag* get_animation_tag(const doc::Sprite* sprite, doc::frame_t frame);
|
||||||
doc::FrameTag* get_loop_tag(const doc::Sprite* sprite);
|
doc::Tag* get_loop_tag(const doc::Sprite* sprite);
|
||||||
doc::FrameTag* create_loop_tag(doc::frame_t from, doc::frame_t to);
|
doc::Tag* create_loop_tag(doc::frame_t from, doc::frame_t to);
|
||||||
|
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
|
||||||
|
@ -39,9 +39,9 @@
|
|||||||
#include "base/fs.h"
|
#include "base/fs.h"
|
||||||
#include "base/replace_string.h"
|
#include "base/replace_string.h"
|
||||||
#include "base/version.h"
|
#include "base/version.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/layer.h"
|
#include "doc/layer.h"
|
||||||
#include "doc/primitives.h"
|
#include "doc/primitives.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
#include "render/render.h"
|
#include "render/render.h"
|
||||||
#include "ui/alert.h"
|
#include "ui/alert.h"
|
||||||
|
|
||||||
@ -403,14 +403,14 @@ int App_get_activeImage(lua_State* L)
|
|||||||
|
|
||||||
int App_get_activeTag(lua_State* L)
|
int App_get_activeTag(lua_State* L)
|
||||||
{
|
{
|
||||||
FrameTag* tag = nullptr;
|
Tag* tag = nullptr;
|
||||||
|
|
||||||
app::Context* ctx = App::instance()->context();
|
app::Context* ctx = App::instance()->context();
|
||||||
Site site = ctx->activeSite();
|
Site site = ctx->activeSite();
|
||||||
if (site.sprite()) {
|
if (site.sprite()) {
|
||||||
#ifdef ENABLE_UI
|
#ifdef ENABLE_UI
|
||||||
if (App::instance()->timeline()) {
|
if (App::instance()->timeline()) {
|
||||||
tag = App::instance()->timeline()->getFrameTagByFrame(site.frame(), false);
|
tag = App::instance()->timeline()->getTagByFrame(site.frame(), false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -36,13 +36,13 @@ namespace gfx {
|
|||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
class Cel;
|
class Cel;
|
||||||
class FrameTag;
|
|
||||||
class Image;
|
class Image;
|
||||||
class Layer;
|
class Layer;
|
||||||
class LayerGroup;
|
class LayerGroup;
|
||||||
class Mask;
|
class Mask;
|
||||||
class Palette;
|
class Palette;
|
||||||
class Sprite;
|
class Sprite;
|
||||||
|
class Tag;
|
||||||
class WithUserData;
|
class WithUserData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
#include "app/cmd/clear_cel.h"
|
#include "app/cmd/clear_cel.h"
|
||||||
#include "app/cmd/convert_color_profile.h"
|
#include "app/cmd/convert_color_profile.h"
|
||||||
#include "app/cmd/flatten_layers.h"
|
#include "app/cmd/flatten_layers.h"
|
||||||
#include "app/cmd/remove_frame_tag.h"
|
|
||||||
#include "app/cmd/remove_layer.h"
|
#include "app/cmd/remove_layer.h"
|
||||||
#include "app/cmd/remove_slice.h"
|
#include "app/cmd/remove_slice.h"
|
||||||
|
#include "app/cmd/remove_tag.h"
|
||||||
#include "app/cmd/set_mask.h"
|
#include "app/cmd/set_mask.h"
|
||||||
#include "app/cmd/set_sprite_size.h"
|
#include "app/cmd/set_sprite_size.h"
|
||||||
#include "app/cmd/set_transparent_color.h"
|
#include "app/cmd/set_transparent_color.h"
|
||||||
@ -40,12 +40,12 @@
|
|||||||
#include "app/ui/doc_view.h"
|
#include "app/ui/doc_view.h"
|
||||||
#include "base/convert_to.h"
|
#include "base/convert_to.h"
|
||||||
#include "base/fs.h"
|
#include "base/fs.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/layer.h"
|
#include "doc/layer.h"
|
||||||
#include "doc/mask.h"
|
#include "doc/mask.h"
|
||||||
#include "doc/palette.h"
|
#include "doc/palette.h"
|
||||||
#include "doc/slice.h"
|
#include "doc/slice.h"
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@ -502,10 +502,10 @@ int Sprite_newTag(lua_State* L)
|
|||||||
auto sprite = get_docobj<Sprite>(L, 1);
|
auto sprite = get_docobj<Sprite>(L, 1);
|
||||||
auto from = get_frame_number_from_arg(L, 2);
|
auto from = get_frame_number_from_arg(L, 2);
|
||||||
auto to = get_frame_number_from_arg(L, 3);
|
auto to = get_frame_number_from_arg(L, 3);
|
||||||
auto tag = new doc::FrameTag(from, to);
|
auto tag = new doc::Tag(from, to);
|
||||||
|
|
||||||
Tx tx;
|
Tx tx;
|
||||||
tx(new cmd::AddFrameTag(sprite, tag));
|
tx(new cmd::AddTag(sprite, tag));
|
||||||
tx.commit();
|
tx.commit();
|
||||||
|
|
||||||
push_docobj(L, tag);
|
push_docobj(L, tag);
|
||||||
@ -515,15 +515,15 @@ int Sprite_newTag(lua_State* L)
|
|||||||
int Sprite_deleteTag(lua_State* L)
|
int Sprite_deleteTag(lua_State* L)
|
||||||
{
|
{
|
||||||
auto sprite = get_docobj<Sprite>(L, 1);
|
auto sprite = get_docobj<Sprite>(L, 1);
|
||||||
auto tag = may_get_docobj<FrameTag>(L, 2);
|
auto tag = may_get_docobj<Tag>(L, 2);
|
||||||
if (!tag && lua_isstring(L, 2)) {
|
if (!tag && lua_isstring(L, 2)) {
|
||||||
const char* tagName = lua_tostring(L, 2);
|
const char* tagName = lua_tostring(L, 2);
|
||||||
if (tagName)
|
if (tagName)
|
||||||
tag = sprite->frameTags().getByName(tagName);
|
tag = sprite->tags().getByName(tagName);
|
||||||
}
|
}
|
||||||
if (tag) {
|
if (tag) {
|
||||||
Tx tx;
|
Tx tx;
|
||||||
tx(new cmd::RemoveFrameTag(sprite, tag));
|
tx(new cmd::RemoveTag(sprite, tag));
|
||||||
tx.commit();
|
tx.commit();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018 Igara Studio S.A.
|
// Copyright (C) 2018-2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2018 David Capello
|
// Copyright (C) 2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -9,15 +9,15 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "app/cmd/set_frame_tag_anidir.h"
|
#include "app/cmd/set_tag_anidir.h"
|
||||||
#include "app/cmd/set_frame_tag_name.h"
|
#include "app/cmd/set_tag_name.h"
|
||||||
#include "app/cmd/set_frame_tag_range.h"
|
#include "app/cmd/set_tag_range.h"
|
||||||
#include "app/script/docobj.h"
|
#include "app/script/docobj.h"
|
||||||
#include "app/script/engine.h"
|
#include "app/script/engine.h"
|
||||||
#include "app/script/luacpp.h"
|
#include "app/script/luacpp.h"
|
||||||
#include "app/tx.h"
|
#include "app/tx.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
namespace script {
|
namespace script {
|
||||||
@ -28,22 +28,22 @@ namespace {
|
|||||||
|
|
||||||
int Tag_eq(lua_State* L)
|
int Tag_eq(lua_State* L)
|
||||||
{
|
{
|
||||||
const auto a = get_docobj<FrameTag>(L, 1);
|
const auto a = get_docobj<Tag>(L, 1);
|
||||||
const auto b = get_docobj<FrameTag>(L, 2);
|
const auto b = get_docobj<Tag>(L, 2);
|
||||||
lua_pushboolean(L, a->id() == b->id());
|
lua_pushboolean(L, a->id() == b->id());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Tag_get_sprite(lua_State* L)
|
int Tag_get_sprite(lua_State* L)
|
||||||
{
|
{
|
||||||
auto tag = get_docobj<FrameTag>(L, 1);
|
auto tag = get_docobj<Tag>(L, 1);
|
||||||
push_docobj(L, tag->owner()->sprite());
|
push_docobj(L, tag->owner()->sprite());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Tag_get_fromFrame(lua_State* L)
|
int Tag_get_fromFrame(lua_State* L)
|
||||||
{
|
{
|
||||||
auto tag = get_docobj<FrameTag>(L, 1);
|
auto tag = get_docobj<Tag>(L, 1);
|
||||||
if (tag->owner()->sprite())
|
if (tag->owner()->sprite())
|
||||||
push_sprite_frame(L, tag->owner()->sprite(), tag->fromFrame());
|
push_sprite_frame(L, tag->owner()->sprite(), tag->fromFrame());
|
||||||
else
|
else
|
||||||
@ -53,7 +53,7 @@ int Tag_get_fromFrame(lua_State* L)
|
|||||||
|
|
||||||
int Tag_get_toFrame(lua_State* L)
|
int Tag_get_toFrame(lua_State* L)
|
||||||
{
|
{
|
||||||
auto tag = get_docobj<FrameTag>(L, 1);
|
auto tag = get_docobj<Tag>(L, 1);
|
||||||
if (tag->owner()->sprite())
|
if (tag->owner()->sprite())
|
||||||
push_sprite_frame(L, tag->owner()->sprite(), tag->toFrame());
|
push_sprite_frame(L, tag->owner()->sprite(), tag->toFrame());
|
||||||
else
|
else
|
||||||
@ -63,42 +63,42 @@ int Tag_get_toFrame(lua_State* L)
|
|||||||
|
|
||||||
int Tag_get_frames(lua_State* L)
|
int Tag_get_frames(lua_State* L)
|
||||||
{
|
{
|
||||||
auto tag = get_docobj<FrameTag>(L, 1);
|
auto tag = get_docobj<Tag>(L, 1);
|
||||||
lua_pushinteger(L, tag->frames());
|
lua_pushinteger(L, tag->frames());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Tag_get_name(lua_State* L)
|
int Tag_get_name(lua_State* L)
|
||||||
{
|
{
|
||||||
auto tag = get_docobj<FrameTag>(L, 1);
|
auto tag = get_docobj<Tag>(L, 1);
|
||||||
lua_pushstring(L, tag->name().c_str());
|
lua_pushstring(L, tag->name().c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Tag_get_aniDir(lua_State* L)
|
int Tag_get_aniDir(lua_State* L)
|
||||||
{
|
{
|
||||||
auto tag = get_docobj<FrameTag>(L, 1);
|
auto tag = get_docobj<Tag>(L, 1);
|
||||||
lua_pushinteger(L, (int)tag->aniDir());
|
lua_pushinteger(L, (int)tag->aniDir());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Tag_set_fromFrame(lua_State* L)
|
int Tag_set_fromFrame(lua_State* L)
|
||||||
{
|
{
|
||||||
auto tag = get_docobj<FrameTag>(L, 1);
|
auto tag = get_docobj<Tag>(L, 1);
|
||||||
const auto fromFrame = get_frame_number_from_arg(L, 2);
|
const auto fromFrame = get_frame_number_from_arg(L, 2);
|
||||||
Tx tx;
|
Tx tx;
|
||||||
tx(new cmd::SetFrameTagRange(tag, fromFrame,
|
tx(new cmd::SetTagRange(tag, fromFrame,
|
||||||
std::max(fromFrame, tag->toFrame())));
|
std::max(fromFrame, tag->toFrame())));
|
||||||
tx.commit();
|
tx.commit();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Tag_set_toFrame(lua_State* L)
|
int Tag_set_toFrame(lua_State* L)
|
||||||
{
|
{
|
||||||
auto tag = get_docobj<FrameTag>(L, 1);
|
auto tag = get_docobj<Tag>(L, 1);
|
||||||
const auto toFrame = get_frame_number_from_arg(L, 2);
|
const auto toFrame = get_frame_number_from_arg(L, 2);
|
||||||
Tx tx;
|
Tx tx;
|
||||||
tx(new cmd::SetFrameTagRange(tag,
|
tx(new cmd::SetTagRange(tag,
|
||||||
std::min(tag->fromFrame(), toFrame),
|
std::min(tag->fromFrame(), toFrame),
|
||||||
toFrame));
|
toFrame));
|
||||||
tx.commit();
|
tx.commit();
|
||||||
@ -107,11 +107,11 @@ int Tag_set_toFrame(lua_State* L)
|
|||||||
|
|
||||||
int Tag_set_name(lua_State* L)
|
int Tag_set_name(lua_State* L)
|
||||||
{
|
{
|
||||||
auto tag = get_docobj<FrameTag>(L, 1);
|
auto tag = get_docobj<Tag>(L, 1);
|
||||||
const char* name = lua_tostring(L, 2);
|
const char* name = lua_tostring(L, 2);
|
||||||
if (name) {
|
if (name) {
|
||||||
Tx tx;
|
Tx tx;
|
||||||
tx(new cmd::SetFrameTagName(tag, name));
|
tx(new cmd::SetTagName(tag, name));
|
||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -119,10 +119,10 @@ int Tag_set_name(lua_State* L)
|
|||||||
|
|
||||||
int Tag_set_aniDir(lua_State* L)
|
int Tag_set_aniDir(lua_State* L)
|
||||||
{
|
{
|
||||||
auto tag = get_docobj<FrameTag>(L, 1);
|
auto tag = get_docobj<Tag>(L, 1);
|
||||||
const int aniDir = lua_tointeger(L, 2);
|
const int aniDir = lua_tointeger(L, 2);
|
||||||
Tx tx;
|
Tx tx;
|
||||||
tx(new cmd::SetFrameTagAniDir(tag, (doc::AniDir)aniDir));
|
tx(new cmd::SetTagAniDir(tag, (doc::AniDir)aniDir));
|
||||||
tx.commit();
|
tx.commit();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -144,11 +144,11 @@ const Property Tag_properties[] = {
|
|||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
DEF_MTNAME(FrameTag);
|
DEF_MTNAME(Tag);
|
||||||
|
|
||||||
void register_tag_class(lua_State* L)
|
void register_tag_class(lua_State* L)
|
||||||
{
|
{
|
||||||
using Tag = doc::FrameTag;
|
using Tag = doc::Tag;
|
||||||
REG_CLASS(L, Tag);
|
REG_CLASS(L, Tag);
|
||||||
REG_CLASS_PROPERTIES(L, Tag);
|
REG_CLASS_PROPERTIES(L, Tag);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018 Igara Studio S.A.
|
// Copyright (C) 2018-2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2018 David Capello
|
// Copyright (C) 2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -12,8 +12,8 @@
|
|||||||
#include "app/script/docobj.h"
|
#include "app/script/docobj.h"
|
||||||
#include "app/script/engine.h"
|
#include "app/script/engine.h"
|
||||||
#include "app/script/luacpp.h"
|
#include "app/script/luacpp.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
namespace script {
|
namespace script {
|
||||||
@ -42,14 +42,14 @@ int Tags_gc(lua_State* L)
|
|||||||
int Tags_len(lua_State* L)
|
int Tags_len(lua_State* L)
|
||||||
{
|
{
|
||||||
auto obj = get_obj<TagsObj>(L, 1);
|
auto obj = get_obj<TagsObj>(L, 1);
|
||||||
lua_pushinteger(L, obj->sprite(L)->frameTags().size());
|
lua_pushinteger(L, obj->sprite(L)->tags().size());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Tags_index(lua_State* L)
|
int Tags_index(lua_State* L)
|
||||||
{
|
{
|
||||||
auto obj = get_obj<TagsObj>(L, 1);
|
auto obj = get_obj<TagsObj>(L, 1);
|
||||||
auto& tags = obj->sprite(L)->frameTags();
|
auto& tags = obj->sprite(L)->tags();
|
||||||
const int i = lua_tonumber(L, 2);
|
const int i = lua_tonumber(L, 2);
|
||||||
if (i >= 1 && i <= int(tags.size()))
|
if (i >= 1 && i <= int(tags.size()))
|
||||||
push_docobj(L, *(tags.begin()+i-1));
|
push_docobj(L, *(tags.begin()+i-1));
|
||||||
|
@ -104,7 +104,7 @@ public:
|
|||||||
return KeyboardShortcuts::instance()->getCurrentActionModifiers(context);
|
return KeyboardShortcuts::instance()->getCurrentActionModifiers(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameTagProvider* getFrameTagProvider() override {
|
TagProvider* getTagProvider() override {
|
||||||
return App::instance()->mainWindow()->getTimeline();
|
return App::instance()->mainWindow()->getTimeline();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ public:
|
|||||||
return KeyAction::None;
|
return KeyAction::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameTagProvider* getFrameTagProvider() override {
|
TagProvider* getTagProvider() override {
|
||||||
return App::instance()->mainWindow()->getTimeline();
|
return App::instance()->mainWindow()->getTimeline();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -631,9 +631,9 @@ void Editor::drawOneSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& sprite
|
|||||||
opts.opacityStep(m_docPref.onionskin.opacityStep());
|
opts.opacityStep(m_docPref.onionskin.opacityStep());
|
||||||
opts.layer(m_docPref.onionskin.currentLayer() ? m_layer: nullptr);
|
opts.layer(m_docPref.onionskin.currentLayer() ? m_layer: nullptr);
|
||||||
|
|
||||||
FrameTag* tag = nullptr;
|
Tag* tag = nullptr;
|
||||||
if (m_docPref.onionskin.loopTag())
|
if (m_docPref.onionskin.loopTag())
|
||||||
tag = m_sprite->frameTags().innerTag(m_frame);
|
tag = m_sprite->tags().innerTag(m_frame);
|
||||||
opts.loopTag(tag);
|
opts.loopTag(tag);
|
||||||
|
|
||||||
m_renderEngine->setOnionskin(opts);
|
m_renderEngine->setOnionskin(opts);
|
||||||
@ -2127,16 +2127,16 @@ void Editor::onRemoveCel(DocEvent& ev)
|
|||||||
m_showGuidesThisCel = nullptr;
|
m_showGuidesThisCel = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::onAddFrameTag(DocEvent& ev)
|
void Editor::onAddTag(DocEvent& ev)
|
||||||
{
|
{
|
||||||
m_tagFocusBand = -1;
|
m_tagFocusBand = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::onRemoveFrameTag(DocEvent& ev)
|
void Editor::onRemoveTag(DocEvent& ev)
|
||||||
{
|
{
|
||||||
m_tagFocusBand = -1;
|
m_tagFocusBand = -1;
|
||||||
if (m_state)
|
if (m_state)
|
||||||
m_state->onRemoveFrameTag(this, ev.frameTag());
|
m_state->onRemoveTag(this, ev.tag());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::onRemoveSlice(DocEvent& ev)
|
void Editor::onRemoveSlice(DocEvent& ev)
|
||||||
|
@ -320,8 +320,8 @@ namespace app {
|
|||||||
void onSpritePixelRatioChanged(DocEvent& ev) override;
|
void onSpritePixelRatioChanged(DocEvent& ev) override;
|
||||||
void onBeforeRemoveLayer(DocEvent& ev) override;
|
void onBeforeRemoveLayer(DocEvent& ev) override;
|
||||||
void onRemoveCel(DocEvent& ev) override;
|
void onRemoveCel(DocEvent& ev) override;
|
||||||
void onAddFrameTag(DocEvent& ev) override;
|
void onAddTag(DocEvent& ev) override;
|
||||||
void onRemoveFrameTag(DocEvent& ev) override;
|
void onRemoveTag(DocEvent& ev) override;
|
||||||
void onRemoveSlice(DocEvent& ev) override;
|
void onRemoveSlice(DocEvent& ev) override;
|
||||||
|
|
||||||
// ActiveToolObserver impl
|
// ActiveToolObserver impl
|
||||||
|
@ -16,7 +16,7 @@ namespace tools {
|
|||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
class Editor;
|
class Editor;
|
||||||
class FrameTagProvider;
|
class TagProvider;
|
||||||
|
|
||||||
class EditorCustomizationDelegate {
|
class EditorCustomizationDelegate {
|
||||||
public:
|
public:
|
||||||
@ -32,7 +32,7 @@ namespace app {
|
|||||||
virtual KeyAction getPressedKeyAction(KeyContext context) = 0;
|
virtual KeyAction getPressedKeyAction(KeyContext context) = 0;
|
||||||
|
|
||||||
// Returns the provider of active frame tag (it's the timeline).
|
// Returns the provider of active frame tag (it's the timeline).
|
||||||
virtual FrameTagProvider* getFrameTagProvider() = 0;
|
virtual TagProvider* getTagProvider() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
@ -25,7 +25,7 @@ namespace ui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
class FrameTag;
|
class Tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
@ -130,7 +130,7 @@ namespace app {
|
|||||||
virtual tools::Ink* getStateInk() const { return nullptr; }
|
virtual tools::Ink* getStateInk() const { return nullptr; }
|
||||||
|
|
||||||
// Called when a tag is deleted.
|
// Called when a tag is deleted.
|
||||||
virtual void onRemoveFrameTag(Editor* editor, doc::FrameTag* tag) { }
|
virtual void onRemoveTag(Editor* editor, doc::Tag* tag) { }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DISABLE_COPYING(EditorState);
|
DISABLE_COPYING(EditorState);
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
#include "app/ui/editor/scrolling_state.h"
|
#include "app/ui/editor/scrolling_state.h"
|
||||||
#include "app/ui/skin/skin_theme.h"
|
#include "app/ui/skin/skin_theme.h"
|
||||||
#include "app/ui_context.h"
|
#include "app/ui_context.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/handle_anidir.h"
|
#include "doc/handle_anidir.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
#include "ui/manager.h"
|
#include "ui/manager.h"
|
||||||
#include "ui/message.h"
|
#include "ui/message.h"
|
||||||
#include "ui/system.h"
|
#include "ui/system.h"
|
||||||
@ -63,8 +63,8 @@ void PlayState::onEnterState(Editor* editor)
|
|||||||
if (!m_playAll)
|
if (!m_playAll)
|
||||||
m_tag = m_editor
|
m_tag = m_editor
|
||||||
->getCustomizationDelegate()
|
->getCustomizationDelegate()
|
||||||
->getFrameTagProvider()
|
->getTagProvider()
|
||||||
->getFrameTagByFrame(m_refFrame, true);
|
->getTagByFrame(m_refFrame, true);
|
||||||
|
|
||||||
// Go to the first frame of the animation or active frame tag
|
// Go to the first frame of the animation or active frame tag
|
||||||
if (m_playOnce) {
|
if (m_playOnce) {
|
||||||
@ -167,7 +167,7 @@ bool PlayState::onSetCursor(Editor* editor, const gfx::Point& mouseScreenPos)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayState::onRemoveFrameTag(Editor* editor, doc::FrameTag* tag)
|
void PlayState::onRemoveTag(Editor* editor, doc::Tag* tag)
|
||||||
{
|
{
|
||||||
if (m_tag == tag)
|
if (m_tag == tag)
|
||||||
m_tag = nullptr;
|
m_tag = nullptr;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include "ui/timer.h"
|
#include "ui/timer.h"
|
||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
class FrameTag;
|
class Tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
@ -35,7 +35,7 @@ namespace app {
|
|||||||
bool onKeyDown(Editor* editor, ui::KeyMessage* msg) override;
|
bool onKeyDown(Editor* editor, ui::KeyMessage* msg) override;
|
||||||
bool onKeyUp(Editor* editor, ui::KeyMessage* msg) override;
|
bool onKeyUp(Editor* editor, ui::KeyMessage* msg) override;
|
||||||
bool onSetCursor(Editor* editor, const gfx::Point& mouseScreenPos) override;
|
bool onSetCursor(Editor* editor, const gfx::Point& mouseScreenPos) override;
|
||||||
void onRemoveFrameTag(Editor* editor, doc::FrameTag* tag) override;
|
void onRemoveTag(Editor* editor, doc::Tag* tag) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onPlaybackTick();
|
void onPlaybackTick();
|
||||||
@ -58,7 +58,7 @@ namespace app {
|
|||||||
|
|
||||||
bool m_pingPongForward;
|
bool m_pingPongForward;
|
||||||
doc::frame_t m_refFrame;
|
doc::frame_t m_refFrame;
|
||||||
doc::FrameTag* m_tag;
|
doc::Tag* m_tag;
|
||||||
|
|
||||||
obs::scoped_connection m_ctxConn;
|
obs::scoped_connection m_ctxConn;
|
||||||
};
|
};
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
#include "base/convert_to.h"
|
#include "base/convert_to.h"
|
||||||
#include "base/fs.h"
|
#include "base/fs.h"
|
||||||
#include "base/string.h"
|
#include "base/string.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/selected_frames.h"
|
#include "doc/selected_frames.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
#include "fmt/format.h"
|
#include "fmt/format.h"
|
||||||
#include "ui/alert.h"
|
#include "ui/alert.h"
|
||||||
|
|
||||||
@ -170,10 +170,10 @@ void ExportFileWindow::updateAniDir()
|
|||||||
framesValue != kAllFrames &&
|
framesValue != kAllFrames &&
|
||||||
framesValue != kSelectedFrames) {
|
framesValue != kSelectedFrames) {
|
||||||
SelectedFrames selFrames;
|
SelectedFrames selFrames;
|
||||||
FrameTag* frameTag = calculate_selected_frames(
|
Tag* tag = calculate_selected_frames(
|
||||||
UIContext::instance()->activeSite(), framesValue, selFrames);
|
UIContext::instance()->activeSite(), framesValue, selFrames);
|
||||||
if (frameTag)
|
if (tag)
|
||||||
anidir()->setSelectedItemIndex(int(frameTag->aniDir()));
|
anidir()->setSelectedItemIndex(int(tag->aniDir()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
anidir()->setSelectedItemIndex(int(doc::AniDir::FORWARD));
|
anidir()->setSelectedItemIndex(int(doc::AniDir::FORWARD));
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
#include "app/restore_visible_layers.h"
|
#include "app/restore_visible_layers.h"
|
||||||
#include "app/site.h"
|
#include "app/site.h"
|
||||||
#include "doc/anidir.h"
|
#include "doc/anidir.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/layer.h"
|
#include "doc/layer.h"
|
||||||
#include "doc/selected_frames.h"
|
#include "doc/selected_frames.h"
|
||||||
#include "doc/selected_layers.h"
|
#include "doc/selected_layers.h"
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
#include "ui/combobox.h"
|
#include "ui/combobox.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
@ -49,7 +49,7 @@ std::string LayerListItem::buildName(const doc::Layer* layer)
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameListItem::FrameListItem(doc::FrameTag* tag)
|
FrameListItem::FrameListItem(doc::Tag* tag)
|
||||||
: ListItem("Tag: " + tag->name())
|
: ListItem("Tag: " + tag->name())
|
||||||
, m_tag(tag)
|
, m_tag(tag)
|
||||||
{
|
{
|
||||||
@ -85,7 +85,7 @@ void fill_frames_combobox(const doc::Sprite* sprite, ui::ComboBox* frames, const
|
|||||||
if (defFrame == kSelectedFrames)
|
if (defFrame == kSelectedFrames)
|
||||||
frames->setSelectedItemIndex(i);
|
frames->setSelectedItemIndex(i);
|
||||||
|
|
||||||
for (auto tag : sprite->frameTags()) {
|
for (auto tag : sprite->tags()) {
|
||||||
// Don't allow to select empty frame tags
|
// Don't allow to select empty frame tags
|
||||||
if (tag->name().empty())
|
if (tag->name().empty())
|
||||||
continue;
|
continue;
|
||||||
@ -134,11 +134,11 @@ void calculate_visible_layers(Site& site,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
doc::FrameTag* calculate_selected_frames(const Site& site,
|
doc::Tag* calculate_selected_frames(const Site& site,
|
||||||
const std::string& framesValue,
|
const std::string& framesValue,
|
||||||
doc::SelectedFrames& selFrames)
|
doc::SelectedFrames& selFrames)
|
||||||
{
|
{
|
||||||
doc::FrameTag* frameTag = nullptr;
|
doc::Tag* tag = nullptr;
|
||||||
|
|
||||||
if (framesValue == kSelectedFrames) {
|
if (framesValue == kSelectedFrames) {
|
||||||
if (!site.selectedFrames().empty()) {
|
if (!site.selectedFrames().empty()) {
|
||||||
@ -149,17 +149,17 @@ doc::FrameTag* calculate_selected_frames(const Site& site,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (framesValue != kAllFrames) {
|
else if (framesValue != kAllFrames) {
|
||||||
frameTag = site.sprite()->frameTags().getByName(framesValue);
|
tag = site.sprite()->tags().getByName(framesValue);
|
||||||
if (frameTag)
|
if (tag)
|
||||||
selFrames.insert(frameTag->fromFrame(),
|
selFrames.insert(tag->fromFrame(),
|
||||||
frameTag->toFrame());
|
tag->toFrame());
|
||||||
else
|
else
|
||||||
selFrames.insert(0, site.sprite()->lastFrame());
|
selFrames.insert(0, site.sprite()->lastFrame());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
selFrames.insert(0, site.sprite()->lastFrame());
|
selFrames.insert(0, site.sprite()->lastFrame());
|
||||||
|
|
||||||
return frameTag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
class FrameTag;
|
|
||||||
class Layer;
|
class Layer;
|
||||||
class SelectedFrames;
|
class SelectedFrames;
|
||||||
class SelectedLayers;
|
class SelectedLayers;
|
||||||
class Sprite;
|
class Sprite;
|
||||||
|
class Tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
@ -45,10 +45,10 @@ namespace app {
|
|||||||
|
|
||||||
class FrameListItem : public ui::ListItem {
|
class FrameListItem : public ui::ListItem {
|
||||||
public:
|
public:
|
||||||
FrameListItem(doc::FrameTag* tag);
|
FrameListItem(doc::Tag* tag);
|
||||||
doc::FrameTag* tag() const { return m_tag; }
|
doc::Tag* tag() const { return m_tag; }
|
||||||
private:
|
private:
|
||||||
doc::FrameTag* m_tag;
|
doc::Tag* m_tag;
|
||||||
};
|
};
|
||||||
|
|
||||||
void fill_layers_combobox(const doc::Sprite* sprite, ui::ComboBox* layers, const std::string& defLayer);
|
void fill_layers_combobox(const doc::Sprite* sprite, ui::ComboBox* layers, const std::string& defLayer);
|
||||||
@ -59,9 +59,9 @@ namespace app {
|
|||||||
const std::string& layersValue,
|
const std::string& layersValue,
|
||||||
RestoreVisibleLayers& layersVisibility);
|
RestoreVisibleLayers& layersVisibility);
|
||||||
|
|
||||||
doc::FrameTag* calculate_selected_frames(const Site& site,
|
doc::Tag* calculate_selected_frames(const Site& site,
|
||||||
const std::string& framesValue,
|
const std::string& framesValue,
|
||||||
doc::SelectedFrames& selFrames);
|
doc::SelectedFrames& selFrames);
|
||||||
|
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "ui/message.h"
|
#include "ui/message.h"
|
||||||
#include "ui/system.h"
|
#include "ui/system.h"
|
||||||
|
|
||||||
#include "doc/frame_tag.h"
|
#include "doc/tag.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
@ -397,15 +397,15 @@ void PreviewEditorWindow::updateUsingEditor(Editor* editor)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (miniEditor->isPlaying()) {
|
if (miniEditor->isPlaying()) {
|
||||||
doc::FrameTag* tag = editor
|
doc::Tag* tag = editor
|
||||||
->getCustomizationDelegate()
|
->getCustomizationDelegate()
|
||||||
->getFrameTagProvider()
|
->getTagProvider()
|
||||||
->getFrameTagByFrame(editor->frame(), true);
|
->getTagByFrame(editor->frame(), true);
|
||||||
|
|
||||||
doc::FrameTag* playingTag = editor
|
doc::Tag* playingTag = editor
|
||||||
->getCustomizationDelegate()
|
->getCustomizationDelegate()
|
||||||
->getFrameTagProvider()
|
->getTagProvider()
|
||||||
->getFrameTagByFrame(m_refFrame, true);
|
->getTagByFrame(m_refFrame, true);
|
||||||
|
|
||||||
if (tag == playingTag)
|
if (tag == playingTag)
|
||||||
return;
|
return;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2016 David Capello
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -8,44 +9,44 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "app/ui/frame_tag_window.h"
|
#include "app/ui/tag_window.h"
|
||||||
|
|
||||||
#include "app/doc.h"
|
#include "app/doc.h"
|
||||||
#include "app/pref/preferences.h"
|
#include "app/pref/preferences.h"
|
||||||
#include "app/ui/layer_frame_comboboxes.h"
|
#include "app/ui/layer_frame_comboboxes.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
FrameTagWindow::FrameTagWindow(const doc::Sprite* sprite, const doc::FrameTag* frameTag)
|
TagWindow::TagWindow(const doc::Sprite* sprite, const doc::Tag* tag)
|
||||||
: m_sprite(sprite)
|
: m_sprite(sprite)
|
||||||
, m_base(Preferences::instance().document(
|
, m_base(Preferences::instance().document(
|
||||||
static_cast<Doc*>(sprite->document())).timeline.firstFrame())
|
static_cast<Doc*>(sprite->document())).timeline.firstFrame())
|
||||||
{
|
{
|
||||||
name()->setText(frameTag->name());
|
name()->setText(tag->name());
|
||||||
from()->setTextf("%d", frameTag->fromFrame()+m_base);
|
from()->setTextf("%d", tag->fromFrame()+m_base);
|
||||||
to()->setTextf("%d", frameTag->toFrame()+m_base);
|
to()->setTextf("%d", tag->toFrame()+m_base);
|
||||||
color()->setColor(app::Color::fromRgb(
|
color()->setColor(app::Color::fromRgb(
|
||||||
doc::rgba_getr(frameTag->color()),
|
doc::rgba_getr(tag->color()),
|
||||||
doc::rgba_getg(frameTag->color()),
|
doc::rgba_getg(tag->color()),
|
||||||
doc::rgba_getb(frameTag->color())));
|
doc::rgba_getb(tag->color())));
|
||||||
|
|
||||||
fill_anidir_combobox(anidir(), frameTag->aniDir());
|
fill_anidir_combobox(anidir(), tag->aniDir());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FrameTagWindow::show()
|
bool TagWindow::show()
|
||||||
{
|
{
|
||||||
openWindowInForeground();
|
openWindowInForeground();
|
||||||
return (closer() == ok());
|
return (closer() == ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string FrameTagWindow::nameValue()
|
std::string TagWindow::nameValue()
|
||||||
{
|
{
|
||||||
return name()->text();
|
return name()->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameTagWindow::rangeValue(doc::frame_t& from, doc::frame_t& to)
|
void TagWindow::rangeValue(doc::frame_t& from, doc::frame_t& to)
|
||||||
{
|
{
|
||||||
doc::frame_t first = 0;
|
doc::frame_t first = 0;
|
||||||
doc::frame_t last = m_sprite->lastFrame();
|
doc::frame_t last = m_sprite->lastFrame();
|
||||||
@ -56,13 +57,13 @@ void FrameTagWindow::rangeValue(doc::frame_t& from, doc::frame_t& to)
|
|||||||
to = MID(from, to, last);
|
to = MID(from, to, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
doc::color_t FrameTagWindow::colorValue()
|
doc::color_t TagWindow::colorValue()
|
||||||
{
|
{
|
||||||
app::Color color = this->color()->getColor();
|
app::Color color = this->color()->getColor();
|
||||||
return doc::rgba(color.getRed(), color.getGreen(), color.getBlue(), 255);
|
return doc::rgba(color.getRed(), color.getGreen(), color.getBlue(), 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
doc::AniDir FrameTagWindow::aniDirValue()
|
doc::AniDir TagWindow::aniDirValue()
|
||||||
{
|
{
|
||||||
return (doc::AniDir)anidir()->getSelectedItemIndex();
|
return (doc::AniDir)anidir()->getSelectedItemIndex();
|
||||||
}
|
}
|
@ -1,29 +1,30 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2017 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
// the End-User License Agreement for Aseprite.
|
// the End-User License Agreement for Aseprite.
|
||||||
|
|
||||||
#ifndef APP_UI_FRAME_TAG_WINDOW_H_INCLUDED
|
#ifndef APP_UI_TAG_WINDOW_H_INCLUDED
|
||||||
#define APP_UI_FRAME_TAG_WINDOW_H_INCLUDED
|
#define APP_UI_TAG_WINDOW_H_INCLUDED
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "app/ui/color_button.h"
|
#include "app/ui/color_button.h"
|
||||||
#include "doc/anidir.h"
|
#include "doc/anidir.h"
|
||||||
#include "doc/frame.h"
|
#include "doc/frame.h"
|
||||||
|
|
||||||
#include "frame_tag_properties.xml.h"
|
#include "tag_properties.xml.h"
|
||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
class FrameTag;
|
|
||||||
class Sprite;
|
class Sprite;
|
||||||
|
class Tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
class FrameTagWindow : protected app::gen::FrameTagProperties {
|
class TagWindow : protected app::gen::TagProperties {
|
||||||
public:
|
public:
|
||||||
FrameTagWindow(const doc::Sprite* sprite, const doc::FrameTag* frameTag);
|
TagWindow(const doc::Sprite* sprite, const doc::Tag* tag);
|
||||||
|
|
||||||
bool show();
|
bool show();
|
||||||
|
|
@ -49,7 +49,6 @@
|
|||||||
#include "base/memory.h"
|
#include "base/memory.h"
|
||||||
#include "base/scoped_value.h"
|
#include "base/scoped_value.h"
|
||||||
#include "doc/doc.h"
|
#include "doc/doc.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "gfx/point.h"
|
#include "gfx/point.h"
|
||||||
#include "gfx/rect.h"
|
#include "gfx/rect.h"
|
||||||
#include "os/font.h"
|
#include "os/font.h"
|
||||||
@ -87,11 +86,11 @@ enum {
|
|||||||
PART_ROW_TEXT,
|
PART_ROW_TEXT,
|
||||||
PART_CEL,
|
PART_CEL,
|
||||||
PART_RANGE_OUTLINE,
|
PART_RANGE_OUTLINE,
|
||||||
PART_FRAME_TAG,
|
PART_TAG,
|
||||||
PART_FRAME_TAGS,
|
PART_TAGS,
|
||||||
PART_FRAME_TAG_BAND,
|
PART_TAG_BAND,
|
||||||
PART_FRAME_TAG_SWITCH_BUTTONS,
|
PART_TAG_SWITCH_BUTTONS,
|
||||||
PART_FRAME_TAG_SWITCH_BAND_BUTTON,
|
PART_TAG_SWITCH_BAND_BUTTON,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Timeline::DrawCelData {
|
struct Timeline::DrawCelData {
|
||||||
@ -162,12 +161,12 @@ namespace {
|
|||||||
Timeline::Hit::Hit(int part,
|
Timeline::Hit::Hit(int part,
|
||||||
layer_t layer,
|
layer_t layer,
|
||||||
frame_t frame,
|
frame_t frame,
|
||||||
ObjectId frameTag,
|
ObjectId tag,
|
||||||
int band)
|
int band)
|
||||||
: part(part),
|
: part(part),
|
||||||
layer(layer),
|
layer(layer),
|
||||||
frame(frame),
|
frame(frame),
|
||||||
frameTag(frameTag),
|
tag(tag),
|
||||||
veryBottom(false),
|
veryBottom(false),
|
||||||
band(band)
|
band(band)
|
||||||
{
|
{
|
||||||
@ -179,13 +178,13 @@ bool Timeline::Hit::operator!=(const Hit& other) const
|
|||||||
part != other.part ||
|
part != other.part ||
|
||||||
layer != other.layer ||
|
layer != other.layer ||
|
||||||
frame != other.frame ||
|
frame != other.frame ||
|
||||||
frameTag != other.frameTag ||
|
tag != other.tag ||
|
||||||
band != other.band;
|
band != other.band;
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameTag* Timeline::Hit::getFrameTag() const
|
Tag* Timeline::Hit::getTag() const
|
||||||
{
|
{
|
||||||
return get<FrameTag>(frameTag);
|
return get<Tag>(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
Timeline::DropTarget::DropTarget()
|
Timeline::DropTarget::DropTarget()
|
||||||
@ -564,24 +563,24 @@ void Timeline::activateClipboardRange()
|
|||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameTag* Timeline::getFrameTagByFrame(const frame_t frame,
|
Tag* Timeline::getTagByFrame(const frame_t frame,
|
||||||
const bool getLoopTagIfNone)
|
const bool getLoopTagIfNone)
|
||||||
{
|
{
|
||||||
if (!m_sprite)
|
if (!m_sprite)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (m_tagFocusBand < 0) {
|
if (m_tagFocusBand < 0) {
|
||||||
FrameTag* tag = get_animation_tag(m_sprite, frame);
|
Tag* tag = get_animation_tag(m_sprite, frame);
|
||||||
if (!tag && getLoopTagIfNone)
|
if (!tag && getLoopTagIfNone)
|
||||||
tag = get_loop_tag(m_sprite);
|
tag = get_loop_tag(m_sprite);
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (FrameTag* frameTag : m_sprite->frameTags()) {
|
for (Tag* tag : m_sprite->tags()) {
|
||||||
if (frame >= frameTag->fromFrame() &&
|
if (frame >= tag->fromFrame() &&
|
||||||
frame <= frameTag->toFrame() &&
|
frame <= tag->toFrame() &&
|
||||||
m_tagBand[frameTag] == m_tagFocusBand) {
|
m_tagBand[tag] == m_tagFocusBand) {
|
||||||
return frameTag;
|
return tag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1252,20 +1251,20 @@ bool Timeline::onProcessMessage(Message* msg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PART_FRAME_TAG: {
|
case PART_TAG: {
|
||||||
FrameTag* frameTag = m_clk.getFrameTag();
|
Tag* tag = m_clk.getTag();
|
||||||
if (frameTag) {
|
if (tag) {
|
||||||
Params params;
|
Params params;
|
||||||
params.set("id", base::convert_to<std::string>(frameTag->id()).c_str());
|
params.set("id", base::convert_to<std::string>(tag->id()).c_str());
|
||||||
|
|
||||||
// As the m_clk.frameTag can be deleted with
|
// As the m_clk.tag can be deleted with
|
||||||
// RemoveFrameTag command, we've to clean all references
|
// RemoveTag command, we've to clean all references
|
||||||
// to it from Hit() structures.
|
// to it from Hit() structures.
|
||||||
cleanClk();
|
cleanClk();
|
||||||
m_hot = m_clk;
|
m_hot = m_clk;
|
||||||
|
|
||||||
if (mouseMsg->right()) {
|
if (mouseMsg->right()) {
|
||||||
Menu* popupMenu = AppMenus::instance()->getFrameTagPopupMenu();
|
Menu* popupMenu = AppMenus::instance()->getTagPopupMenu();
|
||||||
if (popupMenu) {
|
if (popupMenu) {
|
||||||
AppMenuItem::setContextParams(params);
|
AppMenuItem::setContextParams(params);
|
||||||
popupMenu->showPopup(mouseMsg->position());
|
popupMenu->showPopup(mouseMsg->position());
|
||||||
@ -1284,7 +1283,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PART_FRAME_TAG_SWITCH_BAND_BUTTON:
|
case PART_TAG_SWITCH_BAND_BUTTON:
|
||||||
if (m_clk.band >= 0) {
|
if (m_clk.band >= 0) {
|
||||||
focusTagBand(m_clk.band);
|
focusTagBand(m_clk.band);
|
||||||
regenRows = true;
|
regenRows = true;
|
||||||
@ -1355,7 +1354,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PART_FRAME_TAG_BAND:
|
case PART_TAG_BAND:
|
||||||
if (m_hot.band >= 0) {
|
if (m_hot.band >= 0) {
|
||||||
focusTagBand(m_hot.band);
|
focusTagBand(m_hot.band);
|
||||||
regenerateRows();
|
regenerateRows();
|
||||||
@ -1663,7 +1662,7 @@ void Timeline::onPaint(ui::PaintEvent& ev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
drawPaddings(g);
|
drawPaddings(g);
|
||||||
drawFrameTags(g);
|
drawTags(g);
|
||||||
drawRangeOutline(g);
|
drawRangeOutline(g);
|
||||||
drawClipboardRange(g);
|
drawClipboardRange(g);
|
||||||
drawCelOverlay(g);
|
drawCelOverlay(g);
|
||||||
@ -1803,7 +1802,7 @@ void Timeline::onLayerNameChange(DocEvent& ev)
|
|||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timeline::onAddFrameTag(DocEvent& ev)
|
void Timeline::onAddTag(DocEvent& ev)
|
||||||
{
|
{
|
||||||
if (m_tagFocusBand >= 0) {
|
if (m_tagFocusBand >= 0) {
|
||||||
m_tagFocusBand = -1;
|
m_tagFocusBand = -1;
|
||||||
@ -1812,9 +1811,9 @@ void Timeline::onAddFrameTag(DocEvent& ev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timeline::onRemoveFrameTag(DocEvent& ev)
|
void Timeline::onRemoveTag(DocEvent& ev)
|
||||||
{
|
{
|
||||||
onAddFrameTag(ev);
|
onAddTag(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timeline::onStateChanged(Editor* editor)
|
void Timeline::onStateChanged(Editor* editor)
|
||||||
@ -1884,7 +1883,7 @@ void Timeline::setCursor(ui::Message* msg, const Hit& hit)
|
|||||||
else if (hit.part == PART_SEPARATOR) {
|
else if (hit.part == PART_SEPARATOR) {
|
||||||
ui::set_mouse_cursor(kSizeWECursor);
|
ui::set_mouse_cursor(kSizeWECursor);
|
||||||
}
|
}
|
||||||
else if (hit.part == PART_FRAME_TAG) {
|
else if (hit.part == PART_TAG) {
|
||||||
ui::set_mouse_cursor(kHandCursor);
|
ui::set_mouse_cursor(kHandCursor);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -2380,9 +2379,9 @@ void Timeline::drawCelLinkDecorators(ui::Graphics* g, const gfx::Rect& bounds,
|
|||||||
if (style2) drawPart(g, bounds, nullptr, style2, is_active, is_hover);
|
if (style2) drawPart(g, bounds, nullptr, style2, is_active, is_hover);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timeline::drawFrameTags(ui::Graphics* g)
|
void Timeline::drawTags(ui::Graphics* g)
|
||||||
{
|
{
|
||||||
IntersectClip clip(g, getPartBounds(Hit(PART_FRAME_TAGS)));
|
IntersectClip clip(g, getPartBounds(Hit(PART_TAGS)));
|
||||||
if (!clip)
|
if (!clip)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -2400,17 +2399,17 @@ void Timeline::drawFrameTags(ui::Graphics* g)
|
|||||||
m_tagBands > 1 &&
|
m_tagBands > 1 &&
|
||||||
m_tagFocusBand < 0) {
|
m_tagFocusBand < 0) {
|
||||||
gfx::Rect bandBounds =
|
gfx::Rect bandBounds =
|
||||||
getPartBounds(Hit(PART_FRAME_TAG_BAND, -1, 0,
|
getPartBounds(Hit(PART_TAG_BAND, -1, 0,
|
||||||
doc::NullId, m_hot.band));
|
doc::NullId, m_hot.band));
|
||||||
g->fillRect(theme->colors.timelineBandHighlight(), bandBounds);
|
g->fillRect(theme->colors.timelineBandHighlight(), bandBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
int passes = (m_tagFocusBand >= 0 ? 2: 1);
|
int passes = (m_tagFocusBand >= 0 ? 2: 1);
|
||||||
for (int pass=0; pass<passes; ++pass) {
|
for (int pass=0; pass<passes; ++pass) {
|
||||||
for (FrameTag* frameTag : m_sprite->frameTags()) {
|
for (Tag* tag : m_sprite->tags()) {
|
||||||
int band = -1;
|
int band = -1;
|
||||||
if (m_tagFocusBand >= 0) {
|
if (m_tagFocusBand >= 0) {
|
||||||
auto it = m_tagBand.find(frameTag);
|
auto it = m_tagBand.find(tag);
|
||||||
if (it != m_tagBand.end()) {
|
if (it != m_tagBand.end()) {
|
||||||
band = it->second;
|
band = it->second;
|
||||||
if ((pass == 0 && band == m_tagFocusBand) ||
|
if ((pass == 0 && band == m_tagFocusBand) ||
|
||||||
@ -2419,12 +2418,12 @@ void Timeline::drawFrameTags(ui::Graphics* g)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::Rect bounds1 = getPartBounds(Hit(PART_HEADER_FRAME, firstLayer(), frameTag->fromFrame()));
|
gfx::Rect bounds1 = getPartBounds(Hit(PART_HEADER_FRAME, firstLayer(), tag->fromFrame()));
|
||||||
gfx::Rect bounds2 = getPartBounds(Hit(PART_HEADER_FRAME, firstLayer(), frameTag->toFrame()));
|
gfx::Rect bounds2 = getPartBounds(Hit(PART_HEADER_FRAME, firstLayer(), tag->toFrame()));
|
||||||
gfx::Rect bounds = bounds1.createUnion(bounds2);
|
gfx::Rect bounds = bounds1.createUnion(bounds2);
|
||||||
gfx::Rect frameTagBounds = getPartBounds(Hit(PART_FRAME_TAG, 0, 0, frameTag->id()));
|
gfx::Rect tagBounds = getPartBounds(Hit(PART_TAG, 0, 0, tag->id()));
|
||||||
bounds.h = bounds.y2() - frameTagBounds.y2();
|
bounds.h = bounds.y2() - tagBounds.y2();
|
||||||
bounds.y = frameTagBounds.y2();
|
bounds.y = tagBounds.y2();
|
||||||
|
|
||||||
int dx = 0, dw = 0;
|
int dx = 0, dw = 0;
|
||||||
if (m_dropTarget.outside &&
|
if (m_dropTarget.outside &&
|
||||||
@ -2432,19 +2431,19 @@ void Timeline::drawFrameTags(ui::Graphics* g)
|
|||||||
m_dropRange.type() == DocRange::kFrames) {
|
m_dropRange.type() == DocRange::kFrames) {
|
||||||
switch (m_dropTarget.hhit) {
|
switch (m_dropTarget.hhit) {
|
||||||
case DropTarget::Before:
|
case DropTarget::Before:
|
||||||
if (m_dropRange.firstFrame() == frameTag->fromFrame()) {
|
if (m_dropRange.firstFrame() == tag->fromFrame()) {
|
||||||
dx = +frameBoxWidth()/4;
|
dx = +frameBoxWidth()/4;
|
||||||
dw = -frameBoxWidth()/4;
|
dw = -frameBoxWidth()/4;
|
||||||
}
|
}
|
||||||
else if (m_dropRange.firstFrame()-1 == frameTag->toFrame()) {
|
else if (m_dropRange.firstFrame()-1 == tag->toFrame()) {
|
||||||
dw = -frameBoxWidth()/4;
|
dw = -frameBoxWidth()/4;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DropTarget::After:
|
case DropTarget::After:
|
||||||
if (m_dropRange.lastFrame() == frameTag->toFrame()) {
|
if (m_dropRange.lastFrame() == tag->toFrame()) {
|
||||||
dw = -frameBoxWidth()/4;
|
dw = -frameBoxWidth()/4;
|
||||||
}
|
}
|
||||||
else if (m_dropRange.lastFrame()+1 == frameTag->fromFrame()) {
|
else if (m_dropRange.lastFrame()+1 == tag->fromFrame()) {
|
||||||
dx = +frameBoxWidth()/4;
|
dx = +frameBoxWidth()/4;
|
||||||
dw = -frameBoxWidth()/4;
|
dw = -frameBoxWidth()/4;
|
||||||
}
|
}
|
||||||
@ -2453,11 +2452,11 @@ void Timeline::drawFrameTags(ui::Graphics* g)
|
|||||||
}
|
}
|
||||||
bounds.x += dx;
|
bounds.x += dx;
|
||||||
bounds.w += dw;
|
bounds.w += dw;
|
||||||
frameTagBounds.x += dx;
|
tagBounds.x += dx;
|
||||||
|
|
||||||
gfx::Color bg =
|
gfx::Color bg =
|
||||||
(m_tagFocusBand < 0 || pass == 1) ?
|
(m_tagFocusBand < 0 || pass == 1) ?
|
||||||
frameTag->color(): theme->colors.timelineBandBg();
|
tag->color(): theme->colors.timelineBandBg();
|
||||||
{
|
{
|
||||||
IntersectClip clip(g, bounds);
|
IntersectClip clip(g, bounds);
|
||||||
if (clip) {
|
if (clip) {
|
||||||
@ -2473,12 +2472,12 @@ void Timeline::drawFrameTags(ui::Graphics* g)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_tagFocusBand < 0 || pass == 1) {
|
if (m_tagFocusBand < 0 || pass == 1) {
|
||||||
bounds = frameTagBounds;
|
bounds = tagBounds;
|
||||||
|
|
||||||
if (m_clk.part == PART_FRAME_TAG && m_clk.frameTag == frameTag->id()) {
|
if (m_clk.part == PART_TAG && m_clk.tag == tag->id()) {
|
||||||
bg = color_utils::blackandwhite_neg(bg);
|
bg = color_utils::blackandwhite_neg(bg);
|
||||||
}
|
}
|
||||||
else if (m_hot.part == PART_FRAME_TAG && m_hot.frameTag == frameTag->id()) {
|
else if (m_hot.part == PART_TAG && m_hot.tag == tag->id()) {
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
r = gfx::getr(bg)+32;
|
r = gfx::getr(bg)+32;
|
||||||
g = gfx::getg(bg)+32;
|
g = gfx::getg(bg)+32;
|
||||||
@ -2493,7 +2492,7 @@ void Timeline::drawFrameTags(ui::Graphics* g)
|
|||||||
bounds.y += 2*ui::guiscale();
|
bounds.y += 2*ui::guiscale();
|
||||||
bounds.x += 2*ui::guiscale();
|
bounds.x += 2*ui::guiscale();
|
||||||
g->drawText(
|
g->drawText(
|
||||||
frameTag->name(),
|
tag->name(),
|
||||||
color_utils::blackandwhite_neg(bg),
|
color_utils::blackandwhite_neg(bg),
|
||||||
gfx::ColorNone,
|
gfx::ColorNone,
|
||||||
bounds.origin());
|
bounds.origin());
|
||||||
@ -2504,10 +2503,10 @@ void Timeline::drawFrameTags(ui::Graphics* g)
|
|||||||
// Draw button to expand/collapse the active band
|
// Draw button to expand/collapse the active band
|
||||||
if (m_hot.band >= 0 && m_tagBands > 1) {
|
if (m_hot.band >= 0 && m_tagBands > 1) {
|
||||||
gfx::Rect butBounds =
|
gfx::Rect butBounds =
|
||||||
getPartBounds(Hit(PART_FRAME_TAG_SWITCH_BAND_BUTTON, -1, 0,
|
getPartBounds(Hit(PART_TAG_SWITCH_BAND_BUTTON, -1, 0,
|
||||||
doc::NullId, m_hot.band));
|
doc::NullId, m_hot.band));
|
||||||
PaintWidgetPartInfo info;
|
PaintWidgetPartInfo info;
|
||||||
if (m_hot.part == PART_FRAME_TAG_SWITCH_BAND_BUTTON) {
|
if (m_hot.part == PART_TAG_SWITCH_BAND_BUTTON) {
|
||||||
info.styleFlags |= ui::Style::Layer::kMouse;
|
info.styleFlags |= ui::Style::Layer::kMouse;
|
||||||
if (hasCapture())
|
if (hasCapture())
|
||||||
info.styleFlags |= ui::Style::Layer::kSelected;
|
info.styleFlags |= ui::Style::Layer::kSelected;
|
||||||
@ -2775,22 +2774,22 @@ gfx::Rect Timeline::getPartBounds(const Hit& hit) const
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PART_FRAME_TAG: {
|
case PART_TAG: {
|
||||||
FrameTag* frameTag = hit.getFrameTag();
|
Tag* tag = hit.getTag();
|
||||||
if (frameTag) {
|
if (tag) {
|
||||||
gfx::Rect bounds1 = getPartBounds(Hit(PART_HEADER_FRAME, firstLayer(), frameTag->fromFrame()));
|
gfx::Rect bounds1 = getPartBounds(Hit(PART_HEADER_FRAME, firstLayer(), tag->fromFrame()));
|
||||||
gfx::Rect bounds2 = getPartBounds(Hit(PART_HEADER_FRAME, firstLayer(), frameTag->toFrame()));
|
gfx::Rect bounds2 = getPartBounds(Hit(PART_HEADER_FRAME, firstLayer(), tag->toFrame()));
|
||||||
gfx::Rect bounds = bounds1.createUnion(bounds2);
|
gfx::Rect bounds = bounds1.createUnion(bounds2);
|
||||||
bounds.y -= skinTheme()->dimensions.timelineTagsAreaHeight();
|
bounds.y -= skinTheme()->dimensions.timelineTagsAreaHeight();
|
||||||
|
|
||||||
int textHeight = font()->height();
|
int textHeight = font()->height();
|
||||||
bounds.y -= textHeight + 2*ui::guiscale();
|
bounds.y -= textHeight + 2*ui::guiscale();
|
||||||
bounds.x += 3*ui::guiscale();
|
bounds.x += 3*ui::guiscale();
|
||||||
bounds.w = font()->textLength(frameTag->name().c_str()) + 4*ui::guiscale();
|
bounds.w = font()->textLength(tag->name().c_str()) + 4*ui::guiscale();
|
||||||
bounds.h = font()->height() + 2*ui::guiscale();
|
bounds.h = font()->height() + 2*ui::guiscale();
|
||||||
|
|
||||||
if (m_tagFocusBand < 0) {
|
if (m_tagFocusBand < 0) {
|
||||||
auto it = m_tagBand.find(frameTag);
|
auto it = m_tagBand.find(tag);
|
||||||
if (it != m_tagBand.end()) {
|
if (it != m_tagBand.end()) {
|
||||||
int dy = (m_tagBands-it->second-1)*oneTagHeight();
|
int dy = (m_tagBands-it->second-1)*oneTagHeight();
|
||||||
bounds.y -= dy;
|
bounds.y -= dy;
|
||||||
@ -2802,13 +2801,13 @@ gfx::Rect Timeline::getPartBounds(const Hit& hit) const
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PART_FRAME_TAGS:
|
case PART_TAGS:
|
||||||
return gfx::Rect(
|
return gfx::Rect(
|
||||||
bounds.x + m_separator_x + m_separator_w - 1,
|
bounds.x + m_separator_x + m_separator_w - 1,
|
||||||
bounds.y,
|
bounds.y,
|
||||||
bounds.w - m_separator_x - m_separator_w + 1, y);
|
bounds.w - m_separator_x - m_separator_w + 1, y);
|
||||||
|
|
||||||
case PART_FRAME_TAG_BAND:
|
case PART_TAG_BAND:
|
||||||
return gfx::Rect(
|
return gfx::Rect(
|
||||||
bounds.x + m_separator_x + m_separator_w - 1,
|
bounds.x + m_separator_x + m_separator_w - 1,
|
||||||
bounds.y
|
bounds.y
|
||||||
@ -2816,7 +2815,7 @@ gfx::Rect Timeline::getPartBounds(const Hit& hit) const
|
|||||||
bounds.w - m_separator_x - m_separator_w + 1,
|
bounds.w - m_separator_x - m_separator_w + 1,
|
||||||
oneTagHeight());
|
oneTagHeight());
|
||||||
|
|
||||||
case PART_FRAME_TAG_SWITCH_BUTTONS: {
|
case PART_TAG_SWITCH_BUTTONS: {
|
||||||
gfx::Size sz = theme()->calcSizeHint(
|
gfx::Size sz = theme()->calcSizeHint(
|
||||||
this, skinTheme()->styles.timelineSwitchBandButton());
|
this, skinTheme()->styles.timelineSwitchBandButton());
|
||||||
|
|
||||||
@ -2826,7 +2825,7 @@ gfx::Rect Timeline::getPartBounds(const Hit& hit) const
|
|||||||
sz.w, y);
|
sz.w, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
case PART_FRAME_TAG_SWITCH_BAND_BUTTON: {
|
case PART_TAG_SWITCH_BAND_BUTTON: {
|
||||||
gfx::Size sz = theme()->calcSizeHint(
|
gfx::Size sz = theme()->calcSizeHint(
|
||||||
this, skinTheme()->styles.timelineSwitchBandButton());
|
this, skinTheme()->styles.timelineSwitchBandButton());
|
||||||
|
|
||||||
@ -2887,7 +2886,7 @@ void Timeline::invalidateHit(const Hit& hit)
|
|||||||
{
|
{
|
||||||
if (hit.band >= 0) {
|
if (hit.band >= 0) {
|
||||||
Hit hit2 = hit;
|
Hit hit2 = hit;
|
||||||
hit2.part = PART_FRAME_TAG_BAND;
|
hit2.part = PART_TAG_BAND;
|
||||||
invalidateRect(getPartBounds(hit2).offset(origin()));
|
invalidateRect(getPartBounds(hit2).offset(origin()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2962,24 +2961,24 @@ void Timeline::regenerateTagBands()
|
|||||||
{
|
{
|
||||||
// TODO improve this implementation
|
// TODO improve this implementation
|
||||||
std::vector<unsigned char> tagsPerFrame(m_sprite->totalFrames(), 0);
|
std::vector<unsigned char> tagsPerFrame(m_sprite->totalFrames(), 0);
|
||||||
std::vector<FrameTag*> bands(4, nullptr);
|
std::vector<Tag*> bands(4, nullptr);
|
||||||
m_tagBand.clear();
|
m_tagBand.clear();
|
||||||
for (FrameTag* frameTag : m_sprite->frameTags()) {
|
for (Tag* tag : m_sprite->tags()) {
|
||||||
frame_t f = frameTag->fromFrame();
|
frame_t f = tag->fromFrame();
|
||||||
|
|
||||||
int b=0;
|
int b=0;
|
||||||
for (; b<int(bands.size()); ++b) {
|
for (; b<int(bands.size()); ++b) {
|
||||||
if (!bands[b] ||
|
if (!bands[b] ||
|
||||||
frameTag->fromFrame() > calcTagVisibleToFrame(bands[b])) {
|
tag->fromFrame() > calcTagVisibleToFrame(bands[b])) {
|
||||||
bands[b] = frameTag;
|
bands[b] = tag;
|
||||||
m_tagBand[frameTag] = b;
|
m_tagBand[tag] = b;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (b == int(bands.size()))
|
if (b == int(bands.size()))
|
||||||
m_tagBand[frameTag] = tagsPerFrame[f];
|
m_tagBand[tag] = tagsPerFrame[f];
|
||||||
|
|
||||||
frame_t toFrame = calcTagVisibleToFrame(frameTag);
|
frame_t toFrame = calcTagVisibleToFrame(tag);
|
||||||
if (toFrame >= frame_t(tagsPerFrame.size()))
|
if (toFrame >= frame_t(tagsPerFrame.size()))
|
||||||
tagsPerFrame.resize(toFrame+1, 0);
|
tagsPerFrame.resize(toFrame+1, 0);
|
||||||
for (; f<=toFrame; ++f) {
|
for (; f<=toFrame; ++f) {
|
||||||
@ -3081,16 +3080,16 @@ Timeline::Hit Timeline::hitTest(ui::Message* msg, const gfx::Point& mousePos)
|
|||||||
hit.part = PART_SEPARATOR;
|
hit.part = PART_SEPARATOR;
|
||||||
}
|
}
|
||||||
// Is the mouse on the frame tags area?
|
// Is the mouse on the frame tags area?
|
||||||
else if (getPartBounds(Hit(PART_FRAME_TAGS)).contains(mousePos)) {
|
else if (getPartBounds(Hit(PART_TAGS)).contains(mousePos)) {
|
||||||
// Mouse in switch band button
|
// Mouse in switch band button
|
||||||
if (hit.part == PART_NOTHING) {
|
if (hit.part == PART_NOTHING) {
|
||||||
if (m_tagFocusBand < 0) {
|
if (m_tagFocusBand < 0) {
|
||||||
for (int band=0; band<m_tagBands; ++band) {
|
for (int band=0; band<m_tagBands; ++band) {
|
||||||
gfx::Rect bounds = getPartBounds(
|
gfx::Rect bounds = getPartBounds(
|
||||||
Hit(PART_FRAME_TAG_SWITCH_BAND_BUTTON, 0, 0,
|
Hit(PART_TAG_SWITCH_BAND_BUTTON, 0, 0,
|
||||||
doc::NullId, band));
|
doc::NullId, band));
|
||||||
if (bounds.contains(mousePos)) {
|
if (bounds.contains(mousePos)) {
|
||||||
hit.part = PART_FRAME_TAG_SWITCH_BAND_BUTTON;
|
hit.part = PART_TAG_SWITCH_BAND_BUTTON;
|
||||||
hit.band = band;
|
hit.band = band;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3098,10 +3097,10 @@ Timeline::Hit Timeline::hitTest(ui::Message* msg, const gfx::Point& mousePos)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gfx::Rect bounds = getPartBounds(
|
gfx::Rect bounds = getPartBounds(
|
||||||
Hit(PART_FRAME_TAG_SWITCH_BAND_BUTTON, 0, 0,
|
Hit(PART_TAG_SWITCH_BAND_BUTTON, 0, 0,
|
||||||
doc::NullId, m_tagFocusBand));
|
doc::NullId, m_tagFocusBand));
|
||||||
if (bounds.contains(mousePos)) {
|
if (bounds.contains(mousePos)) {
|
||||||
hit.part = PART_FRAME_TAG_SWITCH_BAND_BUTTON;
|
hit.part = PART_TAG_SWITCH_BAND_BUTTON;
|
||||||
hit.band = m_tagFocusBand;
|
hit.band = m_tagFocusBand;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3109,16 +3108,16 @@ Timeline::Hit Timeline::hitTest(ui::Message* msg, const gfx::Point& mousePos)
|
|||||||
|
|
||||||
// Mouse in frame tags
|
// Mouse in frame tags
|
||||||
if (hit.part == PART_NOTHING) {
|
if (hit.part == PART_NOTHING) {
|
||||||
for (FrameTag* frameTag : m_sprite->frameTags()) {
|
for (Tag* tag : m_sprite->tags()) {
|
||||||
gfx::Rect bounds = getPartBounds(Hit(PART_FRAME_TAG, 0, 0, frameTag->id()));
|
gfx::Rect bounds = getPartBounds(Hit(PART_TAG, 0, 0, tag->id()));
|
||||||
if (bounds.contains(mousePos)) {
|
if (bounds.contains(mousePos)) {
|
||||||
const int band = m_tagBand[frameTag];
|
const int band = m_tagBand[tag];
|
||||||
if (m_tagFocusBand >= 0 &&
|
if (m_tagFocusBand >= 0 &&
|
||||||
m_tagFocusBand != band)
|
m_tagFocusBand != band)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
hit.part = PART_FRAME_TAG;
|
hit.part = PART_TAG;
|
||||||
hit.frameTag = frameTag->id();
|
hit.tag = tag->id();
|
||||||
hit.band = band;
|
hit.band = band;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3130,10 +3129,10 @@ Timeline::Hit Timeline::hitTest(ui::Message* msg, const gfx::Point& mousePos)
|
|||||||
if (m_tagFocusBand < 0) {
|
if (m_tagFocusBand < 0) {
|
||||||
for (int band=0; band<m_tagBands; ++band) {
|
for (int band=0; band<m_tagBands; ++band) {
|
||||||
gfx::Rect bounds = getPartBounds(
|
gfx::Rect bounds = getPartBounds(
|
||||||
Hit(PART_FRAME_TAG_BAND, 0, 0,
|
Hit(PART_TAG_BAND, 0, 0,
|
||||||
doc::NullId, band));
|
doc::NullId, band));
|
||||||
if (bounds.contains(mousePos)) {
|
if (bounds.contains(mousePos)) {
|
||||||
hit.part = PART_FRAME_TAG_BAND;
|
hit.part = PART_TAG_BAND;
|
||||||
hit.band = band;
|
hit.band = band;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3141,10 +3140,10 @@ Timeline::Hit Timeline::hitTest(ui::Message* msg, const gfx::Point& mousePos)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gfx::Rect bounds = getPartBounds(
|
gfx::Rect bounds = getPartBounds(
|
||||||
Hit(PART_FRAME_TAG_BAND, 0, 0,
|
Hit(PART_TAG_BAND, 0, 0,
|
||||||
doc::NullId, m_tagFocusBand));
|
doc::NullId, m_tagFocusBand));
|
||||||
if (bounds.contains(mousePos)) {
|
if (bounds.contains(mousePos)) {
|
||||||
hit.part = PART_FRAME_TAG_BAND;
|
hit.part = PART_TAG_BAND;
|
||||||
hit.band = m_tagFocusBand;
|
hit.band = m_tagFocusBand;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3383,14 +3382,14 @@ void Timeline::updateStatusBar(ui::Message* msg)
|
|||||||
|
|
||||||
case PART_HEADER_FRAME:
|
case PART_HEADER_FRAME:
|
||||||
case PART_CEL:
|
case PART_CEL:
|
||||||
case PART_FRAME_TAG: {
|
case PART_TAG: {
|
||||||
frame_t frame = m_frame;
|
frame_t frame = m_frame;
|
||||||
if (validFrame(m_hot.frame))
|
if (validFrame(m_hot.frame))
|
||||||
frame = m_hot.frame;
|
frame = m_hot.frame;
|
||||||
|
|
||||||
updateStatusBarForFrame(
|
updateStatusBarForFrame(
|
||||||
frame,
|
frame,
|
||||||
m_hot.getFrameTag(),
|
m_hot.getTag(),
|
||||||
(layer ? layer->cel(frame) : nullptr));
|
(layer ? layer->cel(frame) : nullptr));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3401,7 +3400,7 @@ void Timeline::updateStatusBar(ui::Message* msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Timeline::updateStatusBarForFrame(const frame_t frame,
|
void Timeline::updateStatusBarForFrame(const frame_t frame,
|
||||||
const FrameTag* frameTag,
|
const Tag* tag,
|
||||||
const Cel* cel)
|
const Cel* cel)
|
||||||
{
|
{
|
||||||
if (!m_sprite)
|
if (!m_sprite)
|
||||||
@ -3412,9 +3411,9 @@ void Timeline::updateStatusBarForFrame(const frame_t frame,
|
|||||||
frame_t firstFrame = frame;
|
frame_t firstFrame = frame;
|
||||||
frame_t lastFrame = frame;
|
frame_t lastFrame = frame;
|
||||||
|
|
||||||
if (frameTag) {
|
if (tag) {
|
||||||
firstFrame = frameTag->fromFrame();
|
firstFrame = tag->fromFrame();
|
||||||
lastFrame = frameTag->toFrame();
|
lastFrame = tag->toFrame();
|
||||||
}
|
}
|
||||||
else if (m_range.enabled() &&
|
else if (m_range.enabled() &&
|
||||||
m_range.frames() > 1) {
|
m_range.frames() > 1) {
|
||||||
@ -3438,8 +3437,8 @@ void Timeline::updateStatusBarForFrame(const frame_t frame,
|
|||||||
if (firstFrame != lastFrame) {
|
if (firstFrame != lastFrame) {
|
||||||
std::sprintf(
|
std::sprintf(
|
||||||
buf+std::strlen(buf), " [%s]",
|
buf+std::strlen(buf), " [%s]",
|
||||||
frameTag ?
|
tag ?
|
||||||
human_readable_time(tagFramesDuration(frameTag)).c_str():
|
human_readable_time(tagFramesDuration(tag)).c_str():
|
||||||
human_readable_time(selectedFramesDuration()).c_str());
|
human_readable_time(selectedFramesDuration()).c_str());
|
||||||
}
|
}
|
||||||
if (m_sprite->totalFrames() > 1)
|
if (m_sprite->totalFrames() > 1)
|
||||||
@ -3713,7 +3712,7 @@ void Timeline::dropRange(DropOp op)
|
|||||||
|
|
||||||
if (m_range.type() == Range::kFrames &&
|
if (m_range.type() == Range::kFrames &&
|
||||||
m_sprite &&
|
m_sprite &&
|
||||||
!m_sprite->frameTags().empty()) {
|
!m_sprite->tags().empty()) {
|
||||||
invalidateRect(getFrameHeadersBounds().offset(origin()));
|
invalidateRect(getFrameHeadersBounds().offset(origin()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3756,7 +3755,7 @@ void Timeline::setViewScroll(const gfx::Point& pt)
|
|||||||
if (newScroll != oldScroll) {
|
if (newScroll != oldScroll) {
|
||||||
gfx::Rect rc;
|
gfx::Rect rc;
|
||||||
if (m_tagBands > 0)
|
if (m_tagBands > 0)
|
||||||
rc |= getPartBounds(Hit(PART_FRAME_TAG_BAND));
|
rc |= getPartBounds(Hit(PART_TAG_BAND));
|
||||||
rc |= getFrameHeadersBounds();
|
rc |= getFrameHeadersBounds();
|
||||||
rc |= getCelsBounds();
|
rc |= getCelsBounds();
|
||||||
rc.offset(origin());
|
rc.offset(origin());
|
||||||
@ -3930,12 +3929,12 @@ double Timeline::zoom() const
|
|||||||
|
|
||||||
// Returns the last frame where the frame tag (or frame tag label)
|
// Returns the last frame where the frame tag (or frame tag label)
|
||||||
// is visible in the timeline.
|
// is visible in the timeline.
|
||||||
int Timeline::calcTagVisibleToFrame(FrameTag* frameTag) const
|
int Timeline::calcTagVisibleToFrame(Tag* tag) const
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
MAX(frameTag->toFrame(),
|
MAX(tag->toFrame(),
|
||||||
frameTag->fromFrame() +
|
tag->fromFrame() +
|
||||||
font()->textLength(frameTag->name())/frameBoxWidth());
|
font()->textLength(tag->name())/frameBoxWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
int Timeline::topHeight() const
|
int Timeline::topHeight() const
|
||||||
@ -4065,14 +4064,14 @@ void Timeline::onCancel(Context* ctx)
|
|||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
int Timeline::tagFramesDuration(const FrameTag* frameTag) const
|
int Timeline::tagFramesDuration(const Tag* tag) const
|
||||||
{
|
{
|
||||||
ASSERT(m_sprite);
|
ASSERT(m_sprite);
|
||||||
ASSERT(frameTag);
|
ASSERT(tag);
|
||||||
|
|
||||||
int duration = 0;
|
int duration = 0;
|
||||||
for (frame_t f=frameTag->fromFrame();
|
for (frame_t f=tag->fromFrame();
|
||||||
f<frameTag->toFrame(); ++f) {
|
f<tag->toFrame(); ++f) {
|
||||||
duration += m_sprite->frameDuration(f);
|
duration += m_sprite->frameDuration(f);
|
||||||
}
|
}
|
||||||
return duration;
|
return duration;
|
||||||
|
@ -62,7 +62,7 @@ namespace app {
|
|||||||
public DocObserver,
|
public DocObserver,
|
||||||
public EditorObserver,
|
public EditorObserver,
|
||||||
public InputChainElement,
|
public InputChainElement,
|
||||||
public FrameTagProvider {
|
public TagProvider {
|
||||||
public:
|
public:
|
||||||
typedef DocRange Range;
|
typedef DocRange Range;
|
||||||
|
|
||||||
@ -115,12 +115,12 @@ namespace app {
|
|||||||
// called from popup menus.
|
// called from popup menus.
|
||||||
void dropRange(DropOp op);
|
void dropRange(DropOp op);
|
||||||
|
|
||||||
// FrameTagProvider impl
|
// TagProvider impl
|
||||||
// Returns the active frame tag depending on the timeline status
|
// Returns the active frame tag depending on the timeline status
|
||||||
// E.g. if other frame tags are collapsed, the focused band has
|
// E.g. if other frame tags are collapsed, the focused band has
|
||||||
// priority and tags in other bands are ignored.
|
// priority and tags in other bands are ignored.
|
||||||
FrameTag* getFrameTagByFrame(const frame_t frame,
|
Tag* getTagByFrame(const frame_t frame,
|
||||||
const bool getLoopTagIfNone) override;
|
const bool getLoopTagIfNone) override;
|
||||||
|
|
||||||
// ScrollableViewDelegate impl
|
// ScrollableViewDelegate impl
|
||||||
gfx::Size visibleSize() const override;
|
gfx::Size visibleSize() const override;
|
||||||
@ -148,8 +148,8 @@ namespace app {
|
|||||||
void onAddFrame(DocEvent& ev) override;
|
void onAddFrame(DocEvent& ev) override;
|
||||||
void onRemoveFrame(DocEvent& ev) override;
|
void onRemoveFrame(DocEvent& ev) override;
|
||||||
void onLayerNameChange(DocEvent& ev) override;
|
void onLayerNameChange(DocEvent& ev) override;
|
||||||
void onAddFrameTag(DocEvent& ev) override;
|
void onAddTag(DocEvent& ev) override;
|
||||||
void onRemoveFrameTag(DocEvent& ev) override;
|
void onRemoveTag(DocEvent& ev) override;
|
||||||
|
|
||||||
// app::Context slots.
|
// app::Context slots.
|
||||||
void onAfterCommandExecution(CommandExecutionEvent& ev);
|
void onAfterCommandExecution(CommandExecutionEvent& ev);
|
||||||
@ -186,17 +186,17 @@ namespace app {
|
|||||||
int part;
|
int part;
|
||||||
layer_t layer;
|
layer_t layer;
|
||||||
frame_t frame;
|
frame_t frame;
|
||||||
ObjectId frameTag;
|
ObjectId tag;
|
||||||
bool veryBottom;
|
bool veryBottom;
|
||||||
int band;
|
int band;
|
||||||
|
|
||||||
Hit(int part = 0,
|
Hit(int part = 0,
|
||||||
layer_t layer = -1,
|
layer_t layer = -1,
|
||||||
frame_t frame = 0,
|
frame_t frame = 0,
|
||||||
ObjectId frameTag = NullId,
|
ObjectId tag = NullId,
|
||||||
int band = -1);
|
int band = -1);
|
||||||
bool operator!=(const Hit& other) const;
|
bool operator!=(const Hit& other) const;
|
||||||
FrameTag* getFrameTag() const;
|
Tag* getTag() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DropTarget {
|
struct DropTarget {
|
||||||
@ -272,7 +272,7 @@ namespace app {
|
|||||||
void drawCelLinkDecorators(ui::Graphics* g, const gfx::Rect& bounds,
|
void drawCelLinkDecorators(ui::Graphics* g, const gfx::Rect& bounds,
|
||||||
Cel* cel, frame_t frame, bool is_active, bool is_hover,
|
Cel* cel, frame_t frame, bool is_active, bool is_hover,
|
||||||
DrawCelData* data);
|
DrawCelData* data);
|
||||||
void drawFrameTags(ui::Graphics* g);
|
void drawTags(ui::Graphics* g);
|
||||||
void drawRangeOutline(ui::Graphics* g);
|
void drawRangeOutline(ui::Graphics* g);
|
||||||
void drawPaddings(ui::Graphics* g);
|
void drawPaddings(ui::Graphics* g);
|
||||||
bool drawPart(ui::Graphics* g, int part, layer_t layer, frame_t frame);
|
bool drawPart(ui::Graphics* g, int part, layer_t layer, frame_t frame);
|
||||||
@ -309,7 +309,7 @@ namespace app {
|
|||||||
bool isCelLooselyActive(const layer_t layerIdx, const frame_t frame) const;
|
bool isCelLooselyActive(const layer_t layerIdx, const frame_t frame) const;
|
||||||
void updateStatusBar(ui::Message* msg);
|
void updateStatusBar(ui::Message* msg);
|
||||||
void updateStatusBarForFrame(const frame_t frame,
|
void updateStatusBarForFrame(const frame_t frame,
|
||||||
const FrameTag* frameTag,
|
const Tag* tag,
|
||||||
const Cel* cel);
|
const Cel* cel);
|
||||||
void updateDropRange(const gfx::Point& pt);
|
void updateDropRange(const gfx::Point& pt);
|
||||||
void clearClipboardRange();
|
void clearClipboardRange();
|
||||||
@ -338,7 +338,7 @@ namespace app {
|
|||||||
int frameBoxWidth() const;
|
int frameBoxWidth() const;
|
||||||
int outlineWidth() const;
|
int outlineWidth() const;
|
||||||
int oneTagHeight() const;
|
int oneTagHeight() const;
|
||||||
int calcTagVisibleToFrame(FrameTag* frameTag) const;
|
int calcTagVisibleToFrame(Tag* tag) const;
|
||||||
|
|
||||||
void updateCelOverlayBounds(const Hit& hit);
|
void updateCelOverlayBounds(const Hit& hit);
|
||||||
void drawCelOverlay(ui::Graphics* g);
|
void drawCelOverlay(ui::Graphics* g);
|
||||||
@ -348,7 +348,7 @@ namespace app {
|
|||||||
const bool updatePref);
|
const bool updatePref);
|
||||||
|
|
||||||
double zoom() const;
|
double zoom() const;
|
||||||
int tagFramesDuration(const FrameTag* frameTag) const;
|
int tagFramesDuration(const Tag* tag) const;
|
||||||
// Calculate the duration of the selected range of frames
|
// Calculate the duration of the selected range of frames
|
||||||
int selectedFramesDuration() const;
|
int selectedFramesDuration() const;
|
||||||
|
|
||||||
@ -379,7 +379,7 @@ namespace app {
|
|||||||
// Data used to display frame tags
|
// Data used to display frame tags
|
||||||
int m_tagBands;
|
int m_tagBands;
|
||||||
int m_tagFocusBand;
|
int m_tagFocusBand;
|
||||||
std::map<FrameTag*, int> m_tagBand;
|
std::map<Tag*, int> m_tagBand;
|
||||||
|
|
||||||
int m_separator_x;
|
int m_separator_x;
|
||||||
int m_separator_w;
|
int m_separator_w;
|
||||||
|
@ -173,7 +173,7 @@ bool AsepriteDecoder::decode()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ASE_FILE_CHUNK_TAGS:
|
case ASE_FILE_CHUNK_TAGS:
|
||||||
readTagsChunk(&sprite->frameTags());
|
readTagsChunk(&sprite->tags());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ASE_FILE_CHUNK_SLICES: {
|
case ASE_FILE_CHUNK_SLICES: {
|
||||||
@ -809,14 +809,14 @@ doc::Mask* AsepriteDecoder::readMaskChunk()
|
|||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsepriteDecoder::readTagsChunk(doc::FrameTags* frameTags)
|
void AsepriteDecoder::readTagsChunk(doc::Tags* tags)
|
||||||
{
|
{
|
||||||
size_t tags = read16();
|
size_t ntags = read16();
|
||||||
|
|
||||||
read32(); // 8 reserved bytes
|
read32(); // 8 reserved bytes
|
||||||
read32();
|
read32();
|
||||||
|
|
||||||
for (size_t c=0; c<tags; ++c) {
|
for (size_t c=0; c<ntags; ++c) {
|
||||||
doc::frame_t from = read16();
|
doc::frame_t from = read16();
|
||||||
doc::frame_t to = read16();
|
doc::frame_t to = read16();
|
||||||
int aniDir = read8();
|
int aniDir = read8();
|
||||||
@ -836,11 +836,11 @@ void AsepriteDecoder::readTagsChunk(doc::FrameTags* frameTags)
|
|||||||
|
|
||||||
std::string name = readString();
|
std::string name = readString();
|
||||||
|
|
||||||
doc::FrameTag* tag = new doc::FrameTag(from, to);
|
auto tag = new doc::Tag(from, to);
|
||||||
tag->setColor(doc::rgba(r, g, b, 255));
|
tag->setColor(doc::rgba(r, g, b, 255));
|
||||||
tag->setName(name);
|
tag->setName(name);
|
||||||
tag->setAniDir((doc::AniDir)aniDir);
|
tag->setAniDir((doc::AniDir)aniDir);
|
||||||
frameTags->add(tag);
|
tags->add(tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
#include "dio/decoder.h"
|
#include "dio/decoder.h"
|
||||||
#include "doc/frame.h"
|
#include "doc/frame.h"
|
||||||
#include "doc/frame_tags.h"
|
|
||||||
#include "doc/layer_list.h"
|
#include "doc/layer_list.h"
|
||||||
#include "doc/pixel_format.h"
|
#include "doc/pixel_format.h"
|
||||||
#include "doc/slices.h"
|
#include "doc/slices.h"
|
||||||
|
#include "doc/tags.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ private:
|
|||||||
void readCelExtraChunk(doc::Cel* cel);
|
void readCelExtraChunk(doc::Cel* cel);
|
||||||
void readColorProfile(doc::Sprite* sprite);
|
void readColorProfile(doc::Sprite* sprite);
|
||||||
doc::Mask* readMaskChunk();
|
doc::Mask* readMaskChunk();
|
||||||
void readTagsChunk(doc::FrameTags* frameTags);
|
void readTagsChunk(doc::Tags* tags);
|
||||||
void readSlicesChunk(doc::Slices& slices);
|
void readSlicesChunk(doc::Slices& slices);
|
||||||
doc::Slice* readSliceChunk(doc::Slices& slices);
|
doc::Slice* readSliceChunk(doc::Slices& slices);
|
||||||
void readUserDataChunk(doc::UserData* userData);
|
void readUserDataChunk(doc::UserData* userData);
|
||||||
|
@ -36,9 +36,6 @@ add_library(doc-lib
|
|||||||
file/gpl_file.cpp
|
file/gpl_file.cpp
|
||||||
file/hex_file.cpp
|
file/hex_file.cpp
|
||||||
file/pal_file.cpp
|
file/pal_file.cpp
|
||||||
frame_tag.cpp
|
|
||||||
frame_tag_io.cpp
|
|
||||||
frame_tags.cpp
|
|
||||||
handle_anidir.cpp
|
handle_anidir.cpp
|
||||||
image.cpp
|
image.cpp
|
||||||
image_impl.cpp
|
image_impl.cpp
|
||||||
@ -66,6 +63,9 @@ add_library(doc-lib
|
|||||||
sprites.cpp
|
sprites.cpp
|
||||||
string_io.cpp
|
string_io.cpp
|
||||||
subobjects_io.cpp
|
subobjects_io.cpp
|
||||||
|
tag.cpp
|
||||||
|
tag_io.cpp
|
||||||
|
tags.cpp
|
||||||
user_data_io.cpp)
|
user_data_io.cpp)
|
||||||
|
|
||||||
# TODO Remove 'os' as dependency and move conversion_to_surface.cpp/h files
|
# TODO Remove 'os' as dependency and move conversion_to_surface.cpp/h files
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// Aseprite Document Library
|
// Aseprite Document Library
|
||||||
// Copyright (c) 2001-2018 David Capello
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
@ -17,8 +18,6 @@
|
|||||||
#include "doc/color_scales.h"
|
#include "doc/color_scales.h"
|
||||||
#include "doc/document.h"
|
#include "doc/document.h"
|
||||||
#include "doc/frame.h"
|
#include "doc/frame.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/frame_tags.h"
|
|
||||||
#include "doc/image.h"
|
#include "doc/image.h"
|
||||||
#include "doc/image_impl.h"
|
#include "doc/image_impl.h"
|
||||||
#include "doc/image_ref.h"
|
#include "doc/image_ref.h"
|
||||||
@ -36,5 +35,7 @@
|
|||||||
#include "doc/slice.h"
|
#include "doc/slice.h"
|
||||||
#include "doc/slices.h"
|
#include "doc/slices.h"
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
|
#include "doc/tags.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
// Aseprite Document Library
|
|
||||||
// Copyright (c) 2001-2015 David Capello
|
|
||||||
//
|
|
||||||
// This file is released under the terms of the MIT license.
|
|
||||||
// Read LICENSE.txt for more information.
|
|
||||||
|
|
||||||
#ifndef DOC_FRAME_TAG_IO_H_INCLUDED
|
|
||||||
#define DOC_FRAME_TAG_IO_H_INCLUDED
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <iosfwd>
|
|
||||||
|
|
||||||
namespace doc {
|
|
||||||
|
|
||||||
class FrameTag;
|
|
||||||
|
|
||||||
void write_frame_tag(std::ostream& os, const FrameTag* tag);
|
|
||||||
FrameTag* read_frame_tag(std::istream& is, bool setId = true);
|
|
||||||
|
|
||||||
} // namespace doc
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,5 +1,6 @@
|
|||||||
// Aseprite Document Library
|
// Aseprite Document Library
|
||||||
// Copyright (c) 2001-2016 David Capello
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
@ -12,8 +13,8 @@
|
|||||||
|
|
||||||
#include "base/base.h"
|
#include "base/base.h"
|
||||||
#include "doc/frame.h"
|
#include "doc/frame.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/sprite.h"
|
#include "doc/sprite.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
|
|
||||||
@ -21,7 +22,7 @@ frame_t calculate_next_frame(
|
|||||||
const Sprite* sprite,
|
const Sprite* sprite,
|
||||||
frame_t frame,
|
frame_t frame,
|
||||||
frame_t frameDelta,
|
frame_t frameDelta,
|
||||||
const FrameTag* tag,
|
const Tag* tag,
|
||||||
bool& pingPongForward)
|
bool& pingPongForward)
|
||||||
{
|
{
|
||||||
if (frameDelta == 0)
|
if (frameDelta == 0)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// Aseprite Document Library
|
// Aseprite Document Library
|
||||||
// Copyright (c) 2001-2015 David Capello
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
|
// Copyright (C) 2001-2015 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
@ -12,14 +13,14 @@
|
|||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
|
|
||||||
class FrameTag;
|
|
||||||
class Sprite;
|
class Sprite;
|
||||||
|
class Tag;
|
||||||
|
|
||||||
frame_t calculate_next_frame(
|
frame_t calculate_next_frame(
|
||||||
const Sprite* sprite,
|
const Sprite* sprite,
|
||||||
frame_t frame,
|
frame_t frame,
|
||||||
frame_t frameDelta,
|
frame_t frameDelta,
|
||||||
const FrameTag* tag,
|
const Tag* tag,
|
||||||
bool& pingPongForward);
|
bool& pingPongForward);
|
||||||
|
|
||||||
} // namespace doc
|
} // namespace doc
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// Aseprite Document Library
|
// Aseprite Document Library
|
||||||
// Copyright (c) 2001-2017 David Capello
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
@ -23,7 +24,7 @@ namespace doc {
|
|||||||
LayerGroup,
|
LayerGroup,
|
||||||
Sprite,
|
Sprite,
|
||||||
Document,
|
Document,
|
||||||
FrameTag,
|
Tag,
|
||||||
Slice,
|
Slice,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Aseprite Document Library
|
// Aseprite Document Library
|
||||||
// Copyright (c) 2018-2019 Igara Studio S.A.
|
// Copyright (C) 2018-2019 Igara Studio S.A.
|
||||||
// Copyright (c) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
@ -16,13 +16,13 @@
|
|||||||
#include "base/remove_from_container.h"
|
#include "base/remove_from_container.h"
|
||||||
#include "doc/cel.h"
|
#include "doc/cel.h"
|
||||||
#include "doc/cels_range.h"
|
#include "doc/cels_range.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/image_impl.h"
|
#include "doc/image_impl.h"
|
||||||
#include "doc/layer.h"
|
#include "doc/layer.h"
|
||||||
#include "doc/palette.h"
|
#include "doc/palette.h"
|
||||||
#include "doc/primitives.h"
|
#include "doc/primitives.h"
|
||||||
#include "doc/remap.h"
|
#include "doc/remap.h"
|
||||||
#include "doc/rgbmap.h"
|
#include "doc/rgbmap.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -44,7 +44,7 @@ Sprite::Sprite(const ImageSpec& spec,
|
|||||||
, m_frlens(1, 100) // First frame with 100 msecs of duration
|
, m_frlens(1, 100) // First frame with 100 msecs of duration
|
||||||
, m_root(new LayerGroup(this))
|
, m_root(new LayerGroup(this))
|
||||||
, m_rgbMap(nullptr) // Initial RGB map
|
, m_rgbMap(nullptr) // Initial RGB map
|
||||||
, m_frameTags(this)
|
, m_tags(this)
|
||||||
, m_slices(this)
|
, m_slices(this)
|
||||||
{
|
{
|
||||||
// Generate palette
|
// Generate palette
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Aseprite Document Library
|
// Aseprite Document Library
|
||||||
// Copyright (c) 2018-2019 Igara Studio S.A.
|
// Copyright (C) 2018-2019 Igara Studio S.A.
|
||||||
// Copyright (c) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
@ -14,7 +14,6 @@
|
|||||||
#include "doc/cel_list.h"
|
#include "doc/cel_list.h"
|
||||||
#include "doc/color.h"
|
#include "doc/color.h"
|
||||||
#include "doc/frame.h"
|
#include "doc/frame.h"
|
||||||
#include "doc/frame_tags.h"
|
|
||||||
#include "doc/image_ref.h"
|
#include "doc/image_ref.h"
|
||||||
#include "doc/image_spec.h"
|
#include "doc/image_spec.h"
|
||||||
#include "doc/layer_list.h"
|
#include "doc/layer_list.h"
|
||||||
@ -22,6 +21,7 @@
|
|||||||
#include "doc/pixel_format.h"
|
#include "doc/pixel_format.h"
|
||||||
#include "doc/pixel_ratio.h"
|
#include "doc/pixel_ratio.h"
|
||||||
#include "doc/slices.h"
|
#include "doc/slices.h"
|
||||||
|
#include "doc/tags.h"
|
||||||
#include "gfx/rect.h"
|
#include "gfx/rect.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -142,8 +142,8 @@ namespace doc {
|
|||||||
void setFrameRangeDuration(frame_t from, frame_t to, int msecs);
|
void setFrameRangeDuration(frame_t from, frame_t to, int msecs);
|
||||||
void setDurationForAllFrames(int msecs);
|
void setDurationForAllFrames(int msecs);
|
||||||
|
|
||||||
const FrameTags& frameTags() const { return m_frameTags; }
|
const Tags& tags() const { return m_tags; }
|
||||||
FrameTags& frameTags() { return m_frameTags; }
|
Tags& tags() { return m_tags; }
|
||||||
|
|
||||||
const Slices& slices() const { return m_slices; }
|
const Slices& slices() const { return m_slices; }
|
||||||
Slices& slices() { return m_slices; }
|
Slices& slices() { return m_slices; }
|
||||||
@ -192,7 +192,7 @@ namespace doc {
|
|||||||
// Current rgb map
|
// Current rgb map
|
||||||
mutable RgbMap* m_rgbMap;
|
mutable RgbMap* m_rgbMap;
|
||||||
|
|
||||||
FrameTags m_frameTags;
|
Tags m_tags;
|
||||||
Slices m_slices;
|
Slices m_slices;
|
||||||
|
|
||||||
// Disable default constructor and copying
|
// Disable default constructor and copying
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// Aseprite Document Library
|
// Aseprite Document Library
|
||||||
// Copyright (c) 2001-2016 David Capello
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
@ -8,15 +9,15 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "doc/frame_tag.h"
|
#include "doc/tag.h"
|
||||||
|
|
||||||
#include "base/debug.h"
|
#include "base/debug.h"
|
||||||
#include "doc/frame_tags.h"
|
#include "doc/tags.h"
|
||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
|
|
||||||
FrameTag::FrameTag(frame_t from, frame_t to)
|
Tag::Tag(frame_t from, frame_t to)
|
||||||
: Object(ObjectType::FrameTag)
|
: Object(ObjectType::Tag)
|
||||||
, m_owner(nullptr)
|
, m_owner(nullptr)
|
||||||
, m_from(from)
|
, m_from(from)
|
||||||
, m_to(to)
|
, m_to(to)
|
||||||
@ -26,8 +27,8 @@ FrameTag::FrameTag(frame_t from, frame_t to)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameTag::FrameTag(const FrameTag& other)
|
Tag::Tag(const Tag& other)
|
||||||
: Object(ObjectType::FrameTag)
|
: Object(ObjectType::Tag)
|
||||||
, m_owner(nullptr)
|
, m_owner(nullptr)
|
||||||
, m_from(other.m_from)
|
, m_from(other.m_from)
|
||||||
, m_to(other.m_to)
|
, m_to(other.m_to)
|
||||||
@ -37,19 +38,19 @@ FrameTag::FrameTag(const FrameTag& other)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameTag::~FrameTag()
|
Tag::~Tag()
|
||||||
{
|
{
|
||||||
ASSERT(!m_owner);
|
ASSERT(!m_owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameTag::setOwner(FrameTags* owner)
|
void Tag::setOwner(Tags* owner)
|
||||||
{
|
{
|
||||||
m_owner = owner;
|
m_owner = owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameTag::setFrameRange(frame_t from, frame_t to)
|
void Tag::setFrameRange(frame_t from, frame_t to)
|
||||||
{
|
{
|
||||||
FrameTags* owner = m_owner;
|
Tags* owner = m_owner;
|
||||||
if (owner)
|
if (owner)
|
||||||
owner->remove(this);
|
owner->remove(this);
|
||||||
|
|
||||||
@ -60,17 +61,17 @@ void FrameTag::setFrameRange(frame_t from, frame_t to)
|
|||||||
owner->add(this); // Re-add the tag, so it's added in the correct place
|
owner->add(this); // Re-add the tag, so it's added in the correct place
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameTag::setName(const std::string& name)
|
void Tag::setName(const std::string& name)
|
||||||
{
|
{
|
||||||
m_name = name;
|
m_name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameTag::setColor(color_t color)
|
void Tag::setColor(color_t color)
|
||||||
{
|
{
|
||||||
m_color = color;
|
m_color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameTag::setAniDir(AniDir aniDir)
|
void Tag::setAniDir(AniDir aniDir)
|
||||||
{
|
{
|
||||||
ASSERT(m_aniDir == AniDir::FORWARD ||
|
ASSERT(m_aniDir == AniDir::FORWARD ||
|
||||||
m_aniDir == AniDir::REVERSE ||
|
m_aniDir == AniDir::REVERSE ||
|
@ -1,11 +1,12 @@
|
|||||||
// Aseprite Document Library
|
// Aseprite Document Library
|
||||||
// Copyright (c) 2001-2016 David Capello
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
|
|
||||||
#ifndef DOC_FRAME_TAG_H_INCLUDED
|
#ifndef DOC_TAG_H_INCLUDED
|
||||||
#define DOC_FRAME_TAG_H_INCLUDED
|
#define DOC_TAG_H_INCLUDED
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "base/disable_copying.h"
|
#include "base/disable_copying.h"
|
||||||
@ -17,15 +18,15 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
class FrameTags;
|
class Tags;
|
||||||
|
|
||||||
class FrameTag : public Object {
|
class Tag : public Object {
|
||||||
public:
|
public:
|
||||||
FrameTag(frame_t from, frame_t to);
|
Tag(frame_t from, frame_t to);
|
||||||
FrameTag(const FrameTag& other);
|
Tag(const Tag& other);
|
||||||
~FrameTag();
|
~Tag();
|
||||||
|
|
||||||
FrameTags* owner() const { return m_owner; }
|
Tags* owner() const { return m_owner; }
|
||||||
frame_t fromFrame() const { return m_from; }
|
frame_t fromFrame() const { return m_from; }
|
||||||
frame_t toFrame() const { return m_to; }
|
frame_t toFrame() const { return m_to; }
|
||||||
frame_t frames() const { return m_to - m_from + 1; }
|
frame_t frames() const { return m_to - m_from + 1; }
|
||||||
@ -38,17 +39,17 @@ namespace doc {
|
|||||||
void setColor(color_t color);
|
void setColor(color_t color);
|
||||||
void setAniDir(AniDir aniDir);
|
void setAniDir(AniDir aniDir);
|
||||||
|
|
||||||
void setOwner(FrameTags* owner);
|
void setOwner(Tags* owner);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FrameTags* m_owner;
|
Tags* m_owner;
|
||||||
frame_t m_from, m_to;
|
frame_t m_from, m_to;
|
||||||
color_t m_color;
|
color_t m_color;
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
AniDir m_aniDir;
|
AniDir m_aniDir;
|
||||||
|
|
||||||
// Disable operator=
|
// Disable operator=
|
||||||
FrameTag& operator=(FrameTag&);
|
Tag& operator=(Tag&);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace doc
|
} // namespace doc
|
@ -1,5 +1,6 @@
|
|||||||
// Aseprite Document Library
|
// Aseprite Document Library
|
||||||
// Copyright (c) 2001-2018 David Capello
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
@ -8,11 +9,11 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "doc/frame_tag_io.h"
|
#include "doc/tag_io.h"
|
||||||
|
|
||||||
#include "base/serialization.h"
|
#include "base/serialization.h"
|
||||||
#include "doc/frame_tag.h"
|
|
||||||
#include "doc/string_io.h"
|
#include "doc/string_io.h"
|
||||||
|
#include "doc/tag.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -22,7 +23,7 @@ namespace doc {
|
|||||||
using namespace base::serialization;
|
using namespace base::serialization;
|
||||||
using namespace base::serialization::little_endian;
|
using namespace base::serialization::little_endian;
|
||||||
|
|
||||||
void write_frame_tag(std::ostream& os, const FrameTag* tag)
|
void write_tag(std::ostream& os, const Tag* tag)
|
||||||
{
|
{
|
||||||
std::string name = tag->name();
|
std::string name = tag->name();
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ void write_frame_tag(std::ostream& os, const FrameTag* tag)
|
|||||||
write_string(os, tag->name());
|
write_string(os, tag->name());
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameTag* read_frame_tag(std::istream& is, bool setId)
|
Tag* read_tag(std::istream& is, bool setId)
|
||||||
{
|
{
|
||||||
ObjectId id = read32(is);
|
ObjectId id = read32(is);
|
||||||
frame_t from = read32(is);
|
frame_t from = read32(is);
|
||||||
@ -43,7 +44,7 @@ FrameTag* read_frame_tag(std::istream& is, bool setId)
|
|||||||
AniDir aniDir = (AniDir)read8(is);
|
AniDir aniDir = (AniDir)read8(is);
|
||||||
std::string name = read_string(is);
|
std::string name = read_string(is);
|
||||||
|
|
||||||
std::unique_ptr<FrameTag> tag(new FrameTag(from, to));
|
std::unique_ptr<Tag> tag(new Tag(from, to));
|
||||||
tag->setColor(color);
|
tag->setColor(color);
|
||||||
tag->setAniDir(aniDir);
|
tag->setAniDir(aniDir);
|
||||||
tag->setName(name);
|
tag->setName(name);
|
23
src/doc/tag_io.h
Normal file
23
src/doc/tag_io.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// Aseprite Document Library
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
|
// Copyright (C) 2001-2015 David Capello
|
||||||
|
//
|
||||||
|
// This file is released under the terms of the MIT license.
|
||||||
|
// Read LICENSE.txt for more information.
|
||||||
|
|
||||||
|
#ifndef DOC_TAG_IO_H_INCLUDED
|
||||||
|
#define DOC_TAG_IO_H_INCLUDED
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <iosfwd>
|
||||||
|
|
||||||
|
namespace doc {
|
||||||
|
|
||||||
|
class Tag;
|
||||||
|
|
||||||
|
void write_tag(std::ostream& os, const Tag* tag);
|
||||||
|
Tag* read_tag(std::istream& is, bool setId = true);
|
||||||
|
|
||||||
|
} // namespace doc
|
||||||
|
|
||||||
|
#endif
|
@ -1,5 +1,6 @@
|
|||||||
// Aseprite Document Library
|
// Aseprite Document Library
|
||||||
// Copyright (c) 2001-2016 David Capello
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
|
// Copyright (C) 2001-2016 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
@ -8,29 +9,29 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "doc/frame_tags.h"
|
#include "doc/tags.h"
|
||||||
|
|
||||||
#include "base/debug.h"
|
#include "base/debug.h"
|
||||||
#include "doc/frame_tag.h"
|
#include "doc/tag.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
|
|
||||||
FrameTags::FrameTags(Sprite* sprite)
|
Tags::Tags(Sprite* sprite)
|
||||||
: m_sprite(sprite)
|
: m_sprite(sprite)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameTags::~FrameTags()
|
Tags::~Tags()
|
||||||
{
|
{
|
||||||
for (FrameTag* tag : m_tags) {
|
for (Tag* tag : m_tags) {
|
||||||
tag->setOwner(nullptr);
|
tag->setOwner(nullptr);
|
||||||
delete tag;
|
delete tag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameTags::add(FrameTag* tag)
|
void Tags::add(Tag* tag)
|
||||||
{
|
{
|
||||||
auto it = begin(), end = this->end();
|
auto it = begin(), end = this->end();
|
||||||
for (; it != end; ++it) {
|
for (; it != end; ++it) {
|
||||||
@ -43,7 +44,7 @@ void FrameTags::add(FrameTag* tag)
|
|||||||
tag->setOwner(this);
|
tag->setOwner(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameTags::remove(FrameTag* tag)
|
void Tags::remove(Tag* tag)
|
||||||
{
|
{
|
||||||
auto it = std::find(m_tags.begin(), m_tags.end(), tag);
|
auto it = std::find(m_tags.begin(), m_tags.end(), tag);
|
||||||
ASSERT(it != m_tags.end());
|
ASSERT(it != m_tags.end());
|
||||||
@ -53,28 +54,28 @@ void FrameTags::remove(FrameTag* tag)
|
|||||||
tag->setOwner(nullptr);
|
tag->setOwner(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameTag* FrameTags::getByName(const std::string& name) const
|
Tag* Tags::getByName(const std::string& name) const
|
||||||
{
|
{
|
||||||
for (FrameTag* tag : *this) {
|
for (Tag* tag : *this) {
|
||||||
if (tag->name() == name)
|
if (tag->name() == name)
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameTag* FrameTags::getById(ObjectId id) const
|
Tag* Tags::getById(ObjectId id) const
|
||||||
{
|
{
|
||||||
for (FrameTag* tag : *this) {
|
for (Tag* tag : *this) {
|
||||||
if (tag->id() == id)
|
if (tag->id() == id)
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameTag* FrameTags::innerTag(frame_t frame) const
|
Tag* Tags::innerTag(const frame_t frame) const
|
||||||
{
|
{
|
||||||
const FrameTag* found = nullptr;
|
const Tag* found = nullptr;
|
||||||
for (const FrameTag* tag : *this) {
|
for (const Tag* tag : *this) {
|
||||||
if (frame >= tag->fromFrame() &&
|
if (frame >= tag->fromFrame() &&
|
||||||
frame <= tag->toFrame()) {
|
frame <= tag->toFrame()) {
|
||||||
if (!found ||
|
if (!found ||
|
||||||
@ -83,13 +84,13 @@ FrameTag* FrameTags::innerTag(frame_t frame) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return const_cast<FrameTag*>(found);
|
return const_cast<Tag*>(found);
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameTag* FrameTags::outerTag(frame_t frame) const
|
Tag* Tags::outerTag(const frame_t frame) const
|
||||||
{
|
{
|
||||||
const FrameTag* found = nullptr;
|
const Tag* found = nullptr;
|
||||||
for (const FrameTag* tag : *this) {
|
for (const Tag* tag : *this) {
|
||||||
if (frame >= tag->fromFrame() &&
|
if (frame >= tag->fromFrame() &&
|
||||||
frame <= tag->toFrame()) {
|
frame <= tag->toFrame()) {
|
||||||
if (!found ||
|
if (!found ||
|
||||||
@ -98,7 +99,7 @@ FrameTag* FrameTags::outerTag(frame_t frame) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return const_cast<FrameTag*>(found);
|
return const_cast<Tag*>(found);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace doc
|
} // namespace doc
|
@ -1,11 +1,12 @@
|
|||||||
// Aseprite Document Library
|
// Aseprite Document Library
|
||||||
// Copyright (c) 2001-2015 David Capello
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
|
// Copyright (C) 2001-2015 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
|
|
||||||
#ifndef DOC_FRAME_TAGS_H_INCLUDED
|
#ifndef DOC_TAGS_H_INCLUDED
|
||||||
#define DOC_FRAME_TAGS_H_INCLUDED
|
#define DOC_TAGS_H_INCLUDED
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "base/disable_copying.h"
|
#include "base/disable_copying.h"
|
||||||
@ -17,26 +18,26 @@
|
|||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
|
|
||||||
class FrameTag;
|
class Tag;
|
||||||
class Sprite;
|
class Sprite;
|
||||||
|
|
||||||
class FrameTags {
|
class Tags {
|
||||||
typedef std::vector<FrameTag*> List;
|
typedef std::vector<Tag*> List;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef List::iterator iterator;
|
typedef List::iterator iterator;
|
||||||
typedef List::const_iterator const_iterator;
|
typedef List::const_iterator const_iterator;
|
||||||
|
|
||||||
FrameTags(Sprite* sprite);
|
Tags(Sprite* sprite);
|
||||||
~FrameTags();
|
~Tags();
|
||||||
|
|
||||||
Sprite* sprite() { return m_sprite; }
|
Sprite* sprite() { return m_sprite; }
|
||||||
|
|
||||||
void add(FrameTag* tag);
|
void add(Tag* tag);
|
||||||
void remove(FrameTag* tag);
|
void remove(Tag* tag);
|
||||||
|
|
||||||
FrameTag* getByName(const std::string& name) const;
|
Tag* getByName(const std::string& name) const;
|
||||||
FrameTag* getById(const ObjectId id) const;
|
Tag* getById(const ObjectId id) const;
|
||||||
|
|
||||||
iterator begin() { return m_tags.begin(); }
|
iterator begin() { return m_tags.begin(); }
|
||||||
iterator end() { return m_tags.end(); }
|
iterator end() { return m_tags.end(); }
|
||||||
@ -46,14 +47,14 @@ namespace doc {
|
|||||||
std::size_t size() const { return m_tags.size(); }
|
std::size_t size() const { return m_tags.size(); }
|
||||||
bool empty() const { return m_tags.empty(); }
|
bool empty() const { return m_tags.empty(); }
|
||||||
|
|
||||||
FrameTag* innerTag(frame_t frame) const;
|
Tag* innerTag(const frame_t frame) const;
|
||||||
FrameTag* outerTag(frame_t frame) const;
|
Tag* outerTag(const frame_t frame) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Sprite* m_sprite;
|
Sprite* m_sprite;
|
||||||
List m_tags;
|
List m_tags;
|
||||||
|
|
||||||
DISABLE_COPYING(FrameTags);
|
DISABLE_COPYING(Tags);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace doc
|
} // namespace doc
|
@ -1,5 +1,6 @@
|
|||||||
// Aseprite Render Library
|
// Aseprite Render Library
|
||||||
// Copyright (c) 2018 David Capello
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
|
// Copyright (C) 2018 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
@ -12,8 +13,8 @@
|
|||||||
#include "render/onionskin_type.h"
|
#include "render/onionskin_type.h"
|
||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
class FrameTag;
|
|
||||||
class Layer;
|
class Layer;
|
||||||
|
class Tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace render {
|
namespace render {
|
||||||
@ -37,7 +38,7 @@ namespace render {
|
|||||||
int nextFrames() const { return m_nextFrames; }
|
int nextFrames() const { return m_nextFrames; }
|
||||||
int opacityBase() const { return m_opacityBase; }
|
int opacityBase() const { return m_opacityBase; }
|
||||||
int opacityStep() const { return m_opacityStep; }
|
int opacityStep() const { return m_opacityStep; }
|
||||||
doc::FrameTag* loopTag() const { return m_loopTag; }
|
doc::Tag* loopTag() const { return m_loopTag; }
|
||||||
doc::Layer* layer() const { return m_layer; }
|
doc::Layer* layer() const { return m_layer; }
|
||||||
|
|
||||||
void type(OnionskinType type) { m_type = type; }
|
void type(OnionskinType type) { m_type = type; }
|
||||||
@ -46,7 +47,7 @@ namespace render {
|
|||||||
void nextFrames(int nextFrames) { m_nextFrames = nextFrames; }
|
void nextFrames(int nextFrames) { m_nextFrames = nextFrames; }
|
||||||
void opacityBase(int base) { m_opacityBase = base; }
|
void opacityBase(int base) { m_opacityBase = base; }
|
||||||
void opacityStep(int step) { m_opacityStep = step; }
|
void opacityStep(int step) { m_opacityStep = step; }
|
||||||
void loopTag(doc::FrameTag* loopTag) { m_loopTag = loopTag; }
|
void loopTag(doc::Tag* loopTag) { m_loopTag = loopTag; }
|
||||||
void layer(doc::Layer* layer) { m_layer = layer; }
|
void layer(doc::Layer* layer) { m_layer = layer; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -56,7 +57,7 @@ namespace render {
|
|||||||
int m_nextFrames;
|
int m_nextFrames;
|
||||||
int m_opacityBase;
|
int m_opacityBase;
|
||||||
int m_opacityStep;
|
int m_opacityStep;
|
||||||
doc::FrameTag* m_loopTag;
|
doc::Tag* m_loopTag;
|
||||||
doc::Layer* m_layer;
|
doc::Layer* m_layer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Aseprite Render Library
|
// Aseprite Render Library
|
||||||
// Copyright (c) 2019 Igara Studio S.A.
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (c) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This file is released under the terms of the MIT license.
|
// This file is released under the terms of the MIT license.
|
||||||
// Read LICENSE.txt for more information.
|
// Read LICENSE.txt for more information.
|
||||||
@ -849,7 +849,7 @@ void Render::renderOnionskin(
|
|||||||
// Onion-skin feature: Draw previous/next frames with different
|
// Onion-skin feature: Draw previous/next frames with different
|
||||||
// opacity (<255)
|
// opacity (<255)
|
||||||
if (m_onionskin.type() != OnionskinType::NONE) {
|
if (m_onionskin.type() != OnionskinType::NONE) {
|
||||||
FrameTag* loop = m_onionskin.loopTag();
|
Tag* loop = m_onionskin.loopTag();
|
||||||
Layer* onionLayer = (m_onionskin.layer() ? m_onionskin.layer():
|
Layer* onionLayer = (m_onionskin.layer() ? m_onionskin.layer():
|
||||||
m_sprite->root());
|
m_sprite->root());
|
||||||
frame_t frameIn;
|
frame_t frameIn;
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
namespace doc {
|
namespace doc {
|
||||||
class Cel;
|
class Cel;
|
||||||
class FrameTag;
|
|
||||||
class Image;
|
class Image;
|
||||||
class Layer;
|
class Layer;
|
||||||
class Palette;
|
class Palette;
|
||||||
|
Loading…
Reference in New Issue
Block a user