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

HYDRA-1291 : Fix default maya material is not picked up correctly #201

Merged
merged 2 commits into from
Nov 14, 2024

Conversation

lanierd-adsk
Copy link
Collaborator

No description provided.

@lanierd-adsk lanierd-adsk self-assigned this Nov 14, 2024
@@ -33,11 +33,7 @@
#include <pxr/usdImaging/usdImaging/tokens.h>

#include <maya/MAnimControl.h>
#include <maya/MDGContext.h>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a bit of headers cleaning in this PR.

// create a fallback material
bool defaultMaterialCreatedSuccessfully = false;

MObject defaultMaterialShadingGroupObj = getDefaultMaterialShadingGroupNode();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recall there's already an Maya API (MMaterial::defaultMaterial()) to get the default Material, no need to query again. Just use MObject defaultMaterialShadingGroupObj = MMaterial::defaultMaterial().shadingEngine();

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here's the API doc:
https://help.autodesk.com/view/MAYAUL/2024/ENU/?guid=MAYA_API_REF_cpp_ref_class_m_material_html

static MMaterial defaultMaterial()

Get the default material.
There will always be a default material in the scene and therefore the result of this function should always succeed. The default material will correspond to the initialShadingGroup node that is in the scene.

#include <maya/MSelectionList.h>
#include <maya/MObjectArray.h>
#include <maya/MFnAttribute.h>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All that has been removed is not used any more

Copy link
Collaborator

@lilike-adsk lilike-adsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice cleanup

@lilike-adsk lilike-adsk merged commit c2f4764 into dev Nov 14, 2024
10 checks passed
@lilike-adsk lilike-adsk deleted the lanierd/HYDRA-1291 branch November 14, 2024 19:05
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

Successfully merging this pull request may close these issues.

2 participants