Skip to content

Commit

Permalink
get_source_path -> get_loadable_path
Browse files Browse the repository at this point in the history
  • Loading branch information
geneotech committed Dec 14, 2023
1 parent c3c2228 commit 77b19c9
Show file tree
Hide file tree
Showing 17 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void create_unpathed_asset_id_command<I>::undo(const debugger_command_input in)

template <class I>
std::string create_pathed_asset_id_command<I>::describe() const {
return typesafe_sprintf("Started tracking asset file: %x", construct_from.get_source_path().filename_first());
return typesafe_sprintf("Started tracking asset file: %x", construct_from.get_loadable_path().filename_first());
}

template <class I>
Expand Down
2 changes: 1 addition & 1 deletion src/application/setups/debugger/detail/get_id_or_import.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ I get_id_or_import(
def_type def;
def.set_source_path(source_path);

const auto resolved = def.get_source_path().resolve(project_path);
const auto resolved = def.get_loadable_path().resolve(project_path);

::load_meta_lua_if_exists(in.lua, def.meta, resolved);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ inline void update_official_content(const debugger_command_input cmd_in, update_

auto find_and_remap_by_path = [&](const auto& reference_pool, const auto& target_pool, auto& field) {
if (const auto found = mapped_or_nullptr(reference_pool, field)) {
const auto source_path = found->get_source_path();
const auto source_path = found->get_loadable_path();

if (const auto found_in_new = ::find_asset_id_by_path(source_path, target_pool)) {
field = *found_in_new;
Expand Down Expand Up @@ -147,7 +147,7 @@ inline void update_official_content(const debugger_command_input cmd_in, update_

auto add_pathed_assets = [&](auto& custom, const auto& official, const std::string& type_name) {
for (const auto& o : official) {
const auto source_path = o.get_source_path();
const auto source_path = o.get_loadable_path();
const auto existing_custom_asset = find_asset_id_by_path(source_path, custom);

if (existing_custom_asset.has_value()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void debugger_pathed_asset_gui<asset_id_type>::perform(

for_each_id_and_object(definitions,
[&](const asset_id_type id, const def_type& object) mutable {
const auto path = object.get_source_path();
const auto path = object.get_loadable_path();
auto new_entry = asset_entry_type(path, id);

#if BUILD_LOCATION_FINDERS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ bool frames_prologue_widget::handle_prologue(const std::string&, plain_animation
const auto& frames = source_animation.frames;

const auto& first_image_def = image_defs[frames[0].image_id];
const auto& first_source_path = first_image_def.get_source_path();
const auto& first_source_path = first_image_def.get_loadable_path();
const auto first_path_no_ext = augs::path_type(first_source_path.path).replace_extension("");

frames_type new_frames;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct image_color_picker_widget {
}

void update_preview() const {
const auto& p = defs[id].get_source_path();
const auto& p = defs[id].get_loadable_path();

if (current_preview.path != p) {
current_preview.image.from_file(p.resolve(project_path));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct pathed_asset_widget {
) const {
static_assert(handles<T>);

return typesafe_sprintf("Set %x to %x", formatted_label, augs::filename_first(get_viewable_pool<T>(defs)[to].get_source_path().path));
return typesafe_sprintf("Set %x to %x", formatted_label, augs::filename_first(get_viewable_pool<T>(defs)[to].get_loadable_path().path));
}

template <class T>
Expand All @@ -52,9 +52,9 @@ struct pathed_asset_widget {
/* Definitions might get altered so we need to keep a copy */
const auto found_def = mapped_or_nullptr(definitions, object);

using P = remove_cref<decltype(found_def->get_source_path())>;
using P = remove_cref<decltype(found_def->get_loadable_path())>;

const auto current_source = found_def ? P(found_def->get_source_path()) : P();
const auto current_source = found_def ? P(found_def->get_loadable_path()) : P();

chooser.perform(identity_label, current_source, project_path, on_choice, true_returner());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ void editor_filesystem_gui::rebuild_special_filesystem(editor_filesystem_node& r
auto result = new_node.custom_thumbnail_path;

if (auto sprite = flavour.template find<invariants::sprite>()) {
result = built_officials.viewables.image_definitions[sprite->image_id].get_source_path().resolve({});
result = built_officials.viewables.image_definitions[sprite->image_id].get_loadable_path().resolve({});
}

if (auto animation = flavour.template find<invariants::animation>()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ void create_official_filesystem_from(
new_node.name = typed_resource.cached_official_name;

if (auto sprite = flavour.template find<invariants::sprite>()) {
new_node.custom_thumbnail_path = initial_intercosm.viewables.image_definitions[sprite->image_id].get_source_path().resolve({});
new_node.custom_thumbnail_path = initial_intercosm.viewables.image_definitions[sprite->image_id].get_loadable_path().resolve({});
}

if (auto animation = flavour.template find<invariants::animation>()) {
Expand Down
2 changes: 1 addition & 1 deletion src/test_scenes/test_scene_images.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void load_test_scene_images(
image_definition definition;
definition.set_source_path({ at_stem.string(), true });

const auto resolved_no_ext = definition.get_source_path().resolve({});
const auto resolved_no_ext = definition.get_loadable_path().resolve({});
const auto with_existent_ext = augs::first_existing_extension(resolved_no_ext, augs::IMAGE_EXTENSIONS);

if (with_existent_ext.empty()) {
Expand Down
2 changes: 1 addition & 1 deletion src/test_scenes/test_scene_sounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void load_test_scene_sounds(sound_definitions_map& all_definitions) {
try_with(stem);
try_with(path(stem) += "_1");

if (!definition.get_source_path().path.empty()) {
if (!definition.get_loadable_path().path.empty()) {
const auto new_allocation = all_definitions.allocate(std::move(definition));
(void)new_allocation;
(void)id;
Expand Down
4 changes: 2 additions & 2 deletions src/view/get_asset_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ auto& access_asset_pool(E&& cmd_in, cosmos_common_significant_access access) {
template <class T>
decltype(auto) get_displayed_name(const T& object) {
if constexpr(std::is_same_v<T, sound_definition>) {
return cut_trailing_number_and_spaces(object.get_source_path().get_prettified_filename());
return cut_trailing_number_and_spaces(object.get_loadable_path().get_prettified_filename());
}
else {
return object.get_source_path().get_prettified_filename();
return object.get_loadable_path().get_prettified_filename();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/view/viewables/all_viewables_defs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ std::optional<I> find_asset_id_by_path(

for_each_id_and_object(definitions,
[&result_id, &searched_path](const auto id, const auto& l) {
if (searched_path == l.get_source_path()) {
if (searched_path == l.get_loadable_path()) {
result_id = id;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/view/viewables/asset_definition_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class asset_definition_view {
T& d
) :
def(d),
resolved_source_path(d.get_source_path().resolve(project_dir)),
resolved_source_path(d.get_loadable_path().resolve(project_dir)),
project_dir(project_dir)
{
}
Expand Down
2 changes: 1 addition & 1 deletion src/view/viewables/image_definition.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct image_definition {
return source_image;
}

auto get_source_path() const {
auto get_loadable_path() const {
const bool is_generated_in_cache = get_source_gif_path() != std::nullopt;

if (is_generated_in_cache) {
Expand Down
2 changes: 1 addition & 1 deletion src/view/viewables/sound_definition.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct sound_definition {
source_sound = p;
}

const auto& get_source_path() const {
const auto& get_loadable_path() const {
return source_sound;
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/view/viewables/standard_atlas_distribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void regenerate_and_gather_subjects(
output.clear();

for (auto&& r : in.necessary_image_definitions) {
output.images.emplace_back(r.second.get_source_path().path);
output.images.emplace_back(r.second.get_loadable_path().path);
}

int total_to_regenerate = 0;
Expand Down Expand Up @@ -245,7 +245,7 @@ general_atlas_output create_general_atlas(

{
for (auto&& r : subjects.necessary_image_definitions) {
out.necessary_atlas_entries[r.first] = baked.images.at(r.second.get_source_path().path);
out.necessary_atlas_entries[r.first] = baked.images.at(r.second.get_loadable_path().path);
}

auto make_view = [&subjects](const auto& def) {
Expand Down

0 comments on commit 77b19c9

Please sign in to comment.