Path: blob/master/modules/multiplayer/editor/replication_editor.h
10278 views
/**************************************************************************/1/* replication_editor.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#include "../scene_replication_config.h"3334#include "editor/plugins/editor_plugin.h"35#include "scene/gui/box_container.h"3637class ConfirmationDialog;38class MultiplayerSynchronizer;39class AcceptDialog;40class LineEdit;41class Tree;42class TreeItem;43class PropertySelector;44class SceneTreeDialog;4546class ReplicationEditor : public VBoxContainer {47GDCLASS(ReplicationEditor, VBoxContainer);4849private:50MultiplayerSynchronizer *current = nullptr;5152ConfirmationDialog *delete_dialog = nullptr;53Button *add_pick_button = nullptr;54Button *add_from_path_button = nullptr;55LineEdit *np_line_edit = nullptr;5657Label *drop_label = nullptr;5859Ref<SceneReplicationConfig> config;60NodePath deleting;61Tree *tree = nullptr;6263PropertySelector *prop_selector = nullptr;64SceneTreeDialog *pick_node = nullptr;65NodePath adding_node_path;6667Button *pin = nullptr;6869Ref<Texture2D> _get_class_icon(const Node *p_node);7071void _add_pressed();72void _np_text_submitted(const String &p_newtext);73void _tree_item_edited();74void _tree_button_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button);75void _update_value(const NodePath &p_prop, int p_column, int p_checked);76void _update_config();77void _dialog_closed(bool p_confirmed);78void _add_property(const NodePath &p_property, bool p_spawn, SceneReplicationConfig::ReplicationMode p_mode);7980void _pick_node_filter_text_changed(const String &p_newtext);81void _pick_node_select_recursive(TreeItem *p_item, const String &p_filter, Vector<Node *> &p_select_candidates);82void _pick_node_selected(NodePath p_path);8384void _pick_new_property();85void _pick_node_property_selected(String p_name);8687bool _can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;88void _drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);8990void _add_sync_property(String p_path);9192protected:93static void _bind_methods();9495void _notification(int p_what);9697public:98void edit(MultiplayerSynchronizer *p_object);99MultiplayerSynchronizer *get_current() const { return current; }100101Button *get_pin() { return pin; }102ReplicationEditor();103};104105106