Dorian Fevrier's blog - Mot-clé - opengl - CommentairesJe m’appelle FEVRIER Dorian, je suis infographiste 3D passionné par mon métier, l’informatique en général, l’internet, la programmation et l’évolution de tout ce petit monde. Vous trouverez sur ce blog des tutoriaux, mes coups de cœurs, avis, etc.2024-01-02T23:48:05+01:00FEVRIER Dorianurn:md5:695d9c73474c33ce3dab043823509c4bDotclearCréer un Custom Locator avec l'API Python de Maya - Dorianurn:md5:b32160798d45980ea0bd70025c7ee3092014-12-24T04:42:18+01:002014-12-24T07:03:16+01:00Dorian<p>Normalement les exemples python sont dans un dossier nommé "scripted" dans Le dossier d'install de Maya.</p>
<p>Mais le VP2 reste quand même plus complique que l'ancien mode (normal, c'est pour ça que c’était lent :D ).</p>Créer un Custom Locator avec l'API Python de Maya - John Levurn:md5:c132677f492285f33aa48f834e3a49312014-12-23T16:18:07+01:002014-12-24T04:40:13+01:00John Lev<p>Bon ben je remets la main sur ce très bon article, mais mon soucis c'est que ça ne fonctionne pas avec le viewport 2.0 qui est aujourd'hui par défaut dans Maya. Autodesk ne semble pas encore décidé à fournir des codes d'exemple en python :/</p>
<p>"Support for Maya nodes implementing the MPxLocator interface can be added by providing an<br />
implementation of MPxDrawOverride and registering it with MDrawRegistry against a<br />
classification string for the Maya plugin node type."</p>Une introduction à l'OpenGL "Moderne" - Chapitre 1: Le Pipeline Graphique - Dorianurn:md5:59738ce722603c76ec490dd48b04e7882014-10-08T23:16:16+02:002014-10-08T22:22:59+02:00Dorian<p>Merci! Je n'ai jamais pris le temps de finir cette serie malheureusmeent.</p>
<p>Si ca t'interesse, developpez a traduit <a href="http://jeux.developpez.com/tutoriels/OpenGL-moderne/" title="http://jeux.developpez.com/tutoriels/OpenGL-moderne/" rel="ugc">d'excellents</a> <a href="http://jeux.developpez.com/tutoriels/OpenGL-ogldev/" title="http://jeux.developpez.com/tutoriels/OpenGL-ogldev/" rel="ugc">tutoriels</a> en francais.</p>
<p>En anglais tu a <a href="http://www.arcsynthesis.org/gltut/" title="http://www.arcsynthesis.org/gltut/" rel="ugc">ceux la</a> qui sont une reference (quoi qu'un peu costaud).</p>
<p>Au passage, <a href="http://docs.gl/" title="http://docs.gl/" rel="ugc">une excellente documentation</a> pour OpenGL a ete publie.</p>
<p>Dorian</p>Une introduction à l'OpenGL "Moderne" - Chapitre 1: Le Pipeline Graphique - DadEapurn:md5:b9b2298bb4dca64ea6182a245f514a7f2014-10-08T23:03:16+02:002014-10-08T22:06:35+02:00DadEap<p>Merci pour ce tutoriel très clair et précis à la fois, ce qui n'est pas chose aisé vu le sujet abordé ;)</p>Créer un Custom Locator avec l'API Python de Maya - Dorianurn:md5:e9c32ec06ebeb306c8193b5f5c588bc72014-03-13T17:07:08+01:002014-03-13T18:28:31+01:00Dorian<p>Hello!</p>
<p>Il peut y avoir plusieurs raisons mais le message est assez clair: Il ne reconnait pas le type de node que tu lui demande de créer.</p>
<p>As tu chargé le plugin? Le type de node déclaré dans le plugin s'appelle t'il bien <code>myCustomLocator</code> ?</p>Créer un Custom Locator avec l'API Python de Maya - Flourn:md5:a65e15491283d71cce94d8c1339f62992014-03-12T12:26:04+01:002014-03-13T17:04:07+01:00Flo<p>Bonjour.</p>
<p>Je suis vraiment tout frais concernant le Python sur Maya et le Python tout court même.<br />
Donc ne m'en veut pas de mes question de débile profond lo ^^</p>
<p>Bref Que veux-tu dire par charger le code dans Maya (Comme un plugin) ?<br />
De mon côté je le lance via l'éditeur de scripts, et après je tape la commande : <code>createNode myCustomLocator;</code></p>
<p>J'obtiens rien sauf une erreur :<br />
<code>// Warning: line 1: Unrecognized node type 'myCustomLocator'; preserving node information during this session. //<br />
// Result: unknown1 //</code></p>
<p>Je dois certaine zapper un truc quelque part. :/<br />
Après concernant tes explications, c'est plutôt clair et intéressant, donc çà me fait mal de bloquer pour un truc certainement très couillon :p</p>
<p>Je te remercie d'avance :)</p>Une introduction à l'OpenGL "Moderne" - Chapitre 1: Le Pipeline Graphique - Dorianurn:md5:398234fd7741b9dd51834e1c3b1ae35b2013-08-14T19:22:54+02:002013-08-14T18:24:34+02:00Dorian<p>:)</p>Une introduction à l'OpenGL "Moderne" - Chapitre 1: Le Pipeline Graphique - Prymourn:md5:f6ad6e8b83f098cfd0ff3d6aa887e6572013-08-14T16:37:45+02:002013-08-14T18:22:08+02:00Prymo<p>Bravo et merci pour ce tutoriel, très bon, et très bien expliqué.</p>Une introduction à l'OpenGL "Moderne" - Chapitre 2.1: Les Buffers Et Les Textures - Curieuxurn:md5:a2fec7146b26776dd54c4d71699e4a642013-02-16T21:16:31+01:002013-02-16T22:13:48+01:00Curieux<p>Salut,</p>
<p>Je serai intéressé par lire ta version non relu =)</p>Une introduction à l'OpenGL "Moderne" - Chapitre 2.1: Les Buffers Et Les Textures - Dorianurn:md5:d736d110998a6d73182c33b5d049c8ef2012-11-18T10:31:18+01:002012-11-18T10:31:38+01:00Dorian<p>En fait j'ai traduit le chapitre 2.2, 2.3 et 3 (en effet 2.2 et 2.3 sont les plus intéressant) mais je ne les ai pas encore relu, c'est extrêmement long (la relecture c'est 90% du temps de traduction). Je ne suis pas sur de les publier un jour...</p>
<p>Il y a un certains temps maintenant (presque un an) des personnes de developpez.fr m'avaient contacté pour reprendre la suite de la traduction. J'ai envoyé tout ce que j'avais mais j'ai l'impression que ce n'est jamais sortie.</p>
<p>Dorian</p>Une introduction à l'OpenGL "Moderne" - Chapitre 2.1: Les Buffers Et Les Textures - zedrummerurn:md5:2e1340562186fe31927e42f0676fa7be2012-11-17T11:22:35+01:002012-11-18T10:25:28+01:00zedrummer<p>Hello<br />
Merci pour tout ça, tu n'as pas traduit la suite?<br />
Dommage on allait justement rentrer dans les choses spécifiques à l'OpenGL moderne.<br />
Cordialement<br />
David</p>Creating Custom Locator with Maya's Python API (English Translation) - Dorianurn:md5:45d2371c44bcffadbe5abfaf473040b62011-12-16T16:51:40+01:002011-12-16T16:51:40+01:00Dorian<p>Hello Luiz,</p>
<p>As I said, I need to find time to write about this... :(</p>
<p>But I suppose this is not something very difficult to do. Just go in the link I gave, everything is here. :D</p>Creating Custom Locator with Maya's Python API (English Translation) - Luiz Eliasurn:md5:98d55a1dcfcaebe736ea821fc8ab5bc42011-12-16T16:14:06+01:002011-12-16T16:14:06+01:00Luiz Elias<p>that's great!!<br />
any chance you do a example using a glDrawElements() call?</p>mupen64plus: Le premier emulateur Nintendo 64 en Multisampling! Grace à moi! Youhou!!! - Acekardurn:md5:cb23524285cfe9bc3a676ffcca67704e2011-11-19T04:41:58+01:002011-11-19T04:41:58+01:00Acekard<p>Merci pour cet émulateur!</p>Creating Custom Locator with Maya's Python API (English Translation) - Dorianurn:md5:863ed70f1f4aec56c3ec853ac87dd0eb2011-11-14T10:18:33+01:002011-11-14T10:18:33+01:00Dorian<p>Thanks a lot for this! :)</p>
<p>About OpenGL, the solution is really Vertex Buffer Object (VBO)! This is the most effective way. :D</p>
<p><a href="http://playcontrol.net/ewing/jibberjabber/opengl_vertex_buffer_object.html" title="http://playcontrol.net/ewing/jibberjabber/opengl_vertex_buffer_object.html" rel="ugc">http://playcontrol.net/ewing/jibber...</a></p>
<p>(This tutorial is OpenGL ES but it work without too much modification and the principle is the same).</p>Creating Custom Locator with Maya's Python API (English Translation) - ricoBabyurn:md5:ae902f3660f8e546fed7c4fc7f23daac2011-11-14T05:47:05+01:002011-11-14T05:47:05+01:00ricoBaby<p>Hello,</p>
<p>I can email you the code with comments once I finished adding one more thing to the code, just so that the attributes are not messy and ugly.</p>
<p>The openGL part is inevitable, i will share to you the solution once I found out about it.</p>
<p>I have not yet tested this on a large scale so I dont know if it will slow, but so far, it seems OK.</p>Creating Custom Locator with Maya's Python API (English Translation) - Dorianurn:md5:10350790c607124edb765f43f28ae8d02011-11-11T10:38:21+01:002011-11-11T10:49:13+01:00Dorian<p>MMh.. Very interesting. You made great locators here. Have you got a page with Python file so I could give your URL in my post? :)</p>
<p>About the transparency bug, I was suspecting it must have a link to the Maya scenegraph but it was something I didn't spend time on.</p>
<p>If you find the solution, don't hesitate to tell me! I will update my blog post to improve it! :)</p>
<p>Also, the OpenGL way I give is not efficient at all. Create many many locators and your performances will fall down a lot: Use glVertex() is deprecated and very heavy, even in C... So in Python... -_-</p>
<p>I have to find time to post another "OpenGL with Maya locators" post (why not using yours if they are avaible!) and Use the VBO objects which are (much) more efficient than "direct rendering": You prepare vertex positions and colors just at update of input attributes, push everything in the GPU memory. And in the draw() method, you just say to render what is already in the GPU memory. Much Much more efficient actually!</p>Creating Custom Locator with Maya's Python API (English Translation) - ricoBabyurn:md5:2142fa4fa3ff3893df9973f9eb2705452011-11-11T03:26:06+01:002011-11-11T03:26:06+01:00ricoBaby<p>I was also reading the openGL docs and it stated that this has to do with the BSP and ordering. So objects created after the transparent objects will have trouble drawing when under the transparent object. This problem was fixed in my previous job, I dont know how but they did it. I shall share it as soon as I know how, I will ask. Thank you again.</p>Creating Custom Locator with Maya's Python API (English Translation) - ricoBabyurn:md5:3934e43512e1d26e3cb513af5427b9b72011-11-11T03:21:59+01:002011-11-11T03:21:59+01:00ricoBaby<p><a href="http://www.youtube.com/watch?v=7WkMTvE_-UM" title="http://www.youtube.com/watch?v=7WkMTvE_-UM" rel="ugc">http://www.youtube.com/watch?v=7WkM...</a></p>
<p>Hello, this is what I came out with. The openGL blending issue seems to be how openGL wants it to be, this may be due to the fact that this is an added node and not part of Maya's original classes. So it is still declared as an "unknown" node.</p>Creating Custom Locator with Maya's Python API (English Translation) - Dorianurn:md5:d715cd5ddc1b0ef8b0bfa90738df26062011-11-02T18:20:58+01:002011-11-02T18:27:57+01:00Dorian<p>The problem seems to be solved with:</p>
<pre> glEnable (GL_BLEND)
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)</pre>
<p>No?</p>
<p>About that, my main source for locators was: <a href="http://nccastaff.bournemouth.ac.uk/jmacey/RobTheBloke/www/mayaapi.html#2" rel="ugc">http://nccastaff.bournemouth.ac.uk/jmacey/RobTheBloke/www/mayaapi.html#2</a></p>
<p>Maybe you could download the pack of 37 locators and see how OpenGL code work in it.</p>
<p>From what I know, Maya was not attended to use "surface" for his locators so I suppose rasterizer work differently than on Mesh. So if you find the solution, don't hesitate to get back, I'm interested about it. :)</p>
<p>Good luck!</p>Creating Custom Locator with Maya's Python API (English Translation) - rico babyurn:md5:aa7e03ff3d3b13cd06c77b700fec71fd2011-11-02T17:57:58+01:002011-11-02T17:57:58+01:00rico baby<p>Thank you, Dorian.</p>
<p>You can see the problem here:<br />
<a href="http://forums.cgsociety.org/showthread.php?f=89&t=1014642" title="http://forums.cgsociety.org/showthread.php?f=89&t=1014642" rel="ugc">http://forums.cgsociety.org/showthr...</a></p>
<p>The cone was created BEFORE the locators, and the sphere and box were created AFTER the locators. this also happen with other locators,too and also with joints.</p>
<p>nodeTypeId = OpenMaya.MTypeId(0x88088)<br />
is this where I put the name ID?</p>
<p>I would like to thank you again, now I can put my python to better use and I can give my animators better controllers like what we use in 3dsMAX.</p>
<p>I was waiting for that python Maya API book from amazon, but this tutorial is OK. I will write my own tutorial so that I can help others,too. Thanks</p>Creating Custom Locator with Maya's Python API (English Translation) - Dorianurn:md5:b7825d47850aba27f04904c4e33ad6952011-11-02T17:49:47+01:002011-11-02T17:49:47+01:00Dorian<p>Mmmh... Maybe a screenshot could help me. I don't know what you mean by transparency problems. :)</p>
<p>The fact Maya list the locator as unknown is maybe you did'nt give it a name+id. But if you open the scene on a Maya which doesn't have you Python locator plugin, this is normal that it is write: "unknown".</p>
<p>That's why, sometime, peoples prefer made locators direclty with curves. This way your scene is not dependent of a external plugin.</p>Creating Custom Locator with Maya's Python API (English Translation) - rico babyurn:md5:58816466511f3376e31ca5fd14de84a92011-11-02T17:11:53+01:002011-11-02T17:11:53+01:00rico baby<p>hello, thank you very much for introducing me to the Maya API, now i am making cool locators with editable attributes.</p>
<p>now my problem is transparency. it has the same problem as your locator.</p>
<p>when an object is created after the locator, it will be having problems showing through the transparency. however, if an object is created before the locator, it has no problem.</p>
<p>another problem is that Maya lists the locators as "unknown", is there a way to fix this so that we can write it in ASCII and also remove the annoying warning messages? thank you very much</p>Créer un Custom Locator avec l'API Python de Maya - Dorianurn:md5:2142f82ee10b067c7f5d11bf17604a4f2011-02-25T18:20:08+01:002011-02-25T18:20:08+01:00Dorian<p>Hello Joss!</p>
<p>Ben oui on a bossé ensemble! :D</p>
<p>Pour apprendre le python (sans le MEL ni rien):</p>
<p><a href="http://python.developpez.com/cours/TutoSwinnen/" title="http://python.developpez.com/cours/TutoSwinnen/" rel="ugc">http://python.developpez.com/cours/...</a> << Tout n'est pas vraiment à prendre et tu peut sauter pas mal de passages sur certaines lib ( genre de la BDD et des applis web... -_- ). Mais toute la première partie est super clair.</p>
<p><a href="http://www.siteduzero.com/tutoriel-3-223267-apprendre-python.html" title="http://www.siteduzero.com/tutoriel-3-223267-apprendre-python.html" rel="ugc">http://www.siteduzero.com/tutoriel-...</a> << Très bon tuto aussi.</p>
<p>Passer du MEL au python est très simple donc si tu a de bon tutos MEL (voir mes liens) tu pourra t'en sortir facilement.</p>
<p>Après, coder dans l'API c'est un peu plus costaud pour un graphiste mais ça ce fait.</p>
<p>Le seul soucis c'est qu'une fois un "node" crée via l'API, il doit être installé sur toute les machines qui lances la scène. Ce n'est pas toujours pratique.</p>
<p>Pour créer une sphère, il n'y a pas de secret: C'est de l'API, c'est du bas niveau. Donc c'est à toi de calculer la position des vertex et de la créer (cosinus toussa).</p>
<p>Ici tu a un fichier zip: "37 New Locator Nodes"</p>
<p>C'est du C++ mais ça te permettra peut être de voir comment il a fait des sphères.</p>
<p><a href="http://nccastaff.bournemouth.ac.uk/jmacey/RobTheBloke/www/mayaapi.html" title="http://nccastaff.bournemouth.ac.uk/jmacey/RobTheBloke/www/mayaapi.html" rel="ugc">http://nccastaff.bournemouth.ac.uk/...</a></p>
<p>Pour le 7z, je ferai des zip à l'avenir... :(</p>
<p>Bon script! :D</p>Créer un Custom Locator avec l'API Python de Maya - jossurn:md5:1711a8ba4159b9415fe8afe5046d53072011-02-25T17:45:08+01:002011-02-25T17:45:08+01:00joss<p>hey mais ... je viens juste de me rendre compte par ton cv qu'en fait...on a bosser ensemble sur Wilmotte...dis donc, c'est petit le web :D</p>Créer un Custom Locator avec l'API Python de Maya - jossurn:md5:7dd88a6854080cffdcd2b5b9f94b100c2011-02-25T17:39:30+01:002011-02-25T17:39:30+01:00joss<p>Merci bien pour cette demistification ;)<br />
quoique la premiere fois que j'ai vue ton post ca m'a bien fait mal aux yeux !!!</p>
<p>Je commence tout just sur python (depuis hier soir en fait :) et en revenant sur ton post cette aprem, j'ai eu la surprise de comprendre la majeur partie (la partie python hein, et pas l'API(rouette cacahuette) :)</p>
<p>Je me suis matter le digital tutors de python pour maya hier soir et ca ma bien aider a comprendre tout ca.</p>
<p>bref j'ai mon super custum Locator maintenant mais je n'ai pas reussi a cahnger la couleur selon l'etat de la selection (je n'ai pas trouver ou metre le dernier bout de code et je ne peux pas ouvrir les .7p sur le linux de la boite)</p>
<p>j'ai chercher de la doc pour faire une sphere a la place d'un plan mais j'ai pas trouver de doc la dessus (et je ne sais pas ou trouver ca d'ailleur)</p>
<p>Bref j'ai enfin recup mes courbes d'anim donc je vais devoir me metre a bosser et ne plus faire joujou avec python(youpi ma journee commence a 16h30 :)</p>
<p>Je dois laisser ca de coter pour le moment mais je compte bien my remetre pour cree un node avec input>comput>output comme sur ton post de la projection.</p>
<p>encore merci ;)</p>Creating Custom Locator with Maya's Python API (English Translation) - Riggermanurn:md5:6168a9562a2049b7f08c890294ed56ac2010-08-10T18:45:49+02:002010-08-10T17:45:49+02:00Riggerman<p>Awesome!! It's a real detailed explanation, congratulations and thanks for sharing!</p>mupen64plus: Le premier emulateur Nintendo 64 en Multisampling! Grace à moi! Youhou!!! - Dorianurn:md5:199147bb03c04765e20a076a65ba4ef72010-07-18T02:41:32+02:002010-07-27T19:58:54+02:00Dorian<p>Merci pour l'info!</p>
<p>Mais il y a déjà énormément de boulot à faire sur la version "de base", sans compter le temps qu'il m'a fallut pour que je "rentre dans le code" que je doute que je passe à autre chose. :)</p>
<p>Sinon, c'est sympa de voir des projets open source se développer autour de celui-ci.</p>mupen64plus: Le premier emulateur Nintendo 64 en Multisampling! Grace à moi! Youhou!!! - airtuxurn:md5:c4705fbbc3aa6cf6d52749483d4e8e1d2010-07-10T21:57:50+02:002010-07-10T20:57:50+02:00airtux<p>C'est cool, je suis tomber sur ton site un peux par hasard et comme je vois que tu a u une petite histoire d'amour avec mupen64plus et que je sais qu'il y a des développeurs qui bosse dessus en se moment pour faire une version pour le Nokia N900 (Maemo Linux) je me suis dit que peux être tu pourrais les aider je sais pas si ils on besoins d'aide mai voila si sa te fait plaisir d'y bosser alors voila le lien verre le forum de conversation des développeurs: <a href="http://forums.internettablettalk.com/showthread.php?t=57647" title="http://forums.internettablettalk.com/showthread.php?t=57647" rel="ugc">http://forums.internettablettalk.co...</a></p>
<p>A+</p>Creating Custom Locator with Maya's Python API (English Translation) - Tom Mikotaurn:md5:ec8ca6300324aa618a56e434b9f653722010-04-27T07:02:56+02:002010-04-27T06:02:56+02:00Tom Mikota<p>Hey - I'd love to get ahold of you to find out how much you'd charge for a few custom locators. Pop me an email if your interested. I need a custom spotlight locator and a locator for gobos or reflection cards.</p>
<p>Thanks,</p>
<p>Tom</p>Creating Custom Locator with Maya's Python API (English Translation) - Un passanturn:md5:24e12e2c1c594c4af88d13ae6c99b9ca2010-04-15T10:20:15+02:002010-04-15T09:20:15+02:00Un passant<p>"ces" pas "ses". -_-</p>Creating Custom Locator with Maya's Python API (English Translation) - Un passanturn:md5:a3bdc41a7f120e318fe47092623cfc242010-04-15T10:19:32+02:002010-04-15T09:19:32+02:00Un passant<p>Merci pour ses réponses. :)</p>
<p>R.</p>Creating Custom Locator with Maya's Python API (English Translation) - Dorianurn:md5:114949baea14101d160231df46e1ec622010-04-14T22:00:25+02:002010-04-14T21:01:50+02:00Dorian<p>Hello "Un passant"</p>
<p>En effet, Maya 2011 amène pas mal de choses d'un point de vu scripting.</p>
<p>Je ne m'y suis pas penché pour l'instant mais je compte le faire dès que j'en aurai l'occasion (ça peut vouloir dire jamais si la-dite occasion ne se présente pas...).</p>
<p>J'aimerai tenter des GUI avec PyQT dans Maya, voir ce que ça peut donner...</p>
<p><a href="http://code.google.com/p/pymel/" title="http://code.google.com/p/pymel/" rel="ugc">PyMEL</a> est assez enfantin à utiliser pour qui connait un peu le python et le MEL... Python for Maya, c'est vraiment pas terrible, sauf pour les API si on n'a pas besoin de beaucoup de vitesse.</p>
<p>Voici le tuto qui m'a permis d'apprendre Python de zéro (je connaissais le MEL):<br />
<a href="http://python.developpez.com/cours/TutoSwinnen/" title="http://python.developpez.com/cours/TutoSwinnen/" rel="ugc">http://python.developpez.com/cours/...</a><br />
Pour le MEL:<br />
<a href="http://n.pastrana.free.fr/mel/cours/indexMel.htm" title="http://n.pastrana.free.fr/mel/cours/indexMel.htm" rel="ugc">http://n.pastrana.free.fr/mel/cours...</a></p>Creating Custom Locator with Maya's Python API (English Translation) - Un passanturn:md5:0d65af6eedbd3ea6406243b2169338e92010-04-14T18:23:45+02:002010-04-14T17:23:45+02:00Un passant<p>Merci pour ces excellents tutoriaux.<br />
Je me demandais si, maintenant que maya 2011 est sorti, de nouveaux tutoriaux simples, orientés API, Python, Mel, PyMel, PyQt allaient voir le jour. Juste histoire de donner une vue d'ensemble des nouvelles fonctionnalités ...</p>
<p>R.</p>Creating Custom Locator with Maya's Python API (English Translation) - Dorianurn:md5:6dc26d3ecd617ba8cd524f38d3ffbfe72010-03-20T00:54:05+01:002010-03-20T00:54:05+01:00Dorian<p>La version française est ici:<br />
<a href="http://www.fevrierdorian.com/blog/post/2009/04/15/Cr%C3%A9er-un-Custom-Locator-avec-l-API-Python-de-Maya" title="http://www.fevrierdorian.com/blog/post/2009/04/15/Cr%C3%A9er-un-Custom-Locator-avec-l-API-Python-de-Maya" rel="ugc">http://www.fevrierdorian.com/blog/p...</a><br />
:)</p>Creating Custom Locator with Maya's Python API (English Translation) - Jaydon Hylaridesurn:md5:c273b9a953229f0df83ff4e28c12c2b42010-03-19T11:33:03+01:002010-03-20T00:53:05+01:00Jaydon Hylarides<p>Wouah! Tres Tres bon article que tu nous a ecris la. A quand la suite ?</p>Creating Custom Locator with Maya's Python API (English Translation) - Dorianurn:md5:05948028be0a4e36582e33c29d714d512010-03-11T12:00:53+01:002010-03-11T12:02:21+01:00Dorian<p>Hi! :)</p>
<p>MPxLocatorNode is a "child" of MPxNode, so it can have a "compute" method.</p>
<p>I suppose the best way is to use the compute method to store the value of your color attribute in a "class variable" of your MPxLocatorNode class and to access this value in your draw method.</p>
<p>I hope this can help because I'd never try that but this should work.</p>
<p>Good luck!</p>
<p>Dorian</p>Creating Custom Locator with Maya's Python API (English Translation) - Jesseurn:md5:4e0b651eedad19a2b9d4b58be3d6894f2010-03-11T05:38:15+01:002010-03-11T05:38:15+01:00Jesse<p>I too would like to allow the user to set the color of a locator. I have added r,g,b attributes to the node, but can't figure out how to plug those into the draw function. The example you suggest, "sineNode.py", uses only the compute function.</p>
<p>Can you comment on the difference between the compute and the draw function? Do you have any simple examples of updating the draw function based on user inputs?</p>
<p>Thanks so much</p>Creating Custom Locator with Maya's Python API (English Translation) - Dorianurn:md5:fb7ac4999d9d421a89b046f7edaab3e62010-02-22T12:06:51+01:002010-02-22T12:13:02+01:00Dorian<p>No you can't. When you register the plugin. No argument is passed.</p>
<p>When you create the node with "createNode myCustomLocator", you can't give argument.</p>
<p>Anyway, you can create attributes in your node and modify this with MEL, is possible, easy AND recommended! :)</p>
<p>To do that, I think the best way is to see how this is done in the scripted plugin there:</p>
<p>C:\Program Files\Autodesk\Maya2010\devkit\plug-ins\scripted\sineNode.py</p>
<p>You have a good exemple from how to use attributes. After, it's only a "if else" statement question! ;)</p>
<p>I hope I've been clear enough. ^^</p>Creating Custom Locator with Maya's Python API (English Translation) - Shawnurn:md5:4787eba75bd0abdcadbc3a09d3a9f8b32010-02-19T21:34:03+01:002010-02-19T21:34:03+01:00Shawn<p>Hi Dorian,</p>
<p>Do you have any idea how you could pass arguments to the node initializer? Example,the user can define colors or transparency on creaion.</p>
<p>Cheers,<br />
Shawn</p>