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
    • Register
    • Login
    1. Home
    2. BruceC
    B
    • Profile
    • Following 0
    • Followers 0
    • Topics 15
    • Posts 39
    • Best 0
    • Controversial 0
    • Groups 0

    BruceC

    @BruceC

    0
    Reputation
    11
    Profile views
    39
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    BruceC Unfollow Follow

    Latest posts made by BruceC

    • Button scaled unexpectedly when it is in the same row with an expanded linkbox

      I have a button and a linkbox placed in the same row, however I found the button is always scaled horizontally when the linkbox is expanded.
      Could you please help me find out how to stop the button being scaled horizontally?
      I have tried applying DESC_SCALEH to FALSE and DESC_FITH to TRUE, but it doesn't work after the linkbox is expanded.

      Before the linkbox is expanded, the button's width is expected.
      ce8c622f-59bb-47da-a5d3-c6bf25da6ffe-image.png
      After the linkbox is expanded, the button is scaled unexpected.
      6dd4884c-6b85-494b-b4eb-22395c2953cd-image.png

      I essentially used the below code snippet to create the button and linkbox in NodeData::GetDDescription()

      Int32 groupID = xxgroupIdxx;
      const DescID groupDescID = CreateDescID(DescLevel(groupID, DTYPE_GROUP, 0));
      {
          BaseContainer bc = GetCustomDataTypeDefault(DTYPE_GROUP);
          bc.SetInt32(DESC_COLUMNS, 2);
          bc.SetInt32(DESC_SCALEH, TRUE);
          description->SetParameter(groupDescID, bc, CreateDescID(DescLevel(AOV_COMP_PARAMS_GRP)));
      }
      
      {
          DescID id = CreateDescID(DescLevel(xxButtonIdxx, DTYPE_BUTTON, 0));
          BaseContainer bc = GetCustomDataTypeDefault(DTYPE_BUTTON);
          bc.SetString(DESC_NAME, "test"_s);
          bc.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_BUTTON);
          bc.SetBool(DESC_SCALEH, FALSE);   //// <<<<<<<<<<<
          bc.SetBool(DESC_FITH, TRUE);      ////  <<<<<<<<<<<< I have tried using these two flags, but they don't help
          description->SetParameter(id, bc, groupDescID);
      }
      
      {
          const DescID id = CreateDescID(DescLevel(xxLinkIdxx, DTYPE_BASELISTLINK, 0));
          BaseContainer bc = GetCustomDataTypeDefault(DTYPE_BASELISTLINK);
          bc.SetString(DESC_NAME, "test"_s);
          bc.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_LINKBOX);
          bc.SetData(DESC_SCALEH, TRUE);
          bc.SetContainer(DESC_ACCEPT, accept);
          description->SetParameter(id, bc, groupDescID);
      }
      

      Thanks!

      posted in Cinema 4D SDK c++
      B
      BruceC
    • RE: Efficient way of saving array to BaseContainer

      Thank you @ferdinand for the help!

      Write raw memory does help a lot, appreciate!

      posted in Cinema 4D SDK
      B
      BruceC
    • Efficient way of saving array to BaseContainer

      Hi,
      could you please help me to find out the efficient way of saving/reading an array with a large size of vectors to BaseContainer?

      I could store/read each Vector in the array one by one as below, but when the size of the array is large, this method will cause performance issue.

      save()
      {
          maxon::BaseArray<Vector> arrayData;
          BaseContainer dataBC;
          Int dataCount = arrayData.GetCount();
          dataBC.SetInt32(XX_COUNT, dataCount);
          for (Int idx = 0; idx < dataCount; ++idx)
          {
              dataBC.SetVector(XX_ITEM + idx, positions[idx]);
          }
      }
      load()
      {
          maxon::BaseArray<Vector> arrayData;
          BaseContainer dataBC;
      
          Int dataCount = dataBC->GetInt32(XX_COUNT, 0);
          arrayData.resize(dataCount);
      
          for (Int32 idx = 0; idx < dataCount; ++idx)
          {
              arrayData[idx] = dataBC->GetVector(XX_ITEM + idx, Vector(0, 0, 0));
          }
      }
      
      

      Then I remember vertex color tag has a special way of reading the color data stored. So I think C4D supports an efficient way of save/loading large array data.
      I tried the below way by storing a raw memory chunk, but it doesn't work. It seems it only stores the memory address rather than the content of the memory address, and I suspect it will have serialize/deserialize problem when the scene file is opened in another platform (operating system).

      save()
      {
          maxon::BaseArray<Vector> arrayData;
          BaseContainer dataBC;
      
          Int dataCount = dataBC->GetInt32(XX_COUNT, 0);
      
          Vector* rawData = NewMem(Vector, arrayData.GetCount()) iferr_return;
          MemCopy((void*)rawData, (void*)arrayData.GetFirst(), Int(sizeof(Vector) * arrayData.GetCount()));
          GeData data(rawData, VOIDVALUE);
      
          dataBC.SetData(XX_ITEM, data);
      
          DeleteMem(rawData);
      }
      
      load()
      {
          maxon::BaseArray<Vector> arrayData;
          Int32 dataCount = dataBC->GetInt32(XX_COUNT, 0);
          arrayData.resize(dataCount);
      
          const GeData& data = dataBC->GetData(XX_ITEM);
          Vector* rawData = (Vector *)data.GetVoid();
          for (Int32 idx = 0; idx < dataCount; ++idx)
          {
              arrayData[idx] = rawData[idx];
          }
      }
      

      So could you please help me to find out the right efficient way of saving/reading an array with a large size of vectors to BaseContainer?

      Thank you very much!

      posted in Cinema 4D SDK r21 2025 linux macos windows
      B
      BruceC
    • RE: create link parameter accept Alembic tag

      @m_adam, Thank you!

      Yes, Message(GeListNode* node, Int32 type, void* data) works for me.

      I'm wondering shall my plugin just return true after processing MSG_DESCRIPTION_CHECKDRAGANDDROP in the Message() function (set the value of DescriptionCheckDragAndDrop::_result) or still call SUPER::Message(node, type, data); at the end?
      It looks to me that calling SUPER::Message(node, type, data); at the end still works.
      But the example in MSG_DESCRIPTION_CHECKDRAGANDDROP Message doesn't call SUPER::Message(node, type, data);.

      Thanks!

      posted in Cinema 4D SDK
      B
      BruceC
    • RE: Read Alembic tag's data

      @m_adam, Thank you very much, this works for me!

      posted in Cinema 4D SDK
      B
      BruceC
    • create link parameter accept Alembic tag

      Hi,
      Could you please help me find out how to define the link parameter in res file which only accepts Alembic tag? (And the Alembic tag should also converted from a vertex color tag before the object was backed as Alembic)

      I'm developing a plugin, and there is a link parameter, previously, in the res file, I used this to make the parameter only accept a vertex color tag.

      LINK xxx { OPEN; ACCEPT { Tvertexcolor; } }
      

      I'd like to change this link to only accept an Alembic tag which is converted from a vertex color tag.
      I got the "the Alembic tag which is converted from a vertex color tag" by this:
      There is an object with a vertex color tag, then the object is baked as Alembic by using the "Bake as Alembic" menu item popped by right click on the object.
      Then the backed Alembic file is imported automatically, and the original vertex color tag will become an Alembic tag.

      I tried

      LINK xxx { OPEN; ACCEPT { Talembic; } }
      

      However, this somehow broke the res file, and made all other parameters disappear.

      LINK xxx { OPEN; ACCEPT { 1036433; } }
      

      By replacing Talembic with 1036433 (this is the value defined for Talembic in cinema.framework/source/ge_prepass.h), it does give me a link parameter accepts Alembic tags (I don't know why the Talembic doesn't work, but the actual number works here), but it doesn't limit to the Alembic tags converted from vertex color tags (i.e. all kinds of Alembic tags are accepted).

      Thanks!

      posted in Cinema 4D SDK r21 2025 c++
      B
      BruceC
    • Read Alembic tag's data

      Hi,
      Could you please help me find out how to read data from a Talembic tag?

      There is an object with a vertex color tag, then the object is baked as Alembic by using the "Bake as Alembic" menu item popped by right click on the object.
      Then the backed Alembic file is imported automatically. However, the original vertex color tag becomes an Alembic tag.

      Can you please help me find out how to read the vertex color data from the new Alembic tag?
      Thank you very much!

      posted in Cinema 4D SDK r21 2025 c++
      B
      BruceC
    • RE: how to get vertex color tag's data for a specific frame (different with current frame) without modifying current document?

      Thank you very much for all your detailed explanation, @ferdinand!

      posted in Cinema 4D SDK
      B
      BruceC
    • RE: how to get vertex color tag's data for a specific frame (different with current frame) without modifying current document?

      Thank you, @ferdinand.
      No worries at all, I know you must be very busy, just take your time. I appreciate all the help!
      Cheers!

      posted in Cinema 4D SDK
      B
      BruceC
    • RE: how to get vertex color tag's data for a specific frame (different with current frame) without modifying current document?

      The most common "pro" solution to that is caching. E.g., that you write yourself a vertex color cache in your case.

      I'm wondering the example you mentioned here, do you mean create a hidden vertex color tag to cache the data?

      posted in Cinema 4D SDK
      B
      BruceC