Zylann / godot_heightmap_plugin

HeightMap terrain for Godot implemented in GDScript
Other
1.77k stars 160 forks source link

i get a null reference issue crashing project and preventing terrain showing #306

Open RichardEllicott opened 2 years ago

RichardEllicott commented 2 years ago

Hi

i get the error all of sudden on running my projects:

image

also now all the terrains refuse to display in the editor also

i had seperate folders, with different terrains... they had subfolders of "data" in them

i think it may have been caused when i loaded a 1024x1024 heightmap into one of them

any idea how i can get it working again? i have ensured the addon has not been modifierd . i believe the data folders are intact

Environment

Zylann commented 2 years ago

It looks like GDNative being a buggy fella again. Your screenshot defies logic: it complains it cannot call new on a null instance. When it has been confirmed to be not null the line right above it. I don't even know how that can be fixed plugin-side.

An immediate workaround is to turn off the GDNative component by commenting out all OSes inside the _supported_os variable, and restart the project.

Other than that... absolutely no idea, but it should not be caused by loading a 1024x1024 map. Your debugger shows 12 errors, is the one you are showing really the first one?

RichardEllicott commented 2 years ago

hmmm nothing obvious then

for myself anyway i recovered my ability to use HTerrain by freezing my terrain experients folder to a zip, creating a new one, so perhaps something in one of them folders breaks it.... i've also choose to rely on heightmaps generated externally so i've lowered any vulnerability to my own projects

i could test loading some of the data back perhaps as all of that stuff seems saved in your format in a folder

actually i get warnings from your software about when i am using images instead of resources apparently... so it says i may not be able to export.

can i ask, will this be a problem for me?

i must admit i may have had quite a few bugs there just from my own tool scripts with null references etc that always occur on certain things... i didn't see anything to do with your plugin actually, them errors where prob my own stuff i had not dealt with in my controllers etc, not interacting with the HTerrain

Zylann commented 2 years ago

i've also choose to rely on heightmaps generated externally so i've lowered any vulnerability to my own projects

Note technically even if the plugin crashes your data isn't lost, the terrain data folder is in clear PNG formats. The heightmap is a .res but it really is just an Image that was called ResourceSaver.save on (so it is recoverable with any script that can do load).

actually i get warnings from your software about when i am using images instead of resources apparently... so it says i may not be able to export.

You mean these?

 core/image.cpp:2045 - Loaded resource as image file, this will not work on export: 'res://tests/test1/terrain1/normal.png'. Instead, import the image file as an Image resource and load it normally as a resource.

They should not be a problem. It's just Godot warning that doing Image.load("res://something") won't work in an exported project, but the plugin does that specifically in editor... for editor reasons (terrain textures are imported as StreamTexture but in order to be edited they must be ImageTextures). But Godot prints them anyways 🤷 In exported projects, the plugin uses the resource loader instead.

RichardEllicott commented 2 years ago

thanks for all the info, so that's okay then. I'll see if i can reproduce the bug at any point yunno just in case i figure out how it went wrong

thanks again for making this tool, arguably one of the most essential plugins for Godot i think