Re: [Maya-Python] Hierarchy selection not in alphabetical order

2016-09-07 Thread Justin Israel
On Thu, Sep 8, 2016 at 12:32 PM likage wrote: > > The latter part have sorted out my result in alphabetical order. Is there > anyway in which I can still make use of the latter method but while > maintaining the output result to be the same as the first (non-alphabetical > order)? Is this possibl

[Maya-Python] Re: Hierarchy selection not in alphabetical order

2016-09-07 Thread likage
Just to add on, it will be like reading the selection from top-down, and I am using polygons as a very simple example 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 recei

[Maya-Python] Hierarchy selection not in alphabetical order

2016-09-07 Thread likage
For example, I have 5 polygons in my scene.. Individual pieces in the following hierarchy: - abs_geo - std_geo - nor_geo - stz_geo - poly_geo If I shift-select from the first node to the last node, abs_geo to poly_geo and I run the following line: cmds.ls(sl = True) # Result

Re: [Maya-Python] 'counter' versioning for object renaming not working

2016-09-07 Thread Justin Israel
On Thu, Sep 8, 2016 at 10:19 AM likage wrote: > I did not know that I can write it as {0:0>3}! Works like a charm! > For completeness, the equivalent in using the older string formatting approach would be: "abc_%03d" % number But using the format() method is the newer preferred approach. >

Re: [Maya-Python] Qt.py and .ui files

2016-09-07 Thread Justin Israel
On Thu, Sep 8, 2016 at 10:23 AM Marcus Ottosson wrote: > That's a good idea! > > I'm expecting this initial proposal to mostly get the conversation started > and iterate on it until all is well. Considering the source files are all > automatically generated by another program, I'm expecting a fin

Re: [Maya-Python] Qt.py and .ui files

2016-09-07 Thread Marcus Ottosson
That's a good idea! I'm expecting this initial proposal to mostly get the conversation started and iterate on it until all is well. Considering the source files are all automatically generated by another program, I'm expecting a finite set of edge cases. This does sound like one of them. But,

Re: [Maya-Python] 'counter' versioning for object renaming not working

2016-09-07 Thread likage
I did not know that I can write it as {0:0>3}! Works like a charm! On Wednesday, September 7, 2016 at 12:24:56 PM UTC-7, Justin Israel wrote: > > > > On Thu, 8 Sep 2016, 6:54 AM likage > > wrote: > >> I tried to tweak the code a bit so that it will register version padding >> - eg. abc_001, abc_

Re: [Maya-Python] Re: Is there a way to render by selected object in Python?

2016-09-07 Thread Wesley Keeling
Well I have a few 'hacks' for rendering the selected object, I would love to not use mel. *mel.eval('optionVar -intValue renderViewRenderSelectedObj 1;')* *mel.eval('renderWindowRender redoPreviousRender renderView;')* *mel.eval('prepareRender -invokePreRenderFrame;')* *mel.eval('prepareRender -in

Re: [Maya-Python] Qt.py and .ui files

2016-09-07 Thread Justin Israel
Hey Marcus, It's a cool goal that you are trying to make everyone's workflows more compatible and consistent. Keep it up. Quick question about the approach to providing the convert functionality... Do you think splitting the file on a '\n' and doing line-by-line string replacements is a viable ap

Re: [Maya-Python] Re: Is there a way to render by selected object in Python?

2016-09-07 Thread Wesley Keeling
It works when I call the eval, but it only works when I first manually render the scene after executing: *import maya.mel as mel* *mel.eval('int $var = 0; if( `optionVar -exists renderViewRenderSelectedObj` ) { $var = (! `optionVar -q renderViewRenderSelectedObj`); } optionVar -intValue renderViewR

[Maya-Python] Re: Is there a way to render by selected object in Python?

2016-09-07 Thread I73
Hey Andrew, thanks for the reply, and sorry for the late reply. So I am still not fully understanding what the render view is doing. Am I going to have to use mel.eval to call renderViewRenderSelectedObj? Or can I preform this in python? Or is there a better way to render out the selected objet

[Maya-Python] Qt.py and .ui files

2016-09-07 Thread Marcus Ottosson
Hi all, Many of you have been asking about working with ui files in a way maintains the cross-binding benefit of Qt.py. The problem has been that: - a) PySide and PyQt implement the in-memory loading mechanism loadUi() differently and - b) Files compiled via the command-line leave artif

Re: [Maya-Python] 'counter' versioning for object renaming not working

2016-09-07 Thread Justin Israel
On Thu, 8 Sep 2016, 6:54 AM likage wrote: > I tried to tweak the code a bit so that it will register version padding - > eg. abc_001, abc_002 where in my code I am using something like > uniqueNamePattern("abc_{0}{0}{0}") > > While it seems to work in a sense, I got abc_111, abc_222 instead... Al

Re: [Maya-Python] 'counter' versioning for object renaming not working

