I want to add my custom mesh to Blender. I already know about vertices, edges, faces, bpy.data.meshes
, etc, but I can't figure out how to create an interactive parametric mesh, just like Maya's primary object that can adjust the height or radius of the mesh on the fly.
UPDATE:
What shape is actually not important, it can be any shape that can be adjusted on the fly.
It can be a plane with only 3 vertices, like this:
import bpy
verts = []
edges = []
faces = []
verts.append([0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 1.0])
faces.append([0,1,2])
mesh = bpy.data.meshes.new("New Mesh")
obj = bpy.data.objects.new("New Object", mesh)
col = bpy.data.collections.get("Collection")
col.objects.link(obj)
bpy.context.view_layer.objects.active = obj
mesh.from_pydata(verts, edges, faces)
Now I want to add a slider to control the position of the vertices, or change its shape or even the number of vertices. How to do that?
My goal is to create an addon that dynamically generates pie charts and adjusts them on the fly. This is what I did in Maya:
I know about the Extra Objects addon, but I also found out that it doesn't have a dynamic slider either. For example, for Add > Mesh > Gear, you can find some parameters, but you can't see the result in real-time. After changing the parameters, you have to right click > Change Gear to refresh the object.
That's why I wanted to make my own, dynamically adjustable object. Just like in Maya.