Skip to content
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

Binary mesh resource disappears from MeshInstance3D upon project restart #77978

Closed
Lippanon opened this issue Jun 7, 2023 · 7 comments · Fixed by #85922
Closed

Binary mesh resource disappears from MeshInstance3D upon project restart #77978

Lippanon opened this issue Jun 7, 2023 · 7 comments · Fixed by #85922

Comments

@Lippanon
Copy link

Lippanon commented Jun 7, 2023

Godot version

v4.1.beta.custom_build [72b5932]

System information

Windows 10, Vulkan

Issue description

This has been plaguing me for a while in my main project. I can only partially reproduce it in a MRP:
When placing a binary mesh resource imported from a .glb file into a MeshInstance3D, it will be gone upon restart. It doesn't seem to happen to every resource, but I've had MIs that were fine and then start doing it out of nowhere.
I thought it was going to be related to materials due to things like #77007 but I can reliably trigger it with the steps listed below.
I have done limited testing on .tres files because I usually use .res for size/performance, but in the MRP .tres doesn't seem to trigger it, so perhaps it doesn't affect those.

Note on the Steps to reproduce: you have to delete the test_cube.res and redo the steps to trigger the bug again, but in my main project the affected resources always disappear.

Steps to reproduce

  1. Double click test_cube.glb
  2. Click the mesh (test_cube_Cube_097), set save to file path as: res://test_cube.res
  3. Make sure to click the little folder icon and then Save (this seems to make it consistent to proc)
  4. Press Reimport
  5. Drag the test_cube.res to the Mesh slot of the MeshInstance3D
  6. Ctrl+s to save
  7. Project -> Reload current project
  8. Mesh is no longer in the MeshInstance3D

Minimal reproduction project

binary res bug.zip

@bitsawer
Copy link
Member

bitsawer commented Jun 7, 2023

After some retrying, I can reproduce this. If someone is having difficulties, try these steps first after unzipping and editing the project:

  1. Delete test_cube.res in the FileSystem dock.
  2. Project -> Reload current project,

Now follow steps in the first post.

I think there are (or has been) similar bugs in Godot, for example attached Script resources sometimes disappearing, so if these have a similar cause fixing this could theoretically fix some other bugs, too.

@fracteed
Copy link

fracteed commented Jun 8, 2023

Have you tried saving the files with a .mesh extension instead of .res? I make heavy use of .mesh files in my game and just checked it in current 4.1 master with no issues. This was developed in 4.0.3 and I use a script to convert from obj to .mesh (using the resource saver class), so maybe that is why I didn't run into this issue?

@Lippanon
Copy link
Author

Lippanon commented Jun 8, 2023

Have you tried saving the files with a .mesh extension instead of .res?

No, didn't try, the saving/path dialog only shows .res/.tres, Is it documented anywhere? What are the differences?

@fracteed
Copy link

fracteed commented Jun 8, 2023

I guess I got used to it with 3.x as that is what was used then by default. I didn't know that it doesn't show up in the ui any more, as I use a script for the batch conversion of files. There is no difference in the file format, just like .gdshader vs .tres. So you could take a .res mesh and rename it to .mesh extension.

It is worth trying at least, to see if the same bug persists. You could also try adding your exported godot mesh to a new test project to see if it gives the same problem there. Sounds like it is some sort of ui quirk/bug.

@GoldenReverie
Copy link

I have noticed a similar issue with imported .res models from .glb files losing disconnecting from the meshinstance3d upon startup. It seems at least in my case that the "save_to_file/path": line on the .import file did not point to the correct location once i changed the capitalisation on the folder. Possible that the engine doesn't detect the case change on the folder name?

@drephuz
Copy link

drephuz commented Sep 29, 2023

I ran into this issue myself. Importing a .glb, and was having assorted bugginess with the entire mesh. I eventually had to change the meshes that lost their link to mesh resource by reimporting them as .tres instead of .res.

@GoldenReverie
Copy link

I ran into this issue myself. Importing a .glb, and was having assorted bugginess with the entire mesh. I eventually had to change the meshes that lost their link to mesh resource by reimporting them as .tres instead of .res.

this is a decent work around works for me too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants