*NEW* Switch Icons (updated 12/13/21)

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Wesleysales3d
Posts: 8
Joined: Wed May 05, 2021 3:18 am
Location: Brazil
Contact:

Re: *NEW* Switch Icons

Post by Wesleysales3d »

OMG, it was released!
Thank you so much for making this great resource available to Moho, the community thanks you!
User avatar
Lukas
Posts: 1297
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: *NEW* Switch Icons

Post by Lukas »

synthsin75 wrote: Sun May 23, 2021 7:16 pm Just updated with fixes for Mac, update button icon, and colorized icon option, all provided by Lukas (thanks again), as well as a minor bug fix.
If you use the colorized icon, you'll need to change line 14, as noted in the script.

Lukas, I think I followed the correct Mac conventions to account for the document being saved to a different name after generating thumbnails, line 509-522. Please let me know if you find that doesn't work.
Happy to contribute to a tool like this!

There's some small macOS stuff still:

string.sub needs to be string.gsub and renaming the folder should use the move (mv) command:

Code: Select all

		if (opSys ~= "win") then
			old = string.gsub(old, " ", "\\ ")
			new = string.gsub(new, " ", "\\ ")
			-- os.execute("mkdir "..new) -- don't create the directory, otherwise it will put the old directory inside the new directory
			os.execute("mv "..old.." "..new)
		else
			os.rename(old, new) --rename thumbnail folder
		end
and removing the directory:

Code: Select all

os.execute("rmdir ".."\""..Syn_SwitchIcons.docFolder.."\"")	--OSX
needs to be something like:

Code: Select all

			local removeDir = string.gsub(Syn_SwitchIcons.docFolder, " ", "\\ ")
			os.execute("rm -r "..removeDir) --OSX
			print ("rm -r "..removeDir)
🤓
User avatar
gilcartunista
Posts: 55
Joined: Mon Mar 14, 2016 7:13 pm
Location: https://www.facebook.com/gil.cartunista
Contact:

Re: *NEW* Switch Icons

Post by gilcartunista »

Estou tão contente que esta ferramenta foi lançada! mas no momento não tenho dinheiro para comprar moho13, tem alguma possibilidade de eu usar em minha versão 11 , pois esta eu comprei e tenho número serial. Grato
User avatar
synthsin75
Posts: 9973
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *NEW* Switch Icons

Post by synthsin75 »

Lukas wrote: Mon May 24, 2021 8:32 am Happy to contribute to a tool like this!

There's some small macOS stuff still:
Thanks again, Lukas.
I've updated the original link: https://www.dropbox.com/s/2wq24rt3vvr3j ... s.zip?dl=0
User avatar
synthsin75
Posts: 9973
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *NEW* Switch Icons

Post by synthsin75 »

gilcartunista wrote: Mon May 24, 2021 12:38 pm Estou tão contente que esta ferramenta foi lançada! mas no momento não tenho dinheiro para comprar moho13, tem alguma possibilidade de eu usar em minha versão 11 , pois esta eu comprei e tenho número serial. Grato

Translation:
I am so glad that this fermentation has been launched! But there is no time I have no money to buy moho13, have some possibility of using it in version 11, but this is the EU and I have a serial number. Welcome
As far as I know, this should work in AS11.
User avatar
synthsin75
Posts: 9973
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *NEW* Switch Icons

Post by synthsin75 »

Just updated to disable moving the thumbnail files if you rename the document. I don't think, off hand, that there's any way for Moho to tell the difference between a renamed file and switching tabs to another opened document, so this tool was consolidating thumbnails for both documents to the current one.

So you will want to save the file before generating your thumbnails.
User avatar
SimplSam
Posts: 1048
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: *NEW* Switch Icons

Post by SimplSam »

synthsin75 wrote: Mon May 24, 2021 5:33 pm As far as I know, this should work in AS11.
Did a quick test and it trips up on a couple of Moho 12+ only features:
- LM.GUI.PopupDialog: uses of SetToolTip is not supported
- LM.GUI.ImageButton: uses the recolor parameter, which is not supported

Also...
- LM.GUI.CheckBox("Timeline visibility", self.TVIS): self.TVIS / Syn_SwitchIconsSettingsDialog.TVIS is not defined (nil), which AS11 errors on but later Moho's seem to ignore/accommodate.

Also...
There is something odd going on with layer:SecondarySelection() not working with a single layer selected, which I suspect is a AS11 limitation. Resulting in the Update button not working for single layer selections, but alt-click working.
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
User avatar
synthsin75
Posts: 9973
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *NEW* Switch Icons

Post by synthsin75 »

Thanks, Sam.

The "Timeline visibility" was never implemented, and no longer exists as of a version or two ago.
I just uploaded a new version that *should* handle all those AS11 issues.
User avatar
hayasidist
Posts: 3523
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: *NEW* Switch Icons

Post by hayasidist »

Just dropped in to this conversation to say thanks for the script - I've got a few big (non-Moho) deadlines coming in the next couple of weeks, so I'm hoping to put this to good use soon after that!
User avatar
gilcartunista
Posts: 55
Joined: Mon Mar 14, 2016 7:13 pm
Location: https://www.facebook.com/gil.cartunista
Contact:

Re: *NEW* Switch Icons

Post by gilcartunista »

I am so glad that this tool has been launched! I downloaded your last update but it still doesn't work on my version 11, I'm sending the image of the error. Grateful.
Image
https://imgbox.com/8HHlbVal
User avatar
synthsin75
Posts: 9973
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *NEW* Switch Icons

Post by synthsin75 »

gilcartunista wrote: Tue May 25, 2021 1:55 pm I am so glad that this tool has been launched! I downloaded your last update but it still doesn't work on my version 11, I'm sending the image of the error. Grateful.
Image
https://imgbox.com/8HHlbVal
Oops, missed that one. It's fixed now.
User avatar
gilcartunista
Posts: 55
Joined: Mon Mar 14, 2016 7:13 pm
Location: https://www.facebook.com/gil.cartunista
Contact:

Re: *NEW* Switch Icons

Post by gilcartunista »

Wes! you are great !!! It's working PERFECTLY !!! This is a tool that puts MOHO above the rest! Congratulations!
Grateful!!!
User avatar
Víctor Paredes
Site Admin
Posts: 5665
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Re: *NEW* Switch Icons

Post by Víctor Paredes »

This is very useful, clever and impressive script.
Thank you, Wes and everyone involved!
Image Image Image Image
Moho Product Manager

www.mohoanimation.com
Rigged animation supervisor in My father's dragon - Lead Moho artist in Wolfwalkers - Cartoon Saloon - My personal Youtube Channel
User avatar
A.Evseeva
Posts: 61
Joined: Wed Apr 08, 2015 8:43 am
Contact:

Re: *NEW* Switch Icons

Post by A.Evseeva »

For me it worked only once after selecting the tool and then fired an error.
Some changes near line 220 fixed this:

Code: Select all

	--print(val)
	--start edit
	local switchChannel = self.switch:Layer(ID):AncestorSwitchLayer():SwitchValues()
	switchChannel.value:Set(val)
	switchChannel:StoreValue()
	--end edit
	self.moho:UpdateUI()
	MOHO.Redraw()
User avatar
synthsin75
Posts: 9973
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *NEW* Switch Icons

Post by synthsin75 »

Thanks, Alexandra.

Not seeing that problem here, but added your edit.
Post Reply