Need direction; renderview

227 views
Skip to first unread message

Mark Serena

unread,
Feb 15, 2014, 7:50:50 AM2/15/14
to python_in...@googlegroups.com
Hey, 

Just wanted to get a helpful push in the right direction if anyone knows. I want to be able to insert the maya renderview (just the rendering/rendered image) into my own qt layout to enhance it a bit with some tools, but before I go too far I just wanted to see if anyone knows if it is even possible to do such a thing? If not then it will only be a post rendered tool.
My searching hasn't really shown me if it's entirely possible. 

Thanks,
Mark

Risto Puukko

unread,
Feb 15, 2014, 3:23:17 PM2/15/14
to python_in...@googlegroups.com
Hi Mark

Usually you can find the rendered image from [your_project]\images\tmp - directory so what you'd do is pickup that and draw it to your own window.

Does this push any buttons ?

8)

/risto

Justin Israel

unread,
Feb 15, 2014, 5:35:49 PM2/15/14
to python_in...@googlegroups.com

I've taken viewports and embedded them into my own Qt app to provide independent scene navigation.
If the renderview is a Singleton instance,  then it wouldn't work the same way that I have done it. My approach has been to create a new viewport to embed.

--
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 receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/8fe547dc-ebd2-4790-a041-73e8b3927eee%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Mark Serena

unread,
Feb 15, 2014, 6:00:58 PM2/15/14
to Justin Israel, python_in...@googlegroups.com

Yeah, doing it once it's rendered and displaying the image will be the way I'll end up doing if I can't get it to work.

Hey Justin, I tried the example on your website to embed Maya windows in qt, but changing the modelpanel  from persp/camera to renderview threw an error line 1 with no other info.

You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/pTUd6aYeQCg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA38Ec7UjhWBh2dbHp4xXqK-8%3DWVrRSj6-seXJpi_8eeWQ%40mail.gmail.com.

Justin Israel

unread,
Feb 15, 2014, 6:08:48 PM2/15/14
to Mark Serena, python_in...@googlegroups.com

I can give it a test later today and report back.

Justin Israel

unread,
Feb 15, 2014, 7:59:21 PM2/15/14
to Mark Serena, python_in...@googlegroups.com
I gave it a play and actually found a small tweak that I needed to add to my original blog example, which was also the reason it was failing when you tried switching to a Render View in the panel. It needed a parent paneLayout.

Here is a modified gist, where it starts with embedding the Render View:

The downside, from this quick test, is that because the renderView is a unique scripted panel, there can only be one. If another panel switches to it, it will grab it away from your panel. And if the actual Render View window is brought up, it will grab it and disable the selection from other panels until it is closed. So I am not sure if that it something you want to work around or not. 

In that same gist, I added a second file of something playing around with the callbacks for the Render View. It shows how you could watch the panel callbacks of the Render View and update your own panel. So maybe, for instance, if you lose the Render View panel, you switch to something that indicates  "Render View panel lost", and maybe show a button to grab it back. And when it gets removed from another view, you could check where it is, and if no one else is viewing it you could grab it back automatically.


Mark Serena

unread,
Feb 15, 2014, 8:26:27 PM2/15/14
to Justin Israel, python_in...@googlegroups.com
Ooooo that's perfect!!! Thank you very much for looking into that Justin, I remember your post about people asking questions and expecting the answer laid out for them, I wasn't trying to coax you into writing anything, but thank you for the example! 
It's possible to make the default render button launch my new UI right? I'm sure the Charcoal Script Editor that Chris Zubrigg does this. I might look into that and that should stop the focus being stolen? 

Thanks again!

Justin Israel

unread,
Feb 15, 2014, 8:35:19 PM2/15/14
to Mark Serena, python_in...@googlegroups.com

Hah, ya no worries. This wasn't the type of question I had posted about. It was based on my existing previous example, and more theoretical about how much could be done with the render view panel. I was interested in testing it.

