Re: [Maya-Python] Re: Help w/Var Assignment inside a Class

2011-08-21 Thread Justin Israel
Since you stated you are trying to write the most efficient code using the best 
coding practices, 
you absolutely should not use vars() or globals() for this purpose. I really 
think its poor habit to
pass in globals unless they are some kind of constant maybe, or environment 
setting. Like say,
a DEBUG flag. Even then I still think globals are kinda evil. Everything should 
always get set up
either through your __init__ in the class, or by setting class level attributes 
once when the script
sets up.
Excerpt on vars(): http://docs.python.org/library/functions.html
Note The returned dictionary should not be modified: the effects on the 
corresponding symbol table are undefined. [3]

vars() and globals() are kind of there for more advanced uses, say where you 
are doing dynamic building of classes or whatnot. Its really unnecessary in 
this case. One reason globals are really evil if misused is because you can't 
always see where objects came from. They were created somewhere else outside 
the current body of code. All the data that is specifically relevant to that 
class should live in that class, and you can wrap it up nicely however you want.

Since your create() method doesnt return anything, you will need to use 
self.lidControls to allow the data to live after create() is done.
The proper way to do this is to have all your important containers that need to 
be built up and remembered, inside your __init__, as you have it
in this example. Is lidControls something the user will access again after 
running create(). You can wrap it up nicer if you want with a getter.

def getControl(self, name):
return self.lidControls.get(name, )

Are these controls always constant?
 ['uprLid', 'lwrLid','lwrLidTrack',
 'lidControls['uprLidTrack']','uprLidRef','lidRig']

If so, I can see why you were trying to make them attributes. Then you are 
right that you could do setattr() if you want, in order to access them as:  
lidRigObj.uprLid

-- justin



On Aug 21, 2011, at 7:55 AM, PixelMuncher wrote:

 @ Justin
 The script is for creating an eyelid rig which tracks the movement of
 an eyeball (based on Stop Staring 3rd Ed.).
 I'm not a professional coder but I like to write tools for my own use.
 I've been using Python for about a year (its my favorite language to
 date). This is the first time I'm using classes in my coding, so its a
 learning experience.  I try to write the most efficient code and use
 best coding practices.
 The problem I encountered was how use a list to create nodes and
 assign them to vars for further processing.  I asked around on a
 couple of forums for how to accomplish this.  The reason I thought of
 using vars is they are easy to read in the code.
 I've already learned that 'vars()/globals()' is not the way to go for
 a few reasons.  Others have also suggested using a dictionary, which
 is what I ended up doing.
 Here are the solutions that have worked:
 --- CODE --
 EyeRig.py
 class lidRig(object):
 
def __init__(self):
print 'lidRig - For instructions, run
 EyeRig.ildRig().useage()'
self.lidControls = dict()
 
def useage(self):
print lidRigUseage,'\n',UDAttrRemove
 
def create (self, lidRigPrefix, uprLidJoint, lwrLidJoint,
 eyeParent, faceControl, lidControls2Make):
# lidControls2Make vars are ['uprLid', 'lwrLid','lwrLidTrack',
 'lidControls['uprLidTrack']','uprLidRef','lidRig']
controlNode = 'loc'
# For each item in the 'lidControls2Make' list, create a group
 or locator and add it to the list of controllers
for control in lidControls2Make:
 
# Create group/locator.  Use dictionary to store reference
 based on name of control:
if controlNode == 'group':
self.lidControls[control] = cmds.group(em = 1, n= '%s_
 %s' % (lidRigPrefix, control))
else:
self.lidControls[control] = cmds.spaceLocator(n= '%s_
 %s' % (lidRigPrefix, control))[0]
print 'Control:  %s. Object: %s' %(control,
 self.lidControls[control])
 
# uprLid controller will be parented under lwrLid controller w/
 max rotation set to prevent passing thru lower lid
# Set the max XRot of the uprLid to 0:
cmds.transformLimits(self.lidControls['uprLid'],rx=(-45,
 0),erx=(0, 1))# Need to set both limits, but erx unsets the min (first
 value)
 
# Setup Hierarchy of controllers
cmds.parent
 (self.lidControls['uprLid'],self.lidControls['lwrLid'])
cmds.parent
 (self.lidControls['lwrLid'],self.lidControls['lwrLidTrack'])
...
  END
 ---
 
 What I like about Chris' approach is that referencing the var is a bit
 easier to write than the dictionary:
 --- CODE ---
 for control in lidControls2Make:
self.lidControls[control] = cmds.group(em = 1, n= '%s_%s' %
 (lidRigPrefix, control))
 
 # Setup 

Re: [Maya-Python] Transfering weights from many to one

2011-09-21 Thread Justin Israel
I cant say I know anything specifically about this process, but from a
general api perspective, it seems that specifying multiple source arguments
as an array isn't documented in either the MEL or the python api docs.
What the docs do say is that it does expect source and destination flags as
string values. Also in the examples, it refers to using
the createSkinCluster mel command for combining multiple pieces of geometry
into a skinCluster, which is then used as the source value.

Have you tried selecting your source meshes, using createSkinCluster, and
then passing that as the string value for *sourceSkin?*
Here is the snippet from the python api docs:

... create geometry ..
... select them ...

maya.mel.eval('createSkinCluster -mi 5 -dr 4' )

cmds.copySkinWeights( ss='skinCluster1', ds='skinCluster2', noMirror=True )



On Tue, Sep 20, 2011 at 11:43 AM, Christian Akesson cakes...@dslextreme.com
 wrote:

 In cases where I want to transfer weights from many separate meshes to a
 merged version of all those meshes:
 So I have done that many times in MEL land using:
 $sourceMeshes - an array of meshes
 $targetMesh - single target mesh
 copySkinWeights -noMirror -surfaceAssociation closestPoint
 -influenceAssociation name $sourceMeshes $targetMesh;

 I am unable to perform the same command using Maya.cmds or PyMel (or at
 least not with the same outcome) :
 copySkinWeights([sourceMeshes, targetMesh],
 surfaceAssociation='closestPoint', influenceAssociation='name')  - Works but
 the result is not accurate.

 The mel version will end up being accurate while the PyMel, maya.cmds (even
 mel.copySkinWeights) are not, which leads me to believe that something is
 messed up with my formatting or I've come across a bug.

 If you use the ss= and ds= flags, there seems to be no way of going from
 multiple to a single.

 Has anyone come across this?
 /Christian


  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Face Centroid

2011-09-22 Thread Justin Israel
They didnt include it in the pymel api wrapper, but this would be it I
think.


import pymel.core as pm

import maya.OpenMaya as OpenMaya


face = pm.MeshFace(pCube1.f[64])

pt = face.__apimfn__().center(OpenMaya.MSpace.kWorld)

centerPoint = pm.datatypes.Point(pt)


-- justin






On Thu, Sep 22, 2011 at 10:21 AM, owen burgess owen.burg...@gmail.comwrote:

 Hi Roland,

 Perhaps this might help:


 http://mayastation.typepad.com/maya-station/2009/11/where-is-the-center-of-a-polygon.html

 regards,
 Owen


 On 22 September 2011 14:58, moesian rolandlamb...@googlemail.com wrote:

 Hello,

 Whats the best way to get the center of a face using pymel?
 pymel.core.general.MeshFace doesn't seem to have a method for it. If
 no method exists would it be possible to extend
 pymel.core.general.MeshFace to include one?

 Thanks

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: how to install SIP for python on MAC

2011-10-04 Thread Justin Israel
Most likely what happened is that you sip and qt are not built with
the same arch.
Can you reply with the results of this?
lipo -info 
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/sip.so

Most likely what you want to do is rebuilt sip, but use these flags:
python configure.py --arch=386 --arch=x86_64

That way it will built 32 and 64bit. Then reinstall pyqt.

-- justin



2011/10/4 宇 1988he...@gmail.com:
 forget to post my tools
 i use
 Mac OS X (Snow Leopard)
 python-2.6.4
 sip-4.12.5
 PyQt-mac-gpl-4.8.5

 On 10月4日, 下午9时43分, 宇 1988he...@gmail.com wrote:
 hi, i got a problem when i was installing PyQt4 on mac, first i
 installed sip-4.12.5 for python, but i got an error when i import the
 sip module.

  import sip

 Traceback (most recent call last):
   File stdin, line 1, in module
 ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/
 lib/python2.6/site-packages/sip.so, 2): no suitable image found.  Did
 find:
 /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
 packages/sip.so: mach-o, but wrong architecture
 i reinstalled the sip many times, and does anybody can help me?

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: nub question - passing arguments as functions

2011-10-04 Thread Justin Israel
No Vordok that still would not work. Daves example is the direction he would
need to go. In the origin question, the example makes no real association
with the item and the item list. Also, if you pass a function as the default
arg like that, it will evaluate only once when the func is defined. For
wanting to have an arg that uses a default function as its value you could
do:

def myFunc(value=None):
if value is None:
value = someFunction()

But yes, really the issue is what Dave addresses by creating classes where a
parent class stores the child classes and also sets a reference to itself (
the parent) when adding in a child.
On Oct 4, 2011 2:11 PM, Vordok vordok.bolsill...@gmail.com wrote:
 Hey,

 Why dont you try this:

 if __name__ = '__main__':
 itemA = myItem()

 itemB = myItem()
 list = myListOfItems()
 list.showAll()

 I hope it work.

 On Sep 19, 9:17 am, Shahar Levavi shahar.lev...@gmail.com wrote:
 Hello,
 I'm trying to set a default argument to be a function result.
 So, in the example below I'm trying to add index to *myItem* but having
 index default to number of items in *myListOfItems*

 class myItem:
   def __init__(self, index = myListOfItems.itemCount(self)):
   self.index = index
   def __str__(self):
   return 'Index: %i' % (self.index)

 class myListOfItems:
   def __init__(self, *args):
   self.items = list(args)
   def itemCount(self):
   len(self.items)
   def showAll(self):
   for item in self items:
   print item

 if __name__ = '__main__':
   itemA = myItem()

   itemB = myItem()
   myListOfItems.showAll()

 This wont work since myListOfItems is not defined on init, but the result
 I'm after is:
 'Index: 0'
 'index: 1'

 How can I achieve this result?

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: Which editor do you use?

2011-10-05 Thread Justin Israel
I've never felt a need to have the telnet commands to maya functionality
working. I tried it once with low commitment and the script didnt work
anymore and I didnt care enough to look onto it.
Whether I use eclipse+pydev, or coda, or whatever, I usually just have a
small snippet in the maya script editor like this:

import myNewTool; reload(myNewTool); myNewTool.Run()
# or whatever launches my script

and I just select and hit return.

I used to have completion set up in eclipse, but that was only important to
me when I was learning the api. Now, I just have the python commands
reference page up and I look at it.

Though, using eclipse for autocompletion is really nice when you are
developing pyqt apps for maya, since qt has way more classes and tons of
constants and whatnot. So it is faster than drilling down through their api
doc.
 On Oct 5, 2011 7:13 AM, Farsheed Ashouri farsheed.asho...@gmail.com
wrote:
 gVim + Mapy

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: how to install SIP for python on MAC

2011-10-06 Thread Justin Israel
Since this is a maya mailing list, I'm assuming you are installing
PyQt for use in maya?
I have a blog about it, if this helps at all:
http://www.justinfx.com/2011/01/07/installing-pyqt-for-maya-2011-osx/

Maybe you could runpython configure.py --verbose and see more info?

Also, what qt did you install? Was it from the binary installer or did
you build from source?



On Thu, Oct 6, 2011 at 9:06 AM, ZhangYu 1988he...@gmail.com wrote:
 With the code you post, it works! i can import sip, but when i rebuilt the 
 pyqt, a new problem appeared, there is the error callback
 Zhang-Yus-MacBook-Pro:PyQt-mac-gpl-4.8.5 zhangyu$ python configure.py
 Determining the layout of your Qt installation...
 Error: Failed to determine the layout of your Qt installation. Try again using
 the --verbose flag to see more detail about the problem.
 I reinstalled the qt but it doesn't work!
 please help
 在 Oct 5, 2011,1:57 AM, Justin Israel 写道:

 Most likely what happened is that you sip and qt are not built with
 the same arch.
 Can you reply with the results of this?
 lipo -info 
 /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/sip.so

 Most likely what you want to do is rebuilt sip, but use these flags:
 python configure.py --arch=386 --arch=x86_64

 That way it will built 32 and 64bit. Then reinstall pyqt.

 -- justin



 2011/10/4 宇 1988he...@gmail.com:
 forget to post my tools
 i use
 Mac OS X (Snow Leopard)
 python-2.6.4
 sip-4.12.5
 PyQt-mac-gpl-4.8.5

 On 10月4日, 下午9时43分, 宇 1988he...@gmail.com wrote:
 hi, i got a problem when i was installing PyQt4 on mac, first i
 installed sip-4.12.5 for python, but i got an error when i import the
 sip module.

 import sip

 Traceback (most recent call last):
  File stdin, line 1, in module
 ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/
 lib/python2.6/site-packages/sip.so, 2): no suitable image found.  Did
 find:
        
 /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
 packages/sip.so: mach-o, but wrong architecture
 i reinstalled the sip many times, and does anybody can help me?

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe


 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: how to install SIP for python on MAC

2011-10-06 Thread Justin Israel
That would work if he only wanted to get pyqt independently running as a
whole. But assuming he wants to use pyqt inside maya (otherwise it wouldnt
make sense to ask here), you have to use specific versions and build steps
for it to link properly and work. My blog was written for maya 2011. For
2012 there are some updated version numbers for qt, sip, pyqt. I should
update my blog with that info.
 On Oct 6, 2011 3:34 PM, Vordok vordok.bolsill...@gmail.com wrote:
 Why dont you try using the mac ports version?

 On Oct 6, 11:45 am, Justin Israel justinisr...@gmail.com wrote:
 Since this is a maya mailing list, I'm assuming you are installing
 PyQt for use in maya?
 I have a blog about it, if this helps at all:
http://www.justinfx.com/2011/01/07/installing-pyqt-for-maya-2011-osx/

 Maybe you could runpython configure.py --verbose and see more info?

 Also, what qt did you install? Was it from the binary installer or did
 you build from source?







 On Thu, Oct 6, 2011 at 9:06 AM, ZhangYu 1988he...@gmail.com wrote:
  With the code you post, it works! i can import sip, but when i rebuilt
the pyqt, a new problem appeared, there is the error callback
  Zhang-Yus-MacBook-Pro:PyQt-mac-gpl-4.8.5 zhangyu$ python configure.py
  Determining the layout of your Qt installation...
  Error: Failed to determine the layout of your Qt installation. Try
again using
  the --verbose flag to see more detail about the problem.
  I reinstalled the qt but it doesn't work!
  please help
  在 Oct 5, 2011,1:57 AM, Justin Israel 写道:

  Most likely what happened is that you sip and qt are not built with
  the same arch.
  Can you reply with the results of this?
  lipo -info
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/sip.so

  Most likely what you want to do is rebuilt sip, but use these flags:
  python configure.py --arch=386 --arch=x86_64

  That way it will built 32 and 64bit. Then reinstall pyqt.

  -- justin

  2011/10/4 宇 1988he...@gmail.com:
  forget to post my tools
  i use
  Mac OS X (Snow Leopard)
  python-2.6.4
  sip-4.12.5
  PyQt-mac-gpl-4.8.5

  On 10月4日, 下午9时43分, 宇 1988he...@gmail.com wrote:
  hi, i got a problem when i was installing PyQt4 on mac, first i
  installed sip-4.12.5 for python, but i got an error when i import
the
  sip module.

  import sip

  Traceback (most recent call last):
   File stdin, line 1, in module
  ImportError:
dlopen(/Library/Frameworks/Python.framework/Versions/2.6/
  lib/python2.6/site-packages/sip.so, 2): no suitable image found.
 Did
  find:
 
 /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-
  packages/sip.so: mach-o, but wrong architecture
  i reinstalled the sip many times, and does anybody can help me?

  --
  view archives:http://groups.google.com/group/python_inside_maya
  change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe

  --
  view archives:http://groups.google.com/group/python_inside_maya
  change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe

  --
  view archives:http://groups.google.com/group/python_inside_maya
  change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


[Maya-Python] Announcing: Intro to Python for Maya

2011-10-08 Thread Justin Israel
Hi all,

I just wanted to make an announcement that my first online video tutorial
was released today through cmiVFX.com

Its an Introduction to Python for Maya course, aimed at artists that are new
to python. If any of you are just starting out learning the language, check
it out! Or maybe you work with Maya artists that might want to pick up some
new skills. Then pass this on to them!

Link:
http://cmivfx.com/tutorials/view/320/Python+Introduction+Vol+01+-+Maya

I plan to release some more videos, that go into further details and
complexity, but this should get a lot of newcomers started. Also, if any of
you more accomplished python coders out there want to suggest some topics or
examples that would make for good intermediate or advanced video additions,
please do contribute your thoughts! I want to make sure to cover everyones
interests and help this community grow in the language.
If anyone happens to check it out, feel free to leave me some feedback
either here, or on my blog.
http://www.justinfx.com/2011/10/08/intro-to-python-for-maya-artists-tutorial/

Thanks!
justin

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Announcing: Intro to Python for Maya

2011-10-10 Thread Justin Israel
It would be nice if cmivfx included small sample clips on each video
release, but it seems they do not.
I was going to try and throw together a promo video to put on youtube, but
it might take a few days.

Got any questions that I can answer for you right now?



On Mon, Oct 10, 2011 at 8:45 AM, Panupat Chongstitwattana 
panup...@gmail.com wrote:

 Very very interesting.

 Is there any short preview available?

 On Sun, Oct 9, 2011 at 3:03 PM, Farsheed Ashouri
 farsheed.asho...@gmail.com wrote:
  That's nice, Thanks.
 
  On Sunday, October 9, 2011, Justin Israel wrote:
 
  Hi all,
 
  I just wanted to make an announcement that my first online video
 tutorial
  was released today through cmiVFX.com
 
  Its an Introduction to Python for Maya course, aimed at artists that are
  new to python. If any of you are just starting out learning the
 language,
  check it out! Or maybe you work with Maya artists that might want to
 pick up
  some new skills. Then pass this on to them!
 
  Link:
  http://cmivfx.com/tutorials/view/320/Python+Introduction+Vol+01+-+Maya
 
  I plan to release some more videos, that go into further details and
  complexity, but this should get a lot of newcomers started. Also, if any
 of
  you more accomplished python coders out there want to suggest some
 topics or
  examples that would make for good intermediate or advanced video
 additions,
  please do contribute your thoughts! I want to make sure to cover
 everyones
  interests and help this community grow in the language.
  If anyone happens to check it out, feel free to leave me some feedback
  either here, or on my blog.
 
 
 http://www.justinfx.com/2011/10/08/intro-to-python-for-maya-artists-tutorial/
 
  Thanks!
  justin
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 
 
  --
  Sincerely,
  Farsheed Ashouri,
  ourway.ir
  Tel: +98 9388801504
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Announcing: Intro to Python for Maya

2011-10-10 Thread Justin Israel
There is a pretty good explanation of the parts of the course on the product
page:
http://cmivfx.com/tutorials/view/320/Python+Introduction+Vol+01+-+Maya

But here is the chapter list:

   - Introduction
   - Objects and Variables
   - Function
   - Maya Script Editor
   - Loops and Functions
   - Spiral Example
   - Fixing Textures
   - Development Details
   - Configuration
   - Bonus: Intro to UI

Like I said, this video is aimed at newcomers to python, and introduces
exactly what you need to get started.
if you already know python, the first 30 min would be a bit basic for you.
Then we move into maya and do visual examples of python, and get into the
commands API. For those that know all these basics, my next video will get
into writing classes, and more complex tools, a little bit of the plugin
api, and some pyqt. Plus whatever else I come up with between now and then.



On Mon, Oct 10, 2011 at 11:28 AM, Panupat Chongstitwattana 
panup...@gmail.com wrote:

 I'll be waiting Justin :)

 Can you let us know the chapter list?



 On Tue, Oct 11, 2011 at 1:19 AM, Martin La Land Romero
 martinmrom...@gmail.com wrote:
  A sample demo would be nice!
 
  Martin
 
  On Mon, Oct 10, 2011 at 10:59 AM, Justin Israel justinisr...@gmail.com
  wrote:
 
  It would be nice if cmivfx included small sample clips on each video
  release, but it seems they do not.
  I was going to try and throw together a promo video to put on youtube,
 but
  it might take a few days.
  Got any questions that I can answer for you right now?
 
 
  On Mon, Oct 10, 2011 at 8:45 AM, Panupat Chongstitwattana
  panup...@gmail.com wrote:
 
  Very very interesting.
 
  Is there any short preview available?
 
  On Sun, Oct 9, 2011 at 3:03 PM, Farsheed Ashouri
  farsheed.asho...@gmail.com wrote:
   That's nice, Thanks.
  
   On Sunday, October 9, 2011, Justin Israel wrote:
  
   Hi all,
  
   I just wanted to make an announcement that my first online video
   tutorial
   was released today through cmiVFX.com
  
   Its an Introduction to Python for Maya course, aimed at artists that
   are
   new to python. If any of you are just starting out learning the
   language,
   check it out! Or maybe you work with Maya artists that might want to
   pick up
   some new skills. Then pass this on to them!
  
   Link:
  
 http://cmivfx.com/tutorials/view/320/Python+Introduction+Vol+01+-+Maya
  
   I plan to release some more videos, that go into further details and
   complexity, but this should get a lot of newcomers started. Also, if
   any of
   you more accomplished python coders out there want to suggest some
   topics or
   examples that would make for good intermediate or advanced video
   additions,
   please do contribute your thoughts! I want to make sure to cover
   everyones
   interests and help this community grow in the language.
   If anyone happens to check it out, feel free to leave me some
 feedback
   either here, or on my blog.
  
  
  
 http://www.justinfx.com/2011/10/08/intro-to-python-for-maya-artists-tutorial/
  
   Thanks!
   justin
  
   --
   view archives: http://groups.google.com/group/python_inside_maya
   change your subscription settings:
   http://groups.google.com/group/python_inside_maya/subscribe
  
  
   --
   Sincerely,
   Farsheed Ashouri,
   ourway.ir
   Tel: +98 9388801504
  
   --
   view archives: http://groups.google.com/group/python_inside_maya
   change your subscription settings:
   http://groups.google.com/group/python_inside_maya/subscribe
  
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
  --
  Martin La Land Romero
  www.martinromerovfx.com
  http://martinromerovfx.blogspot.com/
  martinmrom...@gmail.com
  (415)261-2172
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: Announcing: Intro to Python for Maya

2011-10-12 Thread Justin Israel
I appreciate the interest!

I'm still working out the outline for vol.2. Hopefully I can get it finished
with all the example ideas within a week, and then record. So maybe 2 weeks.
The interesting challenge is trying to determine where to draw the line
between intermediate and advanced concepts. Im not so much a maya artist as
I am a developer and compositor, so sometimes I think my idea of level 2 vs
3 isnt always compatible with a hard core 3d artists idea.

A question for those interested... I received an email with someones
feedback about feeling I had made a mistake in not teaching via pymel. My
response was that, as I even address in the video, pymel is slower, 3rd
party, and prevents you from learning the direct commands and api syntax.
But its good for producing simpler code with easier access to functionality.
Is pymel something you would prefer to learn for accessing the api, as
opposed to doing it directly with OpenMaya calls? My feeling is that you
should learn the real api first, and then optionally choose to use an
abstraction layer later under the right circumstances.
On Oct 12, 2011 2:33 AM, 宇 1988he...@gmail.com wrote:

 Waiting for pyqt and API, thumbs up!!!

 On 10月11日, 上午5时13分, Justin Israel justinisr...@gmail.com wrote:
  There is a pretty good explanation of the parts of the course on the
 product
  page:
 http://cmivfx.com/tutorials/view/320/Python+Introduction+Vol+01+-+Maya
 
  But here is the chapter list:
 
 - Introduction
 - Objects and Variables
 - Function
 - Maya Script Editor
 - Loops and Functions
 - Spiral Example
 - Fixing Textures
 - Development Details
 - Configuration
 - Bonus: Intro to UI
 
  Like I said, this video is aimed at newcomers to python, and introduces
  exactly what you need to get started.
  if you already know python, the first 30 min would be a bit basic for
 you.
  Then we move into maya and do visual examples of python, and get into the
  commands API. For those that know all these basics, my next video will
 get
  into writing classes, and more complex tools, a little bit of the plugin
  api, and some pyqt. Plus whatever else I come up with between now and
 then.
 
  On Mon, Oct 10, 2011 at 11:28 AM, Panupat Chongstitwattana 
 
 
 
 
 
 
 
  panup...@gmail.com wrote:
   I'll be waiting Justin :)
 
   Can you let us know the chapter list?
 
   On Tue, Oct 11, 2011 at 1:19 AM, Martin La Land Romero
   martinmrom...@gmail.com wrote:
A sample demo would be nice!
 
Martin
 
On Mon, Oct 10, 2011 at 10:59 AM, Justin Israel 
 justinisr...@gmail.com
wrote:
 
It would be nice if cmivfx included small sample clips on each video
release, but it seems they do not.
I was going to try and throw together a promo video to put on
 youtube,
   but
it might take a few days.
Got any questions that I can answer for you right now?
 
On Mon, Oct 10, 2011 at 8:45 AM, Panupat Chongstitwattana
panup...@gmail.com wrote:
 
Very very interesting.
 
Is there any short preview available?
 
On Sun, Oct 9, 2011 at 3:03 PM, Farsheed Ashouri
farsheed.asho...@gmail.com wrote:
 That's nice, Thanks.
 
 On Sunday, October 9, 2011, Justin Israel wrote:
 
 Hi all,
 
 I just wanted to make an announcement that my first online video
 tutorial
 was released today through cmiVFX.com
 
 Its an Introduction to Python for Maya course, aimed at artists
 that
 are
 new to python. If any of you are just starting out learning the
 language,
 check it out! Or maybe you work with Maya artists that might
 want to
 pick up
 some new skills. Then pass this on to them!
 
 Link:
 
  http://cmivfx.com/tutorials/view/320/Python+Introduction+Vol+01+-+Maya
 
 I plan to release some more videos, that go into further details
 and
 complexity, but this should get a lot of newcomers started.
 Also, if
 any of
 you more accomplished python coders out there want to suggest
 some
 topics or
 examples that would make for good intermediate or advanced video
 additions,
 please do contribute your thoughts! I want to make sure to cover
 everyones
 interests and help this community grow in the language.
 If anyone happens to check it out, feel free to leave me some
   feedback
 either here, or on my blog.
 
  http://www.justinfx.com/2011/10/08/intro-to-python-for-maya-artists-t.
 ..
 
 Thanks!
 justin
 
 --
 view archives:http://groups.google.com/group/python_inside_maya
 change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe
 
 --
 Sincerely,
 Farsheed Ashouri,
 ourway.ir
 Tel: +98 9388801504
 
 --
 view archives:http://groups.google.com/group/python_inside_maya
 change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe
 
--
view archives:http://groups.google.com/group

Re: [Maya-Python] What's faster, API(2) or native Python?

