[Maya-Python] funny stuff

2010-02-09 Thread sberger
I had to share this on this group. http://gist.github.com/289467 -- http://groups.google.com/group/python_inside_maya

[Maya-Python] Google Wave

2009-12-09 Thread sberger
I just found out this morning that I can add google groups to a Wave... anyopne in this group using wave? I have a few invites if anyone would like to get on the Wave bandwagon. Cheers -- http://groups.google.com/group/python_inside_maya

[Maya-Python] logging and mayaHandler

2009-10-28 Thread sberger
Hi guys, I have setup this logging setup in the __init__.py file of my mfxMaya package # setup logging import logging import maya.OpenMaya as OpenMaya MAYA_LOGGING_SETUP = False class MayaLogHandler(logging.Handler): def emit(self, record): if record.levelno > logging.ERROR:

[Maya-Python] python logging and maya

2009-10-09 Thread sberger
Hi, I have been experimenting with the python logging module... for some reason the debug and info level of the logging are not printed in Maya.. Here is a simple example: import logging def go(): logging.basicConfig(level=logging.DEBUG) logger1 = logging.getLogger('package1.module1')

[Maya-Python] menu created in python

2009-08-07 Thread sberger
So I created this menu in the main menubar in python...the commands attached to these python menuItem are python commands. When select the item in the menu, the python command execute correctly... when I do a shift+CTRL click an item to make a shelf button, it create a mel shelf button!!! Anyone

[Maya-Python] userSetup.py location

2009-08-07 Thread sberger
Hi, I have this setup for Maya 2009 My user Pref are localed on the network m:\profiles\sylvain.berger\maya \... in these user pref I have a maya.env file that add a network MAYA_SCRIPT_PATH=m:\library\maya\scripts\ when I put the userSetup.py in the MAYA_SCRIPT_PATH location it doesn't get exec

[Maya-Python] override class function

2009-06-18 Thread sberger
Hi guys, I have this problem that i have no idea how to fix. I have a base class: class texture(shadingNode): def __init__(self, node=''): shadingNode.__init__(self, node) self.nodeType = 'texture' def create(self, name='texture'): r

[Maya-Python] list booleans

2009-06-11 Thread sberger
Hi guys, i would to know if there is already function in python to perform list booleans. For example, given those list listA = [1,2,3] listB = [2,3,4,5] performing these operation would give the result listB-listA would give [4,5] listA+listB would give [1,2,3,4,5] etc.. thanks --~--~---

[Maya-Python] Re: using partial in window classes

2009-06-10 Thread sberger
please note that the example I sent are reversed... the first one is the keywords example, and the second one the non keywords example On Jun 10, 4:10 pm, sberger wrote: > Hi guys, I found this trick for Maya. When you create a window class, > I can use the partial function to bu

[Maya-Python] using partial in window classes

2009-06-10 Thread sberger
Hi guys, I found this trick for Maya. When you create a window class, I can use the partial function to build my commands sent to my buttons. The problem is I can only manage to make this work with one arguments, when I send 2 or more arguments i get errors. Here is the code: from functools imp

[Maya-Python] pyqt and maya 2009 64 bit

2009-05-07 Thread sberger
Hi guys, I am currently trying to install pyqt for maya 2009... I am now trying to get the 32 bit version working... 64 bit is always a pain in python in my experience. I would like to know if anyone where sucessful at getting pyqt GPL 4.4.4 to work in maya. The doc in maya 2009 for pyqt refers t

[Maya-Python] drag and drop from custom window to main maya window

2009-05-04 Thread sberger
Hi, I am trying to make a drag and drop function to be able to drag an icon or image from my window into the main maya window... So far I was able to drag and drop an icon from one part of my window to another part of the same window... but I can't figure out how to drag and drop from the window t

[Maya-Python] unittest in maya

2009-04-29 Thread sberger
Hi, anyone have examples of how to use unittest in maya, I read on the subject and it seems like a really good way to test code... the problem is I can't figure out how to make it work properly in Maya... Thanks --~--~-~--~~~---~--~~ http://groups.google.com/group/

[Maya-Python] pymel file nodeType

2009-04-29 Thread sberger
Hi, I am listing all the file nodes with pymel import pymel as pm pm.ls(type='file') the result is the list of all file nodes in my scene ... the pymel object returned is the nodeType file... but the nodetype file is not a file node class ... it is the mel file command ... the one used to query

[Maya-Python] python modules setup

2009-04-22 Thread sberger
Hi, I have this folder structure where I put all my python scripts. myPythonScript modeling pyScript1.py pyScript2.py animation pyScript1.py shading pyScript1.py pyScript2.py pyScript3.py etc.. In these script when I need a function from another script I import it like so: from m

[Maya-Python] global variables

2009-04-21 Thread sberger
I would like to create global variable so that I can access them in different modules. But It doesn't seem to work. What I need is this: module A define global var Function1 set global var value Module B Function1 read global var value When I do this, the global var is only accessible in the

[Maya-Python] pymel component list tricks

