pombreda / pymel

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

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

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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 "<maya console>", line 4, in <module>
#   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\cor
e\nodetypes.py", line 2887, in addKeys
#     
_api.apiClassInfo['MFnAnimCurve']['enums']['TangentType']['values'].getIndex('kT
angent'+tangentInType.capitalize()),
# AttributeError: 'module' object has no attribute 'apiClassInfo' # 

Does maya.cmds exhibit the same problem?
irrelevent

Please provide any additional information below.

Original issue reported on code.google.com by mark_the...@yahoo.com on 17 Feb 2011 at 7:43

Attachments:

GoogleCodeExporter commented 9 years ago
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

Original comment by mark_the...@yahoo.com on 17 Feb 2011 at 7:48

GoogleCodeExporter commented 9 years ago
Fixed on latest on github; also added your code as a test
thanks for the bug submission!

Original comment by elron...@gmail.com on 9 Mar 2011 at 5:28

GoogleCodeExporter commented 9 years ago

Original comment by elron...@gmail.com on 9 Mar 2011 at 5:34