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 yo

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

2015-03-09 Thread Gerard v
Thanks for the tip Cesar. Iterating is bad habit from my Mel days I think. However the removal of duplicates is probably a good idea if Sam is going to extend this code to beyond just selection. Unless I am mistaken my tests show that if there are more than one nurbsCurve shape under a transform th

[Maya-Python] calling python from a c++ deformer fails when in Viewport 2.0

2015-03-09 Thread Michał Frątczak
Hi I have a c++ deformer node that calls a python function using: MString res = MGlobal::executePythonCommandStringResult(cmd); This has always been working fine with legacy viewport, but with VP2.0 it fails most of the time (not always) with the following error: # Traceback (most recent call

Re: [Maya-Python] Request-Response Inversion

2015-03-09 Thread Marcus Ottosson
Thanks Justin, having a look. Re zeromq: That would be good option, and also solve this problem before ever having it. I did run with it at first, but found distribution to be the killer here. The reason, by the way, for using Flask here is because it's already running as I'm using it for more th

Re: [Maya-Python] Request-Response Inversion

2015-03-09 Thread Tony Barbieri
If you have zeromq already installed and available, it's another option...possibly also heavy-handed compared to a PIPE. On Mon, Mar 9, 2015 at 4:12 PM, Justin Israel wrote: > Here is an example of communicating via stdin between the parent and child > process: > https://gist.github.com/justinfx

Re: [Maya-Python] Request-Response Inversion

2015-03-09 Thread Justin Israel
Here is an example of communicating via stdin between the parent and child process: https://gist.github.com/justinfx/b94fab9d1f056380cb28 You launch the parent, and it will launch the process, using a PIPE for stdin. The child then starts a thread and reads lines from stdin. The parent can communi

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

2015-03-09 Thread e9554564
wow, simple as that. thanks all for your help here! Sam -- 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...@g

Re: [Maya-Python] Request-Response Inversion

2015-03-09 Thread Marcus Ottosson
But flask is an extremely heavy handed approach to getting to processes talking on the same machine. That’s exactly what I’ve got, and can understand it’s heavy-handed. I did have a closer look at subprocess and pipes, but quickly remembered what my struggles were last time I tried. Maybe in time

Re: [Maya-Python] Request-Response Inversion

2015-03-09 Thread Justin Israel
My suggestion of sockets was a lighter weight suggestion than using flask to start an httpserver and route full requests between processes. Maybe I am missing something from that example. But flask is an extremely heavy handed approach to getting to processes talking on the same machine. Especiall

Re: [Maya-Python] Re: Pycharm DLL issues with run vs debug

2015-03-09 Thread Ben Hearn
No problem at all Marcus, thanks for the help thus far. If I manage to figure out what is going on I shall post up my answers :) On 9 March 2015 at 18:15, Marcus Ottosson wrote: > In that case my advice is no good, sorry. I can't say for sure what's > going on without know more about what PyChar

Re: [Maya-Python] Re: Pycharm DLL issues with run vs debug

2015-03-09 Thread Marcus Ottosson
In that case my advice is no good, sorry. I can't say for sure what's going on without know more about what PyCharm does in debug mode.​ -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and s

Re: [Maya-Python] Re: Pycharm DLL issues with run vs debug

2015-03-09 Thread Ben Hearn
No PyCharm is using the same C:\Python27\python.exe executable for both run and debug mode. I had a look at the conf file and it is the same as your conf file above. Should I have changed the location of the conf file to my project directory? On 9 March 2015 at 17:33, Marcus Ottosson wrote: > Ha

Re: [Maya-Python] Re: Pycharm DLL issues with run vs debug

2015-03-09 Thread Marcus Ottosson
Have a look within the qt.conf file, it’s a simple ConfigFile format (i.e. a .ini file). It should point to where the Qt binaries are; typically in your PyQt4 directory. If the paths are relative, and you move the file, then the resulting absolute paths will be bad. You can safely put in the absol

Re: [Maya-Python] Re: Pycharm DLL issues with run vs debug

2015-03-09 Thread Ben Hearn
Hello Marcus, I have removed my sys.path.append line and have left it as you have suggested. import sys import os import PyQt4 dirname = os.path.dirname(sys.executable) qtconf = os.path.join(dirname, "qt.conf") os.environ["PATH"] += ";" + os.path.dirname(PyQt4.__file__) print os.environ["PATH"]

Re: [Maya-Python] Re: Pycharm DLL issues with run vs debug

