Notifications
Clear all

[Closed] multiMaterial Append if ID is Unique?

Hi

At work most of the people use multimaterials, but they dont manage there ID’s properly, and it’s creating problem at render time.

Letsay they create a multimaterial with 3 submaterials with ID’s like this-

ID 6 – Standard Material
ID 2 – Standard Material
ID 4 – Standard Material

Now what I want to do with scripting is to add materials with the missing ID’s like 1,3 and 5. I don’t want to change the orignal materials and ID’s just add the missing ones with default materials.

Any idea how to do it properly.

2 Replies

Here’s a function to do that.

fn fillMultimaterial multi =
 (
 	for i in 1 to multi.numsubs do
 	(
 		if multi[i] == undefined then
 		(
 			multi[i] = standard()
 		)
 	)
 )

Cheers,

Drea

Thats exactly what I wanted, I didn’t thought about the numsubs. I get it now.

Thanks a lot DreaTawn