Getting debugbreak in atom.cpp
-
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?
-
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:DA_CONTAINER
is not a resource data type. Which is a fancy way of saying that aC4DAtom
parameter cannot be of data typeDA_CONTAINER
. On line 439 inatom.cpp
is no crit stop (at least in the version ofatom.cpp
for 2025.2.x.yyyyyy I looked at), but on line 476 there is. This is insideC4DAtom::SetParameter
, and it gets there the ID of the parameter container of the description element which shall be written, then switches through all the atomicDTYPE_
and when none matches, calls at the endFindResourceDataTypePlugin()
on the ID of the parameter container, i.e., what you initialized asDA_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 nicelyDTYPE_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