NodeData Undo
-
Hi,
For what i understand, using node->SetParameter should take care of the undo. Did you try with a different DESCFLAGS_SET flag?
You can always send the message yourself to the node.
DescriptionInitUndo uu; uu.doc = doc; uu.descid = &m_LinkID; obj->Message(MSG_DESCRIPTION_INITUNDO, &uu);
More lines but you will be sure that the Undo is handle in the same place.
Cheers,
Manuel -
@m_magalhaes
I did try with DESCFLAGS_SET::
NONE
PARAMSET
USERINTERACTIONBut none of these 3 triggered the message.
I will try to send the messaeg myself. -
@m_magalhaes said in NodeData Undo:
uu.descid = &m_LinkID;
Seeing this makes me assume I will need to provide a member variable for each description ID I intend to have an undo for?
And I would need to send a message for each and every description ID?I'd much rather prefer going with the single call to perform an
AddUndo
instead. -
Hi,
well, the structure DescriptionInitUndo have a descid variable you can provide.
As you react to MSG_DESCRIPTION_INITUNDO this descid can be whatever you need to trigger the action you want.
Cheers,
Manuel -
@m_magalhaes said in NodeData Undo:
well, the structure DescriptionInitUndo have a descid variable you can provide.
As you react to MSG_DESCRIPTION_INITUNDO this descid can be whatever you need to trigger the action you want.
Right, but that uu.descid expects a pointer.
Which means you cannot simply pass the description ID of a gadget, but need to allocate some memory and keep that active until the message has been processed.With RECTANGLE_ROTATION_ID defined in the desription header
I can simply set the parameter via:node->SetParameter(RECTANGLE_ROTATION_ID ...
I cannot do:
uu.descid = RECTANGLE_ROTATION_ID
-
Hi,
this should work.
DescriptionInitUndo uu; uu.doc = doc; // define the descid uu.descid = &DescID(RECTANGLE_ROTATION_ID); // or DescID tid = MSG_DESCRIPTION_INITUNDO; uu.descid = &tid;
Cheers,
Manuel -
@m_magalhaes said in NodeData Undo:
this should work.
DescriptionInitUndo uu;
uu.doc = doc;
uu.descid = &DescID(RECTANGLE_ROTATION_ID);Unfortunately!
That's exactly what I had tried from the start but while the message gets delivered the descid didn't survive. -
Looking at the content of uData.descid when manually changing the gadget, I see it contains
10050 = the ID of the description float field ((RECTANGLE_ROTATION_ID)
1057224 = the plugin ID of the NodeData description.Should the plugin ID of the NodeData description be passed somewhere during:
DescriptionInitUndo uu; uu.doc = doc; uu.descid = &(RECTANGLE_ROTATION_ID); obj->Message(MSG_DESCRIPTION_INITUNDO, &uu);
?
-
Hi,
Sorry i forgot this thread. what version of cinema4D are you using (just in case)
Cheers,
Manuel -
@m_magalhaes
At the moment I am using R20. -
Hi,
sorry for that huge delay.
I tried again and it's working even on R20. The descid isn't something to consider. I mean i have the same kind of result, count = 0 and 0x00000 address but it's working.
The undo is added correctly, if the undo arrow is grey out, it become active. That mean an undo step has been added.
Just in case, what's important is to call the message before the change happen because CHANGE_SMALL must be called before.Cheers,
Manuel -
Hello @C4DS,
without any further questions, we will consider this topic as solved by Monday, the 25th and flag it accordingly.
Thank you for your understanding,
Ferdinand