THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 25/08/2011 at 07:04, xxxxxxxx wrote:
In a python tool I wrote, I'm setting a backgroundObject with an animation. Then the tool edits the active render data to change the width and height of the render (and the viewports).
I use the following code:
renderData = document.GetActiveRenderData()
renderData[c4d.RDATA_XRES] = width
renderData[c4d.RDATA_YRES] = height
renderData[c4d.RDATA_FRAMERATE] = fps
renderData[c4d.RDATA_FRAMEFROM] = c4d.BaseTime(startFrame, fps)
renderData[c4d.RDATA_FRAMETO] = c4d.BaseTime(endFrame, fps)
The problem is that, most of the times, the viewport is not refreshed with the correct width and height.
If I open the render settings dialog, I can see the values that the tool has set but it's not the ones used in the viewports: if I edits the values and put the same value again, then it's working! If I don't do that manual edit, I can do a lot of different actions in the application and the viewport is never refreshed with the correct width and height. There's a missing notification and nothing else than opening the dialog and entering the value manually seems to trigger that notification.
I tried adding c4d.EventAdd(), MSG_UPDATE, force redraw views, change the timeline, etc. but nothing fixed the problem.
Thanks for your help,
On 25/08/2011 at 11:23, xxxxxxxx wrote:
Hi Benoit, after you set the data you can redraw the editor view by the following call:
Btw, document.InsertRenderData(...) is not necessary here, renderData is the reference to the renderdata object.
On 30/08/2011 at 04:46, xxxxxxxx wrote:
That's one of the things I already tried. I just tried again, and it doesn't work. Maybe because I'm on a mac?
Thanks for the comment on InsertRenderData, I didn't put it at first but added while trying to force the refresh...