ynput / ayon-core

Apache License 2.0
18 stars 30 forks source link

Maya: add option to stripe shader assignment for setdress family #674

Closed moonyuet closed 1 week ago

moonyuet commented 2 weeks ago

Changelog Description

This PR is to add support to exclude shaders assignment when publishing the scene with setdress family

Additional info

Update the maya addon to 0.2.5 You can set the setdress settings in ayon setting image

Testing notes:

  1. Create setdress and families such as mayascene and layout

  2. In setdress, you can choose whether you want to include shader image

  3. Publish

  4. Should be published successfully

  5. Check published setdress scene, the scene should be without shader assignment if the shader option is turned off.

  6. Check the published scene from mayascene/layout family, the scene should be published with shader assignment

ynbot commented 2 weeks ago

Task linked: AY-5184 publish setdress without textures

LiborBatek commented 2 weeks ago

Didn't test it, but changes look good to me.

It's good to note that whenever you load a maya scene that was exported with shader=False I vaguely recall that maya will make them green by default because they will have no shader assigned at all instead of defaulting to just getting a default shader assigned - but that may be different these days in Maya 2024+ era.

Can we do anything about it? I would def rather having standardSurface1 assigned when shaders stripped...

What you think guys?

moonyuet commented 2 weeks ago

Didn't test it, but changes look good to me. It's good to note that whenever you load a maya scene that was exported with shader=False I vaguely recall that maya will make them green by default because they will have no shader assigned at all instead of defaulting to just getting a default shader assigned - but that may be different these days in Maya 2024+ era.

Can we do anything about it? I would def rather having standardSurface1 assigned when shaders stripped...

What you think guys?

we can do it either during loading scene with the setdress family (with an option) or somehow"editing" the published scene to assign the default shader. @BigRoy and @antirotor any thought?

BigRoy commented 2 weeks ago

we can do it either during loading scene with the setdress family (with an option) or somehow"editing" the published scene to assign the default shader. @BigRoy and @antirotor any thought?

The model publish does this as well on extract to temporarily assign the default shader. See here. That would suffice.

I would def rather having standardSurface1 assigned when shaders stripped...

That's indeed what model publish does with the above linked logic.

But as said, please first confirm the shaders=False flag actually still acting like that when loading in the meshes. Do they turn green still? This may have been an issue back in Maya 8.5 or whatever which has (potentially?) been solved along the way?

BigRoy commented 2 weeks ago

By the way, I noticed this is "sponsored" which means this is likely a client request. If they ALWAYS want no shaders then it may also be worth it to expose the default value to settings so the default value can be customized for that studio?

moonyuet commented 2 weeks ago

But as said, please first confirm the shaders=False flag actually still acting like that when loading in the meshes. Do they turn green still? This may have been an issue back in Maya 8.5 or whatever which has (potentially?) been solved along the way?

I tested with 2025 and 2023, they dont turn green anymore and they are assigned by default shader(lambert1). Not sure about the version elder than 2023.

Also updated the changelog description image

BigRoy commented 2 weeks ago

I tested with 2025 and 2023, they dont turn green anymore and they are assigned by default shader(lambert1). Not sure about the version elder than 2023.

I gave this a quick go. But it unfortunately still does - when the original shader that was applied was NOT the default shader.

image

I tested with file -exportSelected -shader 0 -type mayaAscii "E:/test.ma"

It seems that shader=False means, do not include the shader in the export. But if it contains the default shader assignment - it still assigns it:

connectAttr "pCubeShape1.iog" ":initialShadingGroup.dsm" -na;

But if it had a different shader assign on export, that line is gone and thus on load it doesn't understand it should receive a shader - turning the default maya "I do not have a shader"-green.

Forgot to mention - this is tested in Maya 2024.2

moonyuet commented 2 weeks ago

I tested with 2025 and 2023, they dont turn green anymore and they are assigned by default shader(lambert1). Not sure about the version elder than 2023.

I gave this a quick go. But it unfortunately still does - when the original shader that was applied was NOT the default shader.

image

I tested with file -exportSelected -shader 0 -type mayaAscii "E:/test.ma"

It seems that shader=False means, do not include the shader in the export. But if it contains the default shader assignment - it still assigns it:

connectAttr "pCubeShape1.iog" ":initialShadingGroup.dsm" -na;

But if it had a different shader assign on export, that line is gone and thus on load it doesn't understand it should receive a shader - turning the default maya "I do not have a shader"-green.

Does it mean we need to assign the default one first by using contextlib and then cmds.file?

BigRoy commented 2 weeks ago

Does it mean we need to assign the default one first by using contextlib and then cmds.file?

The workaround for it then would still be doing what we're doing in the model extractor here, yes.