LumaPictures / pymel

Python in Maya Done Right
Other
489 stars 131 forks source link

nodetypes.AnimCurve().addKeys():error: 'module' object has no attribute 'apiClassInfo' #268

Closed pmolodo closed 9 years ago

pmolodo commented 9 years ago

_From mark_the...@yahoo.com on February 17, 2011 11:43:33_

Describe the problem. i am trying to use the addKeys() function of MFnAnimCurve through pymel-1.0.0-py2.6egg .

it appears that 'apiClassInfo' has moved to a different location within pymel since 'addKeys' was implemented, and addKeys was never modified to account for this change.

in this 'egg' version: nodeTypes.py line 2887 you are referring to an attribute: _api.apiClassInfo... here, _api is a nameSpace refering to: pymel.api 'apiClassInfo' in not an attribute or function within any of the files of pymel.api

there is however, a static variable with that name in: apicache.py in the class 'ApiCache' at line 111

it appears that this hybrid API lookup framework has been modified but the nodeTypes.py function AnimCurve.addkeys() has not been updated to account for this. What Version of Maya are you using? 2011 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? pymel-1.0.0-py2.6egg What is the expected output? What do you see instead? the expected output is that pymel.nodetypes.AnimCurve.addKeys() would actually add keys to my animcurve. also that pymel.nodetypes.AnimCurve would have a create function so that i did not have to use the API to do so. the API cannot attatch the OpenMayaAnim.MFnAnimCurve() functionset to the curve during its own creation function in python,(OpenMaya.py bug?) resulting in an inability to operate on the functionCurve once it is created. Pymel should fix this by wrapping animCurve creation as well as addKey, addKeys etc. (would preffer to create and manipulate fCurves this way rather than setKeyFrame and keyFrame commands in mel, python ,or pymel.)

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.

code begin: ######################################################################

nodetypes.Animcurve.addKeys problem

######################################################################

import maya.OpenMayaAnim as omAn import maya.OpenMaya as om import pymel.core as pm

pm.sphere()

nodeNattr = 'nurbsSphere1.tx' times = [1, 2, 4, 7] values = [-1.444, 2.461, 7.544, 11.655]

get the the MPlug of the node.attr using pymel (could use api, this way just to see it work)

mplug = pm.PyNode(object+'.%s'%attr).apimplug()

instantiate the MFnAnimaCurve function, get the curve type needed

crvFnc = omAn.MFnAnimCurve() crvtype = crvFnc.timedAnimCurveTypeForPlug(mplug)

make a curve on the attr using API

how do i create the curve with pymel?? no docs on this??

crv = crvFnc.create(mplug,crvtype)

try to add keyframes to the curve using .addKeys function in Pymel

name = om.MFnDependencyNode(crv).name() pyAnimCurve = pm.PyNode(name) pyAnimCurve.addKeys(times,values,'step','step',False)

code end:

error i am getting:

Error: 'module' object has no attribute 'apiClassInfo'

Traceback (most recent call last):

File "", line 4, in

File "C:\Users\mtherrell\Documents\maya\milldev\millToolMaya.py", line 156, in createAnimCurveOnLayer_pymel

pyAnimCurve.addKeys(times,values,'step','step',False)

File "C:\Program Files\Autodesk\Maya2011\Python\lib\site-packages\pymel-1.0.0-py2.6.egg\pymel\core\nodetypes.py", line 2887, in addKeys

_api.apiClassInfo['MFnAnimCurve']['enums']['TangentType']['values'].getIndex('kTangent'+tangentInType.capitalize()),

AttributeError: 'module' object has no attribute 'apiClassInfo' # Does maya.cmds exhibit the same problem? irrelevent Please provide any additional information below.

Attachment: pymelAddKeyProblemDemo.py

Original issue: http://code.google.com/p/pymel/issues/detail?id=234

pmolodo commented 9 years ago

_From mark_the...@yahoo.com on February 17, 2011 11:48:36_

thanks guys. would sooo love to be able to finally create animCurves and add keyframes without having loops using setKeyFrame commands.

the faster the creation and editing of fCurves in python the better!!

cheers

pmolodo commented 9 years ago

From elron...@gmail.com on March 09, 2011 09:28:49

Fixed on latest on github; also added your code as a test thanks for the bug submission!

pmolodo commented 9 years ago

From elron...@gmail.com on March 09, 2011 09:34:22

Status: Fixed