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

Adding unit test for AETemplate #3297

Merged
merged 4 commits into from
Sep 14, 2023
Merged

Conversation

seando-adsk
Copy link
Collaborator

New unit test that attempts to find when an error exists in the AE template which prevents it from being loaded correctly. When this happens the AE for USD prims will contain no frame sections, no metadata and all attributes are listed one after another.

@seando-adsk seando-adsk added the unit test Related to unit tests (both python or c++) label Aug 24, 2023
Comment on lines +47 to +68
def searchForMayaControl(self, controlOrLayout, mayaControlCmd, labelToFind):
'''Helper function to search for a Maya control or layout with the label
matching the input string <p labelToFind>. The type of the control being
searched for is also given as input <p mayaControlCmd>.
'''
if mayaControlCmd(controlOrLayout, exists=True):
if mayaControlCmd(controlOrLayout, q=True, label=True) == labelToFind:
return controlOrLayout

if controlOrLayout:
childrenOfLayout = cmds.layout(controlOrLayout, q=True, ca=True)
if childrenOfLayout:
for child in childrenOfLayout:
child = controlOrLayout + '|' + child
if cmds.layout(child, exists=True):
foundControl = self.searchForMayaControl(child, mayaControlCmd, labelToFind)
if foundControl:
return foundControl
elif mayaControlCmd(child, exists=True):
if mayaControlCmd(child, q=True, label=True) == labelToFind:
return child
return None
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This function searched thru the layouts in the AE for either a layout (in this case we are searching for frame layout which is used for each section) with a specific name or a control (of a certain type) with a label equal to input name.

Comment on lines +106 to +109
# We should have a frameLayout called 'Capsule' in the template.
# If there is a scripting error in the template, this layout will be missing.
frameLayout = self.searchForMayaControl(startLayout, cmds.frameLayout, 'Capsule')
self.assertIsNotNone(frameLayout, 'Could not find Capsule frameLayout')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Example: there should exist a section called "Capsule"

Comment on lines 111 to 115
# We should also have float slider controls for 'Height' & 'Radius'.
heightControl = self.searchForMayaControl(frameLayout, cmds.floatSliderGrp, 'Height')
self.assertIsNotNone(heightControl, 'Could not find Capsule Height control')
radiusControl = self.searchForMayaControl(frameLayout, cmds.floatSliderGrp, 'Radius')
self.assertIsNotNone(radiusControl, 'Could not find Capsule Radius control')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

And that Capsule section should have attributes for height/radius.

@seando-adsk seando-adsk added the do-not-merge-yet Development is not finished, PR not ready for merge label Sep 1, 2023
@seando-adsk seando-adsk removed the do-not-merge-yet Development is not finished, PR not ready for merge label Sep 5, 2023
@seando-adsk
Copy link
Collaborator Author

@AramAzhari-adsk Sorry had to make a specific fix for our Maya 2022 gold build (where the AE form layouts are not named the same way).

@seando-adsk seando-adsk merged commit d3411c8 into dev Sep 14, 2023
10 checks passed
@seando-adsk seando-adsk deleted the donnels/add_ae_template_unit_test branch September 14, 2023 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unit test Related to unit tests (both python or c++)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants