godot-python
godot-python copied to clipboard
Unable to pack a scene if it has Python scripts
I have a simple project with a CSGMesh and a few other nodes. The CSGMesh has a Python script, which generates a small ArrayMesh. I wanted to try exporting the scene as a packed scene once the mesh was present. However, I find that calling packed_scene.pack(get_tree().get_current_scene())
fails with the error:
Pythonscript 0.50.0 (CPython 3.8.5.final.0)
Traceback (most recent call last):
File "build\windows-64\pythonscript\_godot_instance.pxi", line 67, in _godot.pythonscript_instance_get_prop
File "build\windows-64\pythonscript\godot\bindings.pyx", line 244, in godot.bindings.Object.__getattr__
AttributeError: `CSGMesh` object has no attribute `_import_path`
Traceback (most recent call last):
File "build\windows-64\pythonscript\_godot_instance.pxi", line 67, in _godot.pythonscript_instance_get_prop
File "build\windows-64\pythonscript\godot\bindings.pyx", line 244, in godot.bindings.Object.__getattr__
AttributeError: `CSGMesh` object has no attribute `script`
This happens the same way whether I make the call within a Python script, or a GDNative script.
When inspecting the node in the Inspector, of course, it does have the property "script", whose value corresponds to a python script.
Seems somewhat related to #267.
Hi @dranorter
I think I found the issue: Node._import_path
is a property, but it getter/setter are not defined in Godot's api.json
version used to build version 0.50.0 of Godot Python (I guess it was this one https://github.com/godotengine/godot-headers/blob/f2122198d51f230d903f9585527248f6cf411494/api.json)
The good news is newer version of api.json
seems to have fixed this \o/ (see https://github.com/godotengine/godot-headers/blob/godot-3.2.3-stable/api.json)