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!