Skip to content

Commit

Permalink
Merge pull request #148 from BigRoy/bugfix/extract_layout_include_con…
Browse files Browse the repository at this point in the history
…tainers

Fix including of containers with e.g. `layout` products
  • Loading branch information
BigRoy authored Oct 14, 2024
2 parents abf707f + ff0ad97 commit aff6fd1
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions client/ayon_maya/plugins/publish/extract_maya_scene_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,19 @@ def process(self, instance):
else:
members = instance[:]

selection = members
# For some families, like `layout` we collect the containers so we
# maintain the containers of the members in the resulting product.
# However, if `exactSetMembersOnly` is true (which it is for layouts)
# searching the exact set members for containers doesn't make much
# sense. We must always search the full hierarchy to actually find
# the relevant containers
selection = list(members) # make a copy to not affect input list
if set(self.add_for_families).intersection(
set(instance.data.get("families", []))) or \
instance.data.get("productType") in self.add_for_families:
selection += self._get_loaded_containers(members)
containers = self._get_loaded_containers(instance[:])
self.log.debug(f"Collected containers: {containers}")
selection.extend(containers)

# Perform extraction
self.log.debug("Performing extraction ...")
Expand Down Expand Up @@ -120,7 +128,7 @@ def process(self, instance):

@staticmethod
def _get_loaded_containers(members):
# type: (list) -> list
# type: (list[str]) -> list[str]
refs_to_include = {
cmds.referenceQuery(node, referenceNode=True)
for node in members
Expand Down

0 comments on commit aff6fd1

Please sign in to comment.