-- **************************************************
-- Provide Moho with the name of this script object
-- **************************************************

ScriptName = "SZ_CollapseAllGroups"

-- **************************************************
-- General information about this script
-- **************************************************

SZ_CollapseAllGroups = {}

function SZ_CollapseAllGroups:Name()
	return self:Localize('UILabel')
end

function SZ_CollapseAllGroups:Version()
	return '1.0'
end

function SZ_CollapseAllGroups:UILabel()
	return self:Localize('UILabel')
end

function SZ_CollapseAllGroups:Creator()
	return 'Stan from 2danimator.ru'
end

function SZ_CollapseAllGroups:Description()
	return self:Localize('Description')
end

-- **************************************************
-- Is Relevant / Is Enabled
-- **************************************************

function SZ_CollapseAllGroups:IsRelevant(moho)
	return true
end

function SZ_CollapseAllGroups:IsEnabled(moho)
	return true
end

-- **************************************************
-- The guts of this script
-- **************************************************

function SZ_CollapseAllGroups:Run(moho)
	local count = 0
	repeat
		local layer = moho.document:LayerByAbsoluteID(count)
		if layer then
			count = count + 1
			local groupLayer = moho:LayerAsGroup(layer)
			if groupLayer then
				groupLayer:Expand(false)
			end
		end
	until not layer   
	moho:UpdateUI()
end

-- **************************************************
-- Localization
-- **************************************************

function SZ_CollapseAllGroups:Localize(text)
	local phrase = {}

	phrase['Description'] = 'Collapses all group layers'
	phrase['UILabel'] = 'Collapse All Groups'


	local fileWord = MOHO.Localize("/Menus/File/File=File")
	if fileWord == "Файл" then
		phrase['Description'] = 'Сворачивает все групповые слои'
		phrase['UILabel'] = 'Свернуть все группы'

	end

	return phrase[text]
end

Collapse All Groups
Listed

Author: Stan View Script
Script type: Button/Menu

Uploaded: Dec 26 2020, 22:04

Menu script to collapse all groups in the Layer panel
Image

Installation Options:

This script, and all other scripts on this site are distributed as free software under the GNU General Public License 3.0 or later.
Downloads count: 165