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

Replace invalid node name symbols with an underscore instead of nothing #6225

Closed
roalyr opened this issue Feb 3, 2023 · 2 comments · Fixed by godotengine/godot#75760
Closed
Milestone

Comments

@roalyr
Copy link

roalyr commented Feb 3, 2023

Describe the project you are working on

Making GDTLancer, and I tend to rename nodes in a way that name is indicative of data (i.e. star size).
And I am actually copying it all from a spreadsheet.

Describe the problem or limitation you are having in your project

image

An example of entering an invalid name symbol (dot):
image

Results to:
image

Would be better this way:
image

Describe the feature / enhancement and how it helps to overcome the problem or limitation

See above.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

It will put underscores in place of illegal symbols in node names, instead of just removing them.

If this enhancement will not be used often, can it be worked around with a few lines of script?

Otherwise it should be done manually.

Is there a reason why this should be core and not an add-on in the asset library?

I assume it is a matter of adding a singe symbol in the code where it handles the node names and replaces illegal symbols with empty character, but I don't know where it is to adjust it myself.

@Calinou Calinou changed the title Invalid node name symbols to be replaced with underscore "_" Replce invalid node name symbols with an underscore instead of nothing Feb 3, 2023
@dalexeev
Copy link
Member

dalexeev commented Feb 3, 2023

Related: godotengine/godot#67701. Curiously, the current behavior of validate_identifier() is to replace rather than remove an invalid character, unlike validate_node_name(). Removal is the most straightforward option, unlike replacement. If several characters in a row are invalid, should they be replaced with several _ or one? Should it be possible to specify a different replacement character?

If you're generating these names with code, then what's the problem with replacing . with _ before assigning a name?

@YuriSizov YuriSizov changed the title Replce invalid node name symbols with an underscore instead of nothing Replace invalid node name symbols with an underscore instead of nothing Feb 3, 2023
@roalyr
Copy link
Author

roalyr commented Feb 4, 2023

I have pondered this issue a while ago, because I have a document archive in which I am trying to sanitize names prior to backing it up, and honestly - I haven't figured out what is the best way to do it.

If you're generating these names with code, then what's the problem with replacing . with _ before assigning a name?

It is not like that. I am just copying values from spreadsheet manually, and renaming things manually too.
I know I can pre-format the fields to ease it up otherwise, but it is just weird that invalid characters are not replaced with placeholders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants