-
Notifications
You must be signed in to change notification settings - Fork 202
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
MAYA-104778: Handle two more illegal cases: #659
Conversation
HamedSabri-adsk
commented
Jul 14, 2020
- Spaces are replaced with "_"
- Names are not allowed to start with digits.
- Spaces are replaced with "_" - Names are not allowed to start with digits.
// all special characters are replaced with `_` | ||
const std::string specialChars{"~!@#$%^&*()-=+,.?`':{}|<>[]/"}; | ||
const std::string specialChars{"~!@#$%^&*()-=+,.?`':{}|<>[]/' '"}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space also needs to be replaced with under score.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think you added the space AND the two single quotes, which you don't need because you're in a string. In fact, the single quote is already in your string, so now you have it 3 times...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// names are not allowed to start to digit numbers | ||
if(std::isdigit(_newName.at(0))){ | ||
_newName = prim.GetName(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Names are not allowed to start with digits and should be replaced with the old name. This is based on Natalia's request to match Maya's behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, Maya's behavior is confusing / buggy. Here's what I get when I rename a sphere with a leading numeric:
select -r pSphere1 ;
rename "pSphere1" "1pSphere1";
// Warning: line 1: New name contains invalid characters. Illegal characters were converted to "_". //
// Result: pSphere1 //
Yes, you do get the old name back, but you also get a warning saying "illegal character" will be replaced with an underscore --- and then you don't get the underscore...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, Maya's behavior is confusing / buggy. Here's what I get when I rename a sphere with a leading numeric:
select -r pSphere1 ;
rename "pSphere1" "1pSphere1";
// Warning: line 1: New name contains invalid characters. Illegal characters were converted to "_". //
// Result: pSphere1 //Yes, you do get the old name back, but you also get a warning saying "illegal character" will be replaced with an underscore --- and then you don't get the underscore...
@ppt-adsk Can't agree more. I have noticed this as well and it is very confusing.
I've already brought this up with design team and not really sure if we want to mimic exactly how Maya's handling all these cases.
My main goal for now is to prevent Maya crash when illegal characters are used in names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O.K., fair enough, so for now, no crash, but no warning, and no underscore. Works for me.
// names are not allowed to start to digit numbers | ||
if(std::isdigit(_newName.at(0))){ | ||
_newName = prim.GetName(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, Maya's behavior is confusing / buggy. Here's what I get when I rename a sphere with a leading numeric:
select -r pSphere1 ;
rename "pSphere1" "1pSphere1";
// Warning: line 1: New name contains invalid characters. Illegal characters were converted to "_". //
// Result: pSphere1 //
Yes, you do get the old name back, but you also get a warning saying "illegal character" will be replaced with an underscore --- and then you don't get the underscore...
// all special characters are replaced with `_` | ||
const std::string specialChars{"~!@#$%^&*()-=+,.?`':{}|<>[]/"}; | ||
const std::string specialChars{"~!@#$%^&*()-=+,.?`':{}|<>[]/' '"}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think you added the space AND the two single quotes, which you don't need because you're in a string. In fact, the single quote is already in your string, so now you have it 3 times...
// names are not allowed to start to digit numbers | ||
if(std::isdigit(_newName.at(0))){ | ||
_newName = prim.GetName(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O.K., fair enough, so for now, no crash, but no warning, and no underscore. Works for me.