[Maya-Python] Re: Bug with MSyntax?

2009-06-02 Thread AK Eric
If I re-order the .addFlag's, whichever one is listed first won't be captured. So if I list the radius first, anything I pass in via -r or -radius simply won't be seen. if I list the .heightFlag first, same thing. It seems blatantly broken... but it also seems like maybe this is something

[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

[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:,

[Maya-Python] Re: what loadfile

2009-10-16 Thread AK Eric
import maya.cmds as mc mc.file(c:/mayaStuff/mayaFile.ma, force=True, type=mayaAscii, open=True) ? --~--~-~--~~~---~--~~ 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

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

2009-10-27 Thread AK Eric
Ah-hah! That's cool. So, I actually ran into a very similar problem on Monday: I was trying to use pickle to store objects built via functools.partial (which I suppose you could equate to a PyNode class instance in this case), but pickle said it couldn't do it, which was a bummer (no pickling

[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

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

2010-01-21 Thread AK Eric
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

[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

[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:

[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

[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

[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

[Maya-Python] Re: commandPort

2010-02-02 Thread AK Eric
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

[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

[Maya-Python] Re: commandPort

2010-02-06 Thread AK Eric
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

[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

[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):

[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

[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

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

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

[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

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

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

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

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

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

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

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

Re: [Maya-Python] Remove requires from within Maya?

2015-03-15 Thread AK Eric
So this is a *complete hack*, and just off the cuff, and presuming you tested it and it didn't mangle your scene: You could select all the top-level assemblies and do and export-selected on top of the same file. Sort of using a sledgehammer to do surgery, but if the patient lives I use

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

[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

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

[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

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

[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

[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

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

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

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

[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

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

2015-10-29 Thread AK Eric
t", 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 wrot

[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

[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.

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

[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,

[Maya-Python] QStringListModel missing in PySide2?

2017-11-10 Thread AK Eric
Updating my UI's for Maya 2018/PySide2. Everything's been humming along, until this: http://doc.qt.io/qt-5/qstringlistmodel.html from PySide2.QtCore import QStringListModel # Error: ImportError: file line 1: cannot import name QStringListModel # In PySide (1) this module lived in

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

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

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

[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

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

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

[Maya-Python] Re: Turn of "Use OCIO Input Color Space Rules"

2018-01-10 Thread AK Eric
I don't off hand, but usually these values are set as optionVar and saved in userPrefs.mel: What I do is, save a version of your userPrefs.mel, do the change & quit maya (or save prefs) so that it's updated again, then diff the files. You should see what optionVar changed, and thus giving you

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

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

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-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,

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

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

[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

[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

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-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

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,

[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