[Maya-Python] Socket errors on maya2010 64bit \ Vista

2009-09-14 Thread AK Eric

I'm trying something I've used for years, on Maya2008\win2k:

In maya:
commandPort -n :6000 -echoOutput;

In Python (external to Maya):
import socket
maya = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
maya.connect((127.0.0.1, 6000))

But I now get his error in Maya2010 64bit \ Vista
socket.error: [Errno 10061] No connection could be made because the
target machine actively refused it

Any ideas?

thx

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



[Maya-Python] sys.argv[0] not returning correct value in Maya

2009-09-24 Thread AK Eric

In Python external to Maya, I'm used to doing this in a module, which
is a really convenient way to know the location the module is being
executed in.  For a module living here:

#--
# c:/temp/spam.py
import os
import sys

print Module Save Location:, os.path.dirname(os.path.abspath(sys.argv
[0]))
#--

Would print if executed outside of Maya-Python:
c:/temp

Makes it easy to find relative data.
But when I do this in Maya, no matter what, sys.argv[0] is always:

C:\Program Files\Autodesk\Maya2010\bin\maya.exe

Any module I put that code in returns back the Maya executable dir.
Driving me nuts! :)  Anyone know a way around this?

thanks

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



[Maya-Python] Re: 'Pickeling' pymel objects?

2009-10-27 Thread AK Eric

I don't use pymel, but I do use Python and pickle in Maya ;)  From
your above example, it looks like x is a tuple with two strings in
it?  Or is pymel storing more complex objects as the name
representation of the nodes rather than strings?  I'm not sure why
this would choke (if it's just a tuple of strings), since on reload
it's simply regenerating a tuple object with two string values that
variable x points to, it should be independent from any Maya nodes in
the scene itself.

Would be interesting to do:
type(x[0])
and see what it returns back?

When you pickle.load, in that module, do you have pymel imported?  If
not that could cause a problem.

On the other hand, if I misunderstood your question, like Chad said,
unpickling he saved file isn't going to rebuild any Maya nodes, so if
you're expecting that to happen, that could be the issue as well ;)

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



[Maya-Python] Re: Maya UI - I'm sure it's easy once one knows how.

2010-01-21 Thread AK Eric
Just to add a bit more:  The below block of code is one I just stick
on my shelf, and drag it down to the script editor any time I want to
start a new window.  Like Seth, I just modified it to add a button to
close the window as well.

The finicky bit are button commands, or any command executed from a
control:  They only expect to execute a string, or a function *name*,
without args.  Things get more complex if you want want to pass args
from your button to your command/method, and like Seth showed you can
use *args to help capture them on the method side.  Furthermore, even
if you don't want to capture args from your command execution, Maya
likes to pass out a default value upon execution which your command
must be able to intercept, again, via *args.  If you're interested in
the specifics of that, I have a couple tutorials\notes here:
http://mayamel.tiddlyspot.com/#[[Positional%20args%20in%20Python%20authored%20UI%27s]]
http://mayamel.tiddlyspot.com/#[[Executing%20external%20functions%20via%20UI%27s%20authord%20in%20Python]]
Which basically show how to use lambda or functools.partial


__version__ = '0.1'

import maya.cmds as mc

class App(object):
def __init__(self):
self.name = pyWin
self.title = Python Window

if mc.window(self.name, exists=True):
mc.deleteUI(self.name)

self.window = mc.window(self.name, title=self.title+ - v
+__version__,  resizeToFitChildren=True)
self.rootLayout = mc.columnLayout(adjustableColumn=True,
columnAttach=('both', 5))

self.button = mc.button(label=Close Window,
command=self.buttonCmd)

mc.showWindow()

def buttonCmd(self, *args):
mc.deleteUI(self.name)

App()


On Jan 20, 9:48 pm, Chris Mills c...@lizardlounge.com wrote:
 Thank you Seth!

 Kind regards,
 Chris

 Lizard Lounge Graphics, LTD.
 Wellington, NZhttp://lizardlounge.com

 Int'l:  +644-977-5400 / +642-174-8770
 NZ local: 04-977-5400 /   021-748-770

 Seth Gibson wrote:
  Try this.  It's not very elegant and there are probably better
  architectural decisions you could make, but it should get you pointed in
  the right direction:
-- 
http://groups.google.com/group/python_inside_maya

[Maya-Python] Re: Maya UI - I'm sure it's easy once one knows how.

2010-01-21 Thread AK Eric
Yeh, you know, lambdas work often, but not always.  I've found that if
I have a procedurally generated UI... say, looping to make a lot of
buttons, and each should have some unique argument passed into the
executed command, lambda will assign the same args to every button
(bad), but functools.partial will pass in the uniqe args (good).  So I
sort of use a mix of the two depending on the situation.  I haven't
tried troubleshooting why that is though ;)

On Jan 21, 1:49 pm, ryant ad...@rtrowbridge.com wrote:
 I guess you can use a lambda also which I didnt know Eric. I gave you
 a seventh solution to put on your site.

 Ryan
 Character TDwww.rtrowbridge.com/blog
 NaughtyDog Inc.

 On Jan 21, 1:25 pm, ryant ad...@rtrowbridge.com wrote:

  I have not seen it posted so I thought I would mention there are other
  options for passing callable functions as well. You can use a partial
  function to create a callable function to a command.

  Example:

  from functools import partial

  def myfunc(does, some=1, stuff='test'):
          print does
          print some
          print stuff

  part = partial(myfunc, 10, some=10, stuff='ten')
  part()

  # Result #
  10
  10
  ten
  # End Result #

  By using the partial function you can pass a button a partial function
  with whatever arguments you need to pass:

  self.button = mc.button(label=Close Window, command=partial
  (self.buttonCmd, 'pass', my='arguments', into='something')

  Ryan
  Character TDwww.rtrowbridge.com/blog
  NaughtyDog Inc.

  On Jan 21, 8:34 am, AK Eric warp...@sbcglobal.net wrote:

   Just to add a bit more:  The below block of code is one I just stick
   on my shelf, and drag it down to the script editor any time I want to
   start a new window.  Like Seth, I just modified it to add a button to
   close the window as well.

   The finicky bit are button commands, or any command executed from a
   control:  They only expect to execute a string, or a function *name*,
   without args.  Things get more complex if you want want to pass args
   from your button to your command/method, and like Seth showed you can
   use *args to help capture them on the method side.  Furthermore, even
   if you don't want to capture args from your command execution, Maya
   likes to pass out a default value upon execution which your command
   must be able to intercept, again, via *args.  If you're interested in
   the specifics of that, I have a couple tutorials\notes 
   here:http://mayamel.tiddlyspot.com/#[[Positional%20args%20in%20Python%20authored%20UI%27s]]http://mayamel.tiddlyspot.com/#[[Executing%20external%20functions%20via%20UI%27s%20authord%20in%20Python]]
   Which basically show how to use lambda or functools.partial

   __version__ = '0.1'

   import maya.cmds as mc

   class App(object):
       def __init__(self):
           self.name = pyWin
           self.title = Python Window

           if mc.window(self.name, exists=True):
               mc.deleteUI(self.name)

           self.window = mc.window(self.name, title=self.title+ - v
   +__version__,  resizeToFitChildren=True)
           self.rootLayout = mc.columnLayout(adjustableColumn=True,
   columnAttach=('both', 5))

           self.button = mc.button(label=Close Window,
   command=self.buttonCmd)

           mc.showWindow()

       def buttonCmd(self, *args):
           mc.deleteUI(self.name)

   App()

   On Jan 20, 9:48 pm, Chris Mills c...@lizardlounge.com wrote:

Thank you Seth!

Kind regards,
Chris

Lizard Lounge Graphics, LTD.
Wellington, NZhttp://lizardlounge.com

Int'l:  +644-977-5400 / +642-174-8770
NZ local: 04-977-5400 /   021-748-770

Seth Gibson wrote:
 Try this.  It's not very elegant and there are probably better
 architectural decisions you could make, but it should get you pointed 
 in
 the right direction:



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


[Maya-Python] Re: Maya UI - I'm sure it's easy once one knows how.

2010-01-21 Thread AK Eric
Hey, nice!  Mystery solved ;)

On Jan 21, 3:04 pm, damon shelton damondshel...@gmail.com wrote:
 sorry, y = i not y == i

 On Thu, Jan 21, 2010 at 3:02 PM, damon shelton damondshel...@gmail.comwrote:

  Eric,
  here is how you can handle the looping lambda issue
  set one of your lamdas (eg. y in this case to equal the argument)

  import maya.cmds as cmds

  class lambdaLoop():
      def __init__(self, values = ['a', 'b', 'c']):
          self.window = 'lambdaLoop_win'
          self.vals = values

      def Window(self):
          if cmds.window(self.window, ex = True):
              cmds.deleteUI(self.window)

          self.window = cmds.window(self.window, w = 200, h = len(self.vals *
  20))
          layout = cmds.columnLayout(p = self.window, adj = True)

          for i in xrange(0, len(self.vals)):
              cmds.button(p = layout, l = self.vals[i], c = (lambda x, y =
  i:self.command(arg = y)))

          cmds.showWindow(self.window)

      def command(self, arg):
          print self.vals[arg]

  -Damon



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


