Allows the user to edit graphics sheets from the game or view prototype graphics. More...
#include <graphics_editor.h>

Public Member Functions | |
| GraphicsEditor (Rom *rom=nullptr) | |
| void | Initialize () override |
| absl::Status | Load () override |
| absl::Status | Save () override |
| absl::Status | Update () override |
| absl::Status | Cut () override |
| absl::Status | Copy () override |
| absl::Status | Paste () override |
| absl::Status | Undo () override |
| absl::Status | Redo () override |
| absl::Status | Find () override |
| void | set_rom (Rom *rom) |
| void | SetGameData (zelda3::GameData *game_data) override |
| void | NextSheet () |
| void | PrevSheet () |
| void | SelectSheet (uint16_t sheet_id) |
| void | HighlightTile (uint16_t sheet_id, uint16_t tile_index, const std::string &label="", double duration_secs=3.0) |
| Rom * | rom () const |
Public Member Functions inherited from yaze::editor::Editor | |
| Editor ()=default | |
| virtual | ~Editor ()=default |
| virtual void | SetDependencies (const EditorDependencies &deps) |
| 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 |
Private Member Functions | |
| void | HandleEditorShortcuts () |
| void | DrawPrototypeViewer () |
| absl::Status | DrawCgxImport () |
| absl::Status | DrawScrImport () |
| absl::Status | DrawFileImport () |
| absl::Status | DrawObjImport () |
| absl::Status | DrawTilemapImport () |
| absl::Status | DrawPaletteControls () |
| absl::Status | DrawClipboardImport () |
| absl::Status | DrawExperimentalFeatures () |
| absl::Status | DrawMemoryEditor () |
| absl::Status | DecompressImportData (int size) |
| absl::Status | DecompressSuperDonkey () |
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 graphics sheets from the game or view prototype graphics.
The GraphicsEditor class is responsible for providing functionality to edit graphics sheets from the game or view prototype graphics of Link to the Past from the CGX, SCR, and OBJ formats. It provides various methods to update different components of the graphics editor, such as the graphics edit tab, link graphics view, and prototype graphics viewer. It also includes import functions for different file formats, as well as other utility functions for drawing toolsets, palette controls, clipboard imports, experimental features, and memory editor.
Definition at line 62 of file graphics_editor.h.
|
inlineexplicit |
Definition at line 64 of file graphics_editor.h.
References yaze::editor::kGraphics, and yaze::editor::Editor::type_.
|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 50 of file graphics_editor.cc.
References yaze::editor::Editor::dependencies_, game_data_, gfx_group_panel_, link_sprite_panel_, palette_controls_panel_, paletteset_panel_, yaze::editor::EditorDependencies::panel_manager, pixel_editor_panel_, rom_, sheet_browser_panel_, state_, status_, and yaze::editor::Editor::undo_manager_.
Referenced by yaze::test::GraphicsEditorTestSuite::RunPaletteEditingTest(), and yaze::test::GraphicsEditorTestSuite::RunPixelEditingTest().
|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 120 of file graphics_editor.cc.
References yaze::gfx::Arena::CREATE, yaze::editor::Editor::game_data(), yaze::gfx::Arena::Get(), yaze::gfx::Arena::gfx_sheets(), yaze::zelda3::kNumGfxSheets, LOG_INFO, yaze::gfx::Arena::QueueTextureCommand(), and rom().
Referenced by yaze::test::GraphicsEditorTestSuite::RunPaletteEditingTest(), and yaze::test::GraphicsEditorTestSuite::RunPixelEditingTest().
|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 183 of file graphics_editor.cc.
References yaze::editor::GraphicsEditorState::ClearModifiedSheets(), yaze::Rom::data(), yaze::gfx::lc_lz2::DecompressV2(), yaze::editor::Editor::game_data(), yaze::gfx::Arena::Get(), yaze::core::RomSettings::Get(), yaze::core::RomSettings::GetAddressOr(), yaze::zelda3::GetGraphicsAddress(), yaze::gfx::Arena::gfx_sheets(), yaze::editor::GraphicsEditorState::HasUnsavedChanges(), yaze::gfx::HyruleMagicCompress(), yaze::gfx::IndexedToSnesSheet(), yaze::Rom::is_loaded(), yaze::zelda3::kNumGfxSheets, yaze::core::RomAddressKey::kOverworldGfxPtr1, yaze::core::RomAddressKey::kOverworldGfxPtr2, yaze::core::RomAddressKey::kOverworldGfxPtr3, yaze::gfx::kTilesheetHeight, yaze::gfx::kTilesheetWidth, LOG_INFO, LOG_WARN, yaze::editor::GraphicsEditorState::modified_sheets, yaze::Rom::ReadByteVector(), rom_, yaze::Rom::size(), state_, and yaze::Rom::WriteByte().
|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 315 of file graphics_editor.cc.
References CLEAR_AND_RETURN_STATUS, HandleEditorShortcuts(), and status_.

