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

    Tag variables and rendering?

    Scheduled Pinned Locked Moved PYTHON Development
    6 Posts 0 Posters 712 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 26/08/2017 at 07:02, xxxxxxxx wrote:

      I have a tag plugin with some (local) variables I used in the tag.
      The variable is initialized in __INIT__() and filled/used in Execute and GetDDescription.
      And everything is ok.

      However when I render, myList is empty and thus it does not render correctly.

      What is the best methode / place to define these variables?

          def __init__(self) :
              self.myList = []
        
          def Execute(self, tag, doc, op, bt, priority, flags) :
              data = tag.GetDataInstance()
              self.myList.append(data[inputVar)
              ....
      

      I also tried to put the initialization in Init(self, op),but that did not work either.

      I can use global variables, but then a second same tag will have the same variable values.

      -Pim

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

        On 26/08/2017 at 08:07, xxxxxxxx wrote:

        For passing a list from a copied object you have to override CopyTo function from your NodeData (derived from your TagData).

        For more complete informations make sure to read C++ CopyTo Manual.

        Basicly when you render a scene, c4d copy the current scene and render this copied scene, c4d copy BaseContainer for this object, but not the object stored into it memory. CopyTo function is make for that, you can specified which things are copied and which are not.

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

          On 26/08/2017 at 11:46, xxxxxxxx wrote:

          Ok, i did not know that.
          I will give it a try.

          Thanks, Pim

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

            On 26/08/2017 at 12:24, xxxxxxxx wrote:

            Thanks you very much and thanks for this great forum!

            -Pim

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

              On 28/08/2017 at 09:32, xxxxxxxx wrote:

              Just some additional information for future readers:
              It's not mandatory, but in most case, where you have member variables that need to be covered in CopyTo(), then chances are you will also need to override Read() and Write(). Might not be the case here, but it's at least recommended to think about it and maybe also test it (you'll run into issues with loading or saving scenes in such a case). Here's the link to the respective C++ manual on NodeData::Read() and Write().

              One additional thought: Maybe you don't even need the list as member of your class. Couldn't you use the BaseContainer instead? Then you wouldn't have to worry about this at all.

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

                On 28/08/2017 at 12:42, xxxxxxxx wrote:

                And yes, i did use read and write.

                Thanks, Pim

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