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
    • Recent
    • Tags
    • Users
    • Login

    Script for switching active cameras [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 460 Views
    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.
    • H Offline
      Helper
      last edited by

      On 18/08/2015 at 18:47, xxxxxxxx wrote:

      Is there any way to programmatically select a camera and set it to active view?

      I'm looking for the script property that relates to the little target button which allows you to look through a camera rather than the default editor camera. I'm sure there has to be a property that distinguishes whether it's on or not I but haven't been able to find any information about it, so I'm not sure if we have access to it or not.

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 19/08/2015 at 06:18, xxxxxxxx wrote:

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 19/08/2015 at 06:19, xxxxxxxx wrote:

          Look at the code I just posted in 'Command line parameter problem'. I think you answer is in there 🙂

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 19/08/2015 at 09:33, xxxxxxxx wrote:

            Hi,

            welcome to the PluginCafe forums.
            Here's a small script switching to a selected camera (or editor camera, if none selected).

            import c4d
            from c4d import gui
              
            def main() :
                cam = doc.GetActiveObject()
                bd = doc.GetActiveBaseDraw()
                if (cam.GetType() != c4d.Ocamera) :
                    cam = None # switch to editor camera, if no camera selected
                bd.SetSceneCamera(cam)
                c4d.EventAdd()
              
            if __name__=='__main__':
                main()
            
            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 22/08/2015 at 21:44, xxxxxxxx wrote:

              Thank you Andreas!

              SetSceneCamera() is exactly what I was looking for, I knew it had to be there but for some reason I couldn't find it.

              😕 🙂

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