Without giving too much boring background information: I’m trying to create a very light version of the Maya Hypershade. I basicly just want a hyperGraph -UI element with graph type: hypershade - something Autodesk themselves create with a call to a script called collectionUI.
Now, I’ve been looking at hyperShadePanel.mel and collectionUI.mel for weeks and I can’t say I fully grasp the concepts - which is why I ask for help here.
First things first:
By just calling on collectioUI.mel without any inputs:
collectionUI.mel “” “”;
…you can create a hyperGraph (graph style: hypershade) and it will appear in whatever window which is currently open. The first input is supposed to parent it to a UI part but this I have a problem with. If I have a window, with a frame layout, and then some additional row layouts after it - then if I try and parent the collectionUI to the frame layout, it ALWAYS “moves on” and parent itself under a child to frame layout. Argh!!! Whatever… this is a minor issue.
The big issue is that I don’t know what is needed to populate this area. I’ve stripped down the hyperShadePanel.mel (download here: 7zip Download - Free 7-zip for Windows 11 - Get 7-Zip )
…and I’ve commented out procedures that are non-essential for populating the collectionUI. I can continue on this path I guess and remove UI-parts that I don’t want and then just modify the hyperShade UI with my own tools - but, and this is a big “but”: The maya hypershade CAN NOT BE INSTANCED. At least that’s what the manual says but maybe there is a workaround?
Either way: I would prefer just making this from scratch rather than modding the hyperShade: but I’m completely stuck on how to populate the collectionUI and don’t even know how to parent it correctly without having it auto-parent it to something else in my UI layout.
Last but not least: I don’t know anything about Qt but it seems like a simple language to learn. Handy, flexible and great for UI-building. Would it be possible to create a lite hypershade with MEL+Qt instead of doing any of the above stuff I’ve already tried?
EDIT: I would also be interested to hear about alternative methods to create material thumbnails that are not based on scene renders. I’ve seen quite a few MEL and python scripts where the creator generates asset and/or material thumbnails by doing a render on an external scene - and it’s always SLOW.
I’ve never heard of that command. Never seen anyone else use it, and no one has ever told me about it. And I’ve whined about this particular problem for weeks lol ^^
With that things will become super-easy. Just query the stuff in the scene, place in an array and present it on a UI with swatchDisplayPort. And then you can even add your own marking menu stuff too coz swatchDisplayPort has the ability to run commands. EXCELLENT!
Yea I assumed that much - but then I need to learn python It’s on my todo list but too often I find myself with too little time (or energy). I’m gonna buy (and read through) the book Maya Python for Games and Film some day though as it seems like a great resource for going deeper into scripting. (Python, Qt, Maya API, C++)
(this one: http://www.amazon.com/Maya-Python-Games-Film-Reference/dp/0123785782/ref=sr_1_1?ie=UTF8&qid=1334394818&sr=8-1 )
…but until then, I’ll stick to what I know (MEL).
And yea another thing: swatchDisplayPort doesn’t have visual label - it’s just a swatch. Any clever ideas on how to present the shader name “onto” the thumbnail? I could just make a grid layout and have the name in a separate cell ofc but that’s a bit… sloppy?
ya i found the jump between mel and python using maya.cmds quite easy, but mel was also my 2nd language since i new php before i started working with maya.
than after a while i started using python more as a full object oriented language like it is instead of like a procedural language like mel.
the harder bit to learn, was was using openMaya api with python since this api was designed for use with C++ and you really need to hack your way around a few problems when using python with it such as it wanting strict data types, and it wanting c++ references and pointers for a lot of things.
[QUOTE=passerby;19640]ya i found the jump between mel and python using maya.cmds quite easy, but mel was also my 2nd language since i new php before i started working with maya.
than after a while i started using python more as a full object oriented language like it is instead of like a procedural language like mel.
the harder bit to learn, was was using openMaya api with python since this api was designed for use with C++ and you really need to hack your way around a few problems when using python with it such as it wanting strict data types, and it wanting c++ references and pointers for a lot of things.[/QUOTE]
Though now there is the Python Api 2.0 which is somewhat more pythonic.
@Nithshade, I don’t believe there’s a way in MEL to superimpose the text over the swatch. It is most definitely possible in PyQt/PySide but unfortunately I don’t think MEL has the same power (hopefully I’m wrong though).
Manually placing it via a layout would probably be the best route.
dgovil, is this api 2.0 available in maya 2010 or 2012? i just been working with maya.OpenMaya, whcih some of it seems pythonic, but things get a little weird when references and pointers come into play and i have to use the mscriptutil to fake these thigns.
@capper ya it seems a lot of thigns still arent possible in it yet, like setting up a iterator for going over meshes in a mSelectionList, but what does work is pretty kickass, and works how i would expect proper python code to work.
@Nithshade, I don’t believe there’s a way in MEL to superimpose the text over the swatch. It is most definitely possible in PyQt/PySide but unfortunately I don’t think MEL has the same power (hopefully I’m wrong though).
Manually placing it via a layout would probably be the best route.[/QUOTE]
Alright thanks. I’ll just go with a columnLayout as a container for the swatchDisplayPort and it’s label (an iconTextButton with style: textOnly)