[Maya-Python] Re: numpy with maya and snow leopard

2009-10-26 Thread Chad Dombrova



 I have tried to use easy_install within maya to install it, but It is
 not building correctly (the same is true outside of maya too).


what errors did you get when using easy_install?  and if easy_install  
did not work, how did you get it to install?

-chad



--~--~-~--~~~---~--~~
http://groups.google.com/group/python_inside_maya
-~--~~~~--~~--~--~---



[Maya-Python] Re: PyQt in Maya examples

2009-10-26 Thread David Moulder
Here it is, This version has fixed our threading errors that occurred
where maya wouldn't close correctly and leave 1 mayapy thread open.

-Dave

###

from PyQt4 import QtCore, QtGui
import maya.utils as utils
import sys
import time
import threading
import maya.cmds as cmds

pumpedThread = None
app = None
gPump = True

def get_app():
global app
return app

def set_app(i_app):
global app
testAppInstance = QtCore.QCoreApplication.instance()
if testAppInstance:
app = testAppInstance
else:
app = i_app

def get_pt():
global pumpedThread
return pumpedThread

def set_pt(i_pt):
global pumpedThread
pumpedThread = i_pt

def pumpQt():
global app
global gPump
processorEv = threading.Event()
def processor():
app.processEvents()
processorEv.set()
while gPump:
utils.executeDeferred( processor )
processorEv.wait()
processorEv.clear()
time.sleep(0.01)

def killProcess():
global gPump
gPump = False

def killPumpThread():
if get_app():
get_app().closeAllWindows()
if get_pt():
while get_pt().isAlive():
killProcess()
set_pt(None)
set_app(None)


def initializePumpThread():
global gPump
gPump = True
if get_pt() == None:
set_app(QtGui.QApplication(sys.argv))
set_pt(threading.Thread( target = pumpQt, args = () ))
get_pt().start()

On Fri, Oct 23, 2009 at 8:41 PM, Sylvain Berger sylvain.ber...@gmail.comwrote:

 Where can I find your version of pumpThread?

 Thanks


 On Tue, Sep 29, 2009 at 5:24 AM, David Moulder 
 da...@thirstydevil.co.ukwrote:

 Ok,  Here's and basic example with PyQT and a QListWidget...
 Please note.  This use's a modified pumpThread module.  The default one
 from the maya dev kit has given us lots of problems.
 Thanks to some very clever people on this list we now have a working
 pumpThread module that is heavily tested here at work.

 from PyQt4 import QtCore, QtGui
 import pymel as pm
 import pumpThread

 class ExampleUI(QtGui.QDialog):
 def __init__(self, parent=None):
 super(ExampleUI, self).__init__(parent)
 # Set some basic properties on the UI
 self.setWindowTitle('ExampleUI')
 self.setObjectName(ExampleUI)
 self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

 # Add a Layout and set it to the UI
 self.mainLayout = QtGui.QVBoxLayout(self)
 self.setLayout(self.mainLayout)

 # Add a Button and set some properties.  Also add it to a layout.
 self.RefreshButton = QtGui.QPushButton()
 self.RefreshButton.setText(Refresh)
 self.mainLayout.addWidget(self.RefreshButton)

 # Add a list and set it to the layout
 self.SelectionList = QtGui.QListWidget()
 self.SelectionList.setMinimumSize(250,250)
 self.mainLayout.addWidget(self.SelectionList)

 # Connect the Refresh Button to a function to populate the list
 using SIGNAL's
 self.connect(self.RefreshButton, QtCore.SIGNAL(clicked()),
 self._RefreshButtonFunc)

 def _RefreshButtonFunc(self):
 '''
 Fill the list based on a maya selection
 '''
 oSel = pm.selected()
 if oSel:
 self.SelectionList.clear()
 [self.SelectionList.addItem(s.name()) for s in oSel]
 else:
 self.SelectionList.clear()

 @staticmethod
 def Display():
 '''
 calls the window.  Typical PumpThread call
 Use's a modified pumpThread that properly set's up the thread.
 '''
 # We need a global to stop python gc the UI
 global mainWindow

 # We need pumpThread to make the UI responsive
 pumpThread.initializePumpThread()
 app = pumpThread.get_app()
 if app:
 # We can set the app to use a nice style
 app.setStyle('Plastique')
 mainWindow = ExampleUI()
 mainWindow.show()

 ExampleUI.Display()

 I'll post our final pumpThread later today.

 -Dave



 On Tue, Sep 29, 2009 at 6:42 AM, floyd1510 vshingr...@gmail.com wrote:


 Hello all,

 I have got PyQt up and running in Maya 2009. I was wondering if
 someone could guide me to a few examples, like adding a list of
 objects from maya into the QT listview or adding items dynamically to
 a combo box etc.

 I appreciate the help.

 Cheers,
 Vikram.








 --
 A pit would not be complete without a Freeman coming out of it.
 The Vortigaunt


 


