Godot version:
Current head as of Jan 21, 2018: 37cb029fcc158b8dc43bfefecc6709ae0237642b
OS/device including version:
Linux (but probably affects all OSes)
Issue description:
Opening a project via command line that has never been imported throws "Failed loading resource" errors. This makes it impossible to deploy Godot projects within CI, automated testing and/or automated build systems.
Steps to reproduce:
1) Delete the ".import" folder (if one exists)
2) Open a project via the terminal such as "godot scene.tscn"
3) Godot quits with errors.
Minimal reproduction project:
ExampleProject.zip
This is normal because the import system is part of the editor and won't be available in a non-tools build. This could be solved by something like #533, though re-purposed for the Godot 3 import system (i.e. make the import process available from the command line).
I suppose that makes sense. It should probably have a flag to force the re-import then:
For instance:
godot -i path/to/scene
I'm not entirely clear on the use case here. If you're trying to run this example scene then your CI/automation environment has working 3D support and is capable of running the full tools build, yes?
Given that, working with what Godot provides today, a creative solution (read: hack) would be to simply prime the pump:
cd $PROJECT_PATH
$BIN/godot -e project.godot & sleep 10 && kill $!
$BIN/godot Node.tscn
This assumes that your assets will take 10 seconds to import; that's more than sufficient for this scene.
This assumes that your scene will quit of its own accord.
If you don't like the timed aspect of this, you could enforce a project.godot that ensures a main scene that quit()s itself. Then the import can take however long it takes although you'll still want some kind of watchdog in an automation environment.
@brainsick Thanks for the advice. I don't personally need it to function right now (although the sooner the better), this issue is just to point out that it is needed for the long term. We definitely need something headless that we can use for CI/testing that isn't hacky. Even if it were something like "godot -i -q" for "import and quit" would be fine. Having it sleep for an arbitrary amount of time might be fine in some cases (or having an auto-quit somehow built into the main scene), but in the long term these are hacks and not proper long term solutions. Again, just to be clear, this issue isn't to solve an immediate problem, although I'd like to setup CI/testing sooner rather than later, but rather serves as a reminder that this needs to be implemented in order for CI to work properly and not in a hacky way.
Even if we had to do something multi-step like the following pseudo-bash-script would be fine too:
cd /path/to/project
godot -i -q
godot -export "Linux X11 Server" ./builds/project.x86_64 # Did the project build successfully?
./builds/project.x86_64 # This could run tests
Specifically in response to the "sooner the better" part, I think it's possible to have a reasonably sound implementation of this, today. The workflow is repeatable and scriptable.
I agree that timing the import is insanely hacky. That's on the discard pile.
I agree that editing an existing project's project.godot to quit() is hacky. That's on the discard pile.
I'm inclined to call the main_scene / tool / quit() workflow as clever, not necessarily a hack. It works for this sample project. It's worth testing on a larger project.
It would then be possible to simply add an import.project.godot and TheQuitter.tscn to your existing project.
import.project.godot
config_version=3
[application]
config/name="Asset Importer"
run/main_scene="res://TheQuitter.tscn"
TheQuitter.tscn
[gd_scene load_steps=2 format=2]
[sub_resource type="GDScript" id=1]
script/source = "tool
extends Spatial
func _ready():
get_tree().quit()
"
[node name="TheQuitter" type="Spatial" index="0"]
script = SubResource( 1 )
import.sh
#!/bin/sh
cd `dirname $0`
GODOT_BIN=/home/todd/Downloads/Godot3.0-RC2/Godot_v3.0-rc2_x11.64
mv project.godot project.godot.$$
cp import.project.godot project.godot
$GODOT_BIN -e project.godot
mv project.godot.$$ -f project.godot
Note that we can't simply use $GODOT_BIN -e import.project.godot because Godot still reads the plain project.godot file!
Putting it all together.
todd@todd-ab28d3:~/Downloads/ExampleProject$ rm -rf .import
todd@todd-ab28d3:~/Downloads/ExampleProject$ time ./import.sh
No touch devices found
OpenGL ES 3.0 Renderer: AMD Radeon (TM) R9 Fury Series (AMD FIJI / DRM 3.18.0 / 4.13.0-25-generic, LLVM 5.0.0)
GLES3: max ubo light: 409
GLES3: max ubo reflections: 455, ubo size: 144
ARVR: Registered interface: Native mobile
begin encoding, format: ETC2_RGBA8
time encoding: 7
WARNING: cleanup: ObjectDB Instances still exist!
At: core/object.cpp:1989.
real 0m2.132s
user 0m1.631s
sys 0m0.060s
todd@todd-ab28d3:~/Downloads/ExampleProject$ ls -lR .import
.import:
total 16
-rw-r--r-- 1 todd todd 5476 Jan 21 23:49 icon.png-487276ed1e3a0c39cad0279d744ee560.etc2.stex
-rw-r--r-- 1 todd todd 5476 Jan 21 23:49 icon.png-487276ed1e3a0c39cad0279d744ee560.s3tc.stex
Does everyone get this ObjectDB warning everytime they use Godot 3.0-master (ever to date)? It makes me sad. Fixed in #15963.
@brainsick Thanks for the detailed setup. If I start needing testing and CI before this is fixed I will likely adapt your solution for my needs... thanks again :)
I was perusing the source and happened upon override.cfg. Replacing import.project.godot with override.cfg.off seems slightly less hacky; it's one less file operation anyway.
I think the only remaining hacky aspect of this is that you have a scene that you don't want people to click on.
You could hide that in a .hidden directory with a .gdignore! It works; it doesn't show up in the Editor. It still shuts down Godot when "force" loaded as the main scene.
Layout
todd@todd-ab28d3:~/Downloads/ExampleProject$ find . -type f
./icon.png
./icon.png.import
./.hidden/.gdignore
./.hidden/TheQuitter.tscn
./import.sh
./Node.tscn
./project.godot
./default_env.tres
./override.cfg.off
override.cfg.off
config_version=3
[application]
config/name="Asset Importer"
run/main_scene="res://.hidden/TheQuitter.tscn"
import.sh
#!/bin/sh
cd `dirname $0`
GODOT_BIN=/home/todd/Downloads/Godot3.0-RC2/Godot_v3.0-rc2_x11.64
mv override.cfg.off override.cfg
$GODOT_BIN -e project.godot
mv override.cfg override.cfg.off
So, Godot starts up, imports, and shuts down cleanly. It's three files that can co-exist with an existing project. The user danger is mitigated by hiding TheQuitter. Looks viable. :)
I tried it on godot-sponza which is one of the larger projects I have access to.
In practice
todd@todd-ab28d3:~/repos/remote/godot-sponza$ rm -rf .import
todd@todd-ab28d3:~/repos/remote/godot-sponza$ cp -R ~/Downloads/ExampleProject/.hidden .
todd@todd-ab28d3:~/repos/remote/godot-sponza$ cp -R ~/Downloads/ExampleProject/import.sh .
todd@todd-ab28d3:~/repos/remote/godot-sponza$ cp -R ~/Downloads/ExampleProject/override.cfg.off .
todd@todd-ab28d3:~/repos/remote/godot-sponza$ ./import.sh
No touch devices found
OpenGL ES 3.0 Renderer: AMD Radeon (TM) R9 Fury Series (AMD FIJI / DRM 3.18.0 / 4.13.0-25-generic, LLVM 5.0.0)
GLES3: max ubo light: 409
GLES3: max ubo reflections: 455, ubo size: 144
ARVR: Registered interface: Native mobile
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
WARNING: _parse_mesh_geometry: Primitive type "polygons" is not well supported (concave shapes may fail). To ensure that the geometry is properly imported, please re-export using "triangles" or "polylist".
At: editor/collada/collada.cpp:1061.
node: Scene Root
node: Sponza
node: AnimationPlayer
SAVING TO: res://.import/Sponza.dae-a161e2224a3a973c5f9f90d5ce6bb52a.scn
WARNING: cleanup: ObjectDB Instances still exist!
At: core/object.cpp:1989.
todd@todd-ab28d3:~/repos/remote/godot-sponza$ ls -l .import/
total 50056
-rw-r--r-- 1 todd todd 699068 Jan 24 22:46 background_ddn.tga-c1c40f27c90614baffe49d30f81641f5.s3tc.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:46 background.tga-1d17e32a414ed12362fd788da0b26749.s3tc.stex
-rw-r--r-- 1 todd todd 174796 Jan 24 22:46 chain_texture_ddn.tga-224c568533b3a1de8a426557d184a858.s3tc.stex
-rw-r--r-- 1 todd todd 7109 Jan 24 22:46 chain_texture_mask.tga-e99c46402b9aa59444dec6be167869da.stex
-rw-r--r-- 1 todd todd 174796 Jan 24 22:46 chain_texture.tga-463ba5637976a051a847513ef63db512.s3tc.stex
-rw-r--r-- 1 todd todd 3533 Jan 24 22:46 icon.png-487276ed1e3a0c39cad0279d744ee560.stex
-rw-r--r-- 1 todd todd 1644394 Jan 24 22:47 lion2_ddn.tga-94eb28f3e2629a225d67f03a46d11e9f.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:47 lion_ddn.tga-c935dba368adfccf52e4721fc2378deb.s3tc.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:47 lion.tga-25e3f85cbdedaebc3f2e5281bc1bbb49.s3tc.stex
-rw-r--r-- 1 todd todd 87396 Jan 24 22:46 particle.png-6bc2982443cc9a0ea7820fc4c0d2daf7.s3tc.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:47 spnza_bricks_a_ddn.tga-840924d189a4f8f6119c514b4e8ba73d.s3tc.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:47 spnza_bricks_a_diff.tga-1582a728c7f9039e950a39144da6ae46.s3tc.stex
-rw-r--r-- 1 todd todd 1439466 Jan 24 22:47 spnza_bricks_a_spec.tga-4ae1131baf08b96a76c07f8b6704b7f0.stex
-rw-r--r-- 1 todd todd 319795 Jan 24 22:47 sponza_arch_ddn.tga-bd67fb380bcba9f30e267a9c1eb9895b.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:47 sponza_arch_diff.tga-0c326d6d66d6105ba640f4c03bec29cb.s3tc.stex
-rw-r--r-- 1 todd todd 879318 Jan 24 22:47 sponza_arch_spec.tga-791bad75427500ae0fbd1f8155767334.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:47 sponza_ceiling_a_diff.tga-ced6e652bc50285310d603938aa1ddda.s3tc.stex
-rw-r--r-- 1 todd todd 1008295 Jan 24 22:47 sponza_ceiling_a_spec.tga-9298394498d9b75ecd761795028428a7.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:47 sponza_column_a_ddn.tga-12b7d2797fc60d03344c79eba32518d2.s3tc.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:47 sponza_column_a_diff.tga-b3a9704b3257f8acca9fecc388b07b4a.s3tc.stex
-rw-r--r-- 1 todd todd 1053147 Jan 24 22:47 sponza_column_a_spec.tga-f19af5ec1fb9e269edf77d0bcccd9cf7.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:47 sponza_column_b_ddn.tga-33b1eae8b175d295e33ffd1ea10a0188.s3tc.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:47 sponza_column_b_diff.tga-7171ec39a67ecd6657a7abf2b3645d3f.s3tc.stex
-rw-r--r-- 1 todd todd 1054286 Jan 24 22:47 sponza_column_b_spec.tga-d6fe12cf3813179910445608cdd2d74a.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:47 sponza_column_c_ddn.tga-82cfad231c8b1bb5ec9c7ab4dd1fbe2e.s3tc.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:47 sponza_column_c_diff.tga-bc3e5b406785f6b050de09e5e6b12c64.s3tc.stex
-rw-r--r-- 1 todd todd 1132300 Jan 24 22:47 sponza_column_c_spec.tga-9afb28bbeda810ea140f560af1078714.stex
-rw-r--r-- 1 todd todd 2796220 Jan 24 22:47 sponza_curtain_blue_diff.tga-f1b16240d2ee4fec65e9c2017a3a3d88.s3tc.stex
-rw-r--r-- 1 todd todd 2796220 Jan 24 22:46 sponza_curtain_diff.tga-6d721f4b2f095e00dc0370c035f9b62e.s3tc.stex
-rw-r--r-- 1 todd todd 2796220 Jan 24 22:46 sponza_curtain_green_diff.tga-f1bc984d9ca3c037ecd83b635b7647a2.s3tc.stex
-rw-r--r-- 1 todd todd 5443554 Jan 24 22:47 Sponza.dae-a161e2224a3a973c5f9f90d5ce6bb52a.scn
-rw-r--r-- 1 todd todd 699068 Jan 24 22:46 sponza_details_diff.tga-a688d6e455fc02c3c9462acf4e172f74.s3tc.stex
-rw-r--r-- 1 todd todd 1081822 Jan 24 22:46 sponza_details_spec.tga-74177a86fa2bc4423e3d3ef362b889c8.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:46 sponza_fabric_blue_diff.tga-5fb5d9c72b94fb2cbc785fb86a623bb7.s3tc.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:46 sponza_fabric_diff.tga-f24a8a3560be8b85ab0b1b88a6eb66dd.s3tc.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:46 sponza_fabric_green_diff.tga-e336f41ee4c39e95fd2f1407fbd3d452.s3tc.stex
-rw-r--r-- 1 todd todd 1012478 Jan 24 22:46 sponza_fabric_spec.tga-564b23dc979fcdb32fcf47969a60ae9d.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:46 sponza_flagpole_diff.tga-b19b1dd18d02423dce3075d74b17d34d.s3tc.stex
-rw-r--r-- 1 todd todd 1082152 Jan 24 22:46 sponza_flagpole_spec.tga-5214434e8f6544708dcd339654ff60bf.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:46 sponza_floor_a_diff.tga-f85e4f35472f7fc77501c056c5df0f9f.s3tc.stex
-rw-r--r-- 1 todd todd 1307555 Jan 24 22:46 sponza_floor_a_spec.tga-c7217f983b47c8d5c5eca395b9f33f38.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:46 sponza_roof_diff.tga-af9407d8b831e1be2f850e19e21ceefe.s3tc.stex
-rw-r--r-- 1 todd todd 43708 Jan 24 22:46 sponza_thorn_ddn.tga-8be3ab28787d9e19b0d98a98b6b6df16.s3tc.stex
-rw-r--r-- 1 todd todd 174780 Jan 24 22:46 sponza_thorn_diff.tga-f61e98ea8c2d20b19753fe1bd21abf84.s3tc.stex
-rw-r--r-- 1 todd todd 162545 Jan 24 22:46 sponza_thorn_mask.tga-044b8c10332a34955b1e13eb0a5762ce.stex
-rw-r--r-- 1 todd todd 486129 Jan 24 22:46 sponza_thorn_spec.tga-183d30b778987ba1c17ff46e8a7a2a92.stex
-rw-r--r-- 1 todd todd 1861351 Jan 24 22:46 vase_ddn.tga-a736e52f1c7b2a7ebd16c11be1425a3a.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:46 vase_dif.tga-f534f487d7dacc346bd2f87132bf2264.s3tc.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:46 vase_hanging.tga-3f3a1d947f5af4e97d7501dff318b9f0.s3tc.stex
-rw-r--r-- 1 todd todd 157311 Jan 24 22:46 vase_plant_mask.tga-ff0db8abfd397ed3eae24d4a5e2a6db2.stex
-rw-r--r-- 1 todd todd 836775 Jan 24 22:46 vase_plant_spec.tga-4db43d546d5083140e17080c0a927707.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:46 vase_plant.tga-dd3f6f77e7d6955a64cd8ecef62008bd.s3tc.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:46 vase_round_ddn.tga-e748ab661c1861e8ce8c602160e630d8.s3tc.stex
-rw-r--r-- 1 todd todd 1968875 Jan 24 22:46 vase_round_spec.tga-bb7b0c8162091e52a24ce22094adca32.stex
-rw-r--r-- 1 todd todd 699068 Jan 24 22:46 vase_round.tga-bd601a53ca57273135fcb7d287048dcd.s3tc.stex
todd@todd-ab28d3:~/repos/remote/godot-sponza$ ~/Downloads/Godot3.0-RC2/Godot_v3.0-rc2_x11.64 scenes/sponza.scn
No touch devices found
OpenGL ES 3.0 Renderer: AMD Radeon (TM) R9 Fury Series (AMD FIJI / DRM 3.18.0 / 4.13.0-25-generic, LLVM 5.0.0)
GLES3: max ubo light: 409
GLES3: max ubo reflections: 455, ubo size: 144
ARVR: Registered interface: Native mobile
Thanks for the help, I ended up adapting your solution, but without needing to copy anything. What I did is:
RunTests.sh
#!/bin/bash
GODOT="/home/nathan/Projects/OpenSource/godot/bin/godot.x11.tools.64.mono"
$GODOT -e AutoQuit.tscn &
PID="$!"
while [[ ! -f imported ]]
do
sleep 1
done
rm imported
sleep 5
kill $PID
$GODOT Spatial.tscn
AutoQuit.gd
extends Node
var filepath = "res://imported"
func _ready():
write_file()
get_tree().quit()
func write_file():
var savefile = File.new()
var result = savefile.open(filepath,File.WRITE)
print(result)
savefile.store_line("imported")
savefile.close()
Ah, I wouldn't have suspected that editing TheQuitter.tscn directly would have resulted in a whole project scan / import. But indeed it does; even when in a sub directory. That eliminates the override swapping and simplifies things even further.
That's one file addition that can optionally be hidden from Editor view completely and one import command.
So, glad you found a solution that works for you. I'll stop updating with new developments as I basically consider this solved.
On to the next quest/issue. :)
I'll stop updating with new developments as I basically consider this solved.
I'll close this then :)