yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::editor::ProjectGraphicsSource Class Reference

#include <project_graphics_source.h>

Collaboration diagram for yaze::editor::ProjectGraphicsSource:

Classes

struct  History
 
struct  PixelAction
 
struct  PreviewFiles
 
struct  Resource
 
struct  Slice
 

Public Member Functions

 ProjectGraphicsSource ()
 
 ~ProjectGraphicsSource ()
 
 ProjectGraphicsSource (ProjectGraphicsSource &&) noexcept
 
ProjectGraphicsSource & operator= (ProjectGraphicsSource &&) noexcept
 
 ProjectGraphicsSource (const ProjectGraphicsSource &)=delete
 
ProjectGraphicsSource & operator= (const ProjectGraphicsSource &)=delete
 
absl::Status Load (const std::string &source_root, const std::string &portable_catalog, int parent_map)
 
const std::vector< Resource > & resources () const
 
const Resource * selected_resource () const
 
std::string selected_resource_id () const
 
absl::Status SelectResource (const std::string &resource_id)
 
const std::string & source_root () const
 
const std::string & portable_catalog () const
 
const std::string & profile_id () const
 
int parent_map () const
 
bool loaded () const
 
bool backend_available () const
 
absl::StatusOr< uint8_t > GetPixel (size_t tile, int x, int y) const
 
absl::Status SetPixel (size_t tile, int x, int y, uint8_t index)
 
absl::Status Undo ()
 
absl::Status Redo ()
 
bool can_undo () const
 
bool can_redo () const
 
bool dirty () const
 
bool any_dirty () const
 
absl::Status ReplaceResourceBytes (const std::vector< uint8_t > &bytes)
 
absl::Status ReplaceResourceBytes (const std::string &source_path, const std::vector< uint8_t > &bytes)
 
absl::StatusOr< zelda3::OverworldGraphicsPreview > PendingGraphicsPreview () const
 
absl::StatusOr< nlohmann::json > Preview ()
 
absl::StatusOr< nlohmann::json > Publish ()
 
bool has_preview () const
 
const nlohmann::json & preview_json () const
 

Private Member Functions

absl::Status CheckUnchanged () const
 
absl::Status ReplaceResourceBytesAt (size_t resource, const std::vector< uint8_t > &bytes)
 
absl::Status CheckPixel (size_t tile, int x, int y) const
 
void WritePixel (size_t tile, int x, int y, uint8_t index)
 
void InvalidatePreview ()
 

Private Attributes

std::string source_root_
 
std::string portable_catalog_
 
std::string profile_id_
 
int parent_map_ = -1
 
size_t selected_ = 0
 
std::vector< Resource > resources_
 
std::vector< History > histories_
 
std::map< std::string, std::string > loaded_hashes_
 
std::unique_ptr< PreviewFiles > preview_
 
nlohmann::json preview_json_
 

Detailed Description

Definition at line 20 of file project_graphics_source.h.

Constructor & Destructor Documentation

◆ ProjectGraphicsSource() [1/3]

yaze::editor::ProjectGraphicsSource::ProjectGraphicsSource ( )
default

◆ ~ProjectGraphicsSource()

yaze::editor::ProjectGraphicsSource::~ProjectGraphicsSource ( )
default

◆ ProjectGraphicsSource() [2/3]

yaze::editor::ProjectGraphicsSource::ProjectGraphicsSource ( ProjectGraphicsSource && )
defaultnoexcept

◆ ProjectGraphicsSource() [3/3]

yaze::editor::ProjectGraphicsSource::ProjectGraphicsSource ( const ProjectGraphicsSource & )
delete

Member Function Documentation

◆ operator=() [1/2]

ProjectGraphicsSource & yaze::editor::ProjectGraphicsSource::operator= ( ProjectGraphicsSource && )
defaultnoexcept

◆ operator=() [2/2]

ProjectGraphicsSource & yaze::editor::ProjectGraphicsSource::operator= ( const ProjectGraphicsSource & )
delete

◆ Load()

◆ resources()

const std::vector< Resource > & yaze::editor::ProjectGraphicsSource::resources ( ) const
inline

Definition at line 62 of file project_graphics_source.h.

References resources_.

◆ selected_resource()

const ProjectGraphicsSource::Resource * yaze::editor::ProjectGraphicsSource::selected_resource ( ) const

Definition at line 358 of file project_graphics_source.cc.

References resources_, and selected_.

Referenced by CheckPixel(), dirty(), Publish(), and selected_resource_id().

◆ selected_resource_id()

