Can't save and load .glb/.dae at runtime

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By dsina

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? How to draw a rawarray Image · Issue #4024 · godotengine/godot · GitHub 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
# Save byte by byte
for item in input["data"]:
var building_scene = load(building_path)

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 | 2018-06-11 11:25

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.

ferhand | 2018-06-11 22:49

:bust_in_silhouette: Reply From: ferhand

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…

:bust_in_silhouette: Reply From: Calinou

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.