Parsing Scene File Content String

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

Is there any exposed helper for, instead of providing a path to a scene file (.tscn for example), provide its content, and get a Scene Resource?

Basically, any load() that instead of a path, receive the scene file content?

What do you mean by content ?
Load() takes path as an argument and returns packedscene , which is the very content of the scene. If You save this packedscene as a variable, exposed helper will autocomplete anything regarded it, as from now on it will have information about every function,variable, child nodes and resources of this scene.

What Do You want to do in project ?

Inces | 2022-05-08 09:01

load() takes a path as argument, opens the scene file at the path, takes its content, parse it and return a PackedScene. Given this process, I want to provide the file content and return a PackedScene, instead of providing a path.

Zeero | 2022-05-08 12:31

I am sorry, I don’t get it, what content and how would You feed it to editor ? You mean raw scene file or what ? Where would this content come from if not from already packedscene ?

Inces | 2022-05-08 17:34

This content would come from a encryted_with_pass file, decrypted with the accordingly password. Usually would have to save that raw content as a file, load it with usual load(), and then delete the new created file. Wonder if the in-between of the load() is exposed so this is not needed and it gets from the raw content directly.

Zeero | 2022-05-08 17:38