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

    ObjectData plugin not rendering to picture viewer

    Cinema 4D SDK
    4
    6
    1.0k
    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.
    • G
      glasses
      last edited by

      Ok, I have a simple object data plugin that takes a list of objects and rotates them along the timeline. It works perfectly in the editor view but won't update (looks stuck) in the picture viewer.
      In the editor my objects link fine but the console when rendering says my objects are returning NoneType.

      What am I missing here? Is the renderer not using my document or creating some kind of clone and not finding the objects?

      Cheers mates for any thought on this.

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

        Sounds like your objects have not built their cache yet, so they return nothing. How do you access those objects in your object plugin?

        And, if the whole point is simply rotating them around, maybe an expression tag is what you actually need?

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

        1 Reply Last reply Reply Quote 0
        • S
          s_bach
          last edited by s_bach

          Hello,

          as always, please use the Q&A system to mark questions and post questions regarding the Cinema 4D API in the "Cinema 4D Development" forum.

          If something works in the viewport but not in the Picture Viewer, this is typically caused by using GetActiveDocument(). This function always returns the active document - the document currently displayed in the viewport. It will not return the document currently rendered etc.

          If you want to access the document your object is part of, use GetDocument().

          See BaseDocument Manual.

          best wishes,
          Sebastian

          MAXON SDK Specialist

          Development Blog, MAXON Registered Developer

          1 Reply Last reply Reply Quote 0
          • G
            glasses
            last edited by

            I'm accessing the objects from an inExclude using.

            
            doc = c4d.documents.GetActiveDocument()
            inEx = op[res.MyInExcludeData]
            activeObj = inEx.ObjectFromIndex(doc, i)
            

            @fwilleke80 yes this was a python generator object that I've converted to a plugin. I'm still figuring out the basics here so sorry for the noob Q's.
            I tried to replace GetActiveDocument() with GetDocument() but I don't think I'm structuring my plugin properly. I can't seem to find any resources online to figure this one out.

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

              Hi,

              you cannot use c4d.documents.GetActiveDocument() in a NodeData environment. The reason being, that nodes will also be executed when a document is not the active document (while rendering for example, as a document is getting cloned for rendering).

              You have to either use the document arguments provided by the methods of NodeData\ObjectData or use BaseList2D.GetDocument() on the node attached to your plugin to get the relevant document.

              I would however agree with @fwilleke80, and also think, that you might be better off with a TagData plugin.

              Cheers
              zipit

              MAXON SDK Specialist
              developers.maxon.net

              1 Reply Last reply Reply Quote 0
              • S
                s_bach @glasses
                last edited by

                Hello,

                as now said multiple times, GetActiveDocument() must not be used, but GetDocument() instead.

                What is the point of your In/Exclude list? Are these the objects you "rotate along the timeline"?

                This is typically not how a ObjectData object works; it generates objects based on its child objects or deforms objects in its hierarchy. It is not supposed to move arbitrary other objects.

                As mentioned above, a tag plugin may be the better solution. The "look_at_camera" example show such a plugin rotating its host object.

                best wishes,
                Sebastian

                MAXON SDK Specialist

                Development Blog, MAXON Registered Developer

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