1

I am trying to make an experimental tool that modifies the existing Maya Render View and swaps out the current rendered Image. I want to get the widget that contains the rendered image and change it.

I got the Render View Dialog through MQtUtil with this code:

enter image description here

I looked through all children of the Render View and tracked the widget that seems to contain the rendered image down to a QWidget. The problem ist that this widget has no children and there is no QImage or a similar widget that actualy displays the rendering.

I also removed all of the widgets in the dialog that wont remove the rendered image to make sure I dont miss anything. enter image description here

These are the widgets that are left in the dialog: enter image description here

I also have a tool that prints the hirarchy of the widgets when hovering over it. When I hover over the renderd image I get this hirarchy. The widget at the top that has no Object name set is the widget that seems to contain the rendered image

enter image description here

Am I missing something or how can I get the widget that displays the rendered image?

Sweck
  • 31
  • 7
  • The view seems to be renderView. And, unless they provide a custom API, it's a completely private widget (since it's a basic QWidget). It's probably just a basic QWidget that overrides `paintEvent()` to display the image, so you can probably do nothing with it. – musicamante Jun 29 '22 at 17:00
  • @musicamante I think its the first QWidget child of the QStackedWidget called renderView that displays the image. Is there any way how I can examine that paintEvent or override it? Or maybe a hook after the paintEvent finished? – Sweck Jun 29 '22 at 17:32
  • You can only *try* to install an event filter on that widget, but that won't give nothing useful to you, since the painting is still done internally: you can just *know* when the painting is being done (or has just completed), you cannot know nor intercept *the* painting itself. – musicamante Jun 29 '22 at 17:39
  • Maybe I can get the code where the painting event happens? I tried looking in the maya scripts folder but I dont see any QT related code. There is a renderWindowPanel.mel file that seems to do stuff related to the Render View but I dont really understand much of it. – Sweck Jun 29 '22 at 19:24
  • Can you please explain what you're *actually* trying to achieve? – musicamante Jun 29 '22 at 19:34
  • As I said I want to get the widget that contains the rendered image and change it. I want to do some image editing operations on the rendering and display it in the render view. Its an experimental tool for fast look development thats why its important to me that everything is happening in the render view. I already added some menues and buttons to the render view that will trigger the image editing operations. – Sweck Jun 29 '22 at 19:55
  • You can't access the rendering operation, since it's always done internally, nor you can access the "resulting image", because painting is device dependent (using system APIs). There could be a way through a (terrible) hack that would intercept the `Paint` event, ignore the painting, render the result on a local pixmap, then process it and "virtually" redraw the widget using the processed pixmap. But that's not easy, nor fast or reliable, most importantly because you'll only get the *widget*, not the image. What you want to access is virtually inaccessible, at least what you're interested in. – musicamante Jun 29 '22 at 22:16
  • Okay I see. Thank you for that clarification. I have another idea here. I will try to just display a widget with an image on top of the rendering. I can save the renderd image to disk and than use a widget to display it. Its hacky but might do the trick.. – Sweck Jun 30 '22 at 11:02

0 Answers0