2014-02-10 01:10:30 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
/* node.h */
|
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* http://www.godotengine.org */
|
|
|
|
/*************************************************************************/
|
2017-01-01 21:01:57 +00:00
|
|
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
2017-04-07 22:11:42 +00:00
|
|
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
2014-02-10 01:10:30 +00: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 NODE_H
|
|
|
|
#define NODE_H
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
#include "class_db.h"
|
2017-02-21 03:05:15 +00:00
|
|
|
#include "global_config.h"
|
2017-03-05 15:44:50 +00:00
|
|
|
#include "map.h"
|
2014-02-10 01:10:30 +00:00
|
|
|
#include "object.h"
|
|
|
|
#include "path_db.h"
|
2017-06-27 01:58:03 +00:00
|
|
|
#include "scene/main/scene_tree.h"
|
2017-03-05 15:44:50 +00:00
|
|
|
#include "script_language.h"
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2014-04-10 03:18:27 +00:00
|
|
|
class Viewport;
|
2015-10-10 12:09:09 +00:00
|
|
|
class SceneState;
|
2014-02-10 01:10:30 +00:00
|
|
|
class Node : public Object {
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
GDCLASS(Node, Object);
|
2014-02-10 01:10:30 +00:00
|
|
|
OBJ_CATEGORY("Nodes");
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
public:
|
|
|
|
enum PauseMode {
|
|
|
|
|
|
|
|
PAUSE_MODE_INHERIT,
|
|
|
|
PAUSE_MODE_STOP,
|
|
|
|
PAUSE_MODE_PROCESS
|
|
|
|
};
|
|
|
|
|
2017-02-20 19:05:01 +00:00
|
|
|
enum DuplicateFlags {
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
DUPLICATE_SIGNALS = 1,
|
|
|
|
DUPLICATE_GROUPS = 2,
|
|
|
|
DUPLICATE_SCRIPTS = 4,
|
|
|
|
DUPLICATE_USE_INSTANCING = 8
|
2017-02-20 19:05:01 +00:00
|
|
|
};
|
|
|
|
|
2016-08-19 19:48:08 +00:00
|
|
|
enum RPCMode {
|
|
|
|
|
|
|
|
RPC_MODE_DISABLED, //no rpc for this method, calls to this will be blocked (default)
|
|
|
|
RPC_MODE_REMOTE, // using rpc() on it will call method / set property in all other peers
|
|
|
|
RPC_MODE_SYNC, // using rpc() on it will call method / set property in all other peers and locally
|
|
|
|
RPC_MODE_MASTER, // usinc rpc() on it will call method on wherever the master is, be it local or remote
|
|
|
|
RPC_MODE_SLAVE, // usinc rpc() on it will call method for all slaves, be it local or remote
|
|
|
|
};
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
struct Comparator {
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
bool operator()(const Node *p_a, const Node *p_b) const { return p_b->is_greater_than(p_a); }
|
2014-02-10 01:10:30 +00:00
|
|
|
};
|
|
|
|
|
2016-03-08 23:00:52 +00:00
|
|
|
private:
|
2014-02-10 01:10:30 +00:00
|
|
|
struct GroupData {
|
2016-03-08 23:00:52 +00:00
|
|
|
|
|
|
|
bool persistent;
|
2016-06-08 01:08:12 +00:00
|
|
|
SceneTree::Group *group;
|
2017-03-05 15:44:50 +00:00
|
|
|
GroupData() { persistent = false; }
|
2014-02-10 01:10:30 +00:00
|
|
|
};
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
struct Data {
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
String filename;
|
2015-10-10 12:09:09 +00:00
|
|
|
Ref<SceneState> instance_state;
|
|
|
|
Ref<SceneState> inherited_state;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
HashMap<NodePath, int> editable_instances;
|
2015-10-10 12:09:09 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
Node *parent;
|
|
|
|
Node *owner;
|
2017-03-05 15:44:50 +00:00
|
|
|
Vector<Node *> children; // list of children
|
2014-02-10 01:10:30 +00:00
|
|
|
int pos;
|
|
|
|
int depth;
|
|
|
|
int blocked; // safeguard that throws an error when attempting to modify the tree in a harmful way while being traversed.
|
|
|
|
StringName name;
|
2014-11-06 00:20:42 +00:00
|
|
|
SceneTree *tree;
|
|
|
|
bool inside_tree;
|
2017-01-10 21:02:19 +00:00
|
|
|
bool ready_notified; //this is a small hack, so if a node is added during _ready() to the tree, it corretly gets the _ready() notification
|
|
|
|
bool ready_first;
|
2014-06-19 05:23:03 +00:00
|
|
|
#ifdef TOOLS_ENABLED
|
|
|
|
NodePath import_path; //path used when imported, used by scene editors to keep tracking
|
|
|
|
#endif
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2014-04-10 03:18:27 +00:00
|
|
|
Viewport *viewport;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Map<StringName, GroupData> grouped;
|
|
|
|
List<Node *>::Element *OW; // owned element
|
|
|
|
List<Node *> owned;
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
PauseMode pause_mode;
|
|
|
|
Node *pause_owner;
|
2016-08-14 21:49:50 +00:00
|
|
|
|
2017-07-03 13:44:45 +00:00
|
|
|
int network_master;
|
2017-03-05 15:44:50 +00:00
|
|
|
Map<StringName, RPCMode> rpc_methods;
|
|
|
|
Map<StringName, RPCMode> rpc_properties;
|
2016-08-14 21:49:50 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
// variables used to properly sort the node when processing, ignored otherwise
|
2015-10-10 12:09:09 +00:00
|
|
|
//should move all the stuff below to bits
|
2014-02-10 01:10:30 +00:00
|
|
|
bool fixed_process;
|
|
|
|
bool idle_process;
|
|
|
|
|
2017-01-10 21:02:19 +00:00
|
|
|
bool fixed_process_internal;
|
|
|
|
bool idle_process_internal;
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
bool input;
|
|
|
|
bool unhandled_input;
|
2014-04-10 03:18:27 +00:00
|
|
|
bool unhandled_key_input;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
bool parent_owned;
|
|
|
|
bool in_constructor;
|
2015-10-16 22:11:23 +00:00
|
|
|
bool use_placeholder;
|
|
|
|
|
2016-06-28 16:10:15 +00:00
|
|
|
bool display_folded;
|
2015-10-10 12:09:09 +00:00
|
|
|
|
2016-08-14 21:49:50 +00:00
|
|
|
mutable NodePath *path_cache;
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
} data;
|
|
|
|
|
2017-01-12 18:13:09 +00:00
|
|
|
enum NameCasing {
|
|
|
|
NAME_CASING_PASCAL_CASE,
|
|
|
|
NAME_CASING_CAMEL_CASE,
|
|
|
|
NAME_CASING_SNAKE_CASE
|
|
|
|
};
|
|
|
|
|
2016-03-08 23:00:52 +00:00
|
|
|
void _print_tree(const Node *p_node);
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Node *_get_node(const NodePath &p_path) const;
|
|
|
|
Node *_get_child_by_name(const StringName &p_name) const;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void _replace_connections_target(Node *p_new_target);
|
2015-06-08 03:33:10 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void _validate_child_name(Node *p_child, bool p_force_human_readable = false);
|
2016-10-07 18:25:29 +00:00
|
|
|
String _generate_serial_child_name(Node *p_child);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2016-03-08 23:00:52 +00:00
|
|
|
void _propagate_reverse_notification(int p_notification);
|
2014-02-10 01:10:30 +00:00
|
|
|
void _propagate_deferred_notification(int p_notification, bool p_reverse);
|
2014-11-06 00:20:42 +00:00
|
|
|
void _propagate_enter_tree();
|
2014-02-10 01:10:30 +00:00
|
|
|
void _propagate_ready();
|
2014-11-06 00:20:42 +00:00
|
|
|
void _propagate_exit_tree();
|
2014-02-10 01:10:30 +00:00
|
|
|
void _propagate_validate_owner();
|
|
|
|
void _print_stray_nodes();
|
2017-03-05 15:44:50 +00:00
|
|
|
void _propagate_pause_owner(Node *p_owner);
|
|
|
|
Array _get_node_and_resource(const NodePath &p_path);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void _duplicate_signals(const Node *p_original, Node *p_copy) const;
|
|
|
|
void _duplicate_and_reown(Node *p_new_parent, const Map<Node *, Node *> &p_reown_map) const;
|
2017-02-20 19:05:01 +00:00
|
|
|
Node *_duplicate(int p_flags) const;
|
2016-07-07 00:43:31 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
Array _get_children() const;
|
2014-06-16 13:22:26 +00:00
|
|
|
Array _get_groups() const;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Variant _rpc_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error);
|
|
|
|
Variant _rpc_unreliable_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error);
|
|
|
|
Variant _rpc_id_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error);
|
|
|
|
Variant _rpc_unreliable_id_bind(const Variant **p_args, int p_argcount, Variant::CallError &r_error);
|
2016-08-14 21:49:50 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
friend class SceneTree;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2014-11-06 00:20:42 +00:00
|
|
|
void _set_tree(SceneTree *p_tree);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
protected:
|
2014-02-10 01:10:30 +00:00
|
|
|
void _block() { data.blocked++; }
|
2017-03-05 15:44:50 +00:00
|
|
|
void _unblock() { data.blocked--; }
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2016-03-08 23:00:52 +00:00
|
|
|
void _notification(int p_notification);
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
virtual void add_child_notify(Node *p_child);
|
|
|
|
virtual void remove_child_notify(Node *p_child);
|
2014-12-03 04:17:23 +00:00
|
|
|
virtual void move_child_notify(Node *p_child);
|
2015-04-09 03:49:48 +00:00
|
|
|
//void remove_and_delete_child(Node *p_child);
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void _propagate_replace_owner(Node *p_owner, Node *p_by_owner);
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
static void _bind_methods();
|
2016-10-07 18:25:29 +00:00
|
|
|
static String _get_name_num_separator();
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
friend class SceneState;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void _add_child_nocheck(Node *p_child, const StringName &p_name);
|
|
|
|
void _set_owner_nocheck(Node *p_owner);
|
|
|
|
void _set_name_nocheck(const StringName &p_name);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
enum {
|
|
|
|
// you can make your own, but don't use the same numbers as other notifications in other nodes
|
2017-03-05 15:44:50 +00:00
|
|
|
NOTIFICATION_ENTER_TREE = 10,
|
|
|
|
NOTIFICATION_EXIT_TREE = 11,
|
|
|
|
NOTIFICATION_MOVED_IN_PARENT = 12,
|
|
|
|
NOTIFICATION_READY = 13,
|
2014-02-10 01:10:30 +00:00
|
|
|
//NOTIFICATION_PARENT_DECONFIGURED =15, - it's confusing, it's going away
|
2017-03-05 15:44:50 +00:00
|
|
|
NOTIFICATION_PAUSED = 14,
|
|
|
|
NOTIFICATION_UNPAUSED = 15,
|
2014-02-10 01:10:30 +00:00
|
|
|
NOTIFICATION_FIXED_PROCESS = 16,
|
|
|
|
NOTIFICATION_PROCESS = 17,
|
2017-03-05 15:44:50 +00:00
|
|
|
NOTIFICATION_PARENTED = 18,
|
|
|
|
NOTIFICATION_UNPARENTED = 19,
|
|
|
|
NOTIFICATION_INSTANCED = 20,
|
|
|
|
NOTIFICATION_DRAG_BEGIN = 21,
|
|
|
|
NOTIFICATION_DRAG_END = 22,
|
|
|
|
NOTIFICATION_PATH_CHANGED = 23,
|
|
|
|
NOTIFICATION_TRANSLATION_CHANGED = 24,
|
2017-01-10 21:02:19 +00:00
|
|
|
NOTIFICATION_INTERNAL_PROCESS = 25,
|
|
|
|
NOTIFICATION_INTERNAL_FIXED_PROCESS = 26,
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
};
|
2016-03-08 23:00:52 +00:00
|
|
|
|
|
|
|
/* NODE/TREE */
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
StringName get_name() const;
|
2017-03-05 15:44:50 +00:00
|
|
|
void set_name(const String &p_name);
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void add_child(Node *p_child, bool p_legible_unique_name = false);
|
|
|
|
void add_child_below_node(Node *p_node, Node *p_child, bool p_legible_unique_name = false);
|
2014-02-10 01:10:30 +00:00
|
|
|
void remove_child(Node *p_child);
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
int get_child_count() const;
|
|
|
|
Node *get_child(int p_index) const;
|
2017-03-05 15:44:50 +00:00
|
|
|
bool has_node(const NodePath &p_path) const;
|
|
|
|
Node *get_node(const NodePath &p_path) const;
|
|
|
|
Node *find_node(const String &p_mask, bool p_recursive = true, bool p_owned = true) const;
|
|
|
|
bool has_node_and_resource(const NodePath &p_path) const;
|
|
|
|
Node *get_node_and_resource(const NodePath &p_path, RES &r_res) const;
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
Node *get_parent() const;
|
2017-03-05 15:44:50 +00:00
|
|
|
_FORCE_INLINE_ SceneTree *get_tree() const {
|
|
|
|
ERR_FAIL_COND_V(!data.tree, NULL);
|
|
|
|
return data.tree;
|
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2014-11-06 00:20:42 +00:00
|
|
|
_FORCE_INLINE_ bool is_inside_tree() const { return data.inside_tree; }
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
bool is_a_parent_of(const Node *p_node) const;
|
|
|
|
bool is_greater_than(const Node *p_node) const;
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
NodePath get_path() const;
|
|
|
|
NodePath get_path_to(const Node *p_node) const;
|
2017-03-05 15:44:50 +00:00
|
|
|
Node *find_common_parent_with(const Node *p_node) const;
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void add_to_group(const StringName &p_identifier, bool p_persistent = false);
|
|
|
|
void remove_from_group(const StringName &p_identifier);
|
|
|
|
bool is_in_group(const StringName &p_identifier) const;
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
struct GroupInfo {
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2015-10-10 12:09:09 +00:00
|
|
|
StringName name;
|
2014-02-10 01:10:30 +00:00
|
|
|
bool persistent;
|
|
|
|
};
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
void get_groups(List<GroupInfo> *p_groups) const;
|
2016-06-04 16:17:56 +00:00
|
|
|
bool has_persistent_groups() const;
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void move_child(Node *p_child, int p_pos);
|
2014-02-10 01:10:30 +00:00
|
|
|
void raise();
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
void set_owner(Node *p_owner);
|
|
|
|
Node *get_owner() const;
|
2017-03-05 15:44:50 +00:00
|
|
|
void get_owned_by(Node *p_by, List<Node *> *p_owned);
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
void remove_and_skip();
|
|
|
|
int get_index() const;
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
void print_tree();
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void set_filename(const String &p_filename);
|
2014-02-10 01:10:30 +00:00
|
|
|
String get_filename() const;
|
2015-10-10 12:09:09 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void set_editable_instance(Node *p_node, bool p_editable);
|
|
|
|
bool is_editable_instance(Node *p_node) const;
|
|
|
|
void set_editable_instances(const HashMap<NodePath, int> &p_editable_instances);
|
|
|
|
HashMap<NodePath, int> get_editable_instances() const;
|
2015-10-16 22:11:23 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
/* NOTIFICATIONS */
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
void propagate_notification(int p_notification);
|
2016-03-08 23:00:52 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
/* PROCESSING */
|
|
|
|
void set_fixed_process(bool p_process);
|
|
|
|
float get_fixed_process_delta_time() const;
|
|
|
|
bool is_fixed_processing() const;
|
|
|
|
|
|
|
|
void set_process(bool p_process);
|
|
|
|
float get_process_delta_time() const;
|
|
|
|
bool is_processing() const;
|
|
|
|
|
2017-01-10 21:02:19 +00:00
|
|
|
void set_fixed_process_internal(bool p_process);
|
|
|
|
bool is_fixed_processing_internal() const;
|
|
|
|
|
|
|
|
void set_process_internal(bool p_process);
|
|
|
|
bool is_processing_internal() const;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
void set_process_input(bool p_enable);
|
|
|
|
bool is_processing_input() const;
|
|
|
|
|
|
|
|
void set_process_unhandled_input(bool p_enable);
|
|
|
|
bool is_processing_unhandled_input() const;
|
|
|
|
|
2014-04-10 03:18:27 +00:00
|
|
|
void set_process_unhandled_key_input(bool p_enable);
|
|
|
|
bool is_processing_unhandled_key_input() const;
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
int get_position_in_parent() const;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Node *duplicate(int p_flags = DUPLICATE_GROUPS | DUPLICATE_SIGNALS | DUPLICATE_SCRIPTS) const;
|
|
|
|
Node *duplicate_and_reown(const Map<Node *, Node *> &p_reown_map) const;
|
2015-08-02 15:29:37 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
//Node *clone_tree() const;
|
|
|
|
|
|
|
|
// used by editors, to save what has changed only
|
2017-03-05 15:44:50 +00:00
|
|
|
void set_scene_instance_state(const Ref<SceneState> &p_state);
|
2015-10-10 12:09:09 +00:00
|
|
|
Ref<SceneState> get_scene_instance_state() const;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void set_scene_inherited_state(const Ref<SceneState> &p_state);
|
2015-10-10 12:09:09 +00:00
|
|
|
Ref<SceneState> get_scene_inherited_state() const;
|
|
|
|
|
2015-10-16 22:11:23 +00:00
|
|
|
void set_scene_instance_load_placeholder(bool p_enable);
|
|
|
|
bool get_scene_instance_load_placeholder() const;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
static Vector<Variant> make_binds(VARIANT_ARG_LIST);
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void replace_by(Node *p_node, bool p_keep_data = false);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
void set_pause_mode(PauseMode p_mode);
|
|
|
|
PauseMode get_pause_mode() const;
|
|
|
|
bool can_process() const;
|
|
|
|
|
2017-01-10 21:02:19 +00:00
|
|
|
void request_ready();
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
static void print_stray_nodes();
|
|
|
|
|
2016-10-07 18:25:29 +00:00
|
|
|
#ifdef TOOLS_ENABLED
|
2017-03-05 15:44:50 +00:00
|
|
|
String validate_child_name(Node *p_child);
|
2016-10-07 18:25:29 +00:00
|
|
|
#endif
|
2015-08-02 15:29:37 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
void queue_delete();
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
//shitty hacks for speed
|
2014-02-22 23:28:19 +00:00
|
|
|
static void set_human_readable_collision_renaming(bool p_enabled);
|
|
|
|
static void init_node_hrcr();
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void force_parent_owned() { data.parent_owned = true; } //hack to avoid duplicate nodes
|
2014-04-05 15:39:30 +00:00
|
|
|
|
2014-06-19 05:23:03 +00:00
|
|
|
#ifdef TOOLS_ENABLED
|
2017-03-05 15:44:50 +00:00
|
|
|
void set_import_path(const NodePath &p_import_path); //path used when imported, used by scene editors to keep tracking
|
2014-06-19 05:23:03 +00:00
|
|
|
NodePath get_import_path() const;
|
|
|
|
#endif
|
|
|
|
|
2016-06-21 01:57:07 +00:00
|
|
|
bool is_owned_by_parent() const;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const;
|
2014-06-19 05:23:03 +00:00
|
|
|
|
2015-06-22 03:03:19 +00:00
|
|
|
void clear_internal_tree_resource_paths();
|
|
|
|
|
2014-04-10 03:18:27 +00:00
|
|
|
_FORCE_INLINE_ Viewport *get_viewport() const { return data.viewport; }
|
|
|
|
|
2016-05-17 21:27:15 +00:00
|
|
|
virtual String get_configuration_warning() const;
|
|
|
|
|
|
|
|
void update_configuration_warning();
|
|
|
|
|
2016-06-28 16:10:15 +00:00
|
|
|
void set_display_folded(bool p_folded);
|
|
|
|
bool is_displayed_folded() const;
|
2016-08-14 21:49:50 +00:00
|
|
|
/* NETWORK */
|
|
|
|
|
2017-07-03 13:44:45 +00:00
|
|
|
void set_network_master(int p_peer_id, bool p_recursive = true);
|
|
|
|
int get_network_master() const;
|
2016-08-14 21:49:50 +00:00
|
|
|
bool is_network_master() const;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void rpc_config(const StringName &p_method, RPCMode p_mode); // config a local method for RPC
|
|
|
|
void rset_config(const StringName &p_property, RPCMode p_mode); // config a local property for RPC
|
2016-08-14 21:49:50 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void rpc(const StringName &p_method, VARIANT_ARG_LIST); //rpc call, honors RPCMode
|
|
|
|
void rpc_unreliable(const StringName &p_method, VARIANT_ARG_LIST); //rpc call, honors RPCMode
|
|
|
|
void rpc_id(int p_peer_id, const StringName &p_method, VARIANT_ARG_LIST); //rpc call, honors RPCMode
|
|
|
|
void rpc_unreliable_id(int p_peer_id, const StringName &p_method, VARIANT_ARG_LIST); //rpc call, honors RPCMode
|
2016-08-14 21:49:50 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void rpcp(int p_peer_id, bool p_unreliable, const StringName &p_method, const Variant **p_arg, int p_argcount);
|
2016-08-14 21:49:50 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void rset(const StringName &p_property, const Variant &p_value); //remote set call, honors RPCMode
|
|
|
|
void rset_unreliable(const StringName &p_property, const Variant &p_value); //remote set call, honors RPCMode
|
|
|
|
void rset_id(int p_peer_id, const StringName &p_property, const Variant &p_value); //remote set call, honors RPCMode
|
|
|
|
void rset_unreliable_id(int p_peer_id, const StringName &p_property, const Variant &p_value); //remote set call, honors RPCMode
|
2016-08-14 21:49:50 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void rsetp(int p_peer_id, bool p_unreliable, const StringName &p_property, const Variant &p_value);
|
2016-08-14 21:49:50 +00:00
|
|
|
|
2017-07-03 13:44:45 +00:00
|
|
|
bool can_call_rpc(const StringName &p_method, int p_from) const;
|
|
|
|
bool can_call_rset(const StringName &p_property, int p_from) const;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
Node();
|
|
|
|
~Node();
|
|
|
|
};
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
typedef Set<Node *, Node::Comparator> NodeSet;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
#endif
|