I'd like to write a python script can change (not delete and re-create) the geometry of an object AFTER the initial object has already been loaded by blender.
To clarify, here are the 3 basic steps:
- I write a python file (import bpy, time, ...) that includes some geometric object.
- Through the command line, I open blender and import the python file into blender.
~/tools/Blender-2.79-CellBlender/blender -P ~/src4/.../filename.py
- blender opens, the initial geometry loads, then the geometry periodically changes as the python file runs through a time delayed function that changes the geometry of that object.
I don't want blender to open a new window every time the geometry changes, it should just update the existing model.
I believe this is called periodic display, but I couldn't find any helpful resources online.
I'm running Debian 8, Blender 2.79, python 3.7.3.
In case it's relevent, here's my python code that I'm importing in:
import bpy, time
#remove all default objects
bpy.data.objects['Cube'].select = True
bpy.data.objects['Camera'].select = True
bpy.data.objects['Lamp'].select = True
bpy.ops.object.delete()
#time delayed loop that adds geometry. I want to CHANGE, not add the geometry.
for x in range(1,10):
len = x
#Define box
verts = [(-len,.5,.3),
(len,.5,.3),
(len,-.5,.3),
(-len,-.5,.3),
(-len,.5,-.3),
(len,.5,-.3),
(len,-.5,-.3),
(-len,-.5,-.3),
]
faces = [(0, 1, 2, 3),(4,5,6,7),(0,4,7,3),(1,5,6,2),(0,1,5,4),(3,2,6,7)]
edges = []
my_mesh = bpy.data.meshes.new('Meshy')
my_object = bpy.data.objects.new('Objey', my_mesh)
bpy.context.scene.objects.link(my_object)
my_mesh.update(calc_edges=True)
time.sleep(1)
Right now it just waits 10 seconds to run through the loop, then opens blender with 9 separate boxes, as one would expect. As indicated above, this is not what I want to do.