2011-10-17 Thread Justin Israel
I dont think its an across the board one way or the other answer.
The maya api classes are all wrappers around C++ code, so they should be
pretty fast, whereas not every python standard library module is a C
extension. You can do case-by-case time tests if you want, but if the maya
api provides the functionality you can probably be sure its at least AS
fast. Unless their C code is not as optimized as the python C extension.


On Mon, Oct 17, 2011 at 3:05 AM, André Adam a_adam_li...@gmx.de wrote:

 Hi there,

 in general, are the Maya API(2) classes considered to be faster than
 calling equivalent native Python classes? Like, using the MAngle class
 for radian to degree conversion instead of Python's math.degree()? I
 am calling that per frame, so performance is a factor here.

 Thanks in advance for any insight you can share! Cheers!

  -André

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: Announcing: Intro to Python for Maya

2011-10-19 Thread Justin Israel
Some of you had asked to see a sample video. The closest I have now is a
promo on youtube:
http://www.youtube.com/watch?v=yWW9igbEGikfeature=feedu

I didn't cut it, so its not quite what I hoped it would be (I wanted it to
cut faster, with more footage), but at least you get to hear my gorgeous
voice.  :-)

Also, to try and stimulate some more activity, here is a 20% coupon code:
*justinvfx20*
*
*
*
*
On Wed, Oct 12, 2011 at 3:14 PM, Martin La Land Romero 
martinmrom...@gmail.com wrote:

 Hi there,

 I am a Visual Effects Artist and I am currently learning python. I have
 created a few basic tools here and there and to answer your question, I
 think that personally and also  based on comments from some of my
 co-workers, learning Python as artist I think is the best way to go, I think
 eventually we can learn how Pymel works however, I do agree with you that we
 should learn the real api first.

 My feeling is that you should learn the real api first, and then optionally
 choose to use an abstraction layer later under the right circumstances.


 Those are my two cents.

 Thanks again!

 Martin


 On Wed, Oct 12, 2011 at 9:18 AM, Justin Israel justinisr...@gmail.comwrote:

 I appreciate the interest!

 I'm still working out the outline for vol.2. Hopefully I can get it
 finished with all the example ideas within a week, and then record. So maybe
 2 weeks. The interesting challenge is trying to determine where to draw the
 line between intermediate and advanced concepts. Im not so much a maya
 artist as I am a developer and compositor, so sometimes I think my idea of
 level 2 vs 3 isnt always compatible with a hard core 3d artists idea.

 A question for those interested... I received an email with someones
 feedback about feeling I had made a mistake in not teaching via pymel. My
 response was that, as I even address in the video, pymel is slower, 3rd
 party, and prevents you from learning the direct commands and api syntax.
 But its good for producing simpler code with easier access to functionality.
 Is pymel something you would prefer to learn for accessing the api, as
 opposed to doing it directly with OpenMaya calls? My feeling is that you
 should learn the real api first, and then optionally choose to use an
 abstraction layer later under the right circumstances.
 On Oct 12, 2011 2:33 AM, 宇 1988he...@gmail.com wrote:

 Waiting for pyqt and API, thumbs up!!!

 On 10月11日, 上午5时13分, Justin Israel justinisr...@gmail.com wrote:
  There is a pretty good explanation of the parts of the course on the
 product
  page:
 http://cmivfx.com/tutorials/view/320/Python+Introduction+Vol+01+-+Maya
 
  But here is the chapter list:
 
 - Introduction
 - Objects and Variables
 - Function
 - Maya Script Editor
 - Loops and Functions
 - Spiral Example
 - Fixing Textures
 - Development Details
 - Configuration
 - Bonus: Intro to UI
 
  Like I said, this video is aimed at newcomers to python, and introduces
  exactly what you need to get started.
  if you already know python, the first 30 min would be a bit basic for
 you.
  Then we move into maya and do visual examples of python, and get into
 the
  commands API. For those that know all these basics, my next video will
 get
  into writing classes, and more complex tools, a little bit of the
 plugin
  api, and some pyqt. Plus whatever else I come up with between now and
 then.
 
  On Mon, Oct 10, 2011 at 11:28 AM, Panupat Chongstitwattana 
 
 
 
 
 
 
 
  panup...@gmail.com wrote:
   I'll be waiting Justin :)
 
   Can you let us know the chapter list?
 
   On Tue, Oct 11, 2011 at 1:19 AM, Martin La Land Romero
   martinmrom...@gmail.com wrote:
A sample demo would be nice!
 
Martin
 
On Mon, Oct 10, 2011 at 10:59 AM, Justin Israel 
 justinisr...@gmail.com
wrote:
 
It would be nice if cmivfx included small sample clips on each
 video
release, but it seems they do not.
I was going to try and throw together a promo video to put on
 youtube,
   but
it might take a few days.
Got any questions that I can answer for you right now?
 
On Mon, Oct 10, 2011 at 8:45 AM, Panupat Chongstitwattana
panup...@gmail.com wrote:
 
Very very interesting.
 
Is there any short preview available?
 
On Sun, Oct 9, 2011 at 3:03 PM, Farsheed Ashouri
farsheed.asho...@gmail.com wrote:
 That's nice, Thanks.
 
 On Sunday, October 9, 2011, Justin Israel wrote:
 
 Hi all,
 
 I just wanted to make an announcement that my first online
 video
 tutorial
 was released today through cmiVFX.com
 
 Its an Introduction to Python for Maya course, aimed at
 artists that
 are
 new to python. If any of you are just starting out learning
 the
 language,
 check it out! Or maybe you work with Maya artists that might
 want to
 pick up
 some new skills. Then pass this on to them!
 
 Link:
 
  
 http://cmivfx.com/tutorials/view/320/Python+Introduction+Vol+01+-+Maya
 
 I

Re: [Maya-Python] Re: Announcing: Intro to Python for Maya

2011-10-19 Thread Justin Israel
I totally agree with you. I recorded some material and gave it to him, and
he threw that together and posted it. I didnt intend for it to be an actual
sample of the footage from the tutorial, since he doesnt make samples, but
at least something a little faster paced, lol.
Thanks for the repost!


On Wed, Oct 19, 2011 at 12:14 PM, ArrantSquid arrantsq...@gmail.com wrote:

 Posted on Twitter with Promo code and passed around the office
 again. :)

 The promo video definitely could have used another 30 seconds to
 really get what would come out of it. ;)

 On Oct 19, 12:17 pm, Justin Israel justinisr...@gmail.com wrote:
  Some of you had asked to see a sample video. The closest I have now is a
  promo on youtube:
 http://www.youtube.com/watch?v=yWW9igbEGikfeature=feedu
 
  I didn't cut it, so its not quite what I hoped it would be (I wanted it
 to
  cut faster, with more footage), but at least you get to hear my gorgeous
  voice.  :-)
 
  Also, to try and stimulate some more activity, here is a 20% coupon code:
  *justinvfx20*
  *
  *
  *
  *
  On Wed, Oct 12, 2011 at 3:14 PM, Martin La Land Romero 
 
 
 
 
 
 
 
  martinmrom...@gmail.com wrote:
   Hi there,
 
   I am a Visual Effects Artist and I am currently learning python. I have
   created a few basic tools here and there and to answer your question, I
   think that personally and also  based on comments from some of my
   co-workers, learning Python as artist I think is the best way to go, I
 think
   eventually we can learn how Pymel works however, I do agree with you
 that we
   should learn the real api first.
 
   My feeling is that you should learn the real api first, and then
 optionally
   choose to use an abstraction layer later under the right
 circumstances.
 
   Those are my two cents.
 
   Thanks again!
 
   Martin
 
   On Wed, Oct 12, 2011 at 9:18 AM, Justin Israel justinisr...@gmail.com
 wrote:
 
   I appreciate the interest!
 
   I'm still working out the outline for vol.2. Hopefully I can get it
   finished with all the example ideas within a week, and then record. So
 maybe
   2 weeks. The interesting challenge is trying to determine where to
 draw the
   line between intermediate and advanced concepts. Im not so much a maya
   artist as I am a developer and compositor, so sometimes I think my
 idea of
   level 2 vs 3 isnt always compatible with a hard core 3d artists idea.
 
   A question for those interested... I received an email with someones
   feedback about feeling I had made a mistake in not teaching via pymel.
 My
   response was that, as I even address in the video, pymel is slower,
 3rd
   party, and prevents you from learning the direct commands and api
 syntax.
   But its good for producing simpler code with easier access to
 functionality.
   Is pymel something you would prefer to learn for accessing the api, as
   opposed to doing it directly with OpenMaya calls? My feeling is that
 you
   should learn the real api first, and then optionally choose to use an
   abstraction layer later under the right circumstances.
   On Oct 12, 2011 2:33 AM, 宇 1988he...@gmail.com wrote:
 
   Waiting for pyqt and API, thumbs up!!!
 
   On 10月11日, 上午5时13分, Justin Israel justinisr...@gmail.com wrote:
There is a pretty good explanation of the parts of the course on
 the
   product
page:
  
 http://cmivfx.com/tutorials/view/320/Python+Introduction+Vol+01+-+Maya
 
But here is the chapter list:
 
   - Introduction
   - Objects and Variables
   - Function
   - Maya Script Editor
   - Loops and Functions
   - Spiral Example
   - Fixing Textures
   - Development Details
   - Configuration
   - Bonus: Intro to UI
 
Like I said, this video is aimed at newcomers to python, and
 introduces
exactly what you need to get started.
if you already know python, the first 30 min would be a bit basic
 for
   you.
Then we move into maya and do visual examples of python, and get
 into
   the
commands API. For those that know all these basics, my next video
 will
   get
into writing classes, and more complex tools, a little bit of the
   plugin
api, and some pyqt. Plus whatever else I come up with between now
 and
   then.
 
On Mon, Oct 10, 2011 at 11:28 AM, Panupat Chongstitwattana 
 
panup...@gmail.com wrote:
 I'll be waiting Justin :)
 
 Can you let us know the chapter list?
 
 On Tue, Oct 11, 2011 at 1:19 AM, Martin La Land Romero
 martinmrom...@gmail.com wrote:
  A sample demo would be nice!
 
  Martin
 
  On Mon, Oct 10, 2011 at 10:59 AM, Justin Israel 
   justinisr...@gmail.com
  wrote:
 
  It would be nice if cmivfx included small sample clips on each
   video
  release, but it seems they do not.
  I was going to try and throw together a promo video to put on
   youtube,
 but
  it might take a few days.
  Got any questions that I can answer for you right now?
 
  On Mon, Oct 10, 2011 at 8:45 AM, Panupat

Re: [Maya-Python] where to start pymel for a beginner?

2011-10-19 Thread Justin Israel
Are you asking where you can actually USE pymel inside Maya? Or are you
asking where you can begin to LEARN pymel?
If you are Maya 2011+, you can open script editor and do:

import pymel.core as pm

Sub maya 2011 you have to install pymel manually.



On Wed, Oct 19, 2011 at 3:13 PM, Reza Shahsavary r.shahsav...@gmail.comwrote:

 Hi guys.
 I wanna to start Pymel but I do not know how.
 where can I start pymel?
 thx

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: Which editor do you use?

2011-10-26 Thread Justin Israel
Sublime is 'ok'. This same discussion just happened on the golang mailing list. 
Everyone thinks every editor is the best. Some people are hardcore vim. Some 
use fancier IDEs like eclipse. 
I personally felt sublime was lacking. But everyone has an opinion. This thread 
will go on forever. 



On Oct 26, 2011, at 1:15 AM, Xavier Ho cont...@xavierho.com wrote:

 I can't believe no one has mentioned Sublime Text 2 yet.  It will blow your 
 mind. :]
 
 http://www.sublimetext.com/
 
 -Xav on his Gingerbread
 
 On Oct 26, 2011 5:55 PM, yury nedelin ynede...@gmail.com wrote:
 Nice 
 thanks jan
 
 Yury 
 
 On Tue, Oct 25, 2011 at 1:13 PM, Jan: jan@gmail.com wrote:
 Hi Yury,
 
 I do not think there is mel syntax available for VS 2010 but here is an 
 explanation for pymel.
 https://pytools.codeplex.com/discussions/276754
 
 If it does not work give VS 2010 a restart. that should do the trick. 
 
 Hope that helps!
 Jan
 
 
 2011/10/25 ynedelin ynede...@gmail.com
 
 Hi Mike
 
 I am staring to use VS as well I am on VS 2010. Do you know of a way
 to get MEL syntax for VS?
 
 thanks
 
 Yury
 
 
 On Oct 21, 5:27 am, Mike Malinowski (LIONHEAD)
 mich...@microsoft.com wrote:
  As with Jan, I also use Visual Studio with the PTVS integration. Generally 
  I find it much cleaner and organised than eclipse.
 
  From: python_inside_maya@googlegroups.com 
  [mailto:python_inside_maya@googlegroups.com] On Behalf Of Jan:
  Sent: 21 October 2011 13:05
  To: python_inside_maya@googlegroups.com
  Subject: Re: [Maya-Python] Re: Which editor do you use?
 
  I just started to use visual studio with the python implementation that has 
  been released recently.
  I must say its quite good. Just need to get the hang of using visual studio.
 
  Before that Eclipse/Pydev which worked really well.
 
  2011/10/6 PixelMuncher pixeldr...@gmail.commailto:pixeldr...@gmail.com
  I'll put in my 2 cents for Eclipse/Pydev.  Works great for me.
  I have the creative crash plugin working as far as communicating w/
  Maya, but I don't think autocomplete will work with straight Python
  (ie cmds.command...).
 
  --
  view archives:http://groups.google.com/group/python_inside_maya
  change your subscription 
  settings:http://groups.google.com/group/python_inside_maya/subscribe
 
  --
  view archives:http://groups.google.com/group/python_inside_maya
  change your subscription 
  settings:http://groups.google.com/group/python_inside_maya/subscribe
 
 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: Which editor do you use?

2011-10-26 Thread Justin Israel
Emacs is your favorite OS?




On Oct 26, 2011, at 6:11 PM, T. D. Smith tagoresm...@gmail.com wrote:

 Emacs, since it's my favorite OS. Too bad it doesn't have a decent
 text editor ;). One of these days I am going to have to learn to use
 the vi emulation for emacs, but... old habits die hard, and the Emacs
 key-bindings (well, my Emacs key-bindings) are burned into my fingers
 at this point.
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: Which editor do you use?

2011-10-27 Thread Justin Israel
Ha thats awesome. Thanks for the insight!
I missed the boat on that since I'm not a traditional CS major or old school 
linux junkie. Though this sounds like the lead dev at my work. He fires away 
all day in emacs on an ergonomic dvorak keyboard. I had to do something on his 
box a few times and had to single finger poke at each key. It also makes a beep 
with each keypress that he finally disabled. Yet its still exceptionally loud 
with it off. :-)



On Oct 27, 2011, at 4:23 PM, T. D. Smith tagoresm...@gmail.com wrote:

 
 
 On Oct 26, 11:01 pm, Justin Israel justinisr...@gmail.com wrote:
 Emacs is your favorite OS?
 
 It's an old joke that probably came from the vi community: Emacs is a
 great operating system. Too bad it doesn't have a decent text editor.
 But there's some truth to it. Emacs was a pretty huge executable back
 in the day- another old joke is that Emacs stands for Eleven Megs and
 constantly swapping, though that joke doesn't make much sense
 anymore.
 
 But Emacs is also very programmable and really hardcore Emacs users
 use it to do almost everything. It has a web browser, an email client,
 an irc client, a newsreader, modes for interacting with various source
 control systems, Tetris, a few chatbots, including Eliza and Zippy the
 Pinhead (who you can make converse with each other if it's a really
 slow day at the office,) etc. As Xavier Ho points out you can open a
 system shell in an Emacs buffer. And Emacs is very programmable, if
 you don't mind the idiosyncracies of Emacs Lisp.
 
 I wind up developing on Windows, Mac, and Linux, and there was a time
 when I used a couple of other operating systems pretty regularly.
 Treating Emacs like an OS as much as I can helps to soften the blow of
 moving from platform to platform, though I'm definitely not a really
 hardcore Emacs user. Among other things, I'm not able to grow a
 luxurious enough beard to qualify ;).
 
 I do think that Emacs is a decent text editor, but I sometimes suspect
 that vi might be a better one. And I'm pretty sure vi is less likely
 to give you an RSI than Emacs is. Emacs does have an answer to this
 though- there is a mode for emacs (more than one actually, I think,)
 that makes Emacs's text editing a lot like vi's. But it's a little
 like switching to a programmer's Dvorak keyboard layout- something I
 sometimes think I ought to do, but which I am too set in my ways to
 actually do.
 
 Best
 T
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] PyQt4 for Maya2012 OSX installer

2011-11-10 Thread Justin Israel
Not a windows user so I can't manage that part, but check out this link:
http://blarg.robertkist.com/?p=51

If you want to build one, the script could get committed to the MyQt4
project. I did this since Im a mac user and I had the environment all set
up and available to me. If I had a windows set up with Maya, or a linux set
up, I could probably do these myself as well. But I will host the builds on
my dropbox for sure.



On Thu, Nov 10, 2011 at 12:33 PM, Martin La Land Romero 
martinmrom...@gmail.com wrote:

 How about for Maya 64bit on windows 7?

 Thanks


 On Thu, Nov 10, 2011 at 4:09 AM, Nick Scholtes airc...@gmail.com wrote:

 Very cool  :)



 On Thu, Nov 10, 2011 at 12:48 AM, melvin.3d melvin...@gmail.com wrote:

 Cool man


 On Wed, Nov 9, 2011 at 10:44 PM, Justin justinisr...@gmail.com wrote:

 Hey Everyone,

 I was just wrapping up my next tutorial video, and was doing a bit on
 PyQt4 at the end. I have seen people hosting precompiled windows
 installers but I didnt see one for OSX. I put together a builder:

 http://www.justinfx.com/2011/11/09/installing-pyqt4-for-maya-2012-osx/

 If you use linux and are Makefile savvy, please contribute a linux
 version on github! :-)

 -- justin


 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe




 --
 My Photo Profile:
 http://www.guru.com/freelancers/carbonorchards
  http://goog_1715856884



  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe




 --
 Martin La Land Romero
 www.martinromerovfx.com
 http://martinromerovfx.blogspot.com/
 martinmrom...@gmail.com
 (415)261-2172

  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] PyQt4 for Maya2012 OSX installer

2011-11-11 Thread Justin Israel
Oh sweet. When I was searching, I didn't find any linux builds. Im going to 
link to your page and the windows one I found so they are all in one place. 
Guess someone still needs to build an x64 for windows7.
I wonder what the licensing issue would have been for autodesk to have just 
included pyqt built already with mayas python interpreter. It makes sense to 
have it. They aren't actually using it any of there code so it would just be 
including it in the python site-packages. Then people wouldn't need to write 
blog tutorials and host installers. 



On Nov 10, 2011, at 8:05 PM, Kurian O.S kuria...@gmail.com wrote:

 dont have any make file but maybe some one can make it 
 http://www.kurianos.com/wordpress/?p=551
 
 On Thu, Nov 10, 2011 at 12:14 PM, Justin justinisr...@gmail.com wrote:
 Hey Everyone,
 
 I was just wrapping up my next tutorial video, and was doing a bit on
 PyQt4 at the end. I have seen people hosting precompiled windows
 installers but I didnt see one for OSX. I put together a builder:
 
 http://www.justinfx.com/2011/11/09/installing-pyqt4-for-maya-2012-osx/
 
 If you use linux and are Makefile savvy, please contribute a linux
 version on github! :-)
 
 -- justin
 
 
 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 --:: Kurian ::--
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Make Selected Curves Dynamic via python or pymel

2011-11-15 Thread Justin Israel
How about this?

sel = pm.selected()
for eachIteration in sel:
   pm.select(eachIteration, r=True)
   pm.mel.eval('MakeCurvesDynamic')
pm.select(sel, r=True)

Haven't tested because I'm on my phone. 



On Nov 15, 2011, at 8:07 PM, charles le guen charlesleg...@gmail.com wrote:

 for eachIteration in pm.selected():
pm.mel.eval('MakeCurvesDynamic')

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] MPxCommand undoIt()

2011-11-18 Thread Justin Israel
Hey Andre,

This quick test seems to work fine for me:
http://pastebin.com/t0YM4rmq

It successfully prints as it enters each method as expected.
Maybe you could compare it to how your code is arranged?

-- justin



On Nov 18, 2011, at 2:02 AM, André Adam wrote:

 Hi!
 
 I have written some MPxCommands and would like to implement undo
 functionality. I think I have done things right so far, I used doIt()
 to collect data and store it to the class, and I implemented the
 actual workload in redoIt(), using only the stored data sets.
 
 Now, with
 
 def isUndoable(self):
  return True
 
 I think Maya should trigger my
 
 def undoIt(self):
  print 'Hello!'
 
 when pressing z after the command was excecuted. Unfortunately, this
 does not work, my undoIt() function is not called. I have queried
 isUndoable from the doIt() function, and it returns True, so undoIt()
 should be triggered, no?
 
 Any hint would be greaty appreciated, cheers!
 
 -André
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] How to embed a modelPanel into a Qt Layout

2011-11-20 Thread Justin Israel
Hah, ya I had a feeling.
Now that I am home, I was able to write out an example:

https://gist.github.com/1381489

Its more complicated because you have to use sip and the MQtUtil function to 
translate between maya node paths, and QObjects/QWidgets
Here is what the script is doing:

1. Create the layout in PyQt
2. Unwrap it from python into a pointer using sip
3. use the pointer to get the full maya node path
4. set it as the UI parent

Then you create the model panel using the commands module
1. Get a pointer to the underlying widget of the model panel
2. wrap that into a python QObject using sip
3. Add that new object into your layout.

I also added a repaint in the show() method for the QDialog because maya likes 
to really lag in repainting its interface sometimes, so you wouldnt see the 
camera redrawn until you interacted with it otherwise.

Let me know if any of that example is unclear. Maybe there is a better way to 
do this, but this way works fine.

-- justin



On Nov 20, 2011, at 6:18 PM, 张宇 wrote:

 Thanks for your reply Justin, I am using pyqt not just the qtDesigner, how to 
 do that with pyqt?
 
 Http://zhangyu.me
 
 在 2011-11-21,4:38,Justin Israel justinisr...@gmail.com 写道:
 
 Hey there,
 
 You didn't specify if you were actually using PyQt or not. I'm going to 
 assume you want to just use Qt Designer,
 and then be able to add your modelPanel to the window. There really isnt 
 much different from creating this purely in the maya ui commands.
 
 win = cmds.loadUI(f=windowTest.ui)
 cmds.setParent(win)
 cmds.paneLayout()
 m = cmds.modelPanel()
 cmds.modelPanel(m, e=True, cam=myCamera)
 cmds.showWindow( win )
 cmds.refresh(f=True)
 
 In my windowTest.ui file, I simply created a dialog with nothing in it. 
 And I have a camera in my scene called myCamera
 Sometimes the new maya ui kinda lags in refreshing itself, so you would have 
 to interact with the new dialog sometimes to
 get the camera to redraw. 
 
 Are you trying to do this via PyQt? That would have a few more steps since 
 you need to translate between maya node paths and actual Qt widgets.
 
 -- justin
 
 
 
 On Nov 20, 2011, at 9:08 AM, 宇 wrote:
 
 I want to embed a maya's modelPanel to a Qt's Layout, but i don't know
 how?
 I just know you can create a window and layouts in QtDesigner and
 create the buttons or other controls with coding by PyQt.
 But if i want to create a modelPanel with my own camera embed to the
 widow created by qt, how?
 My english is not good, if you know what i mean, please give me an
 answer .
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] How to embed a modelPanel into a Qt Layout

2011-11-20 Thread Justin Israel
@Panupat
Actually, no I don't go into this specifically in my PyQt chapter. You do 
however see the example of how to use sip and MQtUtil to get the reference to 
the Maya MainWindow. I was trying really hard not to cross a certain threshold 
of difficulty in my examples for that video,  not to mention that the PyQt 
section was considered a bonus chapter. I would love to make another video 
completely dedicated to PyQt at some point and spend much more time on the 
finer details.

@Kurian
Thats pretty strange. Its complaining that a QDialog doesn't want to accept a 
'parent' argument in its init.
Out of curiosity, what version of PyQt are you using?   

from PyQt4 import QtCore; print QtCore.PYQT_VERSION_STR

And this is for Maya 2012? 
I updated the example to not pass in the parent by keyword, but rather by just 
the 1st argument:

Line 14:super(MyDialog, self).__init__(parent, **kwargs)

See if that makes a difference for you? It still seems strange to me. Even Qt 
4.5.x (which is the version maya 2011 uses) accepts that form of an __init__ 
signature.

Interested to know if that small change fixes your problem.

-- justin




On Nov 20, 2011, at 9:20 PM, Kurian O.S wrote:

 Hi Justin,
 
 thanks for the example man , this is so cool and when I try to run , I got 
 this
 
 # Error: 'parent' is not a Qt property or a signal
 # Traceback (most recent call last):
 # File maya console, line 9, in module
 # File maya console, line 14, in __init__
 # AttributeError: 'parent' is not a Qt property or a signal #
 
 any idea ? 
 
 On Mon, Nov 21, 2011 at 9:45 AM, Panupat Chongstitwattana 
 panup...@gmail.com wrote:
 Wow Justin. Thanks for showing us that example. It's great reference.
 Do you cover that in your cmiVFX tutorial too?
 
 Panupat C.
 
 On Mon, Nov 21, 2011 at 10:07 AM, Justin Israel justinisr...@gmail.com 
 wrote:
  Hah, ya I had a feeling.
  Now that I am home, I was able to write out an example:
  https://gist.github.com/1381489
  Its more complicated because you have to use sip and the MQtUtil function to
  translate between maya node paths, and QObjects/QWidgets
  Here is what the script is doing:
  1. Create the layout in PyQt
  2. Unwrap it from python into a pointer using sip
  3. use the pointer to get the full maya node path
  4. set it as the UI parent
  Then you create the model panel using the commands module
  1. Get a pointer to the underlying widget of the model panel
  2. wrap that into a python QObject using sip
  3. Add that new object into your layout.
  I also added a repaint in the show() method for the QDialog because maya
  likes to really lag in repainting its interface sometimes, so you wouldnt
  see the camera redrawn until you interacted with it otherwise.
  Let me know if any of that example is unclear. Maybe there is a better way
  to do this, but this way works fine.
  -- justin
 
 
  On Nov 20, 2011, at 6:18 PM, 张宇 wrote:
 
  Thanks for your reply Justin, I am using pyqt not just the qtDesigner, how
  to do that with pyqt?
 
  Http://zhangyu.me
 
  在 2011-11-21,4:38,Justin Israel justinisr...@gmail.com 写道:
 
  Hey there,
 
  You didn't specify if you were actually using PyQt or not. I'm going to
  assume you want to just use Qt Designer,
 
  and then be able to add your modelPanel to the window. There really isnt
  much different from creating this purely in the maya ui commands.
 
  win = cmds.loadUI(f=windowTest.ui)
 
  cmds.setParent(win)
 
  cmds.paneLayout()
 
  m = cmds.modelPanel()
 
  cmds.modelPanel(m, e=True, cam=myCamera)
 
  cmds.showWindow( win )
 
  cmds.refresh(f=True)
 
  In my windowTest.ui file, I simply created a dialog with nothing in it.
  And I have a camera in my scene called myCamera
 
  Sometimes the new maya ui kinda lags in refreshing itself, so you would have
  to interact with the new dialog sometimes to
 
  get the camera to redraw.
 
  Are you trying to do this via PyQt? That would have a few more steps since
  you need to translate between maya node paths and actual Qt widgets.
 
  -- justin
 
 
 
  On Nov 20, 2011, at 9:08 AM, 宇 wrote:
 
  I want to embed a maya's modelPanel to a Qt's Layout, but i don't know
 
  how?
 
  I just know you can create a window and layouts in QtDesigner and
 
  create the buttons or other controls with coding by PyQt.
 
  But if i want to create a modelPanel with my own camera embed to the
 
  widow created by qt, how?
 
  My english is not good, if you know what i mean, please give me an
 
  answer .
 
  --
 
  view archives: http://groups.google.com/group/python_inside_maya
 
  change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 
  --
 
  view archives: http://groups.google.com/group/python_inside_maya
 
  change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings:
  http://groups.google.com/group

