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

    Alembic camera properties

    Cinema 4D SDK
    python r21
    2
    2
    485
    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.
    • jcooperJ
      jcooper
      last edited by

      When an Alembic camera is merged into a scene, its Attributes panel has a Camera tab with all the usual camera properties. When I drag & drop the "Focal Length" property into the python console, I'm told that its value can be obtained with:

      myCam[1028637,5103,500]
      

      After a bit of digging around I was able to eliminate a couple of the magic numbers like so:

      myCam[1028637,c4d.OBJECT_CAMERA,c4d.CAMERA_FOCUS]
      

      But how was the number 1028637 obtained? It isn't a plugin ID and there is no constant in the c4d namespace with this value. I don't like hard-coded numbers in my code, so I'd rather have a procedural way of obtaining this value.

      On a related note, how does C4D know that this is a camera? It's type is reported as BaseObject not CameraObject. I'd like some way of determining, in code, whether or not an object is an Alembic camera.

      Thanks!

      JOHN COOPER I TECHNICAL DIRECTOR
      PSYOP LA

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by Manuel

        Hello,

        Some symbols are not exposed to public. There's no particular reason for that.
        There's no real place where all exposed symbols are. (and we agree it's could be nice)

        To know if a BaseObject is a camera (or something) you can use IsInstanceOf

        You can also send a message using the ID MSG_GETREALCAMERADATA :

        with an alembic generator you can use this code :

            camera = doc.GetActiveObject()
            if camera is None:
                return
            
            if camera.IsInstanceOf(c4d.Oalembicgenerator) == False:
                return
            
            # This example tries to get the internal camera from a generator. 
            # Typically used with the Alembic Generator camera.
            
            data = {}
            data["res"] = None
            
            res = camera.Message(c4d.MSG_GETREALCAMERADATA, data)
            
            if res:
                camera = data["res"]
            
            print("Camera: " + camera.GetName())
        
        

        For your next threads, please help us keeping things organised and clean. I know it's not your priority but it really simplify our work here.

        • Q&A New Functionality.
        • How to Post Questions especially the tagging part.

        I've marked this thread as a question so when you considered it as solved, please change the state 🙂

        Cheers,
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

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