How to find instanced material in Material Editor?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  04 April 2013
How to find instanced material in Material Editor?

Is there a way to find all instanced materials in Material Editor? I searched the net and maxscript help file, but with no success. Any ideas?
 
  04 April 2013
Originally Posted by miauu: Is there a way to find all instanced materials in Material Editor? I searched the net and maxscript help file, but with no success. Any ideas?

what is instanced? do you mean all instances of some material?
 
  04 April 2013
Yes. In material editor I have slot1 with MultiSubobject material with 5 sub materials. In slot5 I have another MultiSubobject material with 10 sub materials. The subMat4 of slot5 is instance of subMat2 of slot1. In the Material Editor the Make Unique buttons become enabled and I can press it, but how to find that the subMat4 of slot5 is instance of subMat2 of slot1 via maxscript. Using the subMaterial names is enaugh or not, because in the MultiSubobject material I can have two different subMaterials with the same names, but one of them is instance and the other one is not?
 
  04 April 2013
do you need all instances for all materials, or just for a specified one?
 
  04 April 2013
I have to know if the material is instance or not. The reason is that the script have to change the Diffuse color of the materials, and if I loop through all materials the instances will have color correction multiple times. So the loop have to skip the instances. I think that if I can create an array with the all instances of specific material then I can change the diffuse color only for one of the materials in the array and the other materials will receive the new color. Then for the second material, if it is not in the first array, I will check if this material have instances and will build new array if it have, and so on. If the material not have instances then the there will be no need of the array that will holds all onstances.
 
  04 April 2013
ok... it's easier:
fn findMaterialInstances mat target:meditmaterials = 
(
	mats = getclassinstances (classof mat) target:target astrackviewpick:on
	for t in mats where t.anim == mat collect
	(
		format "parent:%\n\tid:%\n" t.client t.subnum
		t
	)
)
resetmaxfile #noPrompt 
meditmaterials[1] = multimaterial materiallist:#(undefined, meditmaterials[3]) 
meditmaterials[2] = multimaterial materiallist:#(undefined, undefined, meditmaterials[3], meditmaterials[3]) 

findMaterialInstances meditmaterials[3]
 
  04 April 2013
Works in max2013, but in max2009 gives this error:

-- Error occurred in findMaterialInstances(); filename: ; position: 111
--  Frame:
--   mat: 03 - Default:Standard
--   target: #meditMaterials()
--   called in anonymous codeblock
--  Frame:
-- Unable to convert: #meditMaterials() to type: MaxObject
 
  04 April 2013
in max 2009 you have to use meditMaterials's reference target
 
  04 April 2013
Thank you.
 
  04 April 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 10:23 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.