Re: [Maya-Python] Can't import modules - Maya on Linux

2011-11-20 Thread Justin Israel
That error wouldnt be coming from the importing of standard python modules like 
os or sys or math. Its complaining about that 'String:Joint_Grp' being an 
invalid argument to someother command. Is that the complete traceback error you 
got?
And stupid question... But... That object does exist with a String namespace?



On Nov 20, 2011, at 11:11 PM, Panupat Chongstitwattana panup...@gmail.com 
wrote:

 Hi Everyone.
 
 So far I've been using Maya on Windows to learn Python. Today I tried
 to run some scripts on Linux and got this error
 
 import os
 # Error: TypeError: Object String:Joint_Grp is invalid #
 cmds.lockNode( 'String:Joint_Grp', lock=False )
 cmds.lockNode( 'String:Curve_Grp', lock=False )
 cmds.lockNode( 'String:Surface_Grp', lock=False )
 cmds.lockNode( 'String:Locator_Grp', lock=False )
 cmds.lockNode( 'String:IkHandle_Grp', lock=False )
 cmds.lockNode( 'String:Cluster_Grp', lock=False )
 
 Maya 2011 x64 running on Fedora 14.
 
 Any idea what this error is? I'm getting this same error with anything
 I'm trying to import - sys, math, etc.
 
 Panupat C.
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] How to embed a modelPanel into a Qt Layout

2011-11-21 Thread Justin Israel
Ok great. Thats good to know. Pyqt 4.6 is slightly older than the maya 2011 
docs even suggest (they recommend 4.7.3) so as Jo pointed out in his link its 
probably a keyword arg compatibility issue. 




On Nov 20, 2011, at 11:56 PM, Kurian O.S kuria...@gmail.com wrote:

 Yeah Justin thats what the issue , i updated with code like this 
 
 def __init__(self, parent=None, **kwargs):
 super(MyDialog, self).__init__(parent, **kwargs)
 
 then its working and I am using 4.6
 
 On Mon, Nov 21, 2011 at 1:08 PM, jo benayoun jobenay...@gmail.com wrote:
 Hi Justin,
 
 Actually, I just wrote the function from scratch. Didn't try your 
 implementation. Did it now. It works fine, for me on 2012 (don't have 2011 
 too).
 To be sure my code always run, I call baseclasses with the oldstyle and never 
 make a use of keyword args (to be compatible with older versions of sip).
 The super call was mainly designed to resolve baseclasses conflicts in a 
 multiple inheritance case and bringing more features to the metaclass concept.
 I make a cast to QWidget, since this is something I probably do in cpp.
 
 http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/keyword_arguments.html
 
 jo
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 --:: Kurian ::--
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Testing a QInputDialog with QTest

2011-11-22 Thread Justin Israel
How are you calling you QInputDialog?
My guess is that you are using the static convenience methods (or exec_) which 
cause your dialog to become modal, and thus block the main application.
What you probably want to do is:

self.d = QInputDialog(self)
self.d.setModal(False)
self.d.show()

At this point you can either decide to set a connection to a slot to handle 
when the window is closed,
or subclass it and overload your own accept() method.

# setting a connection
self.d.accepted.connect(handleInputMethod)

def handleInputMethod(self):
print self.d.textValue()

The static methods are good for when you don't need any special access or 
functionality from the dialog, as it creates it behind the scenes, blocks, and 
just returns the value and whether it was accepted or rejected.




On Nov 22, 2011, at 8:53 AM, Erkan Özgür Yılmaz wrote:

 Hi everybody,
 
 I'm re-writing our asset management system with all its Qt interfaces, and 
 this time I used TDD practices. I'm stuck at testing QInputDialog. I can test 
 a lot of other UI elements (for example, to test if they are enabled or 
 showing the correct item etc.).
 
 The problem is when I create the dialog everything stops working and is 
 waiting for the UI to close. I've tried using threading an created a thread 
 to call the QInputDialog in and created another one to test it but because 
 there is no way to reach the dialog it self I can not test if it is shown and 
 has the correct data in it.
 
 So is there a way to reach the QInputDialog from the dialog it self?
 
 Thanks...
 
 E.Ozgur Yilmaz
 Lead Technical Director
 eoyilmaz.blogspot.com
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: Problem Executing Backburner from Python

2011-11-22 Thread Justin Israel
Unfortunately I dont have any experience with Backburner submissions, since I 
have never used it in a pipeline other than submitting to it from a gui.

Here is an example of a preRender script:

In file /network/path/to/myPreRender.mel:

global proc doStuff()
{
// all your preRender Stuff here
}

Then in your render command:
cmdjob -preRender source /network/path/to/myPreRender.mel; doStuff();

But from your latest information, it seems you have other problems as well, 
such as defining your frame ranges.
Since I again don't know much about backburner I will take a blind stab...

 Calling 'C:/Program Files/Autodesk/Maya2012/bin/Render  -s
 \Undefined -e \Undefined -of png -fnc name.#.ext -pad 3 -im ATR24 -r
 mr -cam audienceCam -alpha 0 -log z:/renderLogs/ATR24_log.txt -rd Z:

It seems like maybe your string formatting is not correct so it cant slot in 
your frame ranges. I assume %tp2 and %tp3
are to be replaced from within backburner, correct? Have you tried NOT escaping 
those parts in the string?

' cmdjob -jobName ' + jobName + params  + taskListFile + ' -taskName 1 ' \
+ mayaPath + ' -s %tp2  -e %tp3 ' + ' -of png -fnc name.#.ext -pad 3 -im ' \
+ imageName + ' -r mr -cam ' + renderCam + ' -alpha 0 ' + ' -log 
z:/renderLogs/ATR24_log.txt -rd ' \
+ destPath + scene2Render

From the looks of the error output, its retaining those backslashes. And I 
guess if you are seeing Undefined, that is
backburner not properly slotting in your ranges from whatever problem you are 
having with your tasklist definition.
That part I unfortunately cant offer any insight.



On Nov 22, 2011, at 10:22 AM, PixelMuncher wrote:

 Thanks for the reply.  I'm not a hardcore coder, could you give me an
 example of calling the proc from the prerender flag?
 Also, it was my assumption that 'numTasks' would tell Backburner to
 divide the whole job into X tasks, but that does not appear to be the
 case - it appears that my 'os'  command is causing BB to send the
 entire frame range with each task.
 Do you know the correct way to call it?
 I think I'm  close, but I don't know how to pass the start/end frames
 from the BB tasklist to the render job command.
 This is what I have:
 
 1) I created a tasklist in table form:
 ATRTaskList.tsk:
 frames1051-107010511070
 frames1071-109110711091
 frames1092-111210921112
 
 2) Create vars for render params
 jobName = 'ATR24'
 # params = r' -manager 192.168.2.222 -logPath z:/renderLogs -
 priority 50 -tp_start 1 -tp_jump 3  -numTasks '
 params = r' -manager 192.168.2.222 -logPath z:/renderLogs -priority
 50 -taskList '
 taskListFile = 'D:/PFarm/_Software_stuff/Maya/Batch/
 ATR24BBTasklist.tsk'
 mayaPath = 'C:/Program Files/Autodesk/Maya2012/bin/Render
 imageName = 'ATR24'
 renderCam = 'audienceCam'
 
 destPath = r' Z:\Compositing\Sequences\ATR\ATR24_2'
 scene2Render = r' Z:\3D\scenes\is50anim24.mb'
 
 3) Render command:
 os.system (' cmdjob -jobName ' + jobName + params  + taskListFile + ' -
 taskName 1 ' + mayaPath + ' -s \%tp2  -e \%tp3 ' + ' -of png -fnc
 name.#.ext -pad 3 -im ' + imageName + ' -r mr -cam ' + renderCam + ' -
 alpha 0 ' + ' -log z:/renderLogs/ATR24_log.txt -rd ' + destPath +
 scene2Render )
 
 The 3 tasks show up in the BB Monitor, and I don't get any errors, but
 I don't get any frames either.  Here's what the job log shows:
 Calling 'C:/Program Files/Autodesk/Maya2012/bin/Render  -s
 \Undefined -e \Undefined -of png -fnc name.#.ext -pad 3 -im ATR24 -r
 mr -cam audienceCam -alpha 0 -log z:/renderLogs/ATR24_log.txt -rd Z:
 \Compositing\Sequences\ATR\ATR24_2 Z:\3D\scenes\is50anim24.mb' from 'C:
 \Users\Me\AppData\Local\backburner\ServerJob'Job exit successful
 
 I'm in a crunch, working by myself, so any help will be deeply
 appreciated.
 Thanks.
 
 On Nov 22, 10:19 am, Justin Israel justinisr...@gmail.com wrote:
 I havent had a chance to test anything yet but have you tried moving your 
 preRender commands into a script and just calling the proc from the 
 preRender flag? That way you can have any length prerender and it will get 
 called from the script. If the prerender code is not in a shared 
 maya_script_path location then u can just source the full path from the 
 preRender flag
 Unless your preRender is over 8k characters long then you wouldn't be 
 hitting an arg limit for the windows command line. And you are using a 
 string arg (though using inefficient string concatenation) for your 
 os.system() call so thats probably not an issue.
 If putting the preRender commands into a script fixes it then you know its 
 backburner/maya. We do the same thing at my studio for queue submissions 
 using preRender scripts in network locations and sourcing them.
 
 On Nov 21, 2011, at 10:36 PM, PixelMuncher pixeldr...@gmail.com wrote:
 
 
 
 
 
 
 
 After hours of research, I have backburner being called from a python
 script and rendering a test scene on 2 networked computers.
 
 However, when I try to run a production file that has a long

Re: [Maya-Python] Re: Problem Executing Backburner from Python

2011-11-22 Thread Justin Israel
Try taking a look at this method of formatting your command. Its a lot easier 
to handle all the quoting without escaping, and see exactly what command you 
are defining:

http://pastebin.com/2U2NCVkJ

Maybe this method might actually address your issue?


On Nov 22, 2011, at 11:11 AM, PixelMuncher wrote:

 Also, I did try surrounding my os cmd with quotes and escaped quotes.
 It doesn't like unescaped quotes at all.
 With escaped quotes, It sees the 2nd escaped quote as an attempt to
 create a line continuation.
 However, that may be all that's needed to get this working at this
 point:
 
 os.system (\ ' cmdjob -jobName ' + jobName + params  + taskListFile +
 ' -taskName 1 ' + mayaPath + ' -s ' + %tp2 + ' -e ' + %tp3 + ' -of png
 -fnc name.#.ext -pad 3 -im ' + imageName + ' -r mr -cam ' + renderCam
 + ' -alpha 0 ' + ' -log z:/renderLogs/ATR24_log.txt -rd ' + destPath +
 scene2Render \)
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] component selection using python

2011-11-26 Thread Justin Israel
Hi Reza,

The range() function accepts a 3rd parameter that defines the step amount.
Here is an example using
the commands module


selectBy = 2

total = len(cmds.getAttr(pSphere1.vtx[:]))

for i in xrange(0, total, selectBy):

cmds.select('pSphere1.vtx[%d]' % i, add=True)


Hope that helps!



On Sat, Nov 26, 2011 at 1:28 PM, Reza Shahsavary r.shahsav...@gmail.comwrote:

 Hi All.
 I`d like to select component(Verts/Edge/Face)by skip one using python
 commands.
 could u assist me?
 thx
 Reza

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] component selection using python

2011-11-27 Thread Justin Israel
Thanks. I am quite lovely aren't I? LOL

Here is a rough example that I thought of, using python commands and assuming a 
start and end selection
https://gist.github.com/1398060

I don't really check the original selection to see if its only two vertices or 
faces, but this should give you an idea. Hopefully I didn't over-think your 
problem.
I used a regex to get the int vert/face number instead of using the maya api 
since that approach seems like too much code just to get the index from the 
selection:

import maya.OpenMaya as api

sel = api.MSelectionList()
api.MGlobal.getActiveSelectionList(sel)
compIter = api.MItSelectionList(sel, api.MFn.kMeshVertComponent)

component = api.MObject()
meshDagPath = api.MDagPath()

vList = []
while not compIter.isDone():
compIter.getDagPath(meshDagPath, component)
if not component.isNull():
vertIter = api.MItMeshVertex(meshDagPath, component)
while not vertIter.isDone():
vList.append(vertIter.index())
vertIter.next()
compIter.next()

I may be a little slow from the holiday weekend and overlooked some easier way 
to do it. But thats as much as I can do with a bunch of turkey in my stomach :-)

-- justin


On Nov 27, 2011, at 4:57 AM, Reza Shahsavary wrote:

 thx Justin
 ur Lovely
 but 2 questions if u don't mind!
 1.what should i do if want to select my component mesh without typing surface 
 name i.g :p.sphere..i`d like to do that with selection mesh
 2.i just need to select my components in one direction(horizontal or vertical)
 thx
 P.M:i just uploaded a photo from maya.i need to selection like that.actually 
 its selected by hand :)
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 my selection.jpg

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] line error display and command completion

2011-12-02 Thread Justin Israel
In the script editor, make sure you have History-Line NUmbers in Errors   and 
History-Show Stack Trace enabled
You should be able to see the line number in the code where the error occurred.

Command completion is activated by typing something and hitting ctrl+spacebar

-- justin


On Dec 2, 2011, at 5:15 AM, rudi wrote:

 Hi
 How could I know where the error is happening in a fast way. For
 instance, when I get maya node error I have to execute line by line
 until I get the error to know in which line it is happening. No way to
 know directly the line?
 Also, how do you use the command completion. I have activate the
 checkbox but nothing happens. Should I do something else?
 Thanks
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] pyqt button menus with designer

2011-12-02 Thread Justin Israel
Though this approach would make it a Menu button, activated from a normal
left click.


On Fri, Dec 2, 2011 at 1:53 PM, David Moulder da...@thirstydevil.co.ukwrote:

 Alternatively you could try


1.  QMenu http://doc.qt.nokia.com/latest/qmenu.html *menu = new 
 QMenuhttp://doc.qt.nokia.com/latest/qmenu.html
(this);
2.  menu-addAction(Testa);
3.  menu-addAction(Test1);
4.  menu-addAction(Test2);
5.
6.  pushButton-setMenu(menu);


 On Fri, Dec 2, 2011 at 9:47 PM, David Moulder da...@thirstydevil.co.ukwrote:

 I'm not at python console to test this but from memory you need to set
 the contextMenu property and then hook up the signal to slot to show your
 menu.

 Qt::ContextMenuPolicyhttp://doc.qt.nokia.com/latest/qt.html#ContextMenuPolicy-enum


 and

  
 customContextMenuRequestedhttp://doc.qt.nokia.com/latest/qwidget.html#customContextMenuRequested


 Good luck.

 -Dave

 On Fri, Dec 2, 2011 at 9:13 PM, notanymike notanym...@gmail.com wrote:

 How can one make a drop-down command menu appear when right-clicking
 on a button in a Maya window using pyqt?

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe




 --
 David Moulder
 http://www.google.com/profiles/squish3d




 --
 David Moulder
 http://www.google.com/profiles/squish3d

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Best place for workspace.mel

2011-12-04 Thread Justin Israel
I would say that if you need per shot scene locations then you would want one 
in each shot level. Because then you would be using the workspace.mel to define 
the environment per shot. 
You might even consider having Project_name be a root workspace that define the 
asset location and other global locations, and then have each sequence or shot 
also be workspaces and then use the baseWorkspace setting of the workspace 
command to inherit. Im not sure if workspaces can be chained or not. Haven't 
tested. Maybe each workspace can first call baseWorkspace on its parent.   


On Dec 4, 2011, at 3:11 AM, Erkan Ozgur Yilmaz eoyil...@gmail.com wrote:

 In a project, where the folder structure is like:
 
 Project_ Name/
Assets/
Asset_Name/
Model/
Rig/
...
etc.
Sequences/
Seq_Name/
Shots/
SH001/
Fx/
Lighting/
etc.
SH002/
Fx/
Lighting/
etc.
...
 
 What is the best place to place the workspace.mel, should I have only one 
 under the project root, or should I have one for every shot and asset?
 
 What do you think?
 
 E. Ozgur Yilmaz
 Lead Technical Director
 Imaj Animation  VFX Studios
 www.imajonline.com
 eoyilmaz.blogspot.com
 
 Sent from my iPad
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: pyqt button menus with designer

2011-12-07 Thread Justin Israel
Your QDialog has a function called mapToGlobal(), which is inherits because
its a subclass of QWidget.
mapToGlobal takes a point that is local to the current object and remaps it
to the global position.

When your button calls that custom context menu slot, popup(), it passes it
the position (point) of where the
click occurred, so that you can popup your menu at that point.
Your menu has a method called exec_(), which will show the popup, start an
event loop, and block until the popup is done.
QMenu.exec_() takes a point as an argument of where to show the popup, so
we pass that global position into it.
exec_() will end once the popup closes.



On Wed, Dec 7, 2011 at 1:37 PM, notanymike notanym...@gmail.com wrote:

 Yeah, I'm still unclear as to what's happening in the popup() function
 of the code. Specifically:

 action = menu.exec_(self.mapToGlobal(pos))

 I'm guessing it's just executing or generating the menu, but the extra
 _(self.mapToGlobal(pos)) I'm not sure how to use elsewhere...


 On Dec 6, 9:55 pm, Justin Israel justinisr...@gmail.com wrote:
  You are making a simple dialog that only contains a pushbutton that is
 added to a vertical layout. You set the context menu option to use a custom
 menu instead of performing its own default action. And you connect a signal
 that is emitted when your right click the button to a custom slot that
 creates a popup menu and shows it.
  Was there a specific area of the code you wanted more details about?
 
  On Dec 6, 2011, at 9:13 PM, notanymike notanym...@gmail.com wrote:
 
 
 
 
 
 
 
   I found a couple of tutorials and merged them and that seemed to work,
   though I still don't know how its working. Could anyone care to
   explain:
 
   import sip
   import maya.cmds as cmds
   import maya.OpenMayaUI as mui
   from PyQt4.QtCore import *
   from PyQt4.QtGui import *
 
   def getMayaWindow():
  ptr = mui.MQtUtil.mainWindow()
  return sip.wrapinstance(long(ptr), QObject)
 
   class Form(QDialog):
 
  def __init__(self, parent=None):
  super(Form, self).__init__(parent)
  self.setObjectName('mainUI')
  self.mainLayout = QVBoxLayout(self)
  self.myButton = QPushButton('myButton')
  self.myButton.setContextMenuPolicy(Qt.CustomContextMenu)
  self.myButton.customContextMenuRequested.connect(self.popup)
  self.myButton.clicked.connect(self.selectJoint)
  self.mainLayout.addWidget(self.myButton)
 
  def popup(self, pos):
  #for i in self.tv.selectionModel().selection().indexes():
  #print i.row(), i.column()
  menu = QMenu()
  jointAction = menu.addAction(This is an action)
  action = menu.exec_(self.mapToGlobal(pos))
  if action == jointAction:
  self.myjoint = cmds.joint()
 
  def selectJoint(self):
  cmds.select(self.myjoint)
 
   global app
   global form
   app = qApp
   form = Form(getMayaWindow())
   form.show()
 
   On Dec 2, 1:57 pm, Justin Israel justinisr...@gmail.com wrote:
   Though this approach would make it a Menu button, activated from a
 normal
   left click.
 
   On Fri, Dec 2, 2011 at 1:53 PM, David Moulder 
 da...@thirstydevil.co.ukwrote:
 
   Alternatively you could try
 
  1.  QMenu http://doc.qt.nokia.com/latest/qmenu.html *menu =
 new QMenuhttp://doc.qt.nokia.com/latest/qmenu.html
  (this);
  2.  menu-addAction(Testa);
  3.  menu-addAction(Test1);
  4.  menu-addAction(Test2);
  5.
  6.  pushButton-setMenu(menu);
 
   On Fri, Dec 2, 2011 at 9:47 PM, David Moulder 
 da...@thirstydevil.co.ukwrote:
 
   I'm not at python console to test this but from memory you need to
 set
   the contextMenu property and then hook up the signal to slot to
 show your
   menu.
 
   Qt::ContextMenuPolicy
 http://doc.qt.nokia.com/latest/qt.html#ContextMenuPolicy-enum
 
   and
 
customContextMenuRequested
 http://doc.qt.nokia.com/latest/qwidget.html#customContextMenuRequested
 
   Good luck.
 
   -Dave
 
   On Fri, Dec 2, 2011 at 9:13 PM, notanymike notanym...@gmail.com
 wrote:
 
   How can one make a drop-down command menu appear when
 right-clicking
   on a button in a Maya window using pyqt?
 
   --
   view archives:http://groups.google.com/group/python_inside_maya
   change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 
   --
   David Moulder
  http://www.google.com/profiles/squish3d
 
   --
   David Moulder
  http://www.google.com/profiles/squish3d
 
   --
   view archives:http://groups.google.com/group/python_inside_maya
   change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 
   --
   view archives:http://groups.google.com/group/python_inside_maya
   change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http

Re: [Maya-Python] Animated Rigid Bodies Starting at Intervals - Will Pay for Sample Script

2011-12-08 Thread Justin Israel
Hey,

What actions specifically should the script perform and what parameters does it 
need to expose to you?
Im not a maya artist specifically im a pipeline developer so i dont always know 
every aspect of maya such as doing rbd very thoroughly but the artists always 
show me what they need to accomplish in order for me to produce tools. 
A sample scene and some specifics is usually all i need

- justin


On Dec 8, 2011, at 11:47 AM, Nick Scholtes airc...@gmail.com wrote:

 Is anyone interested in this? It would be a pretty easy buck! 
 
 Nick
 
 
 
 On Mon, Dec 5, 2011 at 10:42 AM, Nick Scholtes airc...@gmail.com wrote:
 Hi,
 
 Well, if needs to be done with over 1000 objects, which is why they are 
 scripting it. The other artist knows some python, but not a ton, and I know 
 even less.
 
 We need to adjust which object collides with another object. i.e., Obj A 
 cannot interact with Obj B and C but does collide with Obj E, F and G. Plus, 
 the visibility has to be keyed off and on a lot. 
 
 Would you be able to do a sample script if I got you some basic parameters? I 
 can see how much the artist can pay.
 
 Thanks for your reply,
 Nick
 
 
 
 On Mon, Dec 5, 2011 at 10:39 AM, stephenkmann stephenkm...@gmail.com wrote:
 You should be able to just animated / key the active/passive state of each 
 object.
 
 a simple randomize or even key directly script would do that
 
 hth
 
 -=s
 
 On Mon, Dec 5, 2011 at 11:34 AM, Nick Scholtes airc...@gmail.com wrote:
 Hi all,
 
 I have been trying to get assistance from a number of places with this, but 
 no luck. I'm working with someone on this and we REALLY need to get this 
 figured out. We can pay a small fee for help. I'm working w/ another artist 
 on this. Here's lowdown:
 
 I'm trying to animate 5 rigid bodies that appear and interact/collide at 
 different intervals. I'm working with someone on this, trying to help them 
 and I've suggested animating the rigid bodies on/off, collision layers and a 
 few other options. But it needs to be done w/ python. How would I do this? 
 Here's some more info, from the artist:
 I am able to have bodies fall and make contact with other bodies. That is 
 working well. What I haven’t been able to do is sequence the falling bodies 
 to start at different times. Either by starting a dynamics run, stop it, add 
 another rigid body and start it again or by placing all the bodies and 
 holding them in place until I need them during the run.
 I need to create a simple script to drop a ball on a flat plate and then 
 drop another ball on to the same flat plate 1 second later. But I need to 
 keyframe the transparency, Rigid Body Active on/off, Collision Layers, and 
 several other Channel Box parameters. One ball falls, then later the second 
 one appears, and falls. Eventually there would be 5 objects doing this, and 
 selectively interact only certain objects.
 
 They need to do this with 1000 objects so they will need to script it. ANY 
 help to just get started with the first couple would be greatly appreciated!
 
 Again, we can pay. I'm not sure how much but I'm pretty sure this would be 
 quick work for someone versed in Python and Maya.
 
 Thanks,
 Nick
 
 -- 
 My Photo Profile: 
 http://www.guru.com/freelancers/carbonorchards
 
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 stephenkm...@gmail.com
 http://smannimation.blogspot.com/
 http://nymayausersgroup.blogspot.com/
 http://smann3d.blogspot.com/
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 My Photo Profile: 
 http://www.guru.com/freelancers/carbonorchards
 
 
 
 
 
 
 -- 
 My Photo Profile: 
 http://www.guru.com/freelancers/carbonorchards
 
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] mel.eval troubles

2011-12-22 Thread Justin Israel
Are you able to post the specific error? Did it give you any more information 
that what you provided?
Also, is there any reason you cant do it from python?

On Dec 22, 2011, at 2:17 PM, Sebastian Schoellhammer wrote:

 Hello,
 
 I have a weird problem with mel.eval
 
 import maya.mel as mel
 mel.eval('setAttr -s 2 polySphere2_subdivisionsAxis.ktv[0:1] 1 18 5 18;')
 mel.eval('setAttr polySphere2_subdivisionsAxis.i 5;')
 
 The first one is giving me a syntax error, the second works fine.
 Both work when I copy the exact string into a mel console. 
 Is there some funky character conversion going on? 
 
 Hum, any hints are greatly appreciated!
 
 Thanks,
 Seb
 
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] mel.eval troubles

2011-12-24 Thread Justin Israel
Just for my own understanding, could you explain why python is not an option 
for your problem when you are calling out from it to mel commands?
What specifically requires that you do a mel.eval() from a python environment? 
I must be missing something :-)

If one liner keyframe range setting is what you needed, here are some 
interesting python one-liners:

