Im after a script that can change the filter mapping type on materials.....

Hi all.

As the title suggests!

It could be done on all selected objects, all materials in the scene or all materials in the material editor.

Ideally on that works with materials in multi-sub materials too.

Anyone know of such a script or could write one?

Even as a starter, if you could tell me the code that would change the texture filter on opacity maps to none on a selection of objects that would be perfect.

Cheers.

Comments

Comment viewing options

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

It helped me. Thank you.

It helped me. Thank you.

ce89's picture

Barigazy, I have tried using

Barigazy,

I have tried using this snippet of code with Corona Renderer but with no luck. I have tried adding "Opacity color" in the local mapslots array but still no good. I know the property slot is "texmapOpacity" but again this throws up no success.

I'm not sure if you have any experience of Corona Renderer or not? But I'm at a bit of a loss.

barigazy's picture

...

I tried Corona last year.
Try this
Create some object (box for example) and assign Corona material with bitmap in any slot (Opacity slot for example).Select Box and then run this code in the listener and post here result.

fn getMtlMaps mtl maps = 
	(
		if mtl != undefined and mtl.numsubs != 0 do 
		(
			for m = 1 to mtl.numsubs where (mtl[m] != undefined) do 
			(
				if (isKindOf mtl[m] SubAnim) and (isKindOf mtl[m].Object textureMap) do 
				(
					append maps #((filterstring (getSubAnimName mtl m asstring:on) ":")[1], mtl[m].Object)
 
				)
				getMtlMaps mtl[m] maps
			)
		) 
	)
arr=#()
getMtlMaps $.mat arr
print arr 

bga

Script_Butler's picture

Great start, thanks. I

Great start, thanks.

When I have time i will create a ui for it and add in some buttons. Thanks so much, this will save a lot of time!

Cheers.

Script_Butler

barigazy's picture

...

No this change all maps of selected object material but if theses maps are instances of other materials then you need to make them unique.

bga

barigazy's picture

...

Here is a simple snippet. Works with "Bitmap" maps placed in "Opacity" Slot of Standard or VRayMaterial and "Cutout" Slot of Arch&Design material. Of course multimaterial are supported.
Just select multiple objects and run the code below :)
Cheers!

(
	fn getMtlMaps mtl maps = 
	(
		if mtl != undefined and mtl.numsubs != 0 do 
		(
			for m = 1 to mtl.numsubs where (mtl[m] != undefined) do 
			(
				if (isKindOf mtl[m] SubAnim) and (isKindOf mtl[m].Object textureMap) do 
				(
					append maps #((filterstring (getSubAnimName mtl m asstring:on) ":")[1], mtl[m].Object)
 
				)
				getMtlMaps mtl[m] maps
			)
		) 
	)
	if selection.count != 0 do
	(
		local mapSlots = #("Opacity", "Cutout Map")
		for obj in selection where obj.material != null do
		(	
			mapsArr = #()
			getMtlMaps obj.material mapsArr
			if mapsArr.count != 0 do
			(
				for i = 1 to mapsArr.count where findItem mapSlots mapsArr[i][1] != 0 do mapsArr[i][2].filtering = 2
			)
		)
	)
)

bga

Comment viewing options

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