2018-05-17 01:19:33 +08:00
|
|
|
/*************************************************************************/
|
|
|
|
/* editor_properties.h */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/*************************************************************************/
|
2022-01-04 04:27:34 +08:00
|
|
|
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
2018-05-17 01:19:33 +08:00
|
|
|
/* */
|
|
|
|
/* 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. */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2018-05-16 04:12:35 +08:00
|
|
|
#ifndef EDITOR_PROPERTIES_H
|
|
|
|
#define EDITOR_PROPERTIES_H
|
|
|
|
|
|
|
|
#include "editor/create_dialog.h"
|
|
|
|
#include "editor/editor_inspector.h"
|
2021-09-23 19:08:50 +08:00
|
|
|
#include "editor/editor_locale_dialog.h"
|
2021-05-19 20:19:07 +08:00
|
|
|
#include "editor/editor_resource_picker.h"
|
2018-05-16 04:12:35 +08:00
|
|
|
#include "editor/editor_spin_slider.h"
|
|
|
|
#include "editor/property_selector.h"
|
|
|
|
#include "editor/scene_tree_editor.h"
|
|
|
|
#include "scene/gui/color_picker.h"
|
2018-12-04 20:30:00 +08:00
|
|
|
#include "scene/gui/line_edit.h"
|
2018-05-16 04:12:35 +08:00
|
|
|
|
2018-05-20 03:09:38 +08:00
|
|
|
class EditorPropertyNil : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyNil, EditorProperty);
|
2020-11-24 17:12:55 +08:00
|
|
|
LineEdit *text = nullptr;
|
2018-05-20 03:09:38 +08:00
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2018-05-20 03:09:38 +08:00
|
|
|
EditorPropertyNil();
|
|
|
|
};
|
|
|
|
|
2018-05-16 04:12:35 +08:00
|
|
|
class EditorPropertyText : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyText, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
LineEdit *text;
|
|
|
|
|
|
|
|
bool updating;
|
2020-02-21 05:58:05 +08:00
|
|
|
bool string_name;
|
2018-05-16 04:12:35 +08:00
|
|
|
void _text_changed(const String &p_string);
|
2021-06-17 00:43:34 +08:00
|
|
|
void _text_submitted(const String &p_string);
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-02-21 05:58:05 +08:00
|
|
|
void set_string_name(bool p_enabled);
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2018-08-17 09:50:12 +08:00
|
|
|
void set_placeholder(const String &p_string);
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorPropertyText();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyMultilineText : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyMultilineText, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
TextEdit *text;
|
|
|
|
|
|
|
|
AcceptDialog *big_text_dialog;
|
|
|
|
TextEdit *big_text;
|
|
|
|
Button *open_big_text;
|
|
|
|
|
|
|
|
void _big_text_changed();
|
|
|
|
void _text_changed();
|
|
|
|
void _open_big_text();
|
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-16 04:12:35 +08:00
|
|
|
void _notification(int p_what);
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorPropertyMultilineText();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyTextEnum : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyTextEnum, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
|
2021-07-05 04:42:23 +08:00
|
|
|
HBoxContainer *default_layout;
|
|
|
|
HBoxContainer *edit_custom_layout;
|
|
|
|
|
|
|
|
OptionButton *option_button;
|
|
|
|
Button *edit_button;
|
|
|
|
|
|
|
|
LineEdit *custom_value_edit;
|
|
|
|
Button *accept_button;
|
|
|
|
Button *cancel_button;
|
|
|
|
|
|
|
|
Vector<String> options;
|
|
|
|
bool string_name = false;
|
|
|
|
bool loose_mode = false;
|
|
|
|
|
|
|
|
void _emit_changed_value(String p_string);
|
2018-05-16 04:12:35 +08:00
|
|
|
void _option_selected(int p_which);
|
2021-07-05 04:42:23 +08:00
|
|
|
|
|
|
|
void _edit_custom_value();
|
|
|
|
void _custom_value_submitted(String p_value);
|
|
|
|
void _custom_value_accepted();
|
|
|
|
void _custom_value_cancelled();
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
2021-07-05 04:42:23 +08:00
|
|
|
void _notification(int p_what);
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
public:
|
2021-07-05 04:42:23 +08:00
|
|
|
void setup(const Vector<String> &p_options, bool p_string_name = false, bool p_loose_mode = false);
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorPropertyTextEnum();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyPath : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyPath, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
Vector<String> extensions;
|
|
|
|
bool folder;
|
|
|
|
bool global;
|
2018-11-13 03:04:58 +08:00
|
|
|
bool save_mode;
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorFileDialog *dialog;
|
2018-08-23 22:44:36 +08:00
|
|
|
LineEdit *path;
|
|
|
|
Button *path_edit;
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
void _path_selected(const String &p_path);
|
|
|
|
void _path_pressed();
|
2018-08-23 22:44:36 +08:00
|
|
|
void _path_focus_exited();
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
2018-08-23 22:44:36 +08:00
|
|
|
void _notification(int p_what);
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
void setup(const Vector<String> &p_extensions, bool p_folder, bool p_global);
|
2018-11-13 03:04:58 +08:00
|
|
|
void set_save_mode();
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorPropertyPath();
|
|
|
|
};
|
|
|
|
|
2021-09-23 19:08:50 +08:00
|
|
|
class EditorPropertyLocale : public EditorProperty {
|
|
|
|
GDCLASS(EditorPropertyLocale, EditorProperty);
|
|
|
|
EditorLocaleDialog *dialog;
|
|
|
|
LineEdit *locale;
|
|
|
|
Button *locale_edit;
|
|
|
|
|
|
|
|
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();
|
|
|
|
};
|
|
|
|
|
2018-07-19 12:58:40 +08:00
|
|
|
class EditorPropertyClassName : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyClassName, EditorProperty);
|
|
|
|
|
2018-07-19 12:58:40 +08:00
|
|
|
private:
|
|
|
|
CreateDialog *dialog;
|
|
|
|
Button *property;
|
|
|
|
String selected_type;
|
|
|
|
String base_type;
|
|
|
|
void _property_selected();
|
|
|
|
void _dialog_created();
|
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-07-19 12:58:40 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setup(const String &p_base_type, const String &p_selected_type);
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2018-07-19 12:58:40 +08:00
|
|
|
EditorPropertyClassName();
|
|
|
|
};
|
|
|
|
|
2018-05-16 04:12:35 +08:00
|
|
|
class EditorPropertyMember : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyMember, EditorProperty);
|
|
|
|
|
2018-05-16 04:12:35 +08:00
|
|
|
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;
|
|
|
|
Button *property;
|
|
|
|
String hint_text;
|
|
|
|
|
|
|
|
void _property_selected(const String &p_selected);
|
|
|
|
void _property_select();
|
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setup(Type p_hint, const String &p_hint_text);
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorPropertyMember();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyCheck : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyCheck, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
CheckBox *checkbox;
|
|
|
|
|
|
|
|
void _checkbox_pressed();
|
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorPropertyCheck();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyEnum : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyEnum, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
OptionButton *options;
|
|
|
|
|
|
|
|
void _option_selected(int p_which);
|
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setup(const Vector<String> &p_options);
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2018-07-15 05:15:42 +08:00
|
|
|
void set_option_button_clip(bool p_enable);
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorPropertyEnum();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyFlags : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyFlags, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
VBoxContainer *vbox;
|
|
|
|
Vector<CheckBox *> flags;
|
|
|
|
Vector<int> flag_indices;
|
|
|
|
|
|
|
|
void _flag_toggled();
|
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setup(const Vector<String> &p_options);
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorPropertyFlags();
|
|
|
|
};
|
|
|
|
|
2021-12-21 04:30:05 +08:00
|
|
|
///////////////////// 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;
|
|
|
|
ConfirmationDialog *rename_dialog;
|
|
|
|
LineEdit *rename_dialog_text;
|
|
|
|
|
|
|
|
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();
|
|
|
|
};
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
class EditorPropertyLayers : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyLayers, EditorProperty);
|
|
|
|
|
2018-05-16 04:12:35 +08:00
|
|
|
public:
|
|
|
|
enum LayerType {
|
|
|
|
LAYER_PHYSICS_2D,
|
|
|
|
LAYER_RENDER_2D,
|
2021-03-09 03:56:33 +08:00
|
|
|
LAYER_NAVIGATION_2D,
|
2018-05-16 04:12:35 +08:00
|
|
|
LAYER_PHYSICS_3D,
|
|
|
|
LAYER_RENDER_3D,
|
2021-03-09 03:56:33 +08:00
|
|
|
LAYER_NAVIGATION_3D,
|
2018-05-16 04:12:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
EditorPropertyLayersGrid *grid;
|
|
|
|
void _grid_changed(uint32_t p_grid);
|
2021-12-21 04:30:05 +08:00
|
|
|
String basename;
|
2018-05-16 04:12:35 +08:00
|
|
|
LayerType layer_type;
|
|
|
|
PopupMenu *layers;
|
|
|
|
Button *button;
|
|
|
|
|
|
|
|
void _button_pressed();
|
|
|
|
void _menu_pressed(int p_menu);
|
2021-12-21 04:30:05 +08:00
|
|
|
void _refresh_names();
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setup(LayerType p_layer_type);
|
2021-12-21 04:30:05 +08:00
|
|
|
void set_layer_name(int p_index, const String &p_name);
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorPropertyLayers();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyInteger : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyInteger, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorSpinSlider *spin;
|
|
|
|
bool setting;
|
2020-01-16 09:37:08 +08:00
|
|
|
void _value_changed(int64_t p_val);
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2020-01-16 09:37:08 +08:00
|
|
|
void setup(int64_t p_min, int64_t p_max, int64_t p_step, bool p_allow_greater, bool p_allow_lesser);
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorPropertyInteger();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyObjectID : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyObjectID, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
Button *edit;
|
|
|
|
String base_type;
|
|
|
|
void _edit_pressed();
|
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2018-05-16 04:12:35 +08:00
|
|
|
void setup(const String &p_base_type);
|
|
|
|
EditorPropertyObjectID();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyFloat : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyFloat, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorSpinSlider *spin;
|
Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-30 03:42:12 +08:00
|
|
|
bool setting = false;
|
|
|
|
bool angle_in_radians = false;
|
2018-05-16 04:12:35 +08:00
|
|
|
void _value_changed(double p_val);
|
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-30 03:42:12 +08:00
|
|
|
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);
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorPropertyFloat();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyEasing : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyEasing, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
Control *easing_draw;
|
2018-07-19 06:37:17 +08:00
|
|
|
PopupMenu *preset;
|
2018-12-04 20:30:00 +08:00
|
|
|
EditorSpinSlider *spin;
|
|
|
|
bool setting;
|
|
|
|
|
2019-09-06 22:04:07 +08:00
|
|
|
bool dragging;
|
2018-07-19 06:37:17 +08:00
|
|
|
bool full;
|
2018-12-04 20:30:00 +08:00
|
|
|
bool flip;
|
2018-07-19 06:37:17 +08:00
|
|
|
|
|
|
|
enum {
|
|
|
|
EASING_ZERO,
|
|
|
|
EASING_LINEAR,
|
|
|
|
EASING_IN,
|
|
|
|
EASING_OUT,
|
|
|
|
EASING_IN_OUT,
|
|
|
|
EASING_OUT_IN,
|
|
|
|
EASING_MAX
|
|
|
|
|
|
|
|
};
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
void _drag_easing(const Ref<InputEvent> &p_ev);
|
|
|
|
void _draw_easing();
|
2018-07-19 06:37:17 +08:00
|
|
|
void _set_preset(int);
|
2018-05-16 04:12:35 +08:00
|
|
|
|
2018-12-04 20:30:00 +08:00
|
|
|
void _setup_spin();
|
|
|
|
void _spin_value_changed(double p_value);
|
|
|
|
void _spin_focus_exited();
|
|
|
|
|
|
|
|
void _notification(int p_what);
|
|
|
|
|
2018-05-16 04:12:35 +08:00
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2018-05-16 04:12:35 +08:00
|
|
|
void setup(bool p_full, bool p_flip);
|
|
|
|
EditorPropertyEasing();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyVector2 : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyVector2, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorSpinSlider *spin[2];
|
|
|
|
bool setting;
|
2018-09-03 01:16:33 +08:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-07-19 09:27:39 +08:00
|
|
|
void _notification(int p_what);
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-30 03:42:12 +08:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
|
2020-04-17 10:52:00 +08:00
|
|
|
EditorPropertyVector2(bool p_force_wide = false);
|
2018-05-16 04:12:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyRect2 : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyRect2, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorSpinSlider *spin[4];
|
|
|
|
bool setting;
|
2018-09-03 01:16:33 +08:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-07-19 09:27:39 +08:00
|
|
|
void _notification(int p_what);
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-30 03:42:12 +08:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
|
2020-04-17 10:52:00 +08:00
|
|
|
EditorPropertyRect2(bool p_force_wide = false);
|
2018-05-16 04:12:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyVector3 : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyVector3, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorSpinSlider *spin[3];
|
Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-30 03:42:12 +08:00
|
|
|
bool setting = false;
|
|
|
|
bool angle_in_radians = false;
|
2018-09-03 01:16:33 +08:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-07-19 09:27:39 +08:00
|
|
|
void _notification(int p_what);
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2020-05-27 02:17:11 +08:00
|
|
|
virtual void update_using_vector(Vector3 p_vector);
|
|
|
|
virtual Vector3 get_vector();
|
Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-30 03:42:12 +08:00
|
|
|
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);
|
2020-04-17 10:52:00 +08:00
|
|
|
EditorPropertyVector3(bool p_force_wide = false);
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyVector2i : public EditorProperty {
|
|
|
|
GDCLASS(EditorPropertyVector2i, EditorProperty);
|
|
|
|
EditorSpinSlider *spin[2];
|
|
|
|
bool setting;
|
|
|
|
void _value_changed(double p_val, const String &p_name);
|
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2020-04-17 10:52:00 +08:00
|
|
|
void _notification(int p_what);
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-30 03:42:12 +08:00
|
|
|
void setup(int p_min, int p_max, bool p_no_slider, const String &p_suffix = String());
|
2020-04-17 10:52:00 +08:00
|
|
|
EditorPropertyVector2i(bool p_force_wide = false);
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyRect2i : public EditorProperty {
|
|
|
|
GDCLASS(EditorPropertyRect2i, EditorProperty);
|
|
|
|
EditorSpinSlider *spin[4];
|
|
|
|
bool setting;
|
|
|
|
void _value_changed(double p_val, const String &p_name);
|
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2020-04-17 10:52:00 +08:00
|
|
|
void _notification(int p_what);
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-30 03:42:12 +08:00
|
|
|
void setup(int p_min, int p_max, bool p_no_slider, const String &p_suffix = String());
|
2020-04-17 10:52:00 +08:00
|
|
|
EditorPropertyRect2i(bool p_force_wide = false);
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyVector3i : public EditorProperty {
|
|
|
|
GDCLASS(EditorPropertyVector3i, EditorProperty);
|
|
|
|
EditorSpinSlider *spin[3];
|
|
|
|
bool setting;
|
|
|
|
void _value_changed(double p_val, const String &p_name);
|
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2020-04-17 10:52:00 +08:00
|
|
|
void _notification(int p_what);
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-30 03:42:12 +08:00
|
|
|
void setup(int p_min, int p_max, bool p_no_slider, const String &p_suffix = String());
|
2020-04-17 10:52:00 +08:00
|
|
|
EditorPropertyVector3i(bool p_force_wide = false);
|
2018-05-16 04:12:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyPlane : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyPlane, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorSpinSlider *spin[4];
|
|
|
|
bool setting;
|
2018-09-03 01:16:33 +08:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-07-19 09:27:39 +08:00
|
|
|
void _notification(int p_what);
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-30 03:42:12 +08:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
|
2020-04-17 10:52:00 +08:00
|
|
|
EditorPropertyPlane(bool p_force_wide = false);
|
2018-05-16 04:12:35 +08:00
|
|
|
};
|
|
|
|
|
2021-01-20 15:02:02 +08:00
|
|
|
class EditorPropertyQuaternion : public EditorProperty {
|
|
|
|
GDCLASS(EditorPropertyQuaternion, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorSpinSlider *spin[4];
|
|
|
|
bool setting;
|
2018-09-03 01:16:33 +08:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-07-19 09:27:39 +08:00
|
|
|
void _notification(int p_what);
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-30 03:42:12 +08:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
|
2021-01-20 15:02:02 +08:00
|
|
|
EditorPropertyQuaternion();
|
2018-05-16 04:12:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyAABB : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyAABB, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorSpinSlider *spin[6];
|
|
|
|
bool setting;
|
2018-09-03 01:16:33 +08:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-07-19 09:27:39 +08:00
|
|
|
void _notification(int p_what);
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-30 03:42:12 +08:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorPropertyAABB();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyTransform2D : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyTransform2D, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorSpinSlider *spin[6];
|
|
|
|
bool setting;
|
2018-09-03 01:16:33 +08:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-07-19 09:27:39 +08:00
|
|
|
void _notification(int p_what);
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-30 03:42:12 +08:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
|
2021-03-19 13:42:56 +08:00
|
|
|
EditorPropertyTransform2D(bool p_include_origin = true);
|
2018-05-16 04:12:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyBasis : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyBasis, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorSpinSlider *spin[9];
|
|
|
|
bool setting;
|
2018-09-03 01:16:33 +08:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-07-19 09:27:39 +08:00
|
|
|
void _notification(int p_what);
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-30 03:42:12 +08:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorPropertyBasis();
|
|
|
|
};
|
|
|
|
|
2021-06-04 09:58:26 +08:00
|
|
|
class EditorPropertyTransform3D : public EditorProperty {
|
|
|
|
GDCLASS(EditorPropertyTransform3D, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorSpinSlider *spin[12];
|
|
|
|
bool setting;
|
2018-09-03 01:16:33 +08:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-07-19 09:27:39 +08:00
|
|
|
void _notification(int p_what);
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2020-10-17 13:08:21 +08:00
|
|
|
virtual void update_using_transform(Transform3D p_transform);
|
Fix editor suffixes and degrees conversion
* Functions to convert to/from degrees are all gone. Conversion is done by the editor.
* Use PROPERTY_HINT_ANGLE instead of PROPERTY_HINT_RANGE to edit radian angles in degrees.
* Added possibility to add suffixes to range properties, use "min,max[,step][,suffix:<something>]" example "0,100,1,suffix:m"
* In general, can add suffixes for EditorSpinSlider
Not covered by this PR, will have to be addressed by future ones:
* Ability to switch radians/degrees in the inspector for angle properties (if actually wanted).
* Animations previously made will most likely break, need to add a way to make old ones compatible.
* Only added a "px" suffix to 2D position and a "m" one to 3D position, someone needs to go through the rest of the engine and add all remaining suffixes.
* Likely also need to track down usage of EditorSpinSlider outside properties to add suffixes to it too.
2021-06-30 03:42:12 +08:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_no_slider, const String &p_suffix = String());
|
2021-06-04 09:58:26 +08:00
|
|
|
EditorPropertyTransform3D();
|
2018-05-16 04:12:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyColor : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyColor, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
ColorPickerButton *picker;
|
|
|
|
void _color_changed(const Color &p_color);
|
2021-01-09 21:17:33 +08:00
|
|
|
void _popup_closed();
|
2019-08-31 04:25:15 +08:00
|
|
|
void _picker_created();
|
2021-01-09 21:17:33 +08:00
|
|
|
void _picker_opening();
|
|
|
|
|
|
|
|
Color last_color;
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2018-05-16 04:12:35 +08:00
|
|
|
void setup(bool p_show_alpha);
|
|
|
|
EditorPropertyColor();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyNodePath : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyNodePath, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
Button *assign;
|
|
|
|
Button *clear;
|
|
|
|
SceneTreeDialog *scene_tree;
|
|
|
|
NodePath base_hint;
|
2019-01-15 02:52:43 +08:00
|
|
|
bool use_path_from_scene_root;
|
2018-05-16 04:12:35 +08:00
|
|
|
|
2018-06-28 07:50:25 +08:00
|
|
|
Vector<StringName> valid_types;
|
2018-05-16 04:12:35 +08:00
|
|
|
void _node_selected(const NodePath &p_path);
|
|
|
|
void _node_assign();
|
|
|
|
void _node_clear();
|
|
|
|
|
2021-12-10 01:50:57 +08:00
|
|
|
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;
|
|
|
|
|
2018-05-16 04:12:35 +08:00
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
void _notification(int p_what);
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2019-01-15 02:52:43 +08:00
|
|
|
void setup(const NodePath &p_base_hint, Vector<StringName> p_valid_types, bool p_use_path_from_scene_root = true);
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorPropertyNodePath();
|
|
|
|
};
|
|
|
|
|
2019-01-13 22:43:25 +08:00
|
|
|
class EditorPropertyRID : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyRID, EditorProperty);
|
2019-01-13 22:43:25 +08:00
|
|
|
Label *label;
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2019-01-13 22:43:25 +08:00
|
|
|
EditorPropertyRID();
|
|
|
|
};
|
|
|
|
|
2018-05-16 04:12:35 +08:00
|
|
|
class EditorPropertyResource : public EditorProperty {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorPropertyResource, EditorProperty);
|
2018-05-16 04:12:35 +08:00
|
|
|
|
2021-05-19 20:19:07 +08:00
|
|
|
EditorResourcePicker *resource_picker = nullptr;
|
|
|
|
SceneTreeDialog *scene_tree = nullptr;
|
2018-05-16 04:12:35 +08:00
|
|
|
|
2021-05-19 20:19:07 +08:00
|
|
|
bool use_sub_inspector = false;
|
|
|
|
EditorInspector *sub_inspector = nullptr;
|
|
|
|
VBoxContainer *sub_inspector_vbox = nullptr;
|
|
|
|
bool updating_theme = false;
|
|
|
|
bool opened_editor = false;
|
2018-05-16 04:12:35 +08:00
|
|
|
|
2021-11-02 19:35:15 +08:00
|
|
|
void _resource_selected(const RES &p_resource, bool p_edit);
|
2021-05-19 20:19:07 +08:00
|
|
|
void _resource_changed(const RES &p_resource);
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
void _viewport_selected(const NodePath &p_path);
|
|
|
|
|
2021-12-03 23:23:32 +08:00
|
|
|
void _sub_inspector_property_keyed(const String &p_property, const Variant &p_value, bool p_advance);
|
2018-05-18 05:02:16 +08:00
|
|
|
void _sub_inspector_resource_selected(const RES &p_resource, const String &p_property);
|
|
|
|
void _sub_inspector_object_id_selected(int p_id);
|
|
|
|
|
2018-06-19 09:10:48 +08:00
|
|
|
void _open_editor_pressed();
|
2019-03-05 03:44:39 +08:00
|
|
|
void _fold_other_editors(Object *p_self);
|
2021-02-12 05:01:56 +08:00
|
|
|
void _update_property_bg();
|
2021-09-17 22:35:24 +08:00
|
|
|
void _update_preferred_shader();
|
2021-02-12 05:01:56 +08:00
|
|
|
|
2018-05-16 04:12:35 +08:00
|
|
|
protected:
|
2021-08-16 10:42:24 +08:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-16 04:12:35 +08:00
|
|
|
static void _bind_methods();
|
|
|
|
void _notification(int p_what);
|
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual void update_property() override;
|
2021-05-19 20:19:07 +08:00
|
|
|
void setup(Object *p_object, const String &p_path, const String &p_base_type);
|
2018-05-18 05:02:16 +08:00
|
|
|
|
2020-07-10 18:34:39 +08:00
|
|
|
void collapse_all_folding() override;
|
|
|
|
void expand_all_folding() override;
|
2018-05-18 05:02:16 +08:00
|
|
|
|
2018-07-15 05:15:42 +08:00
|
|
|
void set_use_sub_inspector(bool p_enable);
|
|
|
|
|
2018-05-16 04:12:35 +08:00
|
|
|
EditorPropertyResource();
|
|
|
|
};
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////
|
|
|
|
/// \brief The EditorInspectorDefaultPlugin class
|
|
|
|
///
|
|
|
|
class EditorInspectorDefaultPlugin : public EditorInspectorPlugin {
|
2019-03-20 02:35:57 +08:00
|
|
|
GDCLASS(EditorInspectorDefaultPlugin, EditorInspectorPlugin);
|
2018-05-16 04:12:35 +08:00
|
|
|
|
|
|
|
public:
|
2020-07-10 18:34:39 +08:00
|
|
|
virtual bool can_handle(Object *p_object) override;
|
2021-07-01 09:24:34 +08:00
|
|
|
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;
|
2021-06-10 02:01:08 +08:00
|
|
|
|
2021-07-01 09:24:34 +08:00
|
|
|
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);
|
2018-05-16 04:12:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // EDITOR_PROPERTIES_H
|