Undo Script Tool?
Moderators: Víctor Paredes, Belgarath, slowtiger
Re: Undo Script Tool?
Not tested this, but you could try this. Save it as LK_Undo.lua in your tools folder. If it works you can also create a redo button next to it, just change all instances of 'undo' into 'redo'
Code: Select all
-- **************************************************
-- Provide Moho with the name of this script object
-- **************************************************
ScriptName = "LK_Undo"
-- **************************************************
-- General information about this script
-- **************************************************
LK_Undo = {}
function LK_Undo:Name()
return "Undo"
end
function LK_Undo:Version()
return "0.1"
end
function LK_Undo:Description()
return "Undo"
end
function LK_Undo:Creator()
return "Lukas Krepel, Frame Order"
end
function LK_Undo:UILabel()
return "Undo"
end
function LK_Undo:IsEnabled(moho)
return true
end
function LK_Undo:IsRelevant(moho)
return true
end
function LK_Undo:ColorizeIcon(moho)
return true
end
-- **************************************************
-- The guts of this script
-- **************************************************
function LK_Undo:Run(moho)
moho.document:Undo()
end
Last edited by Lukas on Tue Aug 03, 2021 8:34 pm, edited 1 time in total.
Re: Undo Script Tool?
Thanks! I tried but it doesn't work. It shows an "unknown" icon in "Other" tools panel but when clicked, no response.
Re: Undo Script Tool?
Ah I see
Code: Select all
ScriptName = "Undo"
Code: Select all
ScriptName = "LK_Undo"
Re: Undo Script Tool?
No problem!
You know what, here's both undo and redo with icons, I see how this would be useful for tablets:
You know what, here's both undo and redo with icons, I see how this would be useful for tablets:
Re: Undo Script Tool?
Here's a zip file with the LUA, PNG icons, Read Me, and Moho document...
http://www.posemotion.com/download/LK_Undo.zip
http://www.posemotion.com/download/LK_Undo.zip
Re: Undo Script Tool?
That's funny! We were thinking the same thing. I made new icons though.
Re: Undo Script Tool?
I renamed the "Undo" files, so that the Undo icon shows before the Redo icon in Moho. It's "LK_1_Undo" now.
Re: Undo Script Tool?
Actually, you can quite easy edit the order the tools are shown in by editing the _tools_list.txt file in the tools folder. So you don't have to change the names to re-order them.
Also, you can have the icons be greyed out if there's nothing to undo/redo by changing the IsEnabled function to this:
Code: Select all
function LK_Undo:IsEnabled(moho)
if moho.document:IsUndoable() then
return true
end
return false
end
Re: Undo Script Tool?
The recommended way is to use the GUI: Edit > Preferences > Tool Layout (even though it is painful if you want to move a lot of stuff around!).
Moho 14.1 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.1 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam
Sam
Moho 14.1 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam
Sam