[Maya-Python] Re: Get selection by selection order?

2010-01-22 Thread AK Eric
Years ago someone wrote a plugin to do this, it *was* here:
http://www.3dhornet.eu/index.php?main_page=document_general_infocPath=63_67products_id=194
You can still download it from CreativeCrash here:
http://www.creativecrash.com/maya/downloads/scripts-plugins/interface-display/c/true-selection-order-plugin
But it's just the .mll, for 2008, no source.  The link off that page
points back to the missing one.

Maybe you can contact the author of the CreativeCrash page.
2c

ep

On Jan 22, 3:18 am, Sune suneke...@gmail.com wrote:
 I had kinda hoped I could get it with an API call or something, but I
 guess I will have to go go the callback/scriptJob route.

 Thanks :-)

 On 22 Jan., 03:58, Paul Molodowitch elron...@gmail.com wrote:

  Unfortunately, maya does not save selection order information for
  components... which means if you want to know selection order, you'll have
  to install a callback which gets triggered on selection change, and keep
  track of it yourself.

  Kind of a pain, but it's the only way to do it I know of...

  - Paul

  On Thu, Jan 21, 2010 at 10:04 AM, Sune suneke...@gmail.com wrote:
   What's an easy and reliable way to gather a list of selected verts,
   ordered by selection order?

   I had a look at the scriptCtx, but this seems more complex than it
   need to be :-) Also the verts are already selected, before my tools is
   run.

   Cheers,
   Sune

   P.s. I use PyMel

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



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


[Maya-Python] Re: To select object from known skinCluster

2010-01-27 Thread AK Eric
Not the API, but I've used this in the past:

string $inf[] = `listConnections mySkinCluster.matrix`;


On Jan 27, 2:15 am, Subbu subbu@gmail.com wrote:
 Hi,

 Any one has faced this situation to select one object from it's known
 or selected skinCluster.

 There should be some option to select or get object info from
 skinCluster command.
 (i.e for ex:  skinCluster (clustName='', q=True, object=True))

 I have used connectionInfo command to get skinned object.
 I think there may be some other solution through api.

 Please reply..

 Thanks
 Subbu

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


[Maya-Python] Re: commandPort

2010-02-01 Thread AK Eric
To my knowledge, Maya intercepts incoming commands as mel,
irregardless of send methodology.  You can send any type of data you
want to Maya over the socket... but Maya will expect it to be mel when
it receives it.  I've not used MayaPad, but maybe it does something
similar to what I do to work around this issue.   Goes more or less
like this:

Open command port in Maya.
In external app connect to that socket, save python code out as
temp.py file.
Ping Maya through command port to exec on temp.py.

I do this via the API of my IDE:  I can query what is hilighted, save
that out as temp.py, and then have Maya execute it... lets me bypass
the Maya script editor entirely.
As an aside:  While you can open a socket with both mel and Python...
I've found that no matter what I do, if I open a socket with Python,
the above solution won't work.. I have to open it with mel.
Frustrating.

On Feb 1, 6:27 am, Jo Jürgens jojurg...@gmail.com wrote:
 MayaPad does just that. Its a wxPython Python editor that can send commands
 to Maya. Maybe you can copy the way its done there

 http://code.google.com/p/mayapad/

 On Mon, Feb 1, 2010 at 9:05 AM, Shaun Friedberg 
 sh...@pyrokinesis.co.nzwrote:

   Right, perhaps I miss-spoke…

  I use Python to open a socket and then send Mel code.

  My question is does anyone know how to send Python code instead of Mel…


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


[Maya-Python] Re: commandPort

2010-02-01 Thread AK Eric
Interesting, thanks for the tip, I'll give that a shot.  I'm the first
to admit I'm no socket expert ;)

On Feb 1, 9:41 am, Marc Downie m...@openendedgroup.com wrote:
  As an aside:  While you can open a socket with both mel and Python...
  I've found that no matter what I do, if I open a socket with Python,
  the above solution won't work.. I have to open it with mel.
  Frustrating.

 Well, at least on the mac I can state that this doesn't happen. We open
 sockets (port 1024) from Python all the time and they work like sockets.
 Are you sure you are getting the threadding right for executing the incoming
 python ? It seems to me that you have to use executeInMainThreadWithResult()
 [1] in order to have a socket server actually run code that it recieves.

 Marc

 [1]http://download.autodesk.com/us/maya/2009help/index.html?url=Python_P...


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


[Maya-Python] Re: commandPort

2010-02-02 Thread AK Eric
Actually, I don't do any formatting when sending Python code from my
IDE (Wing) to Maya.  If anyone's interested I have the setup
documented here:
http://mayamel.tiddlyspot.com/#[[How%20can%20I%20have%20Wing%20send%20Python%20or%20mel%20code%20to%20Maya%3F]]
(may have to copy-paste that link)
Via that method, I can send both mel and python from the IDE,
prettymuch letting me bypass the script editor entirely.  But I
agree:  It's been nice to hear about the various solutions! ;)

On Feb 2, 12:36 am, Shaun Friedberg sh...@pyrokinesis.co.nz wrote:
 Nice tips everyone!
 What I have been doing works fine for sending my Mel or Python scripts to
 Maya from my IDE.
 I thought it would be nice to remove the need to format my Python using Mel
 when sending it to Maya.

 My method is similar to AK Eric.
 Thanks again for all the input, definitely gives me some ideas to play with.

 -Original Message-
 From: python_inside_maya@googlegroups.com

 [mailto:python_inside_m...@googlegroups.com] On Behalf Of AK Eric
 Sent: Tuesday, February 02, 2010 12:18 PM
 To: python_inside_maya
 Subject: [Maya-Python] Re: commandPort

 Interesting, thanks for the tip, I'll give that a shot.  I'm the first
 to admit I'm no socket expert ;)

 On Feb 1, 9:41 am, Marc Downie m...@openendedgroup.com wrote:
   As an aside:  While you can open a socket with both mel and Python...
   I've found that no matter what I do, if I open a socket with Python,
   the above solution won't work.. I have to open it with mel.
   Frustrating.

  Well, at least on the mac I can state that this doesn't happen. We open
  sockets (port 1024) from Python all the time and they work like sockets.
  Are you sure you are getting the threadding right for executing the
 incoming
  python ? It seems to me that you have to use
 executeInMainThreadWithResult()
  [1] in order to have a socket server actually run code that it recieves.

  Marc

 [1]http://download.autodesk.com/us/maya/2009help/index.html?url=Python_P...

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



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


[Maya-Python] Re: commandPort

2010-02-05 Thread AK Eric
Unless I'm missing something about your question, you can just copy-
paste them from my wiki link above.  The full source is right on that
page.  And if you're using Wing Pro, then yes, you can use that code
per the wiki to have Wing talk to Maya.

On Feb 4, 10:54 pm, Subbu.Add subbu@gmail.com wrote:
 Where can I get wingHotkeys.py and

 execPythonCode.py to use Wing IDE for sending commands to Maya.

 Presently Am using Wing IDE professional (30 day trail version).

 Whether this trial version can send commands from Wing to Maya.

 Subbu

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


[Maya-Python] Re: commandPort

2010-02-06 Thread AK Eric
I'd recommend you contact Wing support at this point, this sounds more
related to your install my implementation.  They're quite helpful.
Good luck!

On Feb 5, 7:26 pm, Subbu.Add subbu@gmail.com wrote:
 Dear Mr.Eric,

 I have got the module wingapi in the below path,

 C:\Program Files\Wing IDE 3.2\bin

 But still it is not getting imported.
 Which is the right place for modules in wing to get imported?
 By getting the content from wingapi, executed in wing.

 Even same problem with:
 import edit.editor
 import command.commandmgr

 Please help me.
 Subbu

 On Sat, Feb 6, 2010 at 8:25 AM, Subbu.Add subbu@gmail.com wrote:
  Thanks Mr. Eric.

  Now Am able to send text as command to Maya.
  So that from wing, with string assignment to txt variable,
  now it is possible to create sphere in Maya from wing.

   txt = 'sphere()'     #  in def send_to_maya(language)

  since 'getWingText()' is not working due to wingapi module is not avilable.

  It is showing error:  ImportError: No module named wingapi

  Please help me how can I get wingapi module, since Am using wing ide
  professional trail version. ( whether this module is not supplied with trial
  version?)

  Subbu

  On Fri, Feb 5, 2010 at 10:43 PM, AK Eric warp...@sbcglobal.net wrote:

  Unless I'm missing something about your question, you can just copy-
  paste them from my wiki link above.  The full source is right on that
  page.  And if you're using Wing Pro, then yes, you can use that code
  per the wiki to have Wing talk to Maya.

  On Feb 4, 10:54 pm, Subbu.Add subbu@gmail.com wrote:
   Where can I get wingHotkeys.py and

   execPythonCode.py to use Wing IDE for sending commands to Maya.

   Presently Am using Wing IDE professional (30 day trail version).

   Whether this trial version can send commands from Wing to Maya.

   Subbu

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



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


