Assigning MutiSubs from Scenematerials

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
  03 March 2013
Assigning MutiSubs from Scenematerials

Hi

Im looping over all the materials in a scene and as such assigning one to some geo if its the correct material, this works for Standard Materials but when i apply similar logic, but with the submats taken into consideration, it fails and assigns undefined effectively removing the material, why?

I know its the correct material and i know its in the scene because im putting it to the Material editor so i can even see it but even then when assigning it via the material editor it fails?

for obj in objs do
(
	for m in sceneMaterials do
	(
		--check some stuff, find the material
		if bFoundMat == true then
		(
			obj.material = m -- FAILS assigns undefined
			max mtledit
			meditMaterials[7] = sceneMaterials[m.name] -- WORKS i can see the material in the editor
			obj.material = sceneMaterials[m.name] -- FAILS assigns undefined
			obj.material = meditMaterials[7] -- FAILS assigns undefined
		)
	)
)



any help understanding what is going on would be appreciated


Thanks
 
  03 March 2013
what OBJ in your sample is? does it assign UNDEFINED or leave whatever it was?
 
  03 March 2013
its an array of geo objects, ePoly/eMesh

And it assigns undefined removing the material that is currently on it
 
  03 March 2013
what is the class of sceneMaterials[m.name]
 
  03 March 2013
what FORMAT says:

   for obj in objs do
   (
   	for m in sceneMaterials do
   	(
   		--check some stuff, find the material
   		if bFoundMat == true then
   		(
   			obj.material = m -- FAILS assigns undefined
   			meditMaterials[7] = sceneMaterials[m.name] -- WORKS i can see the material in the editor
   			format "% >> % >> %  = %\n" m obj.material sceneMaterials[m.name] (m == sceneMaterials[m.name])
   		)
   	)
   )
   


i think that another part of your code wipes the material
 
  03 March 2013
the material exists, i can get it to be one of the slots in the materials editor, it just never assigns to the geo
 
  03 March 2013
Originally Posted by broomy: the material exists, i can get it to be one of the slots in the materials editor, it just never assigns to the geo

what format does print?
 
  04 April 2013
I don't have that code any more so cant tell you what it prints sorry
I had to get it done quick and as such just generated the new sub mate on each object and wrote a simple cleaner that then consolidated any materials that had all the same diffuse maps
 
  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 11:44 PM.


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