--~--~-~--~~~---~--~~
http://groups.google.com/group/python_inside_maya
-~--~~~~--~~--~--~---



[Maya-Python] Re: adding float array attributes to a node from a command

2009-10-26 Thread Jakub Krompolc

just a note, I had a chat with someone and it seems I could get the
DataBuilder in a command from MPlug... also I had some mistake in
initialize method. But please comment anyway if you have something to
say, as I might come back with other problem with this thing.

On Oct 25, 9:52 pm, Jakub Krompolc syntet...@googlemail.com wrote:
 hello, I`m working on python deformer plugin. It`s a node that will
 hold several arrays of float values. Those arrays are all under one
 compound attribute (set as array as well). I want the same workflow as
 Maya blendShape, so user will run a command and add another array when
 he wants. The deformer will then compute final result based on arrays
 that user added.
 First I have set both compound and values attributes as using
 arrayDataBuilder, but this only works under the node, not in the
 command. But the array creation in the node would need to be triggered
 by command somehow.
 What I`m doing now is trying to use MPlug in command using
 selectAncestorLogicalIndexwhich could create the data, but I`m getting
 different errors as if the array couldn`t be made - maybe auto-
 creation only works on single value elements?

 Then I have another idea, to make int attribute on a node with number
 of arrays. The node would always create one more array if the int
 value is the same as current size of array. The command would change
 this value to value+1 and so on. This way there would always be one
 free array for the command to use it and set values. But it sounds
 hacky... does anyone know the right way of doing this?

 this is part of the command, array creation part (which doesn`t work):

 #compound attr
 listPlug = OpenMaya.MPlug( deformNode, deformerName.list )
 listSize = listPlug.numElements()

 #values attr
 valuesPlug = OpenMaya.MPlug( deformNode, deformerName.values )
 valuesPlug.selectAncestorLogicalIndex( listSize,
 deformerName.list )

 pointSize = 1000 #example, size of mesh points
 for i in range( pointSize ):
 valuesPlug.selectAncestorLogicalIndex( i,
 deformerName.values )
 valuesPlug.setValue( 1.2 ) #some value
--~--~-~--~~~---~--~~
http://groups.google.com/group/python_inside_maya
-~--~~~~--~~--~--~---



[Maya-Python] Re: eclipse usage:

2009-10-26 Thread Chad Dombrova

yeah, i agree. this is one of the biggest things i miss when using  
other editors.


On Oct 26, 2009, at 8:48 AM, Count Zer0 wrote:


 That is the coolest feature of Pydev, but if you want to turn it off:

 Preferences - Pydev - Editor - Mark Occurrences.

 -jason



 On Oct 25, 5:01 am, lala lalama...@gmail.com wrote:
 little offtopic but hopefully ppl here have solved this already

 http://forums.dzone.com/eclipse/1853-few-newbie-simple- 
 questions.html...

 see above post (attachment image ) when i select a line or cursor
 blinking at a word(variable) it selects / hilights all same words
 around (in yellow), i wanted to stop this behaviour, any ideas??

 there must be a secret setting, to avoid this behaviour of eclipse or
 pydev?? any ideas, please share
 


--~--~-~--~~~---~--~~
http://groups.google.com/group/python_inside_maya
-~--~~~~--~~--~--~---



[Maya-Python] Re: eclipse usage:

2009-10-26 Thread haseeb ahmed
i agree, while writing lengthy / big script, it would be helpful, but while
testing simple stuff and learning pymel, when i need to select some commands
and run them to check results, its little disturbing,
but huge thanks

