Skip to content

Commit 934164b

Browse files
Better checks for bad attributes and print debug info
When this failed, it just created a huge amount of text, at least in the future when this fails we'll get a little more debug info when it errors.
1 parent 1fd4718 commit 934164b

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/mmSolver/mayahelper/maya_attr.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,17 @@ MString Attr::getLongNodeName() {
678678
MString Attr::getLongAttributeName() {
679679
MStatus status;
680680
MObject attrObj = Attr::getAttribute();
681+
const bool attrIsNull = attrObj.isNull();
682+
MMSOLVER_CHECK(attrIsNull == false, "Attribute is not valid.");
683+
if (attrIsNull) {
684+
MMSOLVER_MAYA_INFO("Attr::getLongAttributeName: Node Name: "
685+
<< "\"" << m_nodeName.asChar() << "\"");
686+
MMSOLVER_MAYA_INFO("Attr::getLongAttributeName: Attr Name: "
687+
<< "\"" << m_attrName.asChar() << "\"");
688+
MMSOLVER_MAYA_INFO("Attr::getLongAttributeName: Anim Curve Name: "
689+
<< "\"" << m_animCurveName.asChar() << "\"");
690+
return MString();
691+
}
681692
MFnAttribute attrMFn(attrObj, &status);
682693
MMSOLVER_CHECK_MSTATUS(status);
683694
return attrMFn.name();

0 commit comments

Comments
 (0)