Copy Pixels from Active BaseDraw?



  • Is it possible to copy pixels from the active BaseDraw to a bitmap?

    Thank you.



  • Hi @blastframe this is not possible in Python.

    In C++ with the R23 we introduced the method BaseDraw::GetViewportImage, this is unfortunately not available in Python.

    Cheers,
    Maxime.



  • Hi @blastframe this is not possible in Python.

    In C++ with the R23 we introduced the method BaseDraw::GetViewportImage, this is unfortunately not available in Python.

    Cheers,
    Maxime.



  • Hi,

    I might be overlooking or misunderstanding something here, but you can render the document with Cinema's OpenGL renderer (via c4d.documents.RenderDocument). If you set the render data accordingly to the frame of the BaseDraw you are interested in, you can sort of mimic what you want to do.

    This would be obviously much slower than directly accessing the frame buffer of the viewport, due to all the overhead that comes with rendering a scene - even it is with the OpenGL renderer.

    So this would probably not be suitable to do, for example, some real time computer vision stuff on a viewport (which would be quite a stretch in Python in the first place) or something equally demanding, but totally fine, if you just need now and then a representation of the users active viewport.

    Cheers,
    zipit



  • Thanks, Zipit you are right, I should have mentioned it, but I was focused on a realtime solution, my bad.

    So thanks again for your daily contribution, this is very appreciated.



  • Hi,
    Thank you @m_adam and @zipit . I am specifically interested in copying the Viewport pixels for speed.

    Thank you both for your help.


Log in to reply