Created
November 2, 2020 19:55
-
-
Save D0tty/61bdf346b8cac3ace4928ec5f1d24b5e to your computer and use it in GitHub Desktop.
machin.py iteration animation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
import bmesh | |
import csv | |
import ntpath | |
from mathutils import Vector | |
from bpy_extras.object_utils import object_data_add | |
path = '/home/ortes/GISTRE/GPGPU/icp-gpgpu/cmake-build-release/' | |
#path = '/home/ortes/GISTRE/GPGPU/icp-gpgpu/data_students/' | |
def instantiate(filename): | |
file = open(path + filename) | |
inFile = csv.reader(file, delimiter=',', quotechar='"') | |
inFile.__next__() | |
new_mesh = bpy.data.meshes.new(filename) | |
vertices = [] | |
for row in inFile: | |
vertices.append((float(row[0]), float(row[1]), float(row[2]))) | |
file.close() | |
new_mesh.from_pydata(vertices, [], []) | |
new_mesh.update() | |
try: | |
bpy.data.objects.remove(bpy.data.objects[filename]) | |
except: | |
pass | |
object = bpy.data.objects.new(filename, new_mesh) | |
bpy.data.collections['Collection'].objects.link(object) | |
return object | |
#instantiate('bun270.txt') | |
i = 0 | |
while True: | |
object = instantiate('bun' + str(i) + '.txt') | |
object.keyframe_insert('hide_viewport', -1, i) | |
object.hide_viewport = True | |
object.keyframe_insert('hide_viewport', -1, i + 1) | |
object.keyframe_insert('hide_viewport', -1, i - 1) | |
i = i + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment