Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Maya® / SDK / // Warning: Failed to call script creator function //
  RSS 2.0 ATOM  

// Warning: Failed to call script creator function //
Rate this thread
 
63468
 
Permlink of this thread  
avatar
  • Total Posts: 25
  • Joined: 01 September 2006 07:16 AM

Hi guys,

I’m pretty new to the whole Maya API Python Plugin development, but I’m eager to dive deeper into it. ;)

When initializing my little plugin I’m always getting this error:

// Error: AttributeError: type object ‘MFnNumericAttribute’ has no attribute ‘kFloat’ //
// Warning: Failed to call script creator function //

The code is not fancy, so where is my problem?

import sys
 
import maya
.OpenMaya as OpenMaya
import maya
.OpenMayaMPx as OpenMayaMPx
 
kPluginNodeTypeName 
"myTestNode"
 
kPluginNodeId OpenMaya.MTypeId0x80000 )
 
# Node definition
class myTestNodeOpenMayaMPx.MPxNode ) :
 
 
# constructor
 
def __init__self ) :
 
 
OpenMayaMPx.MPxNode.__init__self )
 
 
 
def computeselfplugdata ) :

 print 
"compute"
 
return OpenMaya.MStatus.kSuccess
 
 
# creator
def nodeCreator():
 return 
OpenMayaMPx.asMPxPtr(myTestNode())
 
# initializer
def nodeInitialize():
 
#input
 
nAttr OpenMaya.MFnNumericAttribute()
 
myTestNode.input nAttr.create("input""in"OpenMaya.MFnNumericAttribute.kFloat0.0)
 
nAttr.setWritable(True)
 
nAttr.setStorable(True)
 
nAttr.setKeyable(True)

 
#output
 
Attr OpenMaya.MFnNumericAttribute()
 
myTestNode.input nAttr.create("Output""out"OpenMaya.MFnNumericAttribute.kFloat0.0)
 
Attr.setWritable(True)
 
Attr.setStorable(False)
 
Attr.setWritable(False)

 
# add attribute
 
myTestNode.addAttribute(myTestNode.input)
 
myTestNode.addAttribute(myTestNode.output)

 
# dirty flag propergation
 
myTestNode.attributeAffects(myTestNode.input,myTestNode.output)
 
 
 
# initialize the script plug-in
def initializePluginmobject ) :
 
mplugin OpenMayaMPx.MFnPluginmobject,'Me''1.0','Any')
 try:
 
mplugin.registerNodekPluginNodeTypeNamekPluginNodeIdnodeCreatornodeInitialize)
 
except:
 
sys.stderr.write"Failed to register node: %s\n" kPluginNodeTypeName )
 
raise
 
 
# uninitialize the script plug-in
def uninitializePluginmobject ):
 
mplugin OpenMayaMPx.MFnPluginmobject )
 try:
 
mplugin.deregisterNodekPluginNodeId )
 
except:
 
sys.stderr.write"Failed to unregister node: %s\n" kPluginNodeTypeName )
 
raise

The compute function doesn’t do anything for now. All I want is to create this simple node with two attributes(float/int) for the start.
The numeric data type exists(Maya API Class Reference), so what’s wrong here?
If I’m deleting the whole content in

def nodeInitialize()

the plugin loads without any errors and the node can be created.

createNode myTestNode;
// Result: myTestNode1 //

So something has to be wrong here. ;)

Thanks for answers,

Chris



Replies: 0