-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCSGMesh.py
38 lines (31 loc) · 906 Bytes
/
CSGMesh.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
from godot import exposed, export
from godot import *
import debugging
@exposed(tool=True)
class AdditiveThing(CSGMesh):
_render = False
@export(bool)
@property
def render(self):
return self._render
@render.setter
def render(self,do_render):
self._render = do_render
if not Engine.is_editor_hint():
return
self.generate()
def generate(self):
vertices = PoolVector3Array()
vertices.push_back(Vector3(0,1,0))
vertices.push_back(Vector3(1,0,0))
vertices.push_back(Vector3(0,0,1))
self.mesh = ArrayMesh()
arrays = builtins.Array()
arrays.resize(ArrayMesh.ARRAY_MAX)
arrays[ArrayMesh.ARRAY_VERTEX] = vertices
self.mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arrays)
def _ready(self):
self.generate()
#packed_scene = PackedScene()
#print(self.get_tree().get_current_scene())
#packed_scene.pack(self.mesh)#self.get_tree().get_current_scene())