There are some tricks to get Maya to call a node's compute function. There is a good example in Google code called GrassLocator<http://code.google.com/p/mayaprogramming/source/browse/trunk/locator/?r=4>. Take a look at GrassLocator.h, line 52.
On Tue, Feb 2, 2010 at 8:44 AM, Adam Mechtley <[email protected]>wrote: > It's hard to say what's going on without a little more information on how > the attributes are defined. I have made plenty of nodes with matrix > attributes affecting a float output, and have had no problems. > > Off the top of my head, I generally only see problems triggering the > compute() function if I set up my plug test at the beginning of compute() > incorrectly (particularly in the case of compound attributes). > > > On Tue, Feb 2, 2010 at 10:54 AM, Ren Zhi Zhang <[email protected]> wrote: > >> I ran into a similar issue just recently, turns out that Maya will only >> evaluate nodes when necessary (i.e. during a screen refresh), so some >> nodes may not evaluate properly if something happens so quick that Maya >> didn't even get a chance to respond. I solved the issue by using dgeval >> with something like this (adapted to your code): >> >> MString command("dgeval "); >> MGlobal::executeCommand(command + floatAttr.name()); >> >> You should place the above code somewhere after setting the appropriate >> node attribute values and making the appropriate node connections. >> >> Hope the suggestion helps. >> >> Ren Zhi >> >> Ling wrote: >> > Hi guys: >> > >> > sorry for post this again, but I desparately needing for help. >> > >> > my problem is I created three attribute in my custom locator node, >> > a MString attribute, a MMatrixAttribute, >> > and they are affecting a float attribute. >> > >> > basically like this: >> > CHECK_MSTATUS( attributeAffects( MStringAttr, floatAttr ) ); >> > CHECK_MSTATUS( attributeAffects( MMatrixAttr, floatAttr ) ); >> > >> > the node compiles fine, but when changing the Matrix and String >> > attribute, >> > the float attribute doesnt response, which means the node won't >> > re-"compute".. >> > >> > also i got some error message like: >> > attributeAffects( MString, floatAttr ) >> > (kInvalidParameter): Object is incompatible with this method >> > >> > attributeAffects( MMatrixAttr, floatAttr ) >> > (kInvalidParameter): Object is incompatible with this method >> > >> > and if I set only the MString attribute affecting the float attribute, >> > the error becomes: >> > attributeAffects( MString, floatAttr ) >> > (kInvalidParameter): Object is incompatible with this method >> > >> > >> > Really appreciate your helps >> > >> > -ling >> > >> > >> >> -- >> http://groups.google.com/group/python_inside_maya >> > > -- > http://groups.google.com/group/python_inside_maya > -- http://groups.google.com/group/python_inside_maya