[Maya-Python] Undoing scripted plugin calls from MFnMesh?

2011-11-11 Thread AK Eric
I wrote a tool (Python function, not scripted plugin) that assigns
vert colors via the API, through MFnMesh.setVertexColor().  Works
great, really fast.  Problem is, it won't undo.
Unless I'm missing something, I've deduced that when API calls modify
the DG (add\delete nodes\connections, color verts, etc) unless they're
authored via a scripted plugin supporting undo (via MDGModifier), you
can't undo them.  If anyone has a workaround for /that/, I'd love to
hear it.  But I digress...

So I went about re-authoring this function as a scripted plugin so I
can support undo.  However, it's still not undoing... properly.  It
sort of undo's, more on that below.

Other scripted plugins I've written that use the functionality of the
methods on a MDGModifier (create, rename, delete, etc), I can get them
to undo just fine:
http://download.autodesk.com/us/maya/2010help/API/class_m_d_g_modifier.html

But the MDGModifier has nothing for setting vert colors, that's where
MFnMesh comes in obviously.  MFnMesh has a setVertexColors() method:
http://download.autodesk.com/us/maya/2010help/API/class_m_fn_mesh.html#7226f44a9d5d14689a8f1f7c822d6d0f
It can optionally take a MDGModifier reference.  But if I pass one in
or not seems to have no effect on the undo operation:  No undo
whatsoever.

So as a workaround, I've gone about authoring code that will remember
the previous vert colors  store them (during redoIt()), so that when
the command is undone (and the undoIt() method is called), that state
is restored.  And it works... sort of.  The first time yes, but after
that it gets pretty hairy.

Any thoughts on this?  Anyone been successful at passing a MDGModifier
reference to a MFnMesh.serVertexColors() method and getting undo to
properly work?

thanks

-- 
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] Re: MPxCommand undoIt()

2011-11-29 Thread AK Eric
I've found that a very precarious way to work :)  Whenever I'm working
on scripted plugins, I just unload\reload them between each
iteration.  Here's a code chunk I use to do that, that I save in the
physical scripted plugin module itself:

import os
import maya.cmds as mc

def pluginLoader(load):
fullPath = __file__
if fullPath.endswith('.pyc'):
fullPath = fullPath [:-1]
dirPath, plugin = os.path.split(fullPath)
if load:
if not mc.pluginInfo(plugin, query=True, loaded=True):
mc.loadPlugin(fullPath, quiet=True)
mc.pluginInfo(plugin, edit=True, autoload=True)
else:
if mc.pluginInfo(plugin, query=True, loaded=True):
mc.unloadPlugin(plugin, force=True)
mc.pluginInfo(plugin, edit=True, autoload=False)

Then in the script editor I do something like this, which I can
highlight and execute as a single block:

import myPlugin
myPlugin.pluginLoader(False)
reload(myPlugin)
myPlugin.pluginLoader(True)
# Now execute the plugin code
# ...

I've also read it's a really good idea to flush your undo queue when
unloading\reloading the plugin.

On Nov 21, 1:24 am, André Adam a_adam_li...@gmx.de wrote:
 Thanks for the input, I have found what makes it not work, though I
 don't quite understand why. I am executing my command from a Python
 tab in the script editor (for ease of handling) while still coding on
 it. A simple call makes the command work as expected and correctly
 triggers the undoIt(). So, this works as expected:

-- 
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] Problems querying string values from MPlug

2011-12-14 Thread AK Eric
This is my first real shot at dealing with attrs and plugs in the
API.  I'm trying to do something pretty simple:  If an attr is type
string, query and print the value.  I have this working with just
about every other attr type, but string is causing the code to crash
\exit with no errors or warnings.

In the below example, I've created a simple poly plane (with only 4
verts).  I then walk it's plug hierarchy for the uvSet attr.  After
I've collected all the plugs  child plugs, I loop over them seeing if
they're of type string, and if so, get their value.

However, I'm failing terribly.  As mentioned, whenever I comment out
either of the two methods I've come up with below, the code quits
running on that loop with no errors or warnings.  try\except doesn't
help.  What am I missing people? ;)

#--
import maya.OpenMaya as om

attr = 'uvSet'
node = pPlaneShape1

# Get an MObject by string name:
selList = om.MSelectionList()
selList.add(node)
mObject = om.MObject()
selList.getDependNode(0, mObject)

# Get a plug based on the attribute name:
mFnDependencyNode = om.MFnDependencyNode(mObject)
rootPlug = mFnDependencyNode.findPlug(attr)

plugs = [rootPlug]
# get the MPlug for the compound attribute
for plug in plugs:
if plug.isCompound():
for i in range(plug.numChildren()):
plugs.append(plug.child(i))

# Now query values:
for plug in plugs:
attr = plug.attribute() # MObject
if attr.hasFn(om.MFn.kTypedAttribute):
attrFn = om.MFnTypedAttribute(attr)
attrType = attrFn.attrType()
if attrType == om.MFnData.kString:
val = 'I wish I knew'

# Method A:
#stringData = om.MFnStringData(plug.asMObject())
#val = stringData.string()

# Method B:
#val = plug.asString()

print plug.name(), val

-- 
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] Re: Another M3dView question

2011-12-14 Thread AK Eric
I'm not expert on this subject, but I tried the same thing in the past
without any luck. My guess is you need to create an actual
'node' (like you said you didn't want to do) to pull this off.  I was
recently looking at Coral, and that's an external app that does all
sorts of custom drawing inside of Maya, but it's via a plugin.  But
maybe bigger brains will prevail on the subject ;)

On Dec 13, 4:26 pm, notanymike notanym...@gmail.com wrote:
  For no particular reason, I'm trying to find out how joints,
 ikHandles, LRA's, etc are rendered in the 3d viewport without the need
 of shapes. I want to do the same, but for now I'm trying to just get
 opengl to draw anything in the 3d viewport without writing my own
 viewport, locator shape, or any plugin of any kind. Basically, I want
 opengl to render something via the script editor (in python mode). I'm
 guessing that it requires getting the device context ( HDC ) of the
 viewport though pyWin32 and pyOpenGL and somehow inserting the gl draw
 procedure into it, but how exactly is that process (safely) achieved
 for Maya?

-- 
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] adjacent verticies of a face

2013-10-05 Thread AK Eric
Glad you like the site ;)  FYI You can permalink to any of the tiddlers 
(individual subjects) via:

Open the tiddler in question.
Press Close Others in it's menu.  Now it's the only one active
Press the permaview button on the top right:  The URL in the address bar 
will now be the full path to the subject, which you can copy.  Like:
http://mayamel.tiddlyspot.com/#%5B%5BHow%20can%20I%20find%20edge-connected%20verts%20based%20on%20a%20source%20vert%3F%5D%5D

I agree, it takes some time getting used to navigating them, but once you 
do... ;)

On Thursday, October 3, 2013 5:38:29 AM UTC-7, Joe Weidenbach wrote:

 Just a quick answer, but check out http://mayamel.tiddlyspot.com.  It's 
 a GREAT resource for python and MEL commands, that I use all the time.   
 The navigation takes a bit of getting used to, but basically just look 
 at the tags to the right.  If you click on Vert, you'll find a list of 
 vert related questions, and clicking one will open an answer (I don't 
 know of anyway to permalink directly).  The one you're looking for is 
 How can I find edge-connected verts based on a source vert?.  It's 
 even got complete source code to build off of. 


-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To post to this group, send email to python_inside_maya@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/1f6aa2a6-9f8c-4e20-8e36-89e280ac5dc9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Maya-Python] qt and pyqt

2014-12-14 Thread AK Eric
Most of the UI's I write are interacting with *other* legacy ui's (whether 
authored via mel, Python cmds, or PySide) , or parts of the DAG.  If the 
only access I had to them was through the c++ api I'd probably shoot myself 
:P  Having access to PySide (for me) makes the actual interaction part with 
Maya trivial, compared to jumping through all the hoops needed to do simple 
stuff in the api. 

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/5c207f32-635b-4bbd-bf83-1cd9453ee7d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Executing code on close of a docked PySide QDialog

2015-01-23 Thread AK Eric
I've authored a window in PySide (via QDialog), and recently made it 
dockable by inheriting from 
maya.app.general.mayaMixin.MayaQWidgetDockableMixin  (in 2015). 
 Surprisingly easy.

In the QDialog's closeEvent method, I do a bit of cleaning up of API 
callbacks. What I've found is:  If the window is floating and *not docked*, 
the closeEvent code executes.  But if the window is docked and closed (via 
the [x] in the corner), the closeEvent doesn't execute.

Any thoughts on what I need to do to track this close state?  Or possibly 
another method to use when closing the docked window?

thanks

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/2ff28437-2151-43e4-8629-13f35ad7839e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Executing code on close of a docked PySide QDialog

