2
これを行うためのスクリプトやコードについて知っていますか?シーン内の各オブジェクトに一意のワイヤーカラーを付けますか?
私はランダムな色を与えるいくつか見てきましたが、私は何の2つのオブジェクトが同じwirecolorを持っていないことを確認する必要があり..
ありがとう! =)
これを行うためのスクリプトやコードについて知っていますか?シーン内の各オブジェクトに一意のワイヤーカラーを付けますか?
私はランダムな色を与えるいくつか見てきましたが、私は何の2つのオブジェクトが同じwirecolorを持っていないことを確認する必要があり..
ありがとう! =)
わかりませんが、それを書くのは難しくありません。
ここに行く、それがあなたがそれを期待何を願っています:それもすべてあなたのためにそれを使用する目的に依存もちろん
fn shuffle &arr =
(
local temp, swapIndex, counter = arr.count + 1
while counter > 1 do
(
swapIndex = random 1 (counter -= 1)
temp = arr[counter]
arr[counter] = arr[swapIndex]
arr[swapIndex] = temp
)
OK
)
fn incrementCounters &r &g &b step =
(
if (b += step) > 256 do
(
b = 1
if (g += step) > 256 do
(
g = 1
if (r += step) > 256 do r = 1
)
)
)
fn assignRandomWirecolor objs simple:true =
(
local stepCount = objs.count^(double 1/3) + 1
local step = 255./stepCount
local redArr = #(0) + #{1..255}
local greenArr = copy redArr #noMap
local blueArr = copy redArr #noMap
local r = local g = local b = 1
if simple then
(
shuffle &redArr
shuffle &greenArr
shuffle &blueArr
)
else shuffle &sel -- slower with many objects
for obj in objs do
(
obj.wirecolor = [redArr[int(r)], greenArr[int(g)], blueArr[int(b)]]
incrementCounters &r &g &b step
)
)
sel = selection as array
clearSelection()
assignRandomWirecolor sel --simple:false --> if simple is not so cool, try the other option
select sel
、これはただの一般的なアプローチであり、そのようななどその正確なタスクには適していない可能性があります。そのような場合は、詳細を述べることができます。私はいくつかの調整を行います。
ご協力いただきありがとうございます。これはまさに私が探していたもので、現在は機能しています! ;) ありがとう! –