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

    Copying Data between objects

    Scheduled Pinned Locked Moved PYTHON Development
    6 Posts 0 Posters 754 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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 29/06/2011 at 12:50, xxxxxxxx wrote:

      hey guys! had another question.

      is it possible to clone all the data from one spline object into another(assuming they are both the same exact type of spline object)? in my project i have a slot to drag a spline into a user data link field. then within python, i am getting the ID of that type of spline and creating a new spline based on the original spline's ID, but all of the settings are new(which is to be expected) and rather than program the settings for every type of spline i was hoping i could just use a base container to Transfer settings to the new spline. I am halfway there, but now i am not sure how to transfer a base container full of the main spline's settings into the new spline. help? code below...

      #---------------------------------------------
          sptype = baseSpline.GetType()    #baseSpline is the original spline from the User Data Link Field
          spCore = c4d.BaseObject(sptype)                 #create a new spline based on the original spline's type

      #--------------------------------------------

      P.S. i am used to just using get clone is this case, but i doesn't seem to be working with my code. as soon as I use get clone it fails to keep my c4d base object alive. plus i would really just like to know how to do this. Thanks again guys!

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 29/06/2011 at 15:15, xxxxxxxx wrote:

        figured it out!

        just use GetData and Set Data to equate the values within each base object! thanks anyways!

        sptype = baseSpline.GetType()
            spData = baseSpline.GetData()

        spStr  = bo(sptype)
            spCore = bo(sptype)
            spCon  = bo(sptype)
            spMain = bo(sptype)
            spColShp = bo(440000054)

        spColShp.InsertUnder(colNull)

        spStr.SetData(spData)
            spCore.SetData(spData)
            spCon.SetData(spData)
            spMain.SetData(spData)

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 29/06/2011 at 21:54, xxxxxxxx wrote:

          This is more performant

              spStr  = spCore = spCon  = spMain = bo(sptype)
          

          Or just use on variable

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 30/06/2011 at 01:55, xxxxxxxx wrote:

            lol, does my bulky code scare you... 😉

            thank you btw. that reduced my code from like 1200 lines to around 400 or so. woah.

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 30/06/2011 at 02:19, xxxxxxxx wrote:

              P.S. i am used to just using get clone is this case, but i doesn't seem to be working with my code. as soon as I use get clone it fails to keep my c4d base object alive. plus i would really just like to know how to do this. Thanks again guys!

              Hi, can you post a few lines? CopyTo or GetClone should do exactly what you are looking for. Cheers, Sebastian

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

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 30/06/2011 at 12:11, xxxxxxxx wrote:

                hey sebastian! thanks for the response. but i actually got it working! there was some code posted before(bulky noob code. lol.) but i got it working now using get data and set data while also testing the object type and creating a new object of the same type.

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