Replace all maps of a specific type in a scene

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
Old 07 July 2011   #1
Replace all maps of a specific type in a scene

Hey there,

i am hitting the wall a little bit here. How would i best go about replacing all occurances of a map type in a scene ?

I took some tidbits from the bspack to get a list of all scenemaps.
Now i can of course iterate over them, but i cannot replace them that way
obviously.

I'd like to replace each map occurance preserving instances and references.

So for example i would replace all Checker maps with noise maps.

Any hints ?

Kind Regards,
Thorsten
 
Old 07 July 2011   #2
theMaps = getClassInstaces Checker
print theMaps


This ?

This would get you all checker maps, you could then loop thru it and apply a different map.
__________________
Artur Leao | Co-Founder / Project Manager
You can do it! VFX
Porto/Lisbon - Portugal
http://www.ycdivfx.com
 
Old 07 July 2011   #3
Thanks a lot. getClassInstances is definitely a nice shortcut to get all maps in the scene hehe.

But how would i assigne a different map ? iterating over the list and assigning values replaces only the contents in the list, not the map in the scene no ?

Regards,
Thorsten
 
Old 07 July 2011   #4
Hehe you're right, I need a moment to think about it
__________________
Artur Leao | Co-Founder / Project Manager
You can do it! VFX
Porto/Lisbon - Portugal
http://www.ycdivfx.com
 
Old 07 July 2011   #5
It seems i can get somewhere using "asTrackViewPick", but it seems a bit shakey as it returns different values depending on the map beeing used in a material or elsewhere

-> More thinking
 
Old 07 July 2011   #6
Originally Posted by instinct-vfx: I'd like to replace each map occurance preserving instances and references.
So for example i would replace all Checker maps with noise maps.
Any hints ?



for c in (getclassinstances checker) do replaceinstances c (noise name:c.name)
 
Old 07 July 2011   #7
Well, this works, but it needs more work to check maps inside maps and things like that
nNoise = Noise()
for i in scenematerials do
	(
		
		for j in getPropNames i do
		(
			if classof(getProperty i j) == Checker then setProperty i j (copy nNoise)
		)
	)
__________________
Artur Leao | Co-Founder / Project Manager
You can do it! VFX
Porto/Lisbon - Portugal
http://www.ycdivfx.com
 
Old 07 July 2011   #8
Originally Posted by denisT:

for c in (getclassinstances checker) do replaceinstances c (noise name:c.name)


I tried replaceinstances but didnt get it to work and quitted after thinking it only worked with objects
__________________
Artur Leao | Co-Founder / Project Manager
You can do it! VFX
Porto/Lisbon - Portugal
http://www.ycdivfx.com
 
Old 07 July 2011   #9
I think Replaceinstances() is my favourite function in maxscript
__________________
Maxscript Made Easy...
http://davewortley.wordpress.com/
 
Old 07 July 2011   #10
Thanks everyone! And thanks for the heads up on replaceInstances...works like a charm here
 
Old 07 July 2011   #11
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 01:11 PM.


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