SOLVED Setting node dirty does not trigger an update.

Hi,
Sorry I'm probably missing something.

I'm using R21.023, what's your version?
What if you drag and drop the VP into the python console and add .Message(DLRenderFinished) ? (of course, the number itself must be used and not DLRenderFinished)

I'm wondering if there's not a thread issue now.

Cheers,
Manuel

Hi,

I tried again to reproduce this issue but i can't. Would be interesting to send us some of your code using our mailbox [email protected]

Cheers,
Manuel

Hello,
I am using R21.027.
From python console, it worked fine. After setting the node dirty, getDDescription function got executed. But I wonder what is different as the same event is being executed when the rendering finishes and the node is set Dirty except that getDDescription does not get executed after.

Hi,
Cool we are progressing 😄
Can you try something like that? This will execute the call to message directly in the MainThread.

if (has_vp)
{
   maxon::ExecuteOnMainThread([]()
     {
       vp->Message(DLRenderFinished);
     }
   );
}

Cheers,
Manuel

Hello,
Tried that by still the same :/.

Thanks,
Ogers.

Hello @everyone,

don't mind me, this is just a slightly bored myself surfing on private time and did not read the thread in its entirety. But what stands out to me is that you do this in your RenderManger::CoreMessage:

BaseDocument* doc = GetActiveDocument();

Is there actually a guarantee that your render manager will only render the active document? And when you use the rendering logic provided by Cinema, the active document and rendering document will be two different documents, even when the rendering was spawned for the active document, because for rendering, a document is being cloned. So, unless this is intentional, you might be operating on the wrong document there, because as I do understand, this message of yours is coming in from a node/something in the rendered document.

Just pointing this out because it is a common pitfall in the Cinema 4D SDK.

Cheers,
Ferdinand

Hello,

BaseDocument* doc = GetActiveDocument();
BaseDocument* renderdoc = (BaseDocument*) doc->GetClone(COPYFLAGS::DOCUMENT, nullptr);

RenderData* rd = renderdoc->GetActiveRenderData();

If this is what you mean for getting the rendering document, I am using this way on my original code. I am not sure if the issue is related to this.

Cheers,
Ogers

Hi,

as the VideoPostData is inside the current document, it's right to retrieve the current document. But as Ferdinand said, that's a common pitfall.

I was able to reproduce the issue. Using the Console automatically add an EventAdd(). That's why it was working using the console. If you send the message with the script manager, it will not work.

So, you have to "force" the UI update with an EventAdd(). SetDirty only set the VideoPostData dirty but doesn't trigger a UI update.
As it's the end of the render, the scene should not have changed too much and the redraw shouldn't take too much time.

	case DLRenderFinished:
		{
			//DLRenderFinished is executed successfully when rendering is finished, but this does not trigger an update on the UI.
			_render_started = false;
			i_node->SetDirty(DIRTYFLAGS::DESCRIPTION);
			EventAdd();
			break;
		}

Just one question, that's strange to launch the render from the render preferences. Is that the final workflow?

Cheers,
Manuel

Hello,
Trying to "force" the UI update using EventAdd() after setting the node dirty still does not trigger GetDDescription function. I thought this was what I was missing but seems there is something else.

I am not 100% sure if it will be the final workflow, but for now, that's our intention. We are trying to keep a uniform UI on all DCCs (as in the image below) and this way has proven to be efficient.
Of course, this will not be the only way to launch a render, but if we see it to be efficient in Cinema4D too then yes this will also be a way we will keep.
Unfortunately, our C4D plugin is too far away from other plugins that we support on other DCCs, and there's still a lot to do.

As for the buttons' workflow, it would be:
Clicking Render will set the button to Abort Render and make the other two buttons insensitive until rendering finishes (that is why I want to update the UI after rendering is finished), or abort render is clicked which this updates the UI fine.

The same goes for the other two buttons (Start IPR -> Abort IPR and make the other two buttons insensitive until you abort it).

a6afe6b4-f6e3-481e-bb85-cdcfa0bb9049-image.png

Cheers,
Ogers

Hi,

I tried again to reproduce this issue but i can't. Would be interesting to send us some of your code using our mailbox [email protected]

Cheers,
Manuel

Hello @Ogers,

without any further questions, we will consider this topic as solved by Monday, the 25th and flag it accordingly.

Thank you for your understanding,
Ferdinand