Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Copy Pixels from Active BaseDraw?

    Cinema 4D SDK
    python
    3
    5
    567
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ?
      A Former User
      last edited by

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

      Thank you.

      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by

        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.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • ferdinandF
          ferdinand
          last edited by ferdinand

          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

          MAXON SDK Specialist
          developers.maxon.net

          1 Reply Last reply Reply Quote 1
          • M
            m_adam
            last edited by m_adam

            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.

            MAXON SDK Specialist

            Development Blog, MAXON Registered Developer

            1 Reply Last reply Reply Quote 0
            • ?
              A Former User
              last edited by

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

              Thank you both for your help.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post