On Mon, Oct 26, 2009 at 8:56 PM, Chad Dombrova chad...@gmail.com wrote:


 yeah, i agree. this is one of the biggest things i miss when using
 other editors.


 On Oct 26, 2009, at 8:48 AM, Count Zer0 wrote:

 
  That is the coolest feature of Pydev, but if you want to turn it off:
 
  Preferences - Pydev - Editor - Mark Occurrences.
 
  -jason
 
 
 
  On Oct 25, 5:01 am, lala lalama...@gmail.com wrote:
  little offtopic but hopefully ppl here have solved this already
 
  http://forums.dzone.com/eclipse/1853-few-newbie-simple-
  questions.html...
 
  see above post (attachment image ) when i select a line or cursor
  blinking at a word(variable) it selects / hilights all same words
  around (in yellow), i wanted to stop this behaviour, any ideas??
 
  there must be a secret setting, to avoid this behaviour of eclipse or
  pydev?? any ideas, please share
  


 



-- 
regards,
lala

--~--~-~--~~~---~--~~
http://groups.google.com/group/python_inside_maya
-~--~~~~--~~--~--~---



[Maya-Python] Re: numpy with maya and snow leopard

2009-10-26 Thread rabidPraxis

Hey Chad, thanks for the response. pyMel is badass, btw..

I installed numpy on 10.4 (I remember it being a hassle for that first
install, getting the gcc  fortran compilers working) and I have
updated it a couple times since then. I installed snow leopard and
migrated to a new machine, and things have been a little wonky since
then.

Anyways, here is the error I get. I have read posts about this being
something to do with the gcc compiler and some env settings, but I
have yet to find anything concrete.

  File /var/folders/p4/p4ALURh3FMKA+jcKljzZ2k+++TM/-Tmp-/easy_install-
p2grWq/numpy-1.3.0/numpy/distutils/command/build_src.py, line 130, in
run
  File /var/folders/p4/p4ALURh3FMKA+jcKljzZ2k+++TM/-Tmp-/easy_install-
p2grWq/numpy-1.3.0/numpy/distutils/command/build_src.py, line 147, in
build_sources
  File /var/folders/p4/p4ALURh3FMKA+jcKljzZ2k+++TM/-Tmp-/easy_install-
p2grWq/numpy-1.3.0/numpy/distutils/command/build_src.py, line 250, in
build_extension_sources
  File /var/folders/p4/p4ALURh3FMKA+jcKljzZ2k+++TM/-Tmp-/easy_install-
p2grWq/numpy-1.3.0/numpy/distutils/command/build_src.py, line 307, in
generate_sources
  File /private/var/folders/p4/p4ALURh3FMKA+jcKljzZ2k+++TM/-Tmp-/
easy_install-p2grWq/numpy-1.3.0/numpy/core/setup.py, line 286, in
generate_config_h
  File /private/var/folders/p4/p4ALURh3FMKA+jcKljzZ2k+++TM/-Tmp-/
easy_install-p2grWq/numpy-1.3.0/numpy/core/setup.py, line 30, in
check_types
  File /private/var/folders/p4/p4ALURh3FMKA+jcKljzZ2k+++TM/-Tmp-/
easy_install-p2grWq/numpy-1.3.0/numpy/core/setup.py, line 186, in
check_types
SystemError: Cannot compiler 'Python.h'. Perhaps you need to install
python-dev|python-devel.

--~--~-~--~~~---~--~~
http://groups.google.com/group/python_inside_maya
-~--~~~~--~~--~--~---



[Maya-Python] Re: PyQt in Maya examples

2009-10-26 Thread John Creson

Thanks David!

