Closed
Description
The problem
Describe the bug
With the released of this PR: #2537
I was able to create characters from code; however, creating a portrait associated with the character I unfortunately receive an error:
``E 0:00:20:693 _load: Resource file not found: res:// (expected type: )
<C++ Error> Method/function failed. Returning: Ref<Resource>()
<C++ Source> core/io/resource_loader.cpp:352 @ _load()
E 0:00:20:695 subsystem_portraits.gd:477 @ add_character(): [Dialogic] Failed to load character "".
<C++ Source> core/variant/variant_utility.cpp:1098 @ push_error()
<Stack Trace> subsystem_portraits.gd:477 @ add_character()
Digging through the dialogic code it appears to attempt to load a portrait file from disk which doesn't exist.
To Reproduce
Example code:
Globals.database_connection.query("SELECT * FROM scenario_characters INNER JOIN people ON people.id = scenario_characters.people_id WHERE people.id != 1")
var suspects_data: Array = Globals.database_connection.query_result
for suspect: Dictionary in suspects_data:
var character: DialogicCharacter = DialogicCharacter.new()
character.display_name = suspect["name"]
var portrait: DialogicPortrait = DialogicPortrait.new()
portrait.apply_character_and_portrait(character, "default")
portrait.apply_texture(Sprite2D.new(), "assets/" + suspect["image_path"])
character.portraits = { "default": portrait }
character.default_portrait = "default"
character.set_identifier(suspect["name"])
Expected behavior
With the ability to create characters from code, the ability to create and link portraits from code should also exist.
System:
- OS: Linux
- Godot Version: 4.4
- Dialogic Version: Dialogic 2.0 - Alpha 17
Solutions
Workaround
Posted this in the Dialogic discord and user Xen reported it works if you comment out the threaded-loading section of add_character()
Metadata
Metadata
Assignees
Labels
No labels