ScottSmith
11-20-2005, 03:55 AM
This is my first attempt at Maxscript. I'd like a script that will assign materials by layer. Most of my jobs are architectural, and start out very similar. I also use standard layer naming. My models may be created in a variety of software, but they all honor the same layer names.
So it would be very helpful if I could open my template scene which contains starting lights, cameras, etc., then import or link the model, then run the script to do the majority of the mapping. I'd rather go in and make changes than start from scratch on every job.
I searched for something similar, but came up with nothing. So here's what I've come up with so far.
macroScript JSS-BasicSetup category:"JSS"
(
intTotalLayers = layermanager.count
For i = 1 to intTotalLayers do -- Note: Skip 0 since I don't care about layer 0
(
indCurLayer = layermanager.getlayer i
strCurLayer = indCurLayer.Name
max select none
indCurLayer.select true
-- Need to use a lookup table here to get material name
) -- end layer loop
) -- end script
I know it's not much, but I'm trying!
What would work best here? To store the layer:material associations in an external file? How would I read it in and parse it?
Can someone give me a push in the right direction?
So it would be very helpful if I could open my template scene which contains starting lights, cameras, etc., then import or link the model, then run the script to do the majority of the mapping. I'd rather go in and make changes than start from scratch on every job.
I searched for something similar, but came up with nothing. So here's what I've come up with so far.
macroScript JSS-BasicSetup category:"JSS"
(
intTotalLayers = layermanager.count
For i = 1 to intTotalLayers do -- Note: Skip 0 since I don't care about layer 0
(
indCurLayer = layermanager.getlayer i
strCurLayer = indCurLayer.Name
max select none
indCurLayer.select true
-- Need to use a lookup table here to get material name
) -- end layer loop
) -- end script
I know it's not much, but I'm trying!
What would work best here? To store the layer:material associations in an external file? How would I read it in and parse it?
Can someone give me a push in the right direction?
