Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I added some parameters to the packed_scene from path constructor #18

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/util/scene.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,17 +119,21 @@ namespace rl::inline utils
using scene_t = TScene;
using object_t = TObj;

/* Pack as preload from path. */
packed_scene(godot::String resource_load_path)
/** Load and pack from path. */
packed_scene(const godot::String& load_resource_path,
const godot::String& load_type_hint = godot::String(),
godot::ResourceLoader::CacheMode load_cache_mode =
godot::ResourceLoader::CacheMode::CACHE_MODE_REUSE)
{
godot::ResourceLoader* resource_loader{ resource::loader::get() };
godot::ResourceLoader* resource_loader{ loader::get() };

bool file_access_success{ resource_loader->exists(resource_load_path) };
runtime_assert(file_access_success);
bool resource_exists{ resource_loader->exists(load_resource_path) };
runtime_assert(resource_exists);

if (file_access_success)
if (resource_exists)
{
m_packed_resource = resource_loader->load(resource_load_path);
m_packed_resource = resource_loader->load(load_resource_path,
load_type_hint, load_cache_mode);
initialized = m_packed_resource.is_valid();
}
}
Expand Down
Loading