-
-
Notifications
You must be signed in to change notification settings - Fork 235
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
Unique numeric ID for DialogicCharacter resources #2314
Comments
yeah unfortunately I don't think UUID's are quite there yet. I'm wondering why this cannot be achieved relatively easily with the unique identifiers strings we have right now. Each character is assigned a unique name anyways (see the Reference Manager), could you potentially use that in your character system? Alternatively the translation id (of which each character get's one) is also unique, though it only works with translations enabled so it's not as useful I think. Just trying to think whether adding another unique identifier is necessary. Ensuring something is unique across a project isn't super simple. |
I could workaround it using a dictionary that maps |
Arbitrary data should be saved to the |
Is there any tutorial/guide that explains exactly how to do that or do I need to do what is explained here? |
No unfortunately there aren't any docs on how to do this. But you can look at the Styles module which adds a section to the character editor and stores it's data in the custom_info of the character. The main things are:
@tool
extends DialogicCharacterEditorMainSection
## Character editor tab that allows setting a custom style fot the character.
func _init() -> void:
hint_text = 'This is a custom ID that I use to get this character.'
func _get_title() -> String:
return "Custom ID"
func _load_character(character:DialogicCharacter) -> void:
%LineEdit.text = str(character.custom_info.get('id', ''))
func _save_changes(character:DialogicCharacter) -> DialogicCharacter:
character.custom_info['id'] = %LineEdit.text
return character
@tool
extends DialogicIndexer
func _get_character_editor_sections() -> Array:
return [this_folder.path_join('character_settings_scene.tscn')]
|
Is your feature request related to a problem? Please describe.
I'm working on a project where I have custom resources for characters (a set of .tres files where each one has a unique numeric ID for referring to them) and a Dialogic character resource for each (.dch files from the
DialogicCharacter
class).It would be interesting to get my custom character resources from the Dialogic character resources. I could, for example, store all my character resources into a dictionary with their IDs as the keys and then I could do something like that:
Describe the solution you'd like
Export an
id
property for the DialogicCharacter
resource and add some validation to make sure they're unique.Describe alternatives you've considered
I could use the
DialogicCharacter
resource UUID somehow, though I found it not to be very reliable.Additional context
N/A
The text was updated successfully, but these errors were encountered: