Ha, right, I should've thought of that ^_^
Thank you, it works!
Cheers,
Frank
Ha, right, I should've thought of that ^_^
Thank you, it works!
Cheers,
Frank
Hi,
just out of interest: In an object plugin which uses the GetHandleCount() / GetHandle() / SetHandle() functions, is there a way to prevent C4D from drawing the standard handles? I want to draw my own handles, but the yellow standard handles are still visible behind mine.
Skipping the call to ObjectData::Draw() in my object's Draw() function doesn't seem to be a good option, as that also skips drawing of the object gizmo.
Cheers,
Frank
Hi,
I noticed that, in C4D 2024, the return value of BaseContainer::GetDirty()
does not always change after changing a value in the container. Is this a bug? I am using BaseContainer::GetDirty()
to detect changes to a container, and now this doesn't work anymore.
How can I detect changes to a BaseContainer in C4D 2024?
If a fairy granted me three wishes, I would greatly appreciate the addition of functions like BaseContainer::GetHashCode()
, GeData::GetHashCode()
, and a standard way to implement a GetHashCode()
function for CustomDataType
s (which would be invoked by GeData::GetHashCode()
).
Cheers,
Frank
Hi Ferdinand, thank you for the clarification!
Hi Ferdinand,
happy new year! Thanks for chiming in! I have fixed the crash in the meantime (don't ask how, it was all quite confusing, but it might have had to do with how I got the BaseContainer in the first place.
So, if I understand this correctly, most of the structures in C4D 2024 that use COW will create a new instance when getting a writable reference or pointer, while getting a const ref or pointer will use a shared instance? And BaseContainer::GetCustomDataTypeWritableObsolete() will not do that, but still allow me to modify the pointed data? I can live with that
Posting code is difficult, as everything is part of a pretty large project. I'm sorry my questions are sometimes a bit shadowy.
Cheers,
Frank
I am not modifying any data from within GetVirtualObjects()
, of course not.
But Tilo's comment in the code sounds like the data is modified anyway, just by calling GetCustomDataTypeWritableObsolete()
. "needs to be rewritten for COW support because this modifies data inside the container data" sounds pretty clear, that's why I'm asking.
Cheers,
Frank
Hello,
my third post this morning
In the latest C4D 2024, I frequently see this in the Visual Studio debug console:
Description::SetPDescription param(-1) is invalid
This message is definitely not sent from my code. And having searched all API code and the SDK docs, I can find no trace of anything called SetPDescription
. And I don't think I'm ever passing a description ID of -1
anywhere. What is it trying to tell me?
Cheers,
Frank
Hello,
I'm trying to track down a random crash in my code, that only occurs in C4D 2024. While I'm manipulating a CustomGui
in my ObjectData
's Description (e.g. by dragging a slider in that CustomGui
), the ObjectData
's GetVirtualObjects()
is called, of course. In that function, I get the CustomGUI
's data. Sometimes, that data is thrashed. Only happens during ongoing GUI interaction.
While investigating, I found this API code in c4d_basecontainer.h:
template <typename DATATYPE> DATATYPE* GetCustomDataTypeWritableObsolete(Int32 id)
{
// TODO: (Tilo) needs to be rewritten for COW support because this modifies data inside the container data
const GeData& dat = GetData(id);
return MAXON_REMOVE_CONST(dat).GetCustomDataTypeWritable<DATATYPE>();
}
This seems to be the only way to get a writable pointer to a CustomDataType
in a BaseContainer
. Is it? Because, that comment sounds portentous.
Thanks in advance!
Cheers,
Frank
Hi,
I noticed that, with the last C4D 2024 update, VolumeData::AttachVolumeDataFake() has two new parameters: Int32 fakeCurrentThreadIdx and Int32 fakeThreadCount. These are not documented, and not shown in the code snippet.
Are these to fix the known issues with sampling a BaseShader from multiple threads (https://developers.maxon.net/forum/topic/12521/sample-a-shader-in-3d-space/15?_=1702535567135)? Will they allow me to sample multi-threaded again? What if I don't want to rewrite that code and decide to just continue sampling my shader single-threaded, do I just have to pass 0 as fakeCurrentThreadIdx and 1 as fakeThreadCount?
Cheers,
Frank
Very informative, thank you Ferdinand!
@ferdinand said in Adding a STATICTEXT element to a Description... changes in C4D 2024?:
Good question, I will ask Pablo
Thanks! And say hello to him from me
Hi Ferdinand,
@ferdinand said in Adding a STATICTEXT element to a Description... changes in C4D 2024?:
Have you stepped through your code, to check how it behaves; does it go into the MAXON_LIKELY, what is the return value of SetParameter?
Yes, I have. And it does go into the MAXON_LIKELY
and SetParameter()
does return true
.
@ferdinand said in Adding a STATICTEXT element to a Description... changes in C4D 2024?:
Remember, all IDs up to 1000 in the first DescLevel of a DescID are reserved for Cinema 4D. There is a good chance that you overwrite important data, brick a scene, when you write into that range.
Thanks! Yes, I know that. Using IDs far above 1000
So, knowing that STATICTEXT
IDs of 0
are not working anymore in C4D 2024, here's a question out of curiosity:
In .res
files, it's common practice to use STATICTEXT {}
to fill up empty space, e.g. in a layer layout with columns. What ID values does C4D use for STATICTEXT
elements like this?
Cheers,
Frank
Ah, I think I found it already.
In earlier C4D API versions, it was okay to provide an id
value of 0
. Since C4D 2024, we have to provide a proper value. Calling my AddStaticText()
function with an id
other than 0
works.
Hi,
sometimes I need to add a STATICTEXT element to a Description
in GetDDescription()
. I have this function that I've been using for many years now, and that works fine in R20 - C4D 2023. However, in C4D 2024, calling it does not do anything.
maxon::Bool AddStaticText(Description* const description, const DescID* const singleId, const DescID& groupid, const maxon::Int32 id = 0, const maxon::String& name = ""_s)
{
if (!description)
return false;
const DescID descId = CreateDescID(DescLevel(id, DTYPE_STATICTEXT, 0));
if (MAXON_LIKELY(!singleId || id.IsPartOf(*singleId, nullptr)))
{
BaseContainer bc = GetCustomDataTypeDefault(DTYPE_STATICTEXT);
bc.SetString(DESC_NAME, name);
bc.SetInt32(DESC_ANIMATE, DESC_ANIMATE_OFF);
bc.SetBool(DESC_REMOVEABLE, false);
return description->SetParameter(descId, bc, groupid);
}
return true;
}
I call it like this:
Bool MyObject::GetDDescription(const GeListNode* node, Description* description, DESCFLAGS_DESC& flags) const
{
if (!node || !description)
return false;
if (!description->LoadDescription(node->GetType()))
return false;
flags |= DESCFLAGS_DESC::LOADED;
const DescID* const singleid = description->GetSingleDescID();
if (!AddStaticText(description, singleid, MYOBJECT_SOMEGROUP))
return false;
return SUPER::GetDDescription(node, description, flags);
}
Why does this not work anymore in C4D 2024?
@ferdinand said in Can't debug C4D 2023 and 2024 on macOS:
first, thank you very much for investing more time into this and with that saving time for me, truly appreciated.
You're welcome. If any of this get any of us further it's worth the time.
@ferdinand said in Can't debug C4D 2023 and 2024 on macOS:
But let us discuss the details per mail.
Okay!
Cheers,
Frank
Well, well, well, there we have it. It's a Redshift issue! After removing the Redshift .xlib files from /corelibs and /Redshift, most of the error messages are gone, and so is the crash. Tested in C4D 2023.2.
Another idea: You could also use some primitive way to render an object mask (e.g. white object on black background), and then run an edge recognition kernel on the resulting image.