-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathPoisson.py
93 lines (63 loc) · 2.99 KB
/
Poisson.py
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import bpy
import tempfile
import platform
import subprocess
import shutil
def PoissonDef(self, context):
tmpdir = tempfile.mkdtemp()
bpy.ops.object.modifier_add(type='SUBSURF')
bpy.context.object.modifiers["Subdivision"].levels = 1
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Subdivision")
#bpy.ops.object.convert(target='MESH')
bpy.ops.object.editmode_toggle()
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.mesh.delete(type='EDGE_FACE')
bpy.ops.object.editmode_toggle()
bpy.ops.wm.collada_export(filepath=tmpdir+"/Pontos.dae", selected=True)
if platform.system() == "Linux":
subprocess.call('meshlabserver -i '+tmpdir+'/Pontos.dae -o '+tmpdir+'/Poisson.ply -s ~/Programs/OrtogOnBlender/Meshlab/Poisson.mlx -om vc fq wn', shell=True)
bpy.ops.object.delete(use_global=False)
bpy.ops.import_mesh.ply(filepath=tmpdir+"/Poisson.ply", files=[], directory="", filter_glob="*.ply")
class Poisson(bpy.types.Operator):
"""Tooltip"""
bl_idname = "mesh.poisson"
bl_label = "Ortog Poisson"
def execute(self, context):
PoissonDef(self, context)
return {'FINISHED'}
bpy.utils.register_class(Poisson)
def ReconstXYZDef():
context = bpy.context
obj = context.object
scn = context.scene
tmpdir = tempfile.mkdtemp()
dirScript = bpy.utils.user_resource('SCRIPTS')
shutil.copyfile(scn.my_tool.filepathmha, tmpdir+"/file.xyz")
if platform.system() == "Linux":
subprocess.call('meshlabserver -i '+tmpdir+'/file.xyz -o '+tmpdir+'/ObjectXYZ.ply -s '+dirScript+'addons/OrtogOnBlender-master/MicrosGenerate3D.mlx -om', shell=True)
#bpy.ops.object.delete(use_global=False)
bpy.ops.import_mesh.ply(filepath=tmpdir+"/ObjectXYZ.ply", files=[], directory="", filter_glob="*.ply")
bpy.context.space_data.shading.type = 'SOLID'
bpy.context.space_data.shading.show_shadows = True
bpy.context.space_data.shading.show_cavity = True
bpy.context.space_data.shading.cavity_valley_factor = 2.5
bpy.context.space_data.shading.cavity_ridge_factor = 2.5
bpy.context.space_data.shading.cavity_type = 'BOTH'
bpy.context.space_data.shading.curvature_valley_factor = 0.604167
bpy.context.space_data.shading.shadow_intensity = 0.884375
bpy.context.scene.display.matcap_ssao_distance = 0.53 # Funciona!
# bpy.context.scene.matcap_ssao_distance = 0.53 # Não funciona!
# bpy.context.scene.matcap_ssao_attenuation = 1
bpy.context.scene.display.light_direction = (0.666667, 0.319444, 0.673432)
bpy.context.scene.display.shadow_focus = 0.270833
# bpy.context.scene.light_direction = (0.666667, 0.319444, 0.673432)
# bpy.context.scene.shadow_focus = 0.270833
bpy.ops.view3d.view_selected(use_all_regions=False)
class ReconstXYZ(bpy.types.Operator):
"""Tooltip"""
bl_idname = "object.importa_reconstroi_xyz"
bl_label = "Import and Reconstruc XYZ"
def execute(self, context):
ReconstXYZDef()
return {'FINISHED'}
bpy.utils.register_class(ReconstXYZ)