Hello, (lets call you Nero... ) I think you can explain why your compute is not triggered: the dependency graph in maya is not informed that your output attribute needs to be update: you have nothing connected to it , right? Nothing original but how about writing a node to compute your pointList and plug it to your locator that will only draw from a kPointArray/kVectorArray input attribute? I have play with this idea and it works: http://forums.cgsociety.org/showpost.php?p=7280472&postcount=14.
Le mardi 5 juin 2012 18:35:15 UTC+2, WhileRomeBurns a écrit : > > So basically I've got a python node called *simpleLocator* with an > attribute called *pointCount *(type *kInt*) which is used to generate > some random points. These points can be passed out as an array with the > attribute *outPoints *(type *kDoubleArray *for this example). I've setup * > attributeAffects*() so that outPoints depends on pointCount, so it should > update if the user edits the number of points. This node needs to draw the > points every frame with OpenGL as well, but only compute as needed. So far > so good. Here's my example code (also attached to this post), stripped to > the bare essentials and it almost works: > > http://hastebin.com/vixiyaruda.py > > > When compute() is called though, plug never equals aOutPoints. Ever, ever. > > def compute( self, plug, data ): > if plug == simpleLocator.aOutPoints: > print( 'aOutPoints needs to be computed, but we never get > here...' ) > return om.MStatus.kSuccess > else: > return om.MStatus.kUnknownParameter > > > What's normal practice here? Should I just query my > simpleLocator.aPointCount every time draw is called and only > call generatePoints() if the value of aPointCount has been changed? Should > I derive from a node other than MPxLocator and implement my own draw > method? Does MPxLocator behave different in C++? Any help, any insight > would be greatly appreciated. Thanks. > > -shawn > PS- If you're curious, the real node is generating blue noise for > thousands of points and is fairly expensive to calculate. > -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe