Resource Sharing via Paths #9383
Replies: 3 comments 4 replies
-
The question is why you have a "coconut tree" Mesh or Materials (and likely Textures as well) stored in a PackedScene in the first place, and not stored in their own Resource file. Which is basically "resource sharing via paths" because only the path to the resource ref will be stored in the scene, not the entire file data. Just because you can embed everything in Godot into scene files does not mean you should. Not only does storing a mesh or texture like that inside a scene file make everything slow to edit and slow to save and load, it also makes the resource not reusable and shareable. Godot also can not load "a little" of a scene file, it loads the entire scene file because it does not keep a file index position for each individual asset in the scene file. So having a bloated scene file with everything is really unwieldy and bad for a lot of things, not recommended at all. |
Beta Was this translation helpful? Give feedback.
-
Hey. Thanks for engaging the topic. Good on ya. Try this angle: I hear what you sat about bloat, but that's up to the dev (me). They would balance the pros and cons of it. When I start to scatter those trees onto a landscape scene, I am employing many MultimeshInstance3D nodes. If each Multimesh within them could point into that 'library' scene (or even into the glb file) I could use this approach. I know one can extract all the meshes on import and save them to resource files, perhaps that's the way to go. Although, a side-effect/issue is that when you do extract/save the meshes to files, the glb becomes redundant (ito of final export of the game) and you have to remember not to include it or to delete it. Can one mark files for non-inclusion in an export? |
Beta Was this translation helpful? Give feedback.
-
Okay. Thanks to your feedback, I am going to rethink my approach of using scenes as libraries and just go with the godot. I will extract meshes and use folders to categorize things. |
Beta Was this translation helpful? Give feedback.
-
Imagine one has a scene with many nodes (let's say 3d meshes). They are setup as a library of meshes. Let's say "trees.tscn"
I'd like to suggest a way to reach any object via something like: "res://trees.tscn::/palm_tree/coconut/mesh"
(The material would be "res://trees.tscn::palm_tree/coconut/material" and so forth. A bit like Blender does it.)
Right now, Multimesh is very keen to duplicate meshes and dump all that data into the scene file—which bloats quickly. Either that or it expects a file path to a mesh resource file—but, if I already have the coconut tree mesh in that packedscene, why can't the Multimesh just point into tree.tscn instead; fetch the data from there and go about its business?
To avoid issues, the packedscene could be required to be instanced in the scene, so it's loaded and available, it would just be set to invisible.
Maybe this exists already, not sure?
Beta Was this translation helpful? Give feedback.
All reactions