quack/addons/cyclops_level_builder/doc/draw_points_in_blender.py
2023-05-24 00:27:34 +03:00

19 lines
458 B
Python

import bpy
import bmesh
# Define the list of points for the polygon
points = [(0,0,0), (1,0,0), (1,1,0), (0,1,0)]
# Create a new mesh and add a new object to the scene
mesh = bpy.data.meshes.new("Polygon")
obj = bpy.data.objects.new("Polygon", mesh)
bpy.context.collection.objects.link(obj)
# Create a new bmesh and add vertices to it
bm = bmesh.new()
for point in points:
bm.verts.new(point)
# Add the vertices to the mesh
bm.to_mesh(mesh)
bm.free()