THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 21/08/2004 at 10:52, xxxxxxxx wrote:
Cinema 4D Version: 8.503
Platform: Windows ;
Language(s) : C++ ;
I'm trying to understand how one stores information. For example, if I wanted to store a user's selection of points should I:
Maybe I'm just failing to see the structure of/general usage of objects in C4D. Since a tag is associated with an object and an object will have a container perhaps everything gets stored in a container? If so would I need to store my point selections as arrays of vectors?
I'm assuming that I would store bone position/rotation in the same manner?
On 21/08/2004 at 13:27, xxxxxxxx wrote:
It's my understanding (someone correct me if im wrong) that all BaseContainers are stored in the file. So you could use the objects basecontainer. But it looks possible to save data with the other 3 suggestions too. The only dis-advantage with the other 3 that I can see is that the user can delete the tags at any time which would also delete your information.
Im interested in this thread as I have a large linked list that I need to save somehow.
On 21/08/2004 at 18:25, xxxxxxxx wrote:
It's possible to make tags invisible so I'm assuming that would be a way to keep your data safe from being deleted.
I see where it is possible to use ToPoint() on cast an object to a PointObject. I can then use GetPointS() in conjunction with GetPoint() to get the actual vectors. But since PointObject is abstract I can't create an instance of it to store the selection (and I don't see in BaseContainer where it would allow me to store that type anyway). Can I use BaseContainer's SetVector to store the array of vectors?
On 23/08/2004 at 09:34, xxxxxxxx wrote:
Not directly. SetVector() is just for Vector objects, i.e. 3D vectors. You would have to use it for each point in the array.
On 23/08/2004 at 10:51, xxxxxxxx wrote:
Yikes, I don't think that would be very effecient. What about an invisible selection tag for each collection of points? Or one of the others I mentioned (variable tag, base tag of type Tpoint)?
On 23/08/2004 at 14:36, xxxxxxxx wrote:
One advantage of the SelectionTag over the others is that it will be automatically updated during modeling. It isn't possible to hide the selection tag though.
On 24/08/2004 at 10:35, xxxxxxxx wrote:
In a nutshell I want to be able to persist a variable number of vertex arrays. What is the best practice for doing that?
On 24/08/2004 at 10:53, xxxxxxxx wrote:
I'd use SelectionTags. Each selection tag should have the same number of points, lines, or polygons (depending on selection type) as in the Object. The SelectionTag then just retains selected points (or lines, polygons) by setting the value to 1 for those selected in the SelectionTag, 0 for those not.
Think of a SelectionTag as an array of boolean indices into the object's vertex, line, or polygon array which are turned on or off to create the selection. This array is stored in a BaseSelect attached to the SelectionTag.
On 24/08/2004 at 11:09, xxxxxxxx wrote:
That sounds ideal except for Mikael Sterner's comment about them not supporting visiblity. If I have a lot of selection tags wouldn't that make things unwieldy?
On 24/08/2004 at 12:59, xxxxxxxx wrote:
Yes, it can be unwieldy. You should see imported Poser figures with polygon selections for groups and materials - it can go on forever!
It all depends on what you need the selected vertex arrays for. If they are to be regular Selections that users or other features of C4D need (such as bone restrictions), then you are stuck with either SelectionTags or VertexMaps (work very similarly) and unwieldy lists of tags. If they are only for internal plugin use while performing some operations, you could get away with simple UCHAR arrays and set a BaseSelect using BaseSelect->FromArray() as needed.
Point/Line/Polygon selections are store as UCHAR arrays inside a BaseSelect.
Bone/Object Rotations/Positions/Scales are stored in a Transformation Matrix (see Set/GetMg and Set/GetMl).
Other object parameters are stored in BaseContainers.
On 24/08/2004 at 13:34, xxxxxxxx wrote:
Thanks for the advice, I really appreciate it! I'm pretty sure I would only need the data internally, but I would want it to persist. It's my understanding that in order to get automatic persistance, without using the ways mentioned above, would be to use the container. Perhaps I could create a custom data type? I believe the docs say a container can store a custom data type.
On 24/08/2004 at 14:39, xxxxxxxx wrote:
Haven't used custom data types yet, but this may be solution.
Good luck and let us know your solution!
On 30/08/2004 at 05:44, xxxxxxxx wrote:
Leebert, have you solved it? I too need to store an array of vectors into a basecontainer or something.
On 31/08/2004 at 06:13, xxxxxxxx wrote:
I've been spending my time with a paying project so I haven't gotten a chance to pursue this any further. But I will definitely keep you updated once I can get back to it.