Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Frame all

    Cinema 4D SDK
    c++ windows sdk
    3
    5
    1.3k
    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.
    • WickedPW
      WickedP
      last edited by

      Hi folks,

      how can I frame all objects in a document in memory (like command id 12148)?

      WP.

      wickedp.com

      1 Reply Last reply Reply Quote 0
      • fwilleke80F
        fwilleke80
        last edited by

        AFAIK, frame all requires the document to be displayed in the editor.

        With some maths and iteration over potentially a lot of vertices in the document, building a scene bounding box, you might be able to come up with your own.

        www.frankwilleke.de
        Only asking personal code questions here.

        1 Reply Last reply Reply Quote 0
        • r_giganteR
          r_gigante
          last edited by r_gigante

          Hi WickedP, thanks for reaching us.

          Can you please better explain the final intent of your request? Is the document displayed in viewport (which means it's the active document)? Or is it just a cloned document being hold in "memory"?

          That said, supposing that you've your document displayed in the editor, beside the option to invoke CallCommand, there's no built-in function or method to invoke, but rather, as already depicted by @fwilleke80 you can think of doing something like:

          for each object in all objects:
            get object bounding box center and radius
            evalute the bbox max and min and update the overall bbox
          
          reposition the editor camera target in the center of the overall bbox 
          
          for each overall bbox vertex:
            convert from world to screen space
            verify that's inside the frame of the editing camera 
            if not in frame:
             zoom out a little and recheck if vertex is now in frame
          
          1 Reply Last reply Reply Quote 4
          • WickedPW
            WickedP
            last edited by

            Apologies, thought I had left a response but I didn't hit submit!!

            Thanks fwilleke80, I was hoping to avoid writing my own, but I might have to.

            Hi r_gigante, it's a doc in memory (not a clone, but in memory none-the-less) and can't be in the active viewport. It's rendered to bitmap, sometimes very frequently. So I can't be switching to it in the viewport for one command on each frame. Is there no way to piggyback off the underlying CallCommand() functions for this? No messages I could send to try and invoke it?

            WP.

            wickedp.com

            1 Reply Last reply Reply Quote 0
            • r_giganteR
              r_gigante
              last edited by r_gigante

              Hi WickedP,

              sorry for no bringing good news, but the architecture of the CommandData doesn't allow to "piggyback" off the "Frame All" command nor I've evidences of messages being sent around to have the "Frame All" to take place.

              The only, but maybe non-trivial, way to go is to write your own function based on the currently active rendering-camera in your "in-memory" document.

              Cheers, Riccardo

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