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

Alembic Exports: Do not force a preroll starting at frame 0 #151

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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