class MComputation

Jump to documentation

Interupt monitor for long computations. (OpenMaya) (OpenMaya.py)

public members:

MComputation ()
virtual ~MComputation ()
void beginComputation ()
bool isInterruptRequested ()
void endComputation ()

Documentation

An MComputation is used to monitor user-interupts during long computations.
Description

An MComputation allows long computations to check for user interrupts. It is very simple to use. Create a new MComputation object and call the beginComputation method at the beginning of the computation and call the endComputation method when you finish. Then, during the computation, use the isInterruptRequested method to check if the user has requested that the computation terminate.

Example: (of a simple traversal)

    MComputation computation;
    computation.beginComputation();
    for (int i= 1; i<1000; i++) {
        Computation();  // Some expensive operation
        if  (computation.isInterruptRequested()) break ;
    }
    computation.endComputation();			

Functions

MComputation:: MComputation ()

Description

Constructor for MComputation. Instantiate an MComputation before entering a long computation that should be interruptible.

MComputation:: ~MComputation ()

Description

Class destructor

void MComputation:: beginComputation ()

Description

Mark the beginning of a long computation. The application will begin looking for user interupts.

bool MComputation:: isInterruptRequested ()

Description

Query whether a user-interrupt has occurred.

Return Value

  • true if an interrupt has occurred

void MComputation:: endComputation ()

Description

Mark the ending of a long computation. The application will stop looking for user interupts.

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright