2017-11-24 07:09:51 +01:00
|
|
|
/*************************************************************************/
|
2014-02-10 02:10:30 +01:00
|
|
|
/* property_editor.h */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 14:16:55 +02:00
|
|
|
/* https://godotengine.org */
|
2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
2017-01-01 22:01:57 +01:00
|
|
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
2017-04-08 00:11:42 +02:00
|
|
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
2014-02-10 02:10:30 +01: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. */
|
|
|
|
/*************************************************************************/
|
|
|
|
#ifndef PROPERTY_EDITOR_H
|
|
|
|
#define PROPERTY_EDITOR_H
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "editor/editor_file_dialog.h"
|
2017-08-26 17:46:49 +02:00
|
|
|
#include "editor/scene_tree_editor.h"
|
2014-02-10 02:10:30 +01:00
|
|
|
#include "scene/gui/button.h"
|
2016-05-03 23:20:09 +02:00
|
|
|
#include "scene/gui/check_box.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "scene/gui/check_button.h"
|
2014-02-10 02:10:30 +01:00
|
|
|
#include "scene/gui/color_picker.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "scene/gui/dialogs.h"
|
|
|
|
#include "scene/gui/grid_container.h"
|
|
|
|
#include "scene/gui/label.h"
|
2014-02-10 02:10:30 +01:00
|
|
|
#include "scene/gui/menu_button.h"
|
2016-01-23 15:20:54 +01:00
|
|
|
#include "scene/gui/split_container.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "scene/gui/text_edit.h"
|
|
|
|
#include "scene/gui/texture_rect.h"
|
|
|
|
#include "scene/gui/tree.h"
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
@author Juan Linietsky <reduzio@gmail.com>
|
|
|
|
*/
|
|
|
|
|
2016-05-01 10:33:32 +02:00
|
|
|
class PropertyValueEvaluator;
|
2016-08-03 16:28:20 +02:00
|
|
|
class CreateDialog;
|
2016-08-24 00:29:07 +02:00
|
|
|
class PropertySelector;
|
|
|
|
|
2017-09-22 14:20:28 +02:00
|
|
|
class EditorResourceConversionPlugin : public Reference {
|
|
|
|
|
|
|
|
GDCLASS(EditorResourceConversionPlugin, Reference)
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual String converts_to() const;
|
|
|
|
virtual bool handles(const Ref<Resource> &p_resource) const;
|
|
|
|
virtual Ref<Resource> convert(const Ref<Resource> &p_resource);
|
|
|
|
};
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
class CustomPropertyEditor : public Popup {
|
2015-08-30 02:09:11 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(CustomPropertyEditor, Popup);
|
2015-08-30 02:09:11 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
enum {
|
2017-03-05 16:44:50 +01:00
|
|
|
MAX_VALUE_EDITORS = 12,
|
|
|
|
MAX_ACTION_BUTTONS = 5,
|
|
|
|
OBJ_MENU_LOAD = 0,
|
|
|
|
OBJ_MENU_EDIT = 1,
|
|
|
|
OBJ_MENU_CLEAR = 2,
|
|
|
|
OBJ_MENU_MAKE_UNIQUE = 3,
|
|
|
|
OBJ_MENU_COPY = 4,
|
|
|
|
OBJ_MENU_PASTE = 5,
|
2017-08-26 17:46:49 +02:00
|
|
|
OBJ_MENU_NEW_SCRIPT = 6,
|
|
|
|
OBJ_MENU_SHOW_IN_FILE_SYSTEM = 7,
|
2017-09-22 14:20:28 +02:00
|
|
|
TYPE_BASE_ID = 100,
|
|
|
|
CONVERT_BASE_ID = 1000
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
EASING_LINEAR,
|
|
|
|
EASING_EASE_IN,
|
|
|
|
EASING_EASE_OUT,
|
|
|
|
EASING_ZERO,
|
|
|
|
EASING_IN_OUT,
|
|
|
|
EASING_OUT_IN
|
|
|
|
};
|
|
|
|
|
|
|
|
PopupMenu *menu;
|
|
|
|
SceneTreeDialog *scene_tree;
|
2015-06-06 14:44:38 +02:00
|
|
|
EditorFileDialog *file;
|
2014-02-10 02:10:30 +01:00
|
|
|
ConfirmationDialog *error;
|
|
|
|
String name;
|
|
|
|
Variant::Type type;
|
|
|
|
Variant v;
|
2017-03-02 10:42:05 +01:00
|
|
|
List<String> field_names;
|
2014-02-10 02:10:30 +01:00
|
|
|
int hint;
|
|
|
|
String hint_text;
|
|
|
|
LineEdit *value_editor[MAX_VALUE_EDITORS];
|
2017-03-02 10:42:05 +01:00
|
|
|
int focused_value_editor;
|
2014-02-10 02:10:30 +01:00
|
|
|
Label *value_label[MAX_VALUE_EDITORS];
|
2016-01-23 15:20:54 +01:00
|
|
|
HScrollBar *scroll[4];
|
2014-02-10 02:10:30 +01:00
|
|
|
Button *action_buttons[MAX_ACTION_BUTTONS];
|
|
|
|
MenuButton *type_button;
|
|
|
|
Vector<String> inheritors_array;
|
2017-01-12 22:27:27 +01:00
|
|
|
TextureRect *texture_preview;
|
2014-02-10 02:10:30 +01:00
|
|
|
ColorPicker *color_picker;
|
|
|
|
TextEdit *text_edit;
|
|
|
|
bool read_only;
|
2017-01-10 05:04:31 +01:00
|
|
|
bool picking_viewport;
|
2017-01-11 02:20:57 +01:00
|
|
|
GridContainer *checks20gc;
|
2016-05-03 23:20:09 +02:00
|
|
|
CheckBox *checks20[20];
|
2015-08-30 02:09:11 +02:00
|
|
|
SpinBox *spinbox;
|
|
|
|
HSlider *slider;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
Control *easing_draw;
|
2016-08-03 16:28:20 +02:00
|
|
|
CreateDialog *create_dialog;
|
2016-08-24 00:29:07 +02:00
|
|
|
PropertySelector *property_select;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Object *owner;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
bool updating;
|
|
|
|
|
2016-05-01 10:33:32 +02:00
|
|
|
PropertyValueEvaluator *evaluator;
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
void _text_edit_changed();
|
|
|
|
void _file_selected(String p_file);
|
|
|
|
void _modified(String p_string);
|
2015-08-30 02:09:11 +02:00
|
|
|
void _range_modified(double p_value);
|
2014-02-27 15:16:00 +01:00
|
|
|
void _focus_enter();
|
|
|
|
void _focus_exit();
|
2014-02-10 02:10:30 +01:00
|
|
|
void _action_pressed(int p_which);
|
|
|
|
void _type_create_selected(int p_idx);
|
2016-08-03 16:28:20 +02:00
|
|
|
void _create_dialog_callback();
|
2016-08-24 00:29:07 +02:00
|
|
|
void _create_selected_property(const String &p_prop);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void _color_changed(const Color &p_color);
|
2014-02-10 02:10:30 +01:00
|
|
|
void _draw_easing();
|
|
|
|
void _menu_option(int p_which);
|
2015-08-30 02:09:11 +02:00
|
|
|
|
2017-05-20 17:38:03 +02:00
|
|
|
void _drag_easing(const Ref<InputEvent> &p_ev);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
void _node_path_selected(NodePath p_path);
|
|
|
|
void show_value_editors(int p_amount);
|
2017-03-05 16:44:50 +01:00
|
|
|
void config_value_editors(int p_amount, int p_columns, int p_label_w, const List<String> &p_strings);
|
|
|
|
void config_action_buttons(const List<String> &p_strings);
|
2015-10-10 14:09:09 +02:00
|
|
|
|
2017-03-02 10:42:05 +01:00
|
|
|
void _emit_changed_whole_or_field();
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
protected:
|
|
|
|
void _notification(int p_what);
|
2015-08-30 02:09:11 +02:00
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
2016-05-11 16:46:08 +02:00
|
|
|
void hide_menu();
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
Variant get_variant() const;
|
|
|
|
String get_name() const;
|
2015-08-30 02:09:11 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_read_only(bool p_read_only) { read_only = p_read_only; }
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_value_evaluator(PropertyValueEvaluator *p_evaluator) { evaluator = p_evaluator; }
|
2016-05-01 10:33:32 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
bool edit(Object *p_owner, const String &p_name, Variant::Type p_type, const Variant &p_variant, int p_hint, String p_hint_text);
|
2015-08-30 02:09:11 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
CustomPropertyEditor();
|
|
|
|
};
|
|
|
|
|
|
|
|
class PropertyEditor : public Control {
|
2015-08-30 02:09:11 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(PropertyEditor, Control);
|
2015-08-30 02:09:11 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
Tree *tree;
|
|
|
|
Label *top_label;
|
2015-11-21 17:42:15 +01:00
|
|
|
LineEdit *search_box;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2016-05-01 10:33:32 +02:00
|
|
|
PropertyValueEvaluator *evaluator;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Object *obj;
|
2017-01-05 13:16:00 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
StringName _prop_edited;
|
|
|
|
|
|
|
|
bool capitalize_paths;
|
|
|
|
bool changing;
|
|
|
|
bool update_tree_pending;
|
|
|
|
bool autoclear;
|
|
|
|
bool keying;
|
|
|
|
bool read_only;
|
|
|
|
bool show_categories;
|
2015-12-11 13:37:34 +01:00
|
|
|
bool show_type_icons;
|
2015-01-03 19:39:01 +01:00
|
|
|
float refresh_countdown;
|
2015-08-26 04:00:11 +02:00
|
|
|
bool use_doc_hints;
|
2015-11-21 17:42:15 +01:00
|
|
|
bool use_filter;
|
2015-12-03 18:59:59 +01:00
|
|
|
bool subsection_selectable;
|
2017-02-01 13:45:45 +01:00
|
|
|
bool hide_script;
|
2017-06-25 22:30:28 +02:00
|
|
|
bool use_folding;
|
2017-07-19 22:00:46 +02:00
|
|
|
bool property_selectable;
|
2017-11-28 14:49:03 +01:00
|
|
|
bool is_expandall_enabled;
|
2017-06-25 22:30:28 +02:00
|
|
|
|
|
|
|
bool updating_folding;
|
2015-11-21 17:42:15 +01:00
|
|
|
|
2017-11-24 07:09:51 +01:00
|
|
|
enum FOLDING_BEHAVIOUR {
|
|
|
|
FB_UNDEFINED,
|
|
|
|
FB_COLLAPSEALL,
|
|
|
|
FB_EXPANDALL,
|
|
|
|
FB_EXPANDALL_FORCE
|
|
|
|
};
|
|
|
|
FOLDING_BEHAVIOUR folding_behaviour;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
HashMap<String, String> pending;
|
2014-02-10 02:10:30 +01:00
|
|
|
String selected_property;
|
2015-08-30 02:09:11 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Map<StringName, Map<StringName, String> > descr_cache;
|
|
|
|
Map<StringName, String> class_descr_cache;
|
2016-03-09 00:00:52 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
CustomPropertyEditor *custom_editor;
|
2015-08-30 02:09:11 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
void _resource_edit_request();
|
|
|
|
void _custom_editor_edited();
|
2017-03-05 16:44:50 +01:00
|
|
|
void _custom_editor_edited_field(const String &p_field_name);
|
2014-02-10 02:10:30 +01:00
|
|
|
void _custom_editor_request(bool p_arrow);
|
2015-08-30 02:09:11 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
void _item_selected();
|
2017-08-10 21:02:19 +02:00
|
|
|
void _item_rmb_edited();
|
2014-02-10 02:10:30 +01:00
|
|
|
void _item_edited();
|
2017-06-25 22:30:28 +02:00
|
|
|
TreeItem *get_parent_node(String p_path, HashMap<String, TreeItem *> &item_paths, TreeItem *root, TreeItem *category);
|
2015-08-30 02:09:11 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_item_text(TreeItem *p_item, int p_type, const String &p_name, int p_hint = PROPERTY_HINT_NONE, const String &p_hint_text = "");
|
2015-08-30 02:09:11 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
TreeItem *find_item(TreeItem *p_item, const String &p_name);
|
2015-08-30 02:09:11 +02:00
|
|
|
|
2017-08-12 18:52:50 +02:00
|
|
|
virtual void _changed_callback(Object *p_changed, const char *p_prop);
|
|
|
|
virtual void _changed_callbacks(Object *p_changed, const String &p_prop);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void _check_reload_status(const String &p_name, TreeItem *item);
|
2015-10-10 14:09:09 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
void _edit_button(Object *p_item, int p_column, int p_button);
|
2015-08-30 02:09:11 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
void _node_removed(Node *p_node);
|
2016-11-26 15:30:46 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
friend class ProjectExportDialog;
|
|
|
|
void _edit_set(const String &p_name, const Variant &p_value, bool p_refresh_all = false, const String &p_changed_field = "");
|
2017-08-12 18:52:50 +02:00
|
|
|
void _draw_flags(Object *p_object, const Rect2 &p_rect);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2015-10-10 14:09:09 +02:00
|
|
|
bool _might_be_in_instance();
|
2017-03-05 16:44:50 +01:00
|
|
|
bool _get_instanced_node_original_property(const StringName &p_prop, Variant &value);
|
|
|
|
bool _is_property_different(const Variant &p_current, const Variant &p_orig, int p_usage = 0);
|
2015-10-10 14:09:09 +02:00
|
|
|
|
2015-01-03 19:39:01 +01:00
|
|
|
void _refresh_item(TreeItem *p_item);
|
2015-05-25 06:46:45 +02:00
|
|
|
void _set_range_def(Object *p_item, String prop, float p_frame);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void _filter_changed(const String &p_text);
|
2015-11-21 17:42:15 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void _mark_drop_fields(TreeItem *p_at);
|
|
|
|
void _clear_drop_fields(TreeItem *p_at);
|
2016-05-11 16:46:08 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
bool _is_drop_valid(const Dictionary &p_drag_data, const Dictionary &p_item_data) const;
|
|
|
|
Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
|
|
|
|
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);
|
2016-05-11 16:46:08 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void _resource_preview_done(const String &p_path, const Ref<Texture> &p_preview, Variant p_ud);
|
|
|
|
void _draw_transparency(Object *t, const Rect2 &p_rect);
|
2017-06-25 22:30:28 +02:00
|
|
|
void _item_folded(Object *item_obj);
|
2016-05-11 16:46:08 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
UndoRedo *undo_redo;
|
2015-08-30 02:09:11 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
protected:
|
2014-02-10 02:10:30 +01:00
|
|
|
void _notification(int p_what);
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
public:
|
|
|
|
void set_undo_redo(UndoRedo *p_undo_redo) { undo_redo = p_undo_redo; }
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
String get_selected_path() const;
|
|
|
|
|
2014-11-06 01:20:42 +01:00
|
|
|
Tree *get_scene_tree();
|
2017-03-05 16:44:50 +01:00
|
|
|
Label *get_top_label();
|
2014-02-10 02:10:30 +01:00
|
|
|
void hide_top_label();
|
|
|
|
void update_tree();
|
2017-03-05 16:44:50 +01:00
|
|
|
void update_property(const String &p_prop);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2015-01-03 19:39:01 +01:00
|
|
|
void refresh();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void edit(Object *p_object);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
void set_keying(bool p_active);
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_read_only(bool p_read_only) {
|
|
|
|
read_only = p_read_only;
|
|
|
|
custom_editor->set_read_only(p_read_only);
|
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-04-26 13:41:41 +02:00
|
|
|
bool is_capitalize_paths_enabled() const;
|
|
|
|
void set_enable_capitalize_paths(bool p_capitalize);
|
2014-02-10 02:10:30 +01:00
|
|
|
void set_autoclear(bool p_enable);
|
|
|
|
|
|
|
|
void set_show_categories(bool p_show);
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_use_doc_hints(bool p_enable) { use_doc_hints = p_enable; }
|
|
|
|
void set_hide_script(bool p_hide) { hide_script = p_hide; }
|
2015-11-21 17:42:15 +01:00
|
|
|
|
|
|
|
void set_use_filter(bool p_use);
|
|
|
|
void register_text_enter(Node *p_line_edit);
|
|
|
|
|
2015-12-03 18:59:59 +01:00
|
|
|
void set_subsection_selectable(bool p_selectable);
|
2017-07-19 22:00:46 +02:00
|
|
|
void set_property_selectable(bool p_selectable);
|
2015-12-03 18:59:59 +01:00
|
|
|
|
2017-06-25 22:30:28 +02:00
|
|
|
void set_use_folding(bool p_enable);
|
2017-11-24 07:09:51 +01:00
|
|
|
|
|
|
|
bool is_expand_all_properties_enabled() const;
|
|
|
|
|
|
|
|
void collapse_all_parent_nodes();
|
|
|
|
void expand_all_parent_nodes();
|
2016-03-09 00:00:52 +01:00
|
|
|
PropertyEditor();
|
2014-02-10 02:10:30 +01:00
|
|
|
~PropertyEditor();
|
|
|
|
};
|
|
|
|
|
2015-12-16 03:39:36 +01:00
|
|
|
class SectionedPropertyEditorFilter;
|
|
|
|
|
|
|
|
class SectionedPropertyEditor : public HBoxContainer {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(SectionedPropertyEditor, HBoxContainer);
|
2016-03-06 15:22:21 +01:00
|
|
|
|
|
|
|
ObjectID obj;
|
|
|
|
|
2017-01-05 13:16:00 +01:00
|
|
|
Tree *sections;
|
2015-12-16 03:39:36 +01:00
|
|
|
SectionedPropertyEditorFilter *filter;
|
2017-01-05 13:16:00 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Map<String, TreeItem *> section_map;
|
2015-12-16 03:39:36 +01:00
|
|
|
PropertyEditor *editor;
|
2017-07-18 02:05:38 +02:00
|
|
|
LineEdit *search_box;
|
2015-12-16 03:39:36 +01:00
|
|
|
|
2016-01-11 13:41:26 +01:00
|
|
|
static void _bind_methods();
|
2017-01-05 13:16:00 +01:00
|
|
|
void _section_selected();
|
2016-01-23 20:05:27 +01:00
|
|
|
|
2017-07-18 02:05:38 +02:00
|
|
|
void _search_changed(const String &p_what);
|
|
|
|
|
2015-12-16 03:39:36 +01:00
|
|
|
public:
|
2017-07-18 02:05:38 +02:00
|
|
|
void register_search_box(LineEdit *p_box);
|
2015-12-16 03:39:36 +01:00
|
|
|
PropertyEditor *get_property_editor();
|
2017-03-05 16:44:50 +01:00
|
|
|
void edit(Object *p_object);
|
|
|
|
String get_full_item_path(const String &p_item);
|
2016-03-06 15:22:21 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_current_section(const String &p_section);
|
2016-01-10 21:08:02 +01:00
|
|
|
String get_current_section() const;
|
2015-12-16 03:39:36 +01:00
|
|
|
|
2016-03-06 15:22:21 +01:00
|
|
|
void update_category_list();
|
|
|
|
|
2015-12-16 03:39:36 +01:00
|
|
|
SectionedPropertyEditor();
|
|
|
|
~SectionedPropertyEditor();
|
|
|
|
};
|
|
|
|
|
2016-05-01 10:33:32 +02:00
|
|
|
class PropertyValueEvaluator : public ValueEvaluator {
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(PropertyValueEvaluator, ValueEvaluator);
|
2016-05-01 10:33:32 +02:00
|
|
|
|
|
|
|
Object *obj;
|
|
|
|
ScriptLanguage *script_language;
|
2017-03-05 16:44:50 +01:00
|
|
|
String _build_script(const String &p_text);
|
2016-05-01 10:33:32 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
_FORCE_INLINE_ double _default_eval(const String &p_text) {
|
2016-05-01 10:33:32 +02:00
|
|
|
return p_text.to_double();
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
void edit(Object *p_obj);
|
2017-03-05 16:44:50 +01:00
|
|
|
double eval(const String &p_text);
|
2016-05-01 10:33:32 +02:00
|
|
|
|
|
|
|
PropertyValueEvaluator();
|
|
|
|
~PropertyValueEvaluator();
|
|
|
|
};
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
#endif
|