Undo and BaseContainer

Become a member of the CGSociety

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

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 04 April 2006   #1
Undo and BaseContainer

Hi everyone!

I have implemented a tag plugin which do some modifications on the points of an object thanks to sliders. Several sliders can be added by the user and their values are used for the modifications. Each time a slider is modified, the modification is made with a code like this one:

...
// Modifications on the points selected by the tag
...


doc->StartUndo();
Bc.SetContainer(3000, m_vector);
data.SetContainer(MYID, Bc);
tag->SetData(data);
tag->Message(MSG_UPDATE);
doc->AddUndo(UNDO_CHANGE, tag);
doc->EndUndo();

where Bc is a BaseContainer in which my data (m_vector an other BaseContainer which contains several data) are stored.

When I add two sliders and change the sliders values and next do Undo in Cinema4d, the two sliders are removed when the Undo should affect only the laste modification on the points.

Does somebody have an explanation?

Thanks a lot.
Myel.
 
Old 04 April 2006   #2
you're setting your undo on the tag itself, not on the object and to the bit of code where you set the tags basecontainer not editing the object.

however i suspect that even if it was set just on the obejct the tag would also be involved as it's owned by the object.

regardless what you should do is something like this


 Vector *padr = object->GetPoints();
 LONG pcnt = object->GetPointCount();
 if (!padr || pcnt == 0) return;
 
 doc->StartUndo();
 //do some modification to the object directly e.g.
 padr[0]=Vector(0.0);
 doc->AddUndo(UNDO_CHANGE,object);
 doc->EndUndo();


also when you're dealing with objects basecontainers it's much better/faster to simply use the getdatainstance


 BaseContainer *bc = ((PluginTag*)tag)->GetDataInstace();
 if (!bc) return;
 
 bc->SetReal(ID_FOR_REAL,1.0);
 etc...
__________________
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."
 
Old 04 April 2006   #3
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 02:39 AM.


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