Technically mostly everything in the Maya UI can be hijacked to some extent. The render view button calls a runtime command that you could probably swap out to launch yours. If you made your app a scripted plugin, then you could have it hijack that functionality on plugin load, and restore it on unload maybe.

Mark Serena

unread,
Feb 15, 2014, 8:39:15 PM2/15/14
to Justin Israel, python_in...@googlegroups.com
Cool, well there's a lot of new territory for me to cover, I'm currently watching your cmiVFX vid on PyQt and also got the one off CGSociety, so hopefully I'll feel less lost soon. 
Thanks again Justin.

Joe Weidenbach

unread,
Feb 16, 2014, 1:06:41 AM2/16/14
to python_in...@googlegroups.com
Hey Mark,

Just wanted to throw this out to you, I switched to PyQt about 8 months ago, and am finally getting the hang of it (of course I'm working on it part time between school, my day job (Where I use C# with WPF), my second job, and running an indie game development team, so that could contribute to how long it's taken me to pick it up :P).  It does take time to get used to the PyQt thought process, but it will come.  Of all the resources I've used, I keep coming back to Justin's, so you're on the right track with that one.

Best of luck,

Joe
--
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 receiving emails from it, send an email to python_inside_m...@googlegroups.com.

Justin Israel

unread,
Feb 16, 2014, 2:51:18 AM2/16/14
to python_in...@googlegroups.com
Thanks for the complement, Joe ;-)



Mark Serena

unread,
Feb 16, 2014, 4:48:38 AM2/16/14
to python_in...@googlegroups.com
Cheers Joe. Any other things helped you get a grasp of it? Always good to find some golden egg hidden on the inter-web/warren


--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/pTUd6aYeQCg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/53005571.3090308%40gmail.com.

Joe Weidenbach

unread,
Feb 16, 2014, 4:58:30 PM2/16/14
to python_in...@googlegroups.com
The biggest thing for me has been to embrace the widget model.  I had a lot of struggles trying to convert existing Maya interfaces over, which led to a lot of "how do I get x interface element in PyQt" questions (The framelayout was a particular headache for me, but I learned a lot about the internals of the layout system trying to rebuild it).  The thing is, PyQt gives you the base widgets to build just about anything you want, where maya gives you a lot of prebuilt interfaces so you can build very rapidly (while losing some flexibility in the process).

So for me, the key was to redesign my interfaces from the ground up--not thinking about "how can I recreate this existing interface?", and instead thinking about "How do I want the user to experience this tool?"  It was a bit painful with all of the existing work I'd put in before I hit the limits of Maya's interface functionality, but once I started redesigning I realized that a lot of the choices I'd made before were to work within the limitations of the old system, and I was wasting a lot of time trying to recreate something that wasn't really necessary. From there, it was just "which element will accomplish what I'm looking for,"  and then diving into the documentation and forums to figure out how to do it.

Working with the Qt Model/View/Delegate system has also been challenging, but no more so than it was with WPF for me.  The biggest challenge there is in working with the QVariants that Qt uses internally.  I also just discovered that you can put a definition in your imports to remove QVariants entirely for sip, but at this point my codebase has gotten rather large again so I just deal with them.

Justin Israel

unread,
Feb 16, 2014, 5:06:41 PM2/16/14
to python_in...@googlegroups.com
Also if you use PySide (which is now distributed with Maya 2014), their API is more like SIP v2, where they don't have the QVariants at all, as well as no QStrings.


Joe Weidenbach

unread,
Feb 16, 2014, 5:14:40 PM2/16/14
to python_in...@googlegroups.com
I updated the topic since it's off the original at this point.

That's on a "one of these days" list for me.  My tool is for my Master's Thesis, and part of the original specification was that it would run on any version of Maya that supports Python.  I got an adjustment to allow for PyQt, but if I moved to PySide I'd at the very least have to set up dual compatibility for older versions of Maya.  Although, I'd really like to get this functional for 2014, has anyone had any luck getting PyQt to compile for it?  I've never been able to get Qt to finish compiling without erroring out when following the Autodesk instructions, so I've never been able to build PyQt natively (and had to rely on pre-built versions).

