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

ResourceLoader doesn't work with system paths #14879

Closed
tmathews opened this issue Dec 20, 2017 · 15 comments
Closed

ResourceLoader doesn't work with system paths #14879

tmathews opened this issue Dec 20, 2017 · 15 comments

Comments

@tmathews
Copy link

tmathews commented Dec 20, 2017

Godot version:
3.0 (e3fd61b)

OS/device including version:
Ubuntu 17.10

Issue description:
I'm currently using image.load(path) to load images from the users file system. I wanted to try loading any kind of resource using ResourceLoader.load and ResourceLoader.load_interactive, but both give me an error: No loader found for resource: ...

I'm not sure if this is intended, but I expected it to work since I could use image.load for the same path.

Steps to reproduce:

print(ResourceLoader.load("res://resource") != null) # Should be true
print(ResourceLoader.load("/path/to/resource") != null) # Should be true
@Ovnuniarchos
Copy link
Contributor

Ovnuniarchos commented Jan 30, 2018

It seems Godot has been rendered incapable of loading any resource that has not been previously imported.
As a workaround, you can create an Image, load it from disk, then convert it to any type of Texture you want. I have not looked how to do it for other types of resources, though.

@tmathews
Copy link
Author

For now I ended up loading the data through the file API and then using load from jpg/png.

@ifig4fireghost

This comment has been minimized.

@tmathews

This comment has been minimized.

@akien-mga

This comment has been minimized.

@KoreTeknology
Copy link

same for audio files... doesnt want to load external data without previously re-imported from godot ui

@Jack-MoG
Copy link

I've done some testing with this, and it seems that it's impossible to load successfully unless the .import files are present. As far as I can tell, there isn't a way to do so through code.
This demo shows the issue with .obj files
Godot load issue demo.zip

@ondesic
Copy link

ondesic commented Sep 8, 2020

This is a huge problem I am running into. I have a program that relies on the user picking a wav or ogg file from a file dialogbox. They then play it. This will not work as I get errors saying a loader cannot be found for wav or ogg files.
The same code works perfectly if the audio file is in the res:// folder. Looks like this has been a problem for a long time. Can this be fixed?

@Calinou
Copy link
Member

Calinou commented Sep 8, 2020

@ondesic There's a proposal about this already: godotengine/godot-proposals#732

@ondesic
Copy link

ondesic commented Sep 9, 2020

@Calinou The title mentions WAV. We really could use a solution for wav and ogg. Do you know what the progress on this is?

@Calinou
Copy link
Member

Calinou commented Sep 9, 2020

@ondesic As far as I know, nobody started working on this feature yet. The proposal can likely be extended to loading OGG files, although OP didn't ask for it specifically.

@Calinou
Copy link
Member

Calinou commented Sep 9, 2020

@ondesic In the meantime, you may want to look at this script: https://github.com/Gianclgar/GDScriptAudioImport

@spit4520
Copy link

spit4520 commented Mar 9, 2021

Hey all,

I know this thread is a bit old, but I was wondering if there is a way to generate meshes from objects in run time. We are loading up a file picker and importing an object, we want to generate a mesh from the object (which also appears to need the MD5 hash and .import files also need to be generated)

We are trying to create something kind of dynamic like the settlement building in Fallout 4, but with your own objects

Thanks

Scott

@Calinou
Copy link
Member

Calinou commented Mar 9, 2021

@spit4520 To load models in an exported project, you need to use an OBJ loader such as this one.

@KoBeWi
Copy link
Member

KoBeWi commented Oct 24, 2024

load() method in clarifies how to load non-imported Resources:
https://docs.godotengine.org/en/latest/classes/class_%40gdscript.html#class-gdscript-method-load

Loading Resources outside project works normally if they are not importable (e.g. GDScript, JSON). Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants