How to get an value from 2 frames before the current frame using API! 2003-12-16 - By Erick Miller
Back Use the MDGContext class with MPlug. Here is an example of using it with MPlug::getValue() to get the value of an internal attribute on a node back into an MObject (the attribute is in an MObject called inputMeshAttribute) , this example would work for an attribute of MFnData::kMesh (polygon mesh) which is a more complex example, but would work just the same for simple numeric attributes and multis or compounds just as well, using all the similar MPlug member functions :
double frameLagDbl = 2.0; MTime timer = MAnimControl::currentTime(); double nowTime = timer.value(); double lagTime = nowTime - frameLagDbl; timer.setValue( lagTime ); MDGContext timeContext( timer ); MObject thisNode = thisMObject(); MPlug inputGeometryPlug( thisNode, inputMeshAttribute );
MObject laggedInputGeomObj; inputGeometryPlug.getValue( laggedInputGeomObj, timeContext );
Cheers, Erick
hradec.com wrote:
>I need to get an attribute value using MDataBlock.inputValue() from >inside my compute function, but I need to get that value from 2 frames >before the current frame. Just like getAttr -t option, but for >MDataBlock.inputValue()! >How can I do that? Can I use MGlobal::viewFrame()? Or theres another way >to do that? >[]'s Hradec >hradec@(protected) >www.hradec.com/hradec > -- Erick Miller Technical Director emiller@(protected) Digital Domain, 300 Rose Ave, Venice, CA 90291 (310)314-2800 ext.3504 __ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ __
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- List-help: <mailto:listar@(protected)?Subject=help> List-archive: <http://www.highend3d.com/maya/devarchive/>
|
|