Joe Weidenbach

unread,
Feb 16, 2014, 5:17:43 PM2/16/14
to python_in...@googlegroups.com
And now I answered my own question LOL--apparently you don't need to build qt anymore to build PyQT :)  I'll see how things go.

Marcus Ottosson

unread,
Feb 16, 2014, 5:24:10 PM2/16/14
to python_in...@googlegroups.com
If you're specification is for *any* version that supports Python, then you might be out of luck with versions of Maya not using PyQt at all (< 2010)

If you could stretch as far as not having to *run* your code from *within* Maya, then you could potentially be able to develop it on the side and simply trigger it from Maya; communicating back and forth via inter-process communication protocols such as the socket module of Python, RPyC or even Maya's CommandPort.

I posted some examples a while back on something like that could work with Rpyc, near the bottom of this thread.



For more options, visit https://groups.google.com/groups/opt_out.



--
Marcus Ottosson
konstr...@gmail.com

Mark Serena

unread,
Feb 16, 2014, 5:49:10 PM2/16/14
to Justin Israel, python_in...@googlegroups.com
Cheers Joe, that's definitely the frame of mind I would of been stuck in. Thanks for the head check.
I did that when I rebuilt my MEL, just one for one, but now that I've spent more time things are a little more streamlined.

Hey Justin, I wanted to do pyside to begin with but couldn't find unwrapinstance from pyside. I figured more examples for pyqt and later I'll swap over if necessary.
Have seen some convert scripts to change it over.
Is it easy enough to change it over later?

Thanks guys

Justin Israel

unread,
Feb 16, 2014, 7:40:48 PM2/16/14
to Mark Serena, python_in...@googlegroups.com

Pyside is pretty much the same to pyqt4 + sip api v2

The equivalent to sip wrap/unwrap instance is found within the shiboken module. Shiboken is to Pyside, what sip is to pyqt4

Joe Weidenbach

unread,
Feb 17, 2014, 1:11:27 AM2/17/14
to python_in...@googlegroups.com
Marcus,