2015-01-24 Thread AK Eric
I've been making maya ui's forevers (via mel at first and now python), but 
never really messed with docking.  This is really my first attempt at doing 
*PySide*, and *docking* PySide, so I have on doubt that maybe some part of 
my setup is wrong ;)  

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/76e971d6-d9bc-4db1-a980-0e8e75ef6318%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Executing code on close of a docked PySide QDialog

2015-01-23 Thread AK Eric
Timm: This is how my inheritance looks:

class App(MayaQWidgetDockableMixin, QDialog):

So I am overriding the closeEvent in that class with my cleanup code, but 
like mentioned, it's not being called when *docked*.  Also:  closeEvent 
hides the widgets instead of deleting them by default : That's what I've 
experienced as well:  I *am *using the WA_DeleteOnClose for that class: 
 Without it, it seems the closeEvent isn't called when closed in window 
form.  But in docked mode, nada.

Marcus:  I have all my windows (to my knowledge) properly parented.  But 
closing them doesn't seem to actually delete them (see comment 
above) without the WA_DeleteOnClose option.

So what I need is a way to delete my QDialog correctly when it's *docked*. 
 Currently, when docked, when I hit the [x] it just seems to hide it.  It 
*appears* that it was deleted (since it vanishes from the scene, but in 
fact it's still there, just not drawing?


-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/4829e0e6-0dd0-4a9e-811f-d8669d742535%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Executing code on close of a docked PySide QDialog

2015-01-23 Thread AK Eric
Tracked it down:  The MayaQWidgetDockableMixin class has a  
dockCloseEventTriggered 
method:  I can call to my cleanup code in there, and all is happy now.

Thanks for the help!

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/8e9d38cf-b542-46bb-8245-5a94ee873070%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Setting keyframes in one shot?

2015-01-15 Thread AK Eric
I've written a wrapper for the ol' Maya .anim format:  The Maya tool by 
default is selection order based.  But with a bit of metadata and coding 
our solution fully name based, supports namespaces, missing nodes on 
import, stores/writes non-keyed data, etc.  And since the heavy lifting 
(import\export) is done by the plugin via the keyframe clipboard, it's 
pretty darn fast.

I thought about doing a similar wrapper around atom (because ya, it has its 
issues), but we just haven't needed it, since what we have works so well.

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/9dbeacec-c25a-4943-80ac-bd02841dc674%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Detects window exit in another function

2015-01-30 Thread AK Eric
You can also use the  API's MUiMessage_addUiDeletedCallback.  Example of 
that + scriptJob here:
http://mayamel.tiddlyspot.com/#%5B%5BHow%20can%20I%20execute%20code%20when%20a%20window%20is%20deleted%3F%5D%5D

If the window is closed, that callback is triggered, and then you can do 
anything you want based on that condition.

The difference I've found is, the api callback runs just before the window 
is deleted (allowing you to grab data from the window before it dies), the 
scriptJob runs just after.

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/eacf8718-729c-477e-8aea-ba08d7d6c8d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Basic Python Question

2015-01-08 Thread AK Eric
Optionally you can cut out a lot of cruft using PyMel:

def redWireColour():
sel = pm.ls(selection=True)
for item in sel:
item.overrideEnabled.set(1)
item.overrideColor.set(4)

One of the nice things it does is, if it can't find an attr on the 
transform, it'll auto look to the shape.

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/f959a043-5d3e-4808-83be-4e507e6cc727%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Basic Python Question

2015-01-08 Thread AK Eric
d'oh, I forgot the :

import pymel.core as pm

part... ;)

On Thursday, January 8, 2015 11:04:29 AM UTC-8, AK Eric wrote:

 Optionally you can cut out a lot of cruft using PyMel:

 def redWireColour():
 sel = pm.ls(selection=True)
 for item in sel:
 item.overrideEnabled.set(1)
 item.overrideColor.set(4)

 One of the nice things it does is, if it can't find an attr on the 
 transform, it'll auto look to the shape.


-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/a4dc6a8c-9290-4ba8-b4d4-5ed8827878cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Searching for QPushButton, a-la lsUI ?

2015-03-21 Thread AK Eric
Thanks Justin : lol, I'd forgot I'd posted this and ended up coming up with 
the exact same solution.  Which works great by the way.
I'm still pretty new to the whole let's load a .ui file and play with it 
thing, but I've done tests where in QtDesigner I will create say, a QPush 
button with a given name:  lsUI won't find it, but if I query it with the 
Maya button command by name, I can do stuff to it.
Icoonnnssisteeennntt
:S

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/baf2787d-75c9-4a76-9419-d55415f368ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Searching for QPushButton, a-la lsUI ?

2015-03-19 Thread AK Eric
Created a .ui file in QtDesigner, it shows up happily in Maya via loadUI.

I have other Maya code (based on lsUI) that can search through controls 
related to buttons, and report stuff like their label, annotation, command, 
etc.
However, it *appears *that lsUI ignores anything created from a .ui file.
I know the corresponding Maya controls do exist.  For example, I have a 
named QPushButton in qtDesigner called 'myButton'.  This works in Maya:

import pymel.core as pm
b = pm.ui.Button('myButton')
print b
print b.getLabel()

But again, lsUI ignores the existence of the corresponding Maya button.

Any thoughts on how to say, just list every QPushButton in Maya?  I can 
sort from there.  Or any other ideas?

thanks

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/09b577ae-2418-4438-a281-e09ed411eb3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] how do you select all nurbs curves in a scene?

2015-03-09 Thread AK Eric
How about one more way? :)

import pymel.core as pm
curves = map(lambda x:x.firstParent().nodeName(), pm.ls(type='nurbsCurve'))

This returns the string names of the parent transforms.  If you want the 
actual PyNodes, just get rid of the nodeName() method.

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/a218df4d-4ae5-4937-9a18-bd84596fd8c0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: New to PyMEL. Couple question please?

2015-03-10 Thread AK Eric
Nearly everything you need can be accessed by importing pymel.core
When running this:

myname = loop_anim_v001:master_ctrl
pmc.objExists(myname)
# True

You're passing the string name to the PyMel command.  Note most of their 
commands take either strings, or PyNodes.
The reason your getPosition method is failing is that myname is a string, 
not a PyNode.
Do this to convert to a PyNode from string:

mynode = pmc.PyNode(myname)

However, I'm not sure what the getPosition function\method your calling 
lives.  You could do something like:

restPos = mynode.getRestPosition()

Since that's a method of a PyNode Transform (presuming myname was a 
transform).

The reason this works: (and I added the pmc, I presume you left that off)

myobj = pmc.polySphere()

Is that PyMel returns PyNodes when nodes are created, rather than strings, 
so all the methods are available.



-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/328c9d7c-a9eb-49ae-83ac-6a3315a7bd06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: New to PyMEL. Couple question please?

2015-03-12 Thread AK Eric
I tend to prototype in PyMel, just since doing stuff is easy, less typing. 
 But like Justin said, can be slow depending on what you're doing.  If I 
found it this is a performance critical application I move it into cmds, 
and if not suitable, the API.  Over time you sort of learn at which point 
you should start.

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/2e10cd67-5507-4bf7-8197-d45dbd78294a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: Maya Python Event Playback get currentTime

2015-04-06 Thread AK Eric
So I gave it a shot myself, and I realized the scriptJob only fires when 
the playback is *over*, not during playback.  That being said, scriptJobs 
have both a python cmd and pymel implementation, so there'd be no reason 
you'd need to call to the mel version.

It's possible you could get away with something similar using an API 
MDGMessage callback:
http://help.autodesk.com/view/MAYAUL/2015/ENU/?guid=__cpp_ref_class_m_d_g_message_html
I have notes on how to use these here:
http://mayamel.tiddlyspot.com/#%5B%5BAPI%3A%20How%20can%20I%20author%20callbacks%20for%20Maya%20events%3F%5D%5D
But they *may* have the same failures as the scriptJob : only executing 
when the playback is over.

Even easier than all this though : Just make an expression:

print (The Frame! + frame +  \n);


Totally works, and prints every frame during playback.  I create and manage 
expressions from Python all the time:  One button makes the expression node 
if it doesn't exist.  The other button deletes it if it does.  I'm still 
fuzzy on the how\why of all this, but I hope this helps ;)

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/f816eba4-7f6c-487b-ae20-2bc863453341%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: Maya Python Event Playback get currentTime

2015-04-06 Thread AK Eric
Off the cuff:  Make a method that prints the current frame (like you've 
done).  The on button of your ui calls to a *new *method that creates a 
scriptJob and passes the printer method to the *timeChange* arg.   The 
off button deletes the scriptJob.  You'd want to put checks in so no more 
than one scriptJob gets made if the user keeps bonking 'on'.   *Should* be 
about that simple. 

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/4e0fa7f4-ce4f-403b-8c98-9b6c5152a11b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Maya Python Event Playback get currentTime

