Page 1 of 1

Script to enable animated noise for multiple vector layers?

Posted: Tue Sep 24, 2013 3:08 am
by Lukas
Maybe a scripter can help me out here?

I have a lot of projects where I have to enable Noisy outlines, Noisy fills & Animated noise on all vector layers. A script that would change this for all (or all selected) vector layers, would be great.

If it's not too hard to script, I'd appreciate it a lot!

Re: Script to enable animated noise for multiple vector laye

Posted: Tue Sep 24, 2013 4:10 am
by Onionskin
You can do this with Ramon's lost layer tool viewtopic.php?f=12&t=16862 , but first you have to select all vector layers, if it is to much work try with this menu script, but for noise settings you must go into the script code and change manually.

Code: Select all

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

ScriptName = "LM_Sketchy"

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

LM_Sketchy = {}

LM_Sketchy.BASE_STR = 2480

function LM_Sketchy:Name()
	return "Sketchy"
end

function LM_Sketchy:Version()
	return "6.0"
end

function LM_Sketchy:Description()
	return MOHO.Localize("/Scripts/Menu/Sketchy/Description=Applies a sketchy line style to all vector layers in the document.")
end

function LM_Sketchy:Creator()
	return "Smith Micro Software, Inc."
end

function LM_Sketchy:UILabel()
	return(MOHO.Localize("/Scripts/Menu/Sketchy/ApplySketchyEffect=Apply Sketchy Effect"))
end

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

function LM_Sketchy:IsEnabled(moho)
	return true
end

function LM_Sketchy:ConvertLayer(moho, layer)
	if (layer:LayerType() == MOHO.LT_VECTOR) then
		local vectorLayer = moho:LayerAsVector(layer)
		vectorLayer.fNoisyLines = true
		vectorLayer.fAnimatedNoise = true;
		vectorLayer.fExtraSketchy = true;
		vectorLayer.fExtraLines = 5;
		vectorLayer.fNoiseAmp = 6.0 / moho.document:Height();
		vectorLayer.fNoiseScale = 48.0 / moho.document:Height();
	elseif layer:IsGroupType() then
		local groupLayer = moho:LayerAsGroup(layer)
		for i = 1, groupLayer:CountLayers() do
			local subLayer = groupLayer:Layer(i - 1)
			self:ConvertLayer(moho, subLayer)
		end
	end
end

function LM_Sketchy:Run(moho)
	for i = 1, moho.document:CountLayers() do
		moho.document:Layer(i - 1):SetSecondarySelection(true)
	end

	moho.document:PrepMultiUndo()
	moho.document:SetDirty()

	for i = 1, moho.document:CountLayers() do
		moho.document:Layer(i - 1):SetSecondarySelection(false)
	end

	for i = 1, moho.document:CountLayers() do
		local layer = moho.document:Layer(i - 1)
		self:ConvertLayer(moho, layer)
	end
end

Re: Script to enable animated noise for multiple vector laye

Posted: Tue Sep 24, 2013 4:23 am
by Onionskin
omg, one correction, seems like script above is not custom, it is official in ASP under scripts/draw/apply sketchy effect

Re: Script to enable animated noise for multiple vector laye

Posted: Tue Sep 24, 2013 4:38 am
by Lukas
Thanks for the quick reply! I didn't know (or forgot about it because it's tucked away)!

This is gonna save me a lot of time :)

Re: Script to enable animated noise for multiple vector laye

Posted: Tue Sep 24, 2013 4:52 am
by Onionskin
now I remember, I had script like you described but it won't work in 9.5. It was made by Stan and with some Wes modification it was great http://www.kelleytown.com/forum/animato ... PIC_ID=312

Re: Script to enable animated noise for multiple vector laye

Posted: Tue Sep 24, 2013 5:47 am
by Lukas
Thanks :)

I added vectorLayer.fNoisyShapes = true; and changed the settings in the original script, it took me some time to figure out it wasn't fNoisyFills. Works great now. Cheers!