finally back from the holidays! and here to lay everythin down,
hereby is where i got with the deformer (save it in a py text file to get it):
CODE
import math, sys
import maya.OpenMaya as OpenMaya
import maya.OpenMayaAnim as OpenMayaAnim
import maya.OpenMayaMPx as OpenMayaMPx
import os
import string
kPluginNodeTypeName = "geoCacheNode"
geoCacheNodeId = OpenMaya.MTypeId(0x8701)
# Node definition
class geoCacheNode(OpenMayaMPx.MPxDeformerNode):
# class variables
time = OpenMaya.MObject()
# constructor
def __init__(self):
OpenMayaMPx.MPxDeformerNode.__init__(self)
# deform
def deform(self,dataBlock,geomIter,matrix,multiIndex):
#
# get the envelope
envelope = OpenMayaMPx.cvar.MPxDeformerNode_envelope
envelopeHandle = dataBlock.inputValue( envelope )
envelopeValue = envelopeHandle.asFloat()
envelope = OpenMayaMPx.cvar.MPxDeformerNode_envelope
envelopeHandle = dataBlock.inputValue( envelope )
envelopeValue = envelopeHandle.asFloat()
#
# iterate over the object and change the time
jjj= 0;
while geomIter.isDone() == False:
point = OpenMaya.MPoint()
coordinates = string.split(lines[jjj])
point = OpenMaya.MPoint(float(coordinates[1]),float(coordinates[2]),float(coordinates[3]),1)
geomIter.setPosition(point,OpenMaya.MSpace.kObject)
geomIter.next()
jjj = jjj+1
# creator
def nodeCreator():
return OpenMayaMPx.asMPxPtr( geoCacheNode() )
# initializer
def nodeInitializer():
# time
nAttr = OpenMaya.MFnNumericAttribute()
geoCacheNode.time = nAttr.create( "time", "fa", OpenMaya.MFnNumericData.kDouble, 0.0 )
#nAttr.setDefault(0.0)
nAttr.setKeyable(True)
# add attribute
try:
geoCacheNode.addAttribute( geoCacheNode.time )
outputGeom = OpenMayaMPx.cvar.MPxDeformerNode_outputGeom
geoCacheNode.attributeAffects( geoCacheNode.time, outputGeom )
except:
sys.stderr.write( "Failed to create attributes of %s node\n", kPluginNodeTypeName )
timeControl = OpenMayaAnim.MAnimControl()
currentTime = timeControl.currentTime()
inputFile = "D:\maya work\API projects (c++)\geoCacheCmd\geoCacheCmd\Debug\geo"+str(int(currentTime.value()))+".cache"
def getText(inputFile):
if os.path.exists(inputFile) == True:
textRead = file(inputFile,'r')
textResult = textRead.read()
textRead.close()
return textResult
else:
textResult = 'Not Available'
return textResult
fileContents = getText(inputFile)
lines = string.split(fileContents,'\n')
# initialize the script plug-in
def initializePlugin(mobject):
mplugin = OpenMayaMPx.MFnPlugin(mobject)
try:
mplugin.registerNode( kPluginNodeTypeName, geoCacheNodeId, nodeCreator, nodeInitializer, OpenMayaMPx.MPxNode.kDeformerNode )
except:
sys.stderr.write( "Failed to register node: %s\n" % kPluginNodeTypeName )
# uninitialize the script plug-in
def uninitializePlugin(mobject):
mplugin = OpenMayaMPx.MFnPlugin(mobject)
try:
mplugin.deregisterNode( geoCacheNodeId)
except:
sys.stderr.write( "Failed to unregister node: %s\n" % kPluginNodeTypeName )
and hereby is the data needed to run the plugin (the cache files):
http://www.4shared.com/file/32211981/30f1fa70/cache.html
thanks a lot in advance to whoever might help
(ps: i dunno if i someone could move this thread for me to the python section or something???)