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

    Returning a GetClone() weirdness

    Scheduled Pinned Locked Moved PYTHON Development
    8 Posts 0 Posters 638 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 08/11/2013 at 11:50, xxxxxxxx wrote:

      Super simple python in a Generator in R14. I added a userdata for the object, and one 'real' numbers

      For some reason it doesn't seem to refresh properly. and when the real number Userdata updates it dissapears. Any ideas as to what I'm missing?

        
      import c4d
        
      def main() :
          someUserData = op[c4d.ID_USERDATA,2]
          obj = op[c4d.ID_USERDATA,1
        
          obj2 = obj.GetClone()
          obj2.Message (c4d.MSG_UPDATE)
        
          return obj2
        
      
      

      Thanks for your patience, I'm learning : )
      Chris

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

        On 08/11/2013 at 20:37, xxxxxxxx wrote:

        obj = op[c4d.ID_USERDATA,1 need ]

        try to have console open while using python generator to view the error origin.

        Ok tested in r14, not refreshing in the view but using http://code.vonc.fr/?a=36 script on the python generator return the sphere with desired radius.

        working file:

        https://www.dropbox.com/s/ufdzx7pgl30748h/plugincafe_weirdclone_09_11_2013.c4d

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

          On 11/11/2013 at 09:22, xxxxxxxx wrote:

          Hi Focus3D,
          Thanks for reply. I've opened your file, but it has the exact same problem. For instance, if you turn off the Python Generator then back on again, the sphere doesn't appear until another refresh. Tested in R14 and 15. Any thoughts?

          Also I do keep the console open, it just doesn't return any errors on this one.
          Thanks again.

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

            On 11/11/2013 at 09:56, xxxxxxxx wrote:

            c4d.EventAdd()

            right ?
            d

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

              On 11/11/2013 at 09:58, xxxxxxxx wrote:

              Originally posted by xxxxxxxx

              c4d.EventAdd()

              right ?
              d

              Never from an Expression/Generator/or alike. It could lock C4D in an unconditional loop of refreshes.

              It works when you put the generator before the sphere in the hierarchy. Waiting for an answer from
              the devs.

              Best,
              -Niklas

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

                On 11/11/2013 at 11:11, xxxxxxxx wrote:

                Got an answer. It's quite easy, the bits of the clone need to be reset. The easiest way is to pass
                c4d.COPYFLAGS_NO_BITS to GetClone().

                >     obj = op[c4d.ID_USERDATA,1].GetClone(c4d.COPYFLAGS_NO_BITS)

                Best,
                -Niklas

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

                  On 11/11/2013 at 12:54, xxxxxxxx wrote:

                  Never would have figured that out in a million years. Thanks fellas!

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

                    On 13/11/2013 at 07:55, xxxxxxxx wrote:

                    @Niklas,

                    nice one, thanks.

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