Cortex  10.0.0-a4
Public Member Functions | Static Public Member Functions | List of all members
IECoreMaya::PythonCmd Class Reference

#include <PythonCmd.h>

Inherits MPxCommand.

Public Member Functions

MStatus doIt (const MArgList &args)
 

Static Public Member Functions

static void * creator ()
 
static MSyntax newSyntax ()
 
static void import (const std::string &moduleName)
 
static void initialize ()
 
static void uninitialize ()
 
static boost::python::object & globalContext ()
 

Detailed Description

A Maya plugin command to allow execution of Python statements/files under specific named contexts. Provides methods for creating and deleting contexts. Flags:

If a context for execution is not specified then a default global one is used.
Examples:

python -command "print(str(dir()))"
python -createContext "myContext" -command "i = 3";
python -context "myContext" -command "print(i)";
python -createContext "anotherContext" -command "print(i)";
python -createContext "moreContext";;
python -file "/tmp/somePython.py";
python -eval "10 * 10";

Todo:

Support the conversion of -eval results into the most appropriate mel form based on type

Split the management of python contexts and all the evaluation code into a Python object defined in an IECorePython library. Then we can use that object in a Nuke python plugin and wherever else we want. And this command becomes a lot smaller and easier to maintain. Nice.

Member Function Documentation

static boost::python::object& IECoreMaya::PythonCmd::globalContext ( )
static

Returns the python context used for commands not specifying a context. This may be useful for executing python code from c++ elsewhere.


The documentation for this class was generated from the following file: