-
Notifications
You must be signed in to change notification settings - Fork 2
/
tuaneditor.ves
91 lines (69 loc) · 2.12 KB
/
tuaneditor.ves
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
import "blueprint.blueprint" for Blueprint
import "blueprint.variant" for Variant
import "blueprint.variant_proxy" for VariantProxy
import "blueprint.nodes.array" for Array
import "blueprint.nodes.subgraph" for Subgraph
import "tuangraph.context" for CONTEXT
import "tuangraph.constant" for FRAME_DIST
import "editor.editor" for Editor
import "editor.node_cache" for NODE_CACHE
var RENDER_NODE_FILENAME = "9_edit_draw.ves"
class Tuaneditor is Editor
{
load()
{
super.load()
this.prepare_nodes()
this.all_geos = Array()
import "tuangraph.beam_frame" for BeamFrame
this.bf = BeamFrame()
this.render_node = nil
this.add_node(NODE_CACHE.fetch("../yingzao/99_tools/%(RENDER_NODE_FILENAME)", nil), 0, 0)
}
prepare_nodes()
{
this.clear_popup_nodes()
import "tuannodes" for TUAN_NODES
for (var node in TUAN_NODES) {
super.add_popup_node(node)
}
import "blueprint.nodes.commentary" for Commentary
super.add_popup_node(Commentary)
var FANG = NODE_CACHE.fetch("../yingzao/00_dougong2/13_fang.ves", nil)
Blueprint.connect(VariantProxy(Variant(FRAME_DIST)), "out", FANG, "length")
var C_FANG = NODE_CACHE.fetch("../yingzao/00_dougong2/42_chengchuan_fang.ves", nil)
Blueprint.connect(VariantProxy(Variant(FRAME_DIST)), "out", C_FANG, "length")
var L_FANG = NODE_CACHE.fetch("../yingzao/00_dougong2/41_liaoyan_fang.ves", nil)
Blueprint.connect(VariantProxy(Variant(FRAME_DIST)), "out", L_FANG, "length")
}
rebuild_all_geos()
{
this.all_geos.list.clear()
var scene = this.scene_stack.root()
if (!scene.nodes.isEmpty) {
this.bf.rebuild(scene, this.all_geos.list)
}
}
draw_preview()
{
if (this.scene_stack.bp_dirty or CONTEXT.prop_changed)
{
CONTEXT.prop_changed = false
this.rebuild_all_geos()
Blueprint.send_pin_dirty_root(this.all_geos.exports[0])
}
super.draw_preview()
if (this.render_node) {
this.render_node.render_run()
}
}
add_node(bp_node, x, y)
{
super.add_node(bp_node, x, y)
if (bp_node is Subgraph and bp_node.filepath.contains(RENDER_NODE_FILENAME))
{
this.render_node = bp_node
Blueprint.connect(this.all_geos, 0, this.render_node, 1)
}
}
}