My current script works, but it’s really slow on high res models. Is there any way to improve it?
To test the script, create a plane, put a greeble on it, with “select tops” then put edit poly on top, switch to face mode then run the script. It should assign each ‘greeble building’ a different material ID between 20 and 80 and the rooftop and rooftop sections should be a different ID.
I’m attempting to recreate this, adapt and build on it to make it even better and make a really nice procedural City… http://www.mattepainting.org/board/viewtopic.php?f=25&t=4272
theObject = modPanel.getCurrentObject()
thePolys = ( theObject.GetSelection #Face node:selection[1] ) as array
print "count" + thepolys.count as string
for i = 1 to thePolys.count do
(
--i = 1
--select i
a = theObject.SetSelection #Face #{thePolys[i]} -- node:selection[1]
b = theObject.GetFaceMaterial thePolys[i]
print b
If b == 1 do
(
-- Growselection()
max select none
$.Edit_Poly.Select #Face #{thePolys[i]}
theObject.ButtonOp #GrowSelection
--choose ranomd building texture
r = Random 20 100
r = r - 1
$.modifiers[#Edit_Poly].SetOperation #SetMaterial
$.modifiers[#Edit_Poly].MaterialIDtoSet = r
$.modifiers[#Edit_Poly].Commit ()
-- facematerialID = r
max select none
$.Edit_Poly.Select #Face #{thePolys[i]}
t = random 5 10
$.modifiers[#Edit_Poly].SetOperation #SetMaterial
$.modifiers[#Edit_Poly].MaterialIDtoSet = t
$.modifiers[#Edit_Poly].Commit ()
-- face.arraynumber.materialID = t
)
if b == 2 do (
-- Growselection()
print "no"
max select none
$.Edit_Poly.Select #Face #{thePolys[i]}
theObject.ButtonOp #GrowSelection
--choose ranomd building texture
r = Random 2 4
r = r - 1
$.modifiers[#Edit_Poly].SetOperation #SetMaterial
$.modifiers[#Edit_Poly].MaterialIDtoSet = r
$.modifiers[#Edit_Poly].Commit ()
-- facematerialID = r
max select none
$.Edit_Poly.Select #Face #{thePolys[i]}
t = random 5 10
$.modifiers[#Edit_Poly].SetOperation #SetMaterial
$.modifiers[#Edit_Poly].MaterialIDtoSet = t
$.modifiers[#Edit_Poly].Commit ()
)
)