|
Hi all,
I’ve noticed scripts do not work with Undo by default, I know an FBUndoManager() class exists, but am unsure how to use it. Has anyone seen, or know of any examples of how to use it? I’ve looked on the net but I haven’t had much luck…
Any help appreciated.
Thanks,
Steve.
|
|
|
|
Thought I’d give an update. I haven’t tried hooking this up to my UI or a full procedure yet, but I got some undo functions added to the stack and working.
Demonstrates adding models inside a definition and from and external definition.
def moveMe(m): m.Translation = FBVector3d(5,5,5) k = FBModelCube('cubey') k.Show = True print 'done' return k
u = FBUndoManager() m = FBModelMarker('test') m.Show = True
u.TransactionBegin('step01') u.TransactionAddModelTRS(m) k = moveMe(m) u.TransactionAddModelTRS(k) k.Translation = FBVector3d(-5,-5,-5) u.TransactionEnd()
u.TransactionBegin('step02') u.TransactionAddModelTRS(m) m.Scaling = FBVector3d(5,5,5) u.TransactionEnd()
I’m not sure how limiting the undo options will be in a practical example, manipulating layers and stuff though…
Will update in the future. Hope others find this useful.
|
|
|