Re: 1/2 OT: Gorilla and a banana for Maya
In the lack of answer, I guess we shouldn't count too much on the future of the API 2.0 :) On 25 June 2014 11:33, Sebastien Sterling sebastien.sterl...@gmail.com wrote: A brave initiative Christopher, and thank you for laying it out plain for the less techsavvy, why are you using the maya python API 1.0 instead of 2.0 ? Why is Python API 2.0 not finished yet Luc Eric ? On 24 June 2014 17:31, Christopher Crouzet christopher.crou...@gmail.com wrote: When I initially patched the Maya Python API, it was with Maya 2010 and there was no API 2.0 back then. As of today, I didn't really think about my choice, I simply wanted to share the technique. That said, and remembering the state of the API 2.0, it could indeed have been the subject of the article/library but then I'm not sure if patching a yet unfinished API would be the wisest choice since it will have its gaps officially filled in over the releases, right? On 24 June 2014 12:12, Luc-Eric Rousseau luceri...@gmail.com wrote: why are you using the maya python API 1.0 instead of 2.0 ? -- Christopher Crouzet *http://christophercrouzet.com* http://christophercrouzet.com -- Christopher Crouzet *http://christophercrouzet.com* http://christophercrouzet.com
Re: 1/2 OT: Gorilla and a banana for Maya
:P On 29 June 2014 16:56, Christopher Crouzet christopher.crou...@gmail.com wrote: In the lack of answer, I guess we shouldn't count too much on the future of the API 2.0 :) On 25 June 2014 11:33, Sebastien Sterling sebastien.sterl...@gmail.com wrote: A brave initiative Christopher, and thank you for laying it out plain for the less techsavvy, why are you using the maya python API 1.0 instead of 2.0 ? Why is Python API 2.0 not finished yet Luc Eric ? On 24 June 2014 17:31, Christopher Crouzet christopher.crou...@gmail.com wrote: When I initially patched the Maya Python API, it was with Maya 2010 and there was no API 2.0 back then. As of today, I didn't really think about my choice, I simply wanted to share the technique. That said, and remembering the state of the API 2.0, it could indeed have been the subject of the article/library but then I'm not sure if patching a yet unfinished API would be the wisest choice since it will have its gaps officially filled in over the releases, right? On 24 June 2014 12:12, Luc-Eric Rousseau luceri...@gmail.com wrote: why are you using the maya python API 1.0 instead of 2.0 ? -- Christopher Crouzet *http://christophercrouzet.com* http://christophercrouzet.com -- Christopher Crouzet *http://christophercrouzet.com* http://christophercrouzet.com
Re: 1/2 OT: Gorilla and a banana for Maya
A brave initiative Christopher, and thank you for laying it out plain for the less techsavvy, why are you using the maya python API 1.0 instead of 2.0 ? Why is Python API 2.0 not finished yet Luc Eric ? On 24 June 2014 17:31, Christopher Crouzet christopher.crou...@gmail.com wrote: When I initially patched the Maya Python API, it was with Maya 2010 and there was no API 2.0 back then. As of today, I didn't really think about my choice, I simply wanted to share the technique. That said, and remembering the state of the API 2.0, it could indeed have been the subject of the article/library but then I'm not sure if patching a yet unfinished API would be the wisest choice since it will have its gaps officially filled in over the releases, right? On 24 June 2014 12:12, Luc-Eric Rousseau luceri...@gmail.com wrote: why are you using the maya python API 1.0 instead of 2.0 ? -- Christopher Crouzet *http://christophercrouzet.com* http://christophercrouzet.com
Re: 1/2 OT: Gorilla and a banana for Maya
Cheers Sebastien! Here's a small follow up for the few that it might interest: Why I'm Not Using the MEL and the Python Commands Layers of Maya http://christophercrouzet.com/blog/post/2014/06/25/Why-I-m-Not-Using-the-MEL-and-the-Python-Commands-Layers-of-Maya On 25 June 2014 11:33, Sebastien Sterling sebastien.sterl...@gmail.com wrote: A brave initiative Christopher, and thank you for laying it out plain for the less techsavvy, why are you using the maya python API 1.0 instead of 2.0 ? Why is Python API 2.0 not finished yet Luc Eric ? On 24 June 2014 17:31, Christopher Crouzet christopher.crou...@gmail.com wrote: When I initially patched the Maya Python API, it was with Maya 2010 and there was no API 2.0 back then. As of today, I didn't really think about my choice, I simply wanted to share the technique. That said, and remembering the state of the API 2.0, it could indeed have been the subject of the article/library but then I'm not sure if patching a yet unfinished API would be the wisest choice since it will have its gaps officially filled in over the releases, right? On 24 June 2014 12:12, Luc-Eric Rousseau luceri...@gmail.com wrote: why are you using the maya python API 1.0 instead of 2.0 ? -- Christopher Crouzet *http://christophercrouzet.com* http://christophercrouzet.com -- Christopher Crouzet *http://christophercrouzet.com* http://christophercrouzet.com
Re: 1/2 OT: Gorilla and a banana for Maya
why are you using the maya python API 1.0 instead of 2.0 ?
Re: 1/2 OT: Gorilla and a banana for Maya
When I initially patched the Maya Python API, it was with Maya 2010 and there was no API 2.0 back then. As of today, I didn't really think about my choice, I simply wanted to share the technique. That said, and remembering the state of the API 2.0, it could indeed have been the subject of the article/library but then I'm not sure if patching a yet unfinished API would be the wisest choice since it will have its gaps officially filled in over the releases, right? On 24 June 2014 12:12, Luc-Eric Rousseau luceri...@gmail.com wrote: why are you using the maya python API 1.0 instead of 2.0 ? -- Christopher Crouzet *http://christophercrouzet.com* http://christophercrouzet.com
1/2 OT: Gorilla and a banana for Maya
Hey gang, as promised in a previous post, I've finished writing an article about how to monkey patch external libraries in Python while using the Maya Python API as a guinea pig. It took me a bit longer than planned because I also decided to build a couple of open source libraries on that matter. You can find the article and all the information over there: From Monkey Patching the Maya Python API to Gorilla and Bananas http://christophercrouzet.com/blog/post/2014/06/23/From-Monkey-Patching-the-Maya-Python-API-to-Gorilla-and-Bananas . And here's a short(er) version: Monkey patching allows you to modify an existing 3rd-party library by inserting some code of yours. Once the process is done, you can call the extensions you've inserted as if they have always been part of that 3rd-party library. The article uses Maya as a playground but the technique can definitely be applied to about anything, which is what the library Gorilla https://github.com/christophercrouzet/gorilla is all about. You write your functions, classes, methods, properties, whatever, you tell them the target to patch with the help of a Python decorator, and that's about it. You can find more details in the documentation http://gorilla.readthedocs.org/. As a proof of concept for this project, I've developed a couple of extensions for the Maya Python API. Say hi to Banana for Maya https://github.com/christophercrouzet/banana.maya. This basically shows that extending the API can be as simple as: @gorilla.patch(OpenMaya.MFnTransform) def whoAmI(self): print(My name is %s % self.name()) Which allows you to fire the method through a call to ` OpenMaya.MFnTransform.whoAmI()`. As for the extensions already in there, there's a shiny documentation http://bananamaya.readthedocs.org/ for this one too. Once again the `banana.maya` package is only a proof of concept, which is why it's a bit empty. I've started to implement some methods that could hopefully be useful to everyone (mainly retrieving/iterating through the nodes in the scene) but I'm currently not using Maya anymore and don't have any direct interest in developing those extensions much further. The exception being if there's a need for it and if discussions can be organized to implement the right features. Note that I'm not saying that monkey patching the Maya Python API v1.0 is the way to go and I acknowledge that there's better alternatives out there for most cases. That's about it. The code is yours, do what you want with it. Cheers, Christopher. PS: Raff, I hope you'll appreciate the lack of vast sidereal space in-between each statement that you've known me for :) -- Christopher Crouzet *http://christophercrouzet.com* http://christophercrouzet.com