View Full Version : Replace all maps of a specific type in a scene
instinct-vfx 07-08-2011, 02:30 PM 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
|
|
Kameleon
07-08-2011, 02:38 PM
theMaps = getClassInstaces Checker
print theMaps
This ?
This would get you all checker maps, you could then loop thru it and apply a different map.
instinct-vfx
07-08-2011, 02:43 PM
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
Kameleon
07-08-2011, 03:02 PM
Hehe you're right, I need a moment to think about it :D
instinct-vfx
07-08-2011, 03:11 PM
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
denisT
07-08-2011, 03:32 PM
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)
Kameleon
07-08-2011, 03:32 PM
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)
)
)
Kameleon
07-08-2011, 03:36 PM
for c in (getclassinstances checker) do replaceinstances c (noise name:c.name)
:D I tried replaceinstances but didnt get it to work and quitted after thinking it only worked with objects :arteest:
DaveWortley
07-08-2011, 03:44 PM
I think Replaceinstances() is my favourite function in maxscript :)
instinct-vfx
07-11-2011, 09:01 AM
Thanks everyone! And thanks for the heads up on replaceInstances...works like a charm here :)
CGTalk Moderation
07-11-2011, 09:01 AM
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.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.