2023-01-05 12:25:55 +00:00
|
|
|
/**************************************************************************/
|
|
|
|
/* editor_properties.h */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* 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 17:19:33 +00:00
|
|
|
|
2018-05-15 20:12:35 +00:00
|
|
|
#ifndef EDITOR_PROPERTIES_H
|
|
|
|
#define EDITOR_PROPERTIES_H
|
|
|
|
|
|
|
|
#include "editor/editor_inspector.h"
|
2022-11-19 11:45:49 +00:00
|
|
|
|
|
|
|
class CheckBox;
|
|
|
|
class ColorPickerButton;
|
|
|
|
class CreateDialog;
|
|
|
|
class EditorFileDialog;
|
|
|
|
class EditorLocaleDialog;
|
|
|
|
class EditorResourcePicker;
|
|
|
|
class EditorSpinSlider;
|
|
|
|
class PropertySelector;
|
|
|
|
class SceneTreeDialog;
|
|
|
|
class TextEdit;
|
|
|
|
class TextureButton;
|
2018-05-15 20:12:35 +00:00
|
|
|
|
2018-05-19 19:09:38 +00:00
|
|
|
class EditorPropertyNil : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyNil, EditorProperty);
|
2020-11-24 09:12:55 +00:00
|
|
|
LineEdit *text = nullptr;
|
2018-05-19 19:09:38 +00:00
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2018-05-19 19:09:38 +00:00
|
|
|
EditorPropertyNil();
|
|
|
|
};
|
|
|
|
|
2018-05-15 20:12:35 +00:00
|
|
|
class EditorPropertyText : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyText, EditorProperty);
|
2022-04-04 13:06:57 +00:00
|
|
|
LineEdit *text = nullptr;
|
2018-05-15 20:12:35 +00:00
|
|
|
|
2022-02-15 14:56:58 +00:00
|
|
|
bool updating = false;
|
|
|
|
bool string_name = false;
|
2018-05-15 20:12:35 +00:00
|
|
|
void _text_changed(const String &p_string);
|
2021-06-16 16:43:34 +00:00
|
|
|
void _text_submitted(const String &p_string);
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-15 20:12:35 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-02-20 21:58:05 +00:00
|
|
|
void set_string_name(bool p_enabled);
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2018-08-17 01:50:12 +00:00
|
|
|
void set_placeholder(const String &p_string);
|
2022-08-09 15:51:43 +00:00
|
|
|
void set_secret(bool p_enabled);
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorPropertyText();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyMultilineText : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyMultilineText, EditorProperty);
|
2022-04-04 13:06:57 +00:00
|
|
|
TextEdit *text = nullptr;
|
2018-05-15 20:12:35 +00:00
|
|
|
|
2022-04-04 13:06:57 +00:00
|
|
|
AcceptDialog *big_text_dialog = nullptr;
|
|
|
|
TextEdit *big_text = nullptr;
|
|
|
|
Button *open_big_text = nullptr;
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
void _big_text_changed();
|
|
|
|
void _text_changed();
|
|
|
|
void _open_big_text();
|
2022-06-27 20:10:04 +00:00
|
|
|
bool expression = false;
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-15 20:12:35 +00:00
|
|
|
void _notification(int p_what);
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2022-06-27 20:10:04 +00:00
|
|
|
EditorPropertyMultilineText(bool p_expression = false);
|
2018-05-15 20:12:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyTextEnum : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyTextEnum, EditorProperty);
|
2018-05-15 20:12:35 +00:00
|
|
|
|
2022-04-04 13:06:57 +00:00
|
|
|
HBoxContainer *default_layout = nullptr;
|
|
|
|
HBoxContainer *edit_custom_layout = nullptr;
|
2021-07-04 20:42:23 +00:00
|
|
|
|
2022-04-04 13:06:57 +00:00
|
|
|
OptionButton *option_button = nullptr;
|
|
|
|
Button *edit_button = nullptr;
|
2021-07-04 20:42:23 +00:00
|
|
|
|
2022-04-04 13:06:57 +00:00
|
|
|
LineEdit *custom_value_edit = nullptr;
|
|
|
|
Button *accept_button = nullptr;
|
|
|
|
Button *cancel_button = nullptr;
|
2021-07-04 20:42:23 +00:00
|
|
|
|
|
|
|
Vector<String> options;
|
|
|
|
bool string_name = false;
|
|
|
|
bool loose_mode = false;
|
|
|
|
|
|
|
|
void _emit_changed_value(String p_string);
|
2018-05-15 20:12:35 +00:00
|
|
|
void _option_selected(int p_which);
|
2021-07-04 20:42:23 +00:00
|
|
|
|
|
|
|
void _edit_custom_value();
|
|
|
|
void _custom_value_submitted(String p_value);
|
|
|
|
void _custom_value_accepted();
|
2023-01-21 11:25:29 +00:00
|
|
|
void _custom_value_canceled();
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-15 20:12:35 +00:00
|
|
|
static void _bind_methods();
|
2021-07-04 20:42:23 +00:00
|
|
|
void _notification(int p_what);
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
public:
|
2021-07-04 20:42:23 +00:00
|
|
|
void setup(const Vector<String> &p_options, bool p_string_name = false, bool p_loose_mode = false);
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorPropertyTextEnum();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyPath : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyPath, EditorProperty);
|
2018-05-15 20:12:35 +00:00
|
|
|
Vector<String> extensions;
|
2022-02-15 14:56:58 +00:00
|
|
|
bool folder = false;
|
|
|
|
bool global = false;
|
|
|
|
bool save_mode = false;
|
2022-04-04 13:06:57 +00:00
|
|
|
EditorFileDialog *dialog = nullptr;
|
|
|
|
LineEdit *path = nullptr;
|
|
|
|
Button *path_edit = nullptr;
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
void _path_selected(const String &p_path);
|
|
|
|
void _path_pressed();
|
2018-08-23 14:44:36 +00:00
|
|
|
void _path_focus_exited();
|
2022-06-15 23:59:19 +00:00
|
|
|
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;
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-15 20:12:35 +00:00
|
|
|
static void _bind_methods();
|
2018-08-23 14:44:36 +00:00
|
|
|
void _notification(int p_what);
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
void setup(const Vector<String> &p_extensions, bool p_folder, bool p_global);
|
2018-11-12 19:04:58 +00:00
|
|
|
void set_save_mode();
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorPropertyPath();
|
|
|
|
};
|
|
|
|
|
2021-09-23 11:08:50 +00:00
|
|
|
class EditorPropertyLocale : public EditorProperty {
|
|
|
|
GDCLASS(EditorPropertyLocale, EditorProperty);
|
2022-04-04 13:06:57 +00:00
|
|
|
EditorLocaleDialog *dialog = nullptr;
|
|
|
|
LineEdit *locale = nullptr;
|
|
|
|
Button *locale_edit = nullptr;
|
2021-09-23 11:08:50 +00:00
|
|
|
|
|
|
|
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 04:58:40 +00:00
|
|
|
class EditorPropertyClassName : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyClassName, EditorProperty);
|
|
|
|
|
2018-07-19 04:58:40 +00:00
|
|
|
private:
|
2022-04-04 13:06:57 +00:00
|
|
|
CreateDialog *dialog = nullptr;
|
|
|
|
Button *property = nullptr;
|
2018-07-19 04:58:40 +00:00
|
|
|
String selected_type;
|
|
|
|
String base_type;
|
|
|
|
void _property_selected();
|
|
|
|
void _dialog_created();
|
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-07-19 04:58:40 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setup(const String &p_base_type, const String &p_selected_type);
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2018-07-19 04:58:40 +00:00
|
|
|
EditorPropertyClassName();
|
|
|
|
};
|
|
|
|
|
2018-05-15 20:12:35 +00:00
|
|
|
class EditorPropertyCheck : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyCheck, EditorProperty);
|
2022-04-04 13:06:57 +00:00
|
|
|
CheckBox *checkbox = nullptr;
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
void _checkbox_pressed();
|
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-15 20:12:35 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorPropertyCheck();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyEnum : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyEnum, EditorProperty);
|
2022-04-04 13:06:57 +00:00
|
|
|
OptionButton *options = nullptr;
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
void _option_selected(int p_which);
|
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-15 20:12:35 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setup(const Vector<String> &p_options);
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2018-07-14 21:15:42 +00:00
|
|
|
void set_option_button_clip(bool p_enable);
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorPropertyEnum();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyFlags : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyFlags, EditorProperty);
|
2022-04-04 13:06:57 +00:00
|
|
|
VBoxContainer *vbox = nullptr;
|
2018-05-15 20:12:35 +00:00
|
|
|
Vector<CheckBox *> flags;
|
2022-03-06 17:04:29 +00:00
|
|
|
Vector<uint32_t> flag_values;
|
2018-05-15 20:12:35 +00:00
|
|
|
|
2022-03-06 17:04:29 +00:00
|
|
|
void _flag_toggled(int p_index);
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-15 20:12:35 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setup(const Vector<String> &p_options);
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorPropertyFlags();
|
|
|
|
};
|
|
|
|
|
2021-12-20 20:30:05 +00: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;
|
2020-06-07 13:14:18 +00:00
|
|
|
uint32_t hovered_index = INT32_MAX; // Nothing is hovered.
|
2021-12-20 20:30:05 +00:00
|
|
|
bool read_only = false;
|
|
|
|
int renamed_layer_index = -1;
|
2022-04-04 13:06:57 +00:00
|
|
|
PopupMenu *layer_rename = nullptr;
|
|
|
|
ConfirmationDialog *rename_dialog = nullptr;
|
|
|
|
LineEdit *rename_dialog_text = nullptr;
|
2021-12-20 20:30:05 +00:00
|
|
|
|
|
|
|
void _rename_pressed(int p_menu);
|
|
|
|
void _rename_operation_confirm();
|
2023-04-05 23:29:03 +00:00
|
|
|
void _update_hovered(const Vector2 &p_position);
|
|
|
|
void _on_hover_exit();
|
2020-06-07 13:14:18 +00:00
|
|
|
void _update_flag(bool p_replace);
|
2021-12-20 20:30:05 +00:00
|
|
|
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;
|
2020-06-07 13:14:18 +00:00
|
|
|
uint32_t layer_count = 0;
|
2021-12-20 20:30:05 +00:00
|
|
|
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-15 20:12:35 +00:00
|
|
|
|
|
|
|
class EditorPropertyLayers : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyLayers, EditorProperty);
|
|
|
|
|
2018-05-15 20:12:35 +00:00
|
|
|
public:
|
|
|
|
enum LayerType {
|
|
|
|
LAYER_PHYSICS_2D,
|
|
|
|
LAYER_RENDER_2D,
|
2021-03-08 19:56:33 +00:00
|
|
|
LAYER_NAVIGATION_2D,
|
2018-05-15 20:12:35 +00:00
|
|
|
LAYER_PHYSICS_3D,
|
|
|
|
LAYER_RENDER_3D,
|
2021-03-08 19:56:33 +00:00
|
|
|
LAYER_NAVIGATION_3D,
|
2023-01-10 06:14:16 +00:00
|
|
|
LAYER_AVOIDANCE,
|
2018-05-15 20:12:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
2022-04-04 13:06:57 +00:00
|
|
|
EditorPropertyLayersGrid *grid = nullptr;
|
2018-05-15 20:12:35 +00:00
|
|
|
void _grid_changed(uint32_t p_grid);
|
2021-12-20 20:30:05 +00:00
|
|
|
String basename;
|
2018-05-15 20:12:35 +00:00
|
|
|
LayerType layer_type;
|
2022-04-04 13:06:57 +00:00
|
|
|
PopupMenu *layers = nullptr;
|
2022-07-16 17:07:19 +00:00
|
|
|
TextureButton *button = nullptr;
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
void _button_pressed();
|
|
|
|
void _menu_pressed(int p_menu);
|
2021-12-20 20:30:05 +00:00
|
|
|
void _refresh_names();
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
protected:
|
2022-07-16 17:07:19 +00:00
|
|
|
void _notification(int p_what);
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-15 20:12:35 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setup(LayerType p_layer_type);
|
2021-12-20 20:30:05 +00:00
|
|
|
void set_layer_name(int p_index, const String &p_name);
|
2022-10-06 10:51:30 +00:00
|
|
|
String get_layer_name(int p_index) const;
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorPropertyLayers();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyInteger : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyInteger, EditorProperty);
|
2022-04-04 13:06:57 +00:00
|
|
|
EditorSpinSlider *spin = nullptr;
|
2022-02-15 14:56:58 +00:00
|
|
|
bool setting = false;
|
2020-01-16 01:37:08 +00:00
|
|
|
void _value_changed(int64_t p_val);
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-15 20:12:35 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2022-12-08 12:38:01 +00:00
|
|
|
void setup(int64_t p_min, int64_t p_max, int64_t p_step, bool p_hide_slider, bool p_allow_greater, bool p_allow_lesser, const String &p_suffix = String());
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorPropertyInteger();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyObjectID : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyObjectID, EditorProperty);
|
2022-04-04 13:06:57 +00:00
|
|
|
Button *edit = nullptr;
|
2018-05-15 20:12:35 +00:00
|
|
|
String base_type;
|
|
|
|
void _edit_pressed();
|
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-15 20:12:35 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2018-05-15 20:12:35 +00:00
|
|
|
void setup(const String &p_base_type);
|
|
|
|
EditorPropertyObjectID();
|
|
|
|
};
|
|
|
|
|
2022-06-30 00:16:03 +00:00
|
|
|
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();
|
|
|
|
};
|
|
|
|
|
2018-05-15 20:12:35 +00:00
|
|
|
class EditorPropertyFloat : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyFloat, EditorProperty);
|
2022-04-04 13:06:57 +00:00
|
|
|
EditorSpinSlider *spin = nullptr;
|
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-29 19:42:12 +00:00
|
|
|
bool setting = false;
|
2023-09-23 14:27:01 +00:00
|
|
|
bool radians_as_degrees = false;
|
2018-05-15 20:12:35 +00:00
|
|
|
void _value_changed(double p_val);
|
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-15 20:12:35 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2023-09-23 14:27:01 +00:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_hide_slider, bool p_exp_range, bool p_greater, bool p_lesser, const String &p_suffix = String(), bool p_radians_as_degrees = false);
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorPropertyFloat();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyEasing : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyEasing, EditorProperty);
|
2022-04-04 13:06:57 +00:00
|
|
|
Control *easing_draw = nullptr;
|
|
|
|
PopupMenu *preset = nullptr;
|
|
|
|
EditorSpinSlider *spin = nullptr;
|
2022-02-15 14:56:58 +00:00
|
|
|
bool setting = false;
|
2018-12-04 12:30:00 +00:00
|
|
|
|
2022-02-15 14:56:58 +00:00
|
|
|
bool dragging = false;
|
|
|
|
bool full = false;
|
|
|
|
bool flip = false;
|
2021-10-07 16:17:25 +00:00
|
|
|
bool positive_only = false;
|
2018-07-18 22:37:17 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
EASING_ZERO,
|
|
|
|
EASING_LINEAR,
|
|
|
|
EASING_IN,
|
|
|
|
EASING_OUT,
|
|
|
|
EASING_IN_OUT,
|
|
|
|
EASING_OUT_IN,
|
|
|
|
EASING_MAX
|
|
|
|
|
|
|
|
};
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
void _drag_easing(const Ref<InputEvent> &p_ev);
|
|
|
|
void _draw_easing();
|
2018-07-18 22:37:17 +00:00
|
|
|
void _set_preset(int);
|
2018-05-15 20:12:35 +00:00
|
|
|
|
2018-12-04 12:30:00 +00:00
|
|
|
void _setup_spin();
|
|
|
|
void _spin_value_changed(double p_value);
|
|
|
|
void _spin_focus_exited();
|
|
|
|
|
|
|
|
void _notification(int p_what);
|
|
|
|
|
2018-05-15 20:12:35 +00:00
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-15 20:12:35 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2021-10-07 16:17:25 +00:00
|
|
|
void setup(bool p_positive_only, bool p_flip);
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorPropertyEasing();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyRect2 : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyRect2, EditorProperty);
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorSpinSlider *spin[4];
|
2022-02-15 14:56:58 +00:00
|
|
|
bool setting = false;
|
2018-09-02 17:16:33 +00:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-07-19 01:27:39 +00:00
|
|
|
void _notification(int p_what);
|
2018-05-15 20:12:35 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2022-10-03 16:59:33 +00:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix = String());
|
2020-04-17 02:52:00 +00:00
|
|
|
EditorPropertyRect2(bool p_force_wide = false);
|
2018-05-15 20:12:35 +00:00
|
|
|
};
|
|
|
|
|
2020-04-17 02:52:00 +00:00
|
|
|
class EditorPropertyRect2i : public EditorProperty {
|
|
|
|
GDCLASS(EditorPropertyRect2i, EditorProperty);
|
|
|
|
EditorSpinSlider *spin[4];
|
2022-02-15 14:56:58 +00:00
|
|
|
bool setting = false;
|
2020-04-17 02:52:00 +00:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2020-04-17 02:52:00 +00:00
|
|
|
void _notification(int p_what);
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2022-12-08 12:38:01 +00:00
|
|
|
void setup(int p_min, int p_max, const String &p_suffix = String());
|
2020-04-17 02:52:00 +00:00
|
|
|
EditorPropertyRect2i(bool p_force_wide = false);
|
|
|
|
};
|
|
|
|
|
2018-05-15 20:12:35 +00:00
|
|
|
class EditorPropertyPlane : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyPlane, EditorProperty);
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorSpinSlider *spin[4];
|
2022-02-15 14:56:58 +00:00
|
|
|
bool setting = false;
|
2018-09-02 17:16:33 +00:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-07-19 01:27:39 +00:00
|
|
|
void _notification(int p_what);
|
2018-05-15 20:12:35 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2022-10-03 16:59:33 +00:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix = String());
|
2020-04-17 02:52:00 +00:00
|
|
|
EditorPropertyPlane(bool p_force_wide = false);
|
2018-05-15 20:12:35 +00:00
|
|
|
};
|
|
|
|
|
2021-01-20 07:02:02 +00:00
|
|
|
class EditorPropertyQuaternion : public EditorProperty {
|
|
|
|
GDCLASS(EditorPropertyQuaternion, EditorProperty);
|
2022-08-21 07:03:38 +00:00
|
|
|
BoxContainer *default_layout = nullptr;
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorSpinSlider *spin[4];
|
2022-02-15 14:56:58 +00:00
|
|
|
bool setting = false;
|
2022-08-21 07:03:38 +00:00
|
|
|
|
|
|
|
Button *warning = nullptr;
|
|
|
|
AcceptDialog *warning_dialog = nullptr;
|
|
|
|
|
|
|
|
Label *euler_label = nullptr;
|
|
|
|
VBoxContainer *edit_custom_bc = nullptr;
|
|
|
|
EditorSpinSlider *euler[3];
|
|
|
|
Button *edit_button = nullptr;
|
|
|
|
|
2022-11-14 17:21:06 +00:00
|
|
|
Vector3 edit_euler;
|
2022-08-21 07:03:38 +00:00
|
|
|
|
2018-09-02 17:16:33 +00:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2022-08-21 07:03:38 +00:00
|
|
|
void _edit_custom_value();
|
|
|
|
void _custom_value_changed(double p_val);
|
|
|
|
void _warning_pressed();
|
|
|
|
|
|
|
|
bool is_grabbing_euler();
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-07-19 01:27:39 +00:00
|
|
|
void _notification(int p_what);
|
2018-05-15 20:12:35 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2022-10-03 16:59:33 +00:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix = String(), bool p_hide_editor = false);
|
2021-01-20 07:02:02 +00:00
|
|
|
EditorPropertyQuaternion();
|
2018-05-15 20:12:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyAABB : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyAABB, EditorProperty);
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorSpinSlider *spin[6];
|
2022-02-15 14:56:58 +00:00
|
|
|
bool setting = false;
|
2018-09-02 17:16:33 +00:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-07-19 01:27:39 +00:00
|
|
|
void _notification(int p_what);
|
2018-05-15 20:12:35 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2022-10-03 16:59:33 +00:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix = String());
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorPropertyAABB();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyTransform2D : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyTransform2D, EditorProperty);
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorSpinSlider *spin[6];
|
2022-02-15 14:56:58 +00:00
|
|
|
bool setting = false;
|
2018-09-02 17:16:33 +00:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-07-19 01:27:39 +00:00
|
|
|
void _notification(int p_what);
|
2018-05-15 20:12:35 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2022-10-03 16:59:33 +00:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix = String());
|
2021-03-19 05:42:56 +00:00
|
|
|
EditorPropertyTransform2D(bool p_include_origin = true);
|
2018-05-15 20:12:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyBasis : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyBasis, EditorProperty);
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorSpinSlider *spin[9];
|
2022-02-15 14:56:58 +00:00
|
|
|
bool setting = false;
|
2018-09-02 17:16:33 +00:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-07-19 01:27:39 +00:00
|
|
|
void _notification(int p_what);
|
2018-05-15 20:12:35 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2022-10-03 16:59:33 +00:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix = String());
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorPropertyBasis();
|
|
|
|
};
|
|
|
|
|
2021-06-04 01:58:26 +00:00
|
|
|
class EditorPropertyTransform3D : public EditorProperty {
|
|
|
|
GDCLASS(EditorPropertyTransform3D, EditorProperty);
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorSpinSlider *spin[12];
|
2022-02-15 14:56:58 +00:00
|
|
|
bool setting = false;
|
2018-09-02 17:16:33 +00:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-07-19 01:27:39 +00:00
|
|
|
void _notification(int p_what);
|
2018-05-15 20:12:35 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2020-10-17 05:08:21 +00:00
|
|
|
virtual void update_using_transform(Transform3D p_transform);
|
2022-10-03 16:59:33 +00:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix = String());
|
2021-06-04 01:58:26 +00:00
|
|
|
EditorPropertyTransform3D();
|
2018-05-15 20:12:35 +00:00
|
|
|
};
|
|
|
|
|
Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
2022-07-19 23:11:13 +00:00
|
|
|
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);
|
2022-10-03 16:59:33 +00:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_hide_slider, const String &p_suffix = String());
|
Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.
* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.
These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.
**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
2022-07-19 23:11:13 +00:00
|
|
|
EditorPropertyProjection();
|
|
|
|
};
|
|
|
|
|
2018-05-15 20:12:35 +00:00
|
|
|
class EditorPropertyColor : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyColor, EditorProperty);
|
2022-04-04 13:06:57 +00:00
|
|
|
ColorPickerButton *picker = nullptr;
|
2018-05-15 20:12:35 +00:00
|
|
|
void _color_changed(const Color &p_color);
|
2021-01-09 13:17:33 +00:00
|
|
|
void _popup_closed();
|
2019-08-30 20:25:15 +00:00
|
|
|
void _picker_created();
|
2021-01-09 13:17:33 +00:00
|
|
|
void _picker_opening();
|
|
|
|
|
|
|
|
Color last_color;
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2022-05-17 20:44:15 +00:00
|
|
|
void _notification(int p_what);
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2018-05-15 20:12:35 +00:00
|
|
|
void setup(bool p_show_alpha);
|
|
|
|
EditorPropertyColor();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyNodePath : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyNodePath, EditorProperty);
|
2022-04-04 13:06:57 +00:00
|
|
|
Button *assign = nullptr;
|
|
|
|
Button *clear = nullptr;
|
|
|
|
SceneTreeDialog *scene_tree = nullptr;
|
2018-05-15 20:12:35 +00:00
|
|
|
NodePath base_hint;
|
2022-02-15 14:56:58 +00:00
|
|
|
bool use_path_from_scene_root = false;
|
2023-05-19 12:03:01 +00:00
|
|
|
bool editing_node = false;
|
2018-05-15 20:12:35 +00:00
|
|
|
|
2018-06-27 23:50:25 +00:00
|
|
|
Vector<StringName> valid_types;
|
2018-05-15 20:12:35 +00:00
|
|
|
void _node_selected(const NodePath &p_path);
|
|
|
|
void _node_assign();
|
|
|
|
void _node_clear();
|
2023-05-19 12:03:01 +00:00
|
|
|
Node *get_base_node();
|
2018-05-15 20:12:35 +00:00
|
|
|
|
2021-12-09 17:50:57 +00: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;
|
|
|
|
|
2022-06-18 22:42:02 +00:00
|
|
|
virtual Variant _get_cache_value(const StringName &p_prop, bool &r_valid) const override;
|
|
|
|
|
2018-05-15 20:12:35 +00:00
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-15 20:12:35 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
void _notification(int p_what);
|
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2023-05-19 12:03:01 +00:00
|
|
|
void setup(const NodePath &p_base_hint, Vector<StringName> p_valid_types, bool p_use_path_from_scene_root = true, bool p_editing_node = false);
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorPropertyNodePath();
|
|
|
|
};
|
|
|
|
|
2019-01-13 14:43:25 +00:00
|
|
|
class EditorPropertyRID : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyRID, EditorProperty);
|
2022-04-04 13:06:57 +00:00
|
|
|
Label *label = nullptr;
|
2019-01-13 14:43:25 +00:00
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2019-01-13 14:43:25 +00:00
|
|
|
EditorPropertyRID();
|
|
|
|
};
|
|
|
|
|
2018-05-15 20:12:35 +00:00
|
|
|
class EditorPropertyResource : public EditorProperty {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorPropertyResource, EditorProperty);
|
2018-05-15 20:12:35 +00:00
|
|
|
|
2021-05-19 12:19:07 +00:00
|
|
|
EditorResourcePicker *resource_picker = nullptr;
|
|
|
|
SceneTreeDialog *scene_tree = nullptr;
|
2018-05-15 20:12:35 +00:00
|
|
|
|
2021-05-19 12:19:07 +00: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-15 20:12:35 +00:00
|
|
|
|
2022-04-29 06:06:48 +00:00
|
|
|
void _resource_selected(const Ref<Resource> &p_resource, bool p_inspect);
|
2022-05-02 23:43:50 +00:00
|
|
|
void _resource_changed(const Ref<Resource> &p_resource);
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
void _viewport_selected(const NodePath &p_path);
|
|
|
|
|
2021-12-03 15:23:32 +00:00
|
|
|
void _sub_inspector_property_keyed(const String &p_property, const Variant &p_value, bool p_advance);
|
2022-05-02 23:43:50 +00:00
|
|
|
void _sub_inspector_resource_selected(const Ref<Resource> &p_resource, const String &p_property);
|
2018-05-17 21:02:16 +00:00
|
|
|
void _sub_inspector_object_id_selected(int p_id);
|
|
|
|
|
2018-06-19 01:10:48 +00:00
|
|
|
void _open_editor_pressed();
|
2021-02-11 21:01:56 +00:00
|
|
|
void _update_property_bg();
|
2021-09-17 14:35:24 +00:00
|
|
|
void _update_preferred_shader();
|
2021-02-11 21:01:56 +00:00
|
|
|
|
2018-05-15 20:12:35 +00:00
|
|
|
protected:
|
2021-08-16 02:42:24 +00:00
|
|
|
virtual void _set_read_only(bool p_read_only) override;
|
2018-05-15 20:12:35 +00:00
|
|
|
void _notification(int p_what);
|
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void update_property() override;
|
2021-05-19 12:19:07 +00:00
|
|
|
void setup(Object *p_object, const String &p_path, const String &p_base_type);
|
2018-05-17 21:02:16 +00:00
|
|
|
|
2020-07-10 10:34:39 +00:00
|
|
|
void collapse_all_folding() override;
|
|
|
|
void expand_all_folding() override;
|
2022-07-30 13:12:51 +00:00
|
|
|
void expand_revertable() override;
|
2018-05-17 21:02:16 +00:00
|
|
|
|
2018-07-14 21:15:42 +00:00
|
|
|
void set_use_sub_inspector(bool p_enable);
|
2023-01-21 21:49:06 +00:00
|
|
|
void fold_resource();
|
2018-07-14 21:15:42 +00:00
|
|
|
|
2018-05-15 20:12:35 +00:00
|
|
|
EditorPropertyResource();
|
|
|
|
};
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////
|
|
|
|
/// \brief The EditorInspectorDefaultPlugin class
|
|
|
|
///
|
|
|
|
class EditorInspectorDefaultPlugin : public EditorInspectorPlugin {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorInspectorDefaultPlugin, EditorInspectorPlugin);
|
2018-05-15 20:12:35 +00:00
|
|
|
|
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual bool can_handle(Object *p_object) override;
|
2023-01-31 18:08:46 +00: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 BitField<PropertyUsageFlags> p_usage, const bool p_wide = false) override;
|
2021-06-09 18:01:08 +00:00
|
|
|
|
2023-01-31 18:08:46 +00: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 BitField<PropertyUsageFlags> p_usage, const bool p_wide = false);
|
2018-05-15 20:12:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // EDITOR_PROPERTIES_H
|