Allows the user to edit sprites. More...
#include <sprite_editor.h>
Classes | |
| struct | OAMConfig |
Public Member Functions | |
| SpriteEditor (Rom *rom=nullptr) | |
| void | Initialize () override |
| absl::Status | Load () override |
| absl::Status | Update () override |
| absl::Status | Undo () override |
| absl::Status | Redo () override |
| absl::Status | Cut () override |
| absl::Status | Copy () override |
| absl::Status | Paste () override |
| absl::Status | Find () override |
| absl::Status | Save () override |
| void | set_rom (Rom *rom) |
| Rom * | rom () const |
Public Member Functions inherited from yaze::editor::Editor | |
| Editor ()=default | |
| virtual | ~Editor ()=default |
| virtual void | SetDependencies (const EditorDependencies &deps) |
| virtual void | SetGameData (zelda3::GameData *game_data) |
| virtual std::string | GetUndoDescription () const |
| virtual std::string | GetRedoDescription () const |
| const UndoManager & | undo_manager () const |
| virtual absl::Status | Clear () |
| EditorType | type () const |
| bool * | active () |
| void | set_active (bool active) |
| void | toggle_active () |
| virtual bool | IsRomLoaded () const |
| virtual std::string | GetRomStatus () const |
| Rom * | rom () const |
| zelda3::GameData * | game_data () const |
| EditorContext | context () const |
| bool | HasContext () const |
Additional Inherited Members | |
Protected Member Functions inherited from yaze::editor::Editor | |
| std::string | MakePanelTitle (const std::string &base_title) const |
| std::string | MakePanelId (const std::string &base_id) const |
| template<typename T > | |
| absl::StatusOr< T > | SafeRomAccess (std::function< T()> accessor, const std::string &operation="") const |
Protected Attributes inherited from yaze::editor::Editor | |
| bool | active_ = false |
| EditorType | type_ |
| EditorDependencies | dependencies_ |
| UndoManager | undo_manager_ |
Allows the user to edit sprites.
This class provides functionality for updating the sprite editor, drawing the editor table, drawing the sprite canvas, and drawing the current sheets. Supports both vanilla ROM sprites and custom ZSM format sprites.
Definition at line 43 of file sprite_editor.h.
|
inlineexplicit |
Definition at line 45 of file sprite_editor.h.
References yaze::editor::kSprite, and yaze::editor::Editor::type_.
|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 58 of file sprite_editor.cc.
References yaze::editor::Editor::dependencies_, DrawCustomSprites(), yaze::Rom::is_loaded(), yaze::editor::EditorDependencies::panel_manager, yaze::editor::PanelManager::RegisterEditorPanel(), and rom_.
|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 78 of file sprite_editor.cc.
|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 83 of file sprite_editor.cc.
References HandleEditorShortcuts(), last_frame_time_, rom(), sheets_loaded_, status_, and UpdateAnimationPlayback().
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 52 of file sprite_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 53 of file sprite_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 54 of file sprite_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 55 of file sprite_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 56 of file sprite_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 57 of file sprite_editor.h.
|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 136 of file sprite_editor.cc.
References current_custom_sprite_index_, custom_sprites_, GetCurrentZsmPath(), SaveZsmFile(), and SaveZsmFileAs().
|
inline |
|
inline |
Definition at line 61 of file sprite_editor.h.
References rom_.
Referenced by DrawSpritesList(), set_rom(), and Update().
|
private |
Definition at line 103 of file sprite_editor.cc.
References animation_playing_, current_frame_, current_sprite_id_, preview_needs_update_, and vanilla_preview_needs_update_.
Referenced by Update().
|
private |
Definition at line 157 of file sprite_editor.cc.
References active_sprites_, yaze::gui::BeginThemedTabBar(), current_sprite_id_, DrawCurrentSheets(), DrawSpriteCanvas(), DrawSpritesList(), yaze::gui::EndThemedTabBar(), ICON_MD_ADD, yaze::zelda3::kSpriteDefaultNames, yaze::editor::kSpriteTabBarFlags, yaze::editor::kSpriteTabFlags, and sheets_loaded_.
|
private |
Definition at line 329 of file sprite_editor.cc.
References active_sprites_, current_sprite_id_, yaze::gui::GetID(), yaze::util::HexByte(), yaze::zelda3::kSpriteDefaultNames, yaze::Rom::resource_label(), rom(), yaze::project::ResourceLabelManager::SelectableLabelWithNameEdit(), and vanilla_preview_needs_update_.
Referenced by DrawVanillaSpriteEditor().
|
private |
Definition at line 214 of file sprite_editor.cc.
References current_sprite_id_, DrawAnimationFrames(), yaze::gui::Canvas::DrawBackground(), yaze::gui::Canvas::DrawBitmap(), yaze::gui::Canvas::DrawContextMenu(), yaze::gui::Canvas::DrawGrid(), yaze::gui::Canvas::DrawOverlay(), yaze::editor::SpriteEditor::OAMConfig::flip_x, yaze::editor::SpriteEditor::OAMConfig::flip_y, yaze::gui::GetID(), yaze::zelda3::SpriteOamRegistry::GetLayout(), yaze::gui::InputHexByte(), yaze::gui::InputHexWord(), yaze::gfx::Bitmap::is_active(), LoadSheetsForSprite(), oam_config_, yaze::editor::SpriteEditor::OAMConfig::palette, yaze::editor::SpriteEditor::OAMConfig::priority, RenderVanillaSprite(), sprite_canvas_, yaze::editor::SpriteEditor::OAMConfig::tile, vanilla_preview_bitmap_, yaze::editor::SpriteEditor::OAMConfig::x, and yaze::editor::SpriteEditor::OAMConfig::y.
Referenced by DrawVanillaSpriteEditor().
|
private |
Definition at line 291 of file sprite_editor.cc.
References current_sheets_, yaze::gui::Canvas::DrawBackground(), yaze::gui::Canvas::DrawBitmap(), yaze::gui::Canvas::DrawContextMenu(), yaze::gui::Canvas::DrawGrid(), yaze::gui::Canvas::DrawOverlay(), yaze::gui::Canvas::DrawTileSelector(), yaze::gfx::Arena::Get(), yaze::gui::GetID(), gfx_buffer_loaded_, graphics_sheet_canvas_, yaze::gui::InputHexByte(), and preview_needs_update_.
Referenced by DrawCustomSprites(), and DrawVanillaSpriteEditor().
|
private |
Definition at line 149 of file sprite_editor.cc.
|
private |
Definition at line 366 of file sprite_editor.cc.
References DrawCurrentSheets(), DrawCustomSpritesMetadata(), and DrawZSpriteOnCanvas().
Referenced by Initialize().
|
private |
Definition at line 390 of file sprite_editor.cc.
References animation_playing_, yaze::gui::BeginThemedTabBar(), CreateNewZSprite(), current_animation_index_, current_custom_sprite_index_, current_frame_, custom_sprites_, DrawAnimationPanel(), DrawSpritePropertiesPanel(), DrawUserRoutinesPanel(), yaze::gui::EndThemedTabBar(), frame_timer_, GetCurrentZsmPath(), ICON_MD_ADD, ICON_MD_FOLDER_OPEN, ICON_MD_SAVE, ICON_MD_SAVE_AS, LoadZsmFile(), preview_needs_update_, SaveZsmFile(), SaveZsmFileAs(), selected_routine_index_, selected_tile_index_, and yaze::util::FileDialogWrapper::ShowOpenFileDialog().
Referenced by DrawCustomSprites().
|
private |
Definition at line 353 of file sprite_editor.cc.
Referenced by DrawSpriteCanvas().
|
private |
Definition at line 467 of file sprite_editor.cc.
References animation_playing_, yaze::editor::zsprite::ZSprite::animations, current_animation_index_, current_custom_sprite_index_, current_frame_, custom_sprite_paths_, custom_sprites_, yaze::editor::zsprite::ZSprite::editor, frame_timer_, yaze::editor::zsprite::SubEditor::Frames, preview_needs_update_, yaze::editor::zsprite::ZSprite::Reset(), selected_routine_index_, selected_tile_index_, yaze::editor::zsprite::ZSprite::sprName, and zsm_dirty_.
Referenced by DrawCustomSpritesMetadata().
|
private |
Definition at line 491 of file sprite_editor.cc.
References animation_playing_, current_animation_index_, current_custom_sprite_index_, current_frame_, custom_sprite_paths_, custom_sprites_, frame_timer_, yaze::editor::zsprite::ZSprite::Load(), preview_needs_update_, selected_routine_index_, selected_tile_index_, status_, and zsm_dirty_.
Referenced by DrawCustomSpritesMetadata().
|
private |
Definition at line 510 of file sprite_editor.cc.
References current_custom_sprite_index_, custom_sprites_, SetCurrentZsmPath(), status_, and zsm_dirty_.
Referenced by DrawCustomSpritesMetadata(), Save(), and SaveZsmFileAs().
|
private |
Definition at line 521 of file sprite_editor.cc.
References current_custom_sprite_index_, SaveZsmFile(), and yaze::util::FileDialogWrapper::ShowSaveFileDialog().
Referenced by DrawCustomSpritesMetadata(), and Save().
|
private |
Definition at line 1275 of file sprite_editor.cc.
References custom_sprite_paths_, and custom_sprites_.
Referenced by SetCurrentZsmPath().
|
private |
Definition at line 1281 of file sprite_editor.cc.
References current_custom_sprite_index_, and custom_sprite_paths_.
Referenced by DrawCustomSpritesMetadata(), and Save().
|
private |
Definition at line 1291 of file sprite_editor.cc.
References current_custom_sprite_index_, custom_sprite_paths_, and EnsureCustomSpritePaths().
Referenced by SaveZsmFile().
|
private |
Definition at line 535 of file sprite_editor.cc.
References current_custom_sprite_index_, custom_sprites_, DrawBooleanProperties(), DrawStatProperties(), and zsm_dirty_.
Referenced by DrawCustomSpritesMetadata().
|
private |
Definition at line 607 of file sprite_editor.cc.
References current_custom_sprite_index_, custom_sprites_, and zsm_dirty_.
Referenced by DrawSpritePropertiesPanel().
|
private |
Definition at line 564 of file sprite_editor.cc.
References current_custom_sprite_index_, custom_sprites_, and zsm_dirty_.
Referenced by DrawSpritePropertiesPanel().
|
private |
Definition at line 673 of file sprite_editor.cc.
References animation_playing_, current_animation_index_, current_custom_sprite_index_, current_frame_, custom_sprites_, DrawFrameEditor(), frame_timer_, HOVER_HINT, ICON_MD_ADD, ICON_MD_PLAY_ARROW, ICON_MD_SKIP_NEXT, ICON_MD_SKIP_PREVIOUS, ICON_MD_STOP, preview_needs_update_, and zsm_dirty_.
Referenced by DrawCustomSpritesMetadata().
|
private |
|
private |
Definition at line 777 of file sprite_editor.cc.
References current_custom_sprite_index_, current_frame_, custom_sprites_, HOVER_HINT, ICON_MD_ADD, ICON_MD_DELETE, preview_needs_update_, selected_tile_index_, and zsm_dirty_.
Referenced by DrawAnimationPanel().
|
private |
Definition at line 897 of file sprite_editor.cc.
References animation_playing_, current_animation_index_, current_custom_sprite_index_, current_frame_, custom_sprites_, frame_timer_, and preview_needs_update_.
Referenced by Update().
|
private |
Definition at line 928 of file sprite_editor.cc.
References current_custom_sprite_index_, custom_sprites_, HOVER_HINT, ICON_MD_ADD, selected_routine_index_, and zsm_dirty_.
Referenced by DrawCustomSpritesMetadata().
|
private |
Definition at line 1164 of file sprite_editor.cc.
References yaze::gfx::SnesPalette::AddColor(), yaze::editor::SpriteDrawer::ClearBitmap(), yaze::gfx::Bitmap::Create(), current_custom_sprite_index_, custom_sprites_, yaze::gui::Canvas::DrawBitmap(), yaze::editor::SpriteDrawer::DrawFrame(), yaze::gui::Canvas::DrawRect(), gfx_buffer_loaded_, yaze::gfx::Bitmap::is_active(), yaze::editor::SpriteDrawer::IsReady(), LoadSpriteGraphicsBuffer(), LoadSpritePalettes(), yaze::gfx::PaletteGroup::palette(), preview_needs_update_, yaze::gfx::Bitmap::Reformat(), selected_tile_index_, yaze::gfx::Bitmap::SetPalette(), sheets_loaded_, show_tile_grid_, yaze::gfx::SnesPalette::size(), yaze::gfx::PaletteGroup::size(), sprite_canvas_, sprite_drawer_, sprite_gfx_buffer_, sprite_palettes_, and sprite_preview_bitmap_.
Referenced by DrawZSpriteOnCanvas().
|
private |
Definition at line 1247 of file sprite_editor.cc.
References current_custom_sprite_index_, current_frame_, custom_sprites_, yaze::gui::Canvas::DrawBackground(), yaze::gui::Canvas::DrawContextMenu(), yaze::gui::Canvas::DrawGrid(), yaze::gui::Canvas::DrawOverlay(), yaze::gui::GetID(), RenderZSpriteFrame(), and sprite_canvas_.
Referenced by DrawCustomSprites().
|
private |
Definition at line 987 of file sprite_editor.cc.
References current_sheets_, yaze::gfx::Arena::Get(), gfx_buffer_loaded_, yaze::gfx::Arena::gfx_sheets(), yaze::editor::SpriteDrawer::SetGraphicsBuffer(), sprite_drawer_, and sprite_gfx_buffer_.
Referenced by RenderVanillaSprite(), and RenderZSpriteFrame().
|
private |
Definition at line 1032 of file sprite_editor.cc.
References yaze::gfx::PaletteGroup::AddPalette(), yaze::gfx::PaletteGroup::clear(), yaze::editor::Editor::game_data(), yaze::gfx::PaletteGroupMap::global_sprites, yaze::Rom::is_loaded(), yaze::zelda3::GameData::palette_groups, rom_, yaze::editor::SpriteDrawer::SetPalettes(), yaze::gfx::PaletteGroup::size(), sprite_drawer_, sprite_palettes_, yaze::gfx::PaletteGroupMap::sprites_aux1, yaze::gfx::PaletteGroupMap::sprites_aux2, and yaze::gfx::PaletteGroupMap::sprites_aux3.
Referenced by RenderVanillaSprite(), and RenderZSpriteFrame().
|
private |
Definition at line 1098 of file sprite_editor.cc.
References yaze::gfx::SnesPalette::AddColor(), yaze::editor::SpriteDrawer::ClearBitmap(), yaze::gfx::Bitmap::Create(), yaze::editor::SpriteDrawer::DrawOamTile(), gfx_buffer_loaded_, yaze::editor::zsprite::OamTile::id, yaze::gfx::Bitmap::is_active(), yaze::editor::SpriteDrawer::IsReady(), LoadSpriteGraphicsBuffer(), LoadSpritePalettes(), yaze::editor::zsprite::OamTile::mirror_x, yaze::editor::zsprite::OamTile::mirror_y, yaze::editor::zsprite::OamTile::palette, yaze::gfx::PaletteGroup::palette(), yaze::editor::zsprite::OamTile::priority, yaze::gfx::Bitmap::Reformat(), yaze::gfx::Bitmap::SetPalette(), sheets_loaded_, yaze::editor::zsprite::OamTile::size, yaze::gfx::SnesPalette::size(), yaze::gfx::PaletteGroup::size(), sprite_drawer_, sprite_gfx_buffer_, sprite_palettes_, yaze::zelda3::SpriteOamLayout::tiles, vanilla_preview_bitmap_, vanilla_preview_needs_update_, yaze::editor::zsprite::OamTile::x, and yaze::editor::zsprite::OamTile::y.
Referenced by DrawSpriteCanvas().
|
private |
Definition at line 1082 of file sprite_editor.cc.
References current_sheets_, gfx_buffer_loaded_, and vanilla_preview_needs_update_.
Referenced by DrawSpriteCanvas().
|
private |
Definition at line 121 of file sprite_editor.h.
Referenced by DrawSpritesList(), and DrawVanillaSpriteEditor().
|
private |
Definition at line 122 of file sprite_editor.h.
Referenced by DrawSpriteCanvas(), DrawSpritesList(), DrawVanillaSpriteEditor(), and HandleEditorShortcuts().
|
private |
Definition at line 123 of file sprite_editor.h.
Referenced by DrawCurrentSheets(), LoadSheetsForSprite(), and LoadSpriteGraphicsBuffer().
|
private |
Definition at line 124 of file sprite_editor.h.
Referenced by DrawVanillaSpriteEditor(), RenderVanillaSprite(), RenderZSpriteFrame(), and Update().
|
private |
Definition at line 136 of file sprite_editor.h.
Referenced by DrawSpriteCanvas().
|
private |
Definition at line 137 of file sprite_editor.h.
|
private |
Definition at line 138 of file sprite_editor.h.
Referenced by DrawSpriteCanvas(), and RenderVanillaSprite().
|
private |
Definition at line 139 of file sprite_editor.h.
Referenced by DrawSpritesList(), HandleEditorShortcuts(), LoadSheetsForSprite(), and RenderVanillaSprite().
|
private |
Definition at line 144 of file sprite_editor.h.
Referenced by CreateNewZSprite(), DrawAnimationPanel(), DrawBooleanProperties(), DrawCustomSpritesMetadata(), DrawFrameEditor(), DrawSpritePropertiesPanel(), DrawStatProperties(), DrawUserRoutinesPanel(), DrawZSpriteOnCanvas(), EnsureCustomSpritePaths(), LoadZsmFile(), RenderZSpriteFrame(), Save(), SaveZsmFile(), and UpdateAnimationPlayback().
|
private |
Definition at line 145 of file sprite_editor.h.
Referenced by CreateNewZSprite(), EnsureCustomSpritePaths(), GetCurrentZsmPath(), LoadZsmFile(), and SetCurrentZsmPath().
|
private |
Definition at line 146 of file sprite_editor.h.
Referenced by CreateNewZSprite(), DrawAnimationPanel(), DrawBooleanProperties(), DrawCustomSpritesMetadata(), DrawFrameEditor(), DrawSpritePropertiesPanel(), DrawStatProperties(), DrawUserRoutinesPanel(), DrawZSpriteOnCanvas(), GetCurrentZsmPath(), LoadZsmFile(), RenderZSpriteFrame(), Save(), SaveZsmFile(), SaveZsmFileAs(), SetCurrentZsmPath(), and UpdateAnimationPlayback().
|
private |
Definition at line 147 of file sprite_editor.h.
Referenced by CreateNewZSprite(), DrawAnimationPanel(), DrawBooleanProperties(), DrawFrameEditor(), DrawSpritePropertiesPanel(), DrawStatProperties(), DrawUserRoutinesPanel(), LoadZsmFile(), and SaveZsmFile().
|
private |
Definition at line 150 of file sprite_editor.h.
Referenced by CreateNewZSprite(), DrawAnimationPanel(), DrawCustomSpritesMetadata(), HandleEditorShortcuts(), LoadZsmFile(), and UpdateAnimationPlayback().
|
private |
Definition at line 151 of file sprite_editor.h.
Referenced by CreateNewZSprite(), DrawAnimationPanel(), DrawCustomSpritesMetadata(), DrawFrameEditor(), DrawZSpriteOnCanvas(), HandleEditorShortcuts(), LoadZsmFile(), and UpdateAnimationPlayback().
|
private |
Definition at line 152 of file sprite_editor.h.
Referenced by CreateNewZSprite(), DrawAnimationPanel(), DrawCustomSpritesMetadata(), LoadZsmFile(), and UpdateAnimationPlayback().
|
private |
Definition at line 153 of file sprite_editor.h.
Referenced by CreateNewZSprite(), DrawAnimationPanel(), DrawCustomSpritesMetadata(), LoadZsmFile(), and UpdateAnimationPlayback().
|
private |
Definition at line 154 of file sprite_editor.h.
Referenced by Update().
|
private |
Definition at line 157 of file sprite_editor.h.
Referenced by CreateNewZSprite(), DrawCustomSpritesMetadata(), DrawUserRoutinesPanel(), and LoadZsmFile().
|
private |
Definition at line 158 of file sprite_editor.h.
Referenced by CreateNewZSprite(), DrawCustomSpritesMetadata(), DrawFrameEditor(), LoadZsmFile(), and RenderZSpriteFrame().
|
private |
Definition at line 159 of file sprite_editor.h.
Referenced by RenderZSpriteFrame().
|
private |
Definition at line 162 of file sprite_editor.h.
Referenced by RenderZSpriteFrame().
|
private |
Definition at line 163 of file sprite_editor.h.
Referenced by CreateNewZSprite(), DrawAnimationPanel(), DrawCurrentSheets(), DrawCustomSpritesMetadata(), DrawFrameEditor(), HandleEditorShortcuts(), LoadZsmFile(), RenderZSpriteFrame(), and UpdateAnimationPlayback().
|
private |
Definition at line 168 of file sprite_editor.h.
Referenced by LoadSpriteGraphicsBuffer(), LoadSpritePalettes(), RenderVanillaSprite(), and RenderZSpriteFrame().
|
private |
Definition at line 169 of file sprite_editor.h.
Referenced by LoadSpriteGraphicsBuffer(), RenderVanillaSprite(), and RenderZSpriteFrame().
|
private |
Definition at line 170 of file sprite_editor.h.
Referenced by LoadSpritePalettes(), RenderVanillaSprite(), and RenderZSpriteFrame().
|
private |
Definition at line 171 of file sprite_editor.h.
Referenced by DrawCurrentSheets(), LoadSheetsForSprite(), LoadSpriteGraphicsBuffer(), RenderVanillaSprite(), and RenderZSpriteFrame().
|
private |
Definition at line 176 of file sprite_editor.h.
Referenced by DrawSpriteCanvas(), DrawZSpriteOnCanvas(), and RenderZSpriteFrame().
|
private |
Definition at line 179 of file sprite_editor.h.
Referenced by DrawCurrentSheets().
|
private |
Definition at line 186 of file sprite_editor.h.
Referenced by LoadZsmFile(), SaveZsmFile(), and Update().
|
private |
Definition at line 187 of file sprite_editor.h.
Referenced by Initialize(), LoadSpritePalettes(), rom(), and set_rom().