Notifications
Clear all

[Closed] New to This

Hey guys,
I have started with Maxscript and wanted to ask something.Lets say I have created a GUI and it has a spinner which controls the Blur Amount of the maps inside the diffuse channel in the Material Editor…So after creating the spinner I have called teh function

“on _blur amnt changed do”

where bluramnt is the spinner

Now this is where I cant seem to call the function where I want to change the value of all the blur amounts of all the diffuse maps in all the materials…Like when I will change my spinner it will change the blur value of all the materials diffuse slots which has somekind of 2D map in it…

Hope I am clear enough…

Thanks Guys,
Regards,
Entrancea

9 Replies

Here is the Script so far…


global MyBlurValue

try (destroydialog MyBlurValue)catch()

rollout MyBlurValue “Blur Value Controller”

(

spinner _blur “Blur Value” type:#float range:[0.01,10000,1.0]

button theButton “About”

on theButton pressed do

(

messagebox “This is a script to reduce the blur value
of the diffuse slot in the Materials”

)

—–variables

on _blur amnt changed do

(

)

)

createdialog MyBlurValue


Regards,
Entrancea

this should get you started. I noticed that some materials (such as the electric map) may not work with .coords.blur so instead it may be coordinates.blur instead or something. You’ll need to add if statements to check for errors for stuff like “if there is no diffuse map” or “if there is no selection” ( if selection == undefined then ) And it currently works only on selection… probably easier this way

rollout MyBlurValue "Blur Value Controller"

(

spinner _bluramnt "Blur Value" type:#float range:[0.01,10000,1.0]

button theButton "About"

on theButton pressed do

(

messagebox "This is a script to reduce the blur value
of the diffuse slot in the Materials"

)


-----variables

on _bluramnt changed amount do
	(
		for obj in selection do
		(
			obj.material.diffusemap.coords.blur = _bluramnt.value
		)
	)
)

createdialog MyBlurValue 

Dude…Thanks a hell lot…I understood what you changed…So it will change the value of the blur for the selected object…very interesting…I think am gonna start diving into scripting a lil more now…Could you tell me as to how you started learning MaxScript?

Thanks Dude,
Regards,
Entrancea

Allright…One problem…It seems that when I try to adjust the spinner it doesnt seem to work for multi-sub objects?:sad:
Am using Max 2008 and it says that .value is undefined…

Hi,

i had this in the ‘cave’

(
try (destroydialog RO_Blur) catch()
global RO_Blur
rollout RO_Blur "Blur Value"
(
radiobuttons rdo_sel labels:#("Scene","Selection")
spinner spn_blur "Blur Value" range:[0.01,100,1.0] scale:0.01
on spn_blur changed val do
(
local objs = if rdo_sel.state==1 then
	for obj in objects where obj.material != undefined collect obj
	else for obj in selection where obj.material != undefined collect obj
 
for obj in objs do
(
	if classof obj.material == Multimaterial then
	(
	 for m in obj.material.materialList do
	 try (m.diffusemap.coords.blur = val) catch (try (m.diffusemap.coordinates.blur = val) catch())
	)
	else
	 try (obj.material.diffusemap.coords.blur = val) catch (try (obj.material.diffusemap.coordinates.blur = val) catch())
)
)
)
createdialog RO_Blur 
)

Thanks a lot dude…Could you tell me as to how I could get more into learning Maxscripting?

Cg Academy has 3 maxscript dvds… they’re excellent. Get them. Order them now. Buy Buy Buy! ALL OF THEM! 😮

Read the docs! Sounds silly, but Bobo (and many others) have done some excellent work on providing a number tutorials

Search this forum, read this fourm and most importantly, ask lots of questions

It also helps to have a little coding background

Shane

Ian:- Yes Yes Yes…I will get buy them…Thanks Thanks Thanks…

RustyKnight:-I surely will bug you guys with questions allright…Actually I have done my Bachelors in IT(B-Tech)…So I know programming a bit… …I am trying to get into Maxscript cause what I have seen is if I develop my own tools and all then my workflow enhances by a whole lot…But thanks for all your help guys…

Regards,
Entrancea