Thanks for the heads up on that.  But, as I said, I got approval for the switch to PyQt, knowing that QT was only in Maya 2011+, so I'm still good.  With that said, I'd rather not introduce a dependency on PySide at this stage (I've only got about two months left before I have to turn in my Thesis).  I'll definitely keep everything in mind for the future--I'm planning on selling my rigging tool at some point when it's done and tested, so I'll need to switch to PySide at that point to bypass the licensing issues with PyQt depending on what the commercial licensing costs.

Marcus Ottosson

unread,
Feb 17, 2014, 4:49:49 AM2/17/14
to python_in...@googlegroups.com
PyQt is priced at £350 per developer. The main cost if probably Qt itself.



For more options, visit https://groups.google.com/groups/opt_out.



--
Marcus Ottosson
konstr...@gmail.com

Joe Weidenbach

unread,
Feb 17, 2014, 2:21:13 PM2/17/14
to python_in...@googlegroups.com

Joe Weidenbach

unread,
Feb 17, 2014, 2:27:27 PM2/17/14
to python_in...@googlegroups.com
Also, as I understand it, since Qt is actually bundled into Maya, I don't think I need to buy a license of it, from what I've been looking at.

Ævar Guðmundsson

unread,
Feb 18, 2014, 3:57:59 AM2/18/14
to python_in...@googlegroups.com
  You can find and extensive writeup and good links regarding QT and PyQt licensing here:

https://groups.google.com/forum/#!searchin/python_inside_maya/pyqt$20license/python_inside_maya/J4AWPlFYhcQ/1tVM2KTxp8Y

Marcus Ottosson

unread,
Feb 18, 2014, 5:28:55 AM2/18/14
to python_in...@googlegroups.com
In short, if what you are selling uses Maya to run, then you won't need a license for Qt. Licenses only apply when you are the one doing the distribution (and in this case and making a profit off of it). In this case, Autodesk is the one distributing and is the one paying the licensing fees.

The same applies to PyQt (or PySide for that matter, if it came with a price-tag) as you wouldn't distribute it either. You're distributing your code, which is yours.


On 18 February 2014 08:57, Ævar Guðmundsson <aevar.gu...@gmail.com> wrote:
  You can find and extensive writeup and good links regarding QT and PyQt licensing here:

https://groups.google.com/forum/#!searchin/python_inside_maya/pyqt$20license/python_inside_maya/J4AWPlFYhcQ/1tVM2KTxp8Y

--
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 receiving emails from it, send an email to python_inside_m...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.



--
Marcus Ottosson
konstr...@gmail.com

Joe Weidenbach

unread,
Feb 18, 2014, 11:24:26 PM2/18/14
to python_in...@googlegroups.com
Just a quick update, the build of PyQt for 2014 went swimmingly straight from Autodesk's instructions.

Joe Weidenbach

unread,
Feb 23, 2014, 4:24:45 PM2/23/14
to python_in...@googlegroups.com
Ok, very weird issue now.  I'm using my compiled PyQt in Maya 2014, and my interface comes up great.  The problem is this--Signals and Slots seem to have died.  NONE of my buttons actually seem to work.  The same script works perfectly in 2012/2013.  I've even taken my code and just put a print line into the slot and it never gets printed, which tells me that the signals aren't working.  I'm using new-style signals and slots, which I don't think should be an issue.

Has anyone seen this, where the code works in one version of Maya and not another?  I can post more code, but I don't know that it's particularly relevant (and is spread across a lot of files--I know, not very Pythonic, but I'm a C# guy, and this is supposed to be modular).

The gist is this:
from PyQt4 import QtCore, QtGui

import resources

import globalsettingsdlg
reload(globalsettingsdlg)
from globalsettingsdlg import GlobalSettingsDlg

from ..utils import gui as GuiUtils

from creator import centralwidget as cw, bonestudiowidget as bs
reload(cw)

from jdCRT.bonestudio import nodes
reload(nodes)

class jdCRT_CentralWidget(QtGui.QWidget, cw.Ui_jdCRT_CentralWidget):
    def __init__(self, parent=None):
        super(jdCRT_CentralWidget, self).__init__(parent)
        self.setupUi(self)
        self.initBoneStudioBTN.clicked.connect(self.initSkeleton)

    def initSkeleton(self, *args):
        skel = nodes.Skeleton()


class MainWindow(QtGui.QMainWindow):
    def __init__(self, parent=None):
        if parent == None:
            parent = GuiUtils.getMainWindow()
        super(MainWindow, self).__init__(parent)
        self.setWindowTitle("Character Rigging Tools")

        self.mainWidget = jdCRT_CentralWidget()
        self.mainWidget.tabWidget.setCurrentIndex(0)
        self.setCentralWidget(self.mainWidget)

        # Menu Bar
        toolsMenu = self.menuBar().addMenu("&Tools")
        settingsAction = QtGui.QAction(QtGui.QIcon(":icons/MainSettingsIcon.png"), "&Settings", self)
        helpText = "jdCRT Settings"
        settingsAction.setToolTip(helpText)
        settingsAction.setStatusTip(helpText)
        settingsAction.triggered.connect(self.SettingsWin)
        toolsMenu.addActions((settingsAction,))

        # Status Bar
        self.statusLabel = QtGui.QLabel()
        self.statusLabel.setFrameStyle(QtGui.QFrame.StyledPanel|QtGui.QFrame.Sunken)
        status = self.statusBar()
        status.setSizeGripEnabled(False)
        status.addPermanentWidget(self.statusLabel)
        status.showMessage("Ready", 5000)

        self.show()
        self.raise_()

    def SettingsWin(self):
        print "Calling Settings Window"
        self.settingsWin = GlobalSettingsDlg(self)
        #self.settingsWin.show()
        settingsWin.exec_()
Both InitSkeleton (From a QPushButton) and SettingsWin (From a Menu Action) are not actually being called.

Justin Israel

unread,
Feb 23, 2014, 7:30:43 PM2/23/14
to python_in...@googlegroups.com

Does a really simple test where you show a generic button that prints something when clicked not work either?
Just wondering if its only related to your existing code, or PyQt not working in general.

David Moulder

unread,
Feb 24, 2014, 8:42:48 AM2/24/14
to python_inside_maya
I've had this in 2014 a few times.  Just one UI didn't respond to signals.  Then every now and again it would start working.  I eventually took out my wrapper display method that I use for all my UI's and then it worked!

Still concerned that it might come back.  



For more options, visit https://groups.google.com/groups/opt_out.

Joe Weidenbach

unread,
Feb 24, 2014, 2:46:54 PM2/24/14
to python_in...@googlegroups.com
Justin, this code works:

from PyQt4 import QtGui, QtCore

class TestWin(QtGui.QWidget):
    def __init__(self, parent=None):
        super(TestWin, self).__init__(parent)
        layout = QtGui.QVBoxLayout()
        
        btn = QtGui.QPushButton("Test")
        btn.clicked.connect(self.testBtn)
        layout.addWidget(btn)
        self.setLayout(layout)
    
    def testBtn(self):
        print "I was pressed"
        
        
win = TestWin()
win.show()

So it looks like signals and slots are working for this, but something else might be up in my code that's causing this.  I find it odd that it works up until 2014 though--is it that big of a leap between Python 2.6.4 and 2.7.3 (or same with PyQt 4.9 to PyQT 4.10.3)?

Also, when you say wrapper display method, David, are there any specifics you're referring to? I'm just looking for vectors to track down the problem--I've got a demo of my project with a big studio this week for a portfolio review, and I reverted my tablet back to 2013 so it works, but that adds other issues with some of my rigs.


Joe Weidenbach

unread,
Feb 24, 2014, 2:59:50 PM2/24/14
to python_in...@googlegroups.com
On thing I can think of is that my UI here is from pyuic.exe and QtDesigner, would it be an issue if it's from an older version (4.8 or 4.9, can't remember which exactly at this point, but I think 4.8.3)?

Justin Israel

unread,
Feb 24, 2014, 3:47:36 PM2/24/14
to python_in...@googlegroups.com
I don't think there is *too* much difference in those versions. It would probably be an issue if it teetered around the Qt 4.5 area.



Macbeth R.

unread,
May 20, 2014, 12:57:28 PM5/20/14
to python_in...@googlegroups.com
Is it possible to do the opposite, in order to skip the chase for the renderView panel trough maya, I mean embed our own QT widget for example in a bottom horizontal layout inside the renderViewPanel..  ? maybe this need some editing of renderWindowPanel.mel

On Saturday, February 15, 2014 6:50:50 AM UTC-6, Mark Serena wrote:
Hey, 

Just wanted to get a helpful push in the right direction if anyone knows. I want to be able to insert the maya renderview (just the rendering/rendered image) into my own qt layout to enhance it a bit with some tools, but before I go too far I just wanted to see if anyone knows if it is even possible to do such a thing? If not then it will only be a post rendered tool.
My searching hasn't really shown me if it's entirely possible. 

Thanks,
Mark

Justin Israel

unread,
May 20, 2014, 3:59:05 PM5/20/14
to python_in...@googlegroups.com

You could find the layout and add 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 receiving emails from it, send an email to python_inside_m...@googlegroups.com.

Marcus Ottosson

unread,
May 20, 2014, 4:33:09 PM5/20/14
to python_in...@googlegroups.com
Yes, what Justin said. Should be quite straightforward, as most widgets in Maya are natively Qt.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA00z3xTDMmwGrgMad2Sm34zjU9uh5fDfut-a0sELLOiLg%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.


--
Marcus Ottosson
konstr...@gmail.com


Reply all
Reply to author
Forward
0 new messages