ECToo / pymel

Automatically exported from code.google.com/p/pymel
0 stars 0 forks source link

KeyError: 'MObjectHandle' - When trying to access HIK nodes #243

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Describe the problem.

If you create a HIK character, select one of the HIK controls, and run the 
following code :

import pymel.core
print (pymel.core.selected()[0].name())

When running the above code with any sort of HIK object selected the result 
will be the following :

# Error: line 1: MObjectHandle
# Traceback (most recent call last):
#   File "<maya console>", line 3, in <module>
#   File "C:\Program 
Files\Autodesk\Maya2012\Python\lib\site-packages\pymel\core\nodetypes.py", line 
90, in name
#     return self._updateName()
#   File "C:\Program 
Files\Autodesk\Maya2012\Python\lib\site-packages\pymel\core\nodetypes.py", line 
79, in _updateName
#     self.__apimobject__()
#   File "C:\Program 
Files\Autodesk\Maya2012\Python\lib\site-packages\pymel\core\nodetypes.py", line 
137, in __apimobject__
#     handle = self.__apihandle__()
#   File "C:\Program 
Files\Autodesk\Maya2012\Python\lib\site-packages\pymel\core\nodetypes.py", line 
143, in __apihandle__
#     return self.__apiobjects__['MObjectHandle']
# KeyError: 'MObjectHandle' # 

What Version of Maya are you using?
2012

On what operating system? (be as specific as possible and include service
packs, 64bit vs 32bit, etc)

Windows 7 64bit

What Version of PyMEL are you using?

1.0.3

What is the expected output? What do you see instead?

Expected output would be the logged name of the selected object. Instead we get 
a KeyError.

If possible, provide a few lines of code to reproduce the problem. It helps
us if your code will reproduce the problem from a new scene.

As above.

Does maya.cmds exhibit the same problem?
No.

Please provide any additional information below.

Original issue reported on code.google.com by softimag...@gmail.com on 11 Apr 2011 at 4:52

GoogleCodeExporter commented 9 years ago
I have the same problem accessing nCloth nucleus nodes, but I think the issue 
is with Maya 2012's OpenMaya (not PyMEL). I can get the object reference, but 
if I try to do anything *with* the object I'll get this MObjectHandle KeyError. 
My work-around was to keep the nucleus as a string instead of getting the 
object, like this:

# Broken code
nucleus = ls(mel.getActiveNucleusNode(False, True))[0]
nucleus.attr('spaceScale').set(2.5)

# Work-around
from pymel.core import mel
nucleus = mel.getActiveNucleusNode(False, True)
mel.setAttr(nucleus + '.spaceScale', 2.5)

Original comment by jed.hunsaker on 3 May 2011 at 3:21

GoogleCodeExporter commented 9 years ago
MNLN-568

BB #386933 : Pymel error for HumanIK objects

Original comment by johncre...@gmail.com on 28 Jun 2011 at 8:41

GoogleCodeExporter commented 9 years ago
fixed in 321ce6c9bc28957c09d94c8d736b5de68ca1d850 thanks to patch submitted by 
Jed Hunsaker

Original comment by elron...@gmail.com on 29 Sep 2011 at 6:04

GoogleCodeExporter commented 9 years ago
The patch, BTW, had nothing to do with my workaround above. In fact, my 
workaround stopped working on a different machine and I had to change it anyway.

Original comment by jed.hunsaker on 29 Sep 2011 at 7:38