On 23/10/2015 at 08:03, xxxxxxxx wrote:
Hi everyone.
I have an ObjectData plugin which processes and stores about 10 million values when a button is pressed. Then, the values are referenced in GetVirtualObjects (roughly 200 000 per frame). If I press undo, the stored values are lost. I've tried to use various AddUndo() etc commands but no success. I assume this is due to the values being stored in a standard list and not something C4D specific like a BaseContainer.
I can actually avoid this problem with a BaseContainer with many sub BaseContainers but unfortunately this seems to slow everything down a lot when reading it back every frame.
Does anyone know if I can keep my standard stored list method using an undo command configuration? Or if I'm missing something obvious?
Here is a fragment of a really simplified version of my plugin:
class MyPlugin(plugins.ObjectData) :
def Init(self, op) :
# ---------------// This is the data that disappears with an undo
self.data = []
return True
def Message(self, op, type, data) :
if type == c4d.MSG_DESCRIPTION_COMMAND:
#---------------// If the update button is pressed, call the update data function
if data["id"][0].id == UPDATE_DATA:
self.Update_Data(op)
return True
def Update_Data(self, op) :
#---------------// Here 's where I fill the array
self.data.append(1)
self.data.append(2)
self.data.append(3)
return True
def GetVirtualObjects(self, op, hh) :
#---------------// And here's where I do stuff with it
for i in self.data:
print i
return None