playmesumch00ns
02-26-2003, 09:36 PM
HI, I've got a serious problem which is screwing with my plugin project. I sort of have two questions, so I'll ask them and then explain the reasoning:
1) Is it possible to force the re-evaluation of a node (i.e. make an MPxNode call compute()) when an input changes if it's got no connected outputs. What I mean is I have a (MPxNode-derived) rendering node that relies on a whole string of data inputs.
Now I want the rendering node's compute function to be called whenever I change the input data. The specifics of the inputs are an array of compound attributes, each of which consists of an input mesh and an array of custom MPxData-derived data objects.
The trouble is the bloody thing won't re-evaluate when the inputs change! I think it's because the node's outputs (I put a dummy one in just to see if it would work) aren't connected to anything, so pig-headed Maya doesn't see any reason to call compute()
2) Can I get at my custom data outside of a node's compute function (If I could do this, it would mean I wouldn't have to worry about 1 as 1 is a workaround). I mean it's trivial to get a pointer to the custom data objects via the data block in the compute function, but because I'm trying to get at it from inside a render callback, i don't have a data block to work with. I can get a plug from inside the callback, but if I try getting an MObject from that plug, it fails with the ever-helpful "Unexpected Internal Failure" result.
Ok, so explanation: I've got my rendering node, nprRender which is going to do some post-process rendering via a callback. The render node depends on the attributes listed in 1), which are the worldMesh output of a mesh node and an array of custom nprData data objects, which are passed in from a series of nprLayer nodes.
Now I can get hold of the mesh object fine from inside the callback using the plugs. But as far as I can see, the MPlug has nothing which lets me get at custom data. From the manuals, the only way I can see to get at custom data is from the data block passed to the compute function! Aaargh!
So my theoretical workaround was to grab the custom data from the nprRender node's compute method and stick it some arrays ready to be processed when the render callback is tripped. Obviously this isn't a perfect solution, but it's the only one i can think of, and the problem I've described in 1) now has me tearing my hair out!
If you've read this far, thanks!:beer: Please, if anyone's even got the faintest idea how I might resolve this, please tell me as this is driving me nuts!
1) Is it possible to force the re-evaluation of a node (i.e. make an MPxNode call compute()) when an input changes if it's got no connected outputs. What I mean is I have a (MPxNode-derived) rendering node that relies on a whole string of data inputs.
Now I want the rendering node's compute function to be called whenever I change the input data. The specifics of the inputs are an array of compound attributes, each of which consists of an input mesh and an array of custom MPxData-derived data objects.
The trouble is the bloody thing won't re-evaluate when the inputs change! I think it's because the node's outputs (I put a dummy one in just to see if it would work) aren't connected to anything, so pig-headed Maya doesn't see any reason to call compute()
2) Can I get at my custom data outside of a node's compute function (If I could do this, it would mean I wouldn't have to worry about 1 as 1 is a workaround). I mean it's trivial to get a pointer to the custom data objects via the data block in the compute function, but because I'm trying to get at it from inside a render callback, i don't have a data block to work with. I can get a plug from inside the callback, but if I try getting an MObject from that plug, it fails with the ever-helpful "Unexpected Internal Failure" result.
Ok, so explanation: I've got my rendering node, nprRender which is going to do some post-process rendering via a callback. The render node depends on the attributes listed in 1), which are the worldMesh output of a mesh node and an array of custom nprData data objects, which are passed in from a series of nprLayer nodes.
Now I can get hold of the mesh object fine from inside the callback using the plugs. But as far as I can see, the MPlug has nothing which lets me get at custom data. From the manuals, the only way I can see to get at custom data is from the data block passed to the compute function! Aaargh!
So my theoretical workaround was to grab the custom data from the nprRender node's compute method and stick it some arrays ready to be processed when the render callback is tripped. Obviously this isn't a perfect solution, but it's the only one i can think of, and the problem I've described in 1) now has me tearing my hair out!
If you've read this far, thanks!:beer: Please, if anyone's even got the faintest idea how I might resolve this, please tell me as this is driving me nuts!
