2018-05-16 19:19:33 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* editor_properties.h */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/*************************************************************************/
|
2020-01-01 11:16:22 +01:00
|
|
|
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
|
2018-05-16 19:19:33 +02: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-15 22:12:35 +02:00
|
|
|
#ifndef EDITOR_PROPERTIES_H
|
|
|
|
#define EDITOR_PROPERTIES_H
|
|
|
|
|
|
|
|
#include "editor/create_dialog.h"
|
|
|
|
#include "editor/editor_inspector.h"
|
|
|
|
#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 13:30:00 +01:00
|
|
|
#include "scene/gui/line_edit.h"
|
2018-05-15 22:12:35 +02:00
|
|
|
|
2018-05-19 21:09:38 +02:00
|
|
|
class EditorPropertyNil : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyNil, EditorProperty);
|
2018-05-19 21:09:38 +02:00
|
|
|
LineEdit *text;
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-19 21:09:38 +02:00
|
|
|
EditorPropertyNil();
|
|
|
|
};
|
|
|
|
|
2018-05-15 22:12:35 +02:00
|
|
|
class EditorPropertyText : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyText, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
LineEdit *text;
|
|
|
|
|
|
|
|
bool updating;
|
2020-02-20 22:58:05 +01:00
|
|
|
bool string_name;
|
2018-05-15 22:12:35 +02:00
|
|
|
void _text_changed(const String &p_string);
|
2018-07-24 02:42:31 +02:00
|
|
|
void _text_entered(const String &p_string);
|
2018-05-15 22:12:35 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-02-20 22:58:05 +01:00
|
|
|
void set_string_name(bool p_enabled);
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-08-17 03:50:12 +02:00
|
|
|
void set_placeholder(const String &p_string);
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorPropertyText();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyMultilineText : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyMultilineText, EditorProperty);
|
2018-05-15 22:12:35 +02: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:
|
|
|
|
void _notification(int p_what);
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorPropertyMultilineText();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyTextEnum : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyTextEnum, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
OptionButton *options;
|
|
|
|
|
|
|
|
void _option_selected(int p_which);
|
2020-02-20 22:58:05 +01:00
|
|
|
bool string_name;
|
2018-05-15 22:12:35 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-02-20 22:58:05 +01:00
|
|
|
void setup(const Vector<String> &p_options, bool p_string_name = false);
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorPropertyTextEnum();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyPath : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyPath, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
Vector<String> extensions;
|
|
|
|
bool folder;
|
|
|
|
bool global;
|
2018-11-12 20:04:58 +01:00
|
|
|
bool save_mode;
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorFileDialog *dialog;
|
2018-08-23 16:44:36 +02:00
|
|
|
LineEdit *path;
|
|
|
|
Button *path_edit;
|
2018-05-15 22:12:35 +02:00
|
|
|
|
|
|
|
void _path_selected(const String &p_path);
|
|
|
|
void _path_pressed();
|
2018-08-23 16:44:36 +02:00
|
|
|
void _path_focus_exited();
|
2018-05-15 22:12:35 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
2018-08-23 16:44:36 +02:00
|
|
|
void _notification(int p_what);
|
2018-05-15 22:12:35 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
void setup(const Vector<String> &p_extensions, bool p_folder, bool p_global);
|
2018-11-12 20:04:58 +01:00
|
|
|
void set_save_mode();
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorPropertyPath();
|
|
|
|
};
|
|
|
|
|
2018-07-19 06:58:40 +02:00
|
|
|
class EditorPropertyClassName : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyClassName, EditorProperty);
|
|
|
|
|
2018-07-19 06:58:40 +02:00
|
|
|
private:
|
|
|
|
CreateDialog *dialog;
|
|
|
|
Button *property;
|
|
|
|
String selected_type;
|
|
|
|
String base_type;
|
|
|
|
void _property_selected();
|
|
|
|
void _dialog_created();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setup(const String &p_base_type, const String &p_selected_type);
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-07-19 06:58:40 +02:00
|
|
|
EditorPropertyClassName();
|
|
|
|
};
|
|
|
|
|
2018-05-15 22:12:35 +02:00
|
|
|
class EditorPropertyMember : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyMember, EditorProperty);
|
|
|
|
|
2018-05-15 22:12:35 +02: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:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setup(Type p_hint, const String &p_hint_text);
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorPropertyMember();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyCheck : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyCheck, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
CheckBox *checkbox;
|
|
|
|
|
|
|
|
void _checkbox_pressed();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorPropertyCheck();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyEnum : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyEnum, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
OptionButton *options;
|
|
|
|
|
|
|
|
void _option_selected(int p_which);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setup(const Vector<String> &p_options);
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-07-14 23:15:42 +02:00
|
|
|
void set_option_button_clip(bool p_enable);
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorPropertyEnum();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyFlags : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyFlags, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
VBoxContainer *vbox;
|
|
|
|
Vector<CheckBox *> flags;
|
|
|
|
Vector<int> flag_indices;
|
|
|
|
|
|
|
|
void _flag_toggled();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setup(const Vector<String> &p_options);
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorPropertyFlags();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyLayersGrid;
|
|
|
|
|
|
|
|
class EditorPropertyLayers : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyLayers, EditorProperty);
|
|
|
|
|
2018-05-15 22:12:35 +02:00
|
|
|
public:
|
|
|
|
enum LayerType {
|
|
|
|
LAYER_PHYSICS_2D,
|
|
|
|
LAYER_RENDER_2D,
|
|
|
|
LAYER_PHYSICS_3D,
|
|
|
|
LAYER_RENDER_3D,
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
EditorPropertyLayersGrid *grid;
|
|
|
|
void _grid_changed(uint32_t p_grid);
|
|
|
|
LayerType layer_type;
|
|
|
|
PopupMenu *layers;
|
|
|
|
Button *button;
|
|
|
|
|
|
|
|
void _button_pressed();
|
|
|
|
void _menu_pressed(int p_menu);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
|
|
|
void setup(LayerType p_layer_type);
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorPropertyLayers();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyInteger : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyInteger, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorSpinSlider *spin;
|
|
|
|
bool setting;
|
2020-01-16 02:37:08 +01:00
|
|
|
void _value_changed(int64_t p_val);
|
2018-05-15 22:12:35 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2020-01-16 02:37:08 +01: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-15 22:12:35 +02:00
|
|
|
EditorPropertyInteger();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyObjectID : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyObjectID, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
Button *edit;
|
|
|
|
String base_type;
|
|
|
|
void _edit_pressed();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-15 22:12:35 +02:00
|
|
|
void setup(const String &p_base_type);
|
|
|
|
EditorPropertyObjectID();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyFloat : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyFloat, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorSpinSlider *spin;
|
|
|
|
bool setting;
|
|
|
|
void _value_changed(double p_val);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-16 14:13:41 +02: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);
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorPropertyFloat();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyEasing : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyEasing, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
Control *easing_draw;
|
2018-07-19 00:37:17 +02:00
|
|
|
PopupMenu *preset;
|
2018-12-04 13:30:00 +01:00
|
|
|
EditorSpinSlider *spin;
|
|
|
|
bool setting;
|
|
|
|
|
2019-09-06 16:04:07 +02:00
|
|
|
bool dragging;
|
2018-07-19 00:37:17 +02:00
|
|
|
bool full;
|
2018-12-04 13:30:00 +01:00
|
|
|
bool flip;
|
2018-07-19 00:37:17 +02:00
|
|
|
|
|
|
|
enum {
|
|
|
|
EASING_ZERO,
|
|
|
|
EASING_LINEAR,
|
|
|
|
EASING_IN,
|
|
|
|
EASING_OUT,
|
|
|
|
EASING_IN_OUT,
|
|
|
|
EASING_OUT_IN,
|
|
|
|
EASING_MAX
|
|
|
|
|
|
|
|
};
|
2018-05-15 22:12:35 +02:00
|
|
|
|
|
|
|
void _drag_easing(const Ref<InputEvent> &p_ev);
|
|
|
|
void _draw_easing();
|
2018-07-19 00:37:17 +02:00
|
|
|
void _set_preset(int);
|
2018-05-15 22:12:35 +02:00
|
|
|
|
2018-12-04 13:30:00 +01:00
|
|
|
void _setup_spin();
|
|
|
|
void _spin_value_changed(double p_value);
|
|
|
|
void _spin_focus_exited();
|
|
|
|
|
|
|
|
void _notification(int p_what);
|
|
|
|
|
2018-05-15 22:12:35 +02:00
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-15 22:12:35 +02:00
|
|
|
void setup(bool p_full, bool p_flip);
|
|
|
|
EditorPropertyEasing();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyVector2 : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyVector2, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorSpinSlider *spin[2];
|
|
|
|
bool setting;
|
2018-09-02 19:16:33 +02:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-15 22:12:35 +02:00
|
|
|
|
|
|
|
protected:
|
2018-07-19 03:27:39 +02:00
|
|
|
void _notification(int p_what);
|
2018-05-15 22:12:35 +02:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-15 22:12:35 +02:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_no_slider);
|
2020-04-17 04:52:00 +02:00
|
|
|
EditorPropertyVector2(bool p_force_wide = false);
|
2018-05-15 22:12:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyRect2 : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyRect2, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorSpinSlider *spin[4];
|
|
|
|
bool setting;
|
2018-09-02 19:16:33 +02:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-15 22:12:35 +02:00
|
|
|
|
|
|
|
protected:
|
2018-07-19 03:27:39 +02:00
|
|
|
void _notification(int p_what);
|
2018-05-15 22:12:35 +02:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-15 22:12:35 +02:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_no_slider);
|
2020-04-17 04:52:00 +02:00
|
|
|
EditorPropertyRect2(bool p_force_wide = false);
|
2018-05-15 22:12:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyVector3 : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyVector3, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorSpinSlider *spin[3];
|
|
|
|
bool setting;
|
2018-09-02 19:16:33 +02:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-15 22:12:35 +02:00
|
|
|
|
|
|
|
protected:
|
2018-07-19 03:27:39 +02:00
|
|
|
void _notification(int p_what);
|
2018-05-15 22:12:35 +02:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2020-05-26 20:17:11 +02:00
|
|
|
virtual void update_using_vector(Vector3 p_vector);
|
|
|
|
virtual Vector3 get_vector();
|
2018-05-15 22:12:35 +02:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_no_slider);
|
2020-04-17 04:52:00 +02: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:
|
|
|
|
void _notification(int p_what);
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2020-04-17 04:52:00 +02:00
|
|
|
void setup(int p_min, int p_max, bool p_no_slider);
|
|
|
|
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:
|
|
|
|
void _notification(int p_what);
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2020-04-17 04:52:00 +02:00
|
|
|
void setup(int p_min, int p_max, bool p_no_slider);
|
|
|
|
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:
|
|
|
|
void _notification(int p_what);
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2020-04-17 04:52:00 +02:00
|
|
|
void setup(int p_min, int p_max, bool p_no_slider);
|
|
|
|
EditorPropertyVector3i(bool p_force_wide = false);
|
2018-05-15 22:12:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyPlane : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyPlane, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorSpinSlider *spin[4];
|
|
|
|
bool setting;
|
2018-09-02 19:16:33 +02:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-15 22:12:35 +02:00
|
|
|
|
|
|
|
protected:
|
2018-07-19 03:27:39 +02:00
|
|
|
void _notification(int p_what);
|
2018-05-15 22:12:35 +02:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-15 22:12:35 +02:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_no_slider);
|
2020-04-17 04:52:00 +02:00
|
|
|
EditorPropertyPlane(bool p_force_wide = false);
|
2018-05-15 22:12:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyQuat : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyQuat, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorSpinSlider *spin[4];
|
|
|
|
bool setting;
|
2018-09-02 19:16:33 +02:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-15 22:12:35 +02:00
|
|
|
|
|
|
|
protected:
|
2018-07-19 03:27:39 +02:00
|
|
|
void _notification(int p_what);
|
2018-05-15 22:12:35 +02:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-15 22:12:35 +02:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_no_slider);
|
|
|
|
EditorPropertyQuat();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyAABB : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyAABB, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorSpinSlider *spin[6];
|
|
|
|
bool setting;
|
2018-09-02 19:16:33 +02:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-15 22:12:35 +02:00
|
|
|
|
|
|
|
protected:
|
2018-07-19 03:27:39 +02:00
|
|
|
void _notification(int p_what);
|
2018-05-15 22:12:35 +02:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-15 22:12:35 +02:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_no_slider);
|
|
|
|
EditorPropertyAABB();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyTransform2D : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyTransform2D, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorSpinSlider *spin[6];
|
|
|
|
bool setting;
|
2018-09-02 19:16:33 +02:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-15 22:12:35 +02:00
|
|
|
|
|
|
|
protected:
|
2018-07-19 03:27:39 +02:00
|
|
|
void _notification(int p_what);
|
2018-05-15 22:12:35 +02:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-15 22:12:35 +02:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_no_slider);
|
|
|
|
EditorPropertyTransform2D();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyBasis : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyBasis, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorSpinSlider *spin[9];
|
|
|
|
bool setting;
|
2018-09-02 19:16:33 +02:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-15 22:12:35 +02:00
|
|
|
|
|
|
|
protected:
|
2018-07-19 03:27:39 +02:00
|
|
|
void _notification(int p_what);
|
2018-05-15 22:12:35 +02:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-15 22:12:35 +02:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_no_slider);
|
|
|
|
EditorPropertyBasis();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyTransform : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyTransform, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorSpinSlider *spin[12];
|
|
|
|
bool setting;
|
2018-09-02 19:16:33 +02:00
|
|
|
void _value_changed(double p_val, const String &p_name);
|
2018-05-15 22:12:35 +02:00
|
|
|
|
|
|
|
protected:
|
2018-07-19 03:27:39 +02:00
|
|
|
void _notification(int p_what);
|
2018-05-15 22:12:35 +02:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2020-05-26 20:17:11 +02:00
|
|
|
virtual void update_using_transform(Transform p_transform);
|
2018-05-15 22:12:35 +02:00
|
|
|
void setup(double p_min, double p_max, double p_step, bool p_no_slider);
|
|
|
|
EditorPropertyTransform();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyColor : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyColor, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
ColorPickerButton *picker;
|
|
|
|
void _color_changed(const Color &p_color);
|
2018-08-18 17:10:23 +02:00
|
|
|
void _popup_closed();
|
2019-08-30 22:25:15 +02:00
|
|
|
void _picker_created();
|
2018-05-15 22:12:35 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-15 22:12:35 +02:00
|
|
|
void setup(bool p_show_alpha);
|
|
|
|
EditorPropertyColor();
|
|
|
|
};
|
|
|
|
|
|
|
|
class EditorPropertyNodePath : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyNodePath, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
Button *assign;
|
|
|
|
Button *clear;
|
|
|
|
SceneTreeDialog *scene_tree;
|
|
|
|
NodePath base_hint;
|
2019-01-14 19:52:43 +01:00
|
|
|
bool use_path_from_scene_root;
|
2018-05-15 22:12:35 +02:00
|
|
|
|
2018-06-28 01:50:25 +02:00
|
|
|
Vector<StringName> valid_types;
|
2018-05-15 22:12:35 +02:00
|
|
|
void _node_selected(const NodePath &p_path);
|
|
|
|
void _node_assign();
|
|
|
|
void _node_clear();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
void _notification(int p_what);
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2019-01-14 19:52:43 +01:00
|
|
|
void setup(const NodePath &p_base_hint, Vector<StringName> p_valid_types, bool p_use_path_from_scene_root = true);
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorPropertyNodePath();
|
|
|
|
};
|
|
|
|
|
2019-01-13 15:43:25 +01:00
|
|
|
class EditorPropertyRID : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyRID, EditorProperty);
|
2019-01-13 15:43:25 +01:00
|
|
|
Label *label;
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2019-01-13 15:43:25 +01:00
|
|
|
EditorPropertyRID();
|
|
|
|
};
|
|
|
|
|
2018-05-15 22:12:35 +02:00
|
|
|
class EditorPropertyResource : public EditorProperty {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorPropertyResource, EditorProperty);
|
2018-05-15 22:12:35 +02:00
|
|
|
|
|
|
|
enum MenuOption {
|
|
|
|
|
|
|
|
OBJ_MENU_LOAD = 0,
|
|
|
|
OBJ_MENU_EDIT = 1,
|
|
|
|
OBJ_MENU_CLEAR = 2,
|
|
|
|
OBJ_MENU_MAKE_UNIQUE = 3,
|
2018-11-18 15:17:04 +01:00
|
|
|
OBJ_MENU_SAVE = 4,
|
|
|
|
OBJ_MENU_COPY = 5,
|
|
|
|
OBJ_MENU_PASTE = 6,
|
|
|
|
OBJ_MENU_NEW_SCRIPT = 7,
|
2019-10-21 06:57:10 +02:00
|
|
|
OBJ_MENU_EXTEND_SCRIPT = 8,
|
|
|
|
OBJ_MENU_SHOW_IN_FILE_SYSTEM = 9,
|
2018-05-15 22:12:35 +02:00
|
|
|
TYPE_BASE_ID = 100,
|
|
|
|
CONVERT_BASE_ID = 1000
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
Button *assign;
|
2018-07-17 11:43:42 +02:00
|
|
|
TextureRect *preview;
|
2018-05-15 22:12:35 +02:00
|
|
|
Button *edit;
|
|
|
|
PopupMenu *menu;
|
|
|
|
EditorFileDialog *file;
|
|
|
|
Vector<String> inheritors_array;
|
2018-05-17 23:02:16 +02:00
|
|
|
EditorInspector *sub_inspector;
|
2018-06-19 03:10:48 +02:00
|
|
|
VBoxContainer *sub_inspector_vbox;
|
2018-05-15 22:12:35 +02:00
|
|
|
|
2018-05-17 23:02:16 +02:00
|
|
|
bool use_sub_inspector;
|
2018-05-18 00:41:25 +02:00
|
|
|
bool dropping;
|
2018-05-15 22:12:35 +02:00
|
|
|
String base_type;
|
|
|
|
|
|
|
|
SceneTreeDialog *scene_tree;
|
|
|
|
|
|
|
|
void _file_selected(const String &p_path);
|
|
|
|
void _menu_option(int p_which);
|
2019-06-11 20:43:37 +02:00
|
|
|
void _resource_preview(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, ObjectID p_obj);
|
2018-05-15 22:12:35 +02:00
|
|
|
void _resource_selected();
|
|
|
|
void _viewport_selected(const NodePath &p_path);
|
|
|
|
|
2018-11-19 01:28:28 +01:00
|
|
|
void _update_menu_items();
|
|
|
|
|
2018-05-15 22:12:35 +02:00
|
|
|
void _update_menu();
|
|
|
|
|
2018-05-17 23:02:16 +02:00
|
|
|
void _sub_inspector_property_keyed(const String &p_property, const Variant &p_value, bool);
|
|
|
|
void _sub_inspector_resource_selected(const RES &p_resource, const String &p_property);
|
|
|
|
void _sub_inspector_object_id_selected(int p_id);
|
|
|
|
|
2018-05-18 00:41:25 +02:00
|
|
|
void _button_draw();
|
|
|
|
Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
|
|
|
|
bool _is_drop_valid(const Dictionary &p_drag_data) const;
|
|
|
|
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);
|
|
|
|
|
2018-11-19 01:28:28 +01:00
|
|
|
void _button_input(const Ref<InputEvent> &p_event);
|
2018-06-19 03:10:48 +02:00
|
|
|
void _open_editor_pressed();
|
2019-03-04 20:44:39 +01:00
|
|
|
void _fold_other_editors(Object *p_self);
|
|
|
|
|
|
|
|
bool opened_editor;
|
2018-06-19 03:10:48 +02:00
|
|
|
|
2018-05-15 22:12:35 +02:00
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
void _notification(int p_what);
|
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual void update_property() override;
|
2018-05-15 22:12:35 +02:00
|
|
|
void setup(const String &p_base_type);
|
2018-05-17 23:02:16 +02:00
|
|
|
|
2020-07-10 12:34:39 +02:00
|
|
|
void collapse_all_folding() override;
|
|
|
|
void expand_all_folding() override;
|
2018-05-17 23:02:16 +02:00
|
|
|
|
2018-07-14 23:15:42 +02:00
|
|
|
void set_use_sub_inspector(bool p_enable);
|
|
|
|
|
2018-05-15 22:12:35 +02:00
|
|
|
EditorPropertyResource();
|
|
|
|
};
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////
|
|
|
|
/// \brief The EditorInspectorDefaultPlugin class
|
|
|
|
///
|
|
|
|
class EditorInspectorDefaultPlugin : public EditorInspectorPlugin {
|
2019-03-19 19:35:57 +01:00
|
|
|
GDCLASS(EditorInspectorDefaultPlugin, EditorInspectorPlugin);
|
2018-05-15 22:12:35 +02:00
|
|
|
|
|
|
|
public:
|
2020-07-10 12:34:39 +02:00
|
|
|
virtual bool can_handle(Object *p_object) override;
|
|
|
|
virtual void parse_begin(Object *p_object) override;
|
|
|
|
virtual bool parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide = false) override;
|
|
|
|
virtual void parse_end() override;
|
2018-05-15 22:12:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // EDITOR_PROPERTIES_H
|