Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Finding the Containers for User data

    PYTHON Development
    0
    9
    1.2k
    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
      Helper
      last edited by

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

      On 28/06/2011 at 20:51, xxxxxxxx wrote:

      hey everyone! 
      I was wondering where i could look in the API to find the IDs for user data entries. i am looking specifically for the ID to Hide/show a user data element and i found it on my mac at work, but for some reason, Im on my pc at home now and i can't find the right "xxxxxxxxxx.h" file. thanks in advance for the help!

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

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

        On 28/06/2011 at 21:01, xxxxxxxx wrote:

        Do you mean "c4d.gui.GeDialog.Enable()" ?

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

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

          On 28/06/2011 at 21:05, xxxxxxxx wrote:

          Oh, no sorry. I mean for a particular user data entry, you can toggle its visibility. Basically whether or not a user value is accessible, but I'm using a python object, not a GUI. I thought it is somewhere within baselist.h, or baseobject.h, in the c4d API, but i cant seem to find it now...

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

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

            On 28/06/2011 at 21:34, xxxxxxxx wrote:

            I am trying to print out each object inside the user data's base container, but i still cant seem to locate the value to toggle visbility.

            UD = op.GetUserDataContainer()
            for i in UD:
                d = i[0]
                c = i[1]
                print c[0]
                print c[1]
                print c[2]
                print c[3]
                print c[4]
                print c[5]
                print c[6]
            etc......

            but it still doesn't help me to figure out what each value is for?

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

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

              On 28/06/2011 at 21:57, xxxxxxxx wrote:

              after testing every variable and pertty much messing it up untill it worked, i discovered that the number ID to hide/show a user data element is #15. whew.

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

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

                On 28/06/2011 at 22:04, xxxxxxxx wrote:

                And how exactly do you hide a userdata entry ?

                Thanks,
                Niklas

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

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

                  On 28/06/2011 at 22:57, xxxxxxxx wrote:

                  Hey Niklas! Sure thing brosky...

                  Basically, you have to first get the user data container of your object. for example...

                  #----------------------------------------
                  UD = op.GetUserDataContainer()
                  #----------------------------------------

                  then you need to run a for..in statement on the user data container in order to find the user data you want to affect.

                  #----------------------------------------
                  for descId, container in UD:
                  #----------------------------------------

                  then you must specify what user data entry you are trying to access(by ID)...

                  #----------------------------------------
                      if descId[1].id == 8:
                  #----------------------------------------

                  then you need to specify what event is going to turn the user data entry's visibility on/off. In this case i have a user data entry(an integer cycle menu), called colType, and i am testing to see what number it is set to...

                  #-----------------------------------------
                      if coltype==1:
                  #-----------------------------------------

                  then you need to get the container entry that you want to set. In this case, the ID 15 in order to set the visibility. and we need to run the SetUserDataContainer(descId, container), and finally update the viewport!

                  #-----------------------------------------
                          container[15] = False
                  op.SetUserDataContainer(descId, container)
                  c4d.EventAdd()
                  #-----------------------------------------

                  so the whole so far code looks something like this...

                  #-----------------------------------------
                      UD = op.GetUserDataContainer()

                  for descId, container in UD:

                  if descId[1].id == 8:
                              if coltype==1:
                                  container[15] = False
                                  op.SetUserDataContainer(descId, container)
                                  c4d.EventAdd()
                  #-----------------------------------------

                  finally, if you want the data entry to be off otherwise, make sure to run a else: statement and just reverse the container[15]'s value to True and the data entry will dissapear unless the first if statment is reached.

                  so everything altogether

                  #-----------------------------------------
                      UD = op.GetUserDataContainer()

                  for descId, container in UD:

                  if descId[1].id == 8:
                              if coltype==1:
                                  container[15] = False
                                  op.SetUserDataContainer(descId, container)
                                  c4d.EventAdd()
                              else:
                                  container[15] = True
                                  op.SetUserDataContainer(descId, container)
                                  c4d.EventAdd()
                  #-----------------------------------------

                  hope that helps! let me know if it still just don't make sense.

                  Edited: messed up some of the explanation.

                  1 Reply Last reply Reply Quote 0
                  • H
                    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 03:57, xxxxxxxx wrote:

                    Ah thank you very much ! I didn't know that the id 15 of a userdata container controls it's
                    visibility !
                    Very unfortunate that this is not possible for descriptions...

                    Cheers,
                    Niklas

                    1 Reply Last reply Reply Quote 0
                    • H
                      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:28, xxxxxxxx wrote:

                      neither did i.... until i tested every variable and found out thats where it was at. in the c4d Folder/_API on macs it actually has some pretty good notes in the xxxxxxx.H files, but on PC its impossible to figure out what is going on in there. Are the API's between mac and PC super different?

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