2016-09-07 Thread likage
I tried to tweak the code a bit so that it will register version padding - eg. abc_001, abc_002 where in my code I am using something like uniqueNamePattern("abc_{0}{0}{0}") While it seems to work in a sense, I got abc_111, abc_222 instead... Also I tried something like uniqueNamePattern("abc_

Re: [Maya-Python] Sphinx issues with OpenMaya?

2016-09-07 Thread Mark Jackson
looks like easy_install failed to pull down a missing module 'markupsafe' which seems to have fixed it. all building now. thanks guys, going to take a look at mock this week I think. On 7 September 2016 at 12:01, Marcus Ottosson wrote: > Mark, what does the actual command that you are running l

Re: [Maya-Python] Sphinx issues with OpenMaya?

2016-09-07 Thread Marcus Ottosson
Mark, what does the actual command that you are running look like that produces the error? On 7 September 2016 at 11:46, Mark Jackson wrote: > Thanks for all the replies guys, currently all our testing / unitTesting > all goes through nose and coverage, I keep thinking about moving some of > tha

Re: [Maya-Python] Sphinx issues with OpenMaya?

2016-09-07 Thread Mark Jackson
Thanks for all the replies guys, currently all our testing / unitTesting all goes through nose and coverage, I keep thinking about moving some of that to doctest side of things but thats all got side-lined for a while. Mock sounds like something I should be looking into, but I still can't get my h

Re: [Maya-Python] Sphinx issues with OpenMaya?

2016-09-07 Thread Marcus Ottosson
I also don't know what his code does precisely, but I wouldn't be so quick to dismiss. It's possible he has executable documentation; in which code snippets within his documentation are executed at build time to produce actual output, rather than hard-code it. That way he would also become notifie

Re: [Maya-Python] Sphinx issues with OpenMaya?

2016-09-07 Thread Christopher Crouzet
Yes, I did see this but I've got no idea what it refers to. I'd be curious to know what kind of “testing” code would have its place within a doc generation process? On 7 September 2016 at 17:25, Marcus Ottosson wrote: > > Marcus: I have no idea what this MetaData implementation refers to? > > H

Re: [Maya-Python] Sphinx issues with OpenMaya?

2016-09-07 Thread Marcus Ottosson
> Marcus: I have no idea what this MetaData implementation refers to? Hi Christopher, Mark was referring to this by name in the original question as one of the requirements for his document generation. For completeness, here it is again. > all our unitTests run fine and those all call the same M

Re: [Maya-Python] Sphinx issues with OpenMaya?

2016-09-07 Thread Christopher Crouzet
PS: the mock code isn't mine and I failed to credit the original author in my repository, so here it is for now: http://stackoverflow.com/a/23573376/1640404. I'll add the link in a future commit. On 7 September 2016 at 17:13, Christopher Crouzet < christopher.crou...@gmail.com> wrote: > Marcus:

Re: [Maya-Python] Sphinx issues with OpenMaya?

2016-09-07 Thread Christopher Crouzet
Marcus: I have no idea what this MetaData implementation refers to? Cesar: True but I personally like avoiding unnecessary external dependencies for such simple needs (the module `mock` is not part of `mayapy` which is Python 2). Otherwise it feels like coding in JavaScript using one line NPM modu

Re: [Maya-Python] Sphinx issues with OpenMaya?

2016-09-07 Thread Cesar Saez
No need to reinvent the wheel, there's a std/production proved mock module! (it's part of python3 std Library iirc). pip install mock You basically replace Maya entries on sys.modules by a MagicMock instance (check the docs for more info, there are convenience functions to do it and everything...

Re: [Maya-Python] Sphinx issues with OpenMaya?

2016-09-07 Thread Marcus Ottosson
He did say OpenMaya was needed for his MetaData implementation. But if not, I would also suggest stripping the dependency from your documentation generator. Mocking is one way of doing that. On 7 September 2016 at 10:52, Christopher Crouzet < christopher.crou...@gmail.com> wrote: > If it isn't t

Re: [Maya-Python] Sphinx issues with OpenMaya?

2016-09-07 Thread Christopher Crouzet
If it isn't the case already, I'd do as Cesar said—maybe there are better implementations but here's an example of “mocking” the Maya module for Sphinx: https://github.com/christophercrouzet/banana.maya/blob/master/doc/conf.py#L11 On 7 September 2016 at 16:46, Marcus Ottosson wrote: > Have a lo

Re: [Maya-Python] Sphinx issues with OpenMaya?

2016-09-07 Thread Marcus Ottosson
Have a look at trying to narrow it down to something reproducible. For example, delete half the pages of your Sphinx documentation, and see if it still breaks. Keep deleting half of half until you've got the smallest amount of lines that still throw the error. Then post the whole sequence of comma

Re: [Maya-Python] Sphinx issues with OpenMaya?

2016-09-07 Thread Mark Jackson
Yeah thats what I thought, but I grabbed everything via setuptools and everything is pathed up and using the correct interpreter. Like I mentioned the unitTests are all running so the environment should be fine else they'd bail also, or so I'd have thought. Not sure if it's a mismatch in the build

Re: [Maya-Python] Sphinx issues with OpenMaya?

2016-09-07 Thread Cesar Saez
Don't you mock Maya modules during docs generation? Sphinx most likely doesn't need anything from Maya other than being able to import your modules, I totally recommend to take a look at mock for these kind of things. Cheers -- You received this message because you are subscribed to the Google G

Re: [Maya-Python] Sphinx issues with OpenMaya?

2016-09-07 Thread Marcus Ottosson
DLL load failed errors are typically due to your Python version trying to load a module that wasn't compiled for it. Have a look in your environment for things like PySide/PyQt and that your Python actually running is `mayapy`. On 7 September 2016 at 09:31, Mark Jackson wrote: > Morning all, >

[Maya-Python] Sphinx issues with OpenMaya?

2016-09-07 Thread Mark Jackson
Morning all, I'm trying to get our API docs updated and to do so I've always run Sphinx to generate the docs but from an old laptop that was 32bit and running Maya2012. I'm trying to get the whole thing running again from 2016 but running into issues whenever the Sphinx build process hits OpenMay

[Maya-Python] Re: Find Ngons - How to optimize with OpenMaya?

2016-09-07 Thread Marcus Ottosson
For completeness and to not miss anything obvious, Side note: the script cannot select anything. I previously used a command to run the PolyCleanup tool. Although it finds NGons in a microsecond, it doesnt give me a list, it selects them. What about selecting, and running cmds.ls(selection=Tr