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

Look: Validate Look Sets fail if mesh has only face assignments #106

Closed
2 tasks done
BigRoy opened this issue Sep 12, 2024 · 1 comment · Fixed by #107
Closed
2 tasks done

Look: Validate Look Sets fail if mesh has only face assignments #106

BigRoy opened this issue Sep 12, 2024 · 1 comment · Fixed by #107
Assignees
Labels
type: bug Something isn't working

Comments

@BigRoy
Copy link
Contributor

BigRoy commented Sep 12, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior:

When publishing a look on a mesh that for whatever reason has the looks assigned to all the components instead of the shape itself the validation will log it as 'invalid'.

image

Why does this happen?

This is because querying the members for a shader when there are face assignments Maya returns those like pCube1.f[0:200] instead of pCubeShape1.f[0:200] so it returns the transform - instead of the shape. Which is wildly confusing.

Anyway, we may want to, on collect, if the member has components and the node is a transform collect the shape instead. That may actually even fix potential issues where we're accidentally collecting the ids from the transform instead of the shape?

Expected Behavior:

It should either be allowed (if it doesn't provide issues elsewhere) or provide a clearer validation error so the user knows how to fix it.

Version

1.0.0

What platform you are running on?

Windows

Steps To Reproduce:

  1. Select all faces of a mesh.
  2. Assign a material
  3. Publish

(This is just to make an easy reproducable; however, similar issues may arise on merging or separating meshes or other maya construction history)

Are there any labels you wish to add?

  • I have added the relevant labels to the bug report.

Relevant log output:

ERROR: Missing '|cube|cubeShape' in collected set node 'blinn1SG'
Traceback (most recent call last):
  File "C:\Users\Maqina-RTX-03\AppData\Local\Ynput\AYON\dependency_packages\ayon_2407291312_windows.zip\dependencies\pyblish\plugin.py", line 528, in __explicit_process
    runner(*args)
  File "C:\Users\Maqina-RTX-03\AppData\Local\Ynput\AYON\addons\maya_0.2.12-cb.1\ayon_maya\plugins\publish\validate_look_sets.py", line 47, in process
    raise PublishValidationError(
ayon_core.pipeline.publish.publish_plugins.PublishValidationError: 'lookMain' has relationships that could not be collected, likely due to lack of a `cbId` on the relevant nodes or sets.

Additional context:

No response

@BigRoy BigRoy added the type: bug Something isn't working label Sep 12, 2024
@BigRoy BigRoy self-assigned this Sep 12, 2024
@BigRoy
Copy link
Contributor Author

BigRoy commented Sep 12, 2024

Workaround for now in the workfile is to run:

from maya import cmds

for sg in cmds.ls(type="shadingEngine"):
    members =cmds.sets(sg, query=True)
    if not members:
        continue
        
    invalid = []
    for member in members:
        if "." in member:
            invalid.append(member)
    
    if not invalid:
        continue
    
    print(f"Fixing {sg}: {invalid}")
    cmds.sets(invalid, remove=sg)
    
    # Add them as full node
    correct = [member.split(".", 1)[0] for member in invalid]
    cmds.sets(correct, forceElement=sg)
print("Done")

This will basically replace all face assignments to assignments on the full object - and hence avoids the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant