Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Many Dialogic errors such as "Parse Error: Could not resolve class" and "Invalid call. Nonexistent function" on editor start, Dialogic panel Character selection and edit #2225

Open
hsandt opened this issue May 11, 2024 · 4 comments

Comments

@hsandt
Copy link

hsandt commented May 11, 2024

The problem

Describe the bug
I get many errors each time I open the Godot editor:

res://addons/dialogic/Editor/Events/Fields/field_vector2.gd:0 - Parse Error: Could not resolve class "DialogicVisualEditorFieldVector".
modules/gdscript/gdscript.cpp:2788 - Failed to load script "res://addons/dialogic/Editor/Events/Fields/field_vector2.gd" with error "Parse error". (User)
res://addons/dialogic/Editor/CharacterEditor/char_edit_section_portraits.gd:16 - Invalid call. Nonexistent function '_load_display_info' in base 'HBoxContainer (field_vector2.gd)'.
...
res://addons/dialogic/Editor/CharacterEditor/char_edit_section_portraits.gd:51 - Invalid call. Nonexistent function 'set_value' in base 'HBoxContainer (field_vector2.gd)'.
res://addons/dialogic/Core/DialogicUtil.gd:405 - Invalid set index 'property_name' (on base: 'HBoxContainer (field_vector2.gd)') with value of type 'String'.
res://addons/dialogic/Modules/StyleEditor/style_layer_editor.gd:449 - Invalid set index 'size_flags_horizontal' (on base: 'Nil') with value of type 'int'.

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:

  1. Install Dialogic plugin and enable it
  2. Restart project
  3. Check errors in Output

Expected behavior
Start without errors

Screenshots
If applicable, add screenshots to help explain your problem.

System (please complete the following information):

  • OS: Linux Ubuntu 22.04
  • Godot Version: v4.2.1.stable.official [b09f793f5]
  • Dialogic Version: 2.0-Alpha-13 (Godot 4.2+) (installed manually from GitHub)

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

@hsandt
Copy link
Author

hsandt commented May 14, 2024

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 #2227

@hsandt hsandt changed the title Many Dialogic errors such as "Parse Error: Could not resolve class" and "Invalid call. Nonexistent function" on editor start Many Dialogic errors such as "Parse Error: Could not resolve class" and "Invalid call. Nonexistent function" on editor start, Dialogic panel Character selection and edit May 14, 2024
@hsandt
Copy link
Author

hsandt commented May 15, 2024

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.

@hsandt
Copy link
Author

hsandt commented May 15, 2024

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

@hsandt
Copy link
Author

hsandt commented May 15, 2024

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 #2227

For now I'll just ignore further tool errors and focus on actual runtime.

hsandt added a commit to hsandt/lospec-jam-2-scaled-down-adventures that referenced this issue May 17, 2024
Unfortunately, still many errors left and I'm not sure how to fix them, see dialogic-godot/dialogic#2225
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant