Update of /cvsroot/cgkit/maya/plug-ins/sourcepy
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10581
Added Files:
readme.txt
Log Message:
Added a readme with build instructions and documentation
--- NEW FILE: readme.txt ---
######################################################################
sourcepy Maya plugin
Copyright (C) 2005 Matthias Baas
######################################################################
Installation
============
The plugin is built using SCons (www.scons.org). If necessary, you can
do customizations in a file config.py where you can set additional
include paths and library paths in the lists CPPPATH and
LIBPATH. Example:
CPPPATH = ["...path1...", "...path2...", ...]
LIBPATH = ["...path1...", "...path2...", ...]
You have to make sure that the Maya SDK and the Python SDK can be found.
To compile the plugin you have to call "scons" in the root directory of
the sourcepy plugin (where the SConstruct file is located).
If everything went fine, the result will be in the bin subdirectory
(the file will be called sourcepy.mll or sourcepy.so) from where you
can copy it to any convenient place where Maya is able to find it
(e.g. maya/<version>/plug-ins).
Documentation
=============
This plugin defines two new MEL commands sourcePy and evalPy that can
be used to run Python code from within Maya.
All Python code is executed in the same namespace which means that
global variables, functions, modules, etc. can be shared by several
scripts or expressions (for example, you can source a Python file that
defines a function which can then be used inside an expression). Note
that this also means that a module only gets imported once. If you do
modifications to a module, you have to reload it. So when you are
developing a Python module you have to import the module like this:
import mymod
reload(mymod)
(Another workaround would be to unload the sourcepy plugin and load it
again which would reset the global namespace)
sourcePy
--------
Usage: sourcePy filename
The sourcePy command is equivalent to the builtin source command, it
just executes the file as Python code instead of MEL. The command
takes one argument which is the file name of the Python source file.
When the name is given with an absolute path it is executed directly,
otherwise the command searches in the same locations where MEL files
are searched. If no file extension is given, the suffix ".py" is
assumed. Before the file is executed the command changes into the
directory where the file is located. This means local modules (or data
files) can be imported without having to worry about the module search
path.
evalPy
------
Usage: evalPy [-x/--exec] string
The evalPy command executes the contents of a string as Python code,
similar to the eval MEL command. By default, the string is executed as
a Python expression and the result is returned.
When the -x/--exec option is specified, the string is executed as a
series of Python commands (which may be separated by newlines) and no
value is returned.
|