Undo of inserting a tag
-
I have a tag plugin where I move tags from one object to another.
I tried several Undo types, but I cannot get it working.
What to do?childTags = child.GetTags() .... for childTag in childTags: #doc.AddUndo(c4d.UNDOTYPE_CHANGE, object) doc.AddUndo(c4d.UNDOTYPE_HIERARCHY_PSR, object) object.InsertTag(childTag) #doc.AddUndo(c4d.UNDOTYPE_NEW, object)
-
Hi,
undo-steps for inserting objects have to be added after the the object has been inserted; the appropriate flag is then
c4d.UNDOTYPE_NEW
. Could you describe in more detail what is not working?Cheers,
zipit -
Hello,
an undo-step has to start with
StartUndo()
and must end withEndUndo()
. In between, you can add operations to that undo-step withAddUndo()
. As @zipit has shown, the undo-operation for adding something to the document isc4d.UNDOTYPE_NEW
.doc.StartUndo() ttag = c4d.TextureTag() op.InsertTag(ttag) doc.AddUndo(c4d.UNDOTYPE_NEW, ttag) doc.EndUndo()
See also Undo System Manual.
best wishes,
Sebastian -
Also, if you want to move a tag, you first have to remove it from the original object. So you don't insert, you change the position of the tag in the scene graph.
doc.StartUndo() doc.AddUndo(c4d.UNDOTYPE_CHANGE, tag) tag.Remove() op.InsertTag(tag) doc.EndUndo()