COFFEE Undo Not Working In R10.x

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/11/2007 at 05:18, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   10.x 
Platform:   Windows  ;   
Language(s) :   C.O.F.F.E.E  ;

---------
I am trying unsuccessfully to have COFFEE undo the creation of a base tag in R10.x.

Undo calls work perfectly in the following example in R9.6 but have no effect in R10.x. (This code goes into a COFFEE expression tag with a Boole user data element to trigger creation of a display tag.)

> _
> main(doc, op)
> {
> var ttag = op- >GetFirstTag();
>
> while(ttag->GetType() != Tcoffeeexpression)
> {
>     ttag = ttag->GetNext();
> }
>
> var addTag = ttag#ID_USERDATA:1;
>
> doc->StartUndo();
>
> if(addTag)
> {
>     var dispTag = AllocTag(Tdisplay);
>     op->InsertTag(dispTag);
>     doc->AddUndo(UNDO_NEW, dispTag);
> }
>
> ttag#ID_USERDATA:1 = FALSE;
> doc->EndUndo();
> }
> _

Can anyone tell me why this is not working in R10.x?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/11/2007 at 05:36, xxxxxxxx wrote:

To be honest this loks like a hack. You shouldn't create nodes (object/tags/materials, etc.) from within an expression. An expression plugin with an interface where you can catch a button message is probably a better idea because this happens outside of the expression.

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/11/2007 at 15:30, xxxxxxxx wrote:

Thanks for the guidance, Matthias. Looks like I'll have to create an interface for the plugin. Björn mentioned this on the CGTalk forum a couple of years ago too but I had forgotten.