summaryrefslogtreecommitdiff
path: root/editor/plugins/replication_editor_plugin.h
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2022-05-23 02:24:14 +0200
committerreduz <reduzio@gmail.com>2022-05-23 13:14:59 +0200
commit12474fd87ae5de819eee58d0d0bf0b9e2c521cfb (patch)
tree65a00995992f895288ad4320ce290986c14d5bb6 /editor/plugins/replication_editor_plugin.h
parent3568b3deeaf3fbbf9e728ff25c7d0349075f9f1a (diff)
Improve MultiplayerSynchronizer editor usability
* Add a button to add properties (which lets you select node and property) * Add ability to drag properties and drop them to the editor. * Made the editor transient (not always visible on the bottom) since its not needed most of the time. * Added the ability to pin the editor, in case dragging properties from other nodes is desired.
Diffstat (limited to 'editor/plugins/replication_editor_plugin.h')
-rw-r--r--editor/plugins/replication_editor_plugin.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/editor/plugins/replication_editor_plugin.h b/editor/plugins/replication_editor_plugin.h
index 08e86d1617..b6de08a3a8 100644
--- a/editor/plugins/replication_editor_plugin.h
+++ b/editor/plugins/replication_editor_plugin.h
@@ -34,6 +34,10 @@
#include "editor/editor_plugin.h"
#include "scene/resources/scene_replication_config.h"
+#include "editor/editor_spin_slider.h"
+#include "editor/property_editor.h"
+#include "editor/property_selector.h"
+
class ConfirmationDialog;
class MultiplayerSynchronizer;
class Tree;
@@ -46,14 +50,23 @@ private:
AcceptDialog *error_dialog = nullptr;
ConfirmationDialog *delete_dialog = nullptr;
- Button *add_button = nullptr;
+ Button *add_pick_button = nullptr;
+ Button *add_from_path_button = nullptr;
LineEdit *np_line_edit = nullptr;
+ Label *drop_label = nullptr;
+
Ref<SceneReplicationConfig> config;
NodePath deleting;
Tree *tree = nullptr;
bool keying = false;
+ PropertySelector *prop_selector = nullptr;
+ SceneTreeDialog *pick_node = nullptr;
+ NodePath adding_node_path;
+
+ Button *pin = nullptr;
+
Ref<Texture2D> _get_class_icon(const Node *p_node);
void _add_pressed();
@@ -64,6 +77,19 @@ private:
void _dialog_closed(bool p_confirmed);
void _add_property(const NodePath &p_property, bool p_spawn = true, bool p_sync = true);
+ void _pick_node_filter_text_changed(const String &p_newtext);
+ void _pick_node_select_recursive(TreeItem *p_item, const String &p_filter, Vector<Node *> &p_select_candidates);
+ void _pick_node_filter_input(const Ref<InputEvent> &p_ie);
+ void _pick_node_selected(NodePath p_path);
+
+ void _pick_new_property();
+ void _pick_node_property_selected(String p_name);
+
+ 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);
+
+ void _add_sync_property(String p_path);
+
protected:
static void _bind_methods();
@@ -76,6 +102,7 @@ public:
MultiplayerSynchronizer *get_current() const { return current; }
void property_keyed(const String &p_property);
+ Button *get_pin() { return pin; }
ReplicationEditor();
~ReplicationEditor() {}
};
@@ -84,12 +111,15 @@ class ReplicationEditorPlugin : public EditorPlugin {
GDCLASS(ReplicationEditorPlugin, EditorPlugin);
private:
+ Button *button = nullptr;
ReplicationEditor *repl_editor = nullptr;
void _node_removed(Node *p_node);
void _keying_changed();
void _property_keyed(const String &p_keyed, const Variant &p_value, bool p_advance);
+ void _pinned();
+
protected:
void _notification(int p_what);