I have a Maya MEL script, which inserts some nodes. The evaluation seems to be deferred until the script finishes. I guess this comes from the pipeline evaluating when the shape is requested by the renderer, so the dirty propagation starts.
Now I want to run commands if the inserted node calculated a certain output like this:
$node = `insertMyNode`;
dgdirty ($node+".outputAttr");
if(`getAttr ($node+".outputAttr")` == 1) {
print("true");
} else {
print("false");
}
This always prints false. When I insert the node and then run getAttr ($node+".outputAttr")
in the MEL editor, the node is computed and I get 1
.
I tried dgeval
as well and it didn't work either. I think in principle neither dgeval
nor dgdirty
should be needed but getAttr
should start the dirty propagation.
But it always returns the default value of the node, not the evaluated one.
dgdirty $node
works for me, but I still would rather only dirty the output I am using (and if possible automatically, not with a command which is documented to be for debugging purposeses), so the node does not need to recompute all outputs.
myNode
has defined and inputMesh
parameter which affects an output bool outputAttr
value using attributeAffects
in its C++ code. the insertMyNode
command connects an input mesh. It is correct that the node is not computed without a connection to an output plug, but when reading the plug it should be computed. When I open the node editor and hover over the output plug, the node is computed correctly. I would expect getAttr
to do the same in the example code above.