File size: 556 Bytes
38e46a7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import json
import pickle

import trimesh


def load_json(path):
    with open(path) as f:
        return json.load(f)


def save_json(o, path):
    with open(path, "w") as f:
        json.dump(o, f)


def load_pkl(path):
    with open(path, "rb") as f:
        return pickle.load(f)


def save_pkl(o, path):
    with open(path, "wb") as f:
        pickle.dump(o, f)


def save_mesh_with_colors(vertices, faces, save_path):
    mesh = trimesh.Trimesh(
        vertices=vertices,
        faces=faces,
        process=False,
    )
    mesh.export(save_path)