std::string yaze::editor::ProjectGraphicsSource::selected_resource_id ( ) const
inline

Definition at line 64 of file project_graphics_source.h.

References selected_resource().

Here is the call graph for this function:

◆ SelectResource()

absl::Status yaze::editor::ProjectGraphicsSource::SelectResource ( const std::string & resource_id)

Definition at line 374 of file project_graphics_source.cc.

References InvalidatePreview(), resources_, and selected_.

Referenced by Publish().

Here is the call graph for this function:

◆ source_root()

const std::string & yaze::editor::ProjectGraphicsSource::source_root ( ) const
inline

Definition at line 69 of file project_graphics_source.h.

References source_root_.

◆ portable_catalog()

const std::string & yaze::editor::ProjectGraphicsSource::portable_catalog ( ) const
inline

Definition at line 70 of file project_graphics_source.h.

References portable_catalog_.

◆ profile_id()

const std::string & yaze::editor::ProjectGraphicsSource::profile_id ( ) const
inline

Definition at line 71 of file project_graphics_source.h.

References profile_id_.

◆ parent_map()

int yaze::editor::ProjectGraphicsSource::parent_map ( ) const
inline

Definition at line 72 of file project_graphics_source.h.

References parent_map_.

◆ loaded()

bool yaze::editor::ProjectGraphicsSource::loaded ( ) const
inline

Definition at line 73 of file project_graphics_source.h.

References resources_.

Referenced by PendingGraphicsPreview(), and ReplaceResourceBytes().

◆ backend_available()

bool yaze::editor::ProjectGraphicsSource::backend_available ( ) const

Definition at line 362 of file project_graphics_source.cc.

References source_root_.

Referenced by Preview().

◆ GetPixel()

absl::StatusOr< uint8_t > yaze::editor::ProjectGraphicsSource::GetPixel ( size_t tile,
int x,
int y ) const

Definition at line 399 of file project_graphics_source.cc.

References CheckPixel(), resources_, and selected_.

Referenced by SetPixel().

Here is the call graph for this function:

◆ SetPixel()

absl::Status yaze::editor::ProjectGraphicsSource::SetPixel ( size_t tile,
int x,
int y,
uint8_t index )

Definition at line 420 of file project_graphics_source.cc.

References GetPixel(), histories_, selected_, and WritePixel().

Here is the call graph for this function:

◆ Undo()

absl::Status yaze::editor::ProjectGraphicsSource::Undo ( )

Definition at line 436 of file project_graphics_source.cc.

References can_undo(), histories_, selected_, and WritePixel().

Here is the call graph for this function:

◆ Redo()

absl::Status yaze::editor::ProjectGraphicsSource::Redo ( )

Definition at line 447 of file project_graphics_source.cc.

References can_redo(), histories_, selected_, and WritePixel().

Here is the call graph for this function:

◆ can_undo()

bool yaze::editor::ProjectGraphicsSource::can_undo ( ) const

Definition at line 458 of file project_graphics_source.cc.

References histories_, and selected_.

Referenced by Undo().

◆ can_redo()

bool yaze::editor::ProjectGraphicsSource::can_redo ( ) const

Definition at line 461 of file project_graphics_source.cc.

References histories_, and selected_.

Referenced by Redo().

◆ dirty()

bool yaze::editor::ProjectGraphicsSource::dirty ( ) const

Definition at line 464 of file project_graphics_source.cc.

References selected_resource().

Referenced by Preview(), and Publish().

Here is the call graph for this function:

◆ any_dirty()

bool yaze::editor::ProjectGraphicsSource::any_dirty ( ) const

Definition at line 468 of file project_graphics_source.cc.

References resources_.

◆ ReplaceResourceBytes() [1/2]

absl::Status yaze::editor::ProjectGraphicsSource::ReplaceResourceBytes ( const std::vector< uint8_t > & bytes)

Definition at line 473 of file project_graphics_source.cc.

References ReplaceResourceBytesAt(), and selected_.

Here is the call graph for this function:

◆ ReplaceResourceBytes() [2/2]

absl::Status yaze::editor::ProjectGraphicsSource::ReplaceResourceBytes ( const std::string & source_path,
const std::vector< uint8_t > & bytes )

Definition at line 478 of file project_graphics_source.cc.

References loaded(), ReplaceResourceBytesAt(), and resources_.

Here is the call graph for this function:

◆ PendingGraphicsPreview()

absl::StatusOr< zelda3::OverworldGraphicsPreview > yaze::editor::ProjectGraphicsSource::PendingGraphicsPreview ( ) const

