hohehohe2's OpenMaya tutorial     kotamuraa@yahoo.co.jp



Getting/Setting the current time

(The all codes in this page are not tested)

There are several ways to get/set the current time.
Whenever you changed the current time, make sure you implement
undo/redo.

1. The easiest way. Use MEL command.

[Get]
double result;
MGlobal::executeCommand("currentTime -q", result;)

[Set]
MDGModifier  dmod;
dmod.commandToExecute("currentTime 30");

2. Use MGlobal

[Get]
none

[Set]
MTime time(30); //film (24 frames per second)
MGlobal::viewFrame(time);

3. Access time1 node attribute
"time1" node holds the current time.

[Get]
MSelectionList selList;
selList.add( "time1" );
MObject objTme;
list.getDependNode( 0, objTme);

[Set]

(-_-) I haven't written this yet.


What's the best way?

Executing MEL command is the easiest, and usually time consuming. But
changing the current time itself is much more time consuming,
since Maya has to redraw the view, update a lot of attributes,...
So I think the time to execute MEL command can be ignored.


Contents


Maya is a registered trademark of Autodesk
Copyright
© 2003, Koichi Tamura. All Rights Reserved.

















[PR]AE€ŽdŽ–‚Ι‚ΰŒ§–―«‚ͺo‚ιH:–³—ΏΆέΐݐ肒‚Ε“ϊ•₯‚’‚ΰ±―Μί