|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 72 of file graphics_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 73 of file graphics_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 74 of file graphics_editor.h.
|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 326 of file graphics_editor.cc.
References yaze::editor::UndoManager::Undo(), and yaze::editor::Editor::undo_manager_.

|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 330 of file graphics_editor.cc.
References yaze::editor::UndoManager::Redo(), and yaze::editor::Editor::undo_manager_.

|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 77 of file graphics_editor.h.
|
inline |
|
inlineoverridevirtual |
Reimplemented from yaze::editor::Editor.
Definition at line 83 of file graphics_editor.h.
References yaze::editor::Editor::game_data(), game_data_, gfx_group_panel_, palette_controls_panel_, and paletteset_panel_.
Referenced by yaze::editor::EditorSet::EditorSet(), yaze::test::GraphicsEditorTestSuite::RunPaletteEditingTest(), and yaze::test::GraphicsEditorTestSuite::RunPixelEditingTest().

| void yaze::editor::GraphicsEditor::NextSheet | ( | ) |
Definition at line 781 of file graphics_editor.cc.
References yaze::editor::GraphicsEditorState::current_sheet_id, yaze::zelda3::kNumGfxSheets, and state_.
Referenced by HandleEditorShortcuts().
| void yaze::editor::GraphicsEditor::PrevSheet | ( | ) |
Definition at line 787 of file graphics_editor.cc.
References yaze::editor::GraphicsEditorState::current_sheet_id, and state_.
Referenced by HandleEditorShortcuts().
| void yaze::editor::GraphicsEditor::SelectSheet | ( | uint16_t | sheet_id | ) |
Definition at line 793 of file graphics_editor.cc.
References yaze::zelda3::kNumGfxSheets, yaze::editor::GraphicsEditorState::SelectSheet(), and state_.
Referenced by yaze::test::GraphicsEditorTestSuite::RunPixelEditingTest().

| void yaze::editor::GraphicsEditor::HighlightTile | ( | uint16_t | sheet_id, |
| uint16_t | tile_index, | ||
| const std::string & | label = "", | ||
| double | duration_secs = 3.0 ) |
Definition at line 800 of file graphics_editor.cc.
References yaze::editor::GraphicsEditorState::HighlightTile(), yaze::zelda3::kNumGfxSheets, and state_.

