Include custom data in a basecontainer

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  02 February 2006
Include custom data in a basecontainer


I need to save some points arrays in my Plugin. Thus, I have used the CustomDataType functions and it works fine : these arrays are saved and loaded correctly. Now, I try to add Undo actions. But I can not use the function BaseContainer::AddUndo(LONG type, void *data) when data points to a element of a CustomDataType because Cinema4D crashes in that case.
Apparently, the reason is that I can use AddUndo() in this way : the data must be included in a container of the document.
Therefore, my question is :

How can I put a CustomDataType in a BaseContainer?
That is not clear in the documentation. Can anybody eventually have a little code?

Thanks in advance,

  02 February 2006
You use SetData, then set it just as you do for any other customdatatype (read up on cinema's universal datatype GeData).

If you're making an object/scenehook etc you shouldn't have any problems with your custom datatype and undo's if you use the CopyTo function correctly, and then you dont' need to store it in the basecontainer.
The Third Party | Homepage | My Reel
"You need to know what you're doing before you start, and to start because you need what you're doing."
  03 March 2006
Thanks for your reply.
In fact, in the Init function, I wrote the following code:

Bool MyTag::Init(GeListNode *node)
BaseContainer *data = tag->GetDataInstance();
GeData Ged = GeData(ID_MCD, M_Dt);
data->SetData(ID_MCD, Ged);
where ID_MCD is the ID for MyType (my CustomDataType), M_Dt is my data of type MyType.

Where do I need to write the same code? Each time I modify my data M_Dt? (by example in the function Message(GeListNode *node, LONG type, void *data) when I modify the contents of M_Dt according to the actions of the user?

I have two other questions:
- Is it enough to load and save my data? Previously, I used the functions CopyTo(NodeData* dest, GeListNode* snode , GeListNode* dnode, long flags, AliasTrans* trn), Read(GeListNode *node, HyperFile *hf, LONG level) and Write(GeListNode *node, HyperFile *hf) for this purpose.
- If I put my data in a basecontainer, how do I use the Undo, i.e. what must I put for data in the function AddUndo(LONG type, void* data), the basecontainer in which are stored my data?

Thanks again in advance,
  03 March 2006
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 04:16 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.