Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/editor/inspector/editor_properties.h
21345 views
1
/**************************************************************************/
2
/* editor_properties.h */
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
#pragma once
32
33
#include "editor/inspector/editor_inspector.h"
34
35
class CheckBox;
36
class ColorPickerButton;
37
class ConfirmationDialog;
38
class CreateDialog;
39
class EditorFileDialog;
40
class EditorLocaleDialog;
41
class EditorResourcePicker;
42
class EditorSpinSlider;
43
class EditorVariantTypePopupMenu;
44
class MenuButton;
45
class SceneTreeDialog;
46
class TextEdit;
47
class TextureButton;
48
49
struct EditorPropertyRangeHint {
50
bool or_greater = true;
51
bool or_less = true;
52
double min = 0.0;
53
double max = 0.0;
54
double step = 1.0;
55
String suffix;
56
bool exp_range = false;
57
bool prefer_slider = false;
58
bool hide_control = true;
59
bool radians_as_degrees = false;
60
};
61
62
class EditorPropertyNil : public EditorProperty {
63
GDCLASS(EditorPropertyNil, EditorProperty);
64
LineEdit *text = nullptr;
65
66
public:
67
virtual void update_property() override;
68
EditorPropertyNil();
69
};
70
71
class EditorPropertyVariant : public EditorProperty {
72
GDCLASS(EditorPropertyVariant, EditorProperty);
73
74
HBoxContainer *content = nullptr;
75
EditorProperty *sub_property = nullptr;
76
Button *edit_button = nullptr;
77
EditorVariantTypePopupMenu *change_type = nullptr;
78
79
Variant::Type current_type = Variant::VARIANT_MAX;
80
Variant::Type new_type = Variant::VARIANT_MAX;
81
82
void _change_type(int p_to_type);
83
void _popup_edit_menu();
84
85
protected:
86
virtual void _set_read_only(bool p_read_only) override;
87
void _notification(int p_what);
88
89
public:
90
virtual void update_property() override;
91
EditorPropertyVariant();
92
};
93
94
class EditorPropertyText : public EditorProperty {
95
GDCLASS(EditorPropertyText, EditorProperty);
96
LineEdit *text = nullptr;
97
98
bool monospaced = false;
99
bool updating = false;
100
bool string_name = false;
101
void _text_changed(const String &p_string);
102
void _text_submitted(const String &p_string);
103
void _update_theme();
104
105
protected:
106
void _notification(int p_what);
107
108
virtual void _set_read_only(bool p_read_only) override;
109
110
public:
111
void set_string_name(bool p_enabled);
112
virtual void update_property() override;
113
void set_placeholder(const String &p_string);
114
void set_secret(bool p_enabled);
115
void set_monospaced(bool p_monospaced);
116
EditorPropertyText();
117
};
118
119
class EditorPropertyMultilineText : public EditorProperty {
120
GDCLASS(EditorPropertyMultilineText, EditorProperty);
121
122
TextEdit *text = nullptr;
123
124
AcceptDialog *big_text_dialog = nullptr;
125
TextEdit *big_text = nullptr;
126
Button *open_big_text = nullptr;
127
128
bool expression = false;
129
bool monospaced = false;
130
bool wrap_lines = true;
131
132
void _big_text_changed();
133
void _text_changed();
134
void _open_big_text();
135
void _update_theme();
136
137
protected:
138
virtual void _set_read_only(bool p_read_only) override;
139
void _notification(int p_what);
140
141
public:
142
virtual void update_property() override;
143
144
void set_monospaced(bool p_monospaced);
145
bool get_monospaced();
146
147
void set_wrap_lines(bool p_wrap_lines);
148
bool get_wrap_lines();
149
150
EditorPropertyMultilineText(bool p_expression = false);
151
};
152
153
class EditorPropertyTextEnum : public EditorProperty {
154
GDCLASS(EditorPropertyTextEnum, EditorProperty);
155
156
HBoxContainer *default_layout = nullptr;
157
HBoxContainer *edit_custom_layout = nullptr;
158
159
OptionButton *option_button = nullptr;
160
Button *edit_button = nullptr;
161
162
LineEdit *custom_value_edit = nullptr;
163
Button *accept_button = nullptr;
164
Button *cancel_button = nullptr;
165
166
Vector<String> options;
167
Vector<String> option_names;
168
bool string_name = false;
169
bool loose_mode = false;
170
171
void _emit_changed_value(const String &p_string);
172
void _option_selected(int p_which);
173
174
void _edit_custom_value();
175
void _custom_value_submitted(const String &p_value);
176
void _custom_value_accepted();
177
void _custom_value_canceled();
178
179
protected:
180
virtual void _set_read_only(bool p_read_only) override;
181
void _notification(int p_what);
182
183
public:
184
void setup(const Vector<String> &p_options, const Vector<String> &p_option_names = {}, bool p_string_name = false, bool p_loose_mode = false);
185
virtual void update_property() override;
186
EditorPropertyTextEnum();
187
};
188
189
class EditorPropertyPath : public EditorProperty {
190
GDCLASS(EditorPropertyPath, EditorProperty);
191
Vector<String> extensions;
192
bool folder = false;
193
bool global = false;
194
bool save_mode = false;
195
bool enable_uid = false;
196
bool display_uid = false;
197
198
EditorFileDialog *dialog = nullptr;
199
LineEdit *path = nullptr;
200
Button *toggle_uid = nullptr;
201
Button *path_edit = nullptr;
202
203
String _get_path_text(bool p_allow_uid = false);
204
205
void _path_selected(const String &p_path);
206
void _path_pressed();
207
void _path_focus_exited();
208
void _toggle_uid_display();
209
void _update_uid_icon();
210
void _drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
211
bool _can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
212
213
protected:
214
virtual void _set_read_only(bool p_read_only) override;
215
void _notification(int p_what);
216
217
public:
218
LineEdit *get_path_edit() const { return path; }
219
220
void setup(const Vector<String> &p_extensions, bool p_folder, bool p_global, bool p_enable_uid);
221
void set_save_mode();
222
virtual void update_property() override;
223
EditorPropertyPath();
224
};
225
226
class EditorPropertyLocale : public EditorProperty {
227
GDCLASS(EditorPropertyLocale, EditorProperty);
228
EditorLocaleDialog *dialog = nullptr;
229
LineEdit *locale = nullptr;
230
Button *locale_edit = nullptr;
231
232
void _locale_selected(const String &p_locale);
233
void _locale_pressed();
234
void _locale_focus_exited();
235
236
protected:
237
void _notification(int p_what);
238
239
public:
240
void setup(const String &p_hit_string);
241
virtual void update_property() override;
242
EditorPropertyLocale();
243
};
244
245
class EditorPropertyClassName : public EditorProperty {
246
GDCLASS(EditorPropertyClassName, EditorProperty);
247
248
private:
249
CreateDialog *dialog = nullptr;
250
Button *property = nullptr;
251
String selected_type;
252
String base_type;
253
void _property_selected();
254
void _dialog_created();
255
256
protected:
257
virtual void _set_read_only(bool p_read_only) override;
258
259
public:
260
void setup(const String &p_base_type, const String &p_selected_type);
261
virtual void update_property() override;
262
EditorPropertyClassName();
263
};
264
265
class EditorPropertyCheck : public EditorProperty {
266
GDCLASS(EditorPropertyCheck, EditorProperty);
267
CheckBox *checkbox = nullptr;
268
269
void _checkbox_pressed();
270
271
protected:
272
virtual void _set_read_only(bool p_read_only) override;
273
274
public:
275
virtual void update_property() override;
276
EditorPropertyCheck();
277
};
278
279
class EditorPropertyEnum : public EditorProperty {
280
GDCLASS(EditorPropertyEnum, EditorProperty);
281
OptionButton *options = nullptr;
282
283
void _option_selected(int p_which);
284
285
protected:
286
virtual void _set_read_only(bool p_read_only) override;
287
288
public:
289
void setup(const Vector<String> &p_options);
290
virtual void update_property() override;
291
void set_option_button_clip(bool p_enable);
292
OptionButton *get_option_button(); // Hack to allow setting icons.
293
EditorPropertyEnum();
294
};
295
296
class EditorPropertyFlags : public EditorProperty {
297
GDCLASS(EditorPropertyFlags, EditorProperty);
298
VBoxContainer *vbox = nullptr;
299
Vector<CheckBox *> flags;
300
Vector<uint32_t> flag_values;
301
302
void _flag_toggled(int p_index);
303
304
protected:
305
virtual void _set_read_only(bool p_read_only) override;
306
307
public:
308
void setup(const Vector<String> &p_options);
309
virtual void update_property() override;
310
EditorPropertyFlags();
311
};
312
313
///////////////////// LAYERS /////////////////////////
314
315
class EditorPropertyLayersGrid : public Control {
316
GDCLASS(EditorPropertyLayersGrid, Control);
317
318
private:
319
Vector<Rect2> flag_rects;
320
Rect2 expand_rect;
321
bool expand_hovered = false;
322
bool expanded = false;
323
int expansion_rows = 0;
324
const uint32_t HOVERED_INDEX_NONE = UINT32_MAX;
325
uint32_t hovered_index = HOVERED_INDEX_NONE;
326
bool dragging = false;
327
bool dragging_value_to_set = false;
328
bool read_only = false;
329
int renamed_layer_index = -1;
330
PopupMenu *layer_rename = nullptr;
331
ConfirmationDialog *rename_dialog = nullptr;
332
LineEdit *rename_dialog_text = nullptr;
333
334
void _rename_pressed(int p_menu);
335
void _rename_operation_confirm();
336
void _update_hovered(const Vector2 &p_position);
337
void _on_hover_exit();
338
void _update_flag(bool p_replace);
339
Size2 get_grid_size() const;
340
341
protected:
342
void _notification(int p_what);
343
static void _bind_methods();
344
345
public:
346
uint32_t value = 0;
347
int layer_group_size = 0;
348
uint32_t layer_count = 0;
349
Vector<String> names;
350
Vector<String> tooltips;
351
352
void set_read_only(bool p_read_only);
353
virtual Size2 get_minimum_size() const override;
354
virtual String get_tooltip(const Point2 &p_pos) const override;
355
void gui_input(const Ref<InputEvent> &p_ev) override;
356
void set_flag(uint32_t p_flag);
357
EditorPropertyLayersGrid();
358
};
359
360
class EditorPropertyLayers : public EditorProperty {
361
GDCLASS(EditorPropertyLayers, EditorProperty);
362
363
public:
364
enum LayerType {
365
LAYER_PHYSICS_2D,
366
LAYER_RENDER_2D,
367
LAYER_NAVIGATION_2D,
368
LAYER_PHYSICS_3D,
369
LAYER_RENDER_3D,
370
LAYER_NAVIGATION_3D,
371
LAYER_AVOIDANCE,
372
};
373
374
private:
375
EditorPropertyLayersGrid *grid = nullptr;
376
void _grid_changed(uint32_t p_grid);
377
String basename;
378
LayerType layer_type;
379
PopupMenu *layers = nullptr;
380
TextureButton *button = nullptr;
381
382
void _button_pressed();
383
void _menu_pressed(int p_menu);
384
void _refresh_names();
385
386
protected:
387
void _notification(int p_what);
388
virtual void _set_read_only(bool p_read_only) override;
389
390
public:
391
void setup(LayerType p_layer_type);
392
void set_layer_name(int p_index, const String &p_name);
393
String get_layer_name(int p_index) const;
394
virtual void update_property() override;
395
EditorPropertyLayers();
396
};
397
398
class EditorPropertyInteger : public EditorProperty {
399
GDCLASS(EditorPropertyInteger, EditorProperty);
400
EditorSpinSlider *spin = nullptr;
401
void _value_changed(int64_t p_val);
402
403
protected:
404
virtual void _set_read_only(bool p_read_only) override;
405
406
public:
407
virtual void update_property() override;
408
void setup(const EditorPropertyRangeHint &p_range_hint);
409
EditorPropertyInteger();
410
};
411
412
class EditorPropertyObjectID : public EditorProperty {
413
GDCLASS(EditorPropertyObjectID, EditorProperty);
414
Button *edit = nullptr;
415
String base_type;
416
void _edit_pressed();
417
418
protected:
419
virtual void _set_read_only(bool p_read_only) override;
420
421
public:
422
virtual void update_property() override;
423
void setup(const String &p_base_type);
424
EditorPropertyObjectID();
425
};
426
427
class EditorPropertySignal : public EditorProperty {
428
GDCLASS(EditorPropertySignal, EditorProperty);
429
Button *edit = nullptr;
430
String base_type;
431
void _edit_pressed();
432
433
public:
434
virtual void update_property() override;
435
EditorPropertySignal();
436
};
437
438
class EditorPropertyCallable : public EditorProperty {
439
GDCLASS(EditorPropertyCallable, EditorProperty);
440
Button *edit = nullptr;
441
String base_type;
442
443
public:
444
virtual void update_property() override;
445
EditorPropertyCallable();
446
};
447
448
class EditorPropertyFloat : public EditorProperty {
449
GDCLASS(EditorPropertyFloat, EditorProperty);
450
EditorSpinSlider *spin = nullptr;
451
bool radians_as_degrees = false;
452
void _value_changed(double p_val);
453
454
protected:
455
virtual void _set_read_only(bool p_read_only) override;
456
457
public:
458
virtual void update_property() override;
459
void setup(const EditorPropertyRangeHint &p_range_hint);
460
EditorPropertyFloat();
461
};
462
463
class EditorPropertyEasing : public EditorProperty {
464
GDCLASS(EditorPropertyEasing, EditorProperty);
465
Control *easing_draw = nullptr;
466
PopupMenu *preset = nullptr;
467
EditorSpinSlider *spin = nullptr;
468
469
bool dragging = false;
470
bool full = false;
471
bool flip = false;
472
bool positive_only = false;
473
474
enum {
475
EASING_ZERO,
476
EASING_LINEAR,
477
EASING_IN,
478
EASING_OUT,
479
EASING_IN_OUT,
480
EASING_OUT_IN,
481
EASING_MAX
482
483
};
484
485
void _drag_easing(const Ref<InputEvent> &p_ev);
486
void _draw_easing();
487
void _set_preset(int);
488
489
void _setup_spin();
490
void _spin_value_changed(double p_value);
491
void _spin_focus_exited();
492
493
void _notification(int p_what);
494
495
protected:
496
virtual void _set_read_only(bool p_read_only) override;
497
498
public:
499
virtual void update_property() override;
500
void setup(bool p_positive_only, bool p_flip);
501
EditorPropertyEasing();
502
};
503
504
class EditorPropertyRect2 : public EditorProperty {
505
GDCLASS(EditorPropertyRect2, EditorProperty);
506
EditorSpinSlider *spin[4];
507
void _value_changed(double p_val, const String &p_name);
508
509
protected:
510
virtual void _set_read_only(bool p_read_only) override;
511
void _notification(int p_what);
512
513
public:
514
virtual void update_property() override;
515
void setup(const EditorPropertyRangeHint &p_range_hint);
516
EditorPropertyRect2(bool p_force_wide = false);
517
};
518
519
class EditorPropertyRect2i : public EditorProperty {
520
GDCLASS(EditorPropertyRect2i, EditorProperty);
521
EditorSpinSlider *spin[4];
522
void _value_changed(double p_val, const String &p_name);
523
524
protected:
525
virtual void _set_read_only(bool p_read_only) override;
526
void _notification(int p_what);
527
528
public:
529
virtual void update_property() override;
530
void setup(const EditorPropertyRangeHint &p_range_hint);
531
EditorPropertyRect2i(bool p_force_wide = false);
532
};
533
534
class EditorPropertyPlane : public EditorProperty {
535
GDCLASS(EditorPropertyPlane, EditorProperty);
536
EditorSpinSlider *spin[4];
537
void _value_changed(double p_val, const String &p_name);
538
539
protected:
540
virtual void _set_read_only(bool p_read_only) override;
541
void _notification(int p_what);
542
543
public:
544
virtual void update_property() override;
545
void setup(const EditorPropertyRangeHint &p_range_hint);
546
EditorPropertyPlane(bool p_force_wide = false);
547
};
548
549
class EditorPropertyQuaternion : public EditorProperty {
550
GDCLASS(EditorPropertyQuaternion, EditorProperty);
551
BoxContainer *default_layout = nullptr;
552
EditorSpinSlider *spin[4];
553
554
Button *warning = nullptr;
555
AcceptDialog *warning_dialog = nullptr;
556
557
Label *euler_label = nullptr;
558
VBoxContainer *edit_custom_bc = nullptr;
559
EditorSpinSlider *euler[3];
560
Button *edit_button = nullptr;
561
562
Vector3 edit_euler;
563
564
void _value_changed(double p_val, const String &p_name);
565
void _edit_custom_value();
566
void _custom_value_changed(double p_val);
567
void _warning_pressed();
568
569
bool is_grabbing_euler();
570
571
protected:
572
virtual void _set_read_only(bool p_read_only) override;
573
void _notification(int p_what);
574
575
public:
576
virtual void update_property() override;
577
void setup(const EditorPropertyRangeHint &p_range_hint, bool p_hide_editor = false);
578
EditorPropertyQuaternion();
579
};
580
581
class EditorPropertyAABB : public EditorProperty {
582
GDCLASS(EditorPropertyAABB, EditorProperty);
583
EditorSpinSlider *spin[6];
584
void _value_changed(double p_val, const String &p_name);
585
586
protected:
587
virtual void _set_read_only(bool p_read_only) override;
588
void _notification(int p_what);
589
590
public:
591
virtual void update_property() override;
592
void setup(const EditorPropertyRangeHint &p_range_hint);
593
EditorPropertyAABB();
594
};
595
596
class EditorPropertyTransform2D : public EditorProperty {
597
GDCLASS(EditorPropertyTransform2D, EditorProperty);
598
EditorSpinSlider *spin[6];
599
void _value_changed(double p_val, const String &p_name);
600
601
protected:
602
virtual void _set_read_only(bool p_read_only) override;
603
void _notification(int p_what);
604
605
public:
606
virtual void update_property() override;
607
void setup(const EditorPropertyRangeHint &p_range_hint);
608
EditorPropertyTransform2D(bool p_include_origin = true);
609
};
610
611
class EditorPropertyBasis : public EditorProperty {
612
GDCLASS(EditorPropertyBasis, EditorProperty);
613
EditorSpinSlider *spin[9];
614
void _value_changed(double p_val, const String &p_name);
615
616
protected:
617
virtual void _set_read_only(bool p_read_only) override;
618
void _notification(int p_what);
619
620
public:
621
virtual void update_property() override;
622
void setup(const EditorPropertyRangeHint &p_range_hint);
623
EditorPropertyBasis();
624
};
625
626
class EditorPropertyTransform3D : public EditorProperty {
627
GDCLASS(EditorPropertyTransform3D, EditorProperty);
628
EditorSpinSlider *spin[12];
629
void _value_changed(double p_val, const String &p_name);
630
631
protected:
632
virtual void _set_read_only(bool p_read_only) override;
633
void _notification(int p_what);
634
635
public:
636
virtual void update_property() override;
637
virtual void update_using_transform(Transform3D p_transform);
638
void setup(const EditorPropertyRangeHint &p_range_hint);
639
EditorPropertyTransform3D();
640
};
641
642
class EditorPropertyProjection : public EditorProperty {
643
GDCLASS(EditorPropertyProjection, EditorProperty);
644
EditorSpinSlider *spin[16];
645
void _value_changed(double p_val, const String &p_name);
646
647
protected:
648
virtual void _set_read_only(bool p_read_only) override;
649
void _notification(int p_what);
650
651
public:
652
virtual void update_property() override;
653
virtual void update_using_transform(Projection p_transform);
654
void setup(const EditorPropertyRangeHint &p_range_hint);
655
EditorPropertyProjection();
656
};
657
658
class EditorPropertyColor : public EditorProperty {
659
GDCLASS(EditorPropertyColor, EditorProperty);
660
ColorPickerButton *picker = nullptr;
661
void _color_changed(const Color &p_color);
662
void _picker_created();
663
void _popup_opening();
664
void _popup_closed();
665
666
Color last_color;
667
bool live_changes_enabled = true;
668
bool was_checked = false;
669
670
protected:
671
virtual void _set_read_only(bool p_read_only) override;
672
673
public:
674
virtual void update_property() override;
675
void setup(bool p_show_alpha);
676
void set_live_changes_enabled(bool p_enabled);
677
EditorPropertyColor();
678
};
679
680
class EditorPropertyNodePath : public EditorProperty {
681
GDCLASS(EditorPropertyNodePath, EditorProperty);
682
683
enum {
684
ACTION_CLEAR,
685
ACTION_COPY,
686
ACTION_EDIT,
687
ACTION_SELECT,
688
};
689
690
Button *assign = nullptr;
691
MenuButton *menu = nullptr;
692
LineEdit *edit = nullptr;
693
694
SceneTreeDialog *scene_tree = nullptr;
695
bool use_path_from_scene_root = false;
696
bool editing_node = false;
697
bool dropping = false;
698
699
Vector<StringName> valid_types;
700
void _node_selected(const NodePath &p_path, bool p_absolute = true);
701
void _node_assign();
702
void _assign_draw();
703
Node *get_base_node();
704
void _update_menu();
705
void _menu_option(int p_idx);
706
void _accept_text();
707
void _text_submitted(const String &p_text);
708
const NodePath _get_node_path() const;
709
710
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
711
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
712
bool is_drop_valid(const Dictionary &p_drag_data) const;
713
714
virtual Variant _get_cache_value(const StringName &p_prop, bool &r_valid) const override;
715
716
protected:
717
virtual void _set_read_only(bool p_read_only) override;
718
void _notification(int p_what);
719
720
public:
721
virtual void update_property() override;
722
void setup(const Vector<StringName> &p_valid_types, bool p_use_path_from_scene_root = true, bool p_editing_node = false);
723
EditorPropertyNodePath();
724
};
725
726
class EditorPropertyRID : public EditorProperty {
727
GDCLASS(EditorPropertyRID, EditorProperty);
728
Label *label = nullptr;
729
730
public:
731
virtual void update_property() override;
732
EditorPropertyRID();
733
};
734
735
class EditorPropertyResource : public EditorProperty {
736
GDCLASS(EditorPropertyResource, EditorProperty);
737
738
EditorResourcePicker *resource_picker = nullptr;
739
SceneTreeDialog *scene_tree = nullptr;
740
741
bool use_sub_inspector = false;
742
EditorInspector *sub_inspector = nullptr;
743
bool opened_editor = false;
744
bool use_filter = false;
745
746
void _resource_selected(const Ref<Resource> &p_resource, bool p_inspect);
747
void _resource_changed(const Ref<Resource> &p_resource);
748
749
Node *_get_base_node();
750
void _viewport_selected(const NodePath &p_path);
751
752
void _sub_inspector_property_keyed(const String &p_property, const Variant &p_value, bool p_advance);
753
void _sub_inspector_resource_selected(const Ref<Resource> &p_resource, const String &p_property);
754
void _sub_inspector_object_id_selected(int p_id);
755
756
void _open_editor_pressed();
757
void _update_preferred_shader();
758
bool _should_stop_editing() const;
759
760
protected:
761
virtual void _set_read_only(bool p_read_only) override;
762
void _notification(int p_what);
763
static void _bind_methods();
764
765
public:
766
virtual void update_property() override;
767
void setup(Object *p_object, const String &p_path, const String &p_base_type);
768
EditorResourcePicker *get_resource_picker() const { return resource_picker; }
769
770
void collapse_all_folding() override;
771
void expand_all_folding() override;
772
void expand_revertable() override;
773
774
void set_use_sub_inspector(bool p_enable);
775
void set_use_filter(bool p_use);
776
void fold_resource();
777
778
virtual bool is_colored(ColorationMode p_mode) override;
779
780
EditorPropertyResource();
781
};
782
783
///////////////////////////////////////////////////
784
/// \brief The EditorInspectorDefaultPlugin class
785
///
786
class EditorInspectorDefaultPlugin : public EditorInspectorPlugin {
787
GDCLASS(EditorInspectorDefaultPlugin, EditorInspectorPlugin);
788
789
public:
790
virtual bool can_handle(Object *p_object) override;
791
virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide = false) override;
792
793
static EditorProperty *get_editor_for_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide = false);
794
};
795
796