PSD insignia and Duplicate as PNG

Discuss ideas for new features with other users. To submit feature requests to Smith Micro, please visit support.smithmicro.com

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
SimplSam
Posts: 1048
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

PSD insignia and Duplicate as PNG

Post by SimplSam »

In Moho 13 (R.I.P) PSD images were distinguished from other normal images with the PSD insignia. It would be great if we could have that feature back.

It also had a handy 'Duplicate as PNG' feature. It would be great to have that also but with some prompts about naming/location/prefix etc.

Image

and in an ideal world the Type of layer would also be 'PSD Image' or 'Image PSD' as opposed to 'Image' - so that they are searchable/filterable.

and in an even more ideal world there would be access to a script function DuplicateLayerAsPng.
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: PSD insignia and Duplicate as PNG

Post by synthsin75 »

If you want a hack in the meantime, drop this into your tool folder to silently prefix every PSD layer name with "(PSD) ", when selected.

Code: Select all

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

ScriptName = "Syn_PSDLabel"

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

Syn_PSDLabel = {}

function Syn_PSDLabel:Name()
	return "PSD Label"
end

function Syn_PSDLabel:Version()
	return "0.1"
end

function Syn_PSDLabel:Description()
	return "Label PSD layers"
end

function Syn_PSDLabel:Creator()
	return "©2021 J.Wesley Fowler (synthsin75)"
end

function Syn_PSDLabel:UILabel()
	return "SYN: PSD Label"
end


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

function Syn_PSDLabel:ColorizeIcon()
	return true
end

function Syn_PSDLabel:IsRelevant(moho)
	--label PSD layers
	if (moho.layer:LayerType() == MOHO.LT_IMAGE) then
		local prefix = "(PSD)"
		local len = 5
		local name = moho.layer:Name()
		if (moho:LayerAsImage(moho.layer):IsPSDImage()) then
			if (name:sub(1,len) ~= prefix) then
				moho.layer:SetName(prefix .. " " .. name)
			end
		else
			if (name:sub(1,len) == prefix) then
				layer:SetName(name:sub(len+2))
			end
		end
		moho:UpdateUI()
	end
	return false
end
User avatar
SimplSam
Posts: 1048
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: PSD insignia and Duplicate as PNG

Post by SimplSam »

Thanks. I am playing with a variation of this and TAGS as I need to preserve the layer names.
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
Post Reply