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

    Creating a Vector attribute in GetDDescription()

    Scheduled Pinned Locked Moved SDK Help
    6 Posts 0 Posters 415 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 07/06/2011 at 08:42, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   9.0+ 
      Platform:   Windows  ; Mac  ;  Mac OSX  ; 
      Language(s) :     C++  ;

      ---------
      Howdy,

      My tag has Add and Delete buttons, so I need to create vector attributes in GetDDescription() according to how many the user has added.

      My code looks like this:

      BaseContainer subgroup2 = GetCustomDataTypeDefault(DTYPE_GROUP);
      subgroup2.SetLong(DESC_COLUMNS, 1);
      if(!description->SetParameter(DescLevel(OFFSET_GROUP+i, DTYPE_GROUP, 0), subgroup2, DescLevel(ID_TARGET_GROUP))) return TRUE;
      		
      BaseContainer bc4 = GetCustomDataTypeDefault(DTYPE_VECTOR);
      bc4.SetLong(DESC_CUSTOMGUI,CUSTOMGUI_VECTOR);
      bc4.SetString(DESC_NAME, GeLoadString(IDS_OFFSET)+"."+LongToString(i));
      bc4.SetLong(DESC_UNIT, DESC_UNIT_DEGREE);
      bc4.SetReal(DESC_STEP,Rad(1.0));
      if (!description->SetParameter(DescLevel(OFFSET+i, DTYPE_VECTOR, 0), bc4, DescLevel(OFFSET_GROUP+i))) return TRUE;
      

      This is within a loop and it does create the vector attributes needed with each click of the Add button, but the up/down arrows of each value field aren't working. I can change the values by typing them in, but I can't use the up/down arrows to change the values. 😠

      Is there something missing in the above code thats causing the up/down arrows to not work?

      Adios,
      Cactus Dan

      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 08/06/2011 at 08:29, xxxxxxxx wrote:

        Looks like the step setting has to be set separatly for each sub-channel of the vector. I will try to put a working example together, having some problems to get it to work properly too.

        cheers,
        Matthias

        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 08/06/2011 at 10:42, xxxxxxxx wrote:

          Howdy,

          Thanks for looking into it, Matthias. 😉

          Adios,
          Cactus Dan

          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 15/06/2011 at 02:42, xxxxxxxx wrote:

            The solution is to use SetVector instead of SetReal to set the step size and minimum/maximum values.

            Example:

              
            Bool LookAtCamera::GetDDescription(GeListNode *node, Description *description, DESCFLAGS_DESC &flags)  
            {  
              if (!description->LoadDescription(1001165)) return FALSE;  
              const DescID *singleid = description->GetSingleDescID();  
              
              LONG MY_VECTOR = 6000;  
              DescID cid = DescLevel(MY_VECTOR, DTYPE_VECTOR, 0);  
              
              if (!singleid || cid.IsPartOf(*singleid, NULL)) // important to check for speedup c4d!  
              {  
                  BaseContainer v = GetCustomDataTypeDefault(DTYPE_VECTOR);  
              
                  v.SetLong(DESC_CUSTOMGUI, CUSTOMGUI_VECTOR);  
                  v.SetString(DESC_NAME, "My Vector");  
              
                  // use SetVector, not SetReal  
                  v.SetVector(DESC_MIN, Vector(0.0));  
                  v.SetVector(DESC_MAX, Rad(360.0));  
                  v.SetVector(DESC_STEP, Rad(1.0));  
              
                  v.SetLong(DESC_UNIT, DESC_UNIT_DEGREE);  
                  v.SetVector(DESC_DEFAULT, Vector(0.0));  
              
                  if (!description->SetParameter(cid, v, DescLevel(ID_TAGPROPERTIES))) return TRUE;  
              }  
              
              flags |= DESCFLAGS_DESC_LOADED;  
              
              return TRUE;  
            }  
            

            cheers,
            Matthias

            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 15/06/2011 at 13:19, xxxxxxxx wrote:

              Howdy,

              Thanks, Matthias. 😉

              Adios,
              Cactus Dan

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

                On 30/05/2016 at 22:29, xxxxxxxx wrote:

                Thanks! 🙂

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