开发者

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

How to programatically assign random colo开发者_StackOverflowrs 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))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