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

    Changing VideoPost leads to TypeError

    Cinema 4D SDK
    r25 windows python
    2
    4
    460
    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

      Hello,
      I am trying to change the Viewport Renderer parameters. I was able to use the method illustrated in the code sample below, but something changed (I believe in the API) and this now leads to TypeError: __setitem__ expected str, not bool. If I'm not to assign these values as a boolean, can someone please advise on how these are to be set? Thank you.

      import c4d
      from c4d import documents
      
      def main():
          doc = documents.GetActiveDocument()
          rdata = doc.GetActiveRenderData()
          rd = rdata.GetData()
          post = rdata.GetFirstVideoPost()
          post[c4d.VP_PREVIEWHARDWARE_DISPLAYFILTER_NGONLINES] = False
          post[c4d.VP_PREVIEWHARDWARE_DISPLAYFILTER_OTHER] = False
          post[c4d.VP_PREVIEWHARDWARE_DISPLAYFILTER_SDSCAGE] = False
          post[c4d.VP_PREVIEWHARDWARE_DISPLAYFILTER_ONION] = False
      
      if __name__=='__main__':
          main()
      
      1 Reply Last reply Reply Quote 0
      • ?
        A Former User
        last edited by A Former User

        I think I have discovered the issue: I believe rdata.GetFirstVideoPost() was getting a renderer other than the Viewport Renderer, so those symbols weren't available. I am now using the following (I found it here) to check that the video post is the Viewport Renderer.

                    post = rdata.GetFirstVideoPost()
                    while post is not None:
                      if post.CheckType(300001061):
                        break
                      post = post.GetNext()
                    if post is None:
                      rd.InsertVideoPost(c4d.BaseList2D(300001061))
        

        Unless the API devs have any corrections, I'll mark this as solved.

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

          hi,

          Pretty strange i was not able to reproduce the issue.

          @blastframe said in Changing VideoPost leads to TypeError:

          300001061

          you can use the symbol c4d.RDATA_RENDERENGINE_PREVIEWHARDWARE instead.

          Cheers,
          Manuel

          MAXON SDK Specialist

          MAXON Registered Developer

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

            @m_magalhaes Yes, I think the error was because Octane was the result of rdata.GetFirstVideoPost() and those symbols don't exist in it. If I check for the Viewport Renderer, it seems to work fine. Thanks for the reply and symbol tip!

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