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
    • Register
    • Login

    Getting debugbreak in atom.cpp

    Cinema 4D SDK
    c++ 2025
    2
    2
    331
    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.
    • E
      ECHekman
      last edited by ECHekman

      I have created my own iCustomGUI, and it is fully functional except for that when I update the value i get a critical stop message and a debugbreak. However the data is actually correctly set and stored. So im not sure what is going on.

      atom.cpp(439): CRITICAL: Stop
      A breakpoint instruction (__debugbreak() statement or a similar call) was executed in Cinema 4D.exe.
      

      This is how the data is set in the Init() function of my ShaderData

      // In MyData::Init(GeListNode* node, Bool isCloneInit)
      BaseContainer ociodata;
      ociodata.SetString(SOME_STRING_ID, String("initial text"));
      ociodata.SetInt32(SOME_INT_ID,  19);
      base->SetParameter(c4dId, ociodata);
      

      Here is how i create the UI

      // in MyData::GetDDescription()
      BaseContainer bc = GetCustomDataTypeDefault(DA_CONTAINER);
      bc.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_OCIOCYCLE);
      bc.SetString(DESC_NAME, String(pinInfo->mStaticLabel));
      bc.SetBool(DESC_SCALEH, TRUE);
      description->SetParameter(IDCopy, bc, groupID);
      

      Here is how i send the update from the iCustomGUI class

      // in My_iCustomGui::Command()
      BaseContainer _data;
      _data.SetString(SOME_STRING_ID, String("some text"));
      _data.SetInt32(SOME_INT_ID,  14);
      
      BaseContainer m(BFM_ACTION);
      m.SetInt32(BFM_ACTION_ID, GetId());
      m.RemoveData(BFM_ACTION_VALUE);
      m.SetContainer(BFM_ACTION_VALUE, _data);
      SendParentMessage(m);
      

      I have the same setup with a different iCustomGUI and it works fine, but there is something about this specific case where it is doing this debug break and complaining about a critical stop. Could it be because it im using a basecontainer here in not a simple type like int/float/vector?

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @ECHekman
        last edited by ferdinand

        Hey @ECHekman,

        Thank you for reaching out to us.

        @ECHekman said in Getting debugbreak in atom.cpp:

        Here is how i create the UI

        // in MyData::GetDDescription()
        BaseContainer bc = GetCustomDataTypeDefault(DA_CONTAINER);
        bc.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_OCIOCYCLE);
        bc.SetString(DESC_NAME, String(pinInfo->mStaticLabel));
        bc.SetBool(DESC_SCALEH, TRUE);
        description->SetParameter(IDCopy, bc, groupID);
        

        That, the GetCustomDataTypeDefault(DA_CONTAINER) call, is illegal code. Check our documentation for the function. It could probably be put a bit more verbosely into the docstring, but:

        cb400f4a-9cf9-43eb-83b2-0bd37b7127f8-image.png

        DA_CONTAINER is not a resource data type. Which is a fancy way of saying that a C4DAtom parameter cannot be of data type DA_CONTAINER. On line 439 in atom.cpp is no crit stop (at least in the version of atom.cpp for 2025.2.x.yyyyyy I looked at), but on line 476 there is. This is inside C4DAtom::SetParameter, and it gets there the ID of the parameter container of the description element which shall be written, then switches through all the atomic DTYPE_ and when none matches, calls at the end FindResourceDataTypePlugin() on the ID of the parameter container, i.e., what you initialized as DA_CONTAINER. When it cannot find anything there, it raises the crit stop.

        When you want to have there some OCIO data bundle, you probably should also implement a data type for it. Otherwise you should try DTYPE_SUBCONTAINER. But I am not sure how nicely DTYPE_SUBCONTAINER will play with custom GUIs. In general I would lean towards that writing a container as a singular parameter with a GUI like this is not intended, but you can try your luck. What will work in any case, is implementing your own data type.

        And to be verbose, a resource data type is a data type that can be used in resources, i.e., res files.

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

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