diff options
Diffstat (limited to 'editor/editor_properties.h')
-rw-r--r-- | editor/editor_properties.h | 137 |
1 files changed, 122 insertions, 15 deletions
diff --git a/editor/editor_properties.h b/editor/editor_properties.h index 1f40a7fe7b..b3aac6e8ca 100644 --- a/editor/editor_properties.h +++ b/editor/editor_properties.h @@ -81,6 +81,7 @@ class EditorPropertyMultilineText : public EditorProperty { 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; @@ -89,7 +90,7 @@ protected: public: virtual void update_property() override; - EditorPropertyMultilineText(); + EditorPropertyMultilineText(bool p_expression = false); }; class EditorPropertyTextEnum : public EditorProperty { @@ -265,9 +266,9 @@ class EditorPropertyFlags : public EditorProperty { GDCLASS(EditorPropertyFlags, EditorProperty); VBoxContainer *vbox = nullptr; Vector<CheckBox *> flags; - Vector<int> flag_indices; + Vector<uint32_t> flag_values; - void _flag_toggled(); + void _flag_toggled(int p_index); protected: virtual void _set_read_only(bool p_read_only) override; @@ -368,7 +369,7 @@ protected: 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); + 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(); }; @@ -388,6 +389,33 @@ public: 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; @@ -451,16 +479,19 @@ 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); - 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()); + 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); }; @@ -486,6 +517,14 @@ class EditorPropertyVector3 : public 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: @@ -497,7 +536,7 @@ 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, const String &p_suffix = String(), bool p_angle_in_radians = false); + 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); }; @@ -505,16 +544,19 @@ 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); - 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()); + 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); }; @@ -539,6 +581,14 @@ 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: @@ -548,7 +598,7 @@ protected: public: virtual void update_property() override; - void setup(int p_min, int p_max, bool p_no_slider, const String &p_suffix = String()); + 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); }; @@ -586,6 +636,40 @@ public: 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]; @@ -655,6 +739,24 @@ public: 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; @@ -667,7 +769,7 @@ class EditorPropertyColor : public EditorProperty { 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; @@ -682,6 +784,7 @@ class EditorPropertyNodePath : public EditorProperty { 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); @@ -692,6 +795,10 @@ class EditorPropertyNodePath : public EditorProperty { 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(); @@ -699,7 +806,7 @@ protected: 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); + 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(); }; @@ -724,13 +831,13 @@ class EditorPropertyResource : public EditorProperty { bool updating_theme = false; bool opened_editor = false; - void _resource_selected(const RES &p_resource, bool p_edit); - void _resource_changed(const RES &p_resource); + void _resource_selected(const Ref<Resource> &p_resource, bool p_edit); + 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 RES &p_resource, const String &p_property); + 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(); |