cgkit-commits Mailing List for Python Computer Graphics Kit
Brought to you by:
mbaas
You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(54) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(40) |
Feb
(69) |
Mar
(43) |
Apr
(81) |
May
(92) |
Jun
(56) |
Jul
(35) |
Aug
(59) |
Sep
(41) |
Oct
(26) |
Nov
(15) |
Dec
(12) |
| 2006 |
Jan
(20) |
Feb
(23) |
Mar
(47) |
Apr
(87) |
May
(43) |
Jun
(7) |
Jul
(20) |
Aug
(5) |
Sep
(29) |
Oct
(83) |
Nov
(34) |
Dec
(16) |
| 2007 |
Jan
(11) |
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
(3) |
Feb
(24) |
Mar
(2) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(4) |
Sep
(8) |
Oct
(2) |
Nov
(1) |
Dec
|
| 2009 |
Jan
(8) |
Feb
(22) |
Mar
(5) |
Apr
(10) |
May
(9) |
Jun
(8) |
Jul
(2) |
Aug
(13) |
Sep
(10) |
Oct
|
Nov
|
Dec
(1) |
| 2010 |
Jan
(3) |
Feb
(1) |
Mar
(4) |
Apr
(2) |
May
(3) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
(7) |
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(1) |
Nov
(4) |
Dec
(5) |
| 2013 |
Jan
|
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
1
|
2
|
3
(2) |
4
|
|
5
|
6
|
7
|
8
|
9
|
10
(6) |
11
|
|
12
(5) |
13
|
14
|
15
(1) |
16
|
17
|
18
|
|
19
(4) |
20
(6) |
21
(5) |
22
(1) |
23
(6) |
24
(5) |
25
|
|
26
|
27
|
28
|
29
(1) |
30
(5) |
31
|
|
|
From: Matthias B. <mb...@us...> - 2006-03-30 07:38:23
|
Update of /cvsroot/cgkit/maya/maya_wrapper/src_aux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23210 Added Files: creatorfuncmanager.cpp creatorfuncmanager.h Log Message: Added support code for the MFnPlugin class --- NEW FILE: creatorfuncmanager.cpp --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ #include "creatorfuncmanager.h" #include <iostream> #include "creatorfuncs.cpp.h" /** Acquire a creator function that will invoke a Python creator function. */ CreatorFunc CreatorFuncManager::acquireCFunc(boost::python::object callable) { int idx = getFreeIndex(); std::cout<<"Creator index: "<<idx<<std::endl; if (idx==-1) return 0; pycreatorfuncs[idx] = callable; return ccreatorfuncs[idx]; } /** Release a creator function. This method has to be called when a plugin is deregistered. The corresponding creator function can then be used for new plugins. Returns true if the operation was successful (otherwise cfunc was either invalid or already referred to an unused function). */ bool CreatorFuncManager::releaseCFunc(CreatorFunc cfunc) { std::cout<<"CreatorFuncManager::releaseCFunc("<<(long)cfunc<<")"<<std::endl; int idx = getFuncIndex(cfunc); std::cout<<" Func index: "<<idx; if (idx==-1) return false; bool res = (pycreatorfuncs[idx]!=boost::python::object()); // Set the Python callable to None pycreatorfuncs[idx] = boost::python::object(); return res; } /** Return the index of an unused creator function. -1 is returned when all functions are already in use. \returns Function index (0-MAX_CREATOR_FUNCTIONS-1) or -1 */ int CreatorFuncManager::getFreeIndex() { boost::python::object None; // Search for the first index that has None as its Python callable... for(int i=0; i<MAX_CREATOR_FUNCTIONS; i++) { if (pycreatorfuncs[i]==None) return i; } return -1; } /** Obtain the index of a C creator function. Returns the index of a creator function (or -1 which shouldn't happen at all). */ int CreatorFuncManager::getFuncIndex(CreatorFunc func) { // Search for the given function... for(int i=0; i<MAX_CREATOR_FUNCTIONS; i++) { if (ccreatorfuncs[i]==func) return i; } std::cerr<<"ERROR: CreatorFuncManager::getFuncIndex() received an invalid creator function handle!"<<std::endl; return -1; } --- NEW FILE: creatorfuncmanager.h --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ #include <boost/python.hpp> // Define a type "CreatorFunc" for the C creator functions typedef void* (*CreatorFunc)(); /** Plugin creator function manager. */ class CreatorFuncManager { public: CreatorFuncManager() {} CreatorFunc acquireCFunc(boost::python::object callable); bool releaseCFunc(CreatorFunc cfunc); private: int getFreeIndex(); int getFuncIndex(CreatorFunc func); }; |
|
From: Matthias B. <mb...@us...> - 2006-03-30 07:37:47
|
Update of /cvsroot/cgkit/maya/maya_wrapper/src_aux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22760 Added Files: _main.h _main.cpp Log Message: Added a main source file for 'global' functions. --- NEW FILE: _main.cpp --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ #include <maya/MObject.h> MObject toMObject(long addr) { MObject* obj = (MObject*)addr; return *obj; } --- NEW FILE: _main.h --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ #include <maya/MObject.h> MObject toMObject(long addr); |
|
From: Matthias B. <mb...@us...> - 2006-03-30 07:23:19
|
Update of /cvsroot/cgkit/maya/maya_wrapper/maya In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14558 Modified Files: __init__.py Log Message: Added the pluginObject() function Index: __init__.py =================================================================== RCS file: /cvsroot/cgkit/maya/maya_wrapper/maya/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 24 Mar 2006 17:13:42 -0000 1.2 --- __init__.py 30 Mar 2006 07:23:12 -0000 1.3 *************** *** 1,3 **** --- 1,21 ---- # Init + import sys + import _api #from node import Node + + def pluginObject(): + """Return the plugin object. + + Returns the MObject that is passed to the initializePlugin() and + uninitializePlugin() functions. + """ + if not hasattr(sys, "__maya_pluginobj"): + raise RuntimeError, "Could not retrieve the plugin object" + + obj = sys.__maya_pluginobj + + if type(obj)==int: + return _api.toMObject(obj) + else: + raise RuntimeError, "Invalid plugin object type" |
|
From: Matthias B. <mb...@us...> - 2006-03-30 07:22:05
|
Update of /cvsroot/cgkit/maya/maya_wrapper/maya/initmaya In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13550/initmaya Added Files: __init__.py pythoneditor.py Log Message: Added the initmaya module --- NEW FILE: pythoneditor.py --- # Python Editor import sys, StringIO from maya.GUI import * from maya import mel from maya import api class PyEditorWindow(Window): """An editor window similar to the MEL script editor. The editor is invoked as follows: win = PyEditorWindow() win.show() During Maya/Python initialization a MEL function "PythonEditor" is created that opens a Python Editor window. """ def __init__(self): """Constructor. """ Window.__init__(self, title="Python Editor", menuBar=True) # File menu Menu(label="File") MenuItem(label="Open script...", command=self.onOpenScript) MenuItem(label="Source script...", command=self.onSourceScript) MenuItem(label="Save selected...", command=self.onSaveSelected) # MenuItem(divider=True) # MenuItem(label="Exit")#, command=exit) # Edit menu Menu(label="Edit") MenuItem(label="Clear history", command=self.onClearHistory) MenuItem(label="Clear input", command=self.onClearInput) MenuItem(label="Clear all", command=self.onClearAll) # Script menu Menu(label="Script") MenuItem(label="Execute", command=self.onEnter) mel.paneLayout(configuration="horizontal2") # Output widget self._outputfield = ScrollField( text = "Python %s\n"%sys.version, height = 150, editable = False ) # Input widget self._editfield = ScrollField( text = "", height = 150, enterCommand = self.onEnter ) # Set focus to the input field... mel.setFocus(str(self._editfield)) # onEnter def onEnter(self): """Callback that is called when 'enter' was hit. This method executed the Python script. """ # Capture stdout... stdout = sys.stdout stderr = sys.stderr output = StringIO.StringIO() sys.stdout = output # sys.stderr = output # Execute the source code... src = self._editfield.selection clear_flag = False if src=="": src = self._editfield.text clear_flag = True # Replace \r\n with a single \n src = src.replace("\r\n", "\n") # Replace remaining single \r with \n # (this is required for selected text...!?) src = src.replace("\r", "\n") try: exec src in globals() except: sys.stdout = stdout sys.stderr = stderr # Append the captured stdout to the output widget... self._outputfield.insertText = output.getvalue() self._outputfield.insertText = "<an error has occurred, see the output window>\n" output.close() raise sys.stdout = stdout sys.stderr = stderr # Append the captured stdout to the output widget... self._outputfield.insertText = output.getvalue() if clear_flag: self.onClearInput() def onOpenScript(self): """Callback. Open a Python script. """ filename = mel.fileDialog(directoryMask="*.py") if filename=="": return f = file(filename, "rt") data = f.read() self._editfield.text = data f.close() def onSourceScript(self): """Callback. Source a Python script. """ filename = mel.fileDialog(directoryMask="*.py") if filename=="": return mel.pySource(filename) def onSaveSelected(self): """Callback. """ pass # filename = mel.fileDialog(directoryMask="*.py") # if filename=="": # return # data = self._editfield.selection # f = file(filename, "wt") # f.write(data) # f.close() def onClearHistory(self): """Callback. """ self._outputfield.text = "" def onClearInput(self): """Callback. """ self._editfield.text = "" def onClearAll(self): """Callback. """ self._outputfield.text = "" self._editfield.text = "" # findMenuItem def findMenuItem(menu, label): """Find a menu item in a menu. label is the label of the menu item that should be searched for. Returns the item name or None. """ items = mel.menu(menu, query=None, itemArray=None) for item in items: # Skip dividers... if mel.menuItem(item, query=None, divider=None): continue # Compare the item label... ml = mel.menuItem(item, query=None, label=None) if ml==label: return item return None # insertPyEditorMenuItems def insertPyEditorMenuItems(): """Append the Python menu items to the Maya menu. A menu item 'Python Editor...' is added to the 'Window.General Editors' menu. If the menu item already exists, the function returns immediately. """ # "MayaWindow" is taken from $gMainWindow mayawin = "MayaWindow" mainWindowMenu = "mainWindowMenu" # Check if the 'Window' menu is there... menus = mel.window(mayawin, query=None, menuArray=None) if mainWindowMenu not in menus: raise ValueError, "'Window' menu not found" # Search the 'General Editors' menu... generaleditors = findMenuItem(mainWindowMenu, "General Editors") if generaleditors==None: raise ValueError, "'General Editors' not found in Window menu" # Make sure the menu is available (this builds the menu if it wasn't # already there) melcmd = api.MString('buildObjectEdMenu "%s|%s|%s"'%(mayawin, mainWindowMenu, generaleditors)) stat = api.MGlobal.executeCommand(melcmd) if not stat: raise RuntimeError, "Failed to build the 'General Editors' menu" pyedit = findMenuItem(generaleditors, "Python Editor...") # Menu item already there? then exit if pyedit!=None: return mel.setParent(generaleditors, menu=None) mel.menuItem(divider=True) mel.menuItem(label="Python Editor...", command="PythonEditor", annotation="Python Editor: Enter Python commands") def PythonEditor(): """Callback. This function is called when the 'Python Editor...' menu item is selected. """ win = PyEditorWindow() win.show() --- NEW FILE: __init__.py --- # Initialize Maya """This module can be imported in userSetup.mel to invkoe some initializations. The module does the following: - Add a menu item Window.GeneralEditors.Python Editor... and make available a MEL command PythonEditor that opens an editor similar to the builtin Script Editor. """ import maya.api import pythoneditor # Define the MEL function "PythonEditor"... maya.api.MGlobal.executeCommand("""global proc PythonEditor() { python "maya.initmaya.pythoneditor.PythonEditor()"; } """) pythoneditor.insertPyEditorMenuItems() |
|
From: Matthias B. <mb...@us...> - 2006-03-30 07:19:51
|
Update of /cvsroot/cgkit/maya/maya_wrapper/maya/initmaya In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12290/initmaya Log Message: Directory /cvsroot/cgkit/maya/maya_wrapper/maya/initmaya added to the repository |
|
From: Matthias B. <mb...@us...> - 2006-03-29 19:14:16
|
Update of /cvsroot/cgkit/maya/maya_wrapper In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25700 Modified Files: setup.py Log Message: Define the REQUIRE_IOSTREAM symbol Index: setup.py =================================================================== RCS file: /cvsroot/cgkit/maya/maya_wrapper/setup.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** setup.py 24 Mar 2006 17:14:34 -0000 1.6 --- setup.py 29 Mar 2006 19:14:01 -0000 1.7 *************** *** 16,19 **** --- 16,20 ---- MACROS += [("MNoVersionString", None)] MACROS += [("MNoPluginEntry", None)] + MACROS += [("REQUIRE_IOSTREAM", None)] CC_ARGS = [] |
|
From: Matthias B. <mb...@us...> - 2006-03-24 17:14:38
|
Update of /cvsroot/cgkit/maya/maya_wrapper In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4274 Modified Files: setup.py Log Message: Added the _mel module Index: setup.py =================================================================== RCS file: /cvsroot/cgkit/maya/maya_wrapper/setup.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** setup.py 21 Mar 2006 13:31:09 -0000 1.5 --- setup.py 24 Mar 2006 17:14:34 -0000 1.6 *************** *** 48,52 **** url = "http://cgkit.sourceforge.net", ! packages = ["maya", "maya.api", "maya.GUI", "maya.mel"], ext_modules=[Extension("maya._api", srcs --- 48,52 ---- url = "http://cgkit.sourceforge.net", ! packages = ["maya", "maya.api", "maya.GUI", "maya._mel", "maya.mel"], ext_modules=[Extension("maya._api", srcs |
|
From: Matthias B. <mb...@us...> - 2006-03-24 17:14:05
|
Update of /cvsroot/cgkit/maya/maya_wrapper/maya/mel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3718/mel Modified Files: __init__.py Log Message: Renamed the automatic mel module into _mel and added a wrapper mel that has the chance to replace some functions Index: __init__.py =================================================================== RCS file: /cvsroot/cgkit/maya/maya_wrapper/maya/mel/__init__.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** __init__.py 23 Mar 2006 10:50:58 -0000 1.5 --- __init__.py 24 Mar 2006 17:13:48 -0000 1.6 *************** *** 8,197 **** """ ! import types ! from maya.api import MGlobal ! ! # Debug flag ! # (this can be set to True manually to enable some additional output) ! _debug = False ! ! # _parseHelp ! def _parseHelp(help): ! """Parse a help string and return the keyword arguments and the doc string. ! ! help is the string obtained by the 'help' MEL command. The function ! returns a tuple (keywordargs, multiuse, docstring) where keywordargs ! is a list of strings containing the option names of the command (short ! names and long names). multiuse is a dictionary containing those option ! names that are multi-use options (short and long names). The key is the ! option name and the value is irrelevant (non-multi-use options are not ! added to the dictionary). ! docstring contains the reformatted help text which can be used as doc ! string in the source code that will be generated. ! """ ! lines = help.split("\n") ! ! # Strip leading newlines ! while lines[0]=="": ! lines = lines[1:] ! # Strip trailing newlines ! while lines[-1]=="": ! lines = lines[:-1] ! keyargs = [] ! multiuse = {} ! doc = [] ! for nr,line in enumerate(lines): ! a = line.split() ! # Does the line contain flags? ! if len(a)>1 and a[0][0]=='-' and a[1][0]=='-': ! shortname = a[0][1:] ! longname = a[1][1:] ! keyargs.append(shortname) ! keyargs.append(longname) ! if a[-1]=="(multi-use)": ! multiuse[shortname] = 1 ! multiuse[longname] = 1 ! if nr>0: ! line = " "+line ! doc.append(line) - return keyargs, multiuse, "\n".join(doc) ! # _py2mel ! def _py2mel(seq): ! """Return a list of the individual items in a (possibly nested) sequence. ! Returns a list with all items as strings. ! If an item was already a string it's enclosed in apostrophes. ! Example: _py2mel( [(1,2,3), (4,5,6)] ) -> ["1","2","3","4","5","6"] ! _py2mel( ("str1","str2") ) -> ['"str1"','"str2"'] ! """ ! res = [] ! ScalarTypes = [types.IntType, types.LongType, types.FloatType] ! StringType = types.StringType ! for v in seq: ! vtype = type(v) ! # v=scalar? ! if vtype in ScalarTypes: ! res.append(str(v)) ! # v=string? ! elif vtype==StringType: ! v = v.replace('"', '\\"') ! res.append('"%s"'%v) ! # bool? ! elif vtype==bool: ! if v: ! res.append('1') ! else: ! res.append('0') ! # v=list? convert to MEL array ! elif vtype==list: ! toks = _py2mel(v) ! res.append("{%s}"% ", ".join(toks)) ! # no scalar, string or list. Then it's supposed to be a sequence which is converted ! # to a list of individual values... ! else: ! try: ! size = len(v) ! except: ! raise ValueError, "Sequence expected, got %s instead."%(vtype) ! res += _py2mel(v) ! return res ! ! ! # _call ! def _call(_funcname, multiuse={}, *args, **flags): ! """Invoke a MEL command. ! ! _funcname is the name of the MEL command. multiuse is a dictionary ! that contains the names of the multi-use options. args contains ! the arguments and flags the options. ! """ ! ! # toks is a list of tokens that will be concatenated to form the ! # final MEL command. Begin with the command name ! toks = [_funcname] ! ! # Search for the query/edit flags first as these must be at the front ! # of the flag list... ! if "query" in flags: ! toks += ["-query"] ! del flags["query"] ! if "q" in flags: ! toks += ["-q"] ! del flags["q"] ! if "edit" in flags: ! toks += ["-edit"] ! del flags["edit"] ! if "e" in flags: ! toks += ["-e"] ! del flags["e"] ! ! # Add the flags... ! for flag in flags: ! val = flags[flag] ! # Is this a multi-use flag? ! if flag in multiuse: ! # Add the option before each individual value... ! for v in val: ! toks += ["-"+flag] ! toks += _py2mel([v]) ! else: ! # It's a normal flag, so the option only appears once... ! toks += ["-"+flag] ! if val!=None: ! toks += _py2mel([val]) ! ! # ...and the arguments ! for arg in args: ! toks += _py2mel([arg]) ! ! # Combine all the tokens and execute the command ! cmd = " ".join(toks) ! if _debug: ! print "***MEL command:",cmd ! return MGlobal.executeCommandPy(cmd) ! ! ! ###################################################################### ! ! # Don't create functions that are named like a Python keyword ! pykeywords = ["pass", "del", "print", "return", "yield", "raise", "break", ! "continue", "import", "global", "exec", "if", "while", "for", ! "try", "except"] ! ! # Get a list of all available MEL commands ! cmdlst = MGlobal.executeCommandPy('help -list "*"') ! ! #print len(cmdlst), "commands" ! #cmdlst = cmdlst[-2:] ! #cmdlst = ["ls", "sphere", "curve"] ! ! # Create wrapper functions... ! nummultiuse = 0 ! for cmd in cmdlst: ! # Get the help text for the current command ! help = MGlobal.executeCommandPy('help %s'%cmd) ! ! keyargs, multiuse, doc = _parseHelp(help) ! ! # Don't try to wrap functions that have invalid names ! if cmd in pykeywords: ! continue ! ! # Create the source code of the wrapper function... ! src = '# %s\n'%cmd ! # src += 'def %s(%s):\n'%(cmd, ", ".join(map(lambda x: x+"=None", keyargs))) ! src += 'def %s(*args, **flags):\n'%(cmd) ! src += ' """%s\n """\n'%doc ! if multiuse!={}: ! nummultiuse += 1 ! src += " multiuse = %s\n"%repr(multiuse) ! src += ' return _call("%s", multiuse, *args, **flags)\n'%(cmd) ! # if cmd=="curve": ! # print src ! # ...and execute it ! exec src - #print nummultiuse, "functions with multi-use flags" --- 8,28 ---- """ ! # Import the _mel module so that the "raw" commands can still be accessed ! import maya._mel as _mel ! # Import all "raw" MEL command wrappers into this namespace... ! from maya._mel import * ! # Now replace some selected functions with more friendly versions... ! # ls ! def ls(*args, **flags): ! res = _mel.ls(*args, **flags) ! if res==None: ! return [] ! else: ! return res ! ls.__doc__ = _mel.ls.__doc__ |
|
From: Matthias B. <mb...@us...> - 2006-03-24 17:13:54
|
Update of /cvsroot/cgkit/maya/maya_wrapper/maya In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3718 Modified Files: __init__.py Log Message: Renamed the automatic mel module into _mel and added a wrapper mel that has the chance to replace some functions Index: __init__.py =================================================================== RCS file: /cvsroot/cgkit/maya/maya_wrapper/maya/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 23 Sep 2005 09:48:46 -0000 1.1 --- __init__.py 24 Mar 2006 17:13:42 -0000 1.2 *************** *** 1,5 **** # Init ! from _maya import * ! ! from node import Node --- 1,3 ---- # Init ! #from node import Node |
|
From: Matthias B. <mb...@us...> - 2006-03-24 17:13:54
|
Update of /cvsroot/cgkit/maya/maya_wrapper/maya/_mel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3718/_mel Added Files: .cvsignore __init__.py Log Message: Renamed the automatic mel module into _mel and added a wrapper mel that has the chance to replace some functions --- NEW FILE: .cvsignore --- *.pyc --- NEW FILE: __init__.py --- ###################################################################### # "Raw" mel module ###################################################################### ''' This initialization module creates a Python function for each MEL function found in Maya (using the 'help' command). From the information provided by the help command, function prototypes like the following can be created automatically: # curve def curve(*args, **flags): """Synopsis: curve [flags] [String...] Flags: -a -append -d -degree Float -k -knot Float (multi-use) -n -name String -os -objectSpace -p -point Length Length Length (multi-use) -per -periodic on|off -pw -pointWeight Length Length Length Length (multi-use) -r -replace -ws -worldSpace """ multiuse = {'pw': 1, 'pointWeight': 1, 'k': 1, 'point': 1, 'p': 1, 'knot': 1} return _call("curve", multiuse, *args, **flags) The actual invocation of the MEL command is done by the _call() function which is identical for all MEL commands. The dictionary multiuse contains all flags that have the keyword "(multi-use)" in their respective line in the help text. ''' import types from maya.api import MGlobal as _MGlobal from maya.api import MString as _MString # Debug flag # (this can be set to True manually to enable some additional output) _debug = False # _parseHelp def _parseHelp(help): """Parse a help string and return the keyword arguments and the doc string. help is the string obtained by the 'help' MEL command. The function returns a tuple (keywordargs, multiuse, docstring) where keywordargs is a list of strings containing the option names of the command (short names and long names). multiuse is a dictionary containing those option names that are multi-use options (short and long names). The key is the option name and the value is irrelevant (non-multi-use options are not added to the dictionary). docstring contains the reformatted help text which can be used as doc string in the source code that will be generated. """ lines = help.split("\n") # Strip leading newlines while lines[0]=="": lines = lines[1:] # Strip trailing newlines while lines[-1]=="": lines = lines[:-1] keyargs = [] multiuse = {} doc = [] for nr,line in enumerate(lines): a = line.split() # Does the line contain flags? if len(a)>1 and a[0][0]=='-' and a[1][0]=='-': shortname = a[0][1:] longname = a[1][1:] keyargs.append(shortname) keyargs.append(longname) if a[-1]=="(multi-use)": multiuse[shortname] = 1 multiuse[longname] = 1 if nr>0: line = " "+line doc.append(line) return keyargs, multiuse, "\n".join(doc) # _py2mel def _py2mel(seq): """Return a list of the individual items in a (possibly nested) sequence. Returns a list with all items as strings. If an item was already a string it's enclosed in apostrophes. Example: _py2mel( [(1,2,3), (4,5,6)] ) -> ["1","2","3","4","5","6"] _py2mel( ("str1","str2") ) -> ['"str1"','"str2"'] """ res = [] ScalarTypes = [types.IntType, types.LongType, types.FloatType] StringType = types.StringType for v in seq: vtype = type(v) # v=scalar? if vtype in ScalarTypes: res.append(str(v)) # v=string? elif vtype==StringType: v = v.replace('"', '\\"') res.append('"%s"'%v) # bool? elif vtype==bool: if v: res.append('1') else: res.append('0') # v=list? convert to MEL array elif vtype==list: toks = _py2mel(v) res.append("{%s}"% ", ".join(toks)) # no scalar, string or list. Then it's supposed to be a sequence which is converted # to a list of individual values... else: try: size = len(v) except: raise ValueError, "Sequence expected, got %s instead."%(vtype) res += _py2mel(v) return res # _call def _call(_funcname, multiuse={}, *args, **flags): """Invoke a MEL command. _funcname is the name of the MEL command. multiuse is a dictionary that contains the names of the multi-use options. args contains the arguments and flags the options. """ # toks is a list of tokens that will be concatenated to form the # final MEL command. Begin with the command name toks = [_funcname] # Search for the query/edit flags first as these must be at the front # of the flag list... if "query" in flags: toks += ["-query"] del flags["query"] if "q" in flags: toks += ["-q"] del flags["q"] if "edit" in flags: toks += ["-edit"] del flags["edit"] if "e" in flags: toks += ["-e"] del flags["e"] # Add the flags... for flag in flags: val = flags[flag] # Is this a multi-use flag? if flag in multiuse: # Add the option before each individual value... for v in val: toks += ["-"+flag] toks += _py2mel([v]) else: # It's a normal flag, so the option only appears once... toks += ["-"+flag] if val!=None: toks += _py2mel([val]) # ...and the arguments for arg in args: toks += _py2mel([arg]) # Combine all the tokens and execute the command cmd = " ".join(toks) if _debug: print "***MEL command:",cmd return _MGlobal.executeCommandPy(cmd) ###################################################################### # Don't create functions that are named like a Python keyword pykeywords = ["pass", "del", "print", "return", "yield", "raise", "break", "continue", "import", "global", "exec", "if", "while", "for", "try", "except"] # Get a list of all available MEL commands cmdlst = _MGlobal.executeCommandPy('help -list "*"') #print len(cmdlst), "commands" #cmdlst = cmdlst[-2:] #cmdlst = ["ls", "sphere", "curve"] # Create wrapper functions... #_MGlobal.executeCommandPy("waitCursor -state on") #_MGlobal.displayInfo(_MString("Creating Python MEL wrappers...")) _MGlobal.executeCommandPy('progressWindow -title "Creating Python MEL wrappers..." -progress 0 -isInterruptable false -minValue 0 -maxValue %d -status "Completed 0%s"'%(len(cmdlst)-1, "%")) nummultiuse = 0 for i,cmd in enumerate(cmdlst): # Get the help text for the current command help = _MGlobal.executeCommandPy('help %s'%cmd) keyargs, multiuse, doc = _parseHelp(help) # Don't try to wrap functions that have invalid names if cmd in pykeywords: continue # Create the source code of the wrapper function... src = '# %s\n'%cmd # src += 'def %s(%s):\n'%(cmd, ", ".join(map(lambda x: x+"=None", keyargs))) src += 'def %s(*args, **flags):\n'%(cmd) src += ' """%s\n """\n'%doc if multiuse!={}: nummultiuse += 1 src += " multiuse = %s\n"%repr(multiuse) src += ' return _call("%s", multiuse, *args, **flags)\n'%(cmd) # if cmd=="curve": # print src # ...and execute it exec src if i%200==0 or i==len(cmdlst)-1: _MGlobal.executeCommandPy('progressWindow -edit -progress %d -status "Completed %d%s"'%(i,int(100*i/len(cmdlst)),"%")) #print nummultiuse, "functions with multi-use flags" _MGlobal.executeCommandPy('progressWindow -endProgress') #_MGlobal.displayInfo(_MString("Finished creating Python MEL wrappers")) #_MGlobal.executeCommandPy("waitCursor -state off") |
|
From: Matthias B. <mb...@us...> - 2006-03-24 17:09:54
|
Update of /cvsroot/cgkit/maya/maya_wrapper/maya/_mel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1577/_mel Log Message: Directory /cvsroot/cgkit/maya/maya_wrapper/maya/_mel added to the repository |
|
From: Matthias B. <mb...@us...> - 2006-03-23 17:42:33
|
Update of /cvsroot/cgkit/maya/maya_wrapper In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31820 Modified Files: .cvsignore Log Message: Added some entries to the ignore list Index: .cvsignore =================================================================== RCS file: /cvsroot/cgkit/maya/maya_wrapper/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 23 Sep 2005 09:48:46 -0000 1.1 --- .cvsignore 23 Mar 2006 17:42:29 -0000 1.2 *************** *** 2,3 **** --- 2,5 ---- build boost_python.dll + query.log + cache |
|
From: Matthias B. <mb...@us...> - 2006-03-23 17:33:20
|
Update of /cvsroot/cgkit/maya/maya_wrapper/_api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26752/_api Log Message: Directory /cvsroot/cgkit/maya/maya_wrapper/_api added to the repository |
|
From: Matthias B. <mb...@us...> - 2006-03-23 10:51:10
|
Update of /cvsroot/cgkit/maya/maya_wrapper/maya/mel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14679 Modified Files: __init__.py Log Message: Improved handling of bools. Ensure that -query/-edit will be at the beginning of a generated MEL command. Index: __init__.py =================================================================== RCS file: /cvsroot/cgkit/maya/maya_wrapper/maya/mel/__init__.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** __init__.py 21 Mar 2006 13:43:44 -0000 1.4 --- __init__.py 23 Mar 2006 10:50:58 -0000 1.5 *************** *** 80,83 **** --- 80,89 ---- v = v.replace('"', '\\"') res.append('"%s"'%v) + # bool? + elif vtype==bool: + if v: + res.append('1') + else: + res.append('0') # v=list? convert to MEL array elif vtype==list: *************** *** 87,90 **** --- 93,100 ---- # to a list of individual values... else: + try: + size = len(v) + except: + raise ValueError, "Sequence expected, got %s instead."%(vtype) res += _py2mel(v) return res *************** *** 104,107 **** --- 114,132 ---- toks = [_funcname] + # Search for the query/edit flags first as these must be at the front + # of the flag list... + if "query" in flags: + toks += ["-query"] + del flags["query"] + if "q" in flags: + toks += ["-q"] + del flags["q"] + if "edit" in flags: + toks += ["-edit"] + del flags["edit"] + if "e" in flags: + toks += ["-e"] + del flags["e"] + # Add the flags... for flag in flags: |
|
From: Matthias B. <mb...@us...> - 2006-03-23 10:48:32
|
Update of /cvsroot/cgkit/maya/maya_wrapper/maya/GUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13564 Modified Files: guiobjectbase.py Log Message: Improved handling of strings Index: guiobjectbase.py =================================================================== RCS file: /cvsroot/cgkit/maya/maya_wrapper/maya/GUI/guiobjectbase.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** guiobjectbase.py 21 Mar 2006 13:44:00 -0000 1.5 --- guiobjectbase.py 23 Mar 2006 10:48:27 -0000 1.6 *************** *** 7,11 **** import types ! executeCommand = MGlobal.executeCommandPy # GUIObjectBase --- 7,11 ---- import types ! executeCommand = maya.api.MGlobal.executeCommandPy # GUIObjectBase *************** *** 81,90 **** """Read an attribute. """ ! try: ! res = executeCommand("%s -q -%s %s"%(self._classname, name, self._name)) ! except: ! raise AttributeError("Cannot read attribute '%s'"%name) ! return res def __setattr__(self, name, val): --- 81,93 ---- """Read an attribute. """ ! if name[0]=="_": ! raise AttributeError, "object has no attribute '%s'"%name ! else: ! try: ! res = executeCommand("%s -q -%s %s"%(self._classname, name, self._name)) ! except: ! raise AttributeError("Cannot read attribute '%s'"%name) ! return res def __setattr__(self, name, val): *************** *** 99,103 **** else: val = self.val2str(val) ! executeCommand("%s -e -%s %s %s"%(self._classname, name, val, self._name)) # createCommand --- 102,107 ---- else: val = self.val2str(val) ! cmd = "%s -e -%s %s %s"%(self._classname, name, val, self._name) ! executeCommand(cmd) # createCommand *************** *** 134,137 **** --- 138,145 ---- # Is it already a string? if isinstance(val, types.StringTypes): + # Replace special characters... + val = val.replace("\n", "\\n") + val = val.replace("\t", "\\t") + val = val.replace('"', '\\"') return '"%s"'%val *************** *** 166,169 **** key += str(id) maya.GUI._registerCallable(key, cmd) ! command = 'python \\"_getCallable(\'%s\')()\\"'%key return command --- 174,177 ---- key += str(id) maya.GUI._registerCallable(key, cmd) ! command = 'python "_getCallable(\'%s\')()"'%key return command |
|
From: Matthias B. <mb...@us...> - 2006-03-23 10:44:58
|
Update of /cvsroot/cgkit/maya/maya_wrapper/src_aux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11877/src_aux Added Files: exceptions.h mfloatpoint.cpp mfloatpoint.h mfloatvector.cpp mfloatvector.h mfnplugin.cpp mfnplugin.h mglobal.cpp mglobal.h mobject.cpp mobject.h mpoint.cpp mpoint.h mstatus.cpp mstatus.h mstring.cpp mstring.h mvector.cpp mvector.h Log Message: Added the auxiliary sources --- NEW FILE: mfnplugin.cpp --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ /* Additional methods for the MFnPlugin class. */ #include "mfnplugin.h" static const unsigned int MAX_CREATOR_FUNCTIONS = 100; //static object pycreatorfuncs[MAX_CREATOR_FUNCTIONS]; void* createFunc000() { return 0; } typedef void* (*CreatorFunc)(); class CreatorFuncManager { public: CreatorFuncManager() {} CreatorFunc acquireCFunc(object callable) { return createFunc000; } void releaseCFunc(CreatorFunc cfunc) {} }; static CreatorFuncManager creatorfuncmanager; // MFnPlugin methods: namespace pyMFnPlugin { // registerFileTranslator method MStatus registerFileTranslator(MFnPlugin& self, const MString& translateName, char* pixmapName, object creatorFunction, char* optionsScriptName, char* defaultOptionsString, bool requiresFullMel) { CreatorFunc func = creatorfuncmanager.acquireCFunc(creatorFunction); return self.registerFileTranslator(translateName, pixmapName, func, optionsScriptName, defaultOptionsString, requiresFullMel); } } --- NEW FILE: mfloatpoint.cpp --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ /* Additional methods for the MFloatPoint class. */ #include <sstream> #include "mfloatpoint.h" namespace pyMFloatPoint { // __str__ method boost::python::str __str__(MFloatPoint& self) { std::ostringstream s; s<<"("<<self.x<<", "<<self.y<<", "<<self.z<<", "<<self.w<<")"; return boost::python::str(s.str()); } } --- NEW FILE: mstring.cpp --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ /* Additional methods for the MString class. */ #include <sstream> #include "mstring.h" namespace pyMString { // __str__ method boost::python::str __str__(MString& self) { std::ostringstream s; s<<self.asChar(); return boost::python::str(s.str()); } } --- NEW FILE: mfnplugin.h --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ /* Additional methods for the MFnPlugin class. */ #include <boost/python.hpp> #include <maya/MFnPlugin.h> using boost::python::object; namespace pyMFnPlugin { MStatus registerFileTranslator(MFnPlugin& self, const MString& translateName, char* pixmapName, object creatorFunction, char* optionsScriptName, char* defaultOptionsString, bool requiresFullMel); } --- NEW FILE: exceptions.h --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ /* Exception classes. */ #include <exception> #include <string> //#include <boost/python.hpp> #include <maya/MStatus.h> #include <maya/MString.h> //using namespace boost::python; /** Exception class. This class encapsulates a MStatus object. */ class EMayaException : public std::exception { public: MStatus status; EMayaException(MStatus stat) : status(stat) { } ~EMayaException() throw() {} /// Return exception message. const char* what() const throw() { return status.errorString().asChar(); } }; /** Exception: A MEL command wasn't successfully executed. */ class EMELError : public std::exception { std::string msg; public: EMELError(std::string amsg) : msg(amsg) {} ~EMELError() throw() {} /// Return exception message. const char* what() const throw() { return msg.c_str(); } }; /** ValueError exception. */ class EValueError : public std::exception { std::string msg; public: EValueError(std::string amsg) : msg(amsg) {} ~EValueError() throw() {} /// Return exception message. const char* what() const throw() { return msg.c_str(); } }; --- NEW FILE: mfloatpoint.h --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ /* Additional methods for the MFloatPoint class. */ #include <boost/python.hpp> #include <maya/MFloatPoint.h> namespace pyMFloatPoint { boost::python::str __str__(MFloatPoint& self); } --- NEW FILE: mstatus.h --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ /* Additional methods for the MStatus class. */ #include <boost/python.hpp> #include <maya/MStatus.h> namespace pyMStatus { boost::python::str __str__(MStatus& self); } --- NEW FILE: mvector.cpp --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ /* Additional methods for the MVector class. */ #include <iostream> #include <sstream> #include "mvector.h" #include "exceptions.h" namespace pyMVector { // __str__ method boost::python::str __str__(MVector& self) { std::ostringstream s; s<<"("<<self.x<<", "<<self.y<<", "<<self.z<<")"; return boost::python::str(s.str()); } /* Replacement for rotateBy(const double rotXYZ[3], RotationOrder order) The replacement accepts a Python sequence as first argument. */ MVector rotateBy(MVector& self, object rotXYZ, MTransformationMatrix::RotationOrder order) { double c_rotXYZ[3]; int listlen = boost::python::extract<int>(rotXYZ.attr("__len__")()); if (listlen!=3) { throw EValueError("rotXYZ must have 3 arguments"); } // Extract the values from the Python sequence... for (int i = 0; i < listlen; ++i) { boost::python::extract<double> x(rotXYZ[i]); if (x.check()) { c_rotXYZ[i] = x(); } else { throw EValueError("rotXYZ must only contain floats"); } } // Call the original rotateBy method return self.rotateBy(c_rotXYZ, order); } } --- NEW FILE: mobject.h --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ /* Additional methods for the MObject class. */ #include <boost/python.hpp> #include <maya/MObject.h> namespace pyMObject { boost::python::str __str__(MObject& self); } --- NEW FILE: mfloatvector.cpp --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ /* Additional methods for the MFloatVector class. */ #include <sstream> #include "mfloatvector.h" namespace pyMFloatVector { // __str__ method boost::python::str __str__(MFloatVector& self) { std::ostringstream s; s<<"("<<self.x<<", "<<self.y<<", "<<self.z<<")"; return boost::python::str(s.str()); } } --- NEW FILE: mpoint.h --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ /* Additional methods for the MPoint class. */ #include <boost/python.hpp> #include <maya/MPoint.h> namespace pyMPoint { boost::python::str __str__(MPoint& self); } --- NEW FILE: mstatus.cpp --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ /* Additional methods for the MStatus class. */ #include <sstream> #include <maya/MString.h> #include "mstatus.h" namespace pyMStatus { // __str__ method boost::python::str __str__(MStatus& self) { std::ostringstream s; if (self.statusCode()==MStatus::kSuccess) { s<<"kSuccess"; } else { s<<(self.errorString().asChar()); } return boost::python::str(s.str()); } } --- NEW FILE: mglobal.cpp --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ /* Additional methods for the MGlobal class. */ #include "mglobal.h" using boost::python::list; using boost::python::make_tuple; object executeCommandPy(const char* command, bool displayEnabled, bool undoEnabled) { MCommandResult result; list lst; unsigned int m; int i, rows, columns; double d; MString s; MVector v; MIntArray ia; MDoubleArray da; MStringArray sa; MVectorArray va; // Execute the MEL command MStatus stat = MGlobal::executeCommand(MString(command), result, displayEnabled, undoEnabled); if (!stat) { MString msg("An error has occurred while executing a MEL command (see the script editor). Error string: \""+stat.errorString()+"\"."); throw EMELError(std::string(msg.asChar())); } // Convert the result of the MEL command into a Python object and return it switch(result.resultType(&stat)) { // int? -> int case MCommandResult::kInt: result.getResult(i); return object(i); // int array? -> list of ints case MCommandResult::kIntArray: result.getResult(ia); for(m=0; m<ia.length(); m++) { lst.append(ia[m]); } return lst; // double? -> float case MCommandResult::kDouble: result.getResult(d); return object(d); // double array? -> list of floats case MCommandResult::kDoubleArray: result.getResult(da); for(m=0; m<da.length(); m++) { lst.append(da[m]); } return lst; // string? -> str case MCommandResult::kString: result.getResult(s); return object(std::string(s.asChar())); // string array? -> list of strs case MCommandResult::kStringArray: result.getResult(sa); for(m=0; m<sa.length(); m++) { lst.append(std::string(sa[m].asChar())); } return lst; // vector? -> 3-tuple case MCommandResult::kVector: result.getResult(v); return make_tuple(v.x, v.y, v.z); // vector array? list of 3-tuples case MCommandResult::kVectorArray: result.getResult(va); for(m=0; m<va.length(); m++) { MVector& w = va[m]; lst.append(make_tuple(w.x, w.y, w.z)); } return lst; // matrix? case MCommandResult::kMatrix: { result.getResult(da, rows, columns); for(int i=0; i<rows; i++) { list sublist; for(int j=0; j<columns; j++) { sublist.append(da[i*columns+j]); } lst.append(sublist); } } return lst; // matrix array? case MCommandResult::kMatrixArray: // result.getResult(da, rows, columns); // ? return object(); // invalid? case MCommandResult::kInvalid: return object(); // other default: return object(); } } --- NEW FILE: mglobal.h --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ /* Additional methods for the MGlobal class. */ #include <boost/python.hpp> #include <maya/MGlobal.h> #include <maya/MCommandResult.h> #include <maya/MString.h> #include <maya/MVector.h> #include <maya/MVectorArray.h> #include "exceptions.h" using boost::python::object; /** 'Pythonic' version of MGlobal::executeCommand(). Execute a MEL command, given as a string and return the result. */ object executeCommandPy(const char* command, bool displayEnabled, bool undoEnabled); --- NEW FILE: mpoint.cpp --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ /* Additional methods for the MPoint class. */ #include <sstream> #include "mpoint.h" namespace pyMPoint { // __str__ method boost::python::str __str__(MPoint& self) { std::ostringstream s; s<<"("<<self.x<<", "<<self.y<<", "<<self.z<<", "<<self.w<<")"; return boost::python::str(s.str()); } } --- NEW FILE: mvector.h --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ /* Additional methods for the MVector class. */ #include <boost/python.hpp> #include <maya/MVector.h> using boost::python::object; namespace pyMVector { MVector rotateBy(MVector& self, object rotXYZ, MTransformationMatrix::RotationOrder order); boost::python::str __str__(MVector& self); } --- NEW FILE: mfloatvector.h --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ /* Additional methods for the MFloatVector class. */ #include <boost/python.hpp> #include <maya/MFloatVector.h> namespace pyMFloatVector { boost::python::str __str__(MFloatVector& self); } --- NEW FILE: mobject.cpp --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ /* Additional methods for the MObject class. */ #include <sstream> #include "mobject.h" namespace pyMObject { // __str__ method boost::python::str __str__(MObject& self) { std::ostringstream s; s<<"<MObject: "<<self.apiTypeStr()<<">"; return boost::python::str(s.str()); } } --- NEW FILE: mstring.h --- /*====================================================================== cgkit - Python Computer Graphics Kit Copyright (C) 2006 Matthias Baas (ba...@ir...) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cgkit homepage: http://cgkit.sourceforge.net ======================================================================*/ /* Additional methods for the MString class. */ #include <boost/python.hpp> #include <maya/MString.h> namespace pyMString { boost::python::str __str__(MString& self); } |
|
From: Matthias B. <mb...@us...> - 2006-03-23 10:44:17
|
Update of /cvsroot/cgkit/maya/maya_wrapper/src_aux In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11532/src_aux Log Message: Directory /cvsroot/cgkit/maya/maya_wrapper/src_aux added to the repository |
|
From: ocil <oc...@us...> - 2006-03-22 08:19:44
|
Update of /cvsroot/cgkit/cgkit2/wrappers/osg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22525/wrappers/osg Modified Files: osgcore.cpp Log Message: bugfixes Index: osgcore.cpp =================================================================== RCS file: /cvsroot/cgkit/cgkit2/wrappers/osg/osgcore.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** osgcore.cpp 19 Mar 2006 12:31:27 -0000 1.9 --- osgcore.cpp 22 Mar 2006 08:19:36 -0000 1.10 *************** *** 551,554 **** --- 551,556 ---- boost::shared_ptr<support3d::GLTexture> texture = tempMaterial->texture; + std::cout << "Checking textures" << std::endl; + if( texture.get() ) { *************** *** 598,601 **** --- 600,605 ---- boost::shared_ptr<support3d::GLShader> frag_shader = tempMaterial->fragment_shader; + std::cout << "Checking shader" << std::endl; + if( vtx_shader.get() ) { *************** *** 604,607 **** --- 608,620 ---- if( !(pVtxShader->loadShaderSourceFromFile((const std::string)vtx_shader->filename) )) std::cout << "could not load vertex shader, check filename" << std::endl; + + // check for default uniform variables + support3d::SlotIterator it = vtx_shader->slotsBegin(); + while( it != vtx_shader->slotsEnd() ) + { + std::string name = it->first; + std::cout << "found a uniform variable slot: " << name << std::endl; + std::cout << "... it's type is: " << it->second->getSlot().typeName() << std::endl; + } } *************** *** 768,772 **** std::cout << "doing setup 2" << &cam <<" " << mpCameraMatrixTransform << std::endl; pDep->setup(&cam, mpCameraMatrixTransform); ! std::cout << "aDDING DEPENDENT!" << std::endl; cam.transform.addDependent( pDep ); mDependents.push_back( pDep ); --- 781,785 ---- std::cout << "doing setup 2" << &cam <<" " << mpCameraMatrixTransform << std::endl; pDep->setup(&cam, mpCameraMatrixTransform); ! std::cout << "adding camera dependent" << std::endl; cam.transform.addDependent( pDep ); mDependents.push_back( pDep ); *************** *** 784,794 **** --- 797,813 ---- pSurf->fullScreen(false); pCameraConfig->addCamera("maincam", pCamera); + std::cout << "creating the viewer from camera" << std::endl; theViewer = osgProducer::Viewer(pCameraConfig); + std::cout << "configure the viewer" << std::endl; theViewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); + std::cout << "setting scene data" << std::endl; theViewer.setSceneData( mpRoot ); + std::cout << "creating the event handler" << std::endl; mpEH = new MyEventHandler(); theViewer.getEventHandlerList().push_front(mpEH); + std::cout << "finishing the viewer" << std::endl; theViewer.realize(); + std::cout << "finished camera handling" << std::endl; ////////////////////////////////////////////////////////////////// |
|
From: Matthias B. <mb...@us...> - 2006-03-21 13:44:06
|
Update of /cvsroot/cgkit/maya/maya_wrapper/maya/GUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18097 Modified Files: guiobjectbase.py layouts.py menu.py window.py Log Message: Uses MGlobal.executeCommandPy now Index: window.py =================================================================== RCS file: /cvsroot/cgkit/maya/maya_wrapper/maya/GUI/window.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** window.py 23 Sep 2005 09:48:46 -0000 1.1 --- window.py 21 Mar 2006 13:44:00 -0000 1.2 *************** *** 3,8 **** ###################################################################### ! from maya import executeCommand ! from guiobjectbase import GUIObjectBase # Window --- 3,7 ---- ###################################################################### ! from guiobjectbase import GUIObjectBase, executeCommand # Window Index: guiobjectbase.py =================================================================== RCS file: /cvsroot/cgkit/maya/maya_wrapper/maya/GUI/guiobjectbase.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** guiobjectbase.py 9 Jan 2006 18:13:27 -0000 1.4 --- guiobjectbase.py 21 Mar 2006 13:44:00 -0000 1.5 *************** *** 3,10 **** ###################################################################### import maya.GUI - from maya import executeCommand import types # GUIObjectBase class GUIObjectBase(object): --- 3,12 ---- ###################################################################### + import maya.api import maya.GUI import types + executeCommand = MGlobal.executeCommandPy + # GUIObjectBase class GUIObjectBase(object): Index: layouts.py =================================================================== RCS file: /cvsroot/cgkit/maya/maya_wrapper/maya/GUI/layouts.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** layouts.py 23 Sep 2005 09:48:46 -0000 1.1 --- layouts.py 21 Mar 2006 13:44:00 -0000 1.2 *************** *** 3,7 **** ###################################################################### - from maya import executeCommand from guiobjectbase import GUIObjectBase --- 3,6 ---- Index: menu.py =================================================================== RCS file: /cvsroot/cgkit/maya/maya_wrapper/maya/GUI/menu.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** menu.py 23 Sep 2005 09:48:46 -0000 1.1 --- menu.py 21 Mar 2006 13:44:00 -0000 1.2 *************** *** 3,7 **** ###################################################################### - from maya import executeCommand from guiobjectbase import GUIObjectBase --- 3,6 ---- |
|
From: Matthias B. <mb...@us...> - 2006-03-21 13:43:52
|
Update of /cvsroot/cgkit/maya/maya_wrapper/maya/mel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18033 Modified Files: __init__.py Log Message: Uses MGlobal.executeCommandPy now Index: __init__.py =================================================================== RCS file: /cvsroot/cgkit/maya/maya_wrapper/maya/mel/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** __init__.py 12 Jan 2006 10:37:02 -0000 1.3 --- __init__.py 21 Mar 2006 13:43:44 -0000 1.4 *************** *** 8,12 **** """ ! import maya, types # Debug flag --- 8,13 ---- """ ! import types ! from maya.api import MGlobal # Debug flag *************** *** 126,130 **** if _debug: print "***MEL command:",cmd ! return maya.executeCommand(cmd) --- 127,131 ---- if _debug: print "***MEL command:",cmd ! return MGlobal.executeCommandPy(cmd) *************** *** 137,141 **** # Get a list of all available MEL commands ! cmdlst = maya.executeCommand('help -list "*"') #print len(cmdlst), "commands" --- 138,142 ---- # Get a list of all available MEL commands ! cmdlst = MGlobal.executeCommandPy('help -list "*"') #print len(cmdlst), "commands" *************** *** 147,151 **** for cmd in cmdlst: # Get the help text for the current command ! help = maya.executeCommand('help %s'%cmd) keyargs, multiuse, doc = _parseHelp(help) --- 148,152 ---- for cmd in cmdlst: # Get the help text for the current command ! help = MGlobal.executeCommandPy('help %s'%cmd) keyargs, multiuse, doc = _parseHelp(help) |
|
From: Matthias B. <mb...@us...> - 2006-03-21 13:31:20
|
Update of /cvsroot/cgkit/maya/maya_wrapper In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11397 Modified Files: setup.py Log Message: Uses the pyplusplus generated wrappers now Index: setup.py =================================================================== RCS file: /cvsroot/cgkit/maya/maya_wrapper/setup.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** setup.py 12 Jan 2006 10:34:29 -0000 1.4 --- setup.py 21 Mar 2006 13:31:09 -0000 1.5 *************** *** 4,16 **** from distutils.core import setup, Extension ! import sys,shutil,os ! INC_DIRS = [] LIB_DIRS = [] LIBS = ["boost_python", "OpenMaya", "Foundation"] MACROS = [] CC_ARGS = [] ! #LIBS += ["Foundation"] # Platform specific settings --- 4,25 ---- from distutils.core import setup, Extension ! from distutils.sysconfig import get_config_vars ! import sys, shutil, os, glob ! INC_DIRS = [".", "src_aux"] LIB_DIRS = [] LIBS = ["boost_python", "OpenMaya", "Foundation"] + LIBS += ["OpenMayaAnim", "OpenMayaRender", "OpenMayaFX", "OpenMayaUI", "Cloth"] + if sys.platform!="win32": + LIBS.append("OpenMayalib") MACROS = [] + MACROS += [("MNoVersionString", None)] + MACROS += [("MNoPluginEntry", None)] CC_ARGS = [] ! # Remove the debug option ! if sys.platform!="win32": ! vars = get_config_vars() ! vars["OPT"] = vars["OPT"].replace("-g", "") # Platform specific settings *************** *** 28,43 **** # Source files ! srcs = ["src/pymaya.cpp", ! "src/object.cpp", ! "src/selectionlist.cpp", ! "src/itdag.cpp", ! "src/itdependencynodes.cpp", ! "src/itgeometry.cpp", ! "src/itmeshvertex.cpp", ! "src/itmeshpolygon.cpp", ! "src/fn.cpp", ! "src/fnbase.cpp", ! "src/fndependencynode.cpp", ! ] # setup --- 37,42 ---- # Source files ! srcs = glob.glob("_api/*.cpp") ! srcs += glob.glob("src_aux/*.cpp") # setup *************** *** 49,55 **** url = "http://cgkit.sourceforge.net", ! packages = ["maya", "maya.GUI", "maya.mel"], ! ext_modules=[Extension("maya._maya", srcs ,libraries = LIBS ,include_dirs = INC_DIRS --- 48,54 ---- url = "http://cgkit.sourceforge.net", ! packages = ["maya", "maya.api", "maya.GUI", "maya.mel"], ! ext_modules=[Extension("maya._api", srcs ,libraries = LIBS ,include_dirs = INC_DIRS |
|
From: Matthias B. <mb...@us...> - 2006-03-21 13:27:17
|
Update of /cvsroot/cgkit/maya/maya_wrapper/maya/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9276/api Added Files: __init__.py mvector.py Log Message: Added the api sub-package --- NEW FILE: mvector.py --- ###################################################################### # MVector wrapper ###################################################################### from maya import _api class MVector(_api.MVector): def __init__(self, *args): # Is there only one argument? if len(args)==1: # Check if it is a sequence... try: size = len(args[0]) _api.MVector.__init__(self, *args[0]) except: _api.MVector.__init__(self, *args) else: _api.MVector.__init__(self, *args) --- NEW FILE: __init__.py --- # Init function for the api module # Import everything from the C++ wrappers from maya._api import * # Replace some objects by Python wrappers... from mvector import MVector |
|
From: Matthias B. <mb...@us...> - 2006-03-21 13:26:13
|
Update of /cvsroot/cgkit/maya/maya_wrapper/maya/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8320/api Log Message: Directory /cvsroot/cgkit/maya/maya_wrapper/maya/api added to the repository |
|
From: Matthias B. <mb...@us...> - 2006-03-20 19:34:08
|
Update of /cvsroot/cgkit/cgkit2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10785 Modified Files: changelog.txt Log Message: Added support for points and lines Index: changelog.txt =================================================================== RCS file: /cvsroot/cgkit/cgkit2/changelog.txt,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** changelog.txt 19 Mar 2006 20:50:30 -0000 1.63 --- changelog.txt 20 Mar 2006 19:33:43 -0000 1.64 *************** *** 45,48 **** --- 45,49 ---- Bug fixes/enhancements: + - objmtl: Added support for lines (l) and points (p). - sltokenize: Variables whose name started with a SL type were not treated correctly. |
|
From: Matthias B. <mb...@us...> - 2006-03-20 19:33:28
|
Update of /cvsroot/cgkit/cgkit2/cgkit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10709 Modified Files: objimport.py Log Message: Accept lines/points but ignored them Index: objimport.py =================================================================== RCS file: /cvsroot/cgkit/cgkit2/cgkit/objimport.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** objimport.py 15 Aug 2005 15:47:56 -0000 1.10 --- objimport.py 20 Mar 2006 19:33:24 -0000 1.11 *************** *** 191,194 **** --- 191,200 ---- self.trimesh_flag = True + # Was it already reported that points aren't supported? + self.point_msg_flag = False + # Was it already reported that lines aren't supported? + self.line_msg_flag = False + + def end(self): # Trigger the creation of the last object *************** *** 249,252 **** --- 255,274 ---- self.tverts.append(tv) + # p + def p(self, *verts): + """Points.""" + if self.point_msg_flag: + return + print "OBJ import: Points are not supported" + self.point_msg_flag = True + + # l + def l(self, *verts): + """Line.""" + if self.line_msg_flag: + return + print "OBJ import: Lines are not supported" + self.line_msg_flag = True + # f def f(self, *verts): |