Hi everyone,

I got a little question about using the MDGContext in the compute
block of a customNode I'm working on.
I want to get the inputvalues of a matrix attribute
(customNode.inputMatrix) at 2 different times, the currentframe and a
few frames before (for example 2 frames).
I tried to use 2 different contexts but doesn't seem to work. It
ignores the second setContext, and I'm not sure if it's possible
setting two different contexts for the same datablock or there is
another error in my code.
The code looks like this:

def compute(self, plug, dataBlock):
                if plug ==customNode .output:
                        #first i get the currenttime and create the 2 frames 
before context
                        currentTime =omAnim.MAnimControl.currentTime()
                        dgContextBefore = om.MDGContext(currentTime-2)
                        dataBlock.setContext(dgContextBefore)
                        inputFirstMatrix =dataBlock.inputValue
(customNode.inputMatrix ).asMatrix()

                        #once i got the first value i set the second context 
and try to get
the second matrix
                        dgContext =om.MDGContext(currentTime)
                        dataBlock.setContext(dgContext) #it ignores this line?
                        inputSecondMatrix =dataBlock.inputValue
(customNode.inputMatrix ).asMatrix()


 Can someone tell what I'm doing wrong, please?
-- 
http://groups.google.com/group/python_inside_maya

Reply via email to