How to prevent C4D automatically undo handling?
On 18/07/2013 at 05:02, xxxxxxxx wrote:
t want to allowed undos for my object plugin, but C4D handles undos for parameter changes in the attributes manager of an object automatically ( _MSG_DESCRIPTION_INITUNDO_ ). Im searching for a way to prevent this for days, but i can`t get it.
Please, can somebody tell me it is possible or not?
Or is there a way to get the undo list of C4D to remove the undo entries of my object?
Thank you very much for any advices!
On 18/07/2013 at 05:08, xxxxxxxx wrote:
I know it's not a answer to your question, but why on earth would you want to break CINEMA 4D's undo system for your object?
On 18/07/2013 at 08:51, xxxxxxxx wrote:
this is a good question ^^ and a little bit difficult to explain.
first i don
t need undo for this object, because the plugin is just use in a controller xref. Second i cant implemented undo the right way, so its better not to do it.
But now its not as simple as it seemed to me before.
Maybe your are able to give me some advices to add undo correctly in my plugin :)
My object data plugin translates and rotates polygon objects like a null group.
So i don
t have to change the object axis and do it separately. Why i have to develop a plugin for this simple functions? Because of the defined scene structure, im not allowed to arrange this polygon objects in a null group together or rearrange the scene structure.
Some example code:
_ class Transformator(plugins.ObjectData) :
def Message(self, op, type, data) :
def transformObjs(self,op,objList,rotVec,posVec) :
op: my objectdata plugin
objList: polygon objects to be tansformed (linked in InExcludeList)
rotVec: rotation vector
posVec: position vector
doc = op.GetDocument()
parentList = 
for obj in objList:
#store parent for arranging back later
objMg = obj.GetMg()
#arrange polygon objects under my object plugin
obj.Message(c4d.MSG_CHANGE) #i'm not sure this is nessesary
#arrange back to primary scene structure
for i,obj in enumerate(objList) :
objMgRot = obj.GetMg()
obj.InsertUnder(parentList _) _
By this way, too many undos are created (every single value changed)
like in this post: https://plugincafe.maxon.net/topic/6978/7859_undo-in-plugin&KW=self.mouse_checker&PID=32593#32593
But is actual not the main issues.
The probleme is that i can`t set the polygon object and the controller object (my object plugin) back on the same undo step.
So it is not user friendly and they can make unknown mistakes very easily.
I hope, you can understand me by my bad english skills ;)
Thanks for any tips!
On 18/07/2013 at 09:36, xxxxxxxx wrote:
You are not supposed to add undos in expressions. Just leave it as it is. Though you have to ensure
that for a specific set of parameters and circumstances, your expression must deliver the exact