-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprocessing.py
More file actions
56 lines (38 loc) · 1.75 KB
/
Copy pathprocessing.py
File metadata and controls
56 lines (38 loc) · 1.75 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import subprocess
import bpy
import platform
class SEURAT_OT_process_data(bpy.types.Operator):
"""Process the Seurat capture data and output it to a folder"""
bl_idname = "seurat.process_data"
bl_label = "Process Seurat capture data"
def execute(self, context):
scn = context.scene
opt = scn.seurat_options
if platform.system() != 'Windows':
self.report({'ERROR'}, 'Processing Seurat data only possible on Windows')
return {'CANCELLED'}
output_directory = bpy.path.abspath(opt.mesh_output_path)
input_path = bpy.path.abspath(os.path.join(opt.capture_output_path + "manifest.json"))
output_path = bpy.path.abspath(os.path.join(opt.mesh_output_path + "output"))
if not os.path.exists(output_directory):
try:
os.mkdir(output_directory)
except:
self.report({'ERROR'}, 'Failed to create output folder, check the mesh output path')
return {'CANCELLED'}
print ("Created output directory")
else:
print ("Output directory exists")
script_file = os.path.realpath(__file__)
directory = os.path.dirname(script_file)
options = opt.seurat_command_flags
# Default is "-texture_width 8192 -texture_height 8192 -pixels_per_degree 20 -triangle_count 180000"
cmd = os.path.join(directory + "\seurat-pipeline-msvc2017-x64.exe -input_path ") + "\"" + input_path + "\" -output_path \"" + output_path + "\" " + options
print(cmd)
subprocess.run(cmd)
return {'FINISHED'}
def register():
bpy.utils.register_class(SEURAT_OT_process_data)
def unregister():
bpy.utils.unregister_class(SEURAT_OT_process_data)