2015-04-07 Thread AK Eric
If you're trying to export stuff per frame over a long sequence, then you 
want the calling code to control the frame step, not Maya's playback 
mechanism.  I've authored tools that export a .obj per frame over a 
framerange for the selected mesh.  In that case, you pass your min\max 
frame-range to pythons range function, and loop over those:  Each loop you 
set Maya's frame to the given iteration, then do the export work you're 
after.  If you're concerned about canceling the job in the middle of some 
super-long sequence, wrapper the whole thing in a progressWindow.  I have 
an example of how to author a progressWindow context manager here:
http://mayamel.tiddlyspot.com/#%5B%5BHow%20can%20I%20author%20a%20progressWindow%20context%20manager%3F%5D%5D
I use this all the time, and sounds like even the example code could get 
you what you're after, since it iterates over a frame range.

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/4be104b4-a85e-4d7c-b28a-0cfd4911d4a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Any Python IDE that works similar to Maya's script editor?

2015-06-10 Thread AK Eric
I use Wing, like Joe mentioned above.  I have a # of examples showing how 
you can use it as a Script Editor replacement:  Highlight code in it, it 
executes in Maya, just like the Script Editor, either mel or Python.  A 
'very live' coding environment.  Same functionality as the SE, + s much 
more:
http://mayamel.tiddlyspot.com/#%5B%5BInteraction%20between%20Wing%20and%20Maya%5D%5D

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/cb4a28f9-5146-48df-9ddf-3e370326c925%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Scripts and Management

2015-10-24 Thread AK Eric
tl;dnr this whole thread.  But you'd need to:

import SuperScript.myModule
SuperScript.myModule.myFunc()

That's executing the myFunc function in the my myModule.py module living 
under /SuperScript dir.
x:/../../pythonscripts/SuperScript/myModule.py

Generally, I don't often put any code in the __init__.py  (I do 
occasionally for very specific reasons).  In general they're just there to 
get your package paths setup right, so you can import everything correctly 
without any fuss.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/c0949574-6c1c-43a8-9429-263e5b5b1649%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Convert GPU cache back to mesh?

2015-10-29 Thread AK Eric
Just exported some high-res scan mesh via the GPU Cache menu, then had a 
modeler import that back into their scene as a GPU cache for modeling 
reference.

They moved it in worldspace, and now want to to 'turn it back into normal 
(editable) mesh' at that new location.  I figured this would be a 
no-brainer, but I can't find any menu to do this.  

Am I missing something? :)

thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/14351e92-2404-438a-af7f-51c77445f883%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: Convert GPU cache back to mesh?

2015-10-29 Thread AK Eric
That's great, thanks Roy:  Ironically I found a script someone here at work 
wrote that basically did the same thing ;)

On Thursday, October 29, 2015 at 3:03:46 PM UTC-7, Roy Nieterau wrote:
>
> I don't think that's a one-button thing.
>
> Try this:
>
> import maya.cmds as mc
>
> # Get selected leaf shapes (so we can filter to gpuCaches)
> selShapes = mc.ls(sl=1, dag=1, leaf=1, shapes=1, long=True)
>
> # Filter to gpuCache (doesn't work as one-liner above)
> gpuCacheShapes = mc.ls(selShapes, long=True, type='gpuCache')
>
> for gpuCacheShape in gpuCacheShapes:
> transform = mc.listRelatives(gpuCacheShape, parent=True, fullPath=True
> )[0]
> filepath = mc.getAttr(gpuCacheShape + '.cacheFileName')
> 
> # Import everything from filepath and reparent under the transform
> mc.AbcImport(filepath, mode="import", reparent=transform)
> 
> # Hide the original gpuCache shape?
> mc.setAttr(gpuCacheShape + '.visibility', 0)
> 
> #(Or delete it?)
>     #mc.delete(gpuCacheShape)
>
>
>
> On Thursday, October 29, 2015 at 9:34:45 PM UTC+1, AK Eric wrote:
>>
>> Just exported some high-res scan mesh via the GPU Cache menu, then had a 
>> modeler import that back into their scene as a GPU cache for modeling 
>> reference.
>>
>> They moved it in worldspace, and now want to to 'turn it back into normal 
>> (editable) mesh' at that new location.  I figured this would be a 
>> no-brainer, but I can't find any menu to do this.  
>>
>> Am I missing something? :)
>>
>> thanks
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/c2584280-89be-4826-ba01-6da0e3841199%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Integrating custom c++ code into Python scripted plugin?

2015-11-20 Thread AK Eric
Asking for an engineer, since this isn't something I've ever tried:

He wants to integrate some custom (non-Maya) c++ code into a Maya plugin. 
 I have experience doing scriptedPlugins in Python, but not c++ ones. 

Obviously if you make a c++ plugin it'd be easy to integrate this other 
code.  So the question is:  Can you call to custom c++ code from a Python 
scripted plugin?  Or wrapper it somehow... or ?

Any thoughts?

thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/f3be53da-1894-4b77-8645-f60d2d8d74cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: Integrating custom c++ code into Python scripted plugin?

2015-11-20 Thread AK Eric
Thanks everyone, I'll pass that along.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/f35f2163-476e-40c7-ba38-fc170f9a5da5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] AnimLayers pain

2016-03-25 Thread AK Eric
I've done something similar that has worked well:

curves = mc.ls(mc.listHistory(myNodes), type = 'animCurve')

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/e685377a-dc56-413a-ad82-7e83d06d8982%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: QStringListModel missing in PySide2?

2017-11-10 Thread AK Eric
Disregard, guess I had a typo in my code, this actually works:

from PySide2.QtGui import QStringListModel

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/2e2b261f-6773-4f08-86fa-4e7f2838f122%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-05-10 Thread AK Eric
Another great solution, thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/9c3a1378-c862-4987-a4f2-0e5412d217a8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] VertexConstraint

2018-05-21 Thread AK Eric
"Python as CPython implements it simply isn't multithreaded ;-) "

Right, I should have been more specific ;)

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/f7414e90-55b8-4635-904b-b2e0a2437ae4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] VertexConstraint

2018-05-20 Thread AK Eric
Having been in touch with the Autodesk devs directly, I no longer use *any 
*Python-base 
scripted-plugin-based *nodes *since Maya 2015 (Maya 2016 introduced the 
multithreaded evaluation graph):  Per discussion above, from 2016-on, 
they've confirmed (and I've seen first hand) they drop the evaluation graph 
back to a single thread during evaluation (which you can confirm for 
yourself by profiling the evaluation of your rig), based on Python's GIL : 
I still make scripted plugin based *commands*, they're fine.  But if you 
want a performant plugin-based *node*, you needs to be making it via the 
c++'s.  

BTW, this makes me personally sad since I love Python, but I completely 
understand the reason behind it: Python as Maya implements it simply isn't 
multithreaded.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/ce992caf-1964-4e7d-a96d-b126c8e5a923%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: Maya, Euler Rotation and Gimbal lock

2018-05-29 Thread AK Eric
I wouldn't say gimbal *lock *more as a function of how Euler rotations work 
within the gimbal system that constrains them:  You can have the exact same 
"heading" of the local axis between to objects, but they got there by 
rotating in completely opposite directions.  For example, one rotated with 
all positive values, and the other rotated with all negative values, but 
ultimately they keep rotating until they line up.  Or in your case, one 
rotated -122 on z, while the other spun all over the place to get to the 
same heading.  Both legit.

You said "identical rotation but difference rotate-value": I'd rephrase 
that:  "Identical *orientations *(meaning, same worldspace matrix values), 
but different rotate values"

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/f7d0b89f-0592-48fa-8126-0632e10f260e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Maya, Euler Rotation and Gimbal lock

2018-05-29 Thread AK Eric
If you're applying the same worldpsace matrix to two nodes, but they give 
different rot values yet have the same heading, I would infer that each of 
the nodes *parent's *have different orientations, and you're seeing that 
expressed as different rot values on the two nodes.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/81974ef1-1e32-4c49-aec0-083c070eb39a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Build Mesh from point cloud using MayaAPI

2018-01-09 Thread AK Eric
It's also worth noting you can call to meshlab on the commandline, via 
meshlabserver.  It has it's own internal convex hull filter that's super 
easy to use via the gui or commandline if as a saved filter script.  Some 
examples here:
https://www.mankier.com/1/meshlabserver

I have my own Python module that wrappers it's commandline usage callable 
from Maya, quite handy when needed.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/07859ceb-ec02-45ed-afbe-df7fb9332e7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] get scene data python

2018-02-09 Thread AK Eric
Revive this old thread:  I tried using the mayabinary module, and, I'm 
getting no love, just running the built in example.  It seems like the 
mayabinary reader actually expects an *iff *(image) file instead.

> python mayabinary.py metaTest.mb
> ValueError: The file "C:\temp\maya\metaTest.mb" is not a Maya IFF file.

If I then go into the code and disable that check, I get this error:
> ValueError: The file "metaTest.mb" is not a Maya file.

Anyone got that code working?


-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/428feaab-7ae0-49c6-b36e-a9aa3da60cf2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-02-12 Thread AK Eric
Thanks Alok & Marcus:  I tried that code and it does indeed work.  Nice job 
on the scenefile parser Marcus!

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/6c44d89c-d1c5-4c93-9ffa-d2466b6b9617%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] get scene data python

