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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
|
/*************************************************************************/
/* editor_properties.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef EDITOR_PROPERTIES_H
#define EDITOR_PROPERTIES_H
#include "editor/create_dialog.h"
#include "editor/editor_inspector.h"
#include "editor/editor_locale_dialog.h"
#include "editor/editor_resource_picker.h"
#include "editor/editor_spin_slider.h"
#include "editor/property_selector.h"
#include "editor/scene_tree_editor.h"
#include "scene/gui/color_picker.h"
#include "scene/gui/line_edit.h"
class EditorPropertyNil : public EditorProperty {
GDCLASS(EditorPropertyNil, EditorProperty);
LineEdit *text = nullptr;
public:
virtual void update_property() override;
EditorPropertyNil();
};
class EditorPropertyText : public EditorProperty {
GDCLASS(EditorPropertyText, EditorProperty);
LineEdit *text = nullptr;
bool updating = false;
bool string_name = false;
void _text_changed(const String &p_string);
void _text_submitted(const String &p_string);
protected:
virtual void _set_read_only(bool p_read_only) override;
static void _bind_methods();
public:
void set_string_name(bool p_enabled);
virtual void update_property() override;
void set_placeholder(const String &p_string);
void set_secret(bool p_enabled);
EditorPropertyText();
};
class EditorPropertyMultilineText : public EditorProperty {
GDCLASS(EditorPropertyMultilineText, EditorProperty);
TextEdit *text = nullptr;
AcceptDialog *big_text_dialog = nullptr;
TextEdit *big_text = nullptr;
Button *open_big_text = nullptr;
void _big_text_changed();
void _text_changed();
void _open_big_text();
bool expression = false;
protected:
virtual void _set_read_only(bool p_read_only) override;
void _notification(int p_what);
static void _bind_methods();
public:
virtual void update_property() override;
EditorPropertyMultilineText(bool p_expression = false);
};
class EditorPropertyTextEnum : public EditorProperty {
GDCLASS(EditorPropertyTextEnum, EditorProperty);
HBoxContainer *default_layout = nullptr;
HBoxContainer *edit_custom_layout = nullptr;
OptionButton *option_button = nullptr;
Button *edit_button = nullptr;
LineEdit *custom_value_edit = nullptr;
Button *accept_button = nullptr;
Button *cancel_button = nullptr;
Vector<String> options;
bool string_name = false;
bool loose_mode = false;
void _emit_changed_value(String p_string);
void _option_selected(int p_which);
void _edit_custom_value();
void _custom_value_submitted(String p_value);
void _custom_value_accepted();
void _custom_value_cancelled();
protected:
virtual void _set_read_only(bool p_read_only) override;
static void _bind_methods();
void _notification(int p_what);
public:
void setup(const Vector<String> &p_options, bool p_string_name = false, bool p_loose_mode = false);
virtual void update_property() override;
EditorPropertyTextEnum();
};
class EditorPropertyPath : public EditorProperty {
GDCLASS(EditorPropertyPath, EditorProperty);
Vector<String> extensions;
bool folder = false;
bool global = false;
bool save_mode = false;
EditorFileDialog *dialog = nullptr;
LineEdit *path = nullptr;
Button *path_edit = nullptr;
void _path_selected(const String &p_path);
void _path_pressed();
void _path_focus_exited();
void _drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
bool _can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
protected:
virtual void _set_read_only(bool p_read_only) override;
static void _bind_methods();
void _notification(int p_what);
public:
void setup(const Vector<String> &p_extensions, bool p_folder, bool p_global);
void set_save_mode();
virtual void update_property() override;
EditorPropertyPath();
};
class EditorPropertyLocale : public EditorProperty {
GDCLASS(EditorPropertyLocale, EditorProperty);
EditorLocaleDialog *dialog = nullptr;
LineEdit *locale = nullptr;
Button *locale_edit = nullptr;
void _locale_selected(const String &p_locale);
void _locale_pressed();
void _locale_focus_exited();
protected:
static void _bind_methods();
void _notification(int p_what);
public:
void setup(const String &p_hit_string);
virtual void update_property() override;
EditorPropertyLocale();
};
class EditorPropertyClassName : public EditorProperty {
GDCLASS(EditorPropertyClassName, EditorProperty);
private:
CreateDialog *dialog = nullptr;
Button *property = nullptr;
String selected_type;
String base_type;
void _property_selected();
void _dialog_created();
protected:
virtual void _set_read_only(bool p_read_only) override;
static void _bind_methods();
public:
void setup(const String &p_base_type, const String &p_selected_type);
virtual void update_property() override;
EditorPropertyClassName();
};
class EditorPropertyMember : public EditorProperty {
GDCLASS(EditorPropertyMember, EditorProperty);
public:
enum Type {
MEMBER_METHOD_OF_VARIANT_TYPE, ///< a method of a type
MEMBER_METHOD_OF_BASE_TYPE, ///< a method of a base type
MEMBER_METHOD_OF_INSTANCE, ///< a method of an instance
MEMBER_METHOD_OF_SCRIPT, ///< a method of a script & base
MEMBER_PROPERTY_OF_VARIANT_TYPE, ///< a property of a type
MEMBER_PROPERTY_OF_BASE_TYPE, ///< a property of a base type
MEMBER_PROPERTY_OF_INSTANCE, ///< a property of an instance
MEMBER_PROPERTY_OF_SCRIPT, ///< a property of a script & base
};
private:
Type hint;
PropertySelector *selector = nullptr;
Button *property = nullptr;
String hint_text;
void _property_selected(const String &p_selected);
void _property_select();
protected:
virtual void _set_read_only(bool p_read_only) override;
static void _bind_methods();
public:
void setup(Type p_hint, const String &p_hint_text);
virtual void update_property() override;
EditorPropertyMember();
};
class EditorPropertyCheck : public EditorProperty {
GDCLASS(EditorPropertyCheck, EditorProperty);
CheckBox *checkbox = nullptr;
void _checkbox_pressed();
protected:
virtual void _set_read_only(bool p_read_only) override;
static void _bind_methods();
public:
virtual void update_property() override;
EditorPropertyCheck();
};
class EditorPropertyEnum : public EditorProperty {
GDCLASS(EditorPropertyEnum, EditorProperty);
OptionButton *options = nullptr;
void _option_selected(int p_which);
protected:
virtual void _set_read_only(bool p_read_only) override;
static void _bind_methods();
public:
void setup(const Vector<String> &p_options);
virtual void update_property() override;
void set_option_button_clip(bool p_enable);
EditorPropertyEnum();
};
class EditorPropertyFlags : public EditorProperty {
GDCLASS(EditorPropertyFlags, EditorProperty);
VBoxContainer *vbox = nullptr;
Vector<CheckBox *> flags;
Vector<uint32_t> flag_values;
void _flag_toggled(int p_index);
protected:
virtual void _set_read_only(bool p_read_only) override;
static void _bind_methods();
public:
void setup(const Vector<String> &p_options);
virtual void update_property() override;
EditorPropertyFlags();
};
///////////////////// LAYERS /////////////////////////
class EditorPropertyLayersGrid : public Control {
GDCLASS(EditorPropertyLayersGrid, Control);
private:
Vector<Rect2> flag_rects;
Rect2 expand_rect;
bool expand_hovered = false;
bool expanded = false;
int expansion_rows = 0;
int hovered_index = -1;
bool read_only = false;
int renamed_layer_index = -1;
PopupMenu *layer_rename = nullptr;
ConfirmationDialog *rename_dialog = nullptr;
LineEdit *rename_dialog_text = nullptr;
void _rename_pressed(int p_menu);
void _rename_operation_confirm();
Size2 get_grid_size() const;
protected:
void _notification(int p_what);
static void _bind_methods();
public:
uint32_t value = 0;
int layer_group_size = 0;
int layer_count = 0;
Vector<String> names;
Vector<String> tooltips;
void set_read_only(bool p_read_only);
virtual Size2 get_minimum_size() const override;
virtual String get_tooltip(const Point2 &p_pos) const override;
void gui_input(const Ref<InputEvent> &p_ev) override;
void set_flag(uint32_t p_flag);
EditorPropertyLayersGrid();
};
class EditorPropertyLayers : public EditorProperty {
GDCLASS(EditorPropertyLayers, EditorProperty);
public:
enum LayerType {
LAYER_PHYSICS_2D,
LAYER_RENDER_2D,
LAYER_NAVIGATION_2D,
LAYER_PHYSICS_3D,
LAYER_RENDER_3D,
LAYER_NAVIGATION_3D,
};
private:
EditorPropertyLayersGrid *grid = nullptr;
void _grid_changed(uint32_t p_grid);
String basename;
LayerType layer_type;
PopupMenu *layers = nullptr;
TextureButton *button = nullptr;
void _button_pressed();
void _menu_pressed(int p_menu);
void _refresh_names();
protected:
void _notification(int p_what);
virtual void _set_read_only(bool p_read_only) override;
static void _bind_methods();
public:
void setup(LayerType p_layer_type);
void set_layer_name(int p_index, const String &p_name);
virtual void update_property() override;
EditorPropertyLayers();
};
class EditorPropertyInteger : public EditorProperty {
GDCLASS(EditorPropertyInteger, EditorProperty);
EditorSpinSlider *spin = nullptr;
bool setting = false;
void _value_changed(int64_t p_val);
protected:
virtual void _set_read_only(bool p_read_only) override;
static void _bind_methods();
public:
virtual void update_property() override;
void setup(int64_t p_min, int64_t p_max, int64_t p_step, bool p_allow_greater, bool p_allow_lesser, const String &p_suffix = String());
EditorPropertyInteger();
};
class EditorPropertyObjectID : public EditorProperty {
GDCLASS(EditorPropertyObjectID, EditorProperty);
Button *edit = nullptr;
String base_type;
void _edit_pressed();
protected:
virtual void _set_read_only(bool p_read_only) override;
static void _bind_methods();
public:
virtual void update_property() override;
void setup(const String &p_base_type);
EditorPropertyObjectID();
};
class EditorPropertySignal : public EditorProperty {
GDCLASS(EditorPropertySignal, EditorProperty);
Button *edit = nullptr;
String base_type;
void _edit_pressed();
protected:
static void _bind_methods();
public:
virtual void update_property() override;
EditorPropertySignal();
};
class EditorPropertyCallable : public EditorProperty {
GDCLASS(EditorPropertyCallable, EditorProperty);
Button *edit = nullptr;
String base_type;
protected:
static void _bind_methods();
public:
virtual void update_property() override;
EditorPropertyCallable();
};
class EditorPropertyFloat : public EditorProperty {
GDCLASS(EditorPropertyFloat, EditorProperty);
EditorSpinSlider *spin = nullptr;
bool setting = false;
bool angle_in_radians = false;
void _value_changed(double p_val);
protected:
virtual void _set_read_only(bool p_read_only) override;
static void _bind_methods();
public:
virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider, bool p_exp_range, bool p_greater, bool p_lesser, const String &p_suffix = String(), bool p_angle_in_radians = false);
EditorPropertyFloat();
};
class EditorPropertyEasing : public EditorProperty {
GDCLASS(EditorPropertyEasing, EditorProperty);
Control *easing_draw = nullptr;
PopupMenu *preset = nullptr;
EditorSpinSlider *spin = nullptr;
bool setting = false;
bool dragging = false;
bool full = false;
bool flip = false;
bool positive_only = false;
enum {
EASING_ZERO,
EASING_LINEAR,
EASING_IN,
EASING_OUT,
EASING_IN_OUT,
EASING_OUT_IN,
EASING_MAX
};
void _drag_easing(const Ref<InputEvent> &p_ev);
void _draw_easing();
void _set_preset(int);
void _setup_spin();
void _spin_value_changed(double p_value);
void _spin_focus_exited();
void _notification(int p_what);
protected:
virtual void _set_read_only(bool p_read_only) override;
static void _bind_methods();
public:
virtual void update_property() override;
void setup(bool p_positive_only, bool p_flip);
EditorPropertyEasing();
};
class EditorPropertyVector2 : public EditorProperty {
GDCLASS(EditorPropertyVector2, EditorProperty);
EditorSpinSlider *spin[2];
bool setting = false;
double ratio_xy = 1.0;
double ratio_yx = 1.0;
TextureButton *linked = nullptr;
void _update_ratio();
void _value_changed(double p_val, const String &p_name);
protected:
virtual void _set_read_only(bool p_read_only) override;
void _notification(int p_what);
public:
virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider, bool p_link = false, const String &p_suffix = String());
EditorPropertyVector2(bool p_force_wide = false);
};
class EditorPropertyRect2 : public EditorProperty {
GDCLASS(EditorPropertyRect2, EditorProperty);
EditorSpinSlider *spin[4];
bool setting = false;
void _value_changed(double p_val, const String &p_name);
protected:
virtual void _set_read_only(bool p_read_only) override;
void _notification(int p_what);
static void _bind_methods();
public:
virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
EditorPropertyRect2(bool p_force_wide = false);
};
class EditorPropertyVector3 : public EditorProperty {
GDCLASS(EditorPropertyVector3, EditorProperty);
EditorSpinSlider *spin[3];
bool setting = false;
bool angle_in_radians = false;
double ratio_yx = 1.0;
double ratio_zx = 1.0;
double ratio_xy = 1.0;
double ratio_zy = 1.0;
double ratio_xz = 1.0;
double ratio_yz = 1.0;
TextureButton *linked = nullptr;
void _update_ratio();
void _value_changed(double p_val, const String &p_name);
protected:
virtual void _set_read_only(bool p_read_only) override;
void _notification(int p_what);
static void _bind_methods();
public:
virtual void update_property() override;
virtual void update_using_vector(Vector3 p_vector);
virtual Vector3 get_vector();
void setup(double p_min, double p_max, double p_step, bool p_no_slider, bool p_link = false, const String &p_suffix = String(), bool p_angle_in_radians = false);
EditorPropertyVector3(bool p_force_wide = false);
};
class EditorPropertyVector2i : public EditorProperty {
GDCLASS(EditorPropertyVector2i, EditorProperty);
EditorSpinSlider *spin[2];
bool setting = false;
double ratio_xy = 1.0;
double ratio_yx = 1.0;
TextureButton *linked = nullptr;
void _update_ratio();
void _value_changed(double p_val, const String &p_name);
protected:
virtual void _set_read_only(bool p_read_only) override;
void _notification(int p_what);
public:
virtual void update_property() override;
void setup(int p_min, int p_max, bool p_no_slider, bool p_link = false, const String &p_suffix = String());
EditorPropertyVector2i(bool p_force_wide = false);
};
class EditorPropertyRect2i : public EditorProperty {
GDCLASS(EditorPropertyRect2i, EditorProperty);
EditorSpinSlider *spin[4];
bool setting = false;
void _value_changed(double p_val, const String &p_name);
protected:
virtual void _set_read_only(bool p_read_only) override;
void _notification(int p_what);
static void _bind_methods();
public:
virtual void update_property() override;
void setup(int p_min, int p_max, bool p_no_slider, const String &p_suffix = String());
EditorPropertyRect2i(bool p_force_wide = false);
};
class EditorPropertyVector3i : public EditorProperty {
GDCLASS(EditorPropertyVector3i, EditorProperty);
EditorSpinSlider *spin[3];
bool setting = false;
double ratio_yx = 1.0;
double ratio_zx = 1.0;
double ratio_xy = 1.0;
double ratio_zy = 1.0;
double ratio_xz = 1.0;
double ratio_yz = 1.0;
TextureButton *linked = nullptr;
void _update_ratio();
void _value_changed(double p_val, const String &p_name);
protected:
virtual void _set_read_only(bool p_read_only) override;
void _notification(int p_what);
static void _bind_methods();
public:
virtual void update_property() override;
void setup(int p_min, int p_max, bool p_no_slider, bool p_link = false, const String &p_suffix = String());
EditorPropertyVector3i(bool p_force_wide = false);
};
class EditorPropertyPlane : public EditorProperty {
GDCLASS(EditorPropertyPlane, EditorProperty);
EditorSpinSlider *spin[4];
bool setting = false;
void _value_changed(double p_val, const String &p_name);
protected:
virtual void _set_read_only(bool p_read_only) override;
void _notification(int p_what);
static void _bind_methods();
public:
virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
EditorPropertyPlane(bool p_force_wide = false);
};
class EditorPropertyQuaternion : public EditorProperty {
GDCLASS(EditorPropertyQuaternion, EditorProperty);
BoxContainer *default_layout = nullptr;
EditorSpinSlider *spin[4];
bool setting = false;
Button *warning = nullptr;
AcceptDialog *warning_dialog = nullptr;
Label *euler_label = nullptr;
VBoxContainer *edit_custom_bc = nullptr;
EditorSpinSlider *euler[3];
Button *edit_button = nullptr;
Vector3 edit_euler = Vector3();
void _value_changed(double p_val, const String &p_name);
void _edit_custom_value();
void _custom_value_changed(double p_val);
void _warning_pressed();
bool is_grabbing_euler();
protected:
virtual void _set_read_only(bool p_read_only) override;
void _notification(int p_what);
static void _bind_methods();
public:
virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String(), bool p_hide_editor = false);
EditorPropertyQuaternion();
};
class EditorPropertyVector4 : public EditorProperty {
GDCLASS(EditorPropertyVector4, EditorProperty);
EditorSpinSlider *spin[4];
bool setting = false;
void _value_changed(double p_val, const String &p_name);
protected:
virtual void _set_read_only(bool p_read_only) override;
void _notification(int p_what);
static void _bind_methods();
public:
virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
EditorPropertyVector4();
};
class EditorPropertyVector4i : public EditorProperty {
GDCLASS(EditorPropertyVector4i, EditorProperty);
EditorSpinSlider *spin[4];
bool setting = false;
void _value_changed(double p_val, const String &p_name);
protected:
virtual void _set_read_only(bool p_read_only) override;
void _notification(int p_what);
static void _bind_methods();
public:
virtual void update_property() override;
void setup(double p_min, double p_max, bool p_no_slider, const String &p_suffix = String());
EditorPropertyVector4i();
};
class EditorPropertyAABB : public EditorProperty {
GDCLASS(EditorPropertyAABB, EditorProperty);
EditorSpinSlider *spin[6];
bool setting = false;
void _value_changed(double p_val, const String &p_name);
protected:
virtual void _set_read_only(bool p_read_only) override;
void _notification(int p_what);
static void _bind_methods();
public:
virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
EditorPropertyAABB();
};
class EditorPropertyTransform2D : public EditorProperty {
GDCLASS(EditorPropertyTransform2D, EditorProperty);
EditorSpinSlider *spin[6];
bool setting = false;
void _value_changed(double p_val, const String &p_name);
protected:
virtual void _set_read_only(bool p_read_only) override;
void _notification(int p_what);
static void _bind_methods();
public:
virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
EditorPropertyTransform2D(bool p_include_origin = true);
};
class EditorPropertyBasis : public EditorProperty {
GDCLASS(EditorPropertyBasis, EditorProperty);
EditorSpinSlider *spin[9];
bool setting = false;
void _value_changed(double p_val, const String &p_name);
protected:
virtual void _set_read_only(bool p_read_only) override;
void _notification(int p_what);
static void _bind_methods();
public:
virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
EditorPropertyBasis();
};
class EditorPropertyTransform3D : public EditorProperty {
GDCLASS(EditorPropertyTransform3D, EditorProperty);
EditorSpinSlider *spin[12];
bool setting = false;
void _value_changed(double p_val, const String &p_name);
protected:
virtual void _set_read_only(bool p_read_only) override;
void _notification(int p_what);
static void _bind_methods();
public:
virtual void update_property() override;
virtual void update_using_transform(Transform3D p_transform);
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
EditorPropertyTransform3D();
};
class EditorPropertyProjection : public EditorProperty {
GDCLASS(EditorPropertyProjection, EditorProperty);
EditorSpinSlider *spin[16];
bool setting = false;
void _value_changed(double p_val, const String &p_name);
protected:
virtual void _set_read_only(bool p_read_only) override;
void _notification(int p_what);
static void _bind_methods();
public:
virtual void update_property() override;
virtual void update_using_transform(Projection p_transform);
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
EditorPropertyProjection();
};
class EditorPropertyColor : public EditorProperty {
GDCLASS(EditorPropertyColor, EditorProperty);
ColorPickerButton *picker = nullptr;
void _color_changed(const Color &p_color);
void _popup_closed();
void _picker_created();
void _picker_opening();
Color last_color;
protected:
virtual void _set_read_only(bool p_read_only) override;
void _notification(int p_what);
public:
virtual void update_property() override;
void setup(bool p_show_alpha);
EditorPropertyColor();
};
class EditorPropertyNodePath : public EditorProperty {
GDCLASS(EditorPropertyNodePath, EditorProperty);
Button *assign = nullptr;
Button *clear = nullptr;
SceneTreeDialog *scene_tree = nullptr;
NodePath base_hint;
bool use_path_from_scene_root = false;
bool pointer_mode = false;
Vector<StringName> valid_types;
void _node_selected(const NodePath &p_path);
void _node_assign();
void _node_clear();
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
bool is_drop_valid(const Dictionary &p_drag_data) const;
String _get_meta_pointer_property() const;
virtual Variant _get_cache_value(const StringName &p_prop, bool &r_valid) const override;
virtual StringName _get_revert_property() const override;
protected:
virtual void _set_read_only(bool p_read_only) override;
static void _bind_methods();
void _notification(int p_what);
public:
virtual void update_property() override;
void setup(const NodePath &p_base_hint, Vector<StringName> p_valid_types, bool p_use_path_from_scene_root = true, bool p_pointer_mode = false);
EditorPropertyNodePath();
};
class EditorPropertyRID : public EditorProperty {
GDCLASS(EditorPropertyRID, EditorProperty);
Label *label = nullptr;
public:
virtual void update_property() override;
EditorPropertyRID();
};
class EditorPropertyResource : public EditorProperty {
GDCLASS(EditorPropertyResource, EditorProperty);
EditorResourcePicker *resource_picker = nullptr;
SceneTreeDialog *scene_tree = nullptr;
bool use_sub_inspector = false;
EditorInspector *sub_inspector = nullptr;
VBoxContainer *sub_inspector_vbox = nullptr;
bool updating_theme = false;
bool opened_editor = false;
void _resource_selected(const Ref<Resource> &p_resource, bool p_inspect);
void _resource_changed(const Ref<Resource> &p_resource);
void _viewport_selected(const NodePath &p_path);
void _sub_inspector_property_keyed(const String &p_property, const Variant &p_value, bool p_advance);
void _sub_inspector_resource_selected(const Ref<Resource> &p_resource, const String &p_property);
void _sub_inspector_object_id_selected(int p_id);
void _open_editor_pressed();
void _fold_other_editors(Object *p_self);
void _update_property_bg();
void _update_preferred_shader();
protected:
virtual void _set_read_only(bool p_read_only) override;
static void _bind_methods();
void _notification(int p_what);
public:
virtual void update_property() override;
void setup(Object *p_object, const String &p_path, const String &p_base_type);
void collapse_all_folding() override;
void expand_all_folding() override;
void expand_revertable() override;
void set_use_sub_inspector(bool p_enable);
EditorPropertyResource();
};
///////////////////////////////////////////////////
/// \brief The EditorInspectorDefaultPlugin class
///
class EditorInspectorDefaultPlugin : public EditorInspectorPlugin {
GDCLASS(EditorInspectorDefaultPlugin, EditorInspectorPlugin);
public:
virtual bool can_handle(Object *p_object) override;
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 uint32_t p_usage, const bool p_wide = false) override;
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 uint32_t p_usage, const bool p_wide = false);
};
#endif // EDITOR_PROPERTIES_H
|