Skip to content

Commit

Permalink
Merge pull request #151 from BigRoy/enhancement/maya_extract_alembic_…
Browse files Browse the repository at this point in the history
…prerollstartframe_default

Alembic Exports: Do not force a preroll starting at frame 0
  • Loading branch information
iLLiCiTiT authored Oct 16, 2024
2 parents 96e222d + 1cd1589 commit d93d670
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
9 changes: 4 additions & 5 deletions client/ayon_maya/api/alembic.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"userAttrPrefix": (list, tuple),
"uvWrite": bool,
"uvsOnly": bool,
"verbose": bool,
"wholeFrameGeo": bool,
"worldSpace": bool,
"writeColorSets": bool,
Expand All @@ -57,7 +56,7 @@ def extract_alembic(
melPostJobCallback=None,
noNormals=False,
preRoll=False,
preRollStartFrame=0,
preRollStartFrame=None,
pythonPerFrameCallback=None,
pythonPostJobCallback=None,
renderableOnly=False,
Expand Down Expand Up @@ -119,10 +118,11 @@ def extract_alembic(
preRoll (bool): This frame range will not be sampled.
Defaults to False.
preRollStartFrame (float): The frame to start scene
preRollStartFrame (Optional[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.
isn't actually translated. Defaults to None, meaning no pre-roll
start frame will be used to roll from.
pythonPerFrameCallback (Optional[str]): Python callback run per frame.
Expand Down Expand Up @@ -258,7 +258,6 @@ def extract_alembic(
"userAttr": userAttr,
"userAttrPrefix": userAttrPrefix,
"stripNamespaces": stripNamespaces,
"verbose": verbose
}

# Validate options
Expand Down
23 changes: 23 additions & 0 deletions client/ayon_maya/plugins/publish/extract_pointcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,29 @@ def process(self, instance):
iter_visible_nodes_in_range(nodes, start=start, end=end)
)

# Our logic is that `preroll` means:
# - True: include a preroll from `preRollStartFrame` to the start
# frame that is not included in the exported file. Just 'roll up'
# the export from there.
# - False: do not roll up from `preRollStartFrame`.
# `AbcExport` however approaches this very differently.
# A call to `AbcExport` allows to export multiple "jobs" of frame
# ranges in one go. Using `-preroll` argument there means: this one
# job in the full list of jobs SKIP writing these frames into the
# Alembic. In short, marking that job as just preroll.
# Then additionally, separate from `-preroll` the `AbcExport` command
# allows to supply `preRollStartFrame` which, when not None, means
# always RUN UP from that start frame. Since our `preRollStartFrame`
# is always an integer attribute we will convert the attributes so
# they behave like how we intended them initially
if kwargs["preRoll"]:
# Never mark `preRoll` as True because it would basically end up
# writing no samples at all. We just use this to leave
# `preRollStartFrame` as a number value.
kwargs["preRoll"] = False
else:
kwargs["preRollStartFrame"] = None

shapes = self.get_members_shapes(instance)

suspend = not instance.data.get("refresh", False)
Expand Down

0 comments on commit d93d670

Please sign in to comment.