Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

'NoneType' object has no attribute

'NoneType' object has no attribute

Anonymous
Not applicable
8,465 Views
4 Replies
Message 1 of 5

'NoneType' object has no attribute

Anonymous
Not applicable

 Hello, I'm new in Maya programming and I can't figure out how to fix this. 

In the DevKit there is an example python plug-in called yTwistNode.py. 

When I compile it in Pycharm I get an error on these lines:

 

outputGeom = OpenMayaMPx.cvar.MPxDeformerNode_outputGeom
envelope = OpenMayaMPx.cvar.MPxDeformerNode_envelope

The error says: AttributeError: 'NoneType' object has no attribute 'MPxDeformerNode_outputGeom' 

Could you help me to understand what is wrong? 

I think this is something I have to set in PyCharm, but I can't figure it out 

0 Likes
Accepted solutions (1)
8,466 Views
4 Replies
Replies (4)
Message 2 of 5

RFlannery1
Collaborator
Collaborator

According to the following forum post, it should work if you change "OpenMayaMPx.cvar.MPxDeformerNode_outputGeom" to "OpenMayaMPx.cvar.MPxGeometryFilter_outputGeom". https://forums.autodesk.com/t5/maya-programming/openmayampx-cvar-mpxdeformernode-outputgeom-error/td...

 

Alternately, I found a post from an external site that suggests the problem may be solved by updating Maya.  It looks like there was a change introduced in Maya 2016 that broke the code.  But upgrading to Maya 2016 Service Pack 2 solves the problem.  http://discourse.techart.online/t/maya-2016-python-deformer-plugin/5239

Message 3 of 5

Anonymous
Not applicable

I don't think the problem is the update, cause I have Maya 2018. 
By the way, the entire code is this: 

kApiVersion = cmds.about(apiVersion=True)
if kApiVersion < 201600:
outputGeom = OpenMayaMPx.cvar.MPxDeformerNode_outputGeom
envelope = OpenMayaMPx.cvar.MPxDeformerNode_envelope
else:
outputGeom = OpenMayaMPx.cvar.MPxGeometryFilter_outputGeom
envelope = OpenMayaMPx.cvar.MPxGeometryFilter_envelope

 So I don't think the problem is to change MPxDeformerNode with MPxGeometryFilter  

0 Likes
Message 4 of 5

RFlannery1
Collaborator
Collaborator
Accepted solution

That's really strange.  Since you're in Maya 2018, kApiVersion should be getting a value of 20180000 or 20180100 (depending on if you have the latest update.)  Both of those numbers are greater than 201600, so the code should never even enter the part where it's trying to use MPxDeformerNode.

 

Maybe it's something specific to PyCharm?  I tried copying that bit of code into Maya's Script Editor and it ran without a problem.

0 Likes
Message 5 of 5

Anonymous
Not applicable

Yeah, I've changed to Visual Studio and now it works... Thank you 🙂 

0 Likes