Value is the same: (this is a 'duh' I'm sure, but just starting with it)
cmds.setKeyframe(polySphere2.sa, t=(1,5), v=18)

otherwise...

list comprehension:
_ = [cmds.setKeyframe(polySphere2.sa, t=k, v=v) for k,v in ktv = [(1,18), 
(5,18)]]

mapping:
_ = map(lambda x: cmds.setKeyframe(polySphere2.sa, t=x[0], v=x[1]), ktv = 
[(1,18), (5,18)])


-- justin



On Dec 24, 2011, at 4:49 PM, Sebastian Schoellhammer wrote:

 Hmpf, that is a bummer. 
 So the reason why I don't get an error when I execute in a mel console is 
 that it 'silently fails'?
 
 Bah and I thought I found a neat shortcut for my custom presets. I'm making 
 something that let's you store animation/expressions  as well and so needs to 
 create/change nodes. Those commands would have been a simple and general 
 solution if it weren't for that problem :/
 
 merry christmas! :)
 
 On Fri, Dec 23, 2011 at 9:11 PM, Nicolas Combecave zezebubulon...@gmail.com 
 wrote:
 You seem to want to set your keyframes all in one pass directly on the 
 animCurve, which seem to only be possible during file opening, di-uring io 
 operations.
 http://forums.cgsociety.org/archive/index.php/t-898721.html
 
 
 2011/12/23 Sebastian Schoellhammer sschoellhammer.li...@gmail.com
 No, sadly the only thing I get is syntax error and yes in this case 
 mel.eval would be by far the most convenient way.
 
 
 
 On Fri, Dec 23, 2011 at 1:52 PM, Justin Israel justinisr...@gmail.com wrote:
 Are you able to post the specific error? Did it give you any more information 
 that what you provided?
 Also, is there any reason you cant do it from python?
 
 On Dec 22, 2011, at 2:17 PM, Sebastian Schoellhammer wrote:
 
 Hello,
 
 I have a weird problem with mel.eval
 
 import maya.mel as mel
 mel.eval('setAttr -s 2 polySphere2_subdivisionsAxis.ktv[0:1] 1 18 5 18;')
 mel.eval('setAttr polySphere2_subdivisionsAxis.i 5;')
 
 The first one is giving me a syntax error, the second works fine.
 Both work when I copy the exact string into a mel console. 
 Is there some funky character conversion going on? 
 
 Hum, any hints are greatly appreciated!
 
 Thanks,
 Seb
 
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 Sebastian Schoellhammer
 
 Sr. Technical Artist
 Square Enix LTD
 www.square-enix.com
 
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 Sebastian Schoellhammer
 
 Sr. Technical Artist
 Square Enix LTD
 www.square-enix.com
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] mel.eval troubles

2011-12-25 Thread Justin Israel
Thanks. Thats what I needed to know :-)
Couldn't understand what specific problem you were trying to solve until now.



On Dec 25, 2011, at 12:21 AM, Sebastian Schoellhammer wrote:

 Sorry, I missed to explain something.
 
 To get changes on a node I use the 
 getSetAttrCmds function of MPlug on all its writeable attributes.
 
 (I suppose that is the same command that is called when a file is saved.)
 
 So that makes it convinient for me because I don't have to care about what 
 type of attribute it is, what data type etc. 
 All I need to store is the mel command the function above spits out and then 
 re-apply it later.
 
 But if *some* mel commands don't work apart from file openening time, this 
 all crumbles apart a bit. :/
 and I might have to do things properly after all.
 
 seb
 
 
 
 On Sun, Dec 25, 2011 at 3:33 PM, Justin Israel justinisr...@gmail.com wrote:
 Just for my own understanding, could you explain why python is not an option 
 for your problem when you are calling out from it to mel commands?
 What specifically requires that you do a mel.eval() from a python 
 environment? I must be missing something :-)
 
 If one liner keyframe range setting is what you needed, here are some 
 interesting python one-liners:
 
 Value is the same: (this is a 'duh' I'm sure, but just starting with it)
 cmds.setKeyframe(polySphere2.sa, t=(1,5), v=18)
 
 otherwise...
 
 list comprehension:
 _ = [cmds.setKeyframe(polySphere2.sa, t=k, v=v) for k,v in ktv = [(1,18), 
 (5,18)]]
 
 mapping:
 _ = map(lambda x: cmds.setKeyframe(polySphere2.sa, t=x[0], v=x[1]), ktv = 
 [(1,18), (5,18)])
 
 
 -- justin
 
 
 
 On Dec 24, 2011, at 4:49 PM, Sebastian Schoellhammer wrote:
 
 Hmpf, that is a bummer. 
 So the reason why I don't get an error when I execute in a mel console is 
 that it 'silently fails'?
 
 Bah and I thought I found a neat shortcut for my custom presets. I'm making 
 something that let's you store animation/expressions  as well and so needs 
 to create/change nodes. Those commands would have been a simple and general 
 solution if it weren't for that problem :/
 
 merry christmas! :)
 
 On Fri, Dec 23, 2011 at 9:11 PM, Nicolas Combecave 
 zezebubulon...@gmail.com wrote:
 You seem to want to set your keyframes all in one pass directly on the 
 animCurve, which seem to only be possible during file opening, di-uring io 
 operations.
 http://forums.cgsociety.org/archive/index.php/t-898721.html
 
 
 2011/12/23 Sebastian Schoellhammer sschoellhammer.li...@gmail.com
 No, sadly the only thing I get is syntax error and yes in this case 
 mel.eval would be by far the most convenient way.
 
 
 
 On Fri, Dec 23, 2011 at 1:52 PM, Justin Israel justinisr...@gmail.com 
 wrote:
 Are you able to post the specific error? Did it give you any more 
 information that what you provided?
 Also, is there any reason you cant do it from python?
 
 On Dec 22, 2011, at 2:17 PM, Sebastian Schoellhammer wrote:
 
 Hello,
 
 I have a weird problem with mel.eval
 
 import maya.mel as mel
 mel.eval('setAttr -s 2 polySphere2_subdivisionsAxis.ktv[0:1] 1 18 5 18;')
 mel.eval('setAttr polySphere2_subdivisionsAxis.i 5;')
 
 The first one is giving me a syntax error, the second works fine.
 Both work when I copy the exact string into a mel console. 
 Is there some funky character conversion going on? 
 
 Hum, any hints are greatly appreciated!
 
 Thanks,
 Seb
 
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 Sebastian Schoellhammer
 
 Sr. Technical Artist
 Square Enix LTD
 www.square-enix.com
 
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 Sebastian Schoellhammer
 
 Sr. Technical Artist
 Square Enix LTD
 www.square-enix.com
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 Sebastian Schoellhammer
 
 Sr. Technical Artist
 Square Enix LTD
 www.square-enix.com
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings

Re: [Maya-Python] find geometry with vertex count as condition?

2011-12-26 Thread Justin Israel
As far as I know, maya's database doesn't index all geometry vertex counts in a 
way that you can filter select on it. The API selection mechanism only lets you 
select on name patterns and then filter on type. And the python commands wrap 
around that to add more type filtering. 
I believe your only option is to loop over all geometry and do a 
polyEvaluate(v=True) on each one to test the vertex count, and then append to a 
list. A list comprehension would be the same speed as a multi-line for loop:

# list comp
matches = [geom for geom in cmds.ls(dag=True, g=True) if 
cmds.polyEvaluate(geom, v=True)  1000]

# same as normal loop 
matches = []
for geom in cmds.ls(dag=True, g=True):
if cmds.polyEvaluate(geom, v=True)  1000:
matches.append(geom)

This would also be slightly faster if you were to do it in the API because of 
the selection iterator.

Is this something where you need extremely low latency searches for queries 
happening constantly? Or were you just looking for a simpler way to do the 
query? Because if you needed a solution faster than looping over every single 
one, in the way thats similar to your SQL style query, you would need to index 
all the geometry yourself by vertex count into a dictionary. And then either 
manage it yourself each some geometry is modified or attach some kind of 
scriptJob to keep updating it. But Im not sure if thats even your goal. The SQL 
query just sorta made me think you needed fast queries that are indexed.


On Dec 26, 2011, at 4:32 AM, Panupat wrote:

 say I want to select geometries that have more than X amount of
 vertices. Using some kind of logic like this
 
 select geometry where vertex count  1
 
 Is this doable? I can think of a way to cycle through all geometries
 and check their vertices but wondering if there's a better way.
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] user login session with PyQt

2011-12-29 Thread Justin Israel
This is all overkill. I dont see why you need fancy 3rd party frameworks for a 
non http/web app. 
You wouldnt store the users login info locally. You would perform the auth 
against postgres or ldap or any type of server that has the users. If the user 
passes the auth you can use a QSettings instance in pyqt to store a persistent 
arbitrary amount of preferences for the user. At that point its up to you if 
you want to store simply a session key that can be used to check out the real 
prefs from postgres. And maybe that session key has a TTL so it can expire. Or 
not. That would be the closest to an http session i think. All these other 
frameworks are for http requests. But with your pyqt app you have a database 
driver talking live to postgres. There are no requests.  
QSettings creates appropriate property files for different operating systems in 
the right user location. I think it will solve your issue. 
The steps in a nutshell are:
User loads pyqt app
Load the QSettings object and check for a session key
If session key, is it still valid in db? If so, get prefs from db
If not, ask for user and password and validate on db. 
Generate a new session key and store in QSettings and prefs on db





On Dec 29, 2011, at 6:10 AM, Pierre A pierre.auge...@heroldfamily.biz wrote:

 I don't know exactly what you are trying to achieve, but when I see session 
 and python in the same sentence, beaker comes to mind.
 I've only used it with wsgi apps, but the doc says that it works with stand 
 alone applications.
 http://beaker.readthedocs.org/en/latest/index.html 
 
 For authentication and authorization, you could have a look at repoze.who ( 
 http://docs.repoze.org/who/2.0/ ), but it's aimed for wsgi applications.
 Perhaps you could hack it: 
 http://docs.repoze.org/who/2.0/use_cases.html#api-only-use-cases
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] pymel ui from shell

2011-12-30 Thread Justin Israel
Running gui commands requires that maya actually be running in gui mode, 
otherwise it has nothing to generate the dialogs under. That is.. gui commands 
dont work from mayapy

If you need a completely standalone app that uses maya, then you would in fact 
need to design a PyQt app that uses mayapy as its interpreter. I have a tool 
like this actually as part of our pipeline between the art department and the 
TDs. Its a gui that takes illustrator files and custom parses and creates the 
geometry, and then saves the scene files.




On Dec 30, 2011, at 11:53 AM, Murphy Randle wrote:

 Hi there! 
 I'm trying to figure out the lightest way to provide a simple GUI for some 
 production scripts. We've been having some problems with PyQt on the 
 workstations, so I thought I might just use maya's built in GUI 
 functionalities through pymel.
 
 The following code successfully makes and shows a new window when run from 
 within Maya:
 
 from pymel.core import *
 win = window()
 win.show()
 
 But if I run it from the command line, using the executable mayapy, the 
 function 
 window()
 Returns a boolean that is false. 
 
 Is it impossible to show a GUI dialogue from within mayapy?
 I'm running currently on Mac Os X 10 Lion. Maya 2012.
 The workstations are Redhat 5 with Maya 2012.
 
 
 Thanks!
 Murphy
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] pymel ui from shell

2011-12-30 Thread Justin Israel
Actually let me clarify..
My app doesn't actually directly start using mayapy as the interp. It uses a 
normal python interpreter but it calls out to a command line only tool which 
DOES use mayapy to do standalone maya commands

http://download.autodesk.com/global/docs/maya2012/en_us/PyMel/standalone.html

As far as I know, you can't actually run a pyqt app directly under maya 
standalone because I think the main thread blocks and doesn't process any 
events on your qt event loop... which kind of refers back to the whole 
pumpThread fix from pre maya 2010 days.

Though I think its a pretty simple approach to just design your UI completely 
separate in PyQt anyways. If you wanted to get fancier in being able to call 
out to your maya standalone process and didn't want to incur load times each 
time you run the command, I bet you could do something fun like starting up the 
tool right away in a separate process and communicate with it via interprocess 
communication  :-)

On Dec 30, 2011, at 12:06 PM, Murphy Randle wrote:

 Wow, That sounds really cool.
 Thanks for the input Justin!
 
 Bummer that it doesn't work.
 -Murphy
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] PyQt - how to check if UI is already running?

2012-01-09 Thread Justin Israel
Kurian, he is using maya 2010 before they rewrote it in qt. so I don't believe 
MQtUtil even exists. The pumpThread utility is what he needs. It creates a 
fakey event loop that keeps processing events from qt as they stack up and also 
takes care of the global qapp that will be shared. There is actually no global 
qapp being used by maya. 



On Jan 9, 2012, at 6:07 AM, Kurian O.S kuria...@gmail.com wrote:

 O otherwise you can try using this 
 
 import sip
 import maya.OpenMayaUI as mui
 from PyQt4.QtCore import *
 from PyQt4.QtQtGui import *
 
 def getMayaWindow():
 ptr = mui.MQtUtil.mainWindow()
 return sip.wrapinstance(long(ptr), QObject)
 
 class Form(QDialog):
 def __init__(self, parent=None):
 super(Form, self).__init__(parent)
 self.setObjectName('mainUI')
 self.mainLayout = QVBoxLayout(self)
 self.myButton = QPushButton('myButton')
 self.mainLayout.addWidget(self.myButton)
 
 global app
 global form
 app = qApp
 form = Form(getMayaWindow())
 form.show()
 
 PS :  PyQt4.QtCore import * is not really a good idea at all.
 
 On Mon, Jan 9, 2012 at 9:01 AM, Panupat Chongstitwattana panup...@gmail.com 
 wrote:
 David - does pumpThread come with Maya 2010?
 
 I'll try it out once I get to my studio tomorrow, thanks :)
 
 
 
 On Mon, Jan 9, 2012 at 7:57 PM, David Moulder da...@thirstydevil.co.uk 
 wrote:
 You are using pumpThread right?
 
 If so you shouldn't do sys.exit(app.exec_())
 
 just myapp.show()
 
 If your not using pumpThread you have to in Maya 2010.
 
 You can find pumpThread in the sdk folder.  From memory you need to import it 
 and initialize it before any Qt Gui is created.
 
 import pumpThread as pt
 pt.initializePumpThread()
 
 -Dave
 
 
 On Mon, Jan 9, 2012 at 12:31 PM, Panupat Chongstitwattana 
 panup...@gmail.com wrote:
 Kamil
 
 The UI class is Ui_AddPlayblast.py. The set title line looks like this
 
 AddPlayblast.setWindowTitle(QtGui.QApplication.translate(AddPlayblast, 
 Manual Add Playblast, None, QtGui.QApplication.UnicodeUTF8))
 
 I tried using both AddPlayblast and Manual Add Playblast to no avail. Is 
 there anything else I should try?
 
 
 Kurian - the UI script will be run exclusively in Maya. As I understand, the 
 __name__ = __main__ only works if you run the py file directly? Initally I'm 
 launching the UI with these commands
 
 app = QtGui.QApplication(sys.argv)
 myapp = AddPlayblast()
 myapp.show()
 sys.exit(app.exec_())
 
 I tested it out in another function, and it is this line that freezes Maya
 
 myapp = AddPlayblast()
 
 
 best regard,
 Panupat C.
 
 
 On Mon, Jan 9, 2012 at 7:04 PM, Kurian O.S kuria...@gmail.com wrote:
 you can use 
 
 class MyApp (QApplication):
  
 
 if __name__ == '__main__':
 app = MyApp( sys.argv)
 if app.isRunning():
 ... do whatevr u want
 
 
 On Mon, Jan 9, 2012 at 5:30 PM, Ricardo Viana cgolhei...@gmail.com wrote:
 Humm. It should. Check you have your naming right on the .ui for window 
 widget.
 
 Best regards
 Ricardo Viana
 
 On Jan 9, 2012, at 11:56 AM, Panupat Chongstitwattana panup...@gmail.com 
 wrote:
 
 Hi Kamil.
 
 Thanks for suggestion. But the cmds deleteUI/window modules can't seem to 
 detect the PyQt window's titles :(
  
 
 On Mon, Jan 9, 2012 at 5:31 PM, Kamil Hepner hektor1...@gmail.com wrote:
 It's very simple:
 
 
 winName = myWindow
 if pm.windows.window(winName, exists=True):
pm.windows.deleteUI(winName)
 
 
 2012/1/9 Panupat Chongstitwattana panup...@gmail.com
 In Maya 2010, if I run the script to start a UI that is already running, it 
 would crash Maya D: How can I check if the UI is already running and close 
 it?
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 --:: Kurian ::--
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 David Moulder
 http://www.google.com/profiles/squish3d
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 -- 
 view archives: 

Re: [Maya-Python] PyQt - how to check if UI is already running?

2012-01-09 Thread Justin Israel
It should be in the sdk directory and not in your path just yet. But if you 
cant find it:
http://code.google.com/p/svnformaya/source/browse/trunk/pumpThread.py?r=3



On Jan 9, 2012, at 8:14 AM, Justin Israel justinisr...@gmail.com wrote:

 Kurian, he is using maya 2010 before they rewrote it in qt. so I don't 
 believe MQtUtil even exists. The pumpThread utility is what he needs. It 
 creates a fakey event loop that keeps processing events from qt as they stack 
 up and also takes care of the global qapp that will be shared. There is 
 actually no global qapp being used by maya. 
 
 
 
 On Jan 9, 2012, at 6:07 AM, Kurian O.S kuria...@gmail.com wrote:
 
 O otherwise you can try using this 
 
 import sip
 import maya.OpenMayaUI as mui
 from PyQt4.QtCore import *
 from PyQt4.QtQtGui import *
 
 def getMayaWindow():
 ptr = mui.MQtUtil.mainWindow()
 return sip.wrapinstance(long(ptr), QObject)
 
 class Form(QDialog):
 def __init__(self, parent=None):
 super(Form, self).__init__(parent)
 self.setObjectName('mainUI')
 self.mainLayout = QVBoxLayout(self)
 self.myButton = QPushButton('myButton')
 self.mainLayout.addWidget(self.myButton)
 
 global app
 global form
 app = qApp
 form = Form(getMayaWindow())
 form.show()
 
 PS :  PyQt4.QtCore import * is not really a good idea at all.
 
 On Mon, Jan 9, 2012 at 9:01 AM, Panupat Chongstitwattana 
 panup...@gmail.com wrote:
 David - does pumpThread come with Maya 2010?
 
 I'll try it out once I get to my studio tomorrow, thanks :)
 
 
 
 On Mon, Jan 9, 2012 at 7:57 PM, David Moulder da...@thirstydevil.co.uk 
 wrote:
 You are using pumpThread right?
 
 If so you shouldn't do sys.exit(app.exec_())
 
 just myapp.show()
 
 If your not using pumpThread you have to in Maya 2010.
 
 You can find pumpThread in the sdk folder.  From memory you need to import 
 it and initialize it before any Qt Gui is created.
 
 import pumpThread as pt
 pt.initializePumpThread()
 
 -Dave
 
 
 On Mon, Jan 9, 2012 at 12:31 PM, Panupat Chongstitwattana 
 panup...@gmail.com wrote:
 Kamil
 
 The UI class is Ui_AddPlayblast.py. The set title line looks like this
 
 AddPlayblast.setWindowTitle(QtGui.QApplication.translate(AddPlayblast, 
 Manual Add Playblast, None, QtGui.QApplication.UnicodeUTF8))
 
 I tried using both AddPlayblast and Manual Add Playblast to no avail. Is 
 there anything else I should try?
 
 
 Kurian - the UI script will be run exclusively in Maya. As I understand, the 
 __name__ = __main__ only works if you run the py file directly? Initally I'm 
 launching the UI with these commands
 
 app = QtGui.QApplication(sys.argv)
 myapp = AddPlayblast()
 myapp.show()
 sys.exit(app.exec_())
 
 I tested it out in another function, and it is this line that freezes Maya
 
 myapp = AddPlayblast()
 
 
 best regard,
 Panupat C.
 
 
 On Mon, Jan 9, 2012 at 7:04 PM, Kurian O.S kuria...@gmail.com wrote:
 you can use 
 
 class MyApp (QApplication):
  
 
 if __name__ == '__main__':
 app = MyApp( sys.argv)
 if app.isRunning():
 ... do whatevr u want
 
 
 On Mon, Jan 9, 2012 at 5:30 PM, Ricardo Viana cgolhei...@gmail.com wrote:
 Humm. It should. Check you have your naming right on the .ui for window 
 widget.
 
 Best regards
 Ricardo Viana
 
 On Jan 9, 2012, at 11:56 AM, Panupat Chongstitwattana panup...@gmail.com 
 wrote:
 
 Hi Kamil.
 
 Thanks for suggestion. But the cmds deleteUI/window modules can't seem to 
 detect the PyQt window's titles :(
  
 
 On Mon, Jan 9, 2012 at 5:31 PM, Kamil Hepner hektor1...@gmail.com wrote:
 It's very simple:
 
 
 winName = myWindow
 if pm.windows.window(winName, exists=True):
pm.windows.deleteUI(winName)
 
 
 2012/1/9 Panupat Chongstitwattana panup...@gmail.com
 In Maya 2010, if I run the script to start a UI that is already running, it 
 would crash Maya D: How can I check if the UI is already running and close 
 it?
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 --:: Kurian ::--
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 David Moulder
 http

Re: [Maya-Python] Lead Java Developer/Developer

2012-01-18 Thread Justin Israel
Hey Mark, go easy on Surendra. After all, this person does represent A
CMMi Level 5 Company, with Level 1 intelligence.


On Wed, Jan 18, 2012 at 8:27 AM, Mark Tigges mtig...@gmail.com wrote:

 Why the fuck do you spam a python list for a job listing at all.  And
 a completely unrelated job listing.

 Fuck you, stop clogging peoples inboxes you douche bag.

 On Wed, Jan 18, 2012 at 7:43 AM, Java Lead Developer
 steve.bahw...@gmail.com wrote:
  Hi,
 
 
 
  I have a very urgent Direct Client requirement for Lead Java
  Developer/Developer. If you have any resources available kindly send me
  across at your earliest to surendr...@bahwancybertek.com
 
 
  Position: Java Developer
 
  Location:  Boston, MA and Stanford, CT
 
  Rate: DOE:
 
  Start Date: Mid Feb or End of Feb
 
  Contract Type: Long-term C2C
 
 
 
  Requirement Details:
 
  · Java - 5-7 years - Must have - Must have excellent skills - Sun
  certification preferred
 
  · Servlets and JSP/JSTL: 5-7 years - Must have excellent skills -
  Sun certification preferred
 
  · EJB 2.0 - Atleast 2 years
 
  · Spring framework: 2-3 years - Must have at least 1 year of
  experience
 
  · XSL/XPath/XSLT: Preferably 2-3 years, at least 1 year is a must
 
  · Javascript framework - preferably Mootools - Good to have
 
  · Cross browser HTML/CSS/javascript - at least 2 years
 
  · Domain:- banking
 
  · Oracle - writing /modifying PL/SQL queries, Stored procedures
 - At
  least 2 years of experience
 
  · Hibernate/iBatis - 1-2 years - good to have
 
  · Experience with Subversion, Eclipse, Ant - preferably 2+ years
 
  ·Excellent communication skills
 
 
 
  Best Regards,
 
 
 
  Surendra Babu
 
  Team – Talent Acquisition
 
  Bahwan CyberTek Inc
 
  A CMMi Level 5 Company
 
  Ph – 508-507-8340
 
  www.bahwancybertek.com
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python]is there a way to get Current Camera view name(trasnform node)?

2012-01-19 Thread Justin Israel
Kamil, you say that there are only advantages to using pymel? Are you
implying that pymel has no disadvantages? Wouldn't want to mislead a
newcomer to Maya python ;-)