2015-03-09 Thread Marcus Ottosson
I have appended the PYTHONPATH using sys.path.append and have added the qtconf file as per Marcus’ answer Could you take me through what you did exactly? ​ and also: sys.path.append(‘C:\Python27\lib\site-packages\pyqt4’) I think you may have misunderstood me here, this is not the same as: os.e

Re: [Maya-Python] Re: Pycharm DLL issues with run vs debug

2015-03-09 Thread Ben Hearn
Yes Pycharm tries to download automatically from pypi. It it uses PyDev from eclipse to debug. I have appended the PYTHONPATH using sys.path.append and have added the qtconf file as per Marcus' answer and also: sys.path.append('C:\\Python27\\lib\\site-packages\\pyqt4') But I have had no luck as

Re: [Maya-Python] Request-Response Inversion

2015-03-09 Thread Marcus Ottosson
No problem, Justin. Also, I missed this. why not just use sockets?​ Sockets, as in starting another server within the client? Or are you referring to a more light-weight way of utilising sockets here? The weight of instantiating another server was one reason for not doing that initially. ​ --

Re: [Maya-Python] Request-Response Inversion

2015-03-09 Thread Justin Israel
Unfortunately I can't give a custom example at this moment, but you have a perfectly good stdin pipe that can be used in your subprocess Popen command. Just google how to use it in the meantime. You can write to stdin in the parent process and read from it in the child. It would be exactly like wh

Re: [Maya-Python] Request-Response Inversion

2015-03-09 Thread Marcus Ottosson
Sorry, that’s: >>> import subprocess>>> proc = subprocess.Popen(["python"], >>> creationflags=subprocess.CREATE_NEW_CONSOLE)>>> send_signal_somehow(proc) ​ On 9 March 2015 at 10:44, Marcus Ottosson wrote: > Ah, excellent. This is what I’ve been looking for​, I merely used this > inverse reque

Re: [Maya-Python] Request-Response Inversion

2015-03-09 Thread Marcus Ottosson
Ah, excellent. This is what I’ve been looking for​, I merely used this inverse request thing because I didn’t understand the alternatives well enough. If you own the child process, you can just use a pipe between them to communicate. I’ve seen this mentioned, read about it, attempted it, but neve

Re: [Maya-Python] Request-Response Inversion

2015-03-09 Thread Justin Israel
Does this mean the communication is taking place all on the same machine? If that is the case, why not just use sockets? Why the whole http server/client? I've used signals for specific things and you don't necessarily have to have launched or own the target process. In a certain daemon service I

Re: [Maya-Python] Request-Response Inversion

2015-03-09 Thread Marcus Ottosson
Cool, thanks. At the risk of going off topic, I was also looking into the signals standard library for this, as I’ve got a handle to the Popen instance of the client in this case. Have you, or anyone, had any experience in passing user-defined events across processes using signals?​ ​ -- You re

Re: [Maya-Python] Request-Response Inversion

2015-03-09 Thread Justin Israel
Then it sounds like the long polling solution should work just fine if you only need a one-off notification. On Mon, 9 Mar 2015 10:52 PM Marcus Ottosson wrote: > Thanks Justin, long-polling sounds like what this is. > > The specific problem is having a client receive a single notification from >

Re: [Maya-Python] Request-Response Inversion

2015-03-09 Thread Marcus Ottosson
Thanks Justin, long-polling sounds like what this is. The specific problem is having a client receive a single notification from the server, with as little effort as possible. There is no data involved, and the event will only happen once. Because of this, I'm looking for alternatives to more comp

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

2015-03-09 Thread Cesar Saez
Hi there, You don't really need to remove duplicates or get the parent in a list comprehension, maya cmds will deal with it anyways. The following code is basically the same you suggested, but should be much faster (way less maya calls). from maya import cmds crvs = cmds.ls(typ='nurbsCurve', ni=T

Re: [Maya-Python] Request-Response Inversion

2015-03-09 Thread Justin Israel
Can you explain a concrete problem you are trying to solve? Without a concrete problem, I am not sure where this would be specifically useful over other options. What this looks like at face-value is a long poll ( http://en.wikipedia.org/wiki/Push_technology). The standard http communication you o

Re: [Maya-Python] Request-Response Inversion

2015-03-09 Thread Marcus Ottosson
I’d like to you by you to hear what you think of it. That’s some literacy excellence, right there. :) ​ -- 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, se

[Maya-Python] Request-Response Inversion

2015-03-09 Thread Marcus Ottosson
Hi all, I’ve made somewhat of a hack that I’d like to you by you to hear what you think of it. In a nutshell, sending a request to a web-server is one way; you send, the server responds. It’s a “pull” relationthip. There’s *no way* to get the server to send any data to a client without it having