Skip to content

Commit

Permalink
Merge pull request #169 from BigRoy/enhancement/168-publishing-rig-wi…
Browse files Browse the repository at this point in the history
…thout-out_set-should-be-disallowed-or-loading-it-should-be-allowed

Allow loading published rig that has no `out_SET` and no `controls_SET`
  • Loading branch information
BigRoy authored Nov 4, 2024
2 parents e574715 + 6a701a3 commit 8d7693f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
19 changes: 17 additions & 2 deletions client/ayon_maya/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@
]


class RigSetsNotExistError(RuntimeError):
"""Raised when required rig sets for animation instance are missing.
This is raised from `create_rig_animation_instance` when the required
`out_SET` or `controls_SET` are missing.
"""
pass


def get_main_window():
"""Acquire Maya's main window"""
from qtpy import QtWidgets
Expand Down Expand Up @@ -4168,8 +4177,14 @@ def create_rig_animation_instance(
controls = next((node for node in nodes if
node.endswith("controls_SET")), None)
if name != "fbx":
assert output, "No out_SET in rig, this is a bug."
assert controls, "No controls_SET in rig, this is a bug."
if not output:
raise RigSetsNotExistError(
"No out_SET in rig. The loaded rig publish is lacking the "
"out_SET required for animation instances.")
if not controls:
raise RigSetsNotExistError(
"No controls_SET in rig. The loaded rig publish is lacking "
"the controls_SET required for animation instances.")

anim_skeleton = next((node for node in nodes if
node.endswith("skeletonAnim_SET")), None)
Expand Down
11 changes: 8 additions & 3 deletions client/ayon_maya/plugins/load/load_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from ayon_core.settings import get_project_settings
from ayon_maya.api import plugin
from ayon_maya.api.lib import (
RigSetsNotExistError,
create_rig_animation_instance,
get_container_members,
maintained_selection,
Expand Down Expand Up @@ -241,9 +242,13 @@ def update(self, container, context):
def _post_process_rig(self, namespace, context, options):

nodes = self[:]
create_rig_animation_instance(
nodes, context, namespace, options=options, log=self.log
)
try:
create_rig_animation_instance(
nodes, context, namespace, options=options, log=self.log
)
except RigSetsNotExistError as exc:
self.log.warning(
"Missing rig sets for animation instance creation: %s", exc)

def _lock_camera_transforms(self, nodes):
cameras = cmds.ls(nodes, type="camera")
Expand Down

0 comments on commit 8d7693f

Please sign in to comment.