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):
pass
Pythonscript 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):
pass
Pythonscript 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):
pass
Got 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
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:
With MeshInstance node i got same:
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:Software versions that i'm using:
OS: Win10x64
Godot: v3.2-stable_win64
Godot-python: 0.30.0-windows-64