On Mon, Oct 26, 2009 at 9:13 AM, Sylvain Berger
sylvain.ber...@gmail.com wrote:
 Thanks a lot David!

 On Mon, Oct 26, 2009 at 5:23 AM, David Moulder da...@thirstydevil.co.uk
 wrote:

 Here it is, This version has fixed our threading errors that occurred
 where maya wouldn't close correctly and leave 1 mayapy thread open.

 -Dave

 ###

 from PyQt4 import QtCore, QtGui
 import maya.utils as utils
 import sys
 import time
 import threading
 import maya.cmds as cmds

 pumpedThread = None
 app = None
 gPump = True

 def get_app():
     global app
     return app

 def set_app(i_app):
     global app
     testAppInstance = QtCore.QCoreApplication.instance()
     if testAppInstance:
         app = testAppInstance
     else:
         app = i_app

 def get_pt():
     global pumpedThread
     return pumpedThread

 def set_pt(i_pt):
     global pumpedThread
     pumpedThread = i_pt

 def pumpQt():
     global app
     global gPump
     processorEv = threading.Event()
     def processor():
         app.processEvents()
         processorEv.set()
     while gPump:
         utils.executeDeferred( processor )
         processorEv.wait()
         processorEv.clear()
         time.sleep(0.01)

 def killProcess():
     global gPump
     gPump = False

 def killPumpThread():
     if get_app():
         get_app().closeAllWindows()
     if get_pt():
         while get_pt().isAlive():
             killProcess()
         set_pt(None)
         set_app(None)


 def initializePumpThread():
     global gPump
     gPump = True
     if get_pt() == None:
     set_app(QtGui.QApplication(sys.argv))
     set_pt(threading.Thread( target = pumpQt, args = () ))
     get_pt().start()

 On Fri, Oct 23, 2009 at 8:41 PM, Sylvain Berger sylvain.ber...@gmail.com
 wrote:

 Where can I find your version of pumpThread?

 Thanks

 On Tue, Sep 29, 2009 at 5:24 AM, David Moulder da...@thirstydevil.co.uk
 wrote:

 Ok,  Here's and basic example with PyQT and a QListWidget...
 Please note.  This use's a modified pumpThread module.  The default one
 from the maya dev kit has given us lots of problems.
 Thanks to some very clever people on this list we now have a working
 pumpThread module that is heavily tested here at work.

 from PyQt4 import QtCore, QtGui
 import pymel as pm
 import pumpThread

 class ExampleUI(QtGui.QDialog):
     def __init__(self, parent=None):
     super(ExampleUI, self).__init__(parent)
     # Set some basic properties on the UI
     self.setWindowTitle('ExampleUI')
     self.setObjectName(ExampleUI)
     self.setAttribute(QtCore.Qt.WA_DeleteOnClose)

     # Add a Layout and set it to the UI
     self.mainLayout = QtGui.QVBoxLayout(self)
     self.setLayout(self.mainLayout)

     # Add a Button and set some properties.  Also add it to a
 layout.
     self.RefreshButton = QtGui.QPushButton()
     self.RefreshButton.setText(Refresh)
     self.mainLayout.addWidget(self.RefreshButton)

     # Add a list and set it to the layout
     self.SelectionList = QtGui.QListWidget()
     self.SelectionList.setMinimumSize(250,250)
     self.mainLayout.addWidget(self.SelectionList)

     # Connect the Refresh Button to a function to populate the list
 using SIGNAL's
     self.connect(self.RefreshButton, QtCore.SIGNAL(clicked()),
 self._RefreshButtonFunc)

     def _RefreshButtonFunc(self):
     '''
     Fill the list based on a maya selection
     '''
     oSel = pm.selected()
     if oSel:
     self.SelectionList.clear()
     [self.SelectionList.addItem(s.name()) for s in oSel]
     else:
     self.SelectionList.clear()

     @staticmethod
     def Display():
     '''
     calls the window.  Typical PumpThread call
     Use's a modified pumpThread that properly set's up the thread.
     '''
     # We need a global to stop python gc the UI
     global mainWindow

     # We need pumpThread to make the UI responsive
     pumpThread.initializePumpThread()
     app = pumpThread.get_app()
     if app:
     # We can set the app to use a nice style
     app.setStyle('Plastique')
     mainWindow = ExampleUI()
     mainWindow.show()

 ExampleUI.Display()

 I'll post our final pumpThread later today.

 -Dave


 On Tue, Sep 29, 2009 at 6:42 AM, floyd1510 vshingr...@gmail.com wrote:

 Hello all,

 I have got PyQt up and running in Maya 2009. I was wondering if
 someone could guide me to a few examples, like adding a list of
 objects from maya into the QT listview or adding items dynamically to
 a combo box etc.

 I appreciate the help.

 Cheers,
 Vikram.








 --
 A pit would not be complete without a Freeman coming out of it.
 The Vortigaunt








 --
 A pit would not be complete without a Freeman coming out of it.
 The Vortigaunt

 



