Skip to content

Commit

Permalink
maya.plugins Fix create pointcache and apply format
Browse files Browse the repository at this point in the history
  • Loading branch information
Minkiu committed Jan 31, 2024
1 parent 2652397 commit 76a6e2e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
20 changes: 9 additions & 11 deletions openpype/hosts/maya/plugins/create/create_animation_pointcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def _get_animation_attr_defs(cls):
BoolDef("refresh", label="Refresh viewport during export"),
BoolDef(
"includeParentHierarchy", label="Include Parent Hierarchy"
)
),
]
)

Expand Down Expand Up @@ -59,16 +59,12 @@ def _get_abc_export_flags(cls):

# Set of all the available Alembic Export Flags
abc_boolean_flags = {
arg
for arg, arg_type in ALEMBIC_ARGS.items()
if arg_type is bool
arg for arg, arg_type in ALEMBIC_ARGS.items() if arg_type is bool
}

# Set of togglable flags
abc_export_toggleable_flags = {
arg
for arg in abc_export_overrides
if arg in abc_boolean_flags
arg for arg in abc_export_overrides if arg in abc_boolean_flags
}
return abc_export_flags, abc_export_toggleable_flags

Expand Down Expand Up @@ -118,19 +114,22 @@ def _get_animation_abc_attr_defs(cls):
multiselection=True,
label="Settings Defined Arguments",
disabled=True,
hidden=True
hidden=True,
)
)

# Only display Boolan flags that the Admin defined as overrideable
abc_export_toggleable_defaults = [
arg
for arg in abc_export_toggleable_flags
if arg in default_abc_export_flags
]
abc_defs.append(
EnumDef(
"abcExportTogglableFlags",
list(abc_export_toggleable_flags) if abc_export_toggleable_flags else [""],
list(abc_export_toggleable_flags)
if abc_export_toggleable_flags
else [""],
default=abc_export_toggleable_defaults,
multiselection=True,
label="Export Flags",
Expand Down Expand Up @@ -224,8 +223,7 @@ def _ensure_defaults(cls, instance_data):
abc_boolean_args = creator_attr["abcExportTogglableFlags"].copy()

creator_attr["abcExportTogglableFlags"] = [
arg for arg in abc_boolean_args
if arg not in abc_boolean_overrides
arg for arg in abc_boolean_args if arg not in abc_boolean_overrides
]

return instance_data
Expand Down
19 changes: 14 additions & 5 deletions openpype/hosts/maya/plugins/publish/extract_pointcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def process(self, instance):
) + creator_attributes.get("abcExportTogglableFlags")

abc_attrs = [
attr.strip() for attr in creator_attributes.get("attr", "").split(";")
attr.strip()
for attr in creator_attributes.get("attr", "").split(";")
]

abc_attr_prefixes = [
Expand Down Expand Up @@ -82,7 +83,9 @@ def process(self, instance):
"eulerFilter": True if "eulerFilter" in abc_flags else False,
"noNormals": True if "noNormals" in abc_flags else False,
"preRoll": True if "preRoll" in abc_flags else False,
"preRollStartFrame": creator_attributes.get("preRollStartFrame", 0),
"preRollStartFrame": creator_attributes.get(
"preRollStartFrame", 0
),
"renderableOnly": True if "renderableOnly" in abc_flags else False,
"root": abc_root,
"selection": True, # Should this stay like so?
Expand All @@ -97,7 +100,9 @@ def process(self, instance):
"writeCreases": True if "writeCreases" in abc_flags else False,
"writeFaceSets": True if "writeFaceSets" in abc_flags else False,
"writeUVSets": abc_writeUVSets,
"writeVisibility": True if "writeVisibility" in abc_flags else False,
"writeVisibility": True
if "writeVisibility" in abc_flags
else False,
}

if instance.data.get("visibleOnly", False):
Expand All @@ -106,7 +111,9 @@ def process(self, instance):
# flag does not filter out those that are only hidden on some
# frames as it counts "animated" or "connected" visibilities as
# if it's always visible.
nodes = list(iter_visible_nodes_in_range(nodes, start=start, end=end))
nodes = list(
iter_visible_nodes_in_range(nodes, start=start, end=end)
)

suspend = not instance.data.get("refresh", False)
with suspended_refresh(suspend=suspend):
Expand Down Expand Up @@ -182,7 +189,9 @@ def get_members_and_roots(self, instance):

# Include all descendants
nodes = (
roots + cmds.listRelatives(roots, allDescendents=True, fullPath=True) or []
roots
+ cmds.listRelatives(roots, allDescendents=True, fullPath=True)
or []
)

return nodes, roots

0 comments on commit 76a6e2e

Please sign in to comment.