View Full Version : get CurrentTime

12 December 2010, 01:35 AM
Im trying to get a node to evaluate at every frame.
The problem is i dont know how to create a timed context every time i querry my context it return normal and when i get value from it,i got huge non sense number.

def computeHelper( self,plug,dataBlock ):
if plug == pyAnimationFilter.output:
context = OpenMaya.MDGContext(OpenMaya.MTime())
dataHandle = dataBlock.inputValue( pyAnimationFilter.input1 )
in1 = dataHandle.asFloat()
context = dataBlock.context()
currTime = OpenMaya.MTime()
print context.isNormal()
print currTime.value()
data = in1
outFilter = dataBlock.outputValue( pyAnimationFilter.output )

12 December 2010, 05:50 AM
problem solved.

12 December 2010, 01:22 PM
so what was it? anything that may help someone else looking in future?

12 December 2010, 08:30 PM
In my original code i didnt have

dataHandle = dataBlock.inputValue( pyAnimationFilter.input1 )

because im not using it in my code,but having it sit in my compute make it so my node update everyframe ,without it, it was only updating when i release my mouse.

Oh and to get currentTime i just used

currTime = OpenMaya.MTime()
currTime = OpenMayaAnim.MAnimControl.currentTime()

CGTalk Moderation
12 December 2010, 08:30 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.