|
inline |
Definition at line 105 of file graphics_editor.h.
References rom_.
Referenced by DecompressImportData(), DrawPaletteControls(), Load(), and set_rom().
|
private |
Definition at line 334 of file graphics_editor.cc.
References yaze::editor::kEraser, yaze::editor::kEyedropper, yaze::editor::kFill, yaze::editor::kLine, yaze::editor::kPencil, yaze::editor::kRectangle, yaze::editor::kSelect, NextSheet(), PrevSheet(), yaze::editor::GraphicsEditorState::SetTool(), yaze::editor::GraphicsEditorState::show_grid, state_, yaze::editor::GraphicsEditorState::ZoomIn(), and yaze::editor::GraphicsEditorState::ZoomOut().
Referenced by Update().
|
private |
Definition at line 387 of file graphics_editor.cc.
References BEGIN_TABLE, bin_bitmap_, yaze::gui::BitmapCanvasPipeline(), cgx_bitmap_, cgx_loaded_, col_file_, DrawCgxImport(), DrawClipboardImport(), DrawExperimentalFeatures(), DrawFileImport(), DrawMemoryEditor(), DrawPaletteControls(), DrawScrImport(), END_TABLE, gfx_loaded_, gfx_sheets_, import_canvas_, NEXT_COLUMN, num_sheets_to_load_, open_memory_editor_, scr_bitmap_, scr_canvas_, scr_loaded_, SETUP_COLUMN, status_, super_donkey_, and TABLE_HEADERS.
|
private |
Definition at line 449 of file graphics_editor.cc.
References cgx_bitmap_, cgx_data_, cgx_file_name_, cgx_file_path_, cgx_loaded_, col_file_, yaze::gfx::Bitmap::Create(), current_bpp_, decoded_cgx_, decoded_col_, extra_cgx_data_, yaze::gfx::Arena::Get(), is_open_, yaze::gfx::LoadCgx(), yaze::gfx::Arena::QueueTextureCommand(), yaze::gfx::Bitmap::SetPalette(), yaze::util::FileDialogWrapper::ShowOpenFileDialog(), status_, yaze::gui::TextWithSeparators(), and yaze::gfx::Arena::UPDATE.
Referenced by DrawPrototypeViewer().
|
private |
Definition at line 483 of file graphics_editor.cc.
References yaze::gfx::Bitmap::Create(), current_bpp_, decoded_cgx_, decoded_col_, decoded_scr_data_, yaze::gfx::DrawScrWithCgx(), yaze::gfx::Arena::Get(), is_open_, yaze::gfx::LoadScr(), yaze::gfx::Arena::QueueTextureCommand(), scr_bitmap_, scr_data_, scr_file_name_, scr_file_path_, scr_loaded_, scr_mod_value_, yaze::gfx::Bitmap::SetPalette(), yaze::util::FileDialogWrapper::ShowOpenFileDialog(), status_, and yaze::gfx::Arena::UPDATE.
Referenced by DrawPrototypeViewer().
|
private |
Definition at line 603 of file graphics_editor.cc.
References bin_size_, current_offset_, DecompressImportData(), file_path_, HOVER_HINT, yaze::gui::InputHex(), is_open_, yaze::Rom::LoadFromFile(), RETURN_IF_ERROR, yaze::util::FileDialogWrapper::ShowOpenFileDialog(), status_, temp_rom_, and yaze::gui::TextWithSeparators().
Referenced by DrawPrototypeViewer().
|
private |
Definition at line 561 of file graphics_editor.cc.
References HOVER_HINT, is_open_, yaze::Rom::LoadFromFile(), obj_file_path_, obj_loaded_, yaze::util::FileDialogWrapper::ShowOpenFileDialog(), status_, temp_rom_, and yaze::gui::TextWithSeparators().

|
private |
Definition at line 579 of file graphics_editor.cc.
References yaze::Rom::data(), yaze::gfx::lc_lz2::DecompressV2(), HOVER_HINT, is_open_, yaze::gfx::lc_lz2::kNintendoMode1, yaze::Rom::LoadFromFile(), yaze::util::FileDialogWrapper::ShowOpenFileDialog(), yaze::Rom::size(), status_, yaze::gui::TextWithSeparators(), tilemap_file_path_, tilemap_loaded_, and tilemap_rom_.
|
private |
Definition at line 514 of file graphics_editor.cc.
References yaze::gfx::PaletteGroup::clear(), col_file_, col_file_name_, col_file_palette_, col_file_palette_group_, col_file_path_, yaze::gfx::CreatePaletteGroupFromColFile(), current_palette_, current_palette_index_, yaze::gfx::DecodeColFile(), decoded_col_, yaze::gfx::GetColFileData(), HOVER_HINT, yaze::gui::InputHex(), is_open_, yaze::Rom::LoadFromFile(), yaze::Rom::mutable_data(), refresh_graphics_, rom(), yaze::gui::SelectablePalettePipeline(), yaze::util::FileDialogWrapper::ShowOpenFileDialog(), yaze::gfx::SnesPalette::size(), yaze::gfx::PaletteGroup::size(), status_, temp_rom_, and yaze::gui::TextWithSeparators().
Referenced by DrawPrototypeViewer().
|
private |
Definition at line 635 of file graphics_editor.cc.
References clipboard_offset_, clipboard_size_, DecompressImportData(), yaze::gui::InputHex(), yaze::Rom::is_loaded(), is_open_, yaze::Rom::LoadFromData(), num_sheets_to_load_, open_memory_editor_, status_, temp_rom_, and yaze::gui::TextWithSeparators().
Referenced by DrawPrototypeViewer().
|
private |
Definition at line 665 of file graphics_editor.cc.
References DecompressSuperDonkey(), file_path_, RETURN_IF_ERROR, and yaze::gui::TextWithSeparators().
Referenced by DrawPrototypeViewer().

|
private |
Definition at line 681 of file graphics_editor.cc.
References yaze::gui::MemoryEditorWidget::DrawWindow(), is_open_, yaze::Rom::mutable_data(), yaze::Rom::size(), and temp_rom_.
Referenced by DrawPrototypeViewer().