On Thu, Jan 19, 2012 at 10:05 AM, stephenkmann stephenkm...@gmail.comwrote:

 I can see what you mean.. I still have tons to learn, thanks for the
 update!

 -=s



 On Thu, Jan 19, 2012 at 10:46 AM, Kamil Hepner hektor1...@gmail.comwrote:

 Pymel is more pythonic than cmds. Also pymel is object oriented. There
 are only adventages of using pymel istead of cmds. In this simple
 above example, you doesn't see it, I can write it strice in MEL, or
 maya cmds.

 But this example, should work in more OOP way:

 import pymel.core as pm

 # Get the panel
 pan = pm.getPanel(withFocus=True)
 # Name
 pan.getCamera()

 But I have a problem, because the getPanel(), allways return me
 ui.Panel objects, even when I use the all=True flag. It's strange
 becasue it should return the ui.ModelEditor object when I have
 viewport actived. I use the last version of pymel from git repo (1.0.4
 (8cfdc8c)



 2012/1/19, Stephen stephenkm...@gmail.com:
  I'm in the early steps of learning python in maya and was curious why
 you
  are using pymel for this , rather than just maya.cmds.
  (it's the exact same in maya.cmds)
  -s
 
  Sent from blackberry
 
  On Jan 19, 2012, at 7:53 AM, Kamil Hepner hektor1...@gmail.com wrote:
 
  Try this:
 
  import pymel.core as pm
 
  # Get the panel
  pan = pm.getPanel(withFocus=True)
 
  # Name
  print pm.windows.modelPanel(pan, query=True, camera=True)
 
 
  Should work.
  Cya!
 
  2012/1/10, deadparticle xar...@naver.com:
  i can hardly find infomation of this
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe




 --
 stephenkm...@gmail.com
 http://smannimation.blogspot.com/
 http://nymayausersgroup.blogspot.com/
 http://smann3d.blogspot.com/


  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python]is there a way to get Current Camera view name(trasnform node)?

2012-01-19 Thread Justin Israel
I cant agree more with ya, Judah. I acknowledge its extremely appealing to
start in with pymel for all the convenience it offers, and be allowed to
bypass the unpythonic nature of the cmds module. But it does come with a
price, and I'm sure that when you start using it, you would use it for
everything. Its far more beneficial to understand how the native commands
and API work, before you start committing yourself to a 3rd party library
that has to be maintained separately and kept in sync. When you have a bug
in your code, you have the chance of it being one layer higher, in the
pymel abstraction.

When I first saw pymel, a while back, I got really excited and started
using it in my code. But I quickly found that the performance hit was huge
for doing loops on anything. I also address this and show some benchmarks
in my Vol 1. cmivfx training video.

In a nutshell, its far better to get the fundamentals down cold, and then
know what your options are for solving different problems.


On Thu, Jan 19, 2012 at 11:16 AM, Judah Baron judah.ba...@gmail.com wrote:

 You ever hear that joke about the guy who goes into a saloon and is dying
 of thirst but has no money? He's told that if he takes a gulp from the
 spitoon he can get a drink for free. He's thirsty, so he puts the spitoon
 to his lips and takes a gulp - then another and another until the whole
 thing is gone. The people are horrified and say You only needed to take
 one gulp! He replies, I know, but it came all in one piece and I couldn't
 stop.

 Now I'm not saying pymel is a spitoon full of mucus, and mean no offense
 to its talented developers, but it's a funny joke and illustrates an
 important point: once you start using pymel it will be very difficult to
 stop due to the nature of its implementation. It's a slippery slope and the
 decision warrants some study and consideration.

 I would recommend that a new python user stick with cmds. Once you have
 some understanding of python and what Maya offers out of the box you can
 make a more informed decision.

 -Judah


 On Thu, Jan 19, 2012 at 10:56 AM, Kamil Hepner hektor1...@gmail.comwrote:

 Okey I'll be honest... :-) the pymel have disadventages. The biggest
 one is that pymel is slower than cmds. But I love it for his OOP
 structure. So yes, my previous post is misleading, sorry for that :-)

 2012/1/19, Justin Israel justinisr...@gmail.com:
  Kamil, you say that there are only advantages to using pymel? Are you
  implying that pymel has no disadvantages? Wouldn't want to mislead a
  newcomer to Maya python ;-)
 
 
  On Thu, Jan 19, 2012 at 10:05 AM, stephenkmann
  stephenkm...@gmail.comwrote:
 
  I can see what you mean.. I still have tons to learn, thanks for the
  update!
 
  -=s
 
 
 
  On Thu, Jan 19, 2012 at 10:46 AM, Kamil Hepner
  hektor1...@gmail.comwrote:
 
  Pymel is more pythonic than cmds. Also pymel is object oriented. There
  are only adventages of using pymel istead of cmds. In this simple
  above example, you doesn't see it, I can write it strice in MEL, or
  maya cmds.
 
  But this example, should work in more OOP way:
 
  import pymel.core as pm
 
  # Get the panel
  pan = pm.getPanel(withFocus=True)
  # Name
  pan.getCamera()
 
  But I have a problem, because the getPanel(), allways return me
  ui.Panel objects, even when I use the all=True flag. It's strange
  becasue it should return the ui.ModelEditor object when I have
  viewport actived. I use the last version of pymel from git repo (1.0.4
  (8cfdc8c)
 
 
 
  2012/1/19, Stephen stephenkm...@gmail.com:
   I'm in the early steps of learning python in maya and was curious
 why
  you
   are using pymel for this , rather than just maya.cmds.
   (it's the exact same in maya.cmds)
   -s
  
   Sent from blackberry
  
   On Jan 19, 2012, at 7:53 AM, Kamil Hepner hektor1...@gmail.com
 wrote:
  
   Try this:
  
   import pymel.core as pm
  
   # Get the panel
   pan = pm.getPanel(withFocus=True)
  
   # Name
   print pm.windows.modelPanel(pan, query=True, camera=True)
  
  
   Should work.
   Cya!
  
   2012/1/10, deadparticle xar...@naver.com:
   i can hardly find infomation of this
  
   --
   view archives: http://groups.google.com/group/python_inside_maya
   change your subscription settings:
   http://groups.google.com/group/python_inside_maya/subscribe
  
  
   --
   view archives: http://groups.google.com/group/python_inside_maya
   change your subscription settings:
   http://groups.google.com/group/python_inside_maya/subscribe
  
   --
   view archives: http://groups.google.com/group/python_inside_maya
   change your subscription settings:
   http://groups.google.com/group/python_inside_maya/subscribe
  
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 
  --
  stephenkm...@gmail.com
  http://smannimation.blogspot.com/
  http://nymayausersgroup.blogspot.com/
  http://smann3d.blogspot.com

Re: [Maya-Python] python __main__ class

2012-01-25 Thread Justin Israel
I think that __main__ would be a very strange and unpredictable place to
store shared data in your environment.
If what you are after is a globals module to share settings, you could try
something like this

## testConstants.py ##
BAR=foo

## testScriptA.py ##
import testConstants

print BAR=, testConstants.BAR
testConstants.BAR = blah
testConstants.FOO = bar

## testScriptB.py ##
import testConstants

print BAR=,testConstants.BAR
print FOO=,testConstants.FOO


# And when we try them out
 import testScriptA

BAR= foo


 import testScriptB

BAR= blah

FOO= bar



Because modules are only imported once, importing your constants module in
multiple scripts will all reference the same module. You can then access
all the objects within that module.




On Tue, Jan 24, 2012 at 3:45 AM, m.dresch...@bigpoint.net 
m.dresch...@bigpoint.net wrote:

 Hi,

 I have a question regarding the storage of data in Maya that should be
 available in all my python scripts.
 I found the __main__ class and added an (immutable) variable to it
 in the userSetup.py file.

 With this setup I can access the variable in all my scripts.
 Do some of you guys have experience with this? Is it ok to store data
 in __main__ or does it have implications
 I don't know?

 Thank you very much,

 cheers,

 --
 Malte Dreschert
 Senior Technical Artist @ Bigpoint

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] python __main__ class

2012-01-25 Thread Justin Israel
+1 on that, Judah.
Storing them in the __init__.py really does offer an excellent way to
organize by scope.


On Wed, Jan 25, 2012 at 2:03 PM, Judah Baron judah.ba...@gmail.com wrote:

 Additionally, and this might not apply to your situation until you have
 more of a system in place but, many of the constants that you might be
 interested in are best stored in some modular context. That is, you may
 have a number of settings that really belong in your export package, for
 instance. So instead of making them truely detached and global you can
 put them in your export __init__. When you need to retrieve this value it
 would then look something like the following:

 ## export.__init__

 PROCESSOR_EXE = someTool.exe


 -
 ## Any other implementation file

 import os
 import subprocess
 import parentPackage

 processorPath = os.path.join( toolPath,
 'bin', parentPackage.export.PROCESSOR_EXE )
 if os.path.exists(processorPath):
 subprocess.Popen( processorPath, *localArgs... )

 This will give your global variables/constants a meaningful scope. An
 added benefit of doing this is the completion provided in most  IDEs worth
 using. This may seem trivial, but it saves a lot of time when you have a
 large system of packages working together and lots of settings per package.

 For values that are not specific to a particular module, but are used by
 the system in general, you can put them in parentPackage, or an equivalent.

 -Judah


 On Wed, Jan 25, 2012 at 1:38 PM, Justin Israel justinisr...@gmail.comwrote:

 I think that __main__ would be a very strange and unpredictable place to
 store shared data in your environment.
 If what you are after is a globals module to share settings, you could
 try something like this

 ## testConstants.py ##
 BAR=foo

 ## testScriptA.py ##
 import testConstants

 print BAR=, testConstants.BAR
 testConstants.BAR = blah
 testConstants.FOO = bar

 ## testScriptB.py ##
 import testConstants

 print BAR=,testConstants.BAR
 print FOO=,testConstants.FOO


 # And when we try them out
  import testScriptA

 BAR= foo


  import testScriptB

 BAR= blah

 FOO= bar



 Because modules are only imported once, importing your constants module
 in multiple scripts will all reference the same module. You can then access
 all the objects within that module.




 On Tue, Jan 24, 2012 at 3:45 AM, m.dresch...@bigpoint.net 
 m.dresch...@bigpoint.net wrote:

 Hi,

 I have a question regarding the storage of data in Maya that should be
 available in all my python scripts.
 I found the __main__ class and added an (immutable) variable to it
 in the userSetup.py file.

 With this setup I can access the variable in all my scripts.
 Do some of you guys have experience with this? Is it ok to store data
 in __main__ or does it have implications
 I don't know?

 Thank you very much,

 cheers,

 --
 Malte Dreschert
 Senior Technical Artist @ Bigpoint

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] array of pointers?

2012-01-26 Thread Justin Israel
Hey,

I think the problem you are having is in your use of MScriptUtil. As per
the docs, the pointer you generate from data stored in an instance of a
script util is somewhat bound to that instance. When you create more
pointers from more data, you invalidate the previous pointers. Here is an
example that I think should work for you:

https://gist.github.com/1684064

In your example, you see that all the pointers before the last one have
invalid values. In the example I have provided, a new MScriptUtil is used
each time, and stored with the pointer so as not to lose the reference.

-- justin



On Tue, Jan 24, 2012 at 6:20 PM, smb3d pixelscie...@gmail.com wrote:

 Ultimately I'm trying to create a scatter script.

 I'm using the mfnMesh.getPointAtUV to get a world position from U,V
 values on a surface. When I use a single float2 pointer it works
 great.  The problem is that I want to generate an array of random U,V
 values and iterate through this to find the world position for each
 set of U,V values. I can't seem to figure out how to set up something
 that will generate the correct pointers for each set of random U,V
 values in my array.

 I tried something like this, but ptrAry four copies of the same
 pointer.

 
 ptrArray = []
 numObjs = 4
 util = OpenMaya.MScriptUtil()

 for obj in range(numObjs):
util.createFromList ([random.uniform(0,1), random.uniform(0,1)],2)
sys.__stdout__.write(('%s') %util)
ptrArray .append(util.asFloat2Ptr())
 

 I can see why this possibly wouldn't work, but I'm stumped as how to
 do it correctly.

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Fastest way to build a QTreeWidget from Scene

2012-02-04 Thread Justin Israel
Short of testing, I'm pretty confident that using an API MIt* would increase 
the speed just for the fact that its probably doing more in the C++ side.


On Feb 4, 2012, at 2:58 PM, Chad Vernon wrote:

 You could try using the API and MItDag.  I'm not sure if it will be faster or 
 not, but worth a try.
 
 Chad
 
 On Sat, Feb 4, 2012 at 12:28 PM, Christopher Evans chris.ev...@gmail.com 
 wrote:
 Yeah that is just debug stuff :)
 
 Thanks for the reply.
 
 
 On Sat, Feb 4, 2012 at 7:44 PM, damon shelton damondshel...@gmail.com wrote:
 Hey Chris,
 I would suggest nested dictionaries. for storage of the info, makes for much 
 faster retrieval of information. As far as faster scene traversing, I am not 
 sure of a faster way other than what oyu are doing. I would suggest however 
 to remove the print statements, your code will increase in speed immensely.
 
 
 On Sat, Feb 4, 2012 at 10:01 AM, Christopher Evans chris.ev...@gmail.com 
 wrote:
 Yeah, I meant is there any fast way in Python to do like a modified walk 
 function.
 
 I am doing something like this: http://pastebin.com/SCvrKxF8
 
 Is that the fastest way to recursively traverse the scene? I can make a 
 QTreeWidget, no prob. What's the best way to store a tree hierarchy like this 
 in Python? Using Python Data types, like list, dict, etc.. Nested 
 Dictionaries?
 
 CE
 
 
 On Sat, Feb 4, 2012 at 6:38 PM, Judah Baron judah.ba...@gmail.com wrote:
 Take a look at QTreeWidget and possibly subclass QTreeItem per Maya object 
 type that you are interested in.
 
 
 On Saturday, February 4, 2012, Ricardo Viana cgolhei...@gmail.com wrote:
  Maybe xml?
 
  Best regards
  Ricardo Viana
  On Feb 4, 2012, at 4:20 PM, Christopher Evans chris.ev...@gmail.com wrote:
 
  What's the fastest way to build an outliner-like QTree widget from the 
  scene?
 
  Also, what python data type is best for storing a tree representation 
  anyhow?
 
  --
  CE
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings: 
  http://groups.google.com/group/python_inside_maya/subscribe
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings: 
  http://groups.google.com/group/python_inside_maya/subscribe
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 CE
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 CE
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Fastest way to build a QTreeWidget from Scene

2012-02-04 Thread Justin Israel
Also, for the QTreeView, it might even be beneficial to make your model load 
hierarchies on demand as opposed to an exhaustive walk of the whole tree. So 
each time you expand a node, thats when you find the children. Unless of course 
you actually run an 'expand all' type operation. 
And I agree with Judah about subclassing a QStandardItem as some kind of 
NodeItem that holds your paths and important metadata. 



On Feb 4, 2012, at 9:00 PM, Justin Israel justinisr...@gmail.com wrote:

 Short of testing, I'm pretty confident that using an API MIt* would increase 
 the speed just for the fact that its probably doing more in the C++ side.
 
 
 On Feb 4, 2012, at 2:58 PM, Chad Vernon wrote:
 
 You could try using the API and MItDag.  I'm not sure if it will be faster 
 or not, but worth a try.
 
 Chad
 
 On Sat, Feb 4, 2012 at 12:28 PM, Christopher Evans chris.ev...@gmail.com 
 wrote:
 Yeah that is just debug stuff :)
 
 Thanks for the reply.
 
 
 On Sat, Feb 4, 2012 at 7:44 PM, damon shelton damondshel...@gmail.com 
 wrote:
 Hey Chris,
 I would suggest nested dictionaries. for storage of the info, makes for much 
 faster retrieval of information. As far as faster scene traversing, I am not 
 sure of a faster way other than what oyu are doing. I would suggest however 
 to remove the print statements, your code will increase in speed immensely.
 
 
 On Sat, Feb 4, 2012 at 10:01 AM, Christopher Evans chris.ev...@gmail.com 
 wrote:
 Yeah, I meant is there any fast way in Python to do like a modified walk 
 function.
 
 I am doing something like this: http://pastebin.com/SCvrKxF8
 
 Is that the fastest way to recursively traverse the scene? I can make a 
 QTreeWidget, no prob. What's the best way to store a tree hierarchy like 
 this in Python? Using Python Data types, like list, dict, etc.. Nested 
 Dictionaries?
 
 CE
 
 
 On Sat, Feb 4, 2012 at 6:38 PM, Judah Baron judah.ba...@gmail.com wrote:
 Take a look at QTreeWidget and possibly subclass QTreeItem per Maya object 
 type that you are interested in.
 
 
 On Saturday, February 4, 2012, Ricardo Viana cgolhei...@gmail.com wrote:
  Maybe xml?
 
  Best regards
  Ricardo Viana
  On Feb 4, 2012, at 4:20 PM, Christopher Evans chris.ev...@gmail.com 
  wrote:
 
  What's the fastest way to build an outliner-like QTree widget from the 
  scene?
 
  Also, what python data type is best for storing a tree representation 
  anyhow?
 
  --
  CE
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings: 
  http://groups.google.com/group/python_inside_maya/subscribe
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings: 
  http://groups.google.com/group/python_inside_maya/subscribe
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 CE
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 CE
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: Fever Dorian's Sphere Packing code optimized

2012-02-10 Thread Justin Israel
Hey,

While I actually am not really familiar with the original problem that this
trick solves, after seeing your code I got somewhat hooked today trying to
optimize it further. I thought I would post what I've to be able to have
some discussion about it. There were a couple things I was confused
about... But first, here is my pass at further modifying your code:

https://gist.github.com/1795840

Some changes:

   1. Removed all the remaining pymel
   2. During the first loop that computes the radius of each point, I
   create an MPoint as well and save all of the data in an object.
   3. I sort the object by radius size instead of doing that extremely
   repetitive loop to find the biggest sphere each time. Instead I figured we
   could just start with a sorted list and work through it. Am I wrong about
   this approach? Did they need to remain in the original order for some
   reason? I didn't think they did and all we care about is having the biggest
   spheres first.
   4. For the main intensive loop, since we no longer have to do the size
   test, we just go forward over our sorted list, popping off the next
   biggest, and then doing the collision test on the remainder.

I noticed that (at least in my own tests) the original version, yours, and
mine all did not properly set the radiusPP values on each particle. They
all end up being 0.2. I can go and change them individually in the scene
via the component editor, but I have yet to figure out how to get them to
actually set in the script. So that remains unsolved.

I think my version should be faster the more steps you use and the more
complex the geometry. When I tested 60 steps on a very large sphere, my
results were showing a ~30% increase in speed from yours.

Very interested in messing with this :-)



On Fri, Feb 10, 2012 at 12:26 PM, notanymike notanym...@gmail.com wrote:

 Update:

 It turns out the code was written by Djelloul Bekri, and Dorian had
 just explained how it works on his blog...

 On Feb 10, 9:05 am, notanymike notanym...@gmail.com wrote:
  I've converted the following code from being all pymel to mostly using
  the Maya API, mainly for fun:
 
  http://www.fevrierdorian.com/blog/post/2011/03/14/Remplir-un-mesh-de-...
 
  My code is available here:
 
  http://pastebin.com/3KbhXagZ
 
  It's a bit faster...I also attempted to translate the french parts of
  the code into English, though I don't speak French, so it's just an
  educated guess
 
  I was hoping to create a skeletonizer script, but maybe someone will
  find what I've got here useful as is...

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] File Access Callbacks Grrr

2012-02-28 Thread Justin Israel
The actual issue I see with that callback is that you are not defining the
args signature correctly and its actually failing. When you use that
specific callback, it wants to also pass a second parameter for the
optionally provided userdata when the callback was registered.

This example works for me.

import maya.OpenMaya as om
import maya.cmds as mc

def function(retCode, userData=None):
   om.MScriptUtil.setBool(retCode, False)
   return retCode

cbk_id = om.MSceneMessage.addCheckCallback(
om.MSceneMessage.kBeforeSaveCheck,
function )

# remove the callback
om.MSceneMessage.removeCallback(cbk_id)

You don't need to import the OpenMaya module a second time in your
callback. Its already imported and the MScriptUtil is in a closure.



On Tue, Feb 28, 2012 at 8:46 AM, pricee...@googlemail.com 
pricee...@gmail.com wrote:

 import maya.OpenMaya as om
 import maya.cmds as mc

 def function(retCode):
import maya.OpenMaya as om
#retCode = None
om.MScriptUtil.setBool(retCode, True)
return retCode

 #om.MMessage.MCheckFileFunction()

 om.MSceneMessage.addCheckCallback(om.MSceneMessage.kBeforeSaveCheck,function)

 yup I ve used the other Callbaxck methods but this return True / False
 is dribing me crazy. This will just cause it to stop you from saving.
 Really need to be able to be able to enable or disable the action. Am
 I setting the retCode wrong ?

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] keyboard callback

2012-03-01 Thread Justin Israel
I threw together a simple pyqt example of how to show a dialog at the
current mouse position, and then respond to the ESC key being pressed to
then hide that dialog:

https://gist.github.com/1951709

You can adapt this to your maya version I'm sure. But this is a standalone
PyQt working example.
I don't think its necessary to try and hook into any maya events with
callbacks. You obviously know when you will be launching your dialog (to
show at the mouse position), and while your dialog has focus it can watch
for key press events.

-- justin



On Thu, Mar 1, 2012 at 8:37 AM, Chad Vernon chadver...@gmail.com wrote:

 You can probably use Qt to install some keyboard and mouse event filters.


 On Thu, Mar 1, 2012 at 8:28 AM, wilsimar wilsima...@gmail.com wrote:

 how to register one callback for maya keyboard and mouse events
 interception, in python api.. I need place my window widget on current
 mouse screen position, and close my window when ESC key pressed. Some tip?,
 site? or path to learning this I searched on old posts here and on
 google, but I'm out of luck. thanks.

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: keyboard callback

2012-03-01 Thread Justin Israel
No. Maya does not come with pyqt. It is built on Qt only, and you have to
install it yourself.
Were you talking about a window using the native commands api? Sorry if I
misunderstood that.




On Thu, Mar 1, 2012 at 1:55 PM, wilsimar wilsima...@gmail.com wrote:

 thanks Justin and Chad, but I dont want external dependency. Can I to use
 qt widgets without install qt and pyqt libs? Have maya pyqt embebed?? If I
 send my file.py script to another user, will it work there?



 Em quinta-feira, 1 de março de 2012 13h28min18s UTC-3, wilsimar escreveu:

 how to register one callback for maya keyboard and mouse events
 interception, in python api.. I need place my window widget on current
 mouse screen position, and close my window when ESC key pressed. Some tip?,
 site? or path to learning this I searched on old posts here and on
 google, but I'm out of luck. thanks.

  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: keyboard callback

2012-03-03 Thread Justin Israel
I may be wrong, but I dont think there is a direct python equivalent of that 
example. But if you have that snippet, why not just compile it and use it as a 
command in your script? 
The python solutions I have seen are to use an MPxContext type approach and get 
the position from an event. 

All in all it seems you have a useable solution with that C++ snippet. 



On Mar 3, 2012, at 2:45 PM, wilsimar wilsima...@gmail.com wrote:

 Code from haluk cetiner on highend.
 
 #include maya/MSimple.h
 #include maya/MGlobal.h
 #include iostream
 #include fstream
 
 
 using namespace std;
 
 DeclareSimpleCommand(getcurPos, ManualDesk, 8.0);
 
 MStatus getcurPos::doIt( const MArgList )
 {
 
 MStatus stat;WINSTA_READATTRIBUTES;
 
 LPPOINT lpoint=new tagPOINT;
 
 ::GetCursorPos(lpoint);
 
 clearResult();
 
 
 appendToResult(lpoint-x);
 appendToResult(lpoint-y);
 
 return MS::kSuccess;
 } 
 
 Em sábado, 3 de março de 2012 19h43min56s UTC-3, wilsimar escreveu:
 my window is maya native widget (window -title ...), no qt. I want a way to 
 detect if esc key was pressed to quit my window, and before showwindow 
 command, send my window to mouse position.
 
 I found this c++ api code for mouse screen position detection on highend 
 site, but trying convert it to python, DeclareSimpleCommand raising python 
 error (# Error: NameError: name 'DeclareSimpleCommand' is not defined # ).
 
 thanks Justin
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Extracting data from Output Window

2012-03-05 Thread Justin Israel
The code I suggested earlier will work for software renders, and, for
anything that maya batch reports back to maya's script editor. Maya batch
does write to a log file which you could tail, and get your output from
there. I'm not sure where it lives on windows, but on OSX it lives in the
user home directory here:  ~/Library/Logs/Maya/mayaRender.log

Specifically on windows, if you have the output window showing this info,
its being populated by the subprocess of Maya Batch. So, really the logfile
is your best approach I think.



On Mon, Mar 5, 2012 at 4:04 PM, Chad Dombrova chad...@gmail.com wrote:

 if you're talking about the Output Window that comes with Maya on Windows,
 then that is stdout and stderr, which are two special files/streams that
 any application can write to.  On linux or osx, when you start an
 application you can pipe its output to a file or another application.  I
 don't know about windows, but i'm sure there is something similar.

 Typically renderers will allow you to specify a file for render logs.  If
 it's MR, then there is probably some magic, undocumented environment
 variable that does it.

 why is this forum so slow to update? I posted a topic on Friday and I
 don't see it till Tuesday morning


 first time posters are moderated.  your moderator did not check his email
 over the weekend ;)  if this was not your first time posting, perhaps you
 used a different email address.


 and then i replied to this a few hours ago and it doesn't appearis it
 just me?


 don't know about the delay in the reply, but in case it helps clear
 anything up, by default you won't receive your own responses by email.


 -chad



  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Extracting data from Output Window

2012-03-05 Thread Justin Israel
I'm not sure how that python snippet was working for you. It seems kind of
broken. Also, its not really doing a tee, because I believe the os.dup2 is
actually closing the original __stdout__. So its really only writing to
your new file, as you noticed. Also, it looks like he was trying to do a
context manager with the __exit__ method, yet no __enter__ method and not
using it in a with statement, so it basically does nothing right now.

It looks to me like sys.__stdout__ is assigned and used differently on a
windows machine than on osx, because I don't get the same output flowing to
that descriptor that you seem to, but if I had to suggest a version of that
code, it might be this:

http://pastebin.com/RLsAABRQ

You just assign a file-like interface to __stdout__ with a write() method
that writes to both your own file, and the original file descriptor. See if
that works for you.



On Mon, Mar 5, 2012 at 4:56 PM, Mark Serena markjser...@gmail.com wrote:

 I asked a programmer at work this morning, he doesn't use Python but he
 did come up with this.


 import sys, os

  class Tee:

 def __init__(self, filename):

 log = open(filename, w)

 self.prevfd = os.dup(sys.__stdout__.fileno())

 os.dup2(log.fileno(), sys.__stdout__.fileno())

 self.prev = sys.__stdout__

 sys.__stdout__ = os.fdopen(self.prevfd, w)

 def __exit__(self):

 restore()

 def restore():

 os.dup2(self.prevfd, self.prev.fileno())

 sys.__stdout__ = self.prev


 # begin redirect logging to file

   tee = Tee(c:\\log.txt)


 So at the moment it does what I'm after but it completely redirects the
 output window and now there isn't any output in the console, I don't know
 python well enough at the moment to take it further.

 Is there a way to keep both?


 Thanks guys,






 On Tuesday, March 6, 2012 11:50:09 AM UTC+11, Justin Israel wrote:

 The code I suggested earlier will work for software renders, and, for
 anything that maya batch reports back to maya's script editor. Maya batch
 does write to a log file which you could tail, and get your output from
 there. I'm not sure where it lives on windows, but on OSX it lives in the
 user home directory here:  ~/Library/Logs/Maya/**mayaRender.log

 Specifically on windows, if you have the output window showing this info,
 its being populated by the subprocess of Maya Batch. So, really the logfile
 is your best approach I think.



 On Mon, Mar 5, 2012 at 4:04 PM, Chad Dombrova chad...@gmail.com wrote:

 if you're talking about the Output Window that comes with Maya on
 Windows, then that is stdout and stderr, which are two special
 files/streams that any application can write to.  On linux or osx, when you
 start an application you can pipe its output to a file or another
 application.  I don't know about windows, but i'm sure there is something
 similar.

 Typically renderers will allow you to specify a file for render logs.
  If it's MR, then there is probably some magic, undocumented environment
 variable that does it.

 why is this forum so slow to update? I posted a topic on Friday and I
 don't see it till Tuesday morning


 first time posters are moderated.  your moderator did not check his
 email over the weekend ;)  if this was not your first time posting, perhaps
 you used a different email address.


 and then i replied to this a few hours ago and it doesn't appearis
 it just me?


 don't know about the delay in the reply, but in case it helps clear
 anything up, by default you won't receive your own responses by email.


 -chad



  --
 view archives: 
 http://groups.google.com/**group/python_inside_mayahttp://groups.google.com/group/python_inside_maya
 change your subscription settings: http://groups.google.com/**
 group/python_inside_maya/**subscribehttp://groups.google.com/group/python_inside_maya/subscribe



 On Tuesday, March 6, 2012 11:50:09 AM UTC+11, Justin Israel wrote:

 The code I suggested earlier will work for software renders, and, for
 anything that maya batch reports back to maya's script editor. Maya batch
 does write to a log file which you could tail, and get your output from
 there. I'm not sure where it lives on windows, but on OSX it lives in the
 user home directory here:  ~/Library/Logs/Maya/**mayaRender.log

 Specifically on windows, if you have the output window showing this info,
 its being populated by the subprocess of Maya Batch. So, really the logfile
 is your best approach I think.



 On Mon, Mar 5, 2012 at 4:04 PM, Chad Dombrova chad...@gmail.com wrote:

 if you're talking about the Output Window that comes with Maya on
 Windows, then that is stdout and stderr, which are two special
 files/streams that any application can write to.  On linux or osx, when you
 start an application you can pipe its output to a file or another
 application.  I don't know about windows, but i'm sure there is something
 similar.

 Typically renderers will allow you to specify a file for render logs.
  If it's MR, then there is probably some magic, undocumented

Re: [Maya-Python] Maya 2011 PyQt4 Kubuntu

2012-03-08 Thread Justin Israel
Just to make sure this info also shows up in this thread... I have this
information collected into one place on my blog:

http://www.justinfx.com/2011/11/09/installing-pyqt4-for-maya-2012-osx/



On Thu, Mar 8, 2012 at 9:37 AM, notanymike notanym...@gmail.com wrote:

 Never mind, I found this: http://www.kurianos.com/wordpress/?p=551


 On Monday, May 17, 2010 11:43:39 AM UTC-7, Ozgur wrote:

 Hi everybody,

 Finally I've managed to install 2011 x64 on Kubuntu 10.04 (don't ask how,
 a real pain in the ass)... I've created symbolic links for PyQt4 and sip
 from /usr/lib/pymodules/python2.6 to /usr/autodesk/maya/lib/**
 python2.6/site-packages

 when I try to import PyQt4 inside Maya I get this error, (also this error
 happens using mayapy outsite maya):

 from PyQt4 import QtGui

 # Error: ImportError: /usr/autodesk/maya/lib/**
 python2.6/site-packages/PyQt4/**QtGui.so: undefined symbol:
 _ZTI19QKeyEventTransition #

 any idea?

 E.Ozgur Yilmaz
 Lead Technical Director
 www.ozgurfx.com

 --
 http://groups.google.com/**group/python_inside_mayahttp://groups.google.com/group/python_inside_maya

  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Problem with add maya widget to Qt layout

2012-03-08 Thread Justin Israel
Hey there,

This issue, as far as I know, relates to something I addressed in one of my
maya python training videos (vol 2). When you create a ui in Qt Designer
and then have maya generate the actual GUI from it, its doing translations
to represent widgets. With that in mind, the exact hierarchy and objects
aren't completely 1-to-1 or fully accessible all the time. Some of the
widgets translate into maya objects that you can control using the commands
module, others are simply not accessible in a normal fashion.

The specific issue I am referring to here is regarding layouts. A layout is
one of those objects that you can't fully expect to use with commands
module, as it becomes just a generic layout when it translates to maya. The
problem I have seen is when you have a layout inside another layout, which
is perfectly valid in Qt. Maya will do some things differently during
translation, and actually give you issues if you don't put a QWidget in
between. Also, the hierarchy does end up being different.

Consider this Qt Designer UI file:  http://pastebin.com/82W8Kne5
It is a QDialog, with a main horizontal layout, containing two vertical
layouts, each with a push button.
On the left side, the vertical layout is placed directly into the
horizontal layout.
On the right side, a placeholder widget is added first, then set with a
vertical layout and then the push button.

Look at the hierarchy when I do this:

form = test.MyForm(win)
fullName = mui.MQtUtil.fullName
for name in ('layout1', 'button1', 'placeHolderWidget', 'layout2',
'button2'):
obj = getattr(form, name)
path = fullName(long(sip.unwrapinstance(obj)))
print path

## output ##
MayaWindow|MayaTestDialog|layout1
MayaWindow|MayaTestDialog|mainLayout|button1
MayaWindow|MayaTestDialog|mainLayout|placeHolderWidget
MayaWindow|MayaTestDialog|mainLayout|layout2
MayaWindow|MayaTestDialog|mainLayout|layout2|button2

Notice that with the layout-within-layout, button1 isn't even showing that
its a child of layout1
On the other side, button2 does show that its a child of layout2, yet
layout2 still isnt showing that its a child of placeHolderWidget.
So, Maya does some under the hood reorganizing when it translates. When I
try and setParent to layout1, for me Maya actually crashes completely. I'm
not sure what OS you are running, and maybe because your UI is set up
differently you just get a traceback. But, I can however setParent to
layout2 just fine.

Ultimately, you have to be careful with how you expect to use a Qt layout
in combination with the commands module UI widgets.

My final suggestion, regarding wanting to now add an attrFieldSliderGrp to
your ui, is to stick with PyQt if you are already designing with it. You
will reduce your limitations in trying to translate between the two worlds
constantly. An attrFieldSliderGrp is basically a QLabel, a QLineEdit with a
QDoubleValidator set on it, and a QSlider, all placed in a horizontal
layout. And then you just cross connect the signals between the QLineEdit
and QSlider. This may seem like more work rather than trying to just throw
in an existing Maya widget, but what you get is more control over these
items. You don't have to wonder what the translation will do, and you  have
instant easy access to the complete range of signals, events, and even
being able to wrap this up into its own nice subclass with customizations.

Hope this helps
-- justin


On Thu, Mar 8, 2012 at 7:07 AM, 张宇 1988he...@gmail.com wrote:

 I want to add a attrFieldSliderGrp to my Qt window, I create the Qt UI
 with QtDesinger, there is another file to load the .ui file, I get the
 layout's path in maya with MQtUtil.fullName(), I got it.
 The QVBoxLayout's name is SDK_VL,
 When used mc.setParent(layoutName)  I get a wrong feedback:
 # Error: line 1: setParent: Object
 'MayaWindow|SuperFaceJntUIObj|SDK_Layout' not found.
 # Traceback (most recent call last):
 #   File maya console, line 1, in module
 #   File D:/workflow/MyPys/superFaceJnt.py, line 195, in module
 # main()
 #   File D:/workflow/MyPys/superFaceJnt.py, line 191, in main
 # d = MyForm(win)
 #   File D:/workflow/MyPys/superFaceJnt.py, line 32, in __init__
 # self.addWidget()
 #   File D:/workflow/MyPys/superFaceJnt.py, line 40, in addWidget
 # mc.setParent(SDK_layout)
 # RuntimeError: setParent: Object
 'MayaWindow|SuperFaceJntUIObj|SDK_Layout' not found. #
 If I print the layout's name, I got:
 MayaWindow|SuperFaceJntUIObj|SDK_VL

 Here is my code:
 import sys
 import os

 from PyQt4 import QtGui, QtCore, uic
 import sip

 import maya.cmds as mc
 import maya.OpenMayaUI as mui

 uifile = os.path.join(currentPath, 'superFaceJnt2.ui')
 form_class, base_class = uic.loadUiType(uifile)

 global app

 class MyForm(form_class, base_class):
def __init__(self, parent, **kwargs):
QtGui.QWidget.__init__(self, parent, **kwargs)
self.setupUi(self)
self.addWidget()

def addWidget(self):
SDK_layout =
 

Re: [Maya-Python] Problem with add maya widget to Qt layout

2012-03-09 Thread Justin Israel
Thanks. As always…I am cute.

I'm not exactly sure what you want to be able to control from Maya. It would 
work just like any other python object, except you would use the methods of 
your pyqt widget, and not have to use the maya commands module.

In case what you meant is that you were having trouble linking the text field 
with the slider, I have thrown together a really fast and simple example of a 
pyqt attrFieldSliderGrp

https://gist.github.com/2007194

It ties the field and slider together with signals, and uses a QDoubleValidator 
on the text field.

Any maya widget could have its command attribute set to a python command that 
modifies the pyqt widget. And yes you could also use a scriptJob if what you 
are doing is setting up the pyqt widget and then forgetting about it, and 
letting events fire that modify it. How you use the pyqt widget it totally up 
to you, but accessing its values is completely pythonic. You don't need the 
commands module for that.

I hope that helps a bit more. Sorry if I didn't fully understand your question. 
It might be the language barrier :-/
If you still have questions, maybe give an example so I can specifically see 
what your issue is.

-- justin



On Mar 8, 2012, at 7:22 PM, 张宇 wrote:

 Thanks a lot Super Cute Justin!
 There is a small doubt, I know how to control the attribute with the QSlider, 
 but how to change the silder's value by the attribute? Create a scriptJob? 
 Then with the same problem, how to edit the QSlider's in maya.
 
 2012/3/9 Justin Israel justinisr...@gmail.com
 Hey there,
 
 This issue, as far as I know, relates to something I addressed in one of my 
 maya python training videos (vol 2). When you create a ui in Qt Designer and 
 then have maya generate the actual GUI from it, its doing translations to 
 represent widgets. With that in mind, the exact hierarchy and objects aren't 
 completely 1-to-1 or fully accessible all the time. Some of the widgets 
 translate into maya objects that you can control using the commands module, 
 others are simply not accessible in a normal fashion.
 
 The specific issue I am referring to here is regarding layouts. A layout is 
 one of those objects that you can't fully expect to use with commands module, 
 as it becomes just a generic layout when it translates to maya. The problem I 
 have seen is when you have a layout inside another layout, which is perfectly 
 valid in Qt. Maya will do some things differently during translation, and 
 actually give you issues if you don't put a QWidget in between. Also, the 
 hierarchy does end up being different. 
 
 Consider this Qt Designer UI file:  http://pastebin.com/82W8Kne5
 It is a QDialog, with a main horizontal layout, containing two vertical 
 layouts, each with a push button. 
 On the left side, the vertical layout is placed directly into the horizontal 
 layout. 
 On the right side, a placeholder widget is added first, then set with a 
 vertical layout and then the push button.
 
 Look at the hierarchy when I do this:
 
 form = test.MyForm(win)
 fullName = mui.MQtUtil.fullName
 for name in ('layout1', 'button1', 'placeHolderWidget', 'layout2', 'button2'):
 obj = getattr(form, name)
 path = fullName(long(sip.unwrapinstance(obj)))
 print path
 
 ## output ##
 MayaWindow|MayaTestDialog|layout1
 MayaWindow|MayaTestDialog|mainLayout|button1
 MayaWindow|MayaTestDialog|mainLayout|placeHolderWidget
 MayaWindow|MayaTestDialog|mainLayout|layout2
 MayaWindow|MayaTestDialog|mainLayout|layout2|button2
 
 Notice that with the layout-within-layout, button1 isn't even showing that 
 its a child of layout1
 On the other side, button2 does show that its a child of layout2, yet layout2 
 still isnt showing that its a child of placeHolderWidget.
 So, Maya does some under the hood reorganizing when it translates. When I try 
 and setParent to layout1, for me Maya actually crashes completely. I'm not 
 sure what OS you are running, and maybe because your UI is set up differently 
 you just get a traceback. But, I can however setParent to layout2 just fine.
 
 Ultimately, you have to be careful with how you expect to use a Qt layout in 
 combination with the commands module UI widgets.
 
 My final suggestion, regarding wanting to now add an attrFieldSliderGrp to 
 your ui, is to stick with PyQt if you are already designing with it. You will 
 reduce your limitations in trying to translate between the two worlds 
 constantly. An attrFieldSliderGrp is basically a QLabel, a QLineEdit with a 
 QDoubleValidator set on it, and a QSlider, all placed in a horizontal layout. 
 And then you just cross connect the signals between the QLineEdit and 
 QSlider. This may seem like more work rather than trying to just throw in an 
 existing Maya widget, but what you get is more control over these items. You 
 don't have to wonder what the translation will do, and you  have instant easy 
 access to the complete range of signals, events, and even being able to wrap 
 this up

Re: [Maya-Python] copySkinWeights not accepting multiple influenceAssociations

2012-03-13 Thread Justin Israel
In python, it is not valid to pass multiple keywords of the same name as
parameters. This is obviously a typo in both the python commands docs, and
the pymel docs that copied them 1-to1. For commands that state you can pass
the flag multiple time, you should try and combine them into a tuple.

See if this works for you instead:

influenceAssociation = ('label', 'closestBone','closestJoint')



On Tue, Mar 13, 2012 at 1:10 PM, rfsf rayfae...@gmail.com wrote:

 Curious, anyone else have this issue when scripting with the
 copySkinWeights command?

 The mel command works fine, but the python doesn't work .
 I receive the error # Error: keyword argument repeated


 mel : copySkinWeights  -noMirror -surfaceAssociation closestPoint -
 influenceAssociation label -influenceAssociation closestBone -
 influenceAssociation closestJoint;

 import pymel.core as pm

 pm.copySkinWeights(noMirror=True,surfaceAssociation =
 'closestPoint',influenceAssociation = 'label',influenceAssociation
 ='closestBone',influenceAssociation ='closestJoint')

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] copySkinWeights not accepting multiple influenceAssociations

2012-03-13 Thread Justin Israel
Awesome. Thats good to know. I had to assume that all maya python commands
work the same way, since thats the common approach when using the UI
commands as well.



On Tue, Mar 13, 2012 at 2:26 PM, Ray Faenza rayfae...@gmail.com wrote:

 Thanks Justin. Works like a charm.


 On Tue, Mar 13, 2012 at 4:59 PM, Justin Israel justinisr...@gmail.comwrote:

 In python, it is not valid to pass multiple keywords of the same name as
 parameters. This is obviously a typo in both the python commands docs, and
 the pymel docs that copied them 1-to1. For commands that state you can pass
 the flag multiple time, you should try and combine them into a tuple.

 See if this works for you instead:

 influenceAssociation = ('label', 'closestBone','closestJoint')



 On Tue, Mar 13, 2012 at 1:10 PM, rfsf rayfae...@gmail.com wrote:

 Curious, anyone else have this issue when scripting with the
 copySkinWeights command?

 The mel command works fine, but the python doesn't work .
 I receive the error # Error: keyword argument repeated


 mel : copySkinWeights  -noMirror -surfaceAssociation closestPoint -
 influenceAssociation label -influenceAssociation closestBone -
 influenceAssociation closestJoint;

 import pymel.core as pm

 pm.copySkinWeights(noMirror=True,surfaceAssociation =
 'closestPoint',influenceAssociation = 'label',influenceAssociation
 ='closestBone',influenceAssociation ='closestJoint')

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: Extracting data from Output Window

2012-03-15 Thread Justin Israel
If the only way on to redirect the output on windows is to a file using the log 
flag, then you can have your qt window just tail that file. 



On Mar 15, 2012, at 9:03 AM, ChrisV chr...@austin.rr.com wrote:

 Is there a way to redirect the Output Window info or stdout to a Qt
 interface. We have an exporter plugin which kicks info to the Output
 Window, but I'd like to pipe this to an exporter UI  which I've
 created.
 
 On Mar 13, 5:13 am, Mark Serena markjser...@gmail.com wrote:
 Right click your Maya shortcut and choose properties and in the target box
 add this to the end -log c:\debug.txt
 Should look like this:
 *C:\Program Files\Autodesk\Maya2012\bin\maya.exe -log c:\debug.txt*
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] PySide for Maya[2011|2012] under Linux?

2012-03-20 Thread Justin Israel
Probably very similar to the PyQt procedure, linking against the correct
version of Qt. Haven't tried it yet though.


On Tue, Mar 20, 2012 at 7:32 PM, Drake drake.g...@gmail.com wrote:

 I'm really curious to know how to compile/make a workable PySide packages
 for Maya[2011|2012] under Linux?

 Anyone?

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] PySide for Maya[2011|2012] under Linux?

2012-03-21 Thread Justin Israel
It will have to be built against the proper Qt API version. Using yum or
apt-get might end up building against 4.8.
Dunno if that is useable. It also  has to be built for python2.6 (maya2012)


On Wed, Mar 21, 2012 at 3:05 AM, Ricardo Viana cgolhei...@gmail.com wrote:

 If you're on Fedora or Red Hat use:

 su - yum install python-pyside

 dont know if maya will recognize it though.


 best
 Ricardo Viana


 On 03/21/2012 02:32 AM, Drake wrote:

 I'm really curious to know how to compile/make a workable PySide packages
 for Maya[2011|2012] under Linux?

 Anyone?
 --
 view archives: 
 http://groups.google.com/**group/python_inside_mayahttp://groups.google.com/group/python_inside_maya
 change your subscription settings: http://groups.google.com/**
 group/python_inside_maya/**subscribehttp://groups.google.com/group/python_inside_maya/subscribe


 --
 view archives: 
 http://groups.google.com/**group/python_inside_mayahttp://groups.google.com/group/python_inside_maya
 change your subscription settings: http://groups.google.com/**
 group/python_inside_maya/**subscribehttp://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] How to embed PyQt windows to Maya main window on Mac Os

2012-03-27 Thread Justin Israel
Simple fix. Just pass a WindowFlag to your window that tells it to always
stay on top

class MayaSubWindow(QtGui.QMainWindow):
def __init__(self, parent=getMayaWindow()):
super(MayaSubWindow, self).__init__(parent,
QtCore.Qt.WindowStaysOnTopHint)
QtGui.QPushButton(self)

If you are saying that on other operating system, the window stays on top
by default (I havent checked or anything) then it could just be a
difference in the window systems defaults.


On Tue, Mar 27, 2012 at 8:56 AM, 宇 1988he...@gmail.com wrote:

 It's right to embed a pyqt window to Maya main window with this code

 import maya.OpenMayaUI as apiUI

 from PyQt4 import QtGui, QtCore

 import sip

 def getMayaWindow():

 ptr = apiUI.MQtUtil.mainWindow()

 return sip.wrapinstance(long(ptr), QtCore.QObject)

 class MayaSubWindow(QtGui.QMainWindow):

 def __init__(self, parent=getMayaWindow()):

 super(MayaSubWindow, self).__init__(parent)

 QtGui.QPushButton(self)

 myWindow = MayaSubWindow()

 myWindow.show()

 But, on Snow Leopard if you click the maya main window the pyqt ui will be
 covered by maya, Please give me a hand.

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re:- Generating texture list by python

2012-03-27 Thread Justin Israel
Here is a tightened up version of Mike's cmds approach. It uses sets which
are more efficient and unique by design, and gets rid of the inner for
loop...

texture_types = set(['tif', 'tga', 'png'])
used_files = set()

for file_node in cmds.ls(type='file') :
   file_path = cmds.getAttr(%s.fileTextureName % file_node)
   if file_path.lower().rsplit('.', 1)[-1] in texture_types:
   used_files.add(file_path)

print used_files


And just for fun, here is a oneliner filter + lambda + generator

texture_types = set(['tif', 'tga', 'png'])

textures = filter(lambda p: p.lower().rsplit('.', 1)[-1] in texture_types,
(cmds.getAttr(%s.ftn % fNode) for fNode in cmds.ls(type='file')))

--justin


On Tue, Mar 27, 2012 at 9:21 AM, Mike Malinowski (LIONHEAD) 
mich...@microsoft.com wrote:

 Using pymel...


 import pymel.core as pm

 texture_types = ['.tga']
 used_files = []
 for file_node in pm.ls(type='file') :
for texture_type in texture_types :
file_path = file_node.fileTextureName.get()
if texture_type in file_path :
used_files.append(file_path)
continue
 print used_files


 or using cmds...

 import maya.cmds as cmds

 texture_types = ['.tga']
 used_files = []
 for file_node in cmds.ls(type='file') :
for texture_type in texture_types :
file_path = cmds.getAttr(file_node + .fileTextureName)
if texture_type in file_path :
used_files.append(file_path)
continue
 print used_files

 -Original Message-
 From: python_inside_maya@googlegroups.com [mailto:
 python_inside_maya@googlegroups.com] On Behalf Of kinjal gajera
 Sent: 27 March 2012 14:14
 To: python_inside_maya
 Subject: [Maya-Python] Re:- Generating texture list by python

 Hi TEAM

 Please note
 I have one cg maya 2011 file,having various texture.
 my task is to create a script through python,by we can get the complete
 used texture list in maya file.

 Expecting positive reply..

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Anyone tried making Maya (Windows, 64bits) work with virtualenv through userSetup.py?

2012-04-02 Thread Justin Israel
Though I am not sure exactly why, it is this line in the activation script
that is hanging up maya:
site.addsitedir(site_packages)

I have not tried using a virtualenv with maya before. Its a lot easier to
just update the PYTHONPATH from the Maya.env, or, update the sys.path from
the userSetup.py

At our studio we just use git repos in a facility network location, and
then point our userSetup.py files at that location. Using pip locally just
for distributing your maya modules seems like overkill to me, but thats
just my opinion and I could be completely wrong. With git, you can pull
your updates at any time, tag, branch, and have a great deal of control
over the package location.

Do you have some specialized need that makes a local setuptools approach
more appealing than a repo?



On Mon, Apr 2, 2012 at 12:51 AM, Drake drake.g...@gmail.com wrote:

 We (Digimax Inc.) start to transfer our deployed python modules from a
 position indicated by envar, *PYTHONPATH*, to using *virtualenv* way.
 That is, for each proprietary python module/package, it is deployed by
 utilizing *setuptools/distribute/...* We made a virtualenv such that we
 can then just use *pip* to do deployment.

 Everything went well until we tried to put the following code snippets for
 initializing *virtualenv* into *userSetup.py*.

 # initialize the virtualenv
 activate_this =
 '//3dnfs/shows/dgTools/python/%s_%s.%s/%s/activate_this.py'
 activate_this = activate_this % (os.name, sys.version_info[0],
 sys.version_info[1], (os.name=='nt' and ['Scripts'] or ['bin'])[0])
 execfile(activate_this, dict(__file__=activate_this))
 del activate_this


 Those snippets just made Maya 2011 (Windows, 64bits) hang there in splash
 window, and the CPU load is quiet low (around 4%). Any suggestions/ideas?

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re:- Generating texture list by python

2012-04-02 Thread Justin Israel
:-)
Like I said, it was just for fun. Obviously I meant to suggest the first
one for real use.
Its just that, sometimes people don't reply on this group very quickly, so
I like to try and have a  little fun with the code when I can.
You never know, sometimes it might spark ideas. They might think of a new
way to use a lambda, or a map, or a list comp, etc. But yea, not that whole
crazy one liner, LOL.


On Mon, Apr 2, 2012 at 5:28 PM, Farsheed Ashouri farsheed.asho...@gmail.com
 wrote:

 Oh Justin! I almost got a headache when i looked at your lambda recipe.!!
 Classic method is better :P


 On Tuesday, March 27, 2012 9:26:52 PM UTC+4:30, Justin Israel wrote:

 Here is a tightened up version of Mike's cmds approach. It uses sets
 which are more efficient and unique by design, and gets rid of the inner
 for loop...

 texture_types = set(['tif', 'tga', 'png'])
 used_files = set()

 for file_node in cmds.ls(type='file') :
file_path = cmds.getAttr(%s.**fileTextureName % file_node)
if file_path.lower().rsplit('.', 1)[-1] in texture_types:
used_files.add(file_path)

 print used_files


 And just for fun, here is a oneliner filter + lambda + generator

 texture_types = set(['tif', 'tga', 'png'])

 textures = filter(lambda p: p.lower().rsplit('.', 1)[-1] in
 texture_types, (cmds.getAttr(%s.ftn % fNode) for fNode in cmds.ls
 (type='file')))

 --justin


 On Tue, Mar 27, 2012 at 9:21 AM, Mike Malinowski (LIONHEAD) 
 mich...@microsoft.com wrote:

 Using pymel...


 import pymel.core as pm

 texture_types = ['.tga']
 used_files = []
 for file_node in pm.ls(type='file') :
for texture_type in texture_types :
file_path = file_node.fileTextureName.get(**)
if texture_type in file_path :
used_files.append(file_path)
continue
 print used_files


 or using cmds...

 import maya.cmds as cmds

 texture_types = ['.tga']
 used_files = []
 for file_node in cmds.ls(type='file') :
for texture_type in texture_types :
file_path = cmds.getAttr(file_node + .fileTextureName)
if texture_type in file_path :
used_files.append(file_path)
continue
 print used_files

 -Original Message-
 From: 
 python_inside_maya@**googlegroups.compython_inside_maya@googlegroups.com[mailto:
 python_inside_maya@**googlegroups.compython_inside_maya@googlegroups.com]
 On Behalf Of kinjal gajera
 Sent: 27 March 2012 14:14
 To: python_inside_maya
 Subject: [Maya-Python] Re:- Generating texture list by python

 Hi TEAM

 Please note
 I have one cg maya 2011 file,having various texture.
 my task is to create a script through python,by we can get the complete
 used texture list in maya file.

 Expecting positive reply..

 --
 view archives: 
 http://groups.google.com/**group/python_inside_mayahttp://groups.google.com/group/python_inside_maya
 change your subscription settings: http://groups.google.com/**
 group/python_inside_maya/**subscribehttp://groups.google.com/group/python_inside_maya/subscribe


 --
 view archives: 
 http://groups.google.com/**group/python_inside_mayahttp://groups.google.com/group/python_inside_maya
 change your subscription settings: http://groups.google.com/**
 group/python_inside_maya/**subscribehttp://groups.google.com/group/python_inside_maya/subscribe


  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Anyone tried making Maya (Windows, 64bits) work with virtualenv through userSetup.py?

2012-04-03 Thread Justin Israel
Kinjal, did you reply to the wrong thread? Or are you asking something about 
combining your texture question with this virtualenv question? You will need to 
explain a bit more. 



On Apr 3, 2012, at 1:40 AM, kinjal gajera techki...@gmail.com wrote:

 Hi 
 
 Normally we opens maya file and run that script that generates used texture 
 in UI(if make) or in script editor.
 I am looking for any of ref... by which i start using it,
 
 On Tue, Apr 3, 2012 at 2:27 AM, Justin Israel justinisr...@gmail.com wrote:
 Though I am not sure exactly why, it is this line in the activation script 
 that is hanging up maya: 
 site.addsitedir(site_packages)
 
 I have not tried using a virtualenv with maya before. Its a lot easier to 
 just update the PYTHONPATH from the Maya.env, or, update the sys.path from 
 the userSetup.py
 
 At our studio we just use git repos in a facility network location, and then 
 point our userSetup.py files at that location. Using pip locally just for 
 distributing your maya modules seems like overkill to me, but thats just my 
 opinion and I could be completely wrong. With git, you can pull your updates 
 at any time, tag, branch, and have a great deal of control over the package 
 location. 
 
 Do you have some specialized need that makes a local setuptools approach more 
 appealing than a repo?
 
 
 
 On Mon, Apr 2, 2012 at 12:51 AM, Drake drake.g...@gmail.com wrote:
 We (Digimax Inc.) start to transfer our deployed python modules from a 
 position indicated by envar, PYTHONPATH, to using virtualenv way. That is, 
 for each proprietary python module/package, it is deployed by utilizing 
 setuptools/distribute/... We made a virtualenv such that we can then just use 
 pip to do deployment.
 
 Everything went well until we tried to put the following code snippets for 
 initializing virtualenv into userSetup.py.
 
 # initialize the virtualenv
 activate_this = '//3dnfs/shows/dgTools/python/%s_%s.%s/%s/activate_this.py'
 activate_this = activate_this % (os.name, sys.version_info[0], 
 sys.version_info[1], (os.name=='nt' and ['Scripts'] or ['bin'])[0])
 execfile(activate_this, dict(__file__=activate_this))
 del activate_this
 
 Those snippets just made Maya 2011 (Windows, 64bits) hang there in splash 
 window, and the CPU load is quiet low (around 4%). Any suggestions/ideas?
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 RCVFX (Mumbai)
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] keyboard and mouse events

2012-04-10 Thread Justin Israel
This is just a guess, since I haven't put too much time into checking, but
I think you might need to do this in C++.
The pointers that you wrap from sip - PyQt QWidget don't seem to register
any effect to having their event methods overloaded. Maybe someone else has
more insight on this than me?


On Tue, Apr 10, 2012 at 11:54 AM, notanymike notanym...@gmail.com wrote:

 I'd like to query changes of the mouse and keyboard state from Maya's main
 window by adding callbacks inside of MQtUtil.mainWindow(), without adding
 any user-defined QWidgets to the window. Is it possible to just access
 events from the main window's widget without passing that widget into a
 user-defined QWidget class as its parent?

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] keyboard and mouse events

2012-04-10 Thread Justin Israel
Sweet. You are right, that does work. Good to know :-)

Test snippet for notanymike:

import maya.OpenMayaUI as mui
from PyQt4 import QtCore, QtGui
import sip

class Filter(QtCore.QObject):
def eventFilter(self, obj, event):
print eventFilter:, obj, event.type()
return False

ptr = mui.MQtUtil.mainWindow()
mainWin = sip.wrapinstance(long(ptr), QtGui.QMainWindow)

f = Filter()
# enable
mainWin.installEventFilter(f)
# disable
mainWin.removeEventFilter(f)


On Tue, Apr 10, 2012 at 5:25 PM, Chad Vernon chadver...@gmail.com wrote:

 You can attach an EventFilter to the window.  I did that to intercept key
 presses to do something else before sending it on to Maya.


 On Tue, Apr 10, 2012 at 4:47 PM, Justin Israel justinisr...@gmail.comwrote:

 This is just a guess, since I haven't put too much time into checking,
 but I think you might need to do this in C++.
 The pointers that you wrap from sip - PyQt QWidget don't seem to
 register any effect to having their event methods overloaded. Maybe someone
 else has more insight on this than me?


 On Tue, Apr 10, 2012 at 11:54 AM, notanymike notanym...@gmail.comwrote:

 I'd like to query changes of the mouse and keyboard state from Maya's
 main window by adding callbacks inside of MQtUtil.mainWindow(), without
 adding any user-defined QWidgets to the window. Is it possible to just
 access events from the main window's widget without passing that widget
 into a user-defined QWidget class as its parent?

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: keyboard and mouse events

2012-04-12 Thread Justin Israel
In your eventFilter for the mainWindow, you can check for the ChildAdded
event.
Nice thing is that you dont have to go looking it up and converting it :-)

class Filter(QtCore.QObject):
def eventFilter(self, obj, event):

typ = event.type()

if typ == event.ChildAdded:
hyperWidget = event.child()
# set up stuff on the hyperWidget QWidget

return False



On Thu, Apr 12, 2012 at 10:53 AM, Jesse Capper jesse.cap...@gmail.comwrote:

 Related question:
 Can you attach a persistent filterEvent to a panel like the
 hypershade? Or maybe attach a callback to the hyperShadePanel type to
 create a filterEvent every time the panel is created?

 I can get the QWidget for the hypershade if it already exists:

 hypershade_panel = cmds.getPanel(sty='hyperShadePanel')[0]
 if hypershade_panel in cmds.getPanel(vis=True):
ptr = mui.MQtUtil.findControl(hypershade_panel)

 Problem is that since the QWidget for the panel gets destroyed every
 time it is closed, I'd have to reattach the filterEvent every time it
 is reopened (or make it persistent, but I'm guessing that since the
 widget gets destroyed, that isn't possible), and I don't know how to
 do that. Is it possible, a bad idea, anything?

 Thanks,
 Jesse



 On Apr 10, 6:08 pm, notanymike notanym...@gmail.com wrote:
  Thanks. I somehow overlooked eventFilter from the QObject docs...

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: keyboard and mouse events

2012-04-12 Thread Justin Israel
Sorry, I kinda neglected to address checking the child widget in that
example.

Unwrap the qobject with sip:

child = event.child()
mayaName = MQtUtil.fullName(long(sip.unwrapinstance(child)))



On Thu, Apr 12, 2012 at 2:41 PM, Jesse Capper jesse.cap...@gmail.comwrote:

 Awesome, that helps.

 I'm having trouble determining if the created child is a certain type
 of panel. My original thought was to get the maya UI name and check
 it's type with cmds.getPanel, however MQtUtil.fullName() is asking for
 a pointer, not the QWidget that event.child() returns, and I don't
 know how to pass it a pointer to the widget (or if there is a better
 way to either get the Maya UI name, or figure out if the child is a
 panel of type x).

 Thanks,
 Jesse

 On Apr 12, 12:55 pm, Justin Israel justinisr...@gmail.com wrote:
  In your eventFilter for the mainWindow, you can check for the ChildAdded
  event.
  Nice thing is that you dont have to go looking it up and converting it
 :-)
 
  class Filter(QtCore.QObject):
  def eventFilter(self, obj, event):
 
  typ = event.type()
 
  if typ == event.ChildAdded:
  hyperWidget = event.child()
  # set up stuff on the hyperWidget QWidget
 
  return False
 
  On Thu, Apr 12, 2012 at 10:53 AM, Jesse Capper jesse.cap...@gmail.com
 wrote:
 
 
 
 
 
 
 
   Related question:
   Can you attach a persistent filterEvent to a panel like the
   hypershade? Or maybe attach a callback to the hyperShadePanel type to
   create a filterEvent every time the panel is created?
 
   I can get the QWidget for the hypershade if it already exists:
 
   hypershade_panel = cmds.getPanel(sty='hyperShadePanel')[0]
   if hypershade_panel in cmds.getPanel(vis=True):
  ptr = mui.MQtUtil.findControl(hypershade_panel)
 
   Problem is that since the QWidget for the panel gets destroyed every
   time it is closed, I'd have to reattach the filterEvent every time it
   is reopened (or make it persistent, but I'm guessing that since the
   widget gets destroyed, that isn't possible), and I don't know how to
   do that. Is it possible, a bad idea, anything?
 
   Thanks,
   Jesse
 
   On Apr 10, 6:08 pm, notanymike notanym...@gmail.com wrote:
Thanks. I somehow overlooked eventFilter from the QObject docs...
 
   --
   view archives:http://groups.google.com/group/python_inside_maya
   change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: keyboard and mouse events

2012-04-13 Thread Justin Israel
Switch the event type to ChildPolished:

if event.type() == QtCore.QEvent.ChildPolished:

This will fire after the ChildAdded, and after the paint event. Seems to be
when the maya object is available.



On Thu, Apr 12, 2012 at 5:14 PM, Jesse Capper jesse.cap...@gmail.comwrote:

 It seems like at the time of the childAdded event filter, that the
 hypershade hasn't been fully constructed (My knowledge of how the Maya
 UI/layouts function/are constructed is pretty new, so this may be
 common knowledge). sip.unwrapinstance() will give me a valid pointer,
 but MQtUtil.fullName() returns None.

 If I take that pointer and run MQtUtil.fullName() on my own after the
 hypershade has been constructed it will return the name. I feel like
 I'm missing a simple step or two.

 Here is the code I'm using:
 class Filter(QtCore.QObject):
def eventFilter(self, obj, event):
 if event.type() == QtCore.QEvent.ChildAdded:
child = event.child()
maya_name =
 mui.MQtUtil.fullName(long(sip.unwrapinstance(child)))
print 'Child -- ', child#the widget object
print 'Full Name -- ', maya_name#None
 return False

 ptr = mui.MQtUtil.mainWindow()
 mainWin = sip.wrapinstance(long(ptr), QtGui.QMainWindow)

 f = Filter()
 mainWin.installEventFilter(f)

 Thanks,
 Jesse


 On Apr 12, 3:12 pm, Justin Israel justinisr...@gmail.com wrote:
  Sorry, I kinda neglected to address checking the child widget in that
  example.
 
  Unwrap the qobject with sip:
 
  child = event.child()
  mayaName = MQtUtil.fullName(long(sip.unwrapinstance(child)))
 
  On Thu, Apr 12, 2012 at 2:41 PM, Jesse Capper jesse.cap...@gmail.com
 wrote:
 
 
 
 
 
 
 
   Awesome, that helps.
 
   I'm having trouble determining if the created child is a certain type
   of panel. My original thought was to get the maya UI name and check
   it's type with cmds.getPanel, however MQtUtil.fullName() is asking for
   a pointer, not the QWidget that event.child() returns, and I don't
   know how to pass it a pointer to the widget (or if there is a better
   way to either get the Maya UI name, or figure out if the child is a
   panel of type x).
 
   Thanks,
   Jesse
 
   On Apr 12, 12:55 pm, Justin Israel justinisr...@gmail.com wrote:
In your eventFilter for the mainWindow, you can check for the
 ChildAdded
event.
Nice thing is that you dont have to go looking it up and converting
 it
   :-)
 
class Filter(QtCore.QObject):
def eventFilter(self, obj, event):
 
typ = event.type()
 
if typ == event.ChildAdded:
hyperWidget = event.child()
# set up stuff on the hyperWidget QWidget
 
return False
 
On Thu, Apr 12, 2012 at 10:53 AM, Jesse Capper 
 jesse.cap...@gmail.com
   wrote:
 
 Related question:
 Can you attach a persistent filterEvent to a panel like the
 hypershade? Or maybe attach a callback to the hyperShadePanel type
 to
 create a filterEvent every time the panel is created?
 
 I can get the QWidget for the hypershade if it already exists:
 
 hypershade_panel = cmds.getPanel(sty='hyperShadePanel')[0]
 if hypershade_panel in cmds.getPanel(vis=True):
ptr = mui.MQtUtil.findControl(hypershade_panel)
 
 Problem is that since the QWidget for the panel gets destroyed
 every
 time it is closed, I'd have to reattach the filterEvent every time
 it
 is reopened (or make it persistent, but I'm guessing that since the
 widget gets destroyed, that isn't possible), and I don't know how
 to
 do that. Is it possible, a bad idea, anything?
 
 Thanks,
 Jesse
 
 On Apr 10, 6:08 pm, notanymike notanym...@gmail.com wrote:
  Thanks. I somehow overlooked eventFilter from the QObject docs...
 
 --
 view archives:http://groups.google.com/group/python_inside_maya
 change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe
 
   --
   view archives:http://groups.google.com/group/python_inside_maya
   change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] PyQt and Maya's scriptedPanels

2012-04-17 Thread Justin Israel
Seems like pymel's eval functionality isn't converting your bool True - 1

Maybe try this:
p.mel.generateChannelMenu(self.popup, 1)

Or just use the standard mel module:

import cmds.mel as mm
mm.eval('generateChannelMenu(%s, 1)' % self.popup)


On Tue, Apr 17, 2012 at 2:27 PM, Richard Kazuo richard...@gmail.com wrote:

 Thanks for this nice piece of code!

 Strangely right-mouse clicks aren't working here... (Maya 2011 x64)

 # MelError: Error during execution of MEL script:
 generateChannelMenu(MayaWindow|MainAttributeEditorLayout|formLayout37|AEmenuBarLayout|myHappyBox|popupMenu79,True);


 # Line 1.116: Invalid use of Maya object True.

 Anyone can confirm if you can right-click the new channelbox and open the
 popup-menu?




 2012/4/11 Jo Jürgens jojurg...@gmail.com

 Nathan Horne has several very useful posts about PyQt and Maya. You
 should read this:  http://nathanhorne.com/?p=381

 Using the code in that post, here's how to achieve what you want:

 import pymel.all as p

 class MayaSubWindow(QtGui.QMainWindow):
 def __init__(self, parent=getMayaWindow()):
 super(MayaSubWindow, self).__init__(parent)
 self.centralwidget = QtGui.QWidget(self)
 self.layout = QtGui.QVBoxLayout(self.centralwidget)

 self.box = p.channelBox('myHappyBox')

 # add the standard right click menu. Doesnt work too well -
 # most operations use the default channelBox no matter what
 self.popup = p.popupMenu()
 p.popupMenu(self.popup, e=True, postMenuCommand=lambda *x:
 p.mel.generateChannelMenu(self.popup, True))
 qtObj = toQtObject(self.box)
 self.layout.addWidget(qtObj)
 self.setCentralWidget(self.centralwidget)


 myWindow = MayaSubWindow()
 myWindow.show()

 Use this if the code is garbled in this mail:
 http://pastebin.com/HhPcd23h



 On Thu, Apr 5, 2012 at 2:32 AM, dgovil dhruvago...@gmail.com wrote:

 Hey guys,
 I want to create a few PyQt UI's to keep all my animation tools in a
 particular area and cut down on clutter.
 I know this must be possible because I've seen a few GUI's pull it off
 like this: http://www.martintomoya.com/Site/tools_info.html

 Specifically I would like to embed the channel box into a PyQt UI, and
 I've read the way to do it is with scriptedPanels but I can't figure
 out how to implement this in PyQT.

 http://download.autodesk.com/global/docs/maya2012/en_us/CommandsPython/scriptedPanel.html

 THe first problem is that according to the docs, this is pretty much a
 MEL only function as far as I can tell.
 The other is, I'd rather stick to Python if possible than MEL.

 I'm wide open to ideas. Much appreciated.

 -Dhruv

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] PyQt and Maya's scriptedPanels

2012-04-17 Thread Justin Israel
Sorry, typo:

import *maya.mel* as mm
mm.eval('generateChannelMenu(%s, 1)' % self.popup)


On Tue, Apr 17, 2012 at 3:03 PM, Justin Israel justinisr...@gmail.comwrote:

 Seems like pymel's eval functionality isn't converting your bool True - 1

 Maybe try this:
 p.mel.generateChannelMenu(self.popup, 1)

 Or just use the standard mel module:

 import cmds.mel as mm
 mm.eval('generateChannelMenu(%s, 1)' % self.popup)


 On Tue, Apr 17, 2012 at 2:27 PM, Richard Kazuo richard...@gmail.comwrote:

 Thanks for this nice piece of code!

 Strangely right-mouse clicks aren't working here... (Maya 2011 x64)

 # MelError: Error during execution of MEL script:
 generateChannelMenu(MayaWindow|MainAttributeEditorLayout|formLayout37|AEmenuBarLayout|myHappyBox|popupMenu79,True);


 # Line 1.116: Invalid use of Maya object True.

 Anyone can confirm if you can right-click the new channelbox and open the
 popup-menu?




 2012/4/11 Jo Jürgens jojurg...@gmail.com

 Nathan Horne has several very useful posts about PyQt and Maya. You
 should read this:  http://nathanhorne.com/?p=381

 Using the code in that post, here's how to achieve what you want:

 import pymel.all as p

 class MayaSubWindow(QtGui.QMainWindow):
 def __init__(self, parent=getMayaWindow()):
 super(MayaSubWindow, self).__init__(parent)
 self.centralwidget = QtGui.QWidget(self)
 self.layout = QtGui.QVBoxLayout(self.centralwidget)

 self.box = p.channelBox('myHappyBox')

 # add the standard right click menu. Doesnt work too well -
 # most operations use the default channelBox no matter what
 self.popup = p.popupMenu()
 p.popupMenu(self.popup, e=True, postMenuCommand=lambda *x:
 p.mel.generateChannelMenu(self.popup, True))
 qtObj = toQtObject(self.box)
 self.layout.addWidget(qtObj)
 self.setCentralWidget(self.centralwidget)


 myWindow = MayaSubWindow()
 myWindow.show()

 Use this if the code is garbled in this mail:
 http://pastebin.com/HhPcd23h



 On Thu, Apr 5, 2012 at 2:32 AM, dgovil dhruvago...@gmail.com wrote:

 Hey guys,
 I want to create a few PyQt UI's to keep all my animation tools in a
 particular area and cut down on clutter.
 I know this must be possible because I've seen a few GUI's pull it off
 like this: http://www.martintomoya.com/Site/tools_info.html

 Specifically I would like to embed the channel box into a PyQt UI, and
 I've read the way to do it is with scriptedPanels but I can't figure
 out how to implement this in PyQT.

 http://download.autodesk.com/global/docs/maya2012/en_us/CommandsPython/scriptedPanel.html

 THe first problem is that according to the docs, this is pretty much a
 MEL only function as far as I can tell.
 The other is, I'd rather stick to Python if possible than MEL.

 I'm wide open to ideas. Much appreciated.

 -Dhruv

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe




-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] PyQt MainWindow as ScriptJob Parent

2012-04-20 Thread Justin Israel
On Fri, Apr 20, 2012 at 4:25 PM, Christopher Evans chris.ev...@gmail.comwrote:

 First lemme start with: Is it possible to use closeEvent() in Maya? I
 cannot get that to work.


Can you be more specific about what is giving you trouble?
This works just fine:

class Window(QtGui.QMainWindow):
def closeEvent(self, e):
print HIT



 Can someone tell me how to feed a custom pyqt mainWindow tool into the
 parent flag of a scriptjob?


 I have been looking all over teh internets, I think it involves SIP
 somehow.. all examples I have seen show QDialog, or mel/python
 commands UIs.


The part about getting the maya UI name from a pyqt widget has been asked
before.
It goes like this:

import sip
import maya.OpenMayaUI as mui

win = # some PyQt widget
mayaName = mui.MQtUtil.fullName(long(sip.unwrapinstance(win)))

You can also check out


 Thanks,

 --
 CE

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] PyQt MainWindow as ScriptJob Parent

2012-04-20 Thread Justin Israel
I hit send to fast. Ignore that silly line at the end of my last message :-)


On Fri, Apr 20, 2012 at 5:05 PM, Justin Israel justinisr...@gmail.comwrote:

 On Fri, Apr 20, 2012 at 4:25 PM, Christopher Evans 
 chris.ev...@gmail.comwrote:

 First lemme start with: Is it possible to use closeEvent() in Maya? I
 cannot get that to work.


 Can you be more specific about what is giving you trouble?
 This works just fine:

 class Window(QtGui.QMainWindow):
 def closeEvent(self, e):
 print HIT



 Can someone tell me how to feed a custom pyqt mainWindow tool into the
 parent flag of a scriptjob?


 I have been looking all over teh internets, I think it involves SIP
 somehow.. all examples I have seen show QDialog, or mel/python
 commands UIs.


 The part about getting the maya UI name from a pyqt widget has been asked
 before.
 It goes like this:

 import sip
 import maya.OpenMayaUI as mui

 win = # some PyQt widget
 mayaName = mui.MQtUtil.fullName(long(sip.unwrapinstance(win)))

 You can also check out


 Thanks,

 --
 CE

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe




-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] maya 2013 and pyqt on osx lion (10.7.3)

2012-04-21 Thread Justin Israel
I just tested my MyQt build script on Lion + maya2013. Works great.
Maya2013 seems to still use Qt 4.7.1, so not much changed other than the
paths for the installer.

Updated project:
https://github.com/justinfx/MyQt4

Updated blog post with links:
http://www.justinfx.com/2011/11/09/installing-pyqt4-for-maya-2012-osx/

-- justin




On Apr 20, 2012, at 5:00 PM, joshua ochoa wrote:

 Just wondering if anyone has this working and if so how easy or not so easy 
 was it.
 
 Thanks,
 
 +josh
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] PyQt MainWindow as ScriptJob Parent

2012-04-21 Thread Justin Israel
You actually don't need to name the window for it to work. Maya will use a 
default name.

from PyQt4 import QtCore, QtGui
import maya.OpenMayaUI as mui
import sip

def getMayaWindow():
ptr = mui.MQtUtil.mainWindow()
return sip.wrapinstance(long(ptr), QtCore.QObject)

class Window(QtGui.QMainWindow):
def __init__(self, parent=None):
p = parent or getMayaWindow()
super(Window, self).__init__(parent=p)

name = mui.MQtUtil.fullName(long(sip.unwrapinstance(self)))
print Window name, name

def closeEvent(self, e):
print TEST


On Apr 20, 2012, at 8:16 PM, John Patrick wrote:

 You need to set the object name to be able to find it in Maya:  
 http://pastebin.com/T4tJ4GjE
 
 On Fri, Apr 20, 2012 at 5:56 PM, Christopher Evans chris.ev...@gmail.com 
 wrote:
 class skinWrangler(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
 
 Looks like I am creating the window differently than you guys.
 
 I was going to give this skinning tool away free anyways, here's that
 few surrounding chunks of code: http://pastebin.com/5tJfvSB7
 
 Thanks,
 
 CE
 
 On Sat, Apr 21, 2012 at 2:06 AM, Justin Israel justinisr...@gmail.com wrote:
  I hit send to fast. Ignore that silly line at the end of my last message :-)
 
 
  On Fri, Apr 20, 2012 at 5:05 PM, Justin Israel justinisr...@gmail.com
  wrote:
 
  On Fri, Apr 20, 2012 at 4:25 PM, Christopher Evans chris.ev...@gmail.com
  wrote:
 
  First lemme start with: Is it possible to use closeEvent() in Maya? I
  cannot get that to work.
 
 
  Can you be more specific about what is giving you trouble?
  This works just fine:
 
  class Window(QtGui.QMainWindow):
  def closeEvent(self, e):
  print HIT
 
 
 
  Can someone tell me how to feed a custom pyqt mainWindow tool into the
  parent flag of a scriptjob?
 
 
  I have been looking all over teh internets, I think it involves SIP
  somehow.. all examples I have seen show QDialog, or mel/python
  commands UIs.
 
 
  The part about getting the maya UI name from a pyqt widget has been asked
  before.
  It goes like this:
 
  import sip
  import maya.OpenMayaUI as mui
 
  win = # some PyQt widget
  mayaName = mui.MQtUtil.fullName(long(sip.unwrapinstance(win)))
 
  You can also check out
 
 
  Thanks,
 
  --
  CE
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 --
 CE
 
 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 John Patrick
 404-242-2675
 jspatr...@gmail.com
 http://www.canyourigit.com
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] PyQt MainWindow as ScriptJob Parent

2012-04-21 Thread Justin Israel
You might be right actually. I may have spoke too soon.


On Apr 21, 2012, at 3:22 PM, John Patrick wrote:

 I'm not sure if that works on your system, but it doesn't work under Maya2012 
 in Fedora.
 
 It will print:
 Window name MayaWindow|
 
 AFAIK, the most reliable way to get the name of the window is to set it 
 explicitly.
 
 On Sat, Apr 21, 2012 at 3:03 PM, Justin Israel justinisr...@gmail.com wrote:
 You actually don't need to name the window for it to work. Maya will use a 
 default name.
 
 from PyQt4 import QtCore, QtGui
 import maya.OpenMayaUI as mui
 import sip
 
 def getMayaWindow():
 ptr = mui.MQtUtil.mainWindow()
 return sip.wrapinstance(long(ptr), QtCore.QObject)
 
 class Window(QtGui.QMainWindow):
 def __init__(self, parent=None):
 p = parent or getMayaWindow()
 super(Window, self).__init__(parent=p)
 
 name = mui.MQtUtil.fullName(long(sip.unwrapinstance(self)))   
  
 print Window name, name
 
 def closeEvent(self, e):
 print TEST
 
 
 On Apr 20, 2012, at 8:16 PM, John Patrick wrote:
 
 You need to set the object name to be able to find it in Maya:  
 http://pastebin.com/T4tJ4GjE
 
 On Fri, Apr 20, 2012 at 5:56 PM, Christopher Evans chris.ev...@gmail.com 
 wrote:
 class skinWrangler(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
 
 Looks like I am creating the window differently than you guys.
 
 I was going to give this skinning tool away free anyways, here's that
 few surrounding chunks of code: http://pastebin.com/5tJfvSB7
 
 Thanks,
 
 CE
 
 On Sat, Apr 21, 2012 at 2:06 AM, Justin Israel justinisr...@gmail.com 
 wrote:
  I hit send to fast. Ignore that silly line at the end of my last message 
  :-)
 
 
  On Fri, Apr 20, 2012 at 5:05 PM, Justin Israel justinisr...@gmail.com
  wrote:
 
  On Fri, Apr 20, 2012 at 4:25 PM, Christopher Evans chris.ev...@gmail.com
  wrote:
 
  First lemme start with: Is it possible to use closeEvent() in Maya? I
  cannot get that to work.
 
 
  Can you be more specific about what is giving you trouble?
  This works just fine:
 
  class Window(QtGui.QMainWindow):
  def closeEvent(self, e):
  print HIT
 
 
 
  Can someone tell me how to feed a custom pyqt mainWindow tool into the
  parent flag of a scriptjob?
 
 
  I have been looking all over teh internets, I think it involves SIP
  somehow.. all examples I have seen show QDialog, or mel/python
  commands UIs.
 
 
  The part about getting the maya UI name from a pyqt widget has been asked
  before.
  It goes like this:
 
  import sip
  import maya.OpenMayaUI as mui
 
  win = # some PyQt widget
  mayaName = mui.MQtUtil.fullName(long(sip.unwrapinstance(win)))
 
  You can also check out
 
 
  Thanks,
 
  --
  CE
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 --
 CE
 
 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 John Patrick
 404-242-2675
 jspatr...@gmail.com
 http://www.canyourigit.com
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 John Patrick
 404-242-2675
 jspatr...@gmail.com
 http://www.canyourigit.com
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Error: TypeError: file maya console line 1: Invalid arguments for flag 'time'. Expected (time, [time]), got float

2012-04-22 Thread Justin Israel
Hey Besjan,

It might be a good idea to follow up on your questions if you ask the
community something and then someone answers. I keep seeing a pattern in
this discussion group where people will ask a question, someone takes the
time to provide information, and then that original person says nothing
about it for maybe a week or never. In your case, you stated you solved
this soon after posting. Closing this thread would prevent someone else
from putting time into it for you, or might help someone else that comes
across this in the meantime.

I feel like we need to address the QA etiquette situation here on this
group. Am I wrong anyone? Just a thought.

-- justin



On Sun, Apr 22, 2012 at 2:36 AM, Besjan Xhika mayan...@gmail.com wrote:

 Thanks for your reply, I found the solution soon after I posted in here.


 On Friday, April 13, 2012 2:26:09 AM UTC+2, damonshelton wrote:

 in python time is required as a start and end time
 keyt = (keytimes[0], keytimes[0])
 cmds.keyframe('nurbsSphere1_**translateX', time = keyt, query = True,
 valueChange = True)

 On Tue, Apr 10, 2012 at 11:15 AM, Besjan Xhika wrote:

 Hi, I'm studying Maya programming..
 and got around this error while trying to convert a MEL script to a
 Python script..

 MEL

 float $keytimes[];
 $keytimes = `keyframe -query -timeChange nurbsSphere1_translateX`;
 // Result: 1 48 //
 $keyt =  $keytimes[0];
 // Result: 1 //
 keyframe -time $keyt -query -valueChange nurbsSphere1_translateX;
 // Result: -5.321007 //

 nurbsSphere1_translateX is an animation curve..
 // Result: 1 48 // are two frames that have keys..

 In MEL works OK.
 
 Python

 keytimes = cmds.keyframe('nurbsSphere1_**translateX', query = True,
 timeChange = True)

 # Result: [1.0, 48.0] #

 keyt = keytimes[0]

 # Result: 1.0 #

 cmds.keyframe('nurbsSphere1_**translateX', time = keyt, query = True,
 valueChange = True)

 # Error: TypeError: file maya console line 1: Invalid arguments for
 flag 'time'. Expected (time, [time]), got float #


 In Python doesn't work..

 So $keyt = 1 and keyt = 1.0 should be the same (floats)..

 While in MEL is accepting a float for time (maybe is being converted
 automatically, or something..), in Python is not..

 Anyone got any idea?

 --
 view archives: 
 http://groups.google.com/**group/python_inside_mayahttp://groups.google.com/group/python_inside_maya
 change your subscription settings: http://groups.google.com/**
 group/python_inside_maya/**subscribehttp://groups.google.com/group/python_inside_maya/subscribe


  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] PyQt MainWindow as ScriptJob Parent

2012-04-22 Thread Justin Israel
Post your latest code? Maybe you have a strange indent. No idea why the
closeEvent would happen right away unless maybe you are letting it get
garbage collected immediately.


On Sun, Apr 22, 2012 at 3:51 PM, Christopher Evans chris.ev...@gmail.comwrote:

 If I pipe that 'name' into the 'p' parent flag of the sciptjob, it
 lives on after i close the window.  Second, integrating your code, the
 closeEvent runs at the time I execute the script and the window opens
 (weird?) it doesn't run on close.

 On Sat, Apr 21, 2012 at 5:16 AM, John Patrick jspatr...@gmail.com wrote:
  You need to set the object name to be able to find it in Maya:
  http://pastebin.com/T4tJ4GjE
 
 
  On Fri, Apr 20, 2012 at 5:56 PM, Christopher Evans 
 chris.ev...@gmail.com
  wrote:
 
  class skinWrangler(QtGui.QMainWindow):
 def __init__(self):
 QtGui.QMainWindow.__init__(self)
 
  Looks like I am creating the window differently than you guys.
 
  I was going to give this skinning tool away free anyways, here's that
  few surrounding chunks of code: http://pastebin.com/5tJfvSB7
 
  Thanks,
 
  CE
 
  On Sat, Apr 21, 2012 at 2:06 AM, Justin Israel justinisr...@gmail.com
  wrote:
   I hit send to fast. Ignore that silly line at the end of my last
 message
   :-)
  
  
   On Fri, Apr 20, 2012 at 5:05 PM, Justin Israel 
 justinisr...@gmail.com
   wrote:
  
   On Fri, Apr 20, 2012 at 4:25 PM, Christopher Evans
   chris.ev...@gmail.com
   wrote:
  
   First lemme start with: Is it possible to use closeEvent() in Maya?
 I
   cannot get that to work.
  
  
   Can you be more specific about what is giving you trouble?
   This works just fine:
  
   class Window(QtGui.QMainWindow):
   def closeEvent(self, e):
   print HIT
  
  
  
   Can someone tell me how to feed a custom pyqt mainWindow tool into
 the
   parent flag of a scriptjob?
  
  
   I have been looking all over teh internets, I think it involves SIP
   somehow.. all examples I have seen show QDialog, or mel/python
   commands UIs.
  
  
   The part about getting the maya UI name from a pyqt widget has been
   asked
   before.
   It goes like this:
  
   import sip
   import maya.OpenMayaUI as mui
  
   win = # some PyQt widget
   mayaName = mui.MQtUtil.fullName(long(sip.unwrapinstance(win)))
  
   You can also check out
  
  
   Thanks,
  
   --
   CE
  
   --
   view archives: http://groups.google.com/group/python_inside_maya
   change your subscription settings:
   http://groups.google.com/group/python_inside_maya/subscribe
  
  
  
   --
   view archives: http://groups.google.com/group/python_inside_maya
   change your subscription settings:
   http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
  --
  CE
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 
  --
  John Patrick
  404-242-2675
  jspatr...@gmail.com
  http://www.canyourigit.com
 
  --
  view archives: http://groups.google.com/group/python_inside_maya
  change your subscription settings:
  http://groups.google.com/group/python_inside_maya/subscribe



 --
 CE

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] PyQt MainWindow as ScriptJob Parent

2012-04-22 Thread Justin Israel
You have some issues with the way you are loading and using your UI.
Notice that you are loading the UI into self.ui, but then implementing
events on self. Your end up calling self.ui.show() from your init which is
showing a completely different object than your main window class.

Normally, I would recommend either precompiling your UIC via pyuic4, or,
loading it in on the fly and then inheriting from it:

class SkinWrangler(QtGui.QMainWindow, Ui_skinWrangler):
def __init__(self, parent=None):
super(SkinWrangler, self).__init__(parent)
self.setupUi(self)

There are variations of that approach, where some people will store the ui
as an object:
self.ui = Ui_skinWrangler()
self.ui.setupUi(self)

The immediate fix for how you are using loadUi is to tell it to set it up
on your main window (similar to what setupUi does):

class skinWrangler(QtGui.QMainWindow):
def __init__(self):

# other stuff here #

uiPath = /path/to/ui/test.ui
uic.loadUi(uiPath, self)

def closeEvent(self, e):
print 'CLOSED'

win = skinWrangler()
win.show()  # instead of win.ui.show()

Don't call show() from your init. It should be called by the entry-point
function that is launching your UI.
Now you will see your closeEvent get called when the window is closed.
The reason you were seeing it look like it was occurring during init each
time, is that what it was really doing was deleting your previous instance
with cmds.deleteUI() which triggers the closeEvent for that previous widget.




On Sun, Apr 22, 2012 at 5:21 PM, Christopher Evans chris.ev...@gmail.comwrote:

 http://pastebin.com/PKEyg0FJ

 On Mon, Apr 23, 2012 at 1:11 AM, Justin Israel justinisr...@gmail.com
 wrote:
  Post your latest code? Maybe you have a strange indent. No idea why the
  closeEvent would happen right away unless maybe you are letting it get
  garbage collected immediately.
 
 
  On Sun, Apr 22, 2012 at 3:51 PM, Christopher Evans 
 chris.ev...@gmail.com
  wrote:
 
  If I pipe that 'name' into the 'p' parent flag of the sciptjob, it
  lives on after i close the window.  Second, integrating your code, the
  closeEvent runs at the time I execute the script and the window opens
  (weird?) it doesn't run on close.
 
  On Sat, Apr 21, 2012 at 5:16 AM, John Patrick jspatr...@gmail.com
 wrote:
   You need to set the object name to be able to find it in Maya:
   http://pastebin.com/T4tJ4GjE
  
  
   On Fri, Apr 20, 2012 at 5:56 PM, Christopher Evans
   chris.ev...@gmail.com
   wrote:
  
   class skinWrangler(QtGui.QMainWindow):
  def __init__(self):
  QtGui.QMainWindow.__init__(self)
  
   Looks like I am creating the window differently than you guys.
  
   I was going to give this skinning tool away free anyways, here's that
   few surrounding chunks of code: http://pastebin.com/5tJfvSB7
  
   Thanks,
  
   CE
  
   On Sat, Apr 21, 2012 at 2:06 AM, Justin Israel 
 justinisr...@gmail.com
   wrote:
I hit send to fast. Ignore that silly line at the end of my last
message
:-)
   
   
On Fri, Apr 20, 2012 at 5:05 PM, Justin Israel
justinisr...@gmail.com
wrote:
   
On Fri, Apr 20, 2012 at 4:25 PM, Christopher Evans
chris.ev...@gmail.com
wrote:
   
First lemme start with: Is it possible to use closeEvent() in
 Maya?
I
cannot get that to work.
   
   
Can you be more specific about what is giving you trouble?
This works just fine:
   
class Window(QtGui.QMainWindow):
def closeEvent(self, e):
print HIT
   
   
   
Can someone tell me how to feed a custom pyqt mainWindow tool
 into
the
parent flag of a scriptjob?
   
   
I have been looking all over teh internets, I think it involves
 SIP
somehow.. all examples I have seen show QDialog, or mel/python
commands UIs.
   
   
The part about getting the maya UI name from a pyqt widget has
 been
asked
before.
It goes like this:
   
import sip
import maya.OpenMayaUI as mui
   
win = # some PyQt widget
mayaName = mui.MQtUtil.fullName(long(sip.unwrapinstance(win)))
   
You can also check out
   
   
Thanks,
   
--
CE
   
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe
   
   
   
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe
  
  
  
   --
   CE
  
   --
   view archives: http://groups.google.com/group/python_inside_maya
   change your subscription settings:
   http://groups.google.com/group/python_inside_maya/subscribe
  
  
  
  
   --
   John Patrick
   404-242-2675
   jspatr...@gmail.com
   http://www.canyourigit.com
  
   --
   view archives: http://groups.google.com/group/python_inside_maya
   change your subscription settings:
   http

Re: [Maya-Python] PyQt MainWindow as ScriptJob Parent

2012-04-23 Thread Justin Israel
In the single inheritance approach, the key line you woud have been missing
was:

self.ui.setupUi(self)

.. which would set up the ui onto the current class.

As for the TypeError, your Ui class should be a generic class if it came
straight from designer. Looking something like this:

class Ui_skinWrangler(object):
def setupUi(self, skinWrangler):

If you created that file by hand or modified it, and it was a QMainWindow
subclass, then yea this would not work for you. Usually you just generate
them from designer and use them directly in your implementation,
unmodified.


On Mon, Apr 23, 2012 at 2:41 PM, Christopher Evans chris.ev...@gmail.comwrote:

 Thanks for your help, you cleared some things up for me.  I had used
 this self.ui.blah approach because I saw that at a company I worked
 for, it's also the stated 'single inheritance' approach in the QT docs
 here:
 http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/designer.html

 In your example I would get this:
 TypeError: ('Wrong base class of toplevel widget', (class
 '__main__.skinWrangler', 'QDialog'))

 So I made it a QDialog and added this string from the docs:

 def __init__(self):
QtGui.QDialog.__init__(self)

 Now it works fine! (the onClose)

 CE

 On Mon, Apr 23, 2012 at 3:57 AM, Justin Israel justinisr...@gmail.com
 wrote:
  You have some issues with the way you are loading and using your UI.
  Notice that you are loading the UI into self.ui, but then implementing
  events on self. Your end up calling self.ui.show() from your init which
 is
  showing a completely different object than your main window class.
 
  Normally, I would recommend either precompiling your UIC via pyuic4, or,
  loading it in on the fly and then inheriting from it:
 
  class SkinWrangler(QtGui.QMainWindow, Ui_skinWrangler):
  def __init__(self, parent=None):
  super(SkinWrangler, self).__init__(parent)
  self.setupUi(self)
 
  There are variations of that approach, where some people will store the
 ui
  as an object:
  self.ui = Ui_skinWrangler()
  self.ui.setupUi(self)
 
  The immediate fix for how you are using loadUi is to tell it to set it
 up on
  your main window (similar to what setupUi does):
 
  class skinWrangler(QtGui.QMainWindow):
  def __init__(self):
 
  # other stuff here #
 
  uiPath = /path/to/ui/test.ui
  uic.loadUi(uiPath, self)
 
  def closeEvent(self, e):
  print 'CLOSED'
 
  win = skinWrangler()
  win.show()  # instead of win.ui.show()
 
  Don't call show() from your init. It should be called by the entry-point
  function that is launching your UI.
  Now you will see your closeEvent get called when the window is closed.
  The reason you were seeing it look like it was occurring during init each
  time, is that what it was really doing was deleting your previous
 instance
  with cmds.deleteUI() which triggers the closeEvent for that previous
 widget.
 
 
 
 
  On Sun, Apr 22, 2012 at 5:21 PM, Christopher Evans 
 chris.ev...@gmail.com
  wrote:
 
  http://pastebin.com/PKEyg0FJ
 
  On Mon, Apr 23, 2012 at 1:11 AM, Justin Israel justinisr...@gmail.com
  wrote:
   Post your latest code? Maybe you have a strange indent. No idea why
 the
   closeEvent would happen right away unless maybe you are letting it get
   garbage collected immediately.
  
  
   On Sun, Apr 22, 2012 at 3:51 PM, Christopher Evans
   chris.ev...@gmail.com
   wrote:
  
   If I pipe that 'name' into the 'p' parent flag of the sciptjob, it
   lives on after i close the window.  Second, integrating your code,
 the
   closeEvent runs at the time I execute the script and the window opens
   (weird?) it doesn't run on close.
  
   On Sat, Apr 21, 2012 at 5:16 AM, John Patrick jspatr...@gmail.com
   wrote:
You need to set the object name to be able to find it in Maya:
http://pastebin.com/T4tJ4GjE
   
   
On Fri, Apr 20, 2012 at 5:56 PM, Christopher Evans
chris.ev...@gmail.com
wrote:
   
class skinWrangler(QtGui.QMainWindow):
   def __init__(self):
   QtGui.QMainWindow.__init__(self)
   
Looks like I am creating the window differently than you guys.
   
I was going to give this skinning tool away free anyways, here's
that
few surrounding chunks of code: http://pastebin.com/5tJfvSB7
   
Thanks,
   
CE
   
On Sat, Apr 21, 2012 at 2:06 AM, Justin Israel
justinisr...@gmail.com
wrote:
 I hit send to fast. Ignore that silly line at the end of my last
 message
 :-)


 On Fri, Apr 20, 2012 at 5:05 PM, Justin Israel
 justinisr...@gmail.com
 wrote:

 On Fri, Apr 20, 2012 at 4:25 PM, Christopher Evans
 chris.ev...@gmail.com
 wrote:

 First lemme start with: Is it possible to use closeEvent() in
 Maya?
 I
 cannot get that to work.


 Can you be more specific about what is giving you trouble?
 This works just fine:

 class Window

Re: [Maya-Python] Selectively export child members?

2012-04-25 Thread Justin Israel
I wrote an export selected script at our studio that does basically that
same thing. Reparenting various objects to the world temporarily.



On Wed, Apr 25, 2012 at 6:57 AM, yury nedelin ynede...@gmail.com wrote:

 You can unparent body, export control with head, then reparent body and
 unparent head and export again.

 On Apr 25, 2012 1:03 AM, Panupat Chongstitwattana panup...@gmail.com
 wrote:

 Is it possible to select a parent with multiple child, and then have
 Python export the parent with each separate child into separate files?

 For example,

 Controller is the parent. it has 2 child nodes
 - head
 - body

 I want to select the Controller, then export
 - controller+head
 - controller+body

 Thanks

 --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe

  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] wingide 4.1 and maya 2011 - 2013 commandport on win7?

2012-04-25 Thread Justin Israel
I added a sys.platform == darwin case to both scripts, and on osx 10.6.8
with maya 2012 this seems to work fine and repeatedly when I just use the
wingHotKeys module from a terminal (I dont use wing).

I'm curious why the scripts go through so much trouble to set up raw low
level sockets on a platform specific basis. The python telnetlib works
beautifully with very little setup and I would think the underlying code
would handle platform specific issues:

from telnetlib import Telnet

telnet = Telnet()
# I have a mel port on 7001 and a python port w/ pickle on 7002
# Leaving the host empty will connect on localhost automatically
telnet.open(, 7002)
telnet.write(cmds.ls())
result = telnet.read_very_eager()
telnet.close()

Those scripts aren't really the cleanest or most efficient. For instance,
in the executeWingCode module, there is no reason to open the temp file
twice. The whole thing could be cleaned up I am sure. So I am not really
certain where your problem is, as it does work fine for me.


On Wed, Apr 25, 2012 at 9:07 AM, oglop ogl...@gmail.com wrote:

 hi all
 i read  Eric Pavey's  wingide and maya working together tutorial here
 http://mayamel.tiddlyspot.com/#[[How%20can%20I%20have%20Wing%20send%20Python%20or%20mel%20code%20to%20Maya%3F]],
 and used

 executeWingCode.py http://pastebin.ubuntu.com/945883/ and wingHotkeys.py 
 http://pastebin.ubuntu.com/945884/
 from here  http://www.eksod.com/2011/07/wing-ide-with-maya-on-linux/

 it works perfectly fine in maya 2010, but in 2011 / 2012 / 2013 it doesn't 
 work.
 if i use
 mSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 it works for the first time, but won't be able to send python commands to 
 maya from second time on ?
 what should i change to make it work in newer versions of maya ? thanks.

 in office, the same setup works fine though, ( office environment is centos 4 
 + maya 2011 )
 thanks!

  --
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings:
 http://groups.google.com/group/python_inside_maya/subscribe


-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: Syntax Coloring in Eclipse

2012-05-02 Thread Justin Israel
Is this a 1 year old thread or am I reading this wrong? Ha



On May 2, 2012, at 1:16 AM, Felix Ulber f.ul...@web.de wrote:

 There is a MEL syntax Highlighter based on colorer:
 http://www.creativecrash.com/downloads/applications/syntax-scripting/c/eclipse-maya-mel
 
 Am 24.01.2011 05:31, schrieb PixelMuncher:
 I've already followed the instructions in Making Eclipse
 Soar (although I didn't add Perforce nor the PyQT stuff).
 Xtext looks too complicated.
 I also found the Colorer-take5 library at http://colorer.sourceforge.net/.
 I contacted Igor Russkih, the author, who told me it could be used to
 accomplish this task, but I'm not a real programmer, so there's no
 way I could pull it off in a reasonable amount of time.  His reply
 was:
 
 Sure you can do this.
 EclipseColorer distribution contains packed syntax description - you
 can extract and review them.
 You need net.sf.colorer_0.9.1/colorer/hrc/common.jar:base/python.hrc
 As a most simple modification, there you'll find a listing of keywords
 like word name=ImportError/
 Adding your own keywords (and then updating the common.jar file) will
 eventually give you these keywords highlighting in python.
 For more info, you may refer hrc-reference on colorer's site.
 
 Maybe it would be worthwhile for one of you guys in a studio to look
 into this?
 
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Maya 2012 - PyQt uic won't show up when wrapped in function

2012-05-02 Thread Justin Israel
Also, I just wanted to point out that the way you are using your UI file is 
less than desirable. There are a couple recommended approaches you can use 
here:  http://doc.qt.nokia.com/4.7-snapshot/designer-using-a-ui-file.html

But if you just load it into self.ui and then start doing self.ui.show(), your 
main window has not been set up by the ui. That is, your main window is never 
really showing. Only the new widgets set up in the ui. No show events, resize 
events etc. 
Ideally you would do something like:  
self.ui.setupUi(self)
Now your main window would be set up and you can do self.show()
Just a suggestion.  



On May 2, 2012, at 1:49 AM, Panupat Chongstitwattana panup...@gmail.com wrote:

 Ah got it. It's working now, thanks :)
 
 On Wed, May 2, 2012 at 3:48 PM, David Moulder da...@thirstydevil.co.uk 
 wrote:
 python garbage collection doing it's work.  test is dying after the 
 function is finished and your UI is automatically closed.  You need a global 
 to keep it alive. 
 
 On Wed, May 2, 2012 at 9:16 AM, Panupat Chongstitwattana panup...@gmail.com 
 wrote:
 Maya 2012 x64 on Windows here. Here's a simple class loading the ui file.
 
 class UI(QtGui.QMainWindow):
 def __init__(self, parent=None):
 QtGui.QWidget.__init__(self, parent)
 self.ui = uic.loadUi(PATH)
 
 If I execute these command on their own, the UI shows up no problem.
 
 test = loginUI()
 test.ui.show()
 
 But if I wrap those in a function, the UI would show up for an instant and 
 closes itself.
 
 def testui():
 test = loginUI()
 test.ui.show()
 testui()
 
 What could be the cause of it? Am I missing something?
 Thanks
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 David Moulder
 http://www.google.com/profiles/squish3d
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Maya 2012 - PyQt uic won't show up when wrapped in function

2012-05-02 Thread Justin Israel
Actually in your case using loadUi you could just do this for now:

self.ui = uic.loadUi(uifile.ui, self)

This will use your main window as the base class





On May 2, 2012, at 7:57 AM, Panupat Chongstitwattana panup...@gmail.com wrote:

 Thanks for the tips Justin!  I think I read Nathan's post about super 
 classing the ui to gain access to the ui.setup method. I'll experiment with 
 it :)
 
 Thanks
 
 On Wed, May 2, 2012 at 9:54 PM, Justin Israel justinisr...@gmail.com wrote:
 Also, I just wanted to point out that the way you are using your UI file is 
 less than desirable. There are a couple recommended approaches you can use 
 here:  http://doc.qt.nokia.com/4.7-snapshot/designer-using-a-ui-file.html
 
 But if you just load it into self.ui and then start doing self.ui.show(), 
 your main window has not been set up by the ui. That is, your main window is 
 never really showing. Only the new widgets set up in the ui. No show events, 
 resize events etc. 
 Ideally you would do something like:  
 self.ui.setupUi(self)
 Now your main window would be set up and you can do self.show()
 Just a suggestion.  
 
 
 
 On May 2, 2012, at 1:49 AM, Panupat Chongstitwattana panup...@gmail.com 
 wrote:
 
 Ah got it. It's working now, thanks :)
 
 On Wed, May 2, 2012 at 3:48 PM, David Moulder da...@thirstydevil.co.uk 
 wrote:
 python garbage collection doing it's work.  test is dying after the 
 function is finished and your UI is automatically closed.  You need a global 
 to keep it alive. 
 
 On Wed, May 2, 2012 at 9:16 AM, Panupat Chongstitwattana 
 panup...@gmail.com wrote:
 Maya 2012 x64 on Windows here. Here's a simple class loading the ui file.
 
 class UI(QtGui.QMainWindow):
 def __init__(self, parent=None):
 QtGui.QWidget.__init__(self, parent)
 self.ui = uic.loadUi(PATH)
 
 If I execute these command on their own, the UI shows up no problem.
 
 test = loginUI()
 test.ui.show()
 
 But if I wrap those in a function, the UI would show up for an instant and 
 closes itself.
 
 def testui():
 test = loginUI()
 test.ui.show()
 testui()
 
 What could be the cause of it? Am I missing something?
 Thanks
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 
 
 -- 
 David Moulder
 http://www.google.com/profiles/squish3d
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Re: pyMel UI crashes 2013

2012-05-05 Thread Justin Israel
The usage of the context managers for the two menus are causing the crash.
If you remove the with statement and just run them normally, the UI works:

http://pastebin.com/02SVxcn2

May be a pymel bug with context managers.


On May 5, 2012, at 4:14 PM, dgovil wrote:

 Specifically I think I've traced it down to the use of pm.menu() as
 the issue, but a few other things are throwing up issues.
 
 But building a new UI from scratch, the second I use pm.menu, it
 crashes the UI.
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] QLineEdit setFocus problem

2012-05-07 Thread Justin Israel
Hey Manuel,
Have you tried using a QCompleter? You realize its provided to do this exact 
functionality?
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qcompleter.html

There are a couple different modes it can be set to, one of which being a popup 
that narrows down the list as you type. 



On May 6, 2012, at 5:45 PM, Manuel Macha man...@manuelmacha.de wrote:

 Hi,
 
 I'm trying to create a variation of QLineEdit where as soon as the user types 
 something, a list of items that match the entered text pop up below the 
 textfield. If you're not sure what I mean - it's supposed to work like the 
 searchbox in any modern browser where suggestions are being displayed while 
 typing.
 The problem that I'm having is that as soon as I'm displaying the menu, the 
 lineedit is loosing focus which makes it impossible to type more than a 
 character at a time - not exactly very user-friendly. I tried several things 
 using setFocusPolicy and setFocusReason but I'm not sure if I properly 
 understood how to utilize those functions.
 Could someone please have a look at the sample code below. Very much 
 appreciated!
 
 http://pastebin.com/m318MY2G
 
from PyQt4.QtGui import QLineEdit, QMenu, QAction

class SearchField(QLineEdit):
   def __init__(self, parent = None):
   QLineEdit.__init__(self, parent = parent)  
   self.textEdited.connect(self.popupMenu)
   
   
   def popupMenu(self):
   aMenu = QMenu()
   aMenu.addAction('Some text')
   aMenu.addAction('More text')
   globalPos = self.mapToGlobal(self.pos())
   globalPos.setY(globalPos.y() + self.height())
   aMenu.exec_(globalPos)
   self.setFocus()

if __name__ == '__main__':
   import sys
   from PyQt4.QtGui import QApplication, QMainWindow
   app = QApplication(sys.argv)
   win = QMainWindow()
   win.setGeometry(200, 200, 128,32)
   win.setCentralWidget(SearchField())
   win.show()
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] QLineEdit setFocus problem

2012-05-07 Thread Justin Israel
Also, the reason its not working right now in your code is because you are 
using a QMenu. The default flags and usage for a QMenu are to be a popup type 
which is designed to hide when it loses focus. You are calling its exec method 
which will force it to act like a popup .
You would want to just use a normal QWidget that is set up how you want, and 
show() it. I have a tool exactly like this which mimics OSX's Spotlight. The 
list is just a custom widget that I show underneath. 



On May 7, 2012, at 7:25 AM, Justin Israel justinisr...@gmail.com wrote:

 Hey Manuel,
 Have you tried using a QCompleter? You realize its provided to do this exact 
 functionality?
 http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qcompleter.html
 
 There are a couple different modes it can be set to, one of which being a 
 popup that narrows down the list as you type. 
 
 
 
 On May 6, 2012, at 5:45 PM, Manuel Macha man...@manuelmacha.de wrote:
 
 Hi,
 
 I'm trying to create a variation of QLineEdit where as soon as the user 
 types something, a list of items that match the entered text pop up below 
 the textfield. If you're not sure what I mean - it's supposed to work like 
 the searchbox in any modern browser where suggestions are being displayed 
 while typing.
 The problem that I'm having is that as soon as I'm displaying the menu, the 
 lineedit is loosing focus which makes it impossible to type more than a 
 character at a time - not exactly very user-friendly. I tried several things 
 using setFocusPolicy and setFocusReason but I'm not sure if I properly 
 understood how to utilize those functions.
 Could someone please have a look at the sample code below. Very much 
 appreciated!
 
 http://pastebin.com/m318MY2G
 
from PyQt4.QtGui import QLineEdit, QMenu, QAction

class SearchField(QLineEdit):
  def __init__(self, parent = None):
  QLineEdit.__init__(self, parent = parent)  
  self.textEdited.connect(self.popupMenu)
  
  
  def popupMenu(self):
  aMenu = QMenu()
  aMenu.addAction('Some text')
  aMenu.addAction('More text')
  globalPos = self.mapToGlobal(self.pos())
  globalPos.setY(globalPos.y() + self.height())
  aMenu.exec_(globalPos)
  self.setFocus()

if __name__ == '__main__':
  import sys
  from PyQt4.QtGui import QApplication, QMainWindow
  app = QApplication(sys.argv)
  win = QMainWindow()
  win.setGeometry(200, 200, 128,32)
  win.setCentralWidget(SearchField())
  win.show()
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Where do Maya Python API 2.0 feedbacks? Bug reports? etc...

2012-05-07 Thread Justin Israel
Report the bug?
http://usa.autodesk.com/adsk/servlet/item?id=12331406siteID=123112SelProduct=Maya

Also, the results == 2 sounds correct, but what is the actual content of the 
selection list for api.OpenMaya?
What are those 328 items?


On May 7, 2012, at 3:38 AM, Narann wrote:

 Hi all!
 
 I was testing Maya Python API 2.0 and discover what I think is a bug:
 
 import maya.api.OpenMaya as om
 import maya.OpenMaya as OpenMaya
 
 # *Create a cube*
 
 mSelList = om.MSelectionList()
 omSelList = OpenMaya.MSelectionList()
 
 mSelList.add(pCu*)
 mSelList.length()# Result: 328L
 
 omSelList.add(pCu*)
 omSelList.length()# Result: 2
 
 I was just wondering how submit this to Maya's developers?
 
 Any idea?
 
 Thanks in advance!
 
 Regards,
 
 Dorian
 
 -- 
 view archives: http://groups.google.com/group/python_inside_maya
 change your subscription settings: 
 http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


Re: [Maya-Python] Where do Maya Python API 2.0 feedbacks? Bug reports? etc...

2012-05-07 Thread Justin Israel
Just tested in 2013:

import maya.api.OpenMaya as om
import maya.OpenMaya as OpenMaya

# *Create a cube*

mSelList = om.MSelectionList()
omSelList = OpenMaya.MSelectionList()

mSelList.add(pCu*)
print mSelList.length()

omSelList.add(pCu*)
print omSelList.length()

2
2


On May 7, 2012, at 3:38 AM, Narann wrote:

 import maya.api.OpenMaya as om
 import maya.OpenMaya as OpenMaya
 
 # *Create a cube*
 
 mSelList = om.MSelectionList()
 omSelList = OpenMaya.MSelectionList()
 
 mSelList.add(pCu*)
 mSelList.length()# Result: 328L
 
 omSelList.add(pCu*)
 omSelList.length()# Result: 2

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe


  1   2   3   4   5   6   7   8   9   10   >