#ifndef _MGlobal #define _MGlobal // //- // ========================================================================== // Copyright (C) 1995 - 2006 Autodesk, Inc., and/or its licensors. All // rights reserved. // // The coded instructions, statements, computer programs, and/or related // material (collectively the "Data") in these files contain unpublished // information proprietary to Autodesk, Inc. ("Autodesk") and/or its // licensors, which is protected by U.S. and Canadian federal copyright law // and by international treaties. // // The Data may not be disclosed or distributed to third parties or be // copied or duplicated, in whole or in part, without the prior written // consent of Autodesk. // // The copyright notices in the Software and this entire statement, // including the above license grant, this restriction and the following // disclaimer, must be included in all copies of the Software, in whole // or in part, and all derivative works of the Software, unless such copies // or derivative works are solely in the form of machine-executable object // code generated by a source language processor. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. // AUTODESK DOES NOT MAKE AND HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED // WARRANTIES INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF // NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, // OR ARISING FROM A COURSE OF DEALING, USAGE, OR TRADE PRACTICE. IN NO // EVENT WILL AUTODESK AND/OR ITS LICENSORS BE LIABLE FOR ANY LOST // REVENUES, DATA, OR PROFITS, OR SPECIAL, DIRECT, INDIRECT, OR // CONSEQUENTIAL DAMAGES, EVEN IF AUTODESK AND/OR ITS LICENSORS HAS // BEEN ADVISED OF THE POSSIBILITY OR PROBABILITY OF SUCH DAMAGES. // ========================================================================== //+ // // CLASS: MGlobal // // ***************************************************************************** // // CLASS DESCRIPTION (MGlobal) // // MGlobal is a static class which provides access to Maya's model (3d // graphical database). // // MGlobal provides methods for selection, 3d-views, setting the global // time, adding to the DAG, and executing MEL commands from within the API. // // MGlobal also provides methods for controlling error logging in the API. // // ***************************************************************************** #if defined __cplusplus // ***************************************************************************** // INCLUDED HEADER FILES #include #include #include #include #include #include #include #include // ***************************************************************************** // DECLARATIONS class MPoint; class MString; class MTime; class MVector; class MSelectionList; class MDagPath; class MObjectArray; class MCommandResult; // ***************************************************************************** // CLASS DECLARATION (MGlobal) /// Static class providing common API global functions. (OpenMaya) (OpenMaya.py) /** Provide methods for selection, 3D-views, time, model manipulation and MEL commands. */ #ifdef _WIN32 #pragma warning(disable: 4522) #endif // _WIN32 class OPENMAYA_EXPORT MGlobal { public: /// static MString mayaVersion (); /// enum MMayaState { /// running with a UI kInteractive, /// running without a UI kBatch, /// A standalone (MLibrary) application is running kLibraryApp, /// Running in baseUI mode kBaseUIMode }; /// static MMayaState mayaState( MStatus * ReturnStatus = NULL ); /// static MStatus getFunctionSetList( MObject forObject, MStringArray & array ); /// static MStatus getAssociatedSets( MSelectionList & list, MObjectArray & setArray ); /// static MStatus getSelectionListByName( const MString& name, MSelectionList &list ); /// enum ListAdjustment { // Comments use active list as example. /// kReplaceList, // Totally replace the active list with the given items. /// kXORWithList, // If one of the given items is in the active list take // it out, otherwise add it to the active list. /// kAddToList, // Add the items to the list /// kRemoveFromList // Remove the items from the list }; /// static MStatus getActiveSelectionList( MSelectionList & dest ); /// static MStatus getLiveList( MSelectionList & dest ); /// static MStatus getHiliteList( MSelectionList & dest ); /// static MStatus setHiliteList( MSelectionList & src ); /// static MStatus setActiveSelectionList( MSelectionList & src, ListAdjustment=kReplaceList); /// static MStatus setDisplayCVs( MSelectionList&, bool ); // /// static MStatus selectCommand( MSelectionList & src, ListAdjustment=kReplaceList); /// static MStatus selectByName( const MString& name, ListAdjustment=kAddToList ); /// static MStatus unselectByName( const MString& name ); /// static MStatus select( MObject& object, ListAdjustment=kAddToList ); /// static MStatus select( MDagPath& object, MObject& component, ListAdjustment=kAddToList ); /// static MStatus unselect( MObject& object ); /// static MStatus unselect( MDagPath& object, MObject& component ); /// static MStatus selectFromScreen( short& x_pos, short& y_pos, ListAdjustment=kAddToList ); /// static MStatus selectFromScreen( short& start_x, short& start_y, short& end_x, short& end_y, ListAdjustment=kAddToList ); /// enum MSelectionMode { /// kSelectObjectMode, /// kSelectComponentMode, /// kSelectRootMode, /// kSelectLeafMode, /// kSelectTemplateMode }; /// static MSelectionMode selectionMode( MStatus * ReturnStatus = NULL ); /// static MStatus setSelectionMode( MSelectionMode mode ); /// static MSelectionMask objectSelectionMask( MStatus * ReturnStatus = NULL ); /// static MStatus setObjectSelectionMask( MSelectionMask& mask ); /// static MSelectionMask componentSelectionMask( MStatus * ReturnStatus = NULL ); /// static MStatus setComponentSelectionMask( MSelectionMask& mask ); /// static MSelectionMask animSelectionMask( MStatus * ReturnStatus = NULL ); /// static MStatus setAnimSelectionMask( MSelectionMask& mask ); /// static MSelectionMask miscSelectionMask( MStatus * ReturnStatus = NULL ); /// static MStatus setMiscSelectionMask( MSelectionMask& mask ); /// static MStatus clearSelectionList(); /// static bool isSelected( MObject& object, MStatus * ReturnStatus = NULL ); /// static MStatus viewFrame( const MTime & time ); /// static MStatus viewFrame( double time); /// static MStatus sourceFile( const MString& fileName ); /// static MStatus executeCommandOnIdle( const MString& command, bool displayEnabled = false); /// static MStatus executeCommand( const MString& command, bool displayEnabled = false, bool undoEnabled = false); /// static MStatus executeCommand( const MString& command, MCommandResult& result, bool displayEnabled = false, bool undoEnabled = false ); /// static MStatus executeCommand( const MString& command, int& result, bool displayEnabled = false, bool undoEnabled = false ); /// static MStatus executeCommand( const MString& command, MIntArray& result, bool displayEnabled = false, bool undoEnabled = false ); /// static MStatus executeCommand( const MString& command, double& result, bool displayEnabled = false, bool undoEnabled = false ); /// static MStatus executeCommand( const MString& command, MDoubleArray& result, bool displayEnabled = false, bool undoEnabled = false ); BEGIN_NO_SCRIPT_SUPPORT: /// NO SCRIPT SUPPORT static MStatus executeCommand( const MString& command, MString& result, bool displayEnabled = false, bool undoEnabled = false ); END_NO_SCRIPT_SUPPORT: /// static MString executeCommandStringResult( const MString& command, bool displayEnabled = false, bool undoEnabled = false, MStatus * ResultStatus = NULL); /// static MStatus executeCommand( const MString& command, MStringArray& result, bool displayEnabled = false, bool undoEnabled = false ); /// static MStatus executePythonCommand ( const MString& command, bool displayEnabled = false, bool undoEnabled = false ); /// static MStatus executePythonCommand ( const MString& command, int& result, bool displayEnabled = false, bool undoEnabled = false ); /// static MStatus executePythonCommand ( const MString& command, MIntArray& result, bool displayEnabled = false, bool undoEnabled = false ); /// static MStatus executePythonCommand ( const MString& command, double& result, bool displayEnabled = false, bool undoEnabled = false ); /// static MStatus executePythonCommand ( const MString& command, MDoubleArray& result, bool displayEnabled = false, bool undoEnabled = false ); /// NO SCRIPT SUPPORT static MString executePythonCommandStringResult ( const MString& command, bool displayEnabled = false, bool undoEnabled = false, MStatus * ReturnStatus = NULL); BEGIN_NO_SCRIPT_SUPPORT: /// NO SCRIPT SUPPORT static MStatus executePythonCommand ( const MString& command, MString& result, bool displayEnabled = false, bool undoEnabled = false ); END_NO_SCRIPT_SUPPORT: /// static MStatus executePythonCommand ( const MString& command, MStringArray& result, bool displayEnabled = false, bool undoEnabled = false ); /// static MStatus executePythonCommandOnIdle( const MString& command, bool displayEnabled = false); /// static MStatus addToModel( MObject & object, MObject & parent = MObject::kNullObj ); /// static MStatus addToModelAt( MObject&, const MVector& point, const double scale[3] = NULL, const double rotation[3] = NULL, MTransformationMatrix::RotationOrder order = MTransformationMatrix::kXYZ ); /// static MStatus removeFromModel( MObject& ); /// static MStatus deleteNode( MObject& ); /// static MStatus setYAxisUp( bool rotateView = false ); /// static MStatus setZAxisUp( bool rotateView = false ); /// static bool isYAxisUp( MStatus* = NULL ); /// static bool isZAxisUp( MStatus* = NULL ); /// static MVector upAxis( MStatus* = NULL ); /// static void displayInfo( const MString & theMessage ); /// static void displayWarning( const MString & theWarning ); /// static void displayError( const MString & theError ); /// static void setDisableStow( bool state ); /// static bool disableStow( ); /// setting & getting option variable values static int optionVarIntValue(const MString& name, bool *result = NULL ); /// static double optionVarDoubleValue(const MString& name, bool *result = NULL); /// static MString optionVarStringValue(const MString& name, bool *result = NULL); /// static bool setOptionVarValue(const MString& name, int value); /// static bool setOptionVarValue(const MString& name, double value); /// static bool setOptionVarValue(const MString& name, MString value); // Support for DEBUG/NDEBUG API // /// static MString defaultErrorLogPathName( MStatus* ReturnStatus = NULL ); /// static MStatus resetToDefaultErrorLogPathName(); /// static MStatus setErrorLogPathName( const MString& logPathName ); /// static MString errorLogPathName( MStatus* ReturnStatus = NULL ); /// static MStatus startErrorLogging(); /// static MStatus startErrorLogging( const MString& logPathName ); /// static bool errorLoggingIsOn( MStatus* ReturnStatus = NULL ); /// static MStatus stopErrorLogging(); /// static MStatus closeErrorLog(); /// static MStatus doErrorLogEntry( const MString& errorLogEntry ); /// static bool isUndoing(); /// static bool isRedoing(); BEGIN_NO_SCRIPT_SUPPORT: /// OBSOLETE & NO SCRIPT SUPPORT static bool getOptionVarValue(const MString& name, int& value); /// OBSOLETE & NO SCRIPT SUPPORT static bool getOptionVarValue(const MString& name, double& value); /// OBSOLETE & NO SCRIPT SUPPORT static bool getOptionVarValue(const MString& name, MString& value); END_NO_SCRIPT_SUPPORT: protected: static const char* className(); private: ~MGlobal(); #ifdef __GNUC__ friend class shutUpAboutPrivateDestructors; #endif }; #ifdef _WIN32 #pragma warning(default: 4522) #endif // _WIN32 // ***************************************************************************** #endif /* __cplusplus */ #endif /* _MGlobal */