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

Fix naming a prim to something that contains an invalid character crashes Maya #628

Merged
merged 4 commits into from
Jul 7, 2020

Conversation

HamedSabri-adsk
Copy link
Contributor

No description provided.

Copy link

@kxl-adsk kxl-adsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a regression test for illegal characters rename.

@kxl-adsk kxl-adsk added ufe-usd Related to UFE-USD plugin in Maya-Usd workflows Related to in-context workflows and removed core Related to core library labels Jul 7, 2020
Copy link
Collaborator

@ppt-adsk ppt-adsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, as per Krystian's comment needs a test.

@HamedSabri-adsk
Copy link
Contributor Author

@ppt-adsk @kxl-adsk Done. Please see a1b9cfc

Comment on lines 343 to 344
snIter = iter(ufe.GlobalSelection.get())
pSphereItem = next(snIter)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since rename is UFE v2 only, you can just use Ufe::Selection::front():
pSphereItem = ufe.GlobalSelection.get().front()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ppt-adsk that's nice. Thanks for pointing out.

please see a036874

pSphereItemRenamed = str(pSphereItem.path().back())

# get the prim
usdPrim = stage.GetPrimAtPath('/sphereXform/' + pSphereItemRenamed)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be just
usdPrim = stage.GetPrimAtPath(str(pSphereItem.path().segments[1]))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please see a036874

Comment on lines 355 to 359
# rename
try:
primspec.name = pSphereItemRenamed
except:
print(sys.exc_info()[1])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite sure what this is testing in maya-usd. You are just testing USD primSpec renaming here, essentially, which should be tested in USD.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ppt-adsk I agree. this looks weird indeed. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ppt-adsk please see 2c89935

Copy link
Collaborator

@ppt-adsk ppt-adsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the change, much more relevant.

Copy link

@kxl-adsk kxl-adsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding the test.

@kxl-adsk kxl-adsk merged commit c0280d7 into dev Jul 7, 2020
@kxl-adsk kxl-adsk deleted the sabrih/MAYA-104778/fix_invalid_char_crashes_maya branch July 7, 2020 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ufe-usd Related to UFE-USD plugin in Maya-Usd workflows Related to in-context workflows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants