Hi all, 
        currently I'm doing the tutorial for Chad Vernon's Custom Jiggle 
Deformer tutorial but trying to convert the code into Python just to understand 
better the anatomy of building a Deformer. I'm stuck right now at this error

// Error: file: C:/Program Files/Autodesk/Maya2013/scripts/others/pluginWin.mel 
line 665: RuntimeError: file G:/AdvancedScripting/jiggleFinal.py line 48: 
(kInvalidParameter): Cannot find item of required type // 
// Warning: file: C:/Program 
Files/Autodesk/Maya2013/scripts/others/pluginWin.mel line 665: Failed to call 
script creator function // 

Everytime I load in my plugin, I haven't implemented the main code yet just 
trying if the thing could load. The section of code it's complaining about is 
here:

 def initialize():
        
        nAttr = api.MFnNumericAttribute()
        uAttr = api.MFnUnitAttribute()
        mAttr = api.MFnMatrixAttribute()
        cAttr = api.MFnCompoundAttribute()
        
        outputGeom = apiMPx.cvar.MPxDeformerNode_outputGeom

        Jiggle.aTime = uAttr.create('time', 'time', 
api.MFnUnitAttribute.kTime,0.0)
        Jiggle.addAttribute(Jiggle.aTime)
        Jiggle.attributeAffects(Jiggle.aTime, outputGeom)

        
        Jiggle.aStartFrame = nAttr.create("startFrame", "startFrame", 
api.MFnNumericData.kInt, 0)
        nAttr.setKeyable(True)
        Jiggle.addAttribute(Jiggle.aStartFrame)
        Jiggle.attributeAffects(Jiggle.aStartFrame, outputGeom)

Attached is the main code. Would appreciate if anyone could tell me what I'm 
doing wrong

Thank you
Bay 

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].


import maya.OpenMayaMPx as apiMPx
import maya.OpenMaya as api
import maya.cmds as cmds

kPluginNodeTypeName= 'BayJiggle'

class Jiggle(apiMPx.MPxDeformerNode):
        kPluginNodeId = api.MTypeId(0x90008)
        
        aPerGeometry = api.MObject()
        aDirectionBias = api.MObject()
        aNormalStrength = api.MObject()
        aDampingMagnitude = api.MObject()
        aStiffnessMagnitude = api.MObject()
        aStiffnessMap = api.MObject()
        aDampingMap = api.MObject()
        aJiggleMap = api.MObject()
        aTime=api.MObject()
        aStartFrame = api.MObject()
        aWorldmatrix = api.MObject()
        aScale = api.MObject()
        aMaxVelocity = api.MObject()
        
        def __init__(self):
                        apiMPx.MPxDeformerNode.__init__(self)
                        self._initialized=False
                        self._currentPosition = api.MPoint()
                        self._previousPosition = api.MPoint()
                        self._previousTime = api.MTime()
                        
        def deform(self,data, itGeo, localToWorldMatrix, geomIndex):
                envelope = apiMPx.cvar.MPxDeformerNode_envelope
                
                
def creator():
        return apiMPx.asMPxPtr(Jiggle())
        
def initialize():
        
        nAttr = api.MFnNumericAttribute()
        uAttr = api.MFnUnitAttribute()
        mAttr = api.MFnMatrixAttribute()
        cAttr = api.MFnCompoundAttribute()
        
        outputGeom = apiMPx.cvar.MPxDeformerNode_outputGeom

        Jiggle.aTime = uAttr.create('time', 'time', 
api.MFnUnitAttribute.kTime,0.0)
        Jiggle.addAttribute(Jiggle.aTime)
        Jiggle.attributeAffects(Jiggle.aTime, outputGeom)

        
        Jiggle.aStartFrame = nAttr.create("startFrame", "startFrame", 
api.MFnNumericData.kInt, 0)
        nAttr.setKeyable(True)
        Jiggle.addAttribute(Jiggle.aStartFrame)
        Jiggle.attributeAffects(Jiggle.aStartFrame, outputGeom)
        
        
def initializePlugin(mobject):

    # Author, Tool version, API version
    mplugin = apiMPx.MFnPlugin(mobject, "GannBoonBay", "1.0", "Any")
    try:
        mplugin.registerNode( kPluginNodeTypeName, Jiggle.kPluginNodeId, 
creator, initialize )
    except:
        sys.stderr.write( "Failed to register command: %s\n" % 
kPluginNodeTypeName )
        raise


# Uninitialize the script plug-in
def uninitializePlugin(mobject):
    mplugin = apiMPx.MFnPlugin(mobject)
    try:
        mplugin.deregisterNode( Jiggle.kPluginNodeId  )
    except:
        sys.stderr.write( "Failed to unregister command: %s\n" % 
kPluginNodeTypeName )
        raise
                
                

        

Reply via email to