Repository navigation
Closed
Description
Hi! Thank you for so precious project!
Can you please help with problem which i have?
I am have trying use python script with Spatial node, but got error:
from godot import exposed, export
from godot import *
@exposed
class Scene3D(Spatial):
def _ready(self):
passPythonscript 0.30.0 (CPython 3.7.1.final.0)
Got exception loading res://Scene3D.py (Scene3D): Traceback (most recent call last):
File "build\windows-64\pythonscript\_godot_script.pxi", line 170, in _godot.pythonscript_script_init
File "d:/Data/Dev/Godot/Python-test\Scene3D.py", line 6, in <module>
class Scene3D(Spatial):
NameError: name 'Spatial' is not defined
from godot import exposed, export, Spatial
@exposed
class Scene3D(Spatial):
def _ready(self):
passPythonscript 0.30.0 (CPython 3.7.1.final.0)
Got exception loading res://Scene3D.py (Scene3D): Traceback (most recent call last):
File "build\windows-64\pythonscript\_godot_script.pxi", line 170, in _godot.pythonscript_script_init
File "d:/Data/Dev/Godot/Python-test\Scene3D.py", line 1, in <module>
from godot import exposed, export, Spatial
ImportError: cannot import name 'Spatial' from 'godot' (d:\Data\Dev\Godot\Python-test\addons\pythonscript\windows-64\lib\site-packages\godot\__init__.py)
With MeshInstance node i got same:
from godot import exposed, export
from godot import *
@exposed
class Cube(MeshInstance):
def _ready(self):
passGot exception loading res://Cube.py (Cube): Traceback (most recent call last):
File "build\windows-64\pythonscript\_godot_script.pxi", line 170, in _godot.pythonscript_script_init
File "d:/Data/Dev/Godot/Python-test\Cube.py", line 6, in <module>
class Cube(MeshInstance):
NameError: name 'MeshInstance' is not defined
Although in Pong example all works fine. Node2D - works.
If i change root node type from Spatial to Node, and tring get MeshInstance node with help self.get_child(0) then i get:
from godot import exposed, export
from godot import *
@exposed
class Scene3D(Node):
def _ready(self):
print(self.get_child(0))Pythonscript 0.30.0 (CPython 3.7.1.final.0)
Traceback (most recent call last):
File "build\windows-64\pythonscript\_godot_instance.pxi", line 98, in _godot.pythonscript_instance_call_method
File "d:/Data/Dev/Godot/Python-test\Scene3D.py", line 19, in _ready
print(self.get_child(0))
File "build\windows-64\pythonscript\godot\bindings.pyx", line 2427, in godot.bindings.Node.get_child
File "build\windows-64\pythonscript\godot\bindings.pyx", line 94, in godot.bindings.Object.cast_from_ptr
KeyError: 'MeshInstance'
Software versions that i'm using:
OS: Win10x64
Godot: v3.2-stable_win64
Godot-python: 0.30.0-windows-64
Metadata
Metadata
Assignees
Labels
No labels
Activity
touilleMan commentedon Jun 1, 2020
Thanks for pointing this out ;-)
It seems v0.30.0 has been released with
bindings_generate_sample=True(so with only a subset of the entire GDnative API)... with thepythonscript.gdnlibhaving broken path, this release was a really bad one ! 😄I'm going to release a new version today to fix this ;-)
filantus commentedon Jun 1, 2020
Thank you for answer!
Well, then i'll be waiting for the next release. 😃
Thank you for great work!
touilleMan commentedon Jun 1, 2020
version 0.40.0 has been released (might take some time until it is validated to come on the asset store, in the meantime there is the releases page)