Skip to content

Commit

Permalink
Fix compile error in template_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
JiepengTan committed Feb 17, 2025
1 parent 44d9310 commit eee5e97
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions core/extension/spx_res_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,41 +32,49 @@
#include "core/io/file_access.h"
#include "core/io/image.h"
#include "core/io/image_loader.h"
#include "editor/import/resource_importer_wav.h"
#include "modules/minimp3/audio_stream_mp3.h"
#include "modules/minimp3/resource_importer_mp3.h"
#include "scene/2d/audio_stream_player_2d.h"
#include "scene/main/window.h"
#include "scene/resources/atlas_texture.h"
#include "scene/resources/audio_stream_wav.h"
#include "scene/resources/image_texture.h"
#include "scene/resources/sprite_frames.h"
#include "spx.h"
#ifdef TOOLS_ENABLED
#include "editor/import/resource_importer_wav.h"
#include "modules/minimp3/resource_importer_mp3.h"
#endif

void SpxResMgr::on_awake() {
SpxBaseMgr::on_awake();
is_load_direct = true;
anim_frames.instantiate();
}

bool SpxResMgr::is_dynamic_anim_mode() const {
return is_dynamic_anim;
}

Ref<AudioStreamWAV> SpxResMgr::_load_wav(const String &path) {
Ref<AudioStreamWAV> sample;
#ifdef TOOLS_ENABLED
Ref<ResourceImporterWAV> importer = memnew(ResourceImporterWAV);
List<ResourceImporter::ImportOption> options_list;
importer->get_import_options("", &options_list);
HashMap<StringName, Variant> options_map;
for (const ResourceImporter::ImportOption &E : options_list) {
options_map[E.option.name] = E.default_value;
}
Ref<AudioStreamWAV> sample;
importer->import_asset(sample, path, options_map, nullptr);
#endif
return sample;
}
bool SpxResMgr::is_dynamic_anim_mode() const {
return is_dynamic_anim;
}

Ref<AudioStreamMP3> SpxResMgr::_load_mp3(const String &path) {
Ref<AudioStreamMP3> sample;
#ifdef TOOLS_ENABLED
return ResourceImporterMP3::import_mp3(path);
#endif
return sample;
}

Ref<AudioStream> SpxResMgr::_load_audio_direct(const String &p_path) {
Expand Down

0 comments on commit eee5e97

Please sign in to comment.