NathanOtano wrote:
as on the wiki, "tv_undoCloseStack "Action Name""?
I don't know if putting a name after tv_undoCloseStack does do something. Maybe it is a mistake it is written in the WIKI?
does some from the TVPaint team know?
NathanOtano wrote:
And what about update undo? I don't really understand the wiki too.
I've seen some curious things with my undo and my own buttons with "tv_undoX", it undoes but keeps some actions, i think the last ones, even if i undo everything.
I do not fully understand tv_updateUndo either. But if you do script do not undo properly. that means if your project have one state A. and you execute some script surrounded with tv_undoOpenStack and tv_undoCloseStack. and you Update one time. and You don't go back to the same Situation as before the script. then maybe you can solve it with tv_updateUndo. I have noticed especially when switching layers with George mistakes can happen.
I will show you an example
If I have this script to duplicate part of layers to other part of layers
Code: Select all
tv_undoOpenStack
getBounds = "68 139 1091 735"
setBounds = "68 736 1091 1332"
PARSE setBounds x1 y1 x2 y2
dotX = x1+((x2-x1)/2)
dotY = y1+((y2-y1)/2)
run = 1
layerPos = 0
WHILE run
tv_LayerGetID layerPos
lid = result
IF CMP(lid,"NONE")==0
tv_layerSet lid
tv_BrushCut getBounds
tv_restorebrush "subpixel 0"
tv_dot dotX dotY
layerPos = layerPos+1
ELSE
run =0
END
END
tv_undoCloseStack
Here is my Project before the scipt. I have a layer with a blue Cirkle and A layer with a green add sign
![undo_bug00000.jpg](./download/file.php?id=9513&sid=2ecb473eb5b03867e01781080e3a2fc3)
- undo_bug00000.jpg (28.38 KiB) Viewed 1517 times
Then I run my script. And the part of each layers in the "getBound" is copied to the "setBound"
![undo_bug00001.jpg](./download/file.php?id=9514&sid=2ecb473eb5b03867e01781080e3a2fc3)
- undo_bug00001.jpg (31.8 KiB) Viewed 1517 times
But when I press undo I get this
![undo_bug00002.jpg](./download/file.php?id=9515&sid=2ecb473eb5b03867e01781080e3a2fc3)
- undo_bug00002.jpg (29.19 KiB) Viewed 1517 times
It should be the same as before the script of course, but the green add sign is dissapeared, and now I got blue circles on more layers.
Clearly not the disired effect of an undo
![Wink ;)](./images/smilies/icon_wink.gif)
But if I place tv_unpdateUndo just before I switch layers in my script like this
Code: Select all
tv_undoOpenStack
getBounds = "68 139 1091 735"
setBounds = "68 736 1091 1332"
PARSE setBounds x1 y1 x2 y2
dotX = x1+((x2-x1)/2)
dotY = y1+((y2-y1)/2)
run = 1
layerPos = 0
WHILE run
tv_LayerGetID layerPos
lid = result
IF CMP(lid,"NONE")==0
tv_updateUndo // PLEASE NOTICE I PLACED A TV_UPDATEUNDO HERE!!!!!!
tv_layerSet lid
tv_BrushCut getBounds
tv_restorebrush "subpixel 0"
tv_dot dotX dotY
layerPos = layerPos+1
ELSE
run =0
END
END
tv_undoCloseStack
Then I get the desired effect.
I find this a confusing behaviour. And i think it could be nice if tv_UndoOpenStack and tv_UndoCloseStack would work witout tv_updateUndo. I actually think it is a bug and I already have submitted it to the developers and I hope some day they would look at it. But then again it is not that big deal because we can fix it with putting in tv_updateUndo before a layer switch.
A last note on undo Some things you cannot undo forinstance setting the stencil with tv_layerStencil 0 On cannot be undo. But it wil also not be undone if you do it manually in TVPaint(Which I think could be nice. So I just sneak a little feature request in to add momodifying stencil to undo history)
Hope it Helps
-Mads