ScriptSpot

Forum topic · Scripts Wanted

Activate checkboxes with materials inside, only

By igamaximus · 2017-09-06

Downloads
Description

Hello guys,

i would really appreciate your help on this topic: i don't need any UI, just if possible 1 click button that should be small fix after material conversion from VrayBlend to fR-Layer material.
I use finalRender R3.5 engine and after materials conversion from VrayBlend to fR-Layer material, this is usual situation and you can see it in attachment. There are 9 layers but only few of them are filled with materials - 2 in this case, and the rest of them are empty. Since VrayBlendMtl does not have these checkboxes, I need small and fast script to check all fR-Layer materials in entire scene (Max 2012 and 2015) and activate only checkboxes for slots that have materials inside (layer 1 and layer 2 in this case), while checkboxes with "none" label on their slots should remain unchecked (layers 3-9). It would be perfect if this could work for fR-Layer materials in MultiSubs, also.
Just for your reference because i believe most of you don't have finalRender R3.5 installed, both checkboxes and material type slots are array type as you can see on attachment.

Maxscript listener for this attachment and layer 1 checkbox (that is turned off) shows:
meditMaterials[1].enableList[1] = off
Maxscript listener for this attachment and layer 3 material list slot (that is emtpy) shows:
meditMaterials[1].materialList[3] = undefined
Property name for fR-Layer material is:
fR_Layer

Thank you very much for your help.

Comments (11)

.

jahman · 2017-09-06

try this. it will affect all fR_layer materials in scene


for m in getClassInstances fR_Layer do (
    for i=1 to m.materialList.count where m.materialList[i] != undefined do (
        m.enableList[i] = true
    )
)

if you'are not sure how this fr_layer material class is named here's how to check it:


for c in material.classes do format "%\n" c

Thank you so much mate

igamaximus · 2017-09-06

I will try with your code tomorrow morning and let you know about the result.
Thanks again, i really appreciate your help.

Works perfectly!

igamaximus · 2017-09-08

Thank you once again Sergey, it works perfectly on entire scene!
Just please tell me, can you send me variant that would work on selected objects only? This way i would use both variants of the script, this one for entire scene and the other one for selected objects only, depending on the case...
Thank you!

.

jahman · 2017-09-08


(
selectedNodes = selection as array
mtls = getClassInstances fR_Layer

    for mtl in mtls do (

	nodes = refs.dependentNodes mtl
		
	for node in nodes where findItem selectedNodes node > 0 do (
			
		for i=1 to m.materialList.count where m.materialList[i] != undefined do (
				m.enableList[i] = true
		)
	)
    )
)

or you can merge needed objects to an empty scene and merge them back later after processing

Thank you Sergey

igamaximus · 2017-09-08

When i try with that code i get this message in attachemnt. Maybe it is not possible, and i can live with that, i will merge it in new scene as you told me. Thank you!

Attachments

jahman · 2017-09-08

My bad. Change all m. to mtl. and it will work

Perfect!

igamaximus · 2017-09-14

Hey Sergey, I just changed all m. to mtl. and it's totally perfect mate! Thank you SO much for your knowledge and kindness! If i can help back with anything of my abilities, please let me know: www.tiny.cc/igorender

.

jahman · 2017-09-14

😎

fR-Layer mats in Multisubs

igamaximus · 2018-10-08

Hey mate,

during usage, i just realized that it doesn't work if fR-Layer is nested inside of Multisub materials. Can you please include that part, if possible??

Thank you so much!

.

jahman · 2018-10-08

Hi. Sorry, I have no fR installed so it is a mistery what could go wrong here.

fR UI visual glitch in mat editor

igamaximus · 2018-10-08

Mate, i just realized it's finalRender UI glitch in material editor, it doesn't update in realtime, so although it shows it's not checked, it IS! I just have to select some other mat and then go back to this mat, and then i see everything works perfect!

Sorry for interrupting you, mystery solved (it's on Cebas side) :)
Thank you!