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

Expose Maya USD creator that creates a static model product type #205

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
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
44 changes: 34 additions & 10 deletions client/ayon_maya/plugins/create/create_maya_usd.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class CreateMayaUsd(plugin.MayaCreator):
description = "Create Maya USD Export"
cache = {}

allow_animation = True

def register_callbacks(self):
self.create_context.add_value_changed_callback(self.on_values_changed)

Expand Down Expand Up @@ -70,16 +72,18 @@ def get_attr_defs_for_instance(self, instance):

self.cache["jobContextItems"] = job_context_items

defs = [
BoolDef("exportAnimationData",
label="Export Animation Data",
tooltip="When disabled no frame range is exported and "
"only the start frame is used to define the "
"static export frame.",
default=True)
]
defs.extend(lib.collect_animation_defs(
create_context=self.create_context))
defs = []
if self.allow_animation:
defs.append(
BoolDef("exportAnimationData",
label="Export Animation Data",
tooltip="When disabled no frame range is exported and "
"only the start frame is used to define the "
"static export frame.",
default=True)
)
defs.extend(lib.collect_animation_defs(
create_context=self.create_context))
defs.extend([
EnumDef("defaultUSDFormat",
label="File format",
Expand Down Expand Up @@ -242,3 +246,23 @@ def create(self, product_name, instance_data, pre_create_data):
cmds.select(root, replace=True, noExpand=True)

super().create(product_name, instance_data, pre_create_data)


class CreateMayaUsdModel(CreateMayaUsd):
identifier = "io.ayon.creators.maya.mayausd.model"
label = "Maya USD: Model"
product_type = "model"
icon = "cube"
description = "Create Model with Maya USD Export"

allow_animation = False

def get_pre_create_attr_defs(self):
attr_defs = super().get_pre_create_attr_defs()

# Enable by default
for attr_def in attr_defs:
if attr_def.key == "createAssetTemplateHierarchy":
attr_def.default = True

return attr_defs
6 changes: 6 additions & 0 deletions client/ayon_maya/plugins/publish/collect_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ def process(self, instance):
frame = cmds.currentTime(query=True)
instance.data["frameStart"] = frame
instance.data["frameEnd"] = frame

# Explicitly set no handles at all
instance.data["handleStart"] = 0
instance.data["handleEnd"] = 0
instance.data["frameStartHandle"] = frame
instance.data["frameEndHandle"] = frame
Loading