Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/editor/inspector/property_selector.cpp
9905 views
1
/**************************************************************************/
2
/* property_selector.cpp */
3
/**************************************************************************/
4
/* This file is part of: */
5
/* GODOT ENGINE */
6
/* https://godotengine.org */
7
/**************************************************************************/
8
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10
/* */
11
/* Permission is hereby granted, free of charge, to any person obtaining */
12
/* a copy of this software and associated documentation files (the */
13
/* "Software"), to deal in the Software without restriction, including */
14
/* without limitation the rights to use, copy, modify, merge, publish, */
15
/* distribute, sublicense, and/or sell copies of the Software, and to */
16
/* permit persons to whom the Software is furnished to do so, subject to */
17
/* the following conditions: */
18
/* */
19
/* The above copyright notice and this permission notice shall be */
20
/* included in all copies or substantial portions of the Software. */
21
/* */
22
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29
/**************************************************************************/
30
31
#include "property_selector.h"
32
33
#include "editor/doc/editor_help.h"
34
#include "editor/editor_node.h"
35
#include "editor/themes/editor_scale.h"
36
#include "scene/gui/line_edit.h"
37
#include "scene/gui/tree.h"
38
39
void PropertySelector::_text_changed(const String &p_newtext) {
40
_update_search();
41
}
42
43
void PropertySelector::_sbox_input(const Ref<InputEvent> &p_event) {
44
// Redirect navigational key events to the tree.
45
Ref<InputEventKey> key = p_event;
46
if (key.is_valid()) {
47
if (key->is_action("ui_up", true) || key->is_action("ui_down", true) || key->is_action("ui_page_up") || key->is_action("ui_page_down")) {
48
search_options->gui_input(key);
49
search_box->accept_event();
50
51
TreeItem *root = search_options->get_root();
52
if (!root->get_first_child()) {
53
return;
54
}
55
56
TreeItem *current = search_options->get_selected();
57
58
TreeItem *item = search_options->get_next_selected(root);
59
while (item) {
60
item->deselect(0);
61
item = search_options->get_next_selected(item);
62
}
63
64
current->select(0);
65
}
66
}
67
}
68
69
void PropertySelector::_update_search() {
70
if (properties) {
71
set_title(TTR("Select Property"));
72
} else if (virtuals_only) {
73
set_title(TTR("Select Virtual Method"));
74
} else {
75
set_title(TTR("Select Method"));
76
}
77
78
search_options->clear();
79
help_bit->set_custom_text(String(), String(), String());
80
81
TreeItem *root = search_options->create_item();
82
83
// Allow using spaces in place of underscores in the search string (makes the search more fault-tolerant).
84
const String search_text = search_box->get_text().replace_char(' ', '_');
85
86
if (properties) {
87
List<PropertyInfo> props;
88
89
if (instance) {
90
instance->get_property_list(&props, true);
91
} else if (type != Variant::NIL) {
92
Variant v;
93
Callable::CallError ce;
94
Variant::construct(type, v, nullptr, 0, ce);
95
96
v.get_property_list(&props);
97
} else {
98
Object *obj = ObjectDB::get_instance(script);
99
if (Object::cast_to<Script>(obj)) {
100
props.push_back(PropertyInfo(Variant::NIL, "Script Variables", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_CATEGORY));
101
Object::cast_to<Script>(obj)->get_script_property_list(&props);
102
}
103
104
StringName base = base_type;
105
while (base) {
106
props.push_back(PropertyInfo(Variant::NIL, base, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_CATEGORY));
107
ClassDB::get_property_list(base, &props, true);
108
base = ClassDB::get_parent_class(base);
109
}
110
}
111
112
TreeItem *category = nullptr;
113
114
bool found = false;
115
for (const PropertyInfo &E : props) {
116
if (E.usage == PROPERTY_USAGE_CATEGORY) {
117
if (category && category->get_first_child() == nullptr) {
118
memdelete(category); //old category was unused
119
}
120
category = search_options->create_item(root);
121
category->set_text(0, E.name);
122
category->set_selectable(0, false);
123
124
Ref<Texture2D> icon;
125
if (E.name == "Script Variables") {
126
icon = search_options->get_editor_theme_icon(SNAME("Script"));
127
} else {
128
icon = EditorNode::get_singleton()->get_class_icon(E.name);
129
}
130
category->set_icon(0, icon);
131
continue;
132
}
133
134
if (!(E.usage & PROPERTY_USAGE_EDITOR) && !(E.usage & PROPERTY_USAGE_SCRIPT_VARIABLE)) {
135
continue;
136
}
137
138
if (!search_box->get_text().is_empty() && !E.name.containsn(search_text)) {
139
continue;
140
}
141
142
if (!type_filter.is_empty() && !type_filter.has(E.type)) {
143
continue;
144
}
145
146
TreeItem *item = search_options->create_item(category ? category : root);
147
item->set_text(0, E.name);
148
item->set_metadata(0, E.name);
149
item->set_icon(0, search_options->get_editor_theme_icon(Variant::get_type_name(E.type)));
150
151
if (!found && !search_box->get_text().is_empty() && E.name.containsn(search_text)) {
152
item->select(0);
153
found = true;
154
} else if (!found && search_box->get_text().is_empty() && E.name == selected) {
155
item->select(0);
156
found = true;
157
}
158
159
item->set_selectable(0, true);
160
161
_create_subproperties(item, E.type);
162
item->set_collapsed(true);
163
}
164
165
if (category && category->get_first_child() == nullptr) {
166
memdelete(category); //old category was unused
167
}
168
169
if (found) {
170
// As we call this while adding items, defer until list is completely populated.
171
callable_mp(search_options, &Tree::scroll_to_item).call_deferred(search_options->get_selected(), true);
172
}
173
174
} else {
175
List<MethodInfo> methods;
176
177
if (type != Variant::NIL) {
178
Variant v;
179
Callable::CallError ce;
180
Variant::construct(type, v, nullptr, 0, ce);
181
v.get_method_list(&methods);
182
} else {
183
Ref<Script> script_ref = ObjectDB::get_ref<Script>(script);
184
if (script_ref.is_valid()) {
185
if (script_ref->is_built_in()) {
186
script_ref->reload(true);
187
}
188
189
List<MethodInfo> script_methods;
190
script_ref->get_script_method_list(&script_methods);
191
192
methods.push_back(MethodInfo("*Script Methods")); // TODO: Split by inheritance.
193
194
for (const MethodInfo &mi : script_methods) {
195
if (mi.name.begins_with("@")) {
196
// GH-92782. GDScript inline setters/getters are historically present in `get_method_list()`
197
// and can be called using `Object.call()`. However, these functions are meant to be internal
198
// and their names are not valid identifiers, so let's hide them from the user.
199
continue;
200
}
201
methods.push_back(mi);
202
}
203
}
204
205
StringName base = base_type;
206
while (base) {
207
methods.push_back(MethodInfo("*" + String(base)));
208
ClassDB::get_method_list(base, &methods, true, true);
209
base = ClassDB::get_parent_class(base);
210
}
211
}
212
213
TreeItem *category = nullptr;
214
215
bool found = false;
216
bool script_methods = false;
217
218
for (MethodInfo &mi : methods) {
219
if (mi.name.begins_with("*")) {
220
if (category && category->get_first_child() == nullptr) {
221
memdelete(category); //old category was unused
222
}
223
category = search_options->create_item(root);
224
category->set_text(0, mi.name.replace_first("*", ""));
225
category->set_selectable(0, false);
226
227
Ref<Texture2D> icon;
228
script_methods = false;
229
String rep = mi.name.remove_char('*');
230
if (mi.name == "*Script Methods") {
231
icon = search_options->get_editor_theme_icon(SNAME("Script"));
232
script_methods = true;
233
} else {
234
icon = EditorNode::get_singleton()->get_class_icon(rep);
235
}
236
category->set_icon(0, icon);
237
238
continue;
239
}
240
241
String name = mi.name.get_slicec(':', 0);
242
if (!script_methods && name.begins_with("_") && !(mi.flags & METHOD_FLAG_VIRTUAL)) {
243
continue;
244
}
245
246
if (virtuals_only && !(mi.flags & METHOD_FLAG_VIRTUAL)) {
247
continue;
248
}
249
250
if (!virtuals_only && (mi.flags & METHOD_FLAG_VIRTUAL)) {
251
continue;
252
}
253
254
if (!search_box->get_text().is_empty() && !name.containsn(search_text)) {
255
continue;
256
}
257
258
TreeItem *item = search_options->create_item(category ? category : root);
259
260
String desc;
261
if (mi.name.contains_char(':')) {
262
desc = mi.name.get_slicec(':', 1) + " ";
263
mi.name = mi.name.get_slicec(':', 0);
264
} else if (mi.return_val.type != Variant::NIL) {
265
desc = Variant::get_type_name(mi.return_val.type);
266
} else {
267
desc = "void";
268
}
269
270
desc += vformat(" %s(", mi.name);
271
272
for (int64_t i = 0; i < mi.arguments.size(); ++i) {
273
PropertyInfo &arg = mi.arguments.write[i];
274
if (i > 0) {
275
desc += ", ";
276
}
277
278
desc += arg.name;
279
280
if (arg.type == Variant::NIL) {
281
desc += ": Variant";
282
} else if (arg.name.contains_char(':')) {
283
desc += vformat(": %s", arg.name.get_slicec(':', 1));
284
arg.name = arg.name.get_slicec(':', 0);
285
} else {
286
desc += vformat(": %s", Variant::get_type_name(arg.type));
287
}
288
}
289
290
if (mi.flags & METHOD_FLAG_VARARG) {
291
desc += mi.arguments.is_empty() ? "..." : ", ...";
292
}
293
294
desc += ")";
295
296
if (mi.flags & METHOD_FLAG_VARARG) {
297
desc += " vararg";
298
}
299
300
if (mi.flags & METHOD_FLAG_CONST) {
301
desc += " const";
302
}
303
304
if (mi.flags & METHOD_FLAG_VIRTUAL) {
305
desc += " virtual";
306
}
307
308
item->set_text(0, desc);
309
item->set_metadata(0, name);
310
item->set_selectable(0, true);
311
312
if (!found && !search_box->get_text().is_empty() && name.containsn(search_text)) {
313
item->select(0);
314
found = true;
315
} else if (!found && search_box->get_text().is_empty() && name == selected) {
316
item->select(0);
317
found = true;
318
}
319
}
320
321
if (category && category->get_first_child() == nullptr) {
322
memdelete(category); //old category was unused
323
}
324
325
if (found) {
326
// As we call this while adding items, defer until list is completely populated.
327
callable_mp(search_options, &Tree::scroll_to_item).call_deferred(search_options->get_selected(), true);
328
}
329
}
330
331
get_ok_button()->set_disabled(search_options->get_selected() == nullptr);
332
}
333
334
void PropertySelector::_confirmed() {
335
TreeItem *ti = search_options->get_selected();
336
if (!ti) {
337
return;
338
}
339
emit_signal(SNAME("selected"), ti->get_metadata(0));
340
hide();
341
}
342
343
void PropertySelector::_item_selected() {
344
help_bit->set_custom_text(String(), String(), String());
345
346
TreeItem *item = search_options->get_selected();
347
get_ok_button()->set_disabled(item == nullptr);
348
349
if (!item) {
350
return;
351
}
352
String name = item->get_metadata(0);
353
354
String class_type;
355
if (type != Variant::NIL) {
356
class_type = Variant::get_type_name(type);
357
} else if (!base_type.is_empty()) {
358
class_type = base_type;
359
} else if (instance) {
360
class_type = instance->get_class();
361
}
362
363
String text;
364
while (!class_type.is_empty()) {
365
if (properties) {
366
if (ClassDB::has_property(class_type, name, true)) {
367
help_bit->parse_symbol("property|" + class_type + "|" + name);
368
break;
369
}
370
} else {
371
if (ClassDB::has_method(class_type, name, true)) {
372
help_bit->parse_symbol("method|" + class_type + "|" + name);
373
break;
374
}
375
}
376
377
// It may be from a parent class, keep looking.
378
class_type = ClassDB::get_parent_class(class_type);
379
}
380
}
381
382
void PropertySelector::_hide_requested() {
383
_cancel_pressed(); // From AcceptDialog.
384
}
385
386
void PropertySelector::_create_subproperties(TreeItem *p_parent_item, Variant::Type p_type) {
387
switch (p_type) {
388
case Variant::VECTOR2: {
389
_create_subproperty(p_parent_item, "x", Variant::FLOAT);
390
_create_subproperty(p_parent_item, "y", Variant::FLOAT);
391
} break;
392
393
case Variant::VECTOR2I: {
394
_create_subproperty(p_parent_item, "x", Variant::INT);
395
_create_subproperty(p_parent_item, "y", Variant::INT);
396
} break;
397
398
case Variant::RECT2: {
399
_create_subproperty(p_parent_item, "position", Variant::VECTOR2);
400
_create_subproperty(p_parent_item, "size", Variant::VECTOR2);
401
_create_subproperty(p_parent_item, "end", Variant::VECTOR2);
402
} break;
403
404
case Variant::RECT2I: {
405
_create_subproperty(p_parent_item, "position", Variant::VECTOR2I);
406
_create_subproperty(p_parent_item, "size", Variant::VECTOR2I);
407
_create_subproperty(p_parent_item, "end", Variant::VECTOR2I);
408
} break;
409
410
case Variant::VECTOR3: {
411
_create_subproperty(p_parent_item, "x", Variant::FLOAT);
412
_create_subproperty(p_parent_item, "y", Variant::FLOAT);
413
_create_subproperty(p_parent_item, "z", Variant::FLOAT);
414
} break;
415
416
case Variant::VECTOR3I: {
417
_create_subproperty(p_parent_item, "x", Variant::INT);
418
_create_subproperty(p_parent_item, "y", Variant::INT);
419
_create_subproperty(p_parent_item, "z", Variant::INT);
420
} break;
421
422
case Variant::TRANSFORM2D: {
423
_create_subproperty(p_parent_item, "origin", Variant::VECTOR2);
424
_create_subproperty(p_parent_item, "x", Variant::VECTOR2);
425
_create_subproperty(p_parent_item, "y", Variant::VECTOR2);
426
} break;
427
428
case Variant::VECTOR4: {
429
_create_subproperty(p_parent_item, "x", Variant::FLOAT);
430
_create_subproperty(p_parent_item, "y", Variant::FLOAT);
431
_create_subproperty(p_parent_item, "z", Variant::FLOAT);
432
_create_subproperty(p_parent_item, "w", Variant::FLOAT);
433
} break;
434
435
case Variant::VECTOR4I: {
436
_create_subproperty(p_parent_item, "x", Variant::INT);
437
_create_subproperty(p_parent_item, "y", Variant::INT);
438
_create_subproperty(p_parent_item, "z", Variant::INT);
439
_create_subproperty(p_parent_item, "w", Variant::INT);
440
} break;
441
442
case Variant::PLANE: {
443
_create_subproperty(p_parent_item, "x", Variant::FLOAT);
444
_create_subproperty(p_parent_item, "y", Variant::FLOAT);
445
_create_subproperty(p_parent_item, "z", Variant::FLOAT);
446
_create_subproperty(p_parent_item, "normal", Variant::VECTOR3);
447
_create_subproperty(p_parent_item, "d", Variant::FLOAT);
448
} break;
449
450
case Variant::QUATERNION: {
451
_create_subproperty(p_parent_item, "x", Variant::FLOAT);
452
_create_subproperty(p_parent_item, "y", Variant::FLOAT);
453
_create_subproperty(p_parent_item, "z", Variant::FLOAT);
454
_create_subproperty(p_parent_item, "w", Variant::FLOAT);
455
} break;
456
457
case Variant::AABB: {
458
_create_subproperty(p_parent_item, "position", Variant::VECTOR3);
459
_create_subproperty(p_parent_item, "size", Variant::VECTOR3);
460
_create_subproperty(p_parent_item, "end", Variant::VECTOR3);
461
} break;
462
463
case Variant::BASIS: {
464
_create_subproperty(p_parent_item, "x", Variant::VECTOR3);
465
_create_subproperty(p_parent_item, "y", Variant::VECTOR3);
466
_create_subproperty(p_parent_item, "z", Variant::VECTOR3);
467
} break;
468
469
case Variant::TRANSFORM3D: {
470
_create_subproperty(p_parent_item, "basis", Variant::BASIS);
471
_create_subproperty(p_parent_item, "origin", Variant::VECTOR3);
472
} break;
473
474
case Variant::PROJECTION: {
475
_create_subproperty(p_parent_item, "x", Variant::VECTOR4);
476
_create_subproperty(p_parent_item, "y", Variant::VECTOR4);
477
_create_subproperty(p_parent_item, "z", Variant::VECTOR4);
478
_create_subproperty(p_parent_item, "w", Variant::VECTOR4);
479
} break;
480
481
case Variant::COLOR: {
482
_create_subproperty(p_parent_item, "r", Variant::FLOAT);
483
_create_subproperty(p_parent_item, "g", Variant::FLOAT);
484
_create_subproperty(p_parent_item, "b", Variant::FLOAT);
485
_create_subproperty(p_parent_item, "a", Variant::FLOAT);
486
_create_subproperty(p_parent_item, "r8", Variant::INT);
487
_create_subproperty(p_parent_item, "g8", Variant::INT);
488
_create_subproperty(p_parent_item, "b8", Variant::INT);
489
_create_subproperty(p_parent_item, "a8", Variant::INT);
490
_create_subproperty(p_parent_item, "h", Variant::FLOAT);
491
_create_subproperty(p_parent_item, "s", Variant::FLOAT);
492
_create_subproperty(p_parent_item, "v", Variant::FLOAT);
493
} break;
494
495
default: {
496
}
497
}
498
}
499
500
void PropertySelector::_create_subproperty(TreeItem *p_parent_item, const String &p_name, Variant::Type p_type) {
501
if (!type_filter.is_empty() && !type_filter.has(p_type)) {
502
return;
503
}
504
505
TreeItem *item = search_options->create_item(p_parent_item);
506
item->set_text(0, p_name);
507
item->set_metadata(0, String(p_parent_item->get_metadata(0)) + ":" + p_name);
508
item->set_icon(0, search_options->get_editor_theme_icon(Variant::get_type_name(p_type)));
509
510
_create_subproperties(item, p_type);
511
}
512
513
void PropertySelector::_notification(int p_what) {
514
switch (p_what) {
515
case NOTIFICATION_ENTER_TREE: {
516
connect(SceneStringName(confirmed), callable_mp(this, &PropertySelector::_confirmed));
517
} break;
518
519
case NOTIFICATION_EXIT_TREE: {
520
disconnect(SceneStringName(confirmed), callable_mp(this, &PropertySelector::_confirmed));
521
} break;
522
}
523
}
524
525
void PropertySelector::select_method_from_base_type(const String &p_base, const String &p_current, bool p_virtuals_only) {
526
base_type = p_base;
527
selected = p_current;
528
type = Variant::NIL;
529
script = ObjectID();
530
properties = false;
531
instance = nullptr;
532
virtuals_only = p_virtuals_only;
533
534
popup_centered_ratio(0.6);
535
search_box->set_text("");
536
search_box->grab_focus();
537
_update_search();
538
}
539
540
void PropertySelector::select_method_from_script(const Ref<Script> &p_script, const String &p_current) {
541
ERR_FAIL_COND(p_script.is_null());
542
base_type = p_script->get_instance_base_type();
543
selected = p_current;
544
type = Variant::NIL;
545
script = p_script->get_instance_id();
546
properties = false;
547
instance = nullptr;
548
virtuals_only = false;
549
550
popup_centered_ratio(0.6);
551
search_box->set_text("");
552
search_box->grab_focus();
553
_update_search();
554
}
555
556
void PropertySelector::select_method_from_basic_type(Variant::Type p_type, const String &p_current) {
557
ERR_FAIL_COND(p_type == Variant::NIL);
558
base_type = "";
559
selected = p_current;
560
type = p_type;
561
script = ObjectID();
562
properties = false;
563
instance = nullptr;
564
virtuals_only = false;
565
566
popup_centered_ratio(0.6);
567
search_box->set_text("");
568
search_box->grab_focus();
569
_update_search();
570
}
571
572
void PropertySelector::select_method_from_instance(Object *p_instance, const String &p_current) {
573
base_type = p_instance->get_class();
574
selected = p_current;
575
type = Variant::NIL;
576
script = ObjectID();
577
{
578
Ref<Script> scr = p_instance->get_script();
579
if (scr.is_valid()) {
580
script = scr->get_instance_id();
581
}
582
}
583
properties = false;
584
instance = nullptr;
585
virtuals_only = false;
586
587
popup_centered_ratio(0.6);
588
search_box->set_text("");
589
search_box->grab_focus();
590
_update_search();
591
}
592
593
void PropertySelector::select_property_from_base_type(const String &p_base, const String &p_current) {
594
base_type = p_base;
595
selected = p_current;
596
type = Variant::NIL;
597
script = ObjectID();
598
properties = true;
599
instance = nullptr;
600
virtuals_only = false;
601
602
popup_centered_ratio(0.6);
603
search_box->set_text("");
604
search_box->grab_focus();
605
_update_search();
606
}
607
608
void PropertySelector::select_property_from_script(const Ref<Script> &p_script, const String &p_current) {
609
ERR_FAIL_COND(p_script.is_null());
610
611
base_type = p_script->get_instance_base_type();
612
selected = p_current;
613
type = Variant::NIL;
614
script = p_script->get_instance_id();
615
properties = true;
616
instance = nullptr;
617
virtuals_only = false;
618
619
popup_centered_ratio(0.6);
620
search_box->set_text("");
621
search_box->grab_focus();
622
_update_search();
623
}
624
625
void PropertySelector::select_property_from_basic_type(Variant::Type p_type, const String &p_current) {
626
ERR_FAIL_COND(p_type == Variant::NIL);
627
base_type = "";
628
selected = p_current;
629
type = p_type;
630
script = ObjectID();
631
properties = true;
632
instance = nullptr;
633
virtuals_only = false;
634
635
popup_centered_ratio(0.6);
636
search_box->set_text("");
637
search_box->grab_focus();
638
_update_search();
639
}
640
641
void PropertySelector::select_property_from_instance(Object *p_instance, const String &p_current) {
642
base_type = "";
643
selected = p_current;
644
type = Variant::NIL;
645
script = ObjectID();
646
properties = true;
647
instance = p_instance;
648
virtuals_only = false;
649
650
popup_centered_ratio(0.6);
651
search_box->set_text("");
652
search_box->grab_focus();
653
_update_search();
654
}
655
656
void PropertySelector::set_type_filter(const Vector<Variant::Type> &p_type_filter) {
657
type_filter = p_type_filter;
658
}
659
660
void PropertySelector::_bind_methods() {
661
ADD_SIGNAL(MethodInfo("selected", PropertyInfo(Variant::STRING, "name")));
662
}
663
664
PropertySelector::PropertySelector() {
665
VBoxContainer *vbc = memnew(VBoxContainer);
666
add_child(vbc);
667
//set_child_rect(vbc);
668
search_box = memnew(LineEdit);
669
vbc->add_margin_child(TTR("Search:"), search_box);
670
search_box->connect(SceneStringName(text_changed), callable_mp(this, &PropertySelector::_text_changed));
671
search_box->connect(SceneStringName(gui_input), callable_mp(this, &PropertySelector::_sbox_input));
672
search_options = memnew(Tree);
673
search_options->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
674
vbc->add_margin_child(TTR("Matches:"), search_options, true);
675
set_ok_button_text(TTR("Open"));
676
get_ok_button()->set_disabled(true);
677
register_text_enter(search_box);
678
set_hide_on_ok(false);
679
search_options->connect("item_activated", callable_mp(this, &PropertySelector::_confirmed));
680
search_options->connect("cell_selected", callable_mp(this, &PropertySelector::_item_selected));
681
search_options->set_hide_root(true);
682
683
help_bit = memnew(EditorHelpBit);
684
help_bit->set_content_height_limits(80 * EDSCALE, 80 * EDSCALE);
685
help_bit->connect("request_hide", callable_mp(this, &PropertySelector::_hide_requested));
686
vbc->add_margin_child(TTR("Description:"), help_bit);
687
}
688
689