Thanks for the reply.
I kinda goofed up- apparently my objects were being improperly deconstructed before I was trying to use them, which was causing the BaseLink to get deleted and crash on subsequent access. BaseLink does indeed work fine and solves my problem. Sorry for the confusion!
I'm trying to build a list of objects pulled in from the scene and save that list for use in future scene updates.
This seems to work fairly well using maxon::BaseArray<BaseObject *>. I can use a combination of GetDirty()/GetHDirty() to keep track of hierarchy changes and invalidate the list when the dirty count is increased. However, if I do an undo in the scene, GetDirty()/GetHDirty() do not update and yet the object pointers are changed- leading to an immediate crash when I try to access them again.
What is the proper way of keeping internal references to objects within the scene? At first glance, BaseLink looks like it might have been the way to go, but I can't seen to figure that one out since creating a new BaseLink with BaseLink::Alloc() and subsequently calling myBaseLink->SetLink(obj) followed by BaseObject *myObject = static_cast<BaseObject *>(myBaseLink->GetLink(doc)) just causes an immediate segmentation fault.
BaseObject *myObject = static_cast<BaseObject *>(myBaseLink->GetLink(doc))
How can I store objects in a safe manner so that I can access them later on (assuming they're still part of the scene)?
Greetings to all.
I am interested in implementing some different cage mesh algorithms for C4D. In essence, I would like to replicate the behavior of the built-in Mesh object, which allows you to drag and drop an object into an in/exclude list and initialize the mesh deformer against that geometry.
What I'm not quite sure of is what the prescribed method should be for accessing the deform cache of another object under my own deformer's ModifyObject() method. Should I simply call GetDeformCache() on each object that I'm calculating my deformations against? Or is there some other technique that I should be using instead? I guess what I'd really like to know is how the Mesh deformer does it, since it seems to work pretty well and in a relatively foolproof manner.
Awesome, that's exactly what I needed to know- thanks for the reply!
I'm using the code detailed here to set a custom datatype value to an Xpresso port:
This seems to work fairly well in practice. I'll start by calling ::Alloc() on my iCustomDataType class to retrieve a new object pointer (since GvGetPortGeData() never seems to return anything on an out port unless I've just set it using GvSetPortGeData()), then feed it to a new GeData instance using the custom data type constructor + plugin ID, then give the GeData object to GvSetPortGeData(). This seems to work fine- I get success from the function and I can see my custom set value magically appear inside Xpresso on the result node (since I've implemented the string calculation type on my custom data type class).
What I'm wondering is this- who owns the original iCustomDataType object I had to create using ::Alloc()? Neither GeData nor the GraphView documents seem to offer any insight into this. Should I be calling the iCustomDataType::Free() method with my object pointer to free it after I've wrapped it up in GeData and passed that to GvSetPortGeData()? Or does GeData/GraphView effectively "own" that pointer from thereon after (assuming GvSetPortGeData() returns success)?
Right, that's kinda what I thought. I guess showing "<< MULTIPLE VALUES >>" for all four values will have to do (it's not that big of a deal, it just kinda looks ugly on the UI).
Anyways, thanks for your help!
Sorry, I might be a bit confused terminology wise here. I wish to create the equivalent of R20's Vector4D datatype, but for versions < R20. What I've noticed with the 3-component vector is that it only says "<< MULTIPLE VALUES >>" on a per-component basis, ie, if two vector components are identical and multiple items are displayed, then those two will be displayed as usual while the components that differ will say "<< MULTIPLE VALUES>>" instead.
What I'm confused about is how this should be handled on a per-component basis under iCustomGui. It seems simple enough to create four float fields, but what I don't get is how I'd track the tristate between those so the entire thing behaves similar to DTYPE_VECTOR (and presumably DTYPE_VECTOR4D).
Is there any chance you might have some examples of how Vector (or Vector 4D) is implemented in this regard?
Sorry about that, I'd noticed that the API was literally wired up to return the value from GetId() inside GetValueId() by default, so I figured that was answer enough... though I suppose that's kinda why I was asking in the first place- I wasn't sure what sort of situation would require two separate IDs.
Thanks for your response though, that certainly clears up why there's two different functions to handle that.
I'm trying to implement a custom GUI similar to the one-line Vector data type in C4D (where you've got 3x real values on a single row), except with 4x values instead (X, Y, Z, and W).
I'm a bit lost with the iCustomGui class at the moment, since I'm not really sure how the TriState stuff is supposed to work with multiple input fields. The example on plugincafe (customgui_string.cpp) only has a single element in it and I think it's only tracking the tristate for that singular thing.
How can I handle 4x real values on a single custom GUI? All I'm trying to do here is replicate the behavior of the Vector data type, but with 4 values instead of 3.
Hey, thanks for the reply.
A custom data type appears to be what I'm looking for. I do have one question for you, if you don't mind- both GetId() and GetValueID() state that they require unique plugin IDs from Plugincafe. Can they both return the same plugin ID, or do they need to be different?