Open Ranoller opened 7 years ago
More test done: Creature only works in export if the json file is placed in the same directory of the executable, but should work with the json file packed with all the assets in zip pck or exe.
Edit: It seems that godot doesn´t recognize the file like an "external resource". I think that the "asset_filename" section is not enought to godot to find the file. If you see the packedscene contents there is a [ext_resource path="res:etccc...... type="Script" or "Texture" id=x] that allow godot to load the files step by step.... I feel like the json file should be loaded this way, but i´m not a godot dev, not sure at all.
Edit2: Definitely the problem is that the file location is not remapped in export. I made an export packing entire project to exe file, and error is the same. Puting the json near the executable fix the issue. But this is not optimal solution, of course, json files needs to be inside the export package.
I think that problem is here:
94 | CreatureGodot::load_json(const String& filename_in) |
---|---|
95 | { |
96 | auto global_path = Globals::get_singleton()->globalize_path(filename_in); |
There is other user with this problem: https://godotengine.org/qa/18047/how-to-get-an-internal-resource-path-in-exported-binary
But nobody seems to response them.
I deserve good look to you because I would like to become your customer soon like you seems the unique animation-app-developer interested in godot (and with a very smooth integration looking the "dino" example), but my game will need export template working. king regards.
Edit3: In my "no c++ developer condition" i´m not feel confident to find a correct workaround for that, but reading godot docs, it says that if a module inherits node, it appears in editor. But it says too, that you can inherit "Resource", and properly, the json file is a "resource" (res:// is the filesystem path for resources) http://docs.godotengine.org/en/stable/learning/features/misc/data_paths.html. This last comentary it's just in case can give to you any idea, because i can´t realy help with this problem.
Hello, Firstly, I want to say thank you so much for looking into this. I too am not sure how to address this issue as the docs for Godot are quite sparse regarding this area. If you have any insights on how the line of code should be changed, please do let me know. Also, you know the eventual plan is to move the plugin into GDNative but so far, Godot 3.x isn't stable enough yet for full development time.
Cheers
Thanks for your response. I compiled godot changing the globalize_path to localize_path (random thing because i´don´t know c++, godot internal API or real programming) and plugin don´t work in editor. I feel that i can do a nice puppet, do music, and script, but this is up to my scope (and give me headache like the fire of the hell). I can´t help, sorry. I´m not wait for godot3.0 (wait for godot is always bad idea :) :) :) :) ) and i think that probably this "thing" will be present in Godot 3.0 too. (Will be rewrited globals API?, we don´t know). If you can find a workaround please tell me and if you put an issue in godot for that I give you up-hands and support (I don´t think that juan and others developers will be interested in looking this kind of things now, but nothing is lost for try). Store json files out of the project is still an option however.
Hello,
Yes indeed, I need to look around at the Godot API more but so far, I am lost in their code/docs too :( It is a bit unfortunate, hopefully I can figure something out eventually...
I try to export your example of the "dino" with the custom windows templates with the creature module, and no mathers I pack all the files in executable, pck or zip in godot export, or if I use json file of the dino directly in the plugin or packed in the zip, the plugin doesn´t work in export. The files are exported (there is no problem in godot export, I configured that to export .json and .zip). The console shows that creature are unable to find json file. I think that the problem is that it try to find the file in "./" and not in "res://", but not sure.
I forgot: the plugin works in editor.
Edit: Godot version 2.1.4. Export templates: Windows custom with and without debug in 64 bits.
More info:
Exporting project packed in exe (and json unzipped) throws: CreatureGodot::load_json() - Loading file: ./utahraptorExport_character_data.json CreatureGodot::load_json() - ERROR! Could not load file: ./utahraptorExport_character_data.json
Exporting project with assets packed in zip and json file unzipped: Creature try to find the file inside the executable if it will be a directory.