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

Maya: Publish pointcache fails with children of parents in the instance #50

Open
BigRoy opened this issue Mar 11, 2022 · 0 comments
Open

Comments

@BigRoy
Copy link
Contributor

BigRoy commented Mar 11, 2022

Describe the bug

When the publish instance has both a parent and a child inside the instance then Alembic will fail to extract the data when Include Parent Hierarchy is set to False.

Alembic failing to extract makes sense because this case of exporting isn't defined explicitly. When excluding the parent hierarchy from the export and exporting e.g. this:

parent > child

With parent, child both directly in the instance. Then would you want child to still be inside parent in the export. Or without parent hierarchy on its own? Should the data be duplicated (exist both within and outside?)

To Reproduce

import avalon.api
from openpype.hosts.maya.api.lib import maintained_selection
import pyblish.util
import openpype.lib
from maya import cmds


def create(Creator, name, members=None):
    """Create creator for current asset with name + add members"""
    # note: the create method does not "return" the publish instance so for now 
    # we use "useSelection" to add the members - since otherwise it's non trivial.
    options = {"useSelection": True}
    asset = avalon.api.Session["AVALON_ASSET"]
    with maintained_selection():
        cmds.select(members, replace=True, noExpand=True)
        container = avalon.api.create(Creator, 
                                      name=name, 
                                      asset=asset, 
                                      options=options)

cube = cmds.polyCube(constructionHistory=False)[0]
grp = cmds.group(cube, name="group")
cube = cmds.listRelatives(grp, fullPath=True)[0]

# Create instance
Creator = openpype.lib.get_creator_by_name("CreatePointcache")
create(Creator, name="pointcacheMain", members=[grp, cube])

Script Editor log:

Alembic Job Arguments : -selection -uvWrite -eulerFilter -dataFormat ogawa -step 1.0 -attr cbId -writeVisibility -worldSpace -root |group -root |group|pCube1 -writeUVSets -frameRange 1001.0 1100.0 -autoSubd -file "C:/Users/Roy/AppData/Local/Temp/pyblish_tmp_8_f5vrol/pointcacheMain.abc"
// Error: pyblish.plugin : Traceback (most recent call last):
  File "S:\openpype\OpenPype\.venv\lib\site-packages\pyblish\plugin.py", line 522, in __explicit_process
    runner(*args)
  File "S:\openpype\OpenPype\openpype\hosts\maya\plugins\publish\extract_pointcache.py", line 82, in process
  File "S:\openpype\OpenPype\openpype\hosts\maya\api\lib.py", line 1233, in extract_alembic
    cmds.AbcExport(j=job_str, verbose=verbose)
  File "S:\openpype\OpenPype\openpype\hosts\maya\plugins\publish\extract_pointcache.py", line 2, in AbcExport
RuntimeError: |group and |group|pCube1 have parenting relationships
|group and |group|pCube1 have an ancestor relationship.

Traceback (most recent call last):
  File "S:\openpype\OpenPype\.venv\lib\site-packages\pyblish\plugin.py", line 522, in __explicit_process
    runner(*args)
  File "<string>", line 82, in process
  File "S:\openpype\OpenPype\openpype\hosts\maya\api\lib.py", line 1233, in extract_alembic
    cmds.AbcExport(j=job_str, verbose=verbose)
  File "<string>", line 2, in AbcExport
RuntimeError: |group and |group|pCube1 have parenting relationships
|group and |group|pCube1 have an ancestor relationship.
 // 

Expected behavior

We should add a Validator so that it errors much earlier - and also so we can provide a clear error message to the user as to what is going on and what potential solutions to the problem would be. E.g. we could provide an automatic repair to allow removing children from the publish instance directly - to clean up?

Or we could instead in the Extractor ignore any children that were in the instance and always only consider the highest nodes in the hierarchies as root nodes. This might reduce less "struggle" to the end user?

[cuID:OP-2978]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant