19 assert_or_panic(metadata_provider_->
exists(tileset_name),
"precondition violated: tileset must exist");
35 primary_pairing_partners,
38 layout_metadata_provider_,
42 "Failed to resolve partner primary for secondary '{}'.",
48 tileset_repo_->
load(tileset_name),
56 primary_et, domain_config_, extrinsic_transparency, paired_primary->name(),
void);
57 if (secondary_et.value() != primary_et.value()) {
58 std::vector<std::string> warn_msg{};
60 "Secondary tileset '{}' and its paired primary '{}' have different configured "
61 "'extrinsic_transparency' values ('{}' vs '{}').",
64 FormatParam{secondary_et.value().to_jasc_str(), Style::bold},
65 FormatParam{primary_et.value().to_jasc_str(), Style::bold}));
66 warn_msg.emplace_back(
67 "Cross-tileset keyframe matching will use each side's configured value independently.");
68 warn_msg.emplace_back(
"");
69 warn_msg.emplace_back(
70 "This warning is based on the current domain config, not on the ET each tileset was actually "
72 warn_msg.emplace_back(
73 "If a tileset was compiled with a different ET and has not been recompiled since, cross-tileset "
74 "matching may produce unexpected results.");
75 warn_msg.emplace_back(
"Recompile both tilesets if in doubt.");
76 warn_msg.emplace_back(
"");
78 warn_msg.emplace_back(
"");
80 warn_msg.emplace_back(
"");
82 warn_msg.emplace_back(
"");
85 diag_->
warning(
"cross-tileset-extrinsic-transparency-mismatch", warn_msg);
92 std::vector<std::string> err_msg{};
94 "No cached checksums found for tileset '{}'.",
FormatParam{tileset_name, Style::bold}));
96 "Expected to find file '{}'.",
97 FormatParam{
"porytiles/tilesets/" + tileset_name +
"/tileset.cache.json", Style::bold}));
98 err_msg.emplace_back(
"Checksum verification requested via configuration.");
106 if (!
tileset->porymap_component().is_empty()) {
111 "Failed to get Porymap artifact keys.");
112 const auto mismatched_keys =
114 if (!mismatched_keys.empty()) {
115 std::vector<std::string> err_msg{};
116 err_msg.emplace_back(
"Changes present in Porymap assets:");
117 for (
const auto &key : mismatched_keys) {
120 err_msg.emplace_back(
"");
121 err_msg.emplace_back(
"Compiling now would clobber your Porymap asset changes.");
122 err_msg.emplace_back(
"To resolve:");
124 " - Run '{} {}' to synchronize assets.",
130 " - {} delete '{}' cache file.",
145 primary_porytiles_keys,
148 "Failed to get Porytiles artifact keys for paired primary '{}'.",
151 paired_primary->name(), primary_porytiles_keys);
152 if (!primary_mismatched_keys.empty()) {
153 std::vector<std::string> err_msg{};
155 "Paired primary tileset '{}' has source changes that have not been compiled.",
156 FormatParam{paired_primary->name(), Style::bold}));
157 err_msg.emplace_back(
"Changes present in paired primary Porytiles sources:");
158 for (
const auto &key : primary_mismatched_keys) {
161 err_msg.emplace_back(
"");
162 err_msg.emplace_back(
"Compiling the secondary now would match tiles against a stale compiled primary.");
163 err_msg.emplace_back(
"To resolve:");
165 " - Run '{} {}' to bring the primary's compiled form up to date.",
178 "Failed to get Porytiles artifact keys.");
182 "Skipping compilation for '{}', no changes found.",
193 "Compilation job failed for '{}'.",
198 tileset_repo_->
save(*new_tileset),
200 "Tileset save job failed for '{}'.",
204 if (!new_tileset->porymap_component().anims().empty()) {
208 "Failed to wire animation code for '{}'.",
215 "Failed to remove wired animation code for '{}'.",
#define PT_TRY_ASSIGN_CHAIN_ERR(var, expr, return_type,...)
Unwraps a ChainableResult, chaining a new error message on failure.
#define PT_TRY_CALL_CHAIN_ERR(expr, return_type,...)
Unwraps a void ChainableResult, chaining a new error message on failure.
bool all_checksums_tileset_match(const std::string &name, const std::vector< ArtifactKey > &artifact_keys) const
Checks if all artifact checksums for the given Tileset match their cached values.
std::vector< ArtifactKey > find_unsynced_tileset_artifacts(const std::string &name, const std::vector< ArtifactKey > &keys_to_check) const
Finds all artifacts for the given Tileset with unsynced changes compared to cached checksums.
bool cached_checksums_exist(const std::string &name) const
Check if any cached checksums exist for the given tileset.
A result type that maintains a chainable sequence of errors for debugging and error reporting.
ChainableResult< void > compile(const std::string &tileset_name) const
Compiles the secondary Tileset with the given tileset name.
virtual ChainableResult< void > wire_anim_code(const std::string &tileset_name, bool is_secondary) const =0
Wires animation code for a tileset that already has its manifest persisted.
virtual bool is_porytiles_managed(const std::string &tileset_name) const =0
Checks whether a tileset is managed by Porytiles.
virtual ChainableResult< void > remove_wired_anim_code(const std::string &tileset_name, bool is_secondary) const =0
Removes wired animation code for a tileset from the project.
static const Style bold
Bold text formatting.
virtual std::string format(const std::string &format_str, const std::vector< FormatParam > ¶ms) const
Formats a string with styled parameters using fmtlib syntax.
virtual ChainableResult< std::vector< ArtifactKey > > get_porytiles_artifact_keys(const std::string &tileset_name) const
Gets the keys for all Porytiles artifacts present in the given Tileset.
virtual ChainableResult< std::vector< ArtifactKey > > get_porymap_artifact_keys(const std::string &tileset_name) const
Gets the keys for all Porymap artifacts present in the given Tileset.
ChainableResult< std::unique_ptr< Tileset > > compile(const Tileset &tileset, bool is_secondary=false, const Tileset *paired_primary=nullptr) const
Compiles the given Tileset, producing a new Tileset with compiled Porymap assets.
ChainableResult< void > save(const Tileset &tileset) const
Persists a given Tileset and caches new artifact checksums.
ChainableResult< std::unique_ptr< Tileset > > load(const std::string &name) const
Loads an existing Tileset from storage.
const TilesetArtifactKeyProvider & key_provider() const
Gets a reference to the TilesetArtifactKeyProvider for this repo.
const ArtifactChecksumProvider & checksum_provider() const
Gets a reference to the ArtifactChecksumProvider for this repo.
const TextFormatter & formatter() const
virtual void warning(const std::string &tag, const std::vector< std::string > &lines) const =0
Display a tagged warning message.
ChainableResult< std::unique_ptr< Tileset > > resolve_partner_primary(const std::string &tileset_name, const ConfigValue< PrimaryPairingMode > &pairing_mode, const ConfigValue< std::vector< std::string > > &partners, const TilesetRepo *tileset_repo, const TilesetMetadataProvider *metadata_provider, const LayoutMetadataProvider *layout_metadata_provider, const PorytilesTilesetManager *tileset_manager, const UserDiagnostics *diag)
Resolves the partner primary tileset for a secondary tileset.
void assert_or_panic(bool condition, const StringViewSourceLoc &s)
Conditionally panics if the given condition is false.
std::vector< std::string > format_config_note(const TextFormatter &format, const ConfigValue< T > &config)
Format a ConfigValue into diagnostic note lines.
std::vector< std::string > format_config_note_with_separator(const TextFormatter &format, const ConfigValue< T > &config)
Format a ConfigValue into diagnostic note lines with a separator.
@ tileset
Configuration scoped to a specific tileset.
constexpr std::string_view diagnostic_separator
#define PT_UNWRAP_TILESET_CONFIG_PTR(ptr, config, tileset_name, return_type)
Unwraps a tileset-scoped config value via pointer access, returning early if the value is not availab...
#define PT_UNWRAP_TILESET_CONFIG_PTR_AS(var, ptr, config, tileset_name, return_type)
Unwraps a tileset-scoped config value via pointer access into an explicitly named local variable,...