0 votes

I am unable to load(and thus instantiate) scene files that I have gotten through the web and written at runtime.

The errors that I get are:

**ERROR**: No loader found for resource: res://house.glb
**ERROR**:    At: core/io/resource_loader.cpp:186:_load() Method/Function Failed, returning: RES()

It does work with .tscn files but not with .glb and .dae files. I am using the html5 export if that makes a difference. Am I doing something wrong or is this a missing feature? https://github.com/godotengine/godot/issues/4024 seems to show that similar things are possible for .png atleast.

Here's the relevant code:

var building_path="res://house.glb"
var input = _fetch_js_input() #Contains the .glb file as PoolByteArray, I get this through javascript in the webbuild
var file=File.new()
file.open(building_path,File.WRITE)
# Save byte by byte
for item in input["data"]:
    file.store_8(item)
file.close()
var building_scene = load(building_path)
asked Feb 12, 2018 in Engine by dsina (65 points)
edited Feb 18, 2018 by dsina

I asked this on GitHub as well, btw. Here's the issue about it.
Not sure if this feature will come in the future but currently it's not planned.

dsina: I need to ask you a question about this answer you give me here I need to know how to make it work...thanks.

2 Answers

+1 vote
Best answer

If I'm not mistaken, this cannot be done in exported projects since Collada (.dae) and glTF files are considered "source assets" in Godot and require an importing process (which will convert them into SCN or TSCN files). This process can only be performed by the editor – exported binaries do not have such functionality as to decrease binary size (among other concerns).

In contrast, PNG images can be loaded at any time since it is not required to import them to use them in Godot.

answered Jun 10, 2018 by Calinou (6,336 points)
selected Jun 11, 2018 by dsina
+1 vote

I think is a matter of security that any browser can't open or save files in the file system. So they cant't write any file, it is forbidden...

answered Jun 10, 2018 by ferhand (36 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.