-
Notifications
You must be signed in to change notification settings - Fork 4
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,46 +18,11 @@ | |
|
||
#include <maya/MDagPath.h> | ||
#include <maya/MFnDagNode.h> | ||
#include <maya/MGlobal.h> | ||
#include <maya/MMatrix.h> | ||
#include <maya/MPlug.h> | ||
#include <maya/MPlugArray.h> | ||
#include <maya/MSelectionList.h> | ||
#include <maya/MObjectArray.h> | ||
#include <maya/MFnAttribute.h> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All that has been removed is not used any more |
||
|
||
namespace | ||
{ | ||
//To compute the size of an array automatically | ||
template<typename T, std::size_t N> | ||
constexpr std::size_t arraySize(T(&)[N]) noexcept | ||
{ | ||
return N; | ||
} | ||
|
||
///Is an array of strings that are all maya transform attributes names | ||
const char* kMayaTransformAttributesStrings[] = {"translateX", "translateY", "translateZ", | ||
"rotatePivotTranslateX", "rotatePivotTranslateY", "rotatePivotTranslateZ", | ||
"rotatePivotX", "rotatePivotY", "rotatePivotZ", | ||
"rotateX", "rotateY","rotateZ", | ||
"rotateAxisX", "rotateAxisY", "rotateAxisZ", | ||
"scalePivotTranslateX", "scalePivotTranslateY", "scalePivotTranslateZ", | ||
"scalePivotX", "scalePivotY", "scalePivotZ", | ||
"shearXY", "shearXZ", "shearYZ", | ||
"scaleX", "scaleY", "scaleZ", | ||
"worldMatrix", | ||
"localPositionX", "localPositionY", "localPosition", | ||
"translate", "rotate", "scale" | ||
}; | ||
//Convert from const char* [] to MStringArray | ||
const MStringArray transformAttrNames(kMayaTransformAttributesStrings, arraySize(kMayaTransformAttributesStrings)); | ||
|
||
//For visibility attributes | ||
const char* visibilityNames[] = {"visibility"}; | ||
|
||
//For visibility attributes | ||
const MStringArray visibilityAttrNames = MStringArray(visibilityNames, arraySize(visibilityNames)); | ||
} | ||
#include <maya/MStringArray.h> | ||
|
||
namespace MAYAHYDRA_NS_DEF { | ||
|
||
|
@@ -143,47 +108,6 @@ MStatus GetObjectsFromNodeNames(const MStringArray& nodeNames, MObjectArray & ou | |
return MS::kSuccess; | ||
} | ||
|
||
bool IsAMayaTransformAttributeName(const MString& attrName) | ||
{ | ||
return (-1 != transformAttrNames.indexOf(attrName)); | ||
} | ||
|
||
bool IsAMayaVisibilityAttribute(const MPlug& plug, bool& outVal) | ||
{ | ||
//Get the visibility value from MPlug | ||
MFnAttribute attr (plug.attribute()); | ||
bool isVisibility = -1 != visibilityAttrNames.indexOf(attr.name()); | ||
if (isVisibility){ | ||
plug.getValue(outVal); | ||
} | ||
return isVisibility; | ||
} | ||
|
||
MObject GetShadingGroupFromShader(const MObject& shader) | ||
{ | ||
MObject shadingGroup; | ||
MFnDependencyNode fn(shader); | ||
|
||
// Get the "outColor" plug of the shader | ||
MPlug outColorPlug = fn.findPlug("outColor", true); | ||
|
||
// Get the connected plugs | ||
MPlugArray connectedPlugs; | ||
outColorPlug.connectedTo(connectedPlugs, false, true); | ||
|
||
// Loop over the connected plugs | ||
for (unsigned int i = 0; i < connectedPlugs.length(); ++i) { | ||
MObject node = connectedPlugs[i].node(); | ||
if (node.apiType() == MFn::kShadingEngine) // Check if the node is a shading group | ||
{ | ||
shadingGroup = node; | ||
break; | ||
} | ||
} | ||
|
||
return shadingGroup; | ||
} | ||
|
||
bool IsDagPathAnArnoldSkyDomeLight(const MDagPath& dagPath) | ||
{ | ||
static const MString _aiSkyDomeLight("aiSkyDomeLight"); | ||
|
@@ -193,6 +117,5 @@ bool IsDagPathAnArnoldSkyDomeLight(const MDagPath& dagPath) | |
shapeDagPath.extendToShape(); | ||
return _aiSkyDomeLight == MFnDependencyNode(shapeDagPath.node()).typeName(); | ||
} | ||
|
||
|
||
} // namespace MAYAHYDRA_NS_DEF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.