Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/editor/inspector/editor_inspector.h
9900 views
1
/**************************************************************************/
2
/* editor_inspector.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_property_name_processor.h"
34
#include "scene/gui/box_container.h"
35
#include "scene/gui/button.h"
36
#include "scene/gui/panel_container.h"
37
#include "scene/gui/scroll_container.h"
38
39
class AddMetadataDialog;
40
class AcceptDialog;
41
class ConfirmationDialog;
42
class EditorInspector;
43
class EditorValidationPanel;
44
class HSeparator;
45
class LineEdit;
46
class MarginContainer;
47
class OptionButton;
48
class PanelContainer;
49
class PopupMenu;
50
class SpinBox;
51
class StyleBoxFlat;
52
class TextureRect;
53
54
class EditorPropertyRevert {
55
public:
56
static Variant get_property_revert_value(Object *p_object, const StringName &p_property, bool *r_is_valid);
57
static bool can_property_revert(Object *p_object, const StringName &p_property, const Variant *p_custom_current_value = nullptr);
58
};
59
60
class EditorInspectorActionButton : public Button {
61
GDCLASS(EditorInspectorActionButton, Button);
62
63
StringName icon_name;
64
65
protected:
66
void _notification(int p_what);
67
68
public:
69
EditorInspectorActionButton(const String &p_text, const StringName &p_icon_name);
70
};
71
72
class EditorProperty : public Container {
73
GDCLASS(EditorProperty, Container);
74
75
public:
76
enum MenuItems {
77
MENU_COPY_VALUE,
78
MENU_PASTE_VALUE,
79
MENU_COPY_PROPERTY_PATH,
80
MENU_OVERRIDE_FOR_PROJECT,
81
MENU_FAVORITE_PROPERTY,
82
MENU_PIN_VALUE,
83
MENU_DELETE,
84
MENU_REVERT_VALUE,
85
MENU_OPEN_DOCUMENTATION,
86
};
87
88
enum ColorationMode {
89
COLORATION_CONTAINER_RESOURCE,
90
COLORATION_RESOURCE,
91
COLORATION_EXTERNAL,
92
};
93
94
private:
95
String label;
96
int text_size;
97
friend class EditorInspector;
98
Object *object = nullptr;
99
StringName property;
100
String property_path;
101
String doc_path;
102
bool internal = false;
103
bool has_doc_tooltip = false;
104
105
int property_usage;
106
107
bool draw_label = true;
108
bool draw_background = true;
109
bool read_only = false;
110
bool checkable = false;
111
bool checked = false;
112
bool draw_warning = false;
113
bool draw_prop_warning = false;
114
bool keying = false;
115
bool deletable = false;
116
117
Rect2 right_child_rect;
118
Rect2 bottom_child_rect;
119
120
Rect2 keying_rect;
121
bool keying_hover = false;
122
Rect2 revert_rect;
123
bool revert_hover = false;
124
Rect2 check_rect;
125
bool check_hover = false;
126
Rect2 delete_rect;
127
bool delete_hover = false;
128
129
bool can_revert = false;
130
bool can_pin = false;
131
bool pin_hidden = false;
132
bool pinned = false;
133
134
bool can_favorite = false;
135
bool favorited = false;
136
137
bool use_folding = false;
138
bool draw_top_bg = true;
139
140
void _update_popup();
141
void _focusable_focused(int p_index);
142
143
bool selectable = true;
144
bool selected = false;
145
int selected_focusable;
146
147
float split_ratio;
148
149
Vector<Control *> focusables;
150
Control *label_reference = nullptr;
151
Control *bottom_editor = nullptr;
152
PopupMenu *menu = nullptr;
153
154
HashMap<StringName, Variant> cache;
155
156
GDVIRTUAL0(_update_property)
157
GDVIRTUAL1(_set_read_only, bool)
158
159
void _update_flags();
160
161
protected:
162
bool has_borders = false;
163
bool can_override = false;
164
165
void _notification(int p_what);
166
static void _bind_methods();
167
virtual void _set_read_only(bool p_read_only);
168
169
virtual void gui_input(const Ref<InputEvent> &p_event) override;
170
virtual void shortcut_input(const Ref<InputEvent> &p_event) override;
171
const Color *_get_property_colors();
172
173
virtual Variant _get_cache_value(const StringName &p_prop, bool &r_valid) const;
174
virtual StringName _get_revert_property() const;
175
176
void _update_property_bg();
177
178
void _accessibility_action_menu(const Variant &p_data);
179
void _accessibility_action_click(const Variant &p_data);
180
181
public:
182
void emit_changed(const StringName &p_property, const Variant &p_value, const StringName &p_field = StringName(), bool p_changing = false);
183
184
String get_tooltip_string(const String &p_string) const;
185
186
virtual Size2 get_minimum_size() const override;
187
188
void set_label(const String &p_label);
189
String get_label() const;
190
191
void set_read_only(bool p_read_only);
192
bool is_read_only() const;
193
194
void set_draw_label(bool p_draw_label);
195
bool is_draw_label() const;
196
197
void set_draw_background(bool p_draw_background);
198
bool is_draw_background() const;
199
200
Object *get_edited_object();
201
StringName get_edited_property() const;
202
inline Variant get_edited_property_value() const {
203
ERR_FAIL_NULL_V(object, Variant());
204
return object->get(property);
205
}
206
Variant get_edited_property_display_value() const;
207
EditorInspector *get_parent_inspector() const;
208
209
void set_doc_path(const String &p_doc_path);
210
void set_internal(bool p_internal);
211
212
virtual void update_property();
213
void update_editor_property_status();
214
215
virtual bool use_keying_next() const;
216
217
void set_checkable(bool p_checkable);
218
bool is_checkable() const;
219
220
void set_checked(bool p_checked);
221
bool is_checked() const;
222
223
void set_draw_warning(bool p_draw_warning);
224
bool is_draw_warning() const;
225
226
void set_keying(bool p_keying);
227
bool is_keying() const;
228
229
virtual bool is_colored(ColorationMode p_mode) { return false; }
230
231
void set_deletable(bool p_enable);
232
bool is_deletable() const;
233
void add_focusable(Control *p_control);
234
void grab_focus(int p_focusable = -1);
235
void select(int p_focusable = -1);
236
void deselect();
237
bool is_selected() const;
238
239
void set_label_reference(Control *p_control);
240
void set_bottom_editor(Control *p_control);
241
242
void set_use_folding(bool p_use_folding);
243
bool is_using_folding() const;
244
245
virtual void expand_all_folding();
246
virtual void collapse_all_folding();
247
virtual void expand_revertable();
248
249
virtual Variant get_drag_data(const Point2 &p_point) override;
250
virtual void update_cache();
251
virtual bool is_cache_valid() const;
252
253
void set_selectable(bool p_selectable);
254
bool is_selectable() const;
255
256
void set_name_split_ratio(float p_ratio);
257
float get_name_split_ratio() const;
258
259
void set_favoritable(bool p_favoritable);
260
bool is_favoritable() const;
261
262
void set_object_and_property(Object *p_object, const StringName &p_property);
263
virtual Control *make_custom_tooltip(const String &p_text) const override;
264
265
void set_draw_top_bg(bool p_draw) { draw_top_bg = p_draw; }
266
267
bool can_revert_to_default() const { return can_revert; }
268
269
void menu_option(int p_option);
270
271
EditorProperty();
272
};
273
274
class EditorInspectorPlugin : public RefCounted {
275
GDCLASS(EditorInspectorPlugin, RefCounted);
276
277
public:
278
friend class EditorInspector;
279
struct AddedEditor {
280
Control *property_editor = nullptr;
281
Vector<String> properties;
282
String label;
283
bool add_to_end = false;
284
};
285
286
List<AddedEditor> added_editors;
287
288
protected:
289
static void _bind_methods();
290
291
GDVIRTUAL1RC(bool, _can_handle, Object *)
292
GDVIRTUAL1(_parse_begin, Object *)
293
GDVIRTUAL2(_parse_category, Object *, String)
294
GDVIRTUAL2(_parse_group, Object *, String)
295
GDVIRTUAL7R(bool, _parse_property, Object *, Variant::Type, String, PropertyHint, String, BitField<PropertyUsageFlags>, bool)
296
GDVIRTUAL1(_parse_end, Object *)
297
298
#ifndef DISABLE_DEPRECATED
299
void _add_property_editor_bind_compat_92322(const String &p_for_property, Control *p_prop, bool p_add_to_end);
300
static void _bind_compatibility_methods();
301
#endif // DISABLE_DEPRECATED
302
public:
303
void add_custom_control(Control *control);
304
void add_property_editor(const String &p_for_property, Control *p_prop, bool p_add_to_end = false, const String &p_label = String());
305
void add_property_editor_for_multiple_properties(const String &p_label, const Vector<String> &p_properties, Control *p_prop);
306
307
virtual bool can_handle(Object *p_object);
308
virtual void parse_begin(Object *p_object);
309
virtual void parse_category(Object *p_object, const String &p_category);
310
virtual void parse_group(Object *p_object, const String &p_group);
311
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);
312
virtual void parse_end(Object *p_object);
313
};
314
315
class EditorInspectorCategory : public Control {
316
GDCLASS(EditorInspectorCategory, Control);
317
318
friend class EditorInspector;
319
320
// Right-click context menu options.
321
enum ClassMenuOption {
322
MENU_OPEN_DOCS,
323
MENU_UNFAVORITE_ALL,
324
};
325
326
struct ThemeCache {
327
int horizontal_separation = 0;
328
int vertical_separation = 0;
329
int class_icon_size = 0;
330
331
Color font_color;
332
333
Ref<Font> bold_font;
334
int bold_font_size = 0;
335
336
Ref<Texture2D> icon_favorites;
337
Ref<Texture2D> icon_unfavorite;
338
Ref<Texture2D> icon_help;
339
340
Ref<StyleBox> background;
341
} theme_cache;
342
343
PropertyInfo info;
344
345
Ref<Texture2D> icon;
346
String label;
347
String doc_class_name;
348
PopupMenu *menu = nullptr;
349
bool is_favorite = false;
350
bool menu_icon_dirty = true;
351
352
void _handle_menu_option(int p_option);
353
void _popup_context_menu(const Point2i &p_position);
354
void _update_icon();
355
356
protected:
357
static void _bind_methods();
358
359
void _notification(int p_what);
360
virtual void gui_input(const Ref<InputEvent> &p_event) override;
361
362
void _accessibility_action_menu(const Variant &p_data);
363
364
public:
365
void set_as_favorite();
366
void set_property_info(const PropertyInfo &p_info);
367
void set_doc_class_name(const String &p_name);
368
369
virtual Size2 get_minimum_size() const override;
370
virtual Control *make_custom_tooltip(const String &p_text) const override;
371
372
EditorInspectorCategory();
373
};
374
375
class EditorInspectorSection : public Container {
376
GDCLASS(EditorInspectorSection, Container);
377
378
friend class EditorInspector;
379
380
String label;
381
String section;
382
Color bg_color;
383
bool vbox_added = false; // Optimization.
384
bool foldable = false;
385
bool checkable = false;
386
bool checked = false;
387
bool keying = false;
388
int indent_depth = 0;
389
int level = 1;
390
String related_enable_property;
391
392
Timer *dropping_unfold_timer = nullptr;
393
bool dropping_for_unfold = false;
394
395
Rect2 check_rect;
396
bool check_hover = false;
397
Rect2 keying_rect;
398
bool keying_hover = false;
399
bool header_hover = false;
400
401
bool checkbox_only = false;
402
403
HashSet<StringName> revertable_properties;
404
405
void _test_unfold();
406
int _get_header_height();
407
Ref<Texture2D> _get_arrow();
408
Ref<Texture2D> _get_checkbox();
409
410
EditorInspector *_get_parent_inspector() const;
411
412
struct ThemeCache {
413
int horizontal_separation = 0;
414
int vertical_separation = 0;
415
int inspector_margin = 0;
416
int indent_size = 0;
417
418
Color warning_color;
419
Color prop_subsection;
420
Color font_color;
421
Color font_disabled_color;
422
Color font_hover_color;
423
Color font_pressed_color;
424
Color font_hover_pressed_color;
425
426
Ref<Font> font;
427
int font_size = 0;
428
Ref<Font> bold_font;
429
int bold_font_size = 0;
430
Ref<Font> light_font;
431
int light_font_size = 0;
432
433
Ref<Texture2D> arrow;
434
Ref<Texture2D> arrow_collapsed;
435
Ref<Texture2D> arrow_collapsed_mirrored;
436
Ref<Texture2D> icon_gui_checked;
437
Ref<Texture2D> icon_gui_unchecked;
438
Ref<Texture2D> icon_gui_animation_key;
439
440
Ref<StyleBoxFlat> indent_box;
441
Ref<StyleBoxFlat> key_hover;
442
} theme_cache;
443
444
protected:
445
Object *object = nullptr;
446
VBoxContainer *vbox = nullptr;
447
448
void _notification(int p_what);
449
static void _bind_methods();
450
virtual void gui_input(const Ref<InputEvent> &p_event) override;
451
452
void _accessibility_action_collapse(const Variant &p_data);
453
void _accessibility_action_expand(const Variant &p_data);
454
455
public:
456
virtual Size2 get_minimum_size() const override;
457
virtual Control *make_custom_tooltip(const String &p_text) const override;
458
459
void setup(const String &p_section, const String &p_label, Object *p_object, const Color &p_bg_color, bool p_foldable, int p_indent_depth = 0, int p_level = 1);
460
String get_section() const;
461
String get_label() const { return label; }
462
VBoxContainer *get_vbox();
463
void unfold();
464
void fold();
465
void set_bg_color(const Color &p_bg_color);
466
void reset_timer();
467
void set_checkable(const String &p_related_check_property, bool p_checkbox_only, bool p_checked);
468
inline bool is_checkable() const { return checkable; }
469
void set_checked(bool p_checked);
470
void set_keying(bool p_keying);
471
472
bool has_revertable_properties() const;
473
void property_can_revert_changed(const String &p_path, bool p_can_revert);
474
void _property_edited(const String &p_property);
475
void update_property();
476
477
EditorInspectorSection();
478
~EditorInspectorSection();
479
};
480
481
class ArrayPanelContainer : public PanelContainer {
482
GDCLASS(ArrayPanelContainer, PanelContainer);
483
484
protected:
485
void _notification(int p_what);
486
487
void _accessibility_action_menu(const Variant &p_data);
488
489
public:
490
ArrayPanelContainer();
491
};
492
493
class EditorInspectorArray : public EditorInspectorSection {
494
GDCLASS(EditorInspectorArray, EditorInspectorSection);
495
496
enum Mode {
497
MODE_NONE,
498
MODE_USE_COUNT_PROPERTY,
499
MODE_USE_MOVE_ARRAY_ELEMENT_FUNCTION,
500
} mode = MODE_NONE;
501
StringName count_property;
502
StringName array_element_prefix;
503
String swap_method;
504
505
int count = 0;
506
int selected = -1;
507
508
VBoxContainer *elements_vbox = nullptr;
509
510
Control *control_dropping = nullptr;
511
bool dropping = false;
512
513
Button *add_button = nullptr;
514
515
AcceptDialog *resize_dialog = nullptr;
516
SpinBox *new_size_spin_box = nullptr;
517
518
// Pagination.
519
int page_length = 5;
520
int page = 0;
521
int max_page = 0;
522
int begin_array_index = 0;
523
int end_array_index = 0;
524
525
bool read_only = false;
526
bool movable = true;
527
bool is_const = false;
528
bool numbered = false;
529
530
enum MenuOptions {
531
OPTION_MOVE_UP = 0,
532
OPTION_MOVE_DOWN,
533
OPTION_NEW_BEFORE,
534
OPTION_NEW_AFTER,
535
OPTION_REMOVE,
536
OPTION_CLEAR_ARRAY,
537
OPTION_RESIZE_ARRAY,
538
};
539
int popup_array_index_pressed = -1;
540
PopupMenu *rmb_popup = nullptr;
541
542
struct ArrayElement {
543
PanelContainer *panel = nullptr;
544
MarginContainer *margin = nullptr;
545
HBoxContainer *hbox = nullptr;
546
Button *move_up = nullptr;
547
TextureRect *move_texture_rect = nullptr;
548
Button *move_down = nullptr;
549
Label *number = nullptr;
550
VBoxContainer *vbox = nullptr;
551
Button *erase = nullptr;
552
};
553
LocalVector<ArrayElement> array_elements;
554
555
Ref<StyleBoxFlat> odd_style;
556
Ref<StyleBoxFlat> even_style;
557
558
int _get_array_count();
559
void _add_button_pressed();
560
void _paginator_page_changed(int p_page);
561
562
void _rmb_popup_id_pressed(int p_id);
563
564
void _control_dropping_draw();
565
566
void _vbox_visibility_changed();
567
568
void _panel_draw(int p_index);
569
void _panel_gui_input(Ref<InputEvent> p_event, int p_index);
570
void _panel_gui_focus(int p_index);
571
void _panel_gui_unfocus(int p_index);
572
void _move_element(int p_element_index, int p_to_pos);
573
void _clear_array();
574
void _resize_array(int p_size);
575
Array _extract_properties_as_array(const List<PropertyInfo> &p_list);
576
int _drop_position() const;
577
578
void _new_size_spin_box_value_changed(float p_value);
579
void _new_size_spin_box_text_submitted(const String &p_text);
580
void _resize_dialog_confirmed();
581
582
void _update_elements_visibility();
583
void _setup();
584
585
Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
586
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
587
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
588
589
void _remove_item(int p_index);
590
591
protected:
592
void _notification(int p_what);
593
static void _bind_methods();
594
595
public:
596
void setup_with_move_element_function(Object *p_object, const String &p_label, const StringName &p_array_element_prefix, int p_page, const Color &p_bg_color, bool p_foldable, bool p_movable = true, bool p_is_const = false, bool p_numbered = false, int p_page_length = 5, const String &p_add_item_text = "");
597
void setup_with_count_property(Object *p_object, const String &p_label, const StringName &p_count_property, const StringName &p_array_element_prefix, int p_page, const Color &p_bg_color, bool p_foldable, bool p_movable = true, bool p_is_const = false, bool p_numbered = false, int p_page_length = 5, const String &p_add_item_text = "", const String &p_swap_method = "");
598
VBoxContainer *get_vbox(int p_index);
599
600
void show_menu(int p_index, const Vector2 &p_offset);
601
602
EditorInspectorArray(bool p_read_only);
603
};
604
605
class EditorPaginator : public HBoxContainer {
606
GDCLASS(EditorPaginator, HBoxContainer);
607
608
int page = 0;
609
int max_page = 0;
610
Button *first_page_button = nullptr;
611
Button *prev_page_button = nullptr;
612
LineEdit *page_line_edit = nullptr;
613
Label *page_count_label = nullptr;
614
Button *next_page_button = nullptr;
615
Button *last_page_button = nullptr;
616
617
void _first_page_button_pressed();
618
void _prev_page_button_pressed();
619
void _page_line_edit_text_submitted(const String &p_text);
620
void _next_page_button_pressed();
621
void _last_page_button_pressed();
622
623
protected:
624
void _notification(int p_what);
625
static void _bind_methods();
626
627
public:
628
void update(int p_page, int p_max_page);
629
630
EditorPaginator();
631
};
632
633
class EditorInspector : public ScrollContainer {
634
GDCLASS(EditorInspector, ScrollContainer);
635
636
friend class EditorPropertyResource;
637
638
enum {
639
MAX_PLUGINS = 1024
640
};
641
static Ref<EditorInspectorPlugin> inspector_plugins[MAX_PLUGINS];
642
static int inspector_plugin_count;
643
644
struct ThemeCache {
645
int vertical_separation = 0;
646
Color prop_subsection;
647
Ref<Texture2D> icon_add;
648
} theme_cache;
649
650
EditorInspectorSection::ThemeCache section_theme_cache;
651
EditorInspectorCategory::ThemeCache category_theme_cache;
652
653
bool can_favorite = false;
654
PackedStringArray current_favorites;
655
VBoxContainer *favorites_section = nullptr;
656
VBoxContainer *favorites_vbox = nullptr;
657
VBoxContainer *favorites_groups_vbox = nullptr;
658
HSeparator *favorites_separator = nullptr;
659
660
EditorInspector *root_inspector = nullptr;
661
662
VBoxContainer *base_vbox = nullptr;
663
VBoxContainer *begin_vbox = nullptr;
664
VBoxContainer *main_vbox = nullptr;
665
666
// Map used to cache the instantiated editors.
667
HashMap<StringName, List<EditorProperty *>> editor_property_map;
668
List<EditorInspectorSection *> sections;
669
HashSet<StringName> pending;
670
671
void _clear(bool p_hide_plugins = true);
672
Object *object = nullptr;
673
Object *next_object = nullptr;
674
675
//
676
677
LineEdit *search_box = nullptr;
678
bool show_standard_categories = false;
679
bool show_custom_categories = false;
680
bool hide_script = true;
681
bool hide_metadata = true;
682
bool use_doc_hints = false;
683
EditorPropertyNameProcessor::Style property_name_style = EditorPropertyNameProcessor::STYLE_CAPITALIZED;
684
bool use_settings_name_style = true;
685
bool use_filter = false;
686
bool autoclear = false;
687
bool use_folding = false;
688
int changing;
689
bool update_all_pending = false;
690
bool read_only = false;
691
bool keying = false;
692
bool wide_editors = false;
693
bool deletable_properties = false;
694
bool mark_unsaved = true;
695
696
float refresh_countdown;
697
bool update_tree_pending = false;
698
StringName _prop_edited;
699
StringName property_selected;
700
int property_focusable;
701
int update_scroll_request;
702
703
bool updating_theme = false;
704
705
struct DocCacheInfo {
706
String doc_path;
707
String theme_item_name;
708
};
709
710
HashMap<StringName, HashMap<StringName, DocCacheInfo>> doc_cache;
711
HashSet<StringName> restart_request_props;
712
HashMap<String, String> custom_property_descriptions;
713
714
HashMap<ObjectID, int> scroll_cache;
715
716
String property_prefix; // Used for sectioned inspector.
717
String object_class;
718
Variant property_clipboard;
719
720
bool restrict_to_basic = false;
721
722
void _edit_set(const String &p_name, const Variant &p_value, bool p_refresh_all, const String &p_changed_field);
723
724
void _property_changed(const String &p_path, const Variant &p_value, const String &p_name = "", bool p_changing = false, bool p_update_all = false);
725
void _multiple_properties_changed(const Vector<String> &p_paths, const Array &p_values, bool p_changing = false);
726
void _property_keyed(const String &p_path, bool p_advance);
727
void _property_keyed_with_value(const String &p_path, const Variant &p_value, bool p_advance);
728
void _property_deleted(const String &p_path);
729
void _property_checked(const String &p_path, bool p_checked);
730
void _property_pinned(const String &p_path, bool p_pinned);
731
bool _property_path_matches(const String &p_property_path, const String &p_filter, EditorPropertyNameProcessor::Style p_style);
732
bool _resource_properties_matches(const Ref<Resource> &p_resource, const String &p_filter);
733
734
void _resource_selected(const String &p_path, Ref<Resource> p_resource);
735
void _property_selected(const String &p_path, int p_focusable);
736
void _object_id_selected(const String &p_path, ObjectID p_id);
737
738
void _update_current_favorites();
739
void _set_property_favorited(const String &p_path, bool p_favorited);
740
void _clear_current_favorites();
741
742
void _node_removed(Node *p_node);
743
744
HashMap<StringName, int> per_array_page;
745
void _page_change_request(int p_new_page, const StringName &p_array_prefix);
746
747
void _changed_callback();
748
void _edit_request_change(Object *p_object, const String &p_prop);
749
750
void _keying_changed();
751
752
void _parse_added_editors(VBoxContainer *current_vbox, EditorInspectorSection *p_section, Ref<EditorInspectorPlugin> ped);
753
754
void _vscroll_changed(double);
755
756
void _feature_profile_changed();
757
758
bool _is_property_disabled_by_feature_profile(const StringName &p_property);
759
760
void _section_toggled_by_user(const String &p_path, bool p_value);
761
762
AddMetadataDialog *add_meta_dialog = nullptr;
763
LineEdit *add_meta_name = nullptr;
764
OptionButton *add_meta_type = nullptr;
765
EditorValidationPanel *validation_panel = nullptr;
766
767
void _add_meta_confirm();
768
void _show_add_meta_dialog();
769
770
static EditorInspector *_get_control_parent_inspector(Control *p_control);
771
772
protected:
773
static void _bind_methods();
774
void _notification(int p_what);
775
776
public:
777
static void add_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin);
778
static void remove_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin);
779
static void cleanup_plugins();
780
781
static EditorProperty *instantiate_property_editor(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false);
782
783
static void initialize_section_theme(EditorInspectorSection::ThemeCache &p_cache, Control *p_control);
784
static void initialize_category_theme(EditorInspectorCategory::ThemeCache &p_cache, Control *p_control);
785
786
bool is_main_editor_inspector() const;
787
String get_selected_path() const;
788
789
void update_tree();
790
void update_property(const String &p_prop);
791
void edit(Object *p_object);
792
Object *get_edited_object();
793
Object *get_next_edited_object();
794
795
void set_keying(bool p_active);
796
void set_read_only(bool p_read_only);
797
void set_mark_unsaved(bool p_mark) { mark_unsaved = p_mark; }
798
799
EditorPropertyNameProcessor::Style get_property_name_style() const;
800
void set_property_name_style(EditorPropertyNameProcessor::Style p_style);
801
802
// If true, the inspector will update its property name style according to the current editor settings.
803
void set_use_settings_name_style(bool p_enable);
804
805
void set_autoclear(bool p_enable);
806
807
void set_show_categories(bool p_show_standard, bool p_show_custom);
808
void set_use_doc_hints(bool p_enable);
809
void set_hide_script(bool p_hide);
810
void set_hide_metadata(bool p_hide);
811
812
void set_use_filter(bool p_use);
813
void register_text_enter(Node *p_line_edit);
814
815
void set_use_folding(bool p_use_folding, bool p_update_tree = true);
816
bool is_using_folding();
817
818
void collapse_all_folding();
819
void expand_all_folding();
820
void expand_revertable();
821
822
void set_scroll_offset(int p_offset);
823
int get_scroll_offset() const;
824
825
void set_property_prefix(const String &p_prefix);
826
String get_property_prefix() const;
827
828
void add_custom_property_description(const String &p_class, const String &p_property, const String &p_description);
829
String get_custom_property_description(const String &p_property) const;
830
831
void set_object_class(const String &p_class);
832
String get_object_class() const;
833
834
void set_use_wide_editors(bool p_enable);
835
void set_root_inspector(EditorInspector *p_root_inspector);
836
EditorInspector *get_root_inspector() { return is_sub_inspector() ? root_inspector : this; }
837
bool is_sub_inspector() const { return root_inspector != nullptr; }
838
839
void set_use_deletable_properties(bool p_enabled);
840
841
void set_restrict_to_basic_settings(bool p_restrict);
842
void set_property_clipboard(const Variant &p_value);
843
Variant get_property_clipboard() const;
844
845
EditorInspector();
846
};
847
848