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

    copy user data from one group to another

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 474 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 25/01/2017 at 08:21, xxxxxxxx wrote:

      Hi, I am trying to copy data from a user group that has 22 user data fields into another group that has the same number of fields when the user presses a button. Basically it allows the user to store changes he has made to the first group in his own preset. How would I go about doing this? Thanks.

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

        On 25/01/2017 at 11:36, xxxxxxxx wrote:

        By copying you mean copying value or recreate them into another object / group?

        Anyway a good read for you http://www.cineversity.com/wiki/Python%3A_User_Data/

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

          On 25/01/2017 at 16:27, xxxxxxxx wrote:

          I will take a look at that. No, copying the values from one user data group to another within the same null.

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

            On 26/01/2017 at 01:24, xxxxxxxx wrote:

            If they got the same order or you will be sure user will not change / remove user data then you can simply do
            my_second_object[c4d.ID_USERDATA,1] = my_first_obj[c4d.ID_USERDATA,1]

            it's not the proper way but it can do the job and it's pretty easy to write.
            Or you can check the name by listing all userDatas(BaseList2D.GetUserDataContainer()), checking his parent if it's the good one (with c4d.DESC_PARENTGROUP) and then doing a string comparaison with his name with c4d.DESC_NAME and then apply the userData.

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

              On 26/01/2017 at 03:56, xxxxxxxx wrote:

              I want to set it up so the user can change the preset at the push of a button. All the user data is on one object, a null. It controls various objects in the OM with user data presets whose values can be altered. These presets are chosen through a dropdown. When the user chooses one of these presets from the dropdown, then customizes those values, I want him to be able to then store those values in his own user preset. Make sense?

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