Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Maya: abc options for Pointcache/Animation family - OP-5920 #5173

Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
e19e7e1
initial working version of abc options.
tokejepsen Jun 21, 2023
d87e64e
Docs
tokejepsen Jun 22, 2023
c07729d
Hound
tokejepsen Jun 22, 2023
e4a7641
Backwards compatibility attributes.
tokejepsen Jun 22, 2023
cda9089
Debug logging
tokejepsen Jun 22, 2023
1a5201a
Remove redundant code.
tokejepsen Jun 22, 2023
0342870
Failsafe
tokejepsen Jun 22, 2023
fab76c6
Ensure includeUserDefinedAttributes gets correct value
tokejepsen Jun 22, 2023
9923328
Update openpype/hosts/maya/plugins/publish/collect_pointcache.py
tokejepsen Jun 23, 2023
b601aa6
Hound
tokejepsen Jun 23, 2023
b63f5c5
Ensure list arguments are valid
tokejepsen Jun 28, 2023
e722fbe
BigRoy feedback
tokejepsen Jun 28, 2023
38be2be
Fix list arguments.
tokejepsen Jul 3, 2023
5aa5215
Working animation family
tokejepsen Jul 4, 2023
2f8dafd
Hound
tokejepsen Jul 4, 2023
e447e6a
Initial working animation family
tokejepsen Jul 6, 2023
db3dac4
Merge branch 'develop' into enhancement/OP-5920_abc-options-for-Point…
tokejepsen Jul 13, 2023
9ac4017
Working pointcache
tokejepsen Jul 14, 2023
c1e771b
Revert post_imprint
tokejepsen Jul 14, 2023
9887035
Combine CreateAnimation and CreatePointCache
tokejepsen Jul 14, 2023
711fe5d
Merge branch 'develop' into enhancement/OP-5920_abc-options-for-Point…
tokejepsen Aug 22, 2023
eafe2d0
Working merge of develop
tokejepsen Aug 22, 2023
7d1f009
Working hidden animation creator
tokejepsen Aug 22, 2023
d8ee0a6
Merge branch 'develop' into enhancement/OP-5920_abc-options-for-Point…
tokejepsen Aug 22, 2023
178f184
Merge branch 'develop' into enhancement/OP-5920_abc-options-for-Point…
tokejepsen Sep 1, 2023
fcf1c1e
Fix writeNormals
tokejepsen Sep 1, 2023
ee8b230
Remove redundant code.
tokejepsen Sep 1, 2023
de5c1ce
Add tooltip to preRollStartFrame
tokejepsen Sep 1, 2023
af6f157
Merge branch 'develop' into enhancement/OP-5920_abc-options-for-Point…
tokejepsen Sep 18, 2023
7f152b9
Sync with develop plugin.py
tokejepsen Sep 18, 2023
99f7191
Merge origin/develop
Minkiu Nov 13, 2023
bb8b4c1
`maya` Define Alembic attributes as enums
Minkiu Nov 13, 2023
14fc3ab
`maya` Display Alembic settings for Animation
Minkiu Nov 14, 2023
f4be711
`maya.api.alembic` Move all the Alembic methods into it's own
Minkiu Nov 14, 2023
38a3ea4
`maya.api.alembic` Alphabetically order arguments
Minkiu Nov 14, 2023
6363064
`maya` Rename Alemebic settings, update `pointcache` creator
Minkiu Nov 14, 2023
3a14c8e
`maya.publish.pointcache` Use the `api.alembic` instead of `lib`
Minkiu Nov 14, 2023
33784f7
`maya.api.alembic` Fix missing `cmds` import
Minkiu Nov 15, 2023
fca2442
`maya.plugin.pointcache` Rework settings names
Minkiu Nov 15, 2023
608c7eb
`maya.extract_pointcache` Adapt to new settings
Minkiu Nov 15, 2023
2427477
Merge branch 'develop' into enhancement/OP-5920_abc-options-for-Point…
Minkiu Nov 15, 2023
70e4883
`maya.api.alembic` Fix missing imports
Minkiu Nov 15, 2023
c379e7f
`maya.create_animation_pointcache` Fix publisher widgets population
Minkiu Nov 15, 2023
b0ab45b
Merge remote-tracking branch 'origin/develop' into enhancement/OP-592…
Minkiu Nov 20, 2023
e700f28
`maya.publish.pointcache` Log out the Alembic argumetns used.
Minkiu Nov 20, 2023
5935ef5
`maya.create_animation_pointcache` Ensure we set defaults
Minkiu Nov 20, 2023
326c210
`schemas.maya.create` Remove `stripNameSpaces` setting
Minkiu Nov 21, 2023
ca7998e
`maya.settings` Add AYON settings for Animation and PointCache
Minkiu Nov 21, 2023
0e905f3
`maya` Fix faulty logic in pointcache creator
Minkiu Dec 12, 2023
cd26a89
Merge branch 'develop' into enhancement/OP-5920_abc-options-for-Point…
Minkiu Dec 12, 2023
f2f8345
`maya.create_animation_pointcache` Ensure there are `maya_cached_subs…
Minkiu Jan 4, 2024
749b3b4
`maya.create_animation_pointcache` Fix `_ensure_defaults` logic
Minkiu Jan 15, 2024
afc7967
`maya.creat_pointcache` Fix boolean arguments not being correctly par…
Minkiu Jan 15, 2024
a9fbb68
Merge branch 'develop' into enhancement/OP-5920_abc-options-for-Point…
Minkiu Jan 31, 2024
97e8ccd
`server_addons.maya` Fix creator settings using legacy `Field`
Minkiu Jan 31, 2024
8c999fb
`server_addons.maya` Fix creator settings using legacy `Field`
Minkiu Jan 31, 2024
8e284aa
`settings.maya` Rename Alembic settings
Minkiu Jan 31, 2024
2652397
`maya.plugins.pointcache` Fix togglable flags defaults and adapt to n…
Minkiu Jan 31, 2024
76a6e2e
`maya.plugins` Fix create pointcache and apply format
Minkiu Jan 31, 2024
534bc82
`server_addons.maya.settings` fix missing `Literal` type in creators
Minkiu Feb 1, 2024
43bbf5a
`server_addons.maya.settings` Fix missing `creator` defaults
Minkiu Feb 1, 2024
87b3d7f
`hosts.maya.create` Ensure we get a `set` in `abc_args_overrides` in …
Minkiu Feb 1, 2024
698e5db
Working version of attributes on extractor
tokejepsen Feb 20, 2024
4e8ea03
Tidy up changes.
tokejepsen Feb 20, 2024
70982d9
Backwards compatibility wip
tokejepsen Feb 20, 2024
64b366c
Backwards compatibility
tokejepsen Feb 21, 2024
05dd980
Revert AYON settings
tokejepsen Feb 21, 2024
c123e83
revert ayon settings
tokejepsen Feb 21, 2024
8fee7b5
Merge branch 'develop' into enhancement/OP-5920_abc-options-for-Point…
LiborBatek Feb 22, 2024
1f1d7c3
Missing writeNormals flag
tokejepsen Feb 22, 2024
242ea77
Merge branch 'develop' into enhancement/OP-5920_abc-options-for-Point…
LiborBatek Feb 26, 2024
0c40340
Merge branch 'develop' into enhancement/OP-5920_abc-options-for-Point…
LiborBatek Mar 5, 2024
59c0079
Merge branch 'develop' into enhancement/OP-5920_abc-options-for-Point…
tokejepsen Mar 7, 2024
2e76f27
Change labels and export_overrides key
tokejepsen Mar 7, 2024
370e422
Fix plugin
tokejepsen Mar 7, 2024
3def9fe
Validate alembic options defaults
tokejepsen Mar 28, 2024
b645c62
Hound
tokejepsen Mar 28, 2024
50ff436
Merge branch 'develop' into enhancement/OP-5920_abc-options-for-Point…
antirotor Apr 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 110 additions & 27 deletions openpype/hosts/maya/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import os
from pprint import pformat
import sys
import platform
import uuid
import re

Expand Down Expand Up @@ -98,6 +97,7 @@
"renderableOnly": bool,
"step": float,
"stripNamespaces": bool,
"verbose": bool,
"uvWrite": bool,
"wholeFrameGeo": bool,
"worldSpace": bool,
Expand All @@ -115,7 +115,9 @@
"melPostJobCallback": str,
"pythonPerFrameCallback": str,
"pythonPostJobCallback": str,
"selection": bool
"selection": bool,
"preRoll": bool,
"preRollStartFrame": int
}

INT_FPS = {15, 24, 25, 30, 48, 50, 60, 44100, 48000}
Expand Down Expand Up @@ -1083,12 +1085,28 @@ def is_visible(node,
def extract_alembic(file,
startFrame=None,
endFrame=None,
frameRange="",
eulerFilter=True,
noNormals=False,
preRoll=False,
renderableOnly=False,
selection=True,
uvWrite=True,
eulerFilter=True,
writeColorSets=False,
writeFaceSets=False,
wholeFrameGeo=False,
worldSpace=False,
writeVisibility=False,
writeUVSets=False,
writeCreases=False,
dataFormat="ogawa",
step=1.0,
attr=None,
attrPrefix=None,
root=None,
stripNamespaces=True,
verbose=False,
**kwargs):
preRollStartFrame=0):
"""Extract a single Alembic Cache.

This extracts an Alembic cache using the `-selection` flag to minimize
Expand All @@ -1106,37 +1124,87 @@ def extract_alembic(file,
string formatted as: "startFrame endFrame". This argument
overrides `startFrame` and `endFrame` arguments.

dataFormat (str): The data format to use for the cache,
defaults to "ogawa"

verbose (bool): When on, outputs frame number information to the
Script Editor or output window during extraction.
eulerFilter (bool): When on, X, Y, and Z rotation data is filtered with
an Euler filter. Euler filtering helps resolve irregularities in
rotations especially if X, Y, and Z rotations exceed 360 degrees.
Defaults to True.

noNormals (bool): When on, normal data from the original polygon
objects is not included in the exported Alembic cache file.

preRoll (bool): This frame range will not be sampled.
Defaults to False.

renderableOnly (bool): When on, any non-renderable nodes or hierarchy,
such as hidden objects, are not included in the Alembic file.
Defaults to False.

stripNamespaces (bool): When on, any namespaces associated with the
exported objects are removed from the Alembic file. For example, an
object with the namespace taco:foo:bar appears as bar in the
Alembic file.
selection (bool): Write out all all selected nodes from the
active selection list that are descendents of the roots specified
with -root. Defaults to False.

uvWrite (bool): When on, UV data from polygon meshes and subdivision
objects are written to the Alembic file. Only the current UV map is
included.

writeColorSets (bool): Write all color sets on MFnMeshes as
color 3 or color 4 indexed geometry parameters with face varying
scope. Defaults to False.

writeFaceSets (bool): Write all Face sets on MFnMeshes.
Defaults to False.

wholeFrameGeo (bool): Data for geometry will only be written
out on whole frames. Defaults to False.

worldSpace (bool): When on, the top node in the node hierarchy is
stored as world space. By default, these nodes are stored as local
space. Defaults to False.

eulerFilter (bool): When on, X, Y, and Z rotation data is filtered with
an Euler filter. Euler filtering helps resolve irregularities in
rotations especially if X, Y, and Z rotations exceed 360 degrees.
Defaults to True.
writeVisibility (bool): Visibility state will be stored in
the Alembic file. Otherwise everything written out is treated as
visible. Defaults to False.

writeUVSets (bool): Write all uv sets on MFnMeshes as vector
2 indexed geometry parameters with face varying scope. Defaults to
False.

writeCreases (bool): If the mesh has crease edges or crease
vertices, the mesh (OPolyMesh) would now be written out as an OSubD
and crease info will be stored in the Alembic file. Otherwise,
creases info won't be preserved in Alembic file unless a custom
Boolean attribute SubDivisionMesh has been added to mesh node and
its value is true. Defaults to False.

dataFormat (str): The data format to use for the cache,
defaults to "ogawa"

step (float): The time interval (expressed in frames) at
which the frame range is sampled. Additional samples around each
frame can be specified with -frs. Defaults to 1.0.

attr (list of str, optional): A specific geometric attribute to write
out. Defaults to [].

attrPrefix (list of str, optional): Prefix filter for determining which
geometric attributes to write out. Defaults to ["ABC_"].

root (list of str): Maya dag path which will be parented to
the root of the Alembic file. Defaults to [], which means the
entire scene will be written out.

stripNamespaces (bool): When on, any namespaces associated with the
exported objects are removed from the Alembic file. For example, an
object with the namespace taco:foo:bar appears as bar in the
Alembic file.

verbose (bool): When on, outputs frame number information to the
Script Editor or output window during extraction.

preRollStartFrame (float): The frame to start scene
evaluation at. This is used to set the starting frame for time
dependent translations and can be used to evaluate run-up that
isn't actually translated. Defaults to 0.
BigRoy marked this conversation as resolved.
Show resolved Hide resolved
"""

# Ensure alembic exporter is loaded
Expand All @@ -1147,7 +1215,7 @@ def extract_alembic(file,

# Pass the start and end frame on as `frameRange` so that it
# never conflicts with that argument
if "frameRange" not in kwargs:
if not frameRange:
# Fallback to maya timeline if no start or end frame provided.
if startFrame is None:
startFrame = cmds.playbackOptions(query=True,
Expand All @@ -1159,23 +1227,38 @@ def extract_alembic(file,
# Ensure valid types are converted to frame range
assert isinstance(startFrame, _alembic_options["startFrame"])
assert isinstance(endFrame, _alembic_options["endFrame"])
kwargs["frameRange"] = "{0} {1}".format(startFrame, endFrame)
frameRange = "{0} {1}".format(startFrame, endFrame)
else:
# Allow conversion from tuple for `frameRange`
frame_range = kwargs["frameRange"]
if isinstance(frame_range, (list, tuple)):
assert len(frame_range) == 2
kwargs["frameRange"] = "{0} {1}".format(frame_range[0],
frame_range[1])
if isinstance(frameRange, (list, tuple)):
assert len(frameRange) == 2
frameRange = "{0} {1}".format(frameRange[0], frameRange[1])
tokejepsen marked this conversation as resolved.
Show resolved Hide resolved

# Assemble options
options = {
"selection": selection,
"uvWrite": uvWrite,
"frameRange": frameRange,
"eulerFilter": eulerFilter,
"dataFormat": dataFormat
"noNormals": noNormals,
"preRoll": preRoll,
"renderableOnly": renderableOnly,
"selection": selection,
"uvWrite": uvWrite,
"writeColorSets": writeColorSets,
"writeFaceSets": writeFaceSets,
"wholeFrameGeo": wholeFrameGeo,
"worldSpace": worldSpace,
"writeVisibility": writeVisibility,
"writeUVSets": writeUVSets,
"writeCreases": writeCreases,
"dataFormat": dataFormat,
"step": step,
"attr": attr,
"attrPrefix": attrPrefix,
"stripNamespaces": stripNamespaces,
"verbose": verbose,
"preRollStartFrame": preRollStartFrame
}
options.update(kwargs)

# Validate options
for key, value in options.copy().items():
Expand Down
87 changes: 54 additions & 33 deletions openpype/hosts/maya/plugins/create/create_animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,44 +17,65 @@ class CreateAnimation(plugin.Creator):
label = "Animation"
family = "animation"
icon = "male"
write_color_sets = False
write_face_sets = False
include_parent_hierarchy = False
include_user_defined_attributes = False
includeUserDefinedAttributes = False
eulerFilter = True
noNormals = False
preRoll = False
renderableOnly = False
uvWrite = True
writeColorSets = False
writeFaceSets = False
wholeFrameGeo = False
worldSpace = True
writeVisibility = True
writeUVSets = True
writeCreases = False
dataFormat = "ogawa"
step = 1.0
attr = ""
attrPrefix = ""
stripNamespaces = True
verbose = False
preRollStartFrame = 0
farm = False
priority = 50
includeParentHierarchy = False # Include parent groups
refresh = False # Default to suspend refresh.
visibleOnly = False # only nodes that are visible
antirotor marked this conversation as resolved.
Show resolved Hide resolved

def __init__(self, *args, **kwargs):
super(CreateAnimation, self).__init__(*args, **kwargs)

# create an ordered dict with the existing data first

# get basic animation data : start / end / handles / steps
for key, value in lib.collect_animation_data().items():
self.data[key] = value

# Write vertex colors with the geometry.
self.data["writeColorSets"] = self.write_color_sets
self.data["writeFaceSets"] = self.write_face_sets

# Include only renderable visible shapes.
# Skips locators and empty transforms
self.data["renderableOnly"] = False

# Include only nodes that are visible at least once during the
# frame range.
self.data["visibleOnly"] = False

# Include the groups above the out_SET content
self.data["includeParentHierarchy"] = self.include_parent_hierarchy

# Default to exporting world-space
self.data["worldSpace"] = True

# Default to not send to farm.
self.data["farm"] = False
self.data["priority"] = 50

# Default to write normals.
self.data["writeNormals"] = True

value = self.include_user_defined_attributes
self.data["includeUserDefinedAttributes"] = value
attrs = [
"includeUserDefinedAttributes",
"eulerFilter",
"noNormals",
"preRoll",
"renderableOnly",
"uvWrite",
"writeColorSets",
"writeFaceSets",
"wholeFrameGeo",
"worldSpace",
"writeVisibility",
"writeUVSets",
"writeCreases",
"dataFormat",
"step",
"attr",
"attrPrefix",
"stripNamespaces",
"verbose",
"preRollStartFrame",
"farm",
"priority",
"includeParentHierarchy",
"refresh",
"visibleOnly"
]
antirotor marked this conversation as resolved.
Show resolved Hide resolved
for attr in attrs:
self.data[attr] = getattr(self, attr)
Loading