2018-02-09 Thread AK Eric
Thanks, I'll take a look at that too.  I'm on 2016, so yah, maybe the file 
format has changed since then.  This is actually related to another issue, 
I'll start a new thread for it.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/74e791c2-c84a-4fd6-a53c-abf5e1ec1f2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Tagging MB files with metadata

2018-02-09 Thread AK Eric
It would be of great use if I could (somehow) tag mb files with metadata 
that could be read at system level, never having to open the mb itself in 
Maya.

I already have a solution that will save out a json/xml next to the file 
whenever the users saves, with queryable info.  But this is lossy, can 
decouple from the file if it's ever moved, etc.

Being able to tag an actual mb with data would be great (in the same way 
you can say, check exif data on an image).

I've tried some examples doing this in Python with pickle, on both ma & mb 
files, but... it corrupts the files.  Ironically, I can store and retrieve 
metadata, it just wrecks everything else in the file :P

Maybe not possible.  But I thought I'd see if someone actually had a more 
elegant solution for this.

thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/3132cfc8-55bb-4bdc-b031-d47689b1a136%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-02-11 Thread AK Eric
Marcus:  MA not an option, so no comment blocks, but thanks, good idea.  
However, I like your idea of just writing data to somewhere on the server 
that corresponds to the Maya file in question.  That could be a legit 
answer.  not tagging the file with metadata itself, but the data isn't 
living next to the Maya file itself, which I find scary :P

Juan:  Your thought has merit, and technically I could do it with a 
pre-scene-open callback.  Would be worth a test to prove out, but it's a 
little scary that unless that callback fires, your scene is garbage.  
However, it does make for an interesting way to copy-protect in-house 
data

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/4485d4ba-a768-4116-a1da-87445e01da69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: Tagging MB files with metadata

2018-02-13 Thread AK Eric
Right on, credit :)

FYI, I figured out you can use cpickle.dumps to embed arbitrary python data 
straight into the value of fileInfo, allowing you to query it outside of 
Maya, powerful.

However, on large files (200+megs) it can still take a good 20 seconds to 
parse.  I may end up just storing all this data to a folder on a server for 
easy/fast lookup, but it was still a fun exercise.  Thanks for the help 
everyone.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/563ef7ef-a5a4-4007-aa2d-f978cf569aff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: change Renderable Camera ?

2018-02-10 Thread AK Eric
When I can't figure these out, I save one version of the file as an ma, 
then make the change and save a different version as an ma, then diff the 
files:  This usually exposes the setAttr line that does the change, and 
you'er good to go.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/6a561dd9-24c6-4795-a423-307ecf0100f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: control for colorpicker: color ring or spectrum

2018-02-19 Thread AK Eric
Have you tried the colorEditor command?  The results of the selection can 
be easily queried in rgb(+a) and hsv.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/c4791c25-e42a-408e-b59d-24018fe9f62e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Re: PyQt5 maya 2018 tutorials/information

2018-03-06 Thread AK Eric
I recently had to port all our stuff to support both PySide *&* PySide2, 
ugh.  Since this thread is along those lines, this is the solution I came 
up with at the top of my modules since we have multiple versions of Maya 
running:

Simple example import section:

> import maya.cmds as mc
> MAYA_VER = int(mc.about(version=True))
> if MAYA_VER <= 2016:
> from PySide.QtGui import QWidget, QMainWindow, QDialog, 
> QAbstractButton, QIcon
> from shiboken import wrapInstance
> import pysideuic
> else:
> from PySide2.QtGui import QIcon
> from PySide2.QtWidgets import QWidget, QMainWindow, QDialog, 
> QAbstractButton
> from shiboken2 import wrapInstance
> import pyside2uic as pysideuic


To make my life easier (similar to what Marcus said above) trying to figure 
out where the classes moved, I'd have these three tabs open:
http://doc.qt.io/qt-5/qtwidgets-module.html
http://doc.qt.io/qt-5/qtcore-module.html
http://doc.qt.io/qt-5/qtgui-module.html

So I'd select some class name, like 'QIcon', then do a search on each page 
looking for it:  That would quickly tell me which new qt5 module it lived 
in for those style imports.
Boy I can't wait util qt6! ;)

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/eb9f0cb8-63f0-411a-8a67-60e3fa339cf5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Maya 'thin client' startup times?

2018-02-28 Thread AK Eric
We're researching using a Maya 'thin client' distro:  Running Maya off a 
server instead of standalone installs.  I'm tired of finding out someone is 
3 versions behind (or never installed the updates / patches) and *that's* why 
they're having so many bugs...

The only major problem we've hit is startup times:  Maya 2016 will have the 
UI launch in around 20 seconds, and it's fully usable in 30 (stops being 
herky-jerky in the perspective view).

But the thinclient takes 45 sec for the UI to launch, and remains super 
herky-jerky for *another minute*:  Basically, unusable for about 1:45 from 
launch.  

It's even more polarizing in batch mode:  Standalone Maya will boot and be 
usable in 7 seconds. But the thin client still takes a min thirty.  Ouch.

 IT has been trying to tune the server, but for all I know this is what one 
should expect... or not: Would appreciate anyone's thoughts on this that 
has a similar setup.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/6f4d0368-6526-449c-b40b-bc2fb14ebc59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Maya 'thin client' startup times?

2018-02-28 Thread AK Eric
The first one: "serving Maya from a network filesystem mount and running it 
as a local user process".

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/bae8169d-2616-460a-ac4d-44855e565fd6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: Is there a way of adding dict as an extra attribute to objects?

2018-03-02 Thread AK Eric
Indeed there is:  Python comes with the cPickle module, that lets you 
serialize any builtin Python data to disk.  It has a dump method that does 
that writing to your filesystem, but it also had a dumps (dump string) that 
writes it as a string.

In Maya, you can make string attrs on your nodes...

pseudo code, not directly tested but you get the idea

import cPickle

data = {"a":1, "b":2}
stringData = cPickle.dumps(data)

# Add a custom string attr to your node and:
mc.setAttr("myObj.stringAttr", stringData, type='string')

# Then later to query it:
stringAttrData = str(mc.getAttr("myObj.stringAttr"))
loadedData = cPickle.loads(stringAttrData)

print loadedData
{"a":1, "b":2}

I do this *all* the time to just get away from having to deal with Maya's 
own attr types.  So much more flexibility in data storage on Maya nodes.




-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/882c27f4-2c59-4019-bd88-bbb802d9cadd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: skin weight values

2018-10-03 Thread AK Eric
It's non trivial (since Maya has nothing built in to do this), but you find 
the 3 verts closest to your point, and their weights.  If the point isn't 
exactly on that tri the 3 verts define, you need to use the vector maths to 
project it down to that plane.  You can then use some (roll your own) 
barrycentric coordinate math to figure out what that interpolated value 
is.  No example code since it's proprietary, but that's how I do it.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/ad33ff4a-c1f9-4334-a7f4-0c0d50799360%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: Robust tools for skin weight export/import

2019-06-24 Thread AK Eric
Thanks Harshad, I'll give it a look!

On Sunday, June 23, 2019 at 8:20:27 PM UTC-7, HarshadB wrote:
>
> I feel ngSkinTools is more of a painting weights toolset plugin than a 
> full-fledged tool to handle import/export skin-weights at a production 
> level. It's more of a user tool than a pipeline tool. Yes, it would be very 
> convenient to have a function to select the joints in the exported file, 
> that is true, but it still does a decent job the way it is by design. The 
> next major version in future would be awesome I presume.
>
> You can look at mGear Rigging Framework. It does have pretty stable 
> skin-weights import/export tools built in.
>
> -H
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/e4b6f1c6-313b-45b2-894e-6821750fd5c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Best way to check if current panel is viewport

2019-06-24 Thread AK Eric
I've used this for a looong time:

import maya.cmds as mc
modelPanel = mc.playblast(activeEditor=True)

That's it:  The playblast command always knows the last active panel it 
could use, so querying that has always worked for me.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/4f718022-a3b4-4ea0-903d-384c06e04209%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: Is there a way to return selected objects in Mayas Shape editor?

2019-06-24 Thread AK Eric
Yep, it's not "obvious".   My notes are here:
http://mayamel.tiddlyspot.com/#%5B%5BHow%20can%20I%20query%20what%20is%20highlighted%20in%20the%20Shape%20Editor%3F%5D%5D

I use pymel simply because it makes optionVars convenient.
Snip:

import pymel.core as pm
selData = [item for item in 
pm.optionVar["blendShapeEditorTreeViewSelection"] if item][0].split("/")
bsIndices = []
for item in selData:
if not item:
continue
bsNode, index = item.split(".")
bsIndices.append((bsNode, int(index)))

print bsIndices
[(u'blendA', 0), (u'blendA', 1), (u'blendA', 2), (u'blendB', 0)]

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/bb502a46-82aa-4ff5-8fc3-b1667a8e6aaf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: Robust tools for skin weight export/import

2019-06-24 Thread AK Eric
I got mGear in and working, thanks @HarshadB : I found the api docs online, 
and the source, but is there any sort of overview on how the skinning 
import\export works?
By default (at least via the ui), it seems to only import if the vert count 
matches, which is pretty limiting.  Appreciate the info though.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/048efec2-1351-49ed-8100-61611430b18f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: calling mel script from python

