Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (
- fn GetElements obj =
- (
- if not iskindof obj Editable_Poly do return #()
- getelem = polyop.getElementsUsingFace /* <Poly poly> <facelist> fence:<fence_facelist> */
- local faces_done = #{}
- local element_arr = #()
- for face=1 to obj.numfaces where not faces_done[face] do
- (
- elemfaces = getelem obj #{face}
- faces_done += elemfaces
- append element_arr elemfaces
- )
- element_arr
- )
- fn AssignRandomId obj =
- (
- local elem_arr = GetElements obj
- local start_id = 1
- local end_id = elem_arr.count + start_id - 1
- local id_arr = for i=start_id to end_id collect i
- undo "random id" on
- (
- for elem in elem_arr do
- (
- local index = random 1 id_arr.count
- local id = id_arr[index]
- deleteitem id_arr index
- polyop.setFaceMatID obj elem id
- )
- )
- )
- AssignRandomId $
- )
Advertisement
Add Comment
Please, Sign In to add comment