|
private |
Definition at line 691 of file graphics_editor.cc.
References ASSIGN_OR_RETURN, bin_bitmap_, col_file_, col_file_palette_, yaze::gfx::Bitmap::Create(), current_offset_, current_palette_, yaze::Rom::data(), yaze::gfx::lc_lz2::DecompressV2(), yaze::editor::Editor::game_data(), yaze::gfx::Arena::Get(), gfx_loaded_, import_data_, yaze::gfx::kTilesheetDepth, yaze::gfx::kTilesheetWidth, yaze::gfx::PaletteGroupMap::overworld_animated, yaze::zelda3::GameData::palette_groups, yaze::gfx::Arena::QueueTextureCommand(), rom(), yaze::gfx::Bitmap::SetPalette(), yaze::Rom::size(), yaze::gfx::SnesTo8bppSheet(), temp_rom_, yaze::gfx::Arena::UPDATE, and z3_rom_palette_.
Referenced by DrawClipboardImport(), and DrawFileImport().
|
private |
Definition at line 717 of file graphics_editor.cc.
References ASSIGN_OR_RETURN, col_file_, col_file_palette_group_, current_palette_, current_palette_index_, yaze::Rom::data(), yaze::gfx::lc_lz2::DecompressV2(), yaze::editor::Editor::game_data(), yaze::gfx::Arena::Get(), yaze::gfx::PaletteGroupMap::get_group(), gfx_sheets_, yaze::editor::kSuperDonkeySprites, yaze::editor::kSuperDonkeyTiles, yaze::gfx::kTilesheetDepth, yaze::gfx::kTilesheetHeight, yaze::gfx::kTilesheetWidth, num_sheets_to_load_, yaze::zelda3::GameData::palette_groups, yaze::gfx::Arena::QueueTextureCommand(), yaze::Rom::size(), yaze::gfx::SnesTo8bppSheet(), super_donkey_, temp_rom_, yaze::gfx::Arena::UPDATE, and z3_rom_palette_.
Referenced by DrawExperimentalFeatures().
|
private |
Definition at line 112 of file graphics_editor.h.
Referenced by HandleEditorShortcuts(), HighlightTile(), Initialize(), NextSheet(), PrevSheet(), Save(), and SelectSheet().
|
private |
Definition at line 113 of file graphics_editor.h.
Referenced by Initialize().
|
private |
Definition at line 114 of file graphics_editor.h.
Referenced by Initialize().
|
private |
Definition at line 115 of file graphics_editor.h.
Referenced by Initialize(), and SetGameData().
|
private |
Definition at line 116 of file graphics_editor.h.
Referenced by Initialize().
|
private |
Definition at line 117 of file graphics_editor.h.
Referenced by Initialize(), and SetGameData().
|
private |
Definition at line 118 of file graphics_editor.h.
Referenced by Initialize(), and SetGameData().
|
private |
Definition at line 135 of file graphics_editor.h.
Referenced by DecompressImportData(), DecompressSuperDonkey(), and DrawPaletteControls().
|
private |
Definition at line 136 of file graphics_editor.h.
Referenced by DecompressImportData(), and DrawFileImport().
|
private |
Definition at line 137 of file graphics_editor.h.
Referenced by DecompressSuperDonkey(), and DrawPaletteControls().
|
private |
Definition at line 138 of file graphics_editor.h.
Referenced by DrawCgxImport(), and DrawScrImport().
|
private |
Definition at line 139 of file graphics_editor.h.
Referenced by DrawScrImport().
|
private |
Definition at line 140 of file graphics_editor.h.
Referenced by DecompressSuperDonkey(), DrawClipboardImport(), and DrawPrototypeViewer().
|
private |
Definition at line 141 of file graphics_editor.h.
Referenced by DrawFileImport().
|
private |
Definition at line 142 of file graphics_editor.h.
Referenced by DrawClipboardImport().
|
private |
Definition at line 143 of file graphics_editor.h.
Referenced by DrawClipboardImport().
|
private |
Definition at line 144 of file graphics_editor.h.
Referenced by DrawPaletteControls().
|
private |
Definition at line 145 of file graphics_editor.h.
Referenced by DrawClipboardImport(), and DrawPrototypeViewer().
|
private |
Definition at line 146 of file graphics_editor.h.
Referenced by DecompressImportData(), and DrawPrototypeViewer().
|
private |
Definition at line 147 of file graphics_editor.h.
Referenced by DrawCgxImport(), DrawClipboardImport(), DrawFileImport(), DrawMemoryEditor(), DrawObjImport(), DrawPaletteControls(), DrawScrImport(), and DrawTilemapImport().
|
private |
Definition at line 148 of file graphics_editor.h.
Referenced by DecompressSuperDonkey(), and DrawPrototypeViewer().
|
private |
Definition at line 149 of file graphics_editor.h.
Referenced by DecompressImportData(), DecompressSuperDonkey(), DrawCgxImport(), DrawPaletteControls(), and DrawPrototypeViewer().
|
private |
Definition at line 150 of file graphics_editor.h.
Referenced by DrawCgxImport(), and DrawPrototypeViewer().
|
private |
Definition at line 151 of file graphics_editor.h.
Referenced by DrawPrototypeViewer(), and DrawScrImport().
|
private |
Definition at line 152 of file graphics_editor.h.
Referenced by DrawObjImport().
|
private |
Definition at line 153 of file graphics_editor.h.
Referenced by DrawTilemapImport().
|
private |
Definition at line 155 of file graphics_editor.h.
Referenced by DrawExperimentalFeatures(), and DrawFileImport().
|
private |
Definition at line 156 of file graphics_editor.h.
Referenced by DrawPaletteControls().
|
private |
Definition at line 157 of file graphics_editor.h.
Referenced by DrawPaletteControls().
|
private |
Definition at line 158 of file graphics_editor.h.
Referenced by DrawCgxImport().
|
private |
Definition at line 159 of file graphics_editor.h.
Referenced by DrawCgxImport().
|
private |
Definition at line 160 of file graphics_editor.h.
Referenced by DrawScrImport().
|
private |
Definition at line 161 of file graphics_editor.h.
Referenced by DrawScrImport().
|
private |
Definition at line 162 of file graphics_editor.h.
Referenced by DrawObjImport().
|
private |
Definition at line 163 of file graphics_editor.h.
Referenced by DrawTilemapImport().
|
private |
Definition at line 164 of file graphics_editor.h.
|
private |
Definition at line 166 of file graphics_editor.h.
Referenced by DecompressImportData(), DecompressSuperDonkey(), DrawClipboardImport(), DrawFileImport(), DrawMemoryEditor(), DrawObjImport(), and DrawPaletteControls().
|
private |
Definition at line 167 of file graphics_editor.h.
Referenced by DrawTilemapImport().
|
private |
Definition at line 168 of file graphics_editor.h.
Referenced by DecompressImportData().
|
private |
Definition at line 169 of file graphics_editor.h.
Referenced by DrawCgxImport(), and DrawScrImport().
|
private |
Definition at line 170 of file graphics_editor.h.
Referenced by DrawCgxImport().
|
private |
Definition at line 171 of file graphics_editor.h.
Referenced by DrawCgxImport().
|
private |
Definition at line 172 of file graphics_editor.h.
Referenced by DrawCgxImport(), DrawPaletteControls(), and DrawScrImport().
|
private |
Definition at line 173 of file graphics_editor.h.
Referenced by DrawScrImport().
|
private |
Definition at line 174 of file graphics_editor.h.
Referenced by DrawScrImport().
|
private |
Definition at line 175 of file graphics_editor.h.
Referenced by DrawCgxImport(), and DrawPrototypeViewer().
|
private |
Definition at line 176 of file graphics_editor.h.
Referenced by DrawPrototypeViewer(), and DrawScrImport().
|
private |
Definition at line 177 of file graphics_editor.h.
Referenced by DecompressImportData(), and DrawPrototypeViewer().
|
private |
Definition at line 178 of file graphics_editor.h.
Referenced by DecompressSuperDonkey(), and DrawPrototypeViewer().
|
private |
Definition at line 179 of file graphics_editor.h.
Referenced by DecompressSuperDonkey(), and DrawPaletteControls().
|
private |
Definition at line 180 of file graphics_editor.h.
Referenced by DecompressImportData(), and DecompressSuperDonkey().
|
private |
Definition at line 181 of file graphics_editor.h.
Referenced by DecompressImportData(), and DrawPaletteControls().
|
private |
Definition at line 182 of file graphics_editor.h.
Referenced by DrawPrototypeViewer().
|
private |
Definition at line 183 of file graphics_editor.h.
Referenced by DrawPrototypeViewer().
|
private |
Definition at line 184 of file graphics_editor.h.
|
private |
Definition at line 187 of file graphics_editor.h.
Referenced by DrawCgxImport(), DrawClipboardImport(), DrawFileImport(), DrawObjImport(), DrawPaletteControls(), DrawPrototypeViewer(), DrawScrImport(), DrawTilemapImport(), Initialize(), and Update().
|
private |
Definition at line 190 of file graphics_editor.h.
Referenced by Initialize(), rom(), Save(), and set_rom().
|
private |
Definition at line 191 of file graphics_editor.h.
Referenced by Initialize(), and SetGameData().