Is there a way to undo selection for GeDialog(GUI)?
You can see the problem here:
As you can see, I changed the FK to IK and it is reflected in the viewport.
I pressed Ctrl+Z and it is reflected in the viewport (i.e reverted back to FK) but the GUI is still in IK selection.
There is an existing thread that says it is not possible. Is this still relevant today?
If so, are there any other alternatives?
I was thinking of having to reinitialize values through InitValues() for every 5 second so that the UI will sync to the viewport but I'm not sure if this is a standard.
I found this documentation in the C++ manual that says:
"To start and end an undo based on some interaction in a GeDialog the messages BFM_INTERACTSTART and BFM_INTERACTEND can be used."
I tried this in the GeDialog and got a TypeError:
def Message(self, msg, result):
return gui.GeDialog.Message(self, msg, result)
TypeError: argument 2 must be c4d.GeListNode
I don't think I'm setting up the Undo correctly because what can be passed to doc.AddUndo from the GeDialog that is GeListNode? Without the doc.AddUndo line, those message conditionals do work.
You GUI should update when something change in the scene.
In this case you can use CoreMessage to trigger an update function if something have change.
Check the value and update your GeDialog accordingly
self.comboBox = 2000
self.FK = 2001
self.IK = 2002
cycle = self.AddComboBox(self.comboBox, c4d.BFH_SCALEFIT, 100, 10, False, True);
self.AddChild(self.comboBox, self.FK, "FK");
self.AddChild(self.comboBox, self.IK, "IK");
# retrieves the tag where we want to change the value of the field
doc = c4d.documents.GetActiveDocument()
if doc is None:
raise ValueError("no active document")
op = doc.GetActiveObject()
if op is None:
raise ValueError("no active Object")
tag = op.GetTag(1019561)
if tag is None:
raise ValueError("no IK tag found on this object")
# Check the value of the field of the tag and set the value of the gadget
tag = self.FindTag()
if tag[c4d.ID_CA_IK_TAG_IKFK] == 1.0:
def Command(self, id, msg):
# Reacts to the change of the combo box, update the tag value.
if id == self.comboBox:
value = self.GetInt32 (self.comboBox)
if value == self.FK:
self.FindTag()[c4d.ID_CA_IK_TAG_IKFK] = 1.0
self.FindTag()[c4d.ID_CA_IK_TAG_IKFK] = 0.0
def CoreMessage(self, id, msg):
# If something have change in the scene, check the values
if (id == c4d.EVMSG_CHANGE):
Thanks for the response and the confirmation that Undo is not included in the GeDialog(GUI).
That said the supplied code works on my use case.