2009-04-09 Thread sberger
Hi, I am having a bit of trouble processing component lists, I often end up in my code with a list of component list... parssing this list to other function often prove problematic. For example passing a list of componentList to the select() function fails. Is there a trick in pymel to cocatenate

[Maya-Python] pymel getTransform() question

2009-04-08 Thread sberger
Hi, I want to get the transform node from a mesh, but the getTransform () method is not included in the mesh class. So I am using the degNode.getParent() method instead which work fine. Would it make sense to have the getTransform() method from the shape class included in the mesh. Same for the

[Maya-Python] Re: bug in pymel

2009-04-08 Thread sberger
not touching pymel for uv editing anymore. I hope you guys can fix it in future releases, because the functions and methods are really useful. But they are so unreliable that I can't use them. Thanks On Apr 8, 10:51 am, sberger wrote: > I found another bug with UVs in the mesh clas

[Maya-Python] Re: bug in pymel

2009-04-08 Thread sberger
On Tue, Apr 7, 2009 at 12:43 PM, Sylvain Berger > > > > wrote: > > Also, I get the same behavior with Nurbs CVs > > > On Tue, Apr 7, 2009 at 3:41 PM, sberger wrote: > > >> On the same line, I found another problem with UV component. > >> Basically I figured tha

[Maya-Python] Re: bug in pymel

2009-04-07 Thread sberger
On the same line, I found another problem with UV component. Basically I figured that there is no pymel polygon UV nodeType. This example crash at the polyUVs command: Create a poly shape, select a few UVs and run the getPolygonUVs() function... it will fail. the other 3 polygon components work

[Maya-Python] nodeType of vertex

2009-04-07 Thread sberger
Hi, I am wondering why the nodeType() method of a vertex return mesh instead of meshVertex type? # run this code to repro sphere = pm.polySphere()[0] pm.select('%s.vtx[0:10]' %sphere, r=True) sel = pm.ls(sl=True, fl=True) for i in sel: print 'nodeType:', i.nodeType() print type(i)

[Maya-Python] reverse boolean

2009-04-06 Thread sberger
Hi, I am trying to reverse a boolean value. I use this a lot in mel in UI creation to set the value to the reverse of another control. For example, in mel this works fine: $a = true; print (!$a); How can I do this in python? I'm sure the solution is simple but for some reason i can't figure thi

[Maya-Python] bug in pymel

2009-04-03 Thread sberger
I'm not sure if I should post it here ... if not please let me know where I should post for pymel bugs please. here is the bug. selecting a uv point and running the following command crashes: import pymel as pm sel = pm.selected() thanks --~--~-~--~~~---~--~~ ht

[Maya-Python] pymel mesh uv function

2009-04-03 Thread sberger
Hi, I have a few question on the getAssignedUVs() function. I would like to understand what is the return of that function... I don't understand the return. import pymel as pm plane = pm.polyPlane(sw=2, sh=2)[0] print 'plane:', plane, '|type', type(plane) shape = plane.getShape() print 'shape:',

[Maya-Python] problem with undo in pymel window

2009-04-03 Thread sberger
Hi, I am using pymel to build this window. in my Apply button I am using lambda in the command flag: applyButton = pm.button( height=buttonHeight, label='Apply', command=lambda *args: _windowApply(window, False) ) In the aply function, I grab values from the window and use these values to call a

[Maya-Python] Pymel comments and questions

2009-03-18 Thread sberger
So I finally took the time to look at pymel ... WOW! I mean WOW! I had no Idea it was this powerful! I knew it would be nice, but not like that. I am extremely impressed and pleased. Great work guys...really great! Now for my question. I am looking at a way of getting all the poly shells from a m

[Maya-Python Club:1457] supress warning message

2009-01-14 Thread sberger
Hi, I am trying to suppress maya warning message, but the try:/except: clause don't supress it. Anyone know how to do this? Here is a peice of code that repro the problem import maya.cmds as cmds circle_X = cmds.circle(c=(1.1,0,0), nr=(0,1,0), s=8)[0] circle_Y = cmds.circle(c=(-1.1,0,0), nr=(0,

[Maya-Python Club:1267] Re: fileBrowserDialog

2008-10-27 Thread sberger
s > > def importImage(fileName, fileType): >     #cmds.file( fileName, i=True ); >     print "I am here\n" >     print fileName >     return 1 > > cmds.fileBrowserDialog( m=0, fc=importImage, ft='image', > an='Import_Image', om='Import

[Maya-Python Club:1264] Re: fileBrowserDialog

2008-10-27 Thread sberger
port maya.cmds as cmds > > def importImage(fileName, fileType): >     #cmds.file( fileName, i=True ); >     print "I am here\n" >     print fileName >     return 1 > > cmds.fileBrowserDialog( m=0, fc=importImage, ft='image', > an='Import_Image', o

[Maya-Python Club:1260] fileBrowserDialog

2008-10-27 Thread sberger
Anyone found out how to make the fileBrowserDialog work in python? The example in the maya python docs is not working. import maya.cmds as cmds def importImage( fileName, fileType): cmds.file( fileName, i=True ); return 1 cmds.fileBrowserDialog( m=0, fc='importImage', ft='image', an='Imp