maya.plugins Fix create pointcache and apply format

This commit is contained in:
Oscar Domingo 2024-01-31 16:37:20 +00:00
parent 265239770e
commit 76a6e2ec1a
2 changed files with 23 additions and 16 deletions

View file

@ -29,7 +29,7 @@ def _get_animation_attr_defs(cls):
BoolDef("refresh", label="Refresh viewport during export"),
BoolDef(
"includeParentHierarchy", label="Include Parent Hierarchy"
)
),
]
)
@ -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
@ -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",
@ -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

View file

@ -44,7 +44,8 @@ class ExtractAlembic(publish.Extractor):
) + 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 = [
@ -82,7 +83,9 @@ class ExtractAlembic(publish.Extractor):
"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?
@ -97,7 +100,9 @@ class ExtractAlembic(publish.Extractor):
"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):
@ -106,7 +111,9 @@ class ExtractAlembic(publish.Extractor):
# 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):
@ -182,7 +189,9 @@ class ExtractAnimation(ExtractAlembic):
# 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