kestrelm / Creature_Godot

2D Skeletal Animation Creature Runtime for Godot Engine
Apache License 2.0
84 stars 12 forks source link

creature2d crashes godot entirely if you set it to a wrong file name #2

Closed blurymind closed 8 years ago

blurymind commented 8 years ago

the lichlord file here is the log :

CreatureGodot::load_json() - Loading file: 
CreatureGodot::load_json() - ERRROR! Could not load file: 
CreatureGodot::load_json() - Loading file: /home/owl/INSTALL/godot/creature2dExample/LichLordProject.creaProj.zip
LoadCreatureJSONData() - Error parsing JSON!
CreatureGodot::load_json() - Finished loading file: /home/owl/INSTALL/godot/creature2dExample/LichLordProject.creaProj.zip
godot.x11.tools.64: modules/creaturegodot/gason/gason.h:85: JsonNode* JsonValue::toNode() const: Assertion `getTag() == JSON_TAG_ARRAY || getTag() == JSON_TAG_OBJECT' failed.

Not sure if this applies to windows builds too, but this crashes godot! Specifying any invalid path or path to a file that doesnt satisfy creature's node will kill godot entirely.

blurymind commented 8 years ago

https://www.kestrelmoon.com/creaturesamples/LichLordProject.creaProj.zip

blurymind commented 8 years ago

Ok this is my mistake. The archive contains the actual creature project file, not the exported data. But if you set an archive without a proper exported json file for the file - it crashes the entire engine - which is pretty harsh. :)

It would also be nice if we could navigate to the file, but I guess that would create more work for you

blurymind commented 8 years ago

In fact typing anything in the file box will crash godot, so the user has to always paste the name of the file. In often cases this could lead to a crash, because I like to keep the assets in a subfolder

kestrelm commented 8 years ago

Sync up and try again. Just checked in a fix. Now it doesn't crash if the incorrect name was typed in. Create a new CreatureGodot object and give it a go.

blurymind commented 8 years ago

nice! thank you. I will recompile and give it a try asap.

kestrelm commented 8 years ago

Btw, it only works for exported jsons or zipped jsons. Error checking for other files will take more time. Sorry.

blurymind commented 8 years ago

does it still crash godot if I start typing the path manually?

Since there is no way to navigate to the file, a lot of people who keep their animations in a subfolder might do this:

type res://myAnimationsFolder/

then paste the name of the file at the end of the line

But now when you start typing, you wont go as far as 're...' before it crashes the whole editor.

Its not the worst thing - but definitelly a big gotcha that deserves a warning.

kestrelm commented 8 years ago

That is very strange, I am experiencing no such crash at all on Windows. Is this a Linux editor issue? I do not control the textbox UI code, that is all up to Godot. What does your error console print?

blurymind commented 8 years ago

I need to check it again - but it might be a linux specific one - in which case I will forward it to godot devs for more info.

kestrelm commented 8 years ago

I just double checked again on Windows. I can keep typing in the textbox with a totally bogus filename without any crashes.

kestrelm commented 8 years ago

Also, what is your print out in your console before the crash?

kestrelm commented 8 years ago

For example, I am currently typing in a bogus file called "test" that does not exist, I get the following printout:

settings changed CreatureGodot::load_json() - Loading file: test CreatureGodot::load_json() - ERRROR! Could not load file: test

But no crashes. Godot Editor runs just fine.

blurymind commented 8 years ago

when I type res:// and hit enter godot crashes with this error:

CreatureGodot::load_json() - Loading file: /home/owl/INSTALL/godot/creature2dExample/
LoadCreatureJSONData() - Error parsing JSON!
CreatureGodot::load_json() - Finished loading file: /home/owl/INSTALL/godot/creature2dExample/
godot.x11.tools.64: modules/creaturegodot/gason/gason.h:85: JsonNode* JsonValue::toNode() const: Assertion `getTag() == JSON_TAG_ARRAY || getTag() == JSON_TAG_OBJECT' failed.

I will try it with the fixes in a bit. still recompiling

kestrelm commented 8 years ago

That is very strange, did you sync up and rebuild the latest changes?

blurymind commented 8 years ago

not yet, I am compiling it now

blurymind commented 8 years ago

ok tested it!

I confirm that your last commit has fixed the issue. Now when I type a wrong directory or path, it just gets erased from the input box. That was an awesome and qucik fix. :+1:

kestrelm commented 8 years ago

Sounds great, please remember to sync and finish compiling before testing :)

Cheers

blurymind commented 8 years ago

thank you for the awesome plugin and for the fixes.