-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Save generated meshes to resources #109
Comments
See this reference here, where by we could utilize the editor plugin ability to define a custom |
Looking into this further: We are actually not far off from being able to support this actually. If in code we set So. In order to save the mesh resource, we need to add it to the scene hierarchy. But this also violates our initial principle of never exposing the RoadSegment to the editor directly, since it's not meant to be user manipulated. Options include:
Maybe there are more approaches. Both bullet points above would likely end up needing us to enforce that 1 RoadPoint = one child RoadSegment/mesh, which further means we should try to avoid any of the complexity of flipped directions of RoadPoints. This task is relevant now because we also want to avoid having to recreate all geometry for instanced scenes, something we're running into some issues with recently (#169) due to rotations on RoadContainers not working well for curve offsets. If we can save the mesh geo to disk instead of regenerating it for saved scenes, we would mostly bypass this problem (well, it'd at least be under the rug). |
FYI @bdog2112 that this conundrum has come up as I contemplate saved scenes actually persisting their data. I need spend some thinking time on this one, since it would potentially lead to a bit of a restructure. |
Ok on further consideration, seems like we could actually have the best of a few worlds, but would need to do some experimentation.. and might not be as straightforward as the just "saving everything to the scene" approach:
|
Right now, whenever you open the editor scene or start the game (or even just switch from one scene tab to another, sigh), road meshes need to be generated on the fly. For a game already built around procedural world generation, this is not too much of a problem - but for other games where roads should be generated and then just made static, it would be ideal that these can be saved in a native format that is loadable from disk. This will also greatly reduce the burden of time delay when tabbing over to a scene, which right now can take some time to load if there are a lot of meshes present.
Apparently, this should be possible using https://docs.godotengine.org/en/stable/classes/class_arraymesh.html and saving to resource files.
From this post, at least one person suggested:
You could make your own Resource type that generates the ArrayMesh based on the exported variables
The text was updated successfully, but these errors were encountered: