Re: [Maya-Python] Re: object matrix

2011-01-22 Thread Jan Berger


Have you tried using 
MScriptUtil.http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.html#891ecce0036c4ca210c39b27b1ead805asDouble3Ptr 
?



From the docs:
Utility class for working with pointers and references.

Utility class for working with pointers to basic types such as int, 
float and arrays of these types. Class is more applicable for script 
programming rather than C++. C++ pointers and references have no 
equivalent in script so this class provides utility methods for 
working with these type of parameters and return values.


References are treated as pointers in script. This class allows 
creating data and then acquiring a pointer to the data so that 
information can be passed to class methods requiring references.


Common scenarios:

   * A reference to an integer is required for a parameter: create 
the 
http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.htmlMScriptUtil 
object with the integer create() method, acquire a pointer using 
http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.html#d9ea6a06354c1e489730649a2d9bf1edasIntPtr(), 
pass that pointer to the method requiring the reference, create 
another 
http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.htmlMScriptUtil 
object using the int pointer that was returned, query the integer 
return value using 
http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.html#e42e1236dd42fccf9f98516deebcbe24asInt().
   * A pointer to a list of floats are required for a parameter: 
create the 
http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.htmlMScriptUtil 
object with createFromList(), call asFloatPointer() and pass that to 
the method.
   * Several static methods are available for converting python 
lists to matrices and integer/float arrays.


This class is cumbersome to use but it provides a way of building 
parameters and accessing return values for methods which would 
normally not be scriptable.




At 05:44 AM 1/22/2011, you wrote:

hi,
i would love to get the worldspace scales but can get the getScale
arguments right. What did you use?
I end up with

tMatrix.getScale(ptr, om.MSpace.kWorld)
# Error: line 1: in method 'MTransformationMatrix_getScale', argument
2 of type 'double [3]'
# Traceback (most recent call last):
#   File maya console, line 1, in module
# TypeError: in method 'MTransformationMatrix_getScale', argument 2 of
type 'double [3]' #

Best Regards,
katrin
--
NEU: FreePhone - kostenlos mobil telefonieren und 
surfen!

Jetzt informieren: http://www.gmx.net/de/go/freephone

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


Jan Berger
j...@janberger.de :: www.janberger.de  


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


Re: [Maya-Python] Re: object matrix

2011-01-22 Thread katrin schmid
hi,
yes, i did as described here 
http://groups.google.com/group/python_inside_maya/browse_thread/thread/1b0eae1c73c93042/ebbf7af9b00a26e4?hl=deq=#ebbf7af9b00a26e4
but couls figure out th emissing argument...
I only need worldspace scale from marix, maybe there is an easyer way after all?
Thanks,
katrin


 Original-Nachricht 
 Datum: Sat, 22 Jan 2011 12:08:16 +0100
 Von: Jan Berger j...@janberger.de
 An: python_inside_maya@googlegroups.com
 Betreff: Re: [Maya-Python] Re: object matrix

 
 Have you tried using 
 MScriptUtil.http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.html#891ecce0036c4ca210c39b27b1ead805asDouble3Ptr
 ?
 
 
  From the docs:
 Utility class for working with pointers and references.
 
 Utility class for working with pointers to basic types such as int, 
 float and arrays of these types. Class is more applicable for script 
 programming rather than C++. C++ pointers and references have no 
 equivalent in script so this class provides utility methods for 
 working with these type of parameters and return values.
 
 References are treated as pointers in script. This class allows 
 creating data and then acquiring a pointer to the data so that 
 information can be passed to class methods requiring references.
 
 Common scenarios:
 
 * A reference to an integer is required for a parameter: create 
 the 
 http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.htmlMScriptUtil
 object with the integer create() method, acquire a pointer using 
 http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.html#d9ea6a06354c1e489730649a2d9bf1edasIntPtr(),
 pass that pointer to the method requiring the reference, create 
 another 
 http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.htmlMScriptUtil
 object using the int pointer that was returned, query the integer 
 return value using 
 http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.html#e42e1236dd42fccf9f98516deebcbe24asInt().
 * A pointer to a list of floats are required for a parameter: 
 create the 
 http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.htmlMScriptUtil
 object with createFromList(), call asFloatPointer() and pass that to 
 the method.
 * Several static methods are available for converting python 
 lists to matrices and integer/float arrays.
 
 This class is cumbersome to use but it provides a way of building 
 parameters and accessing return values for methods which would 
 normally not be scriptable.
 
 
 
 At 05:44 AM 1/22/2011, you wrote:
 hi,
 i would love to get the worldspace scales but can get the getScale
 arguments right. What did you use?
 I end up with
 
 tMatrix.getScale(ptr, om.MSpace.kWorld)
 # Error: line 1: in method 'MTransformationMatrix_getScale', argument
 2 of type 'double [3]'
 # Traceback (most recent call last):
 #   File maya console, line 1, in module
 # TypeError: in method 'MTransformationMatrix_getScale', argument 2 of
 type 'double [3]' #
 
 Best Regards,
 katrin
 --
 NEU: FreePhone - kostenlos mobil telefonieren und 
 surfen!
 Jetzt informieren: http://www.gmx.net/de/go/freephone
 
 --
 http://groups.google.com/group/python_inside_maya
 
 Jan Berger
 j...@janberger.de :: www.janberger.de  
 
 -- 
 http://groups.google.com/group/python_inside_maya

-- 
GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit 
gratis Handy-Flat! http://portal.gmx.net/de/go/dsl

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


Re: [Maya-Python] Re: object matrix

2011-01-22 Thread Jan Berger


If you have the worldMatrix the scale is in matrix[0][0] matrix[1][1] 
and matrix[2][2]



At 01:17 PM 1/22/2011, you wrote:

hi,
yes, i did as described here 
http://groups.google.com/group/python_inside_maya/browse_thread/thread/1b0eae1c73c93042/ebbf7af9b00a26e4?hl=deq=#ebbf7af9b00a26e4

but couls figure out th emissing argument...
I only need worldspace scale from marix, maybe there is an easyer 
way after all?

Thanks,
katrin


 Original-Nachricht 
 Datum: Sat, 22 Jan 2011 12:08:16 +0100
 Von: Jan Berger j...@janberger.de
 An: python_inside_maya@googlegroups.com
 Betreff: Re: [Maya-Python] Re: object matrix


 Have you tried using
 
MScriptUtil.http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.html#891ecce0036c4ca210c39b27b1ead805asDouble3Ptr

 ?


  From the docs:
 Utility class for working with pointers and references.

 Utility class for working with pointers to basic types such as int,
 float and arrays of these types. Class is more applicable for script
 programming rather than C++. C++ pointers and references have no
 equivalent in script so this class provides utility methods for
 working with these type of parameters and return values.

 References are treated as pointers in script. This class allows
 creating data and then acquiring a pointer to the data so that
 information can be passed to class methods requiring references.

 Common scenarios:

 * A reference to an integer is required for a parameter: create
 the
 
http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.htmlMScriptUtil

 object with the integer create() method, acquire a pointer using
 
http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.html#d9ea6a06354c1e489730649a2d9bf1edasIntPtr(),

 pass that pointer to the method requiring the reference, create
 another
 
http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.htmlMScriptUtil

 object using the int pointer that was returned, query the integer
 return value using
 
http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.html#e42e1236dd42fccf9f98516deebcbe24asInt().

 * A pointer to a list of floats are required for a parameter:
 create the
 
http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.htmlMScriptUtil

 object with createFromList(), call asFloatPointer() and pass that to
 the method.
 * Several static methods are available for converting python
 lists to matrices and integer/float arrays.

 This class is cumbersome to use but it provides a way of building
 parameters and accessing return values for methods which would
 normally not be scriptable.



 At 05:44 AM 1/22/2011, you wrote:
 hi,
 i would love to get the worldspace scales but can get the getScale
 arguments right. What did you use?
 I end up with
 
 tMatrix.getScale(ptr, om.MSpace.kWorld)
 # Error: line 1: in method 'MTransformationMatrix_getScale', argument
 2 of type 'double [3]'
 # Traceback (most recent call last):
 #   File maya console, line 1, in module
 # TypeError: in method 'MTransformationMatrix_getScale', argument 2 of
 type 'double [3]' #
 
 Best Regards,
 katrin
 --
 NEU: FreePhone - kostenlos mobil telefonieren und
 surfen!
 Jetzt informieren: http://www.gmx.net/de/go/freephone
 
 --
 http://groups.google.com/group/python_inside_maya

 Jan Berger
 j...@janberger.de :: www.janberger.de

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

--
GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit
gratis Handy-Flat! http://portal.gmx.net/de/go/dsl

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


Jan Berger
j...@janberger.de :: www.janberger.de  


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


Re: [Maya-Python] Subprocess, Maya 2011, and external python2.5 scripts ...

2011-01-22 Thread Judah Baron
Are you running Maya 2011? If so, you probably need to specify some
environment information to the python25 interpreter. When Maya starts up it
does some manipulation to sys.path and some other environment info. You are
probably calling the python25 interpreter, but inheriting the python26
configuration established by Maya.

You could test this easily enough by creating your own python script an
calling it in place of the one you want to run now. You could do something
like:

import sys, os
FILE = open( C:/temp/python_environ_data.txt, 'w')
FILE.write('sys.path:\n')
FILE.write( '\n'.join(sys.path) )

for var in os.environ.keys():
FILE.write( %s=%s\n%(var, os.environ[var]))

FILE.close()


That code might not do exactly what you want (I didn't run it), but it
should get you pretty close.

-Judah


On Sat, Jan 22, 2011 at 7:04 AM, Geoff Harvey hoafal...@gmail.com wrote:

 Hello!

 Long time listener, first time caller.

 I've run into a situation where I need to launch gather some data from
 a python script.

 The script I need to run happens to be long, complicated, and requires
 python2.5.

 Thing is, when I launch it via subprocess from a python script inside
 of Maya, I get a bunch of incompatibility errors, starting with the
 inability to import the os module.

 Running the same scenario outside of Maya (ie, launching the python2.5
 script inside a python2.6 shell) works just swell.

 Any ideas on how to do this?

 Thanks in advance!

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


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


Re: [Maya-Python] Subprocess, Maya 2011, and external python2.5 scripts ...

2011-01-22 Thread Geoff Harvey
 Are you running Maya 2011? If so, you probably need to specify some
 environment information to the python25 interpreter. When Maya starts up it
 does some manipulation to sys.path and some other environment info. You are
 probably calling the python25 interpreter, but inheriting the python26
 configuration established by Maya.


Correct -- I'm running Maya 2011.

You could test this easily enough by creating your own python script an
 calling it in place of the one you want to run now. You could do something
 like:

 import sys, os
 FILE = open( C:/temp/python_environ_data.txt, 'w')
 FILE.write('sys.path:\n')
 FILE.write( '\n'.join(sys.path) )

 for var in os.environ.keys():
 FILE.write( %s=%s\n%(var, os.environ[var]))

 FILE.close()


 That code might not do exactly what you want (I didn't run it), but it
 should get you pretty close.


Maybe running a tcsh/bash script to a) set the environment then b) run the
script?

I'll give it a try.

It's just odd that I can do this type of stuff outside of Maya 2011, just
not *IN* it ...

Thanks!

hoaf

ps -- I tried monkeying around with the optional env argument on
subprocess, but didn't have much luck:

import os, subprocess
myEnv = os.environ.copy()

## Environment modifications here:
myEnv.update(PYTHONPATH=something)
subprocess.subprocess(myCmd, env=myEnv, [options here]).communicate()

[..]

An intermediary script sounds better, though.  :^)

On Sat, Jan 22, 2011 at 7:04 AM, Geoff Harvey hoafal...@gmail.com wrote:

 Hello!

 Long time listener, first time caller.

 I've run into a situation where I need to launch gather some data from
 a python script.

 The script I need to run happens to be long, complicated, and requires
 python2.5.

 Thing is, when I launch it via subprocess from a python script inside
 of Maya, I get a bunch of incompatibility errors, starting with the
 inability to import the os module.

 Running the same scenario outside of Maya (ie, launching the python2.5
 script inside a python2.6 shell) works just swell.

 Any ideas on how to do this?

 Thanks in advance!

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


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

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


Re: [Maya-Python] Syntax Coloring in Eclipse

2011-01-22 Thread Matt Estela
Last time I looked defining syntax files for eclipse was way more complex
than I expected. Just searched again, someone on stack overflow suggested
this plugin to help get things setup:

http://www.eclipse.org/Xtext/

-matt


On Fri, Jan 21, 2011 at 11:37 PM, PixelMuncher pixeldr...@gmail.com wrote:

 I switched from jEdit to Eclipse, which is proving a good move.
 Is there a way to color Maya commands?
 Thanks.

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


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


Re: [Maya-Python] Re: object matrix

2011-01-22 Thread katrin schmid
hi,
oh, i am totally retarded ;).
Thanks for pointing this out...
katrin

 Original-Nachricht 
 Datum: Sat, 22 Jan 2011 15:08:35 +0100
 Von: Jan Berger j...@janberger.de
 An: python_inside_maya@googlegroups.com
 Betreff: Re: [Maya-Python] Re: object matrix

 
 If you have the worldMatrix the scale is in matrix[0][0] matrix[1][1] 
 and matrix[2][2]
 
 
 At 01:17 PM 1/22/2011, you wrote:
 hi,
 yes, i did as described here 
 http://groups.google.com/group/python_inside_maya/browse_thread/thread/1b0eae1c73c93042/ebbf7af9b00a26e4?hl=deq=#ebbf7af9b00a26e4
 but couls figure out th emissing argument...
 I only need worldspace scale from marix, maybe there is an easyer 
 way after all?
 Thanks,
 katrin
 
 
  Original-Nachricht 
   Datum: Sat, 22 Jan 2011 12:08:16 +0100
   Von: Jan Berger j...@janberger.de
   An: python_inside_maya@googlegroups.com
   Betreff: Re: [Maya-Python] Re: object matrix
 
  
   Have you tried using
   
 
 MScriptUtil.http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.html#891ecce0036c4ca210c39b27b1ead805asDouble3Ptr
   ?
  
  
From the docs:
   Utility class for working with pointers and references.
  
   Utility class for working with pointers to basic types such as int,
   float and arrays of these types. Class is more applicable for script
   programming rather than C++. C++ pointers and references have no
   equivalent in script so this class provides utility methods for
   working with these type of parameters and return values.
  
   References are treated as pointers in script. This class allows
   creating data and then acquiring a pointer to the data so that
   information can be passed to class methods requiring references.
  
   Common scenarios:
  
   * A reference to an integer is required for a parameter: create
   the
   
 
 http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.htmlMScriptUtil
   object with the integer create() method, acquire a pointer using
   
 
 http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.html#d9ea6a06354c1e489730649a2d9bf1edasIntPtr(),
   pass that pointer to the method requiring the reference, create
   another
   
 
 http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.htmlMScriptUtil
   object using the int pointer that was returned, query the integer
   return value using
   
 
 http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.html#e42e1236dd42fccf9f98516deebcbe24asInt().
   * A pointer to a list of floats are required for a parameter:
   create the
   
 
 http://download.autodesk.com/us/maya/2010help/API/class_m_script_util.htmlMScriptUtil
   object with createFromList(), call asFloatPointer() and pass that to
   the method.
   * Several static methods are available for converting python
   lists to matrices and integer/float arrays.
  
   This class is cumbersome to use but it provides a way of building
   parameters and accessing return values for methods which would
   normally not be scriptable.
  
  
  
   At 05:44 AM 1/22/2011, you wrote:
   hi,
   i would love to get the worldspace scales but can get the getScale
   arguments right. What did you use?
   I end up with
   
   tMatrix.getScale(ptr, om.MSpace.kWorld)
   # Error: line 1: in method 'MTransformationMatrix_getScale', argument
   2 of type 'double [3]'
   # Traceback (most recent call last):
   #   File maya console, line 1, in module
   # TypeError: in method 'MTransformationMatrix_getScale', argument 2
 of
   type 'double [3]' #
   
   Best Regards,
   katrin
   --
   NEU: FreePhone - kostenlos mobil telefonieren und
   surfen!
   Jetzt informieren: http://www.gmx.net/de/go/freephone
   
   --
   http://groups.google.com/group/python_inside_maya
  
   Jan Berger
   j...@janberger.de :: www.janberger.de
  
   --
   http://groups.google.com/group/python_inside_maya
 
 --
 GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit
 gratis Handy-Flat! http://portal.gmx.net/de/go/dsl
 
 --
 http://groups.google.com/group/python_inside_maya
 
 Jan Berger
 j...@janberger.de :: www.janberger.de  
 
 -- 
 http://groups.google.com/group/python_inside_maya

-- 
Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief!  
Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail

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


[Maya-Python] Re: Subprocess, Maya 2011, and external python2.5 scripts ...

2011-01-22 Thread Amorano
Windows?

If you dont need to run inside of Maya per se, i.e. run the script,
not hang Maya in the meantime, return later with information, an:

import os
os.system('start c:\python25\python.exe %s .')


HTH.


On Jan 22, 7:04 am, Geoff Harvey hoafal...@gmail.com wrote:
 Hello!

 Long time listener, first time caller.

 I've run into a situation where I need to launch gather some data from
 a python script.

 The script I need to run happens to be long, complicated, and requires
 python2.5.

 Thing is, when I launch it via subprocess from a python script inside
 of Maya, I get a bunch of incompatibility errors, starting with the
 inability to import the os module.

 Running the same scenario outside of Maya (ie, launching the python2.5
 script inside a python2.6 shell) works just swell.

 Any ideas on how to do this?

 Thanks in advance!

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


Re: [Maya-Python] Re: Subprocess, Maya 2011, and external python2.5 scripts ...

2011-01-22 Thread Judah Baron
That's effectively the same thing as using subprocess, and the same issue
will persist.

On Sat, Jan 22, 2011 at 6:12 PM, Amorano amor...@gmail.com wrote:

 Windows?

 If you dont need to run inside of Maya per se, i.e. run the script,
 not hang Maya in the meantime, return later with information, an:

 import os
 os.system('start c:\python25\python.exe %s .')


 HTH.


 On Jan 22, 7:04 am, Geoff Harvey hoafal...@gmail.com wrote:
  Hello!
 
  Long time listener, first time caller.
 
  I've run into a situation where I need to launch gather some data from
  a python script.
 
  The script I need to run happens to be long, complicated, and requires
  python2.5.
 
  Thing is, when I launch it via subprocess from a python script inside
  of Maya, I get a bunch of incompatibility errors, starting with the
  inability to import the os module.
 
  Running the same scenario outside of Maya (ie, launching the python2.5
  script inside a python2.6 shell) works just swell.
 
  Any ideas on how to do this?
 
  Thanks in advance!

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


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


Re: [Maya-Python] Syntax Coloring in Eclipse

2011-01-22 Thread shaun
That plugin is probably not what you want. I have found a few others as
well but they all force you out of pydev, which for me is not desired.
Because I want to use pydev I have started a feature request ticket via
the pydev site.

https://sourceforge.net/tracker/index.php?func=detailaid=3119380group_id=85796atid=577332#

Feel free to add to the ticket or create your own, it would be awesome if
pydev started supporting commands.




 Last time I looked defining syntax files for eclipse was way more complex
 than I expected. Just searched again, someone on stack overflow suggested
 this plugin to help get things setup:

 http://www.eclipse.org/Xtext/

 -matt


 On Fri, Jan 21, 2011 at 11:37 PM, PixelMuncher pixeldr...@gmail.com
 wrote:

 I switched from jEdit to Eclipse, which is proving a good move.
 Is there a way to color Maya commands?
 Thanks.

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


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



-- 
Shaun Friedberg
04-902-0443
http://www.pyrokinesis.co.nz
Fire Is Fun, When You Think About It

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