문제

How to programatically assign random colors to objects in 3ds max?

도움이 되었습니까?

해결책

That works well if you just want to assign a random wire color. Here is some code for creating a standard material with a random diffuse color.

for o in $* do 
( 
  m = standard
  m.diffuse = random white black 
  o.material = m
) 

다른 팁

This is what I found online as a solution:

for o in $* do
(
o.wirecolor = random white black
)

Various ways:

For wirecolor changes (i.e.-objects with no scene material on them) you can do,

(for mesh objects only)

for o in geometry do
(
     o.wirecolor = random black white
)

for all scene objects you can do

for o in objects do
(
     o.wirecolor = random black white
)

for all objects that are selected you can do

for o in selection do
(
     o.wirecolor = random black
)

for only a single object, you can do

selection[1].wirecolor = random black white

for object that match a criteria use the where clause

for o in objects where <someproperty> == <somevalue> do o.wirecolor = random black white

so like..

for o in objects where classof o == Sphere and o.radius > 10.0 do o.wirecolor = random black white

or filter by the objects name then create and apply a standard material:

for o in objects where matchpattern o.name pattern:"Sphere*" do o.material = (standard diffuse:(random white black))
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top