ScriptSpot

Forum topic · General Scripting

mass noise modifier seed rendomizer help

By splinterD · 2010-01-03

Description

hi im tring to change the seed value on a noise modifier
for a bunch of selected objects
but cant make a script work
im just starting with scripting and came up with this
$.modifiers[#Noise].seed = random 1 9999
but it will only work when one object is selected
can any one help me with this ?
it will save me allot of time

thanks

Comments (4)

Any joy?

grasshopper · 2010-10-06

Did you have any luck getting this script to work? It would be really useful and save a load of time. I tried the scripts but they didn't seem to have any effect at all.

Anubis · 2010-01-03

Hi Andy, your code is simple but not check if objects has noise modifier applied.

for i in selection where i.modifiers[#Noise] != undefined do
i.modifiers[#Noise].seed = random 1 9999

This also a quick code. If some modifier renamed - the script will omit it. For this cases will need class check.

andy_alesik · 2010-01-03

maybe you want it a little bit simplier, try this one. Select the objects with the noise modifier applied and type this either into a new editor or the listener:

for obj in selection do (
obj.modifiers[#Noise].seed = random 1 9999
)

br0t · 2010-01-03

hi, all you need is for loop that does your command for every object in the selection, and maybe some error checking. you may use this little tool:


macroscript randomNoiseSeed
category:"Custom"
tooltip:"Randomize Noise Seed on selected Objects"
buttontext:"noiseSeed"
(
	rollout randomNoiseSeed "Noise Seed" width:117 height:77
	(
		label lbl1 "Seed Range:" pos:[5,3] width:69 height:15
		spinner spn1 "" pos:[5,22] width:44 height:16 range:[0,1000000,0] type:#integer
		spinner spn2 "" pos:[69,22] width:45 height:16 range:[0,1000000,9999] type:#integer
		label lbl2 "to" pos:[54,25] width:14 height:14
		button btn5 "Randomize Seed" pos:[6,45] width:107 height:27
		
		on btn5 pressed do
		(
			local minR = spn1.value
			local maxR = spn2.value
			if selection.count > 0 then
			(
				for i=1 to selection.count do
				(
					try (selection[i].modifiers[#noise].seed = random minR maxR)
					catch (print ("No Noise-Modifier found on "+selection[i].name))
				)
			)
			else messagebox "Select at least one Object."
		)--end on
	)--end rollout
	createDialog randomNoiseSeed
)--end macro
Attachments