-
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-108214 - Attributes categorized by schema #964
Merged
kxl-adsk
merged 2 commits into
dev
from
donnels/MAYA-108214/attributes_categorized_by_schema
Dec 4, 2020
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,118 +1,15 @@ | ||
import fnmatch | ||
import ufe | ||
import mayaUsd.ufe | ||
import maya.internal.common.ufe_ae.template as ufeAeTemplate | ||
|
||
from pxr import UsdGeom, UsdShade | ||
|
||
# Base template class that can be used by other templates. | ||
class AEBaseTemplate(ufeAeTemplate.Template): | ||
def __init__(self, ufeSceneItem): | ||
# Get the UFE Attributes interface for this scene item. | ||
self.attrS = ufe.Attributes.attributes(ufeSceneItem) | ||
super(AEBaseTemplate, self).__init__(ufeSceneItem) | ||
|
||
def createSection(self, layoutName, attrList, collapse=False): | ||
# We create the section named "layoutName" if at least one | ||
# of the attributes from the input list exists. | ||
for attr in attrList: | ||
if self.attrS.hasAttribute(attr): | ||
with ufeAeTemplate.Layout(self, layoutName, collapse): | ||
# Note: addControls will silently skip any attributes | ||
# which does not exist. | ||
self.addControls(attrList) | ||
return | ||
|
||
def createTransformAttributesSection(self): | ||
# Get the xformOp order and add those attributes (in order) | ||
# followed by the xformOp order attribute. | ||
prim = mayaUsd.ufe.getPrimFromRawItem(self.item.getRawAddress()) | ||
geomX = UsdGeom.Xformable(prim) | ||
xformOps = geomX.GetOrderedXformOps() | ||
xformOpOrderNames = [op.GetOpName() for op in xformOps] | ||
xformOpOrderNames.append(UsdGeom.Tokens.xformOpOrder) | ||
# Don't use createSection because we want a sub-section for Unused. | ||
with ufeAeTemplate.Layout(self, 'Transform Attributes'): | ||
self.addControls(xformOpOrderNames) | ||
|
||
# Get the remainder of the xformOps and add them in an Unused section. | ||
allAttrs = self.attrS.attributeNames | ||
xformOpUnusedNames = fnmatch.filter(allAttrs, 'xformOp:*') | ||
xformOpUnusedNames = [ele for ele in xformOpUnusedNames if ele not in xformOpOrderNames] | ||
self.createSection('Unused Transform Attributes', xformOpUnusedNames, collapse=True) | ||
|
||
def buildUI(self, ufeSceneItem): | ||
# Create all the various sections. | ||
# TODO: translate the section names. | ||
self.createSection('Prim', | ||
[UsdGeom.Tokens.proxyPrim, | ||
UsdGeom.Tokens.purpose, | ||
UsdGeom.Tokens.extent, | ||
UsdShade.Tokens.infoId, | ||
UsdShade.Tokens.infoImplementationSource] | ||
) | ||
|
||
self.createTransformAttributesSection() | ||
|
||
self.createSection('Mesh Component Display', | ||
[UsdGeom.Tokens.doubleSided, | ||
UsdGeom.Tokens.primvarsDisplayColor, | ||
UsdGeom.Tokens.primvarsDisplayOpacity, | ||
UsdGeom.Tokens.orientation, | ||
UsdGeom.Tokens.faceVaryingLinearInterpolation] | ||
) | ||
|
||
self.createSection('Display', | ||
[UsdGeom.Tokens.visibility] | ||
) | ||
|
||
self.createSection('Smooth Mesh', | ||
[UsdGeom.Tokens.cornerIndices, | ||
UsdGeom.Tokens.cornerSharpnesses, | ||
UsdGeom.Tokens.creaseIndices, | ||
UsdGeom.Tokens.creaseLengths, | ||
UsdGeom.Tokens.creaseSharpnesses, | ||
UsdGeom.Tokens.interpolateBoundary] | ||
) | ||
|
||
self.createSection('Open Subdiv Controls', | ||
[UsdGeom.Tokens.subdivisionScheme, | ||
UsdGeom.Tokens.triangleSubdivisionRule] | ||
) | ||
|
||
self.createSection('Components', | ||
[UsdGeom.Tokens.points, | ||
UsdGeom.Tokens.normals, | ||
UsdGeom.Tokens.faceVertexCounts, | ||
UsdGeom.Tokens.faceVertexIndices, | ||
UsdGeom.Tokens.holeIndices, | ||
UsdGeom.Tokens.accelerations, | ||
UsdGeom.Tokens.velocities] | ||
) | ||
|
||
self.createSection('Common Material Attributes', | ||
[UsdShade.Tokens.outputsSurface, | ||
UsdShade.Tokens.outputsVolume, | ||
UsdShade.Tokens.outputsDisplacement, | ||
'inputs:diffuseColor', | ||
'inputs:emissiveColor'] | ||
) | ||
|
||
self.createSection('Camera Attributes', | ||
[UsdGeom.Tokens.projection, | ||
UsdGeom.Tokens.focalLength, | ||
UsdGeom.Tokens.clippingPlanes, | ||
UsdGeom.Tokens.clippingRange] | ||
) | ||
|
||
self.createSection('Film Back', | ||
[UsdGeom.Tokens.horizontalAperture, | ||
UsdGeom.Tokens.horizontalApertureOffset, | ||
UsdGeom.Tokens.verticalAperture, | ||
UsdGeom.Tokens.verticalApertureOffset] | ||
) | ||
|
||
self.createSection('Depth of Field', | ||
[UsdGeom.Tokens.focusDistance, | ||
UsdGeom.Tokens.fStop] | ||
) | ||
# This template file is no longer required for Maya PR 121. | ||
# It will eventually be removed. | ||
import mayaUtils | ||
if mayaUtils.previewReleaseVersion() < 121: | ||
import ufe_ae.usd.nodes.usdschemabase.ae_template as UsdSchemaBaseAETemplate | ||
|
||
# Base template class that can be used by other templates. | ||
# Nov 2020: New schema base template. Eventually we will | ||
# remove the specific node and this base template. | ||
class AEBaseTemplate(UsdSchemaBaseAETemplate.AETemplate): | ||
def __init__(self, ufeSceneItem): | ||
super(AEBaseTemplate, self).__init__(ufeSceneItem) | ||
|
||
def buildUI(self, ufeSceneItem): | ||
super(AEBaseTemplate, self).buildUI(ufeSceneItem) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've moved all the code from this base to the new "usdschemabase". This base template now derives from the usdschemabase (line 10). I've also made all these templates non-loadable for Maya PR 121 or later. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
import ufe | ||
import ufe_ae.usd.nodes.base.ae_template as UfeAeBaseTemplate | ||
# This template file is no longer required for Maya PR 121. | ||
# It will eventually be removed. | ||
import mayaUtils | ||
if mayaUtils.previewReleaseVersion() < 121: | ||
import ufe | ||
import ufe_ae.usd.nodes.base.ae_template as UfeAeBaseTemplate | ||
|
||
from pxr import UsdGeom | ||
from pxr import UsdGeom | ||
|
||
# This class must be named "AETemplate" | ||
class AETemplate(UfeAeBaseTemplate.AEBaseTemplate): | ||
def __init__(self, ufeSceneItem): | ||
super(AETemplate, self).__init__(ufeSceneItem) | ||
# This class must be named "AETemplate" | ||
class AETemplate(UfeAeBaseTemplate.AEBaseTemplate): | ||
def __init__(self, ufeSceneItem): | ||
super(AETemplate, self).__init__(ufeSceneItem) | ||
|
||
def buildUI(self, ufeSceneItem): | ||
super(AETemplate, self).buildUI(ufeSceneItem) | ||
def buildUI(self, ufeSceneItem): | ||
super(AETemplate, self).buildUI(ufeSceneItem) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
import ufe | ||
import ufe_ae.usd.nodes.base.ae_template as UfeAeBaseTemplate | ||
# This template file is no longer required for Maya PR 121. | ||
# It will eventually be removed. | ||
import mayaUtils | ||
if mayaUtils.previewReleaseVersion() < 121: | ||
import ufe | ||
import ufe_ae.usd.nodes.base.ae_template as UfeAeBaseTemplate | ||
|
||
from pxr import UsdGeom | ||
from pxr import UsdGeom | ||
|
||
# This class must be named "AETemplate" | ||
class AETemplate(UfeAeBaseTemplate.AEBaseTemplate): | ||
def __init__(self, ufeSceneItem): | ||
super(AETemplate, self).__init__(ufeSceneItem) | ||
# This class must be named "AETemplate" | ||
class AETemplate(UfeAeBaseTemplate.AEBaseTemplate): | ||
def __init__(self, ufeSceneItem): | ||
super(AETemplate, self).__init__(ufeSceneItem) | ||
|
||
def buildUI(self, ufeSceneItem): | ||
super(AETemplate, self).buildUI(ufeSceneItem) | ||
def buildUI(self, ufeSceneItem): | ||
super(AETemplate, self).buildUI(ufeSceneItem) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
import ufe | ||
import ufe_ae.usd.nodes.base.ae_template as UfeAeBaseTemplate | ||
# This template file is no longer required for Maya PR 121. | ||
# It will eventually be removed. | ||
import mayaUtils | ||
if mayaUtils.previewReleaseVersion() < 121: | ||
import ufe | ||
import ufe_ae.usd.nodes.base.ae_template as UfeAeBaseTemplate | ||
|
||
from pxr import UsdGeom | ||
from pxr import UsdGeom | ||
|
||
# This class must be named "AETemplate" | ||
class AETemplate(UfeAeBaseTemplate.AEBaseTemplate): | ||
def __init__(self, ufeSceneItem): | ||
super(AETemplate, self).__init__(ufeSceneItem) | ||
# This class must be named "AETemplate" | ||
class AETemplate(UfeAeBaseTemplate.AEBaseTemplate): | ||
def __init__(self, ufeSceneItem): | ||
super(AETemplate, self).__init__(ufeSceneItem) | ||
|
||
def buildUI(self, ufeSceneItem): | ||
super(AETemplate, self).buildUI(ufeSceneItem) | ||
def buildUI(self, ufeSceneItem): | ||
super(AETemplate, self).buildUI(ufeSceneItem) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
import ufe | ||
import ufe_ae.usd.nodes.base.ae_template as UfeAeBaseTemplate | ||
# This template file is no longer required for Maya PR 121. | ||
# It will eventually be removed. | ||
import mayaUtils | ||
if mayaUtils.previewReleaseVersion() < 121: | ||
import ufe | ||
import ufe_ae.usd.nodes.base.ae_template as UfeAeBaseTemplate | ||
|
||
from pxr import UsdGeom | ||
from pxr import UsdGeom | ||
|
||
# This class must be named "AETemplate" | ||
class AETemplate(UfeAeBaseTemplate.AEBaseTemplate): | ||
def __init__(self, ufeSceneItem): | ||
super(AETemplate, self).__init__(ufeSceneItem) | ||
# This class must be named "AETemplate" | ||
class AETemplate(UfeAeBaseTemplate.AEBaseTemplate): | ||
def __init__(self, ufeSceneItem): | ||
super(AETemplate, self).__init__(ufeSceneItem) | ||
|
||
def buildUI(self, ufeSceneItem): | ||
super(AETemplate, self).buildUI(ufeSceneItem) | ||
def buildUI(self, ufeSceneItem): | ||
super(AETemplate, self).buildUI(ufeSceneItem) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
import ufe | ||
import ufe_ae.usd.nodes.base.ae_template as UfeAeBaseTemplate | ||
# This template file is no longer required for Maya PR 121. | ||
# It will eventually be removed. | ||
import mayaUtils | ||
if mayaUtils.previewReleaseVersion() < 121: | ||
import ufe | ||
import ufe_ae.usd.nodes.base.ae_template as UfeAeBaseTemplate | ||
|
||
from pxr import UsdGeom | ||
from pxr import UsdGeom | ||
|
||
# This class must be named "AETemplate" | ||
class AETemplate(UfeAeBaseTemplate.AEBaseTemplate): | ||
def __init__(self, ufeSceneItem): | ||
super(AETemplate, self).__init__(ufeSceneItem) | ||
# This class must be named "AETemplate" | ||
class AETemplate(UfeAeBaseTemplate.AEBaseTemplate): | ||
def __init__(self, ufeSceneItem): | ||
super(AETemplate, self).__init__(ufeSceneItem) | ||
|
||
def buildUI(self, ufeSceneItem): | ||
super(AETemplate, self).buildUI(ufeSceneItem) | ||
def buildUI(self, ufeSceneItem): | ||
super(AETemplate, self).buildUI(ufeSceneItem) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
import ufe | ||
import ufe_ae.usd.nodes.base.ae_template as UfeAeBaseTemplate | ||
# This template file is no longer required for Maya PR 121. | ||
# It will eventually be removed. | ||
import mayaUtils | ||
if mayaUtils.previewReleaseVersion() < 121: | ||
import ufe | ||
import ufe_ae.usd.nodes.base.ae_template as UfeAeBaseTemplate | ||
|
||
from pxr import UsdGeom | ||
from pxr import UsdGeom | ||
|
||
# This class must be named "AETemplate" | ||
class AETemplate(UfeAeBaseTemplate.AEBaseTemplate): | ||
def __init__(self, ufeSceneItem): | ||
super(AETemplate, self).__init__(ufeSceneItem) | ||
# This class must be named "AETemplate" | ||
class AETemplate(UfeAeBaseTemplate.AEBaseTemplate): | ||
def __init__(self, ufeSceneItem): | ||
super(AETemplate, self).__init__(ufeSceneItem) | ||
|
||
def buildUI(self, ufeSceneItem): | ||
super(AETemplate, self).buildUI(ufeSceneItem) | ||
def buildUI(self, ufeSceneItem): | ||
super(AETemplate, self).buildUI(ufeSceneItem) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
import ufe | ||
import ufe_ae.usd.nodes.base.ae_template as UfeAeBaseTemplate | ||
# This template file is no longer required for Maya PR 121. | ||
# It will eventually be removed. | ||
import mayaUtils | ||
if mayaUtils.previewReleaseVersion() < 121: | ||
import ufe | ||
import ufe_ae.usd.nodes.base.ae_template as UfeAeBaseTemplate | ||
|
||
from pxr import UsdGeom | ||
from pxr import UsdGeom | ||
|
||
# This class must be named "AETemplate" | ||
class AETemplate(UfeAeBaseTemplate.AEBaseTemplate): | ||
def __init__(self, ufeSceneItem): | ||
super(AETemplate, self).__init__(ufeSceneItem) | ||
# This class must be named "AETemplate" | ||
class AETemplate(UfeAeBaseTemplate.AEBaseTemplate): | ||
def __init__(self, ufeSceneItem): | ||
super(AETemplate, self).__init__(ufeSceneItem) | ||
|
||
def buildUI(self, ufeSceneItem): | ||
super(AETemplate, self).buildUI(ufeSceneItem) | ||
def buildUI(self, ufeSceneItem): | ||
super(AETemplate, self).buildUI(ufeSceneItem) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
import ufe | ||
import ufe_ae.usd.nodes.base.ae_template as UfeAeBaseTemplate | ||
# This template file is no longer required for Maya PR 121. | ||
# It will eventually be removed. | ||
import mayaUtils | ||
if mayaUtils.previewReleaseVersion() < 121: | ||
import ufe | ||
import ufe_ae.usd.nodes.base.ae_template as UfeAeBaseTemplate | ||
|
||
from pxr import UsdGeom | ||
from pxr import UsdGeom | ||
|
||
# This class must be named "AETemplate" | ||
class AETemplate(UfeAeBaseTemplate.AEBaseTemplate): | ||
def __init__(self, ufeSceneItem): | ||
super(AETemplate, self).__init__(ufeSceneItem) | ||
# This class must be named "AETemplate" | ||
class AETemplate(UfeAeBaseTemplate.AEBaseTemplate): | ||
def __init__(self, ufeSceneItem): | ||
super(AETemplate, self).__init__(ufeSceneItem) | ||
|
||
def buildUI(self, ufeSceneItem): | ||
super(AETemplate, self).buildUI(ufeSceneItem) | ||
def buildUI(self, ufeSceneItem): | ||
super(AETemplate, self).buildUI(ufeSceneItem) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
import ufe | ||
import ufe_ae.usd.nodes.base.ae_template as UfeAeBaseTemplate | ||
# This template file is no longer required for Maya PR 121. | ||
# It will eventually be removed. | ||
import mayaUtils | ||
if mayaUtils.previewReleaseVersion() < 121: | ||
import ufe | ||
import ufe_ae.usd.nodes.base.ae_template as UfeAeBaseTemplate | ||
|
||
from pxr import UsdGeom | ||
from pxr import UsdGeom | ||
|
||
# This class must be named "AETemplate" | ||
class AETemplate(UfeAeBaseTemplate.AEBaseTemplate): | ||
def __init__(self, ufeSceneItem): | ||
super(AETemplate, self).__init__(ufeSceneItem) | ||
# This class must be named "AETemplate" | ||
class AETemplate(UfeAeBaseTemplate.AEBaseTemplate): | ||
def __init__(self, ufeSceneItem): | ||
super(AETemplate, self).__init__(ufeSceneItem) | ||
|
||
def buildUI(self, ufeSceneItem): | ||
super(AETemplate, self).buildUI(ufeSceneItem) | ||
def buildUI(self, ufeSceneItem): | ||
super(AETemplate, self).buildUI(ufeSceneItem) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The new single python template since all schemas end up deriving from UsdSchemaBase. So the new ufe template inheritance loading (changes in Maya) will always find this file.