Open hsandt opened 3 months ago
I got a more consistent repro during project edit, not on start, with similar but a slightly different set of errors:
Open Dialogic panel and select character:
res://addons/dialogic/Editor/CharacterEditor/char_edit_section_portraits.gd:51 - Invalid call. Nonexistent function 'set_value' in base 'HBoxContainer (field_vector2.gd)'.
Edit Display Name and try to save:
res://addons/dialogic/Editor/CharacterEditor/char_edit_section_portraits.gd:66 - Invalid get index 'current_value' (on base: 'HBoxContainer (field_vector2.gd)'). res://addons/dialogic/Modules/Text/character_settings/character_moods_settings.gd:36 - Invalid get index 'custom_info' (on base: 'Nil'). res://addons/dialogic/Modules/Style/character_settings_style.gd:23 - Invalid get index 'custom_info' (on base: 'Nil'). res://addons/dialogic/Editor/CharacterEditor/character_editor.gd:114 - Invalid get index 'resource_path' (on base: 'Nil').
It is possible that one of the errors prevent immediate character saving, therefore causing https://github.com/dialogic-godot/dialogic/issues/2227
Very weird. When adding a new character portrait (the entry, not the picture), I got a similar issue:
res://addons/dialogic/Editor/CharacterEditor/char_edit_p_section_layout.gd:16 - Invalid call. Nonexistent function 'set_value' in base 'HBoxContainer (field_vector2.gd)'.
and noticed that field_vector2.gd defines a _set_value
with initial underscore indeed, not set_value
. So I fixed the call in char_edit_p_section_layout.gd from:
%PortraitOffset._set_value(data.get('offset', Vector2()))
to:
%PortraitOffset.set_value(data.get('offset', Vector2()))
but then I got:
res://addons/dialogic/Editor/CharacterEditor/char_edit_p_section_layout.gd:16 - Invalid call. Nonexistent function '_set_value' in base 'HBoxContainer (field_vector2.gd)'.
which I don't understand at all.
Before, I also had an error in res://addons/dialogic/Editor/CharacterEditor/character_editor_portrait_tree.gd
when creating a new Portrait entry for a character:
res://addons/dialogic/Editor/CharacterEditor/character_editor_portrait_tree.gd:32 - Invalid get index 'default_portrait' (on base: 'Nil'). res://addons/dialogic/Editor/CharacterEditor/character_editor.gd:345 - Cannot call method 'set_meta' on a null value.
But this one was easy to avoid, just checking for null:
func add_portrait_item(portrait_name: String, portrait_data: Dictionary, parent_item: TreeItem, previous_name := "") -> TreeItem:
var item: TreeItem = %PortraitTree.create_item(parent_item)
item.set_text(0, portrait_name)
item.set_metadata(0, portrait_data)
if previous_name.is_empty():
item.set_meta('previous_name', get_full_item_name(item))
else:
item.set_meta('previous_name', previous_name)
# LOCAL FIX by hsandt: check for null current_resource
# This avoids errors:
# res://addons/dialogic/Editor/CharacterEditor/character_editor_portrait_tree.gd:32 - Invalid get index 'default_portrait' (on base: 'Nil').
# res://addons/dialogic/Editor/CharacterEditor/character_editor.gd:345 - Cannot call method 'set_meta' on a null value.
if editor.current_resource:
if portrait_name == editor.current_resource.default_portrait:
item.add_button(0, get_theme_icon('Favorites', 'EditorIcons'), 2, true, 'Default')
return item
And another error I don't understand at all, when refreshing the portrait image field:
print("current_portrait_data: ", current_portrait_data)
var mirror: bool = current_portrait_data.get('mirror', false) != current_resource.mirror
res://addons/dialogic/Editor/CharacterEditor/character_editor.gd:577 - Invalid get index 'mirror' (on base: 'Nil'). current_portrait_data: { "scene": "", "export_overrides": { "image": "\"\"" }, "scale": 1, "offset": (0, 0), "mirror": false }
I debug printed the current_portrait_data
(note that print appears after error due to how streams are handled), and I do see mirror
is there. And clearly the variable is not null
.
Despite all these @tool
errors I managed to make portraits work with the Premade Style layer "Textbox with Portrait", so I suppose I can go on with development. The biggest issue was character asset not saving properly, I had to re-add the Portrait once or twice to finally save it. But it seems related to another issue https://github.com/dialogic-godot/dialogic/issues/2227
For now I'll just ignore further tool errors and focus on actual runtime.
The problem
Describe the bug I get many errors each time I open the Godot editor:
I suspect that Godot is responsible for this as it doesn't parse things in order (I saw some issues on Godot repo although not sure which specific one it would be). If so there is not much choice to fix it from plugin side, unless you know a workaround.
Note that the game runs fine at runtime. It's just a one-time issue that doesn't prevent development.
To Reproduce Steps to reproduce the behavior:
Expected behavior Start without errors
Screenshots If applicable, add screenshots to help explain your problem.
System (please complete the following information):
Solutions
Workaround
No workaround known
Possible fixes
It may be on Godot side... but it would be nice to find out what specifically triggers this, as not all plugins cause such errors