| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "../scene_replication_config.h" |
| 34 |
|
| 35 |
#include "editor/plugins/editor_plugin.h" |
| 36 |
#include "scene/gui/box_container.h" |
| 37 |
|
| 38 |
class ConfirmationDialog; |
| 39 |
class MultiplayerSynchronizer; |
| 40 |
class AcceptDialog; |
| 41 |
class LineEdit; |
| 42 |
class Tree; |
| 43 |
class TreeItem; |
| 44 |
class PropertySelector; |
| 45 |
class SceneTreeDialog; |
| 46 |
|
| 47 |
class ReplicationEditor : public VBoxContainer { |
| 48 |
GDCLASS(ReplicationEditor, VBoxContainer); |
| 49 |
|
| 50 |
private: |
| 51 |
MultiplayerSynchronizer *current = nullptr; |
| 52 |
|
| 53 |
ConfirmationDialog *delete_dialog = nullptr; |
| 54 |
Button *add_pick_button = nullptr; |
| 55 |
Button *add_from_path_button = nullptr; |
| 56 |
LineEdit *np_line_edit = nullptr; |
| 57 |
|
| 58 |
Label *drop_label = nullptr; |
| 59 |
|
| 60 |
Ref<SceneReplicationConfig> config; |
| 61 |
NodePath deleting; |
| 62 |
Tree *tree = nullptr; |
| 63 |
|
| 64 |
PropertySelector *prop_selector = nullptr; |
| 65 |
SceneTreeDialog *pick_node = nullptr; |
| 66 |
NodePath adding_node_path; |
| 67 |
|
| 68 |
Button *pin = nullptr; |
| 69 |
|
| 70 |
Ref<Texture2D> _get_class_icon(const Node *p_node); |
| 71 |
|
| 72 |
void _add_pressed(); |
| 73 |
void _np_text_submitted(const String &p_newtext); |
| 74 |
void _tree_item_edited(); |
| 75 |
void _tree_button_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button); |
| 76 |
void _update_value(const NodePath &p_prop, int p_column, int p_checked); |
| 77 |
void _update_config(); |
| 78 |
void _dialog_closed(bool p_confirmed); |
| 79 |
void _add_property(const NodePath &p_property, bool p_spawn, SceneReplicationConfig::ReplicationMode p_mode); |
| 80 |
|
| 81 |
void _pick_node_filter_text_changed(const String &p_newtext); |
| 82 |
void _pick_node_select_recursive(TreeItem *p_item, const String &p_filter, Vector<Node *> &p_select_candidates); |
| 83 |
void _pick_node_selected(NodePath p_path); |
| 84 |
|
| 85 |
void _pick_new_property(); |
| 86 |
void _pick_node_property_selected(String p_name); |
| 87 |
|
| 88 |
bool _can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; |
| 89 |
void _drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from); |
| 90 |
|
| 91 |
void _add_sync_property(String p_path); |
| 92 |
|
| 93 |
protected: |
| 94 |
static void _bind_methods(); |
| 95 |
|
| 96 |
void _notification(int p_what); |
| 97 |
|
| 98 |
public: |
| 99 |
void edit(MultiplayerSynchronizer *p_object); |
| 100 |
MultiplayerSynchronizer *get_current() const { return current; } |
| 101 |
|
| 102 |
Button *get_pin() { return pin; } |
| 103 |
ReplicationEditor(); |
| 104 |
}; |