hi GUY :) - 3DBUZZ.com offers A NEW mayaPython DVD ... http://www.3dbuzz.com/xcart/product.php?productid=54&cat=16&page=1
( i ordered it last week / i can tell you , how it is , when the shipping arrives - hope they will send it by "plane" - HAHA ) - there is one "Autodesk" DVD "Python for Maya" / it shows how to create a simple-PYTHON-node ( really basic stuff , and you won't learn much from it ) http://store.autodesk.com/DRHM/servlet/ControllerServlet?Action=DisplayProductDetailsPage&SiteID=adsk&Locale=en_US&productID=98208500 - i got the Digital-Tutors DVD somewhere , i think there is also a "tiny" part about scripted-plugins on it . but i do not think , it is so informative - as it is mainly about python-basics API: there are 2 Books "Complete Maya Programming" by David Gould / you can find them on Amazon ... here you can learn a lot about API ( C++ ) ... there is not much python-API-information on the internet yet / but somehow , you can to try to "translate" the C++ API-tutorials into Python / python_API is easier to learn than C++ , as you can "source" the code directly in Maya without compiling it . Information about maya-API : http://www.robthebloke.org/mayaapi.html http://comet-cartoons.com/3ddocs/mayaAPI/ hope that helps you a little , although i can't tell anything about fluids ... sim.On MaxtorAG schrieb: > Hi guys! > > 1. I need som good books/tutorials on Maya API! :( > > 2. I am setting up a node with 2 message input attributes (one for > connecting message from fluid and another from particle) > > This is what I have in compute function def: > > def compute(self, plug, dataBlock): > > print "1. preparing" > result = "1. preparing" > > connections = om.MPlugArray() > connection = om.MPlug() > > plugParticleNode = om.MPlug() > plugParticleNode.setAttribute(self.particleNode) #this is the > connection to the message att > connectedToParticleNode = om.MObject() > > plugFluidNode = om.MPlug() > plugFluidNode.setAttribute(self.fluidNode) #this is the > connection to the message att > connectedToFluidNode = om.MObject() > > print "2.computed" > result = "2.computed" > > # check if a particle is connected to the particleNode input > plugParticleNode.connectedTo(connections,1,0) > if (connections.length() > 0): > connection = connections[0] > connectedToParticleNode = connection.node() > try: > connectedParticleNode = > omFX.MFnParticleSystem(connectedToParticleNode) # I will be later > using function set to read particle atts > particleConnected = 1 > except: > statusError("Not valid particle shape connected") > particleConnected = 0 > else: > particleConnected = 0 > > print "3.particle checked with value %d" % particleConnected > result = "3.particle checked with value %d" % > particleConnected > > # check if a fluid is connected to the fluidNode input > plugFluidNode.connectedTo(connections,1,0) > if (connections.length() > 0): > connection = connections[0] > connectedToFluidNode = connection.node() > try: > connectedFluidNode = > omFX.MFnFluid(connectedToFluidNode) # I will be later using function > set to read fluid atts > fluidConnected = 1 > except: > statusError("Not valid fluid shape connected") > fluidConnected = 0 > else: > fluidConnected = 0 > > print "4.fluid checked with value %d" % fluidConnected > result = "4.fluid checked with value %d" % fluidConnected > > Problem: > 1. I did not know how to construct the MPlug with function (MObject, > Attribute) (there is no thisObject() function in python API?) So I > just created it and then assigned > > 2. When I create the node, everything works. I get the correct integer > number for my debugging (0 for both). As soon as I connect anything to > those message atts, I get crash. Even without that, when I after > creation try to create new scene, I get crash. If I comment out the > connection checking functions, nothing crashes. > > Btw...That's all I compute, nothing after this part of code except of > setting custom debugging attribute to the *result* value value. > > > > > --~--~---------~--~----~------------~-------~--~----~ Yours, Maya-Python Club Team. -~----------~----~----~----~------~----~------~--~---