Definition at line 526 of file project_graphics_source.cc.

References CheckUnchanged(), yaze::zelda3::DecodeGraphicsPreviewTransfer(), loaded(), and resources_.

Here is the call graph for this function:

◆ Preview()

absl::StatusOr< Json > yaze::editor::ProjectGraphicsSource::Preview ( )

◆ Publish()

◆ has_preview()

bool yaze::editor::ProjectGraphicsSource::has_preview ( ) const
inline

Definition at line 106 of file project_graphics_source.h.

References preview_.

◆ preview_json()

const nlohmann::json & yaze::editor::ProjectGraphicsSource::preview_json ( ) const
inline

Definition at line 107 of file project_graphics_source.h.

References preview_json_.

◆ CheckUnchanged()

absl::Status yaze::editor::ProjectGraphicsSource::CheckUnchanged ( ) const
private

Definition at line 565 of file project_graphics_source.cc.

References yaze::core::ComputeSourceArtifactSha256(), and loaded_hashes_.

Referenced by PendingGraphicsPreview(), Preview(), Publish(), and ReplaceResourceBytesAt().

Here is the call graph for this function:

◆ ReplaceResourceBytesAt()

absl::Status yaze::editor::ProjectGraphicsSource::ReplaceResourceBytesAt ( size_t resource,
const std::vector< uint8_t > & bytes )
private

Definition at line 491 of file project_graphics_source.cc.

References CheckUnchanged(), yaze::zelda3::DecodeGraphicsPreviewTransfer(), histories_, InvalidatePreview(), and resources_.

Referenced by ReplaceResourceBytes(), and ReplaceResourceBytes().

Here is the call graph for this function:

◆ CheckPixel()

absl::Status yaze::editor::ProjectGraphicsSource::CheckPixel ( size_t tile,
int x,
int y ) const
private

Definition at line 387 of file project_graphics_source.cc.

References selected_resource().

Referenced by GetPixel().

Here is the call graph for this function:

◆ WritePixel()

void yaze::editor::ProjectGraphicsSource::WritePixel ( size_t tile,
int x,
int y,
uint8_t index )
private

Definition at line 407 of file project_graphics_source.cc.

References InvalidatePreview(), resources_, and selected_.

Referenced by Redo(), SetPixel(), and Undo().

Here is the call graph for this function:

◆ InvalidatePreview()

void yaze::editor::ProjectGraphicsSource::InvalidatePreview ( )
private

Definition at line 560 of file project_graphics_source.cc.

References preview_, and preview_json_.

Referenced by Preview(), ReplaceResourceBytesAt(), SelectResource(), and WritePixel().

Member Data Documentation

◆ source_root_

std::string yaze::editor::ProjectGraphicsSource::source_root_
private

Definition at line 129 of file project_graphics_source.h.

Referenced by backend_available(), Preview(), Publish(), and source_root().

◆ portable_catalog_

std::string yaze::editor::ProjectGraphicsSource::portable_catalog_
private

Definition at line 130 of file project_graphics_source.h.

Referenced by portable_catalog(), Preview(), and Publish().

◆ profile_id_

std::string yaze::editor::ProjectGraphicsSource::profile_id_
private

Definition at line 131 of file project_graphics_source.h.

Referenced by profile_id().

◆ parent_map_

int yaze::editor::ProjectGraphicsSource::parent_map_ = -1
private

Definition at line 132 of file project_graphics_source.h.

Referenced by parent_map(), and Publish().

◆ selected_

size_t yaze::editor::ProjectGraphicsSource::selected_ = 0
private

◆ resources_

std::vector<Resource> yaze::editor::ProjectGraphicsSource::resources_
private

◆ histories_

std::vector<History> yaze::editor::ProjectGraphicsSource::histories_
private

◆ loaded_hashes_

std::map<std::string, std::string> yaze::editor::ProjectGraphicsSource::loaded_hashes_
private

Definition at line 136 of file project_graphics_source.h.

Referenced by CheckUnchanged().

◆ preview_

std::unique_ptr<PreviewFiles> yaze::editor::ProjectGraphicsSource::preview_
private

Definition at line 137 of file project_graphics_source.h.

Referenced by has_preview(), InvalidatePreview(), Preview(), and Publish().

◆ preview_json_

nlohmann::json yaze::editor::ProjectGraphicsSource::preview_json_
private

Definition at line 138 of file project_graphics_source.h.

Referenced by InvalidatePreview(), Preview(), preview_json(), and Publish().


The documentation for this class was generated from the following files: