Randomize Seed on MULTIPLE Noise Modifiers on a Single Object (for Multiple Selected Objects)

Hello,

I'm trying to figure out a way to randomize the seed on MULTIPLE noise modifiers on multiple selected objects. As in: Each object has anywhere from 2-4 noise modifiers and I need to be able to rendomize them all.

So far, I have this from user br0t. It works well for randomizing ONLY the top noise modifier but it doesn't randomize the noise modifiers underneath the top one:

Any suggestions / tips would be greatly appreciated!

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
AttachmentSize
capture2412516136.jpg21.01 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

.

(
	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
			(
				selObjsArr = selection as array
				for o in selObjsArr do
				(
					if (modsCnt = o.modifiers.count) != 0 do
					(
 
						for m = 1 to modsCnt where (classof o.modifiers[m] == Noisemodifier) do
						(
							o.modifiers[m].seed = random minR maxR
						)
					)
				)
			)
			else messagebox "Select at least one Object."
		)
	)
	createDialog randomNoiseSeed
)
DotScott1's picture

:o

:o It was so simple... yet I didn't figure it out. YOU ARE MY HERO, miauu!! It works perfectly, THANK YOU!

miauu's picture

.

I am glad to help.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.