@@ -7,44 +7,50 @@ const CubeLinedraw = preload("uid://sh0b67wxk8us")
77@onready var demo : DemoManager = % DemoManager
88var current_method : Node
99
10- const methods : Dictionary [String , GDScript ] = {
10+ const neighbors : Dictionary [String , GDScript ] = {
1111 "cube_neighbor" : preload ("uid://cykasr1p4xfed" ),
1212 "cube_neighbors" : preload ("uid://x00gcujhimxg" ),
1313 "cube_corner_neighbors" : preload ("uid://cau6opgjwiksw" ),
1414 "cube_direction" : preload ("uid://cwjv67kxuu1li" ),
15+ }
16+ const transform : Dictionary [String , GDScript ] = {
1517 "cube_distance" : preload ("uid://croybbcw88our" ),
16- "cube_linedraw" : preload ("uid://sh0b67wxk8us" ),
17- "cube_range" : preload ("uid://b6cnoelqbw8uc" ),
18- "cube_intersect_ranges" : preload ("uid://dkugmb7vsjusc" ),
1918 "cube_rotate" : preload ("uid://d4ndsqop2jy6n" ),
2019 "cube_rotate_from" : preload ("uid://dnxp71qf1w3vg" ),
2120 "cube_reflect" : preload ("uid://but5uj3o3qpac" ),
2221 "cube_reflect_from" : preload ("uid://41shw4r5cyc0" ),
22+ }
23+ const shapes : Dictionary [String , GDScript ] = {
24+ "cube_linedraw" : preload ("uid://sh0b67wxk8us" ),
2325 "cube_rect" : preload ("uid://y2lutl2c46b7" ),
2426 "cube_rect_corners" : preload ("uid://bnw55cavqioss" ),
2527 "cube_ring" : preload ("uid://cbsxeto3wkwua" ),
28+ "cube_spiral" : preload ("uid://b72r41cv74ijm" ),
29+ "cube_range" : preload ("uid://b6cnoelqbw8uc" ),
30+ "cube_intersect_ranges" : preload ("uid://dkugmb7vsjusc" ),
2631}
2732
33+ const other_methods : Dictionary [String , GDScript ] = {}
34+
2835
2936func _ready () -> void :
3037 var root = create_item ()
3138 root .set_text (0 , "Methods" )
32- var default = "last"
33- # hide_root = true
39+ hide_root = true
3440
35- for method_name in methods .keys ():
36- var child = create_item (root )
37- child .set_text (0 , method_name )
38- child .set_metadata (0 , methods [method_name ])
41+ add_methods (root , "Neighbors" , neighbors )
42+ add_methods (root , "Transform" , transform )
43+ add_methods (root , "Shapes" , shapes )
3944
40- if default is String and method_name == default :
41- default = child
4245
43- if default is String :
44- var childs = root .get_children ()
45- childs .pop_back ().select (0 )
46- else :
47- default .select (0 )
46+ func add_methods (root : TreeItem , label : String , methods : Dictionary [String , GDScript ]):
47+ if methods .size () > 0 :
48+ var methods_root = create_item (root )
49+ methods_root .set_text (0 , label )
50+ for method_name in methods .keys ():
51+ var child = create_item (methods_root )
52+ child .set_text (0 , method_name )
53+ child .set_metadata (0 , methods [method_name ])
4854
4955
5056func _on_item_selected () -> void :
0 commit comments