THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/09/2006 at 13:54, xxxxxxxx wrote:
Cinema 4D Version: 9.6
Platform: Windows ;
Language(s) : C++ ;
Im writing a Tool plugin, and I want to make it possible to undo changes in its parameters.
How to do it?
I have tried:
m writing a Tool plugin, and I want to make it possible to undo changes in it
doc->AddUndo( UNDO_CHANGE, (ToolData* )this) ;
doc->AddUndo( UNDO_CHANGE_SMALL, (DescriptionToolData* )this) ;
and other combinations. But Cinema crash on this strings.
On 23/09/2006 at 14:26, xxxxxxxx wrote:
"ToolData*" type is unambiguously wrong. There I need something like "BaseTool*"
On 23/09/2006 at 15:12, xxxxxxxx wrote:
Have you added doc->EndUndo()?
If that doesn't work, try implementing Message() (R9+ only for ToolData) and checking for MSG_DESCRIPTION_INITUNDO. With this, you do not need to do doc-StartUndo() and doc->EndUndo(), just doc->AddUndo().
On 23/09/2006 at 23:59, xxxxxxxx wrote:
Yes, I have added EndUndo()
How can messages help me? I have problems just with doc->AddUndo(...). I dont know what write inside it. Thank you anyway. .... but ... You give me a good idea. I just need to catch messages which indicate undo command, and perform undo manually. I dont know which constant correspond to it. But it`s value is 200000096
t know what write inside it. Thank you anyway. .... but ... You give me a good idea. I just need to catch messages which indicate undo command, and perform undo manually. I don
On 24/09/2006 at 00:11, xxxxxxxx wrote:
I find it`s name
On 24/09/2006 at 01:02, xxxxxxxx wrote:
But in this case there is a problem with redo...
There is no message sending when user choose redo.
On 24/09/2006 at 01:18, xxxxxxxx wrote:
BaseContainer *writeback = GetToolData(doc,GetToolPluginId());
Before you do it another time call:
Check the SDK edge cut example for detailed information.
On 24/09/2006 at 01:40, xxxxxxxx wrote:
Thank you anyway. But how this code can make tool parameters undoable?
I use code like you wrote, and I have checked SDK edge cut example.
And in SDK edge cut example parameters is not undoable! For example: I choose edge cut tool, and drag in editor, subdivision parameter grows, and new points added. Then I press Ctrl+Z - points disappers but subdivision parameter not changes.
On 24/09/2006 at 02:06, xxxxxxxx wrote:
Your problem is that you are adding the ToolData as the undo object. The undo must be on an 'object' - BaseList2D base-class. For an Attribute Manager value, this is the same - you must set an undo for the 'object' that is affected by the value. For instance, when I change a morph value using an AM slider, the correct path is to store an undo on the polygon object:
// Store undo for IPPBase
else if (type == MSG_DESCRIPTION_INITUNDO)
BaseDocument* doc = node->GetDocument();
if (!doc) return FALSE;
BaseContainer* bc = ((BaseObject* )node)->GetDataInstance();
if (!bc) return FALSE;
BaseObject* orig = bc->GetObjectLink(IPP_ROOT, doc);
if (!orig) return FALSE;
There is no 'undo for the tool', there is only an undo for the affected object! Supposedly, C4D stores undo for AM changes - but only in accordance with the object that is affected by the change. That must be made clear and precise - you are not storing an undo for a slider, but for the affect that the slider causes.
On 24/09/2006 at 02:17, xxxxxxxx wrote:
it is a slightly pity (I want to storing an undo for a slider)
Thank you, Robert.
On 24/09/2006 at 02:24, xxxxxxxx wrote:
I think the slider should undo by default (test this - don't take my work on it), but the affect must be undone as well. So if the slider changes, say translation for simplicity, you store an undo for the change in translation on the object - AddUndo(UND0_CHANGE, obj) - so that the undo will also prompt the obj undo. The slider undo should be automatic (as stated in the documentation - This is already automatically handled for keys, tags, objects etc. ). This is definitely one of those weird areas of the SDK where an AM undo isn't exactly a complete undo unless you specify the connection literally.
On 24/09/2006 at 03:09, xxxxxxxx wrote:
I think for tool with traditional c4d style there is no need to undo sliders (it has no sence).
But simply I try to write something else