[Maya-Python] Re: numpy with maya and snow leopard

2009-10-26 Thread chadrik

hmmm... that does not look like fun.  since numpy is compiled, i can  
definitely see that there would be a problem copying libs compiled on  
10.4 over to 10.6.  i haven't looked at this problem yet myself, but  
here are a few thoughts:

python2.6.1 is the default on snow leopard and it is 64 bit, which  
makes compiling anything against it much more complicated.  maya 2010  
is still 32 bit, so you should not compile anything against the system  
2.6 to use within 2010.

to get the best compatibility with maya, use mayapy to compile, rather  
than compiling against the system and copying over.  to do this,  
create an easy_install for each maya installation, changing the top  
line to the appropriate mayapy interpreter. our easy_install-maya2009  
looks like this:



#!/usr/bin/env /Applications/Autodesk/maya2009/Maya.app/Contents/bin/ 
mayapy
# EASY-INSTALL-ENTRY-SCRIPT:  
'setuptools==0.6c9','console_scripts','easy_install'
__requires__ = 'setuptools==0.6c9'
import sys
from pkg_resources import load_entry_point

sys.exit(
load_entry_point('setuptools==0.6c9', 'console_scripts',  
'easy_install')()
)




not sure why the /usr/bin/env is necessary on osx (it's not on linux),  
but for me it doesn't work without it.  hope some of this helps.

-chad




On Oct 26, 2009, at 12:03 PM, rabidPraxis wrote:


 Hey Chad, thanks for the response. pyMel is badass, btw..

 I installed numpy on 10.4 (I remember it being a hassle for that first
 install, getting the gcc  fortran compilers working) and I have
 updated it a couple times since then. I installed snow leopard and
 migrated to a new machine, and things have been a little wonky since
 then.

 Anyways, here is the error I get. I have read posts about this being
 something to do with the gcc compiler and some env settings, but I
 have yet to find anything concrete.

  File /var/folders/p4/p4ALURh3FMKA+jcKljzZ2k+++TM/-Tmp-/easy_install-
 p2grWq/numpy-1.3.0/numpy/distutils/command/build_src.py, line 130, in
 run
  File /var/folders/p4/p4ALURh3FMKA+jcKljzZ2k+++TM/-Tmp-/easy_install-
 p2grWq/numpy-1.3.0/numpy/distutils/command/build_src.py, line 147, in
 build_sources
  File /var/folders/p4/p4ALURh3FMKA+jcKljzZ2k+++TM/-Tmp-/easy_install-
 p2grWq/numpy-1.3.0/numpy/distutils/command/build_src.py, line 250, in
 build_extension_sources
  File /var/folders/p4/p4ALURh3FMKA+jcKljzZ2k+++TM/-Tmp-/easy_install-
 p2grWq/numpy-1.3.0/numpy/distutils/command/build_src.py, line 307, in
 generate_sources
  File /private/var/folders/p4/p4ALURh3FMKA+jcKljzZ2k+++TM/-Tmp-/
 easy_install-p2grWq/numpy-1.3.0/numpy/core/setup.py, line 286, in
 generate_config_h
  File /private/var/folders/p4/p4ALURh3FMKA+jcKljzZ2k+++TM/-Tmp-/
 easy_install-p2grWq/numpy-1.3.0/numpy/core/setup.py, line 30, in
 check_types
  File /private/var/folders/p4/p4ALURh3FMKA+jcKljzZ2k+++TM/-Tmp-/
 easy_install-p2grWq/numpy-1.3.0/numpy/core/setup.py, line 186, in
 check_types
 SystemError: Cannot compiler 'Python.h'. Perhaps you need to install
 python-dev|python-devel.

 


--~--~-~--~~~---~--~~
http://groups.google.com/group/python_inside_maya
-~--~~~~--~~--~--~---