[Closed] Medit index out of range: 25
how can you increase medit index range.
i need to create over 100 materials to be applied to seperate objects through a for loop.
like this;
for i=1 to 193 do
(
$[i].material = meditMaterials[i]
)
once i pass 25 i get the error “– Runtime error: Medit index out of range: 25”
any ideas?
While you can have hundreds of materials in the actual scene, you are limited to 24 materials in the editor itself. That’s why the error message at 25.
so what do you recommend i do in my situation? im pretty new t maxscript so any help would be great. thanks
Reset the material editor after 24 maps and start the loop again, not from i=1 but i=24(or 48, 72 and so on).
Why do you use the Material Editor to start with?
If you are CREATING materials, just create them fresh in MAXScript.
for o in selection do o.material = standard name:(o.name) diffuse:(random black white)
This will assign a new standard material with a random diffuse color to each selected object and name the material just like the object it is assigned to.
You can also add bitmaps, change any settings and so on.
RTFineM.
If you HAVE TO use the Material Editor, you could just have a variable looping from 1 to 24 while the loop is changing above:
cnt = 0
for i = 1 to selection.count do
(
cnt += 1
if cnt > 24 do cnt = 1
selection[i].material = meditMaterials[cnt]
)
or better
cnt = 0
for o in selection do
(
cnt += 1
if cnt > 24 do cnt = 1
o.material = meditMaterials[cnt]
)