Hey,
I’m converting a script from maya to motionbuilder. And noticed thumbnails not showing up in motionbuilder…? Is there some trick to getting thumbs working in motionbuilder?
Here is an excerpt from what i’m trying to do:
icon = QtGui.QIcon(“path.jpg”)
newItem = QtGui.QListWidgetItem(‘test’)
newItem.setIcon(icon)
list.addItem(newItem)
hmm… I’ve just quickly checked how I add icons in Mobu. I use this combination:
item = QListWidgetItem(“name”)
icon = QPixmap(‘D:\icon_file.png’)
item.setIcon(icon)
No, I didn’t try yet. In FBImage doc I saw only option to save as tif.
This would probably need solution based on python or qt. I mean save to tif, then convert it by some python function. Maybe external lib would be needed.
The pillow library can be used to convert images from one format to another.
I believe the QImage class should be capable of writing out a PNG file as well, but that requires QImage to load the image from whatever other format, which may or may not be supported depending on how Qt was built for Mobu.
I don’t have it installed so can’t really test myself.
heh, yeah, QImage is supported in mobu 2017 and there is option to open tif and save as png, but my first try failed. It return False when I load tif. need to do more research.
Ha new development. So I looked at the option of upgrading to 2019 as a way to avoid this issue…
However I downloaded the trial of mobu 2019. And WriteToTif is not working ( doesn’t seem to do anything in 2019. But in 2018 / 15 works )
hmm I had some luck grabbing window with pyside instead. eg. pixmap = QtGui.QPixmap.grabWindow(widget.winId()). Where widget is the viewer widget in the motionbuilder interface. However a lot of the time this failed and instead only got me a white screen. If I instead grab the desktop with the same setup it seems to always work, but I’m not grabbing the whole desktop which is not ideal…
hehe, we think similar I also tried this. But I don’t need this currently so I gave up.
The best I manage was this grabing of desktop with additionally cropping it to Viewer coordinates.
This works fine but it’s a bit slow (with my 2 monitors setup it’s 1-2s), and is hacky.
Grabbing Viewer widget gave me only blank background without models and even Grid. What is interesting, Skeleton parts were captured on the screenshot. Maybe XRay mode in viewport allowed it.
For grabing widget I used QPixmap.grabWidget() function
For what I read, grabing desktop works in different way than grabing praticular windows or widgets. Maybe some additional vieport refresh is needed…
BTW. did you tried to render one frame ? I mean using File->Render option, but from python and as output choosing only one current frame and JPG format. (but probably jpg is not perfect here because it won’t be displayed by QPixmap…)
Ha, yeah exactly the same path i ended up down lol. I also have my windows taskbar on the side which made the viewer position offset :(.
I briefly looked at the render a frame route, but 2015 mobu QImage reader does not support that either… could try bmp… I also tried to some things to refresh the viewport for Qimage grab, but nothing worked so far.
Currently I am grabbing the desktop then opening that in a new widget with a crop tool to select the area u want. Not ideal, but works for now.
Never really dug into the crash dump files themselves.
Usually I just go on a logging spree, and pick through Maya’s log on the off chance that I’ll get some good information.
Though I’ve found that the majority of cases where Maya hard crashes is either from a janky plugin, or a threading problem. Minus the cases where Maya is just being unstable all on its own.