選択されたポリゴンメッシュを三角形分割する (スクリプト)

ブラウザで選択されたポリゴンメッシュに四角形以上の多角形が含まれる場合、
三角形に分割するスクリプトです。


scene = xshade.scene()

# アクティブ形状でポリゴンメッシュのものをリストに格納.
activeShapesList = []
for shape in scene.active_shapes:
  if shape.type == 7:   # ポリゴンメッシュの場合.
    activeShapesList.append(shape)

for shape in activeShapesList:
  # 分割対象の面番号のリスト.
  indices = []
  for i in range(shape.number_of_faces):
    indices.append(i)

  # 指定の面を三角形分割.
  shape.triangulate_faces(indices)
この記事のURLとタイトルをコピーする
Translate »