2019-06-25 Thread AK Eric
In general it's bad form to require a source of a mel script to trigger 
execution.  If you make a global mel proc in the script with the same name 
as the script, you can just do:
mel.eval("test");
And that will execute it.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/7201a00b-a28d-4415-b6e2-3a71263ff8b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Robust tools for skin weight export/import

2019-06-20 Thread AK Eric
I've recently changed companies and starting something from scratch.  One 
of the tools I need (and we had before) is a bulletproof solution for skin 
weight export/import.  I'm a bit out of touch with what's out there in the 
community since I've not had to look into this for years.  Maya's built-in 
solutions are sorely lacking when used on any sort of complex asset.  

Are there any off-the-shelf tools available ($ is fine) that people would 
recommend?

I've been looking at ngSkinTools, but it's export\import step seems pretty 
clunky as well.  As in, you can't import weights unless the mesh is already 
skinned, which sort of defeats the purpose.  I could introspect the json 
weight files and pre-skin the assets based on my own wrapper code, but... 
if I paid for it why should I have to do it?  I figured *someone* by now 
has solved this problem and is trying to profit from it.

Any other suggestions?  Much appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/6e771d5c-c45d-49db-9fad-9141c68c1495%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: Robust tools for skin weight export/import

2019-06-21 Thread AK Eric
Thanks for that Andrew!  The ngSkinTools dev got back with me as well with 
a similar solution, although it still crashes, sigh.  

I'm going to continue to investigate the ngSkinTools API, but am still open 
to other solutions as well.

On Friday, June 21, 2019 at 12:53:06 PM UTC-7, Andres Weber wrote:
>
> Funny enough I actually have written those helper scripts since it was 
> pretty simple as their JSON files are quite well formatted.  Honestly I 
> never really looked further than ngSkinTools as they're the most complete 
> and functional skinning toolset I've come across and used for many years.  
> Apologies as this is quite old code and not very well structured:
>
> import json
> import maya.cmds as mc
>
> def copy_bind_from_ng_file(file):
> """ Copies skinCluster from ngSkinTools JSON file to make the same 
> skinCluster before importing weights.
> Args:
> file (str): file...
> Returns [str]: list of influences that we used to build the skinCluster
> Usage:
> 
> copy_bind_from_ng_file('path_to_your_ng_skin_tools_weights_file.json')
> """
> influences = []
> missing_influences = []
>
> with open(file) as f:
> data = f.read()
> json_data = json.loads(data)
> f.close()
>
> for value in json_data['influences']:
> influence = json_data['influences'][value]['path'].split('|')[-1]
> if mc.objExists(influence):
> influences.append(influence)
> else:
> missing_influences.append(influence)
> 
> if missing_influences:
> print 'Missing Influences from your file: 
> \n{}'.format(missing_influences)
>
> result = cmds.confirmDialog(b=['OK','CANCEL'], m='You have %d missing 
> influences...continue adding skin cluster from file with %d influences?' % 
> (len(missing_influences), len(influences)))
>
> if result == 'OK':
> mc.skinCluster(influences, mc.ls(sl=True)[0], tsb=True)
>
> return influences
>
>
>
>
> On Thursday, June 20, 2019 at 6:34:29 PM UTC-4, AK Eric wrote:
>>
>> I've recently changed companies and starting something from scratch.  One 
>> of the tools I need (and we had before) is a bulletproof solution for skin 
>> weight export/import.  I'm a bit out of touch with what's out there in the 
>> community since I've not had to look into this for years.  Maya's built-in 
>> solutions are sorely lacking when used on any sort of complex asset.  
>>
>> Are there any off-the-shelf tools available ($ is fine) that people would 
>> recommend?
>>
>> I've been looking at ngSkinTools, but it's export\import step seems 
>> pretty clunky as well.  As in, you can't import weights unless the mesh is 
>> already skinned, which sort of defeats the purpose.  I could introspect the 
>> json weight files and pre-skin the assets based on my own wrapper code, 
>> but... if I paid for it why should I have to do it?  I figured *someone* by 
>> now has solved this problem and is trying to profit from it.
>>
>> Any other suggestions?  Much appreciated.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/089b94d8-afa3-46bf-9605-3981b38919cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Maya-Python] Re: Robust tools for skin weight export/import

2019-06-27 Thread AK Eric
Thanks for the info:  I've used deformerWeights successfully, but (like you 
mentioned) it still requires a large amount of wrapper code to make it 
functional in a real pipeline.  Which I'll probably end up writing myself 
if I can't find anything off the shelf ;)

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/9f3fb504-3f83-4689-8396-79360218b620%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Maya-Python] Desperately trying to run matplotlib

2021-09-18 Thread AK Eric
FWIW, I've always had trouble using pip to install python packages in 
Python 2.7.  I'm now on 2022 / Python 3.7 now, and installing packages via 
pip amazingly, 'just works'.  I can install matplotlib, numpy, scipy, 
pandas, tensorflow, etc, all just via pip.

Run shell as admin and:
> "C:\Program Files\Autodesk\Maya2022\bin\mayapy.exe" -m pip install 
matplotlib --target "C:\some\optional\custom\path\if\you\want\site-packages"

Autodesk themselves have updated their docs with this info:
https://help.autodesk.com/view/MAYAUL/2022/ENU/?guid=GUID-72A245EC-CDB4-46AB-BEE0-4BBBF9791627

Now, this won't help you if you're *still on Python 2.7* : Just calling out 
that there 'is hope', somewhere in the future, once you move to Python 3.

On Monday, May 24, 2021 at 1:51:56 PM UTC-7 justin hidair wrote:

> Re, unfortunately those env variables are not discarding vs2008 
> tried as admin, tried to restart , tried powershell as well 
> it's as if nothing happened at all, quite frustrating honestly 
>
> >  I don't have much experience compiling on windows so maybe a windows 
> user will recognize the fix. 
>
> man you're blessed not to have to deal with such bullsh*t
>
> On Monday, May 24, 2021 at 9:07:15 PM UTC+2 justin hidair wrote:
>
>> thank you guys going to try all the suggestions 
>> but wouldn't it make sense to have the same MSVC version as the one they 
>> built their  python with ? 
>>
>> [image: cmd_uw6R7GsUGh.png]
>>
>> this is visual studio 2015 here not 2017, so ??? 
>> but yeah let's go on with the rest of the suggestions first 
>>
>> On Monday, May 24, 2021 at 8:00:17 PM UTC+2 justin...@gmail.com wrote:
>>
>>>
>>>
>>> On Tue, 25 May 2021, 5:41 am justin hidair,  wrote:
>>>
 here's the best I managed 
 https://gist.github.com/yetigit/c2f55bdb8b1798b2936687567f9c6c1e
>>>
>>>
>>>
>>> Looks like maybe the wrong Visual Studio C++ compiler for Maya 2020? In 
>>> addition to C++being difficult to build, combining that with Maya on 
>>> Windows is even harder. 
>>> I don't have much experience compiling on windows so maybe a windows 
>>> user will recognize the fix. 
>>> A quick look shows that Maya 2020 says it uses Visual Studio C++ 2017. 
>>>
>>>

 On Monday, May 24, 2021 at 1:59:52 PM UTC+2 Marcus Ottosson wrote:

> Could you post some of those error messages? Maybe someone here 
> recognises and could help resolve those.
>
> I don’t think there’s a silver bullet, each library build has its 
> quirks and challenges despite the community trying to adhere to standards 
> there are like massive disparities on how easy it is to build something 
> versus how confusing and annoying it is to build another 
>
> I think we’ve got C and C++ to thank for this haha. Or rather, thank 
> Python for shielding us from the horrors of compiled software out there, 
> it’s hard to understate how much more accessible it makes programming for 
> this benefit alone. I bet anyone dabbling with C++ can attest to the pain 
> and recurrence of dependencies in everyday life. For a modern example, 
> just 
> look at USD!
>
> That said, it’s certainly possible. One clue might be looking at how 
> the native Python packages are built for matplotlib.
>
>- 
>
> https://github.com/matplotlib/matplotlib/blob/master/.github/workflows/cibuildwheel.yml
>  
>
> The curveball Maya throws at you is that most build scripts out there 
> assume a system-wide install of Python, and makes hardcoded assumptions 
> about where to find libraries and headers. In a CI environment like that, 
> it wouldn’t be unreasonable to mount Maya’s files over the native ones, 
> to 
> trick such build scripts into using the proper ones.
>
> On Mon, 24 May 2021 at 12:15, justin hidair  
> wrote:
>
>> re, yes forgot to mention my attempts at compiling it were made with 
>> mayapy.exe, still failed with opaque error messages
>>
>> I don't think there's a silver bullet, each library build has its 
>> quirks and challenges despite the community trying to adhere to standards
>> there are like massive disparities on how easy it is to build 
>> something versus how confusing and annoying it is to build another 
>>
>> On Monday, May 24, 2021 at 9:41:44 AM UTC+2 Marcus Ottosson wrote:
>>
>>> This topic is so common it really needs to be highlighted somewhere. 
>>> Maybe as a new Maya splash screen? xD
>>>
>>> [image: notcompatible]
>>>
>>> The problem though is that many packages *are* compatible, it’s 
>>> only the compiled packages that are not. So it’s understandable that it 
>>> keeps getting confused. Can only imagine the number of hours lost 
>>> trying to 
>>> shoehorn PyPI into Maya, and the subsequent number of hours struggling 
>>> with 
>>> random crashes due to *suceeding* to shoehorn it in; when it seems 
>>> 

