godot-python
godot-python copied to clipboard
Tools (export(tool=True)) do not reload on save
I can see that #180 was labeled as a "partially fixes #170", but #170 got closed. The specific errors in #170 are fixed, but I have not been able to reload any type of tool script with any method besides a restart of the editor.
When I save changes to a script, errors appear in the output which are identical to the ones quoted on #280: AttributeError tool_class
object has no attribute script
.
The specific attributes complained about seem to depend on the type of node the script is attached to. For example a Node2D will just complain about "editor_description" and "script", whereas an AnimatedSprite will raise the same exception regarding the attribute "playing".
I decided to experiment with this a bit, and set up the following class:
from godot import exposed, ProjectSettings, ResourceLoader
from godot import export
from godot import *
@exposed(tool=True)
class tool_script(AnimatedSprite):
def _enter_tree(self):
# Initialization of the plugin goes here
print("tree entered")
def _ready(self):
print("ready")
def _process(self,delta):
pass
Checking the "Playing" box in the inspector gives:
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: `tool_script` object has no attribute `playing`
Traceback (most recent call last):
File "build\windows-64\pythonscript\_godot_instance.pxi", line 52, in _godot.pythonscript_instance_set_prop
File "build\windows-64\pythonscript\godot\bindings.pyx", line 253, in godot.bindings.Object.__setattr__
File "build\windows-64\pythonscript\godot\bindings.pyx", line 171577, in godot.bindings.AnimatedSprite.playing.__set__
File "build\windows-64\pythonscript\godot\bindings.pyx", line 244, in godot.bindings.Object.__getattr__
AttributeError: `tool_script` object has no attribute `_set_playing`
Set playing
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: `tool_script` object has no attribute `playing`
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: `tool_script` object has no attribute `playing`
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: `tool_script` object has no attribute `playing`
I can avoid all these errors if I use an autoload class; however, the script still does not reload. I guess that leaves me with no specific leads.