-
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
Adding unit test for AETemplate #3297
Conversation
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 |
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.
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.
# 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') |
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.
Example: there should exist a section called "Capsule"
# 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') |
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.
And that Capsule section should have attributes for height/radius.
@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). |
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.