Re: [Maya-Python] New Maya skin weight export/import tool: Skinner

2021-12-07 Thread AK Eric
Thanks for the feedback Marcus, and totally agree.  It's 'on the list' in 
my 'copious spare time' ;)  Hopefully I can eventually get some video 
tutorials etc.  But hey, it's free, and you get what you pay for :P 

But to your point above, it's not the same thing as ngSkinTools:  That (as 
you're aware, but for anyone else) helps you paint weights, but it's 
save/load functionality is extremely limited (last I checked, I did reach 
out to the author).  This tool fills in that save/load import/export part 
of your skin weight pipeline.

On Thursday, December 2, 2021 at 12:03:46 AM UTC-8 Marcus Ottosson wrote:

> Congrats on making it to a public release, that stuff is hard!
>
> I was typing up a few questions, especially on comparisons with 
> ngSkinTools, but as I did I came across the answers in your README already. 
> :D My one suggestion would be to include a gif near the top of your README, 
> using your tool in the way it was intended on some example asset. That can 
> help communicate the idea more quickly and helps it stand out amongst the 
> vast ocean of plain-text READMEs on GitHub already. Even taking one of 
> those screenshots in the middle and putting it front and center would help.
>
> Best,
> Marcus
>
> On Thu, 2 Dec 2021 at 03:21, AK Eric  wrote:
>
>> After two years of working on it in my spare time, I'm releasing my 
>> custom skin weight import/export tool free to the public. Happy Holidays.
>>
>> https://github.com/AKEric/skinner
>>
>> Having built holistic art -> engine pipelines for multiple studios 
>> (Visceral/EA, Sledgehammer Games/Activision, 31st Union/2K), part of which 
>> include fully procedural rigging solutions, one of the biggest areas that 
>> is missing in that pipeline-subset is a solid/repeatable skin weight 
>> export/import process in Maya.
>>
>> The tools that Maya provides lack features (and can be slow), and there 
>> isn't anything I could find (free or $paid$) that had the feature-set I 
>> wanted/needed.
>>
>> This tool aims to alleviate *any* issues for the techart team regardless 
>> of industry. It is in-use and proven in AAA game production.
>>
>> I welcome any thoughts/feedback/improvements you have via the github.
>>
>> I should call out this requires Python 3 + numpy & scipi : the docs 
>> explain how to easily install these dependencies on Maya 2022+
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to python_inside_m...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/python_inside_maya/d6a29d0a-647e-4c3a-8ea1-de1f78de766an%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/python_inside_maya/d6a29d0a-647e-4c3a-8ea1-de1f78de766an%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/4beb9a27-2b20-45ae-9e73-3ad19bdfb84cn%40googlegroups.com.


[Maya-Python] New Maya skin weight export/import tool: Skinner

2021-12-01 Thread AK Eric


After two years of working on it in my spare time, I'm releasing my custom 
skin weight import/export tool free to the public. Happy Holidays.

https://github.com/AKEric/skinner

Having built holistic art -> engine pipelines for multiple studios 
(Visceral/EA, Sledgehammer Games/Activision, 31st Union/2K), part of which 
include fully procedural rigging solutions, one of the biggest areas that 
is missing in that pipeline-subset is a solid/repeatable skin weight 
export/import process in Maya.

The tools that Maya provides lack features (and can be slow), and there 
isn't anything I could find (free or $paid$) that had the feature-set I 
wanted/needed.

This tool aims to alleviate *any* issues for the techart team regardless of 
industry. It is in-use and proven in AAA game production.

I welcome any thoughts/feedback/improvements you have via the github.

I should call out this requires Python 3 + numpy & scipi : the docs explain 
how to easily install these dependencies on Maya 2022+

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/d6a29d0a-647e-4c3a-8ea1-de1f78de766an%40googlegroups.com.


Re: [Maya-Python] New Maya skin weight export/import tool: Skinner

2023-02-05 Thread AK Eric


PyArmor is becoming to difficult to work with, and their support is... not 
good.

I'd rather people use this tool successfully : I've just pushed the whole 
open source codebase with the latest package.

But I'd still appreciate tips for it's usage.  For those interested, please 
see here : https://github.com/AKEric/skinner#donate-for-usage

On Wednesday, January 25, 2023 at 4:13:33 PM UTC-8 AK Eric wrote:

> Per
> "This would be my guess as well; there likely needs to be a version of 
> Skinner for each version of Maya, possibly per platform."
>
> That's the sinking suspicion I am having. Which makes PyArmor basically 
> useless as a distribution tool.  I don't have a linux/Mac box, nor do I 
> want to maintain x# versions of Maya at the same time + have to reobfuscate 
> this bleh.
>
> I'm waiting to hear back from the devs on this.
>
> The recent version I obfuscated is on the current beta, which is 
> technically... 2024(?) 
>
> "why so hard", lol
>
> On Tue, Jan 24, 2023 at 6:20 AM Dag Isaksson  wrote:
>
>> Oh, and I'm using Windows 10 and Maya 2023
>>
>> tisdag 24 januari 2023 kl. 15:18:48 UTC+1 skrev Dag Isaksson:
>>
>>> Thank you!
>>> Yes, that fixes the problem. 
>>>
>>> söndag 22 januari 2023 kl. 00:21:29 UTC+1 skrev AK Eric:
>>> I've reobfuscated the modules and made a new release:
>>> https://github.com/AKEric/skinner/releases/tag/Reobfuscate
>>>
>>> See if that fixes the bug?  I have my doubts, but since I can't repro 
>>> it, it's hard to test/fix.
>>>
>>> On Sat, Jan 21, 2023 at 3:02 PM Eric Pavey  wrote:
>>> The 'Marshal loads failed' is the key : This is a bug that some people 
>>> get, but others (including myself) don't.  I know this tool is in use 
>>> across multiple studios in their pipelines, so I have yet to track down why 
>>> for some people it fails.
>>>
>>> I *think *it has to do with how the code is obfuscated by pyarmor, 
>>> since I don't use the marshal module in any of my code, but pyarmor does.  
>>>  I've tested it on Windows 10, Maya 2022, 2023, 2024.
>>>
>>> Can you let me know what version of Maya you're on, and what version of 
>>> Windows?
>>>
>>> On Sat, Jan 21, 2023 at 2:00 AM Dag Isaksson  
>>> wrote:
>>> Hi. I just found this. Looks great. A big thanks for releasing it to the 
>>> public.
>>> unfortunately I can't get it to start. Not sure where I'm doing wrong.
>>> I put the skinner folder in my python path, I installed numpy and scipy, 
>>> but they were installed to where I have Python 3.9 Standalone as can be 
>>> seen.
>>>
>>> [image: skinner.JPG]
>>>
>>> torsdag 16 juni 2022 kl. 02:30:58 UTC+2 skrev AK Eric:
>>> Not as is : I've always found UV space to be possibly buggy, since it's 
>>> easy to encounter bad models that have overlapping UV's, which would 
>>> invalidate the queried weight data.
>>>
>>> Not that it couldn't be a future improvement: I'll put it on the todo.
>>>
>>> On Tue, Jun 14, 2022 at 10:10 PM Arthur Na  wrote:
>>> Thank you so much for sharing this, This could be quite useful for us.
>>>
>>> Is there a way I can load weights in UV space?
>>>
>>> Thank you,
>>>
>>>
>>>
>>>
>>> On Tue, Dec 7, 2021 at 2:27 PM AK Eric  wrote:
>>> Thanks for the feedback Marcus, and totally agree.  It's 'on the list' 
>>> in my 'copious spare time' ;)  Hopefully I can eventually get some video 
>>> tutorials etc.  But hey, it's free, and you get what you pay for :P 
>>>
>>> But to your point above, it's not the same thing as ngSkinTools:  That 
>>> (as you're aware, but for anyone else) helps you paint weights, but it's 
>>> save/load functionality is extremely limited (last I checked, I did reach 
>>> out to the author).  This tool fills in that save/load import/export part 
>>> of your skin weight pipeline.
>>>
>>> On Thursday, December 2, 2021 at 12:03:46 AM UTC-8 Marcus Ottosson wrote:
>>> Congrats on making it to a public release, that stuff is hard!
>>>
>>> I was typing up a few questions, especially on comparisons with 
>>> ngSkinTools, but as I did I came across the answers in your README already. 
>>> :D My one suggestion would be to include a gif near the top of your README, 
>>> using your tool in the way it was intended on some example asset. That can 
>>> help communicate the idea more quickly and helps it stand out amongst the