2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
2017-09-01 16:07:55 +02:00
|
|
|
/* scene_tree.h */
|
2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* 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
|
|
|
/*************************************************************************/
|
2020-01-01 11:16:22 +01:00
|
|
|
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2020 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. */
|
|
|
|
/*************************************************************************/
|
2018-01-05 00:50:27 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
#ifndef SCENE_MAIN_LOOP_H
|
|
|
|
#define SCENE_MAIN_LOOP_H
|
|
|
|
|
2018-09-11 18:13:45 +02:00
|
|
|
#include "core/io/multiplayer_api.h"
|
|
|
|
#include "core/os/main_loop.h"
|
|
|
|
#include "core/os/thread_safe.h"
|
|
|
|
#include "core/self_list.h"
|
2017-06-07 23:18:55 +02:00
|
|
|
#include "scene/resources/mesh.h"
|
2014-02-10 02:10:30 +01:00
|
|
|
#include "scene/resources/world.h"
|
|
|
|
#include "scene/resources/world_2d.h"
|
2016-08-14 23:49:50 +02:00
|
|
|
|
2015-05-17 21:33:35 +02:00
|
|
|
class PackedScene;
|
2014-02-10 02:10:30 +01:00
|
|
|
class Node;
|
|
|
|
class Viewport;
|
2015-09-20 18:03:46 +02:00
|
|
|
class Material;
|
|
|
|
class Mesh;
|
2020-02-07 02:52:05 +01:00
|
|
|
class SceneDebugger;
|
2014-06-30 03:41:02 +02:00
|
|
|
|
2016-08-07 02:39:50 +02:00
|
|
|
class SceneTreeTimer : public Reference {
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(SceneTreeTimer, Reference);
|
2016-08-07 02:39:50 +02:00
|
|
|
|
|
|
|
float time_left;
|
2017-02-14 00:34:33 +01:00
|
|
|
bool process_pause;
|
2017-03-05 16:44:50 +01:00
|
|
|
|
2016-08-07 02:39:50 +02:00
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
public:
|
2016-08-07 02:39:50 +02:00
|
|
|
void set_time_left(float p_time);
|
|
|
|
float get_time_left() const;
|
|
|
|
|
2017-02-14 00:34:33 +01:00
|
|
|
void set_pause_mode_process(bool p_pause_mode_process);
|
|
|
|
bool is_pause_mode_process();
|
|
|
|
|
2019-10-19 18:45:17 +02:00
|
|
|
void release_connections();
|
|
|
|
|
2016-08-07 02:39:50 +02:00
|
|
|
SceneTreeTimer();
|
|
|
|
};
|
|
|
|
|
2014-11-06 01:20:42 +01:00
|
|
|
class SceneTree : public MainLoop {
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
_THREAD_SAFE_CLASS_
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
GDCLASS(SceneTree, MainLoop);
|
2014-04-15 03:43:44 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
public:
|
2016-10-27 16:50:26 +02:00
|
|
|
typedef void (*IdleCallback)();
|
|
|
|
|
2014-04-15 03:43:44 +02:00
|
|
|
enum StretchMode {
|
|
|
|
|
|
|
|
STRETCH_MODE_DISABLED,
|
|
|
|
STRETCH_MODE_2D,
|
|
|
|
STRETCH_MODE_VIEWPORT,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum StretchAspect {
|
|
|
|
|
|
|
|
STRETCH_ASPECT_IGNORE,
|
|
|
|
STRETCH_ASPECT_KEEP,
|
|
|
|
STRETCH_ASPECT_KEEP_WIDTH,
|
|
|
|
STRETCH_ASPECT_KEEP_HEIGHT,
|
2017-08-09 09:53:38 +02:00
|
|
|
STRETCH_ASPECT_EXPAND,
|
2014-04-15 03:43:44 +02:00
|
|
|
};
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
private:
|
2014-02-10 02:10:30 +01:00
|
|
|
struct Group {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Vector<Node *> nodes;
|
2016-06-08 03:08:12 +02:00
|
|
|
//uint64_t last_tree_version;
|
|
|
|
bool changed;
|
2017-03-05 16:44:50 +01:00
|
|
|
Group() { changed = false; };
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
Viewport *root;
|
|
|
|
|
|
|
|
uint64_t tree_version;
|
2017-09-30 16:19:07 +02:00
|
|
|
float physics_process_time;
|
2014-02-10 02:10:30 +01:00
|
|
|
float idle_process_time;
|
|
|
|
bool accept_quit;
|
2017-01-11 20:34:32 +01:00
|
|
|
bool quit_on_go_back;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-04-07 16:17:16 +02:00
|
|
|
#ifdef DEBUG_ENABLED
|
2015-09-19 04:10:58 +02:00
|
|
|
bool debug_collisions_hint;
|
2015-09-20 18:03:46 +02:00
|
|
|
bool debug_navigation_hint;
|
2017-04-07 16:17:16 +02:00
|
|
|
#endif
|
2014-02-10 02:10:30 +01:00
|
|
|
bool pause;
|
|
|
|
int root_lock;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Map<StringName, Group> group_map;
|
2014-02-10 02:10:30 +01:00
|
|
|
bool _quit;
|
|
|
|
bool initialized;
|
|
|
|
bool input_handled;
|
2017-12-19 22:48:30 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
Size2 last_screen_size;
|
|
|
|
StringName tree_changed_name;
|
2017-10-19 02:30:27 +02:00
|
|
|
StringName node_added_name;
|
2014-02-10 02:10:30 +01:00
|
|
|
StringName node_removed_name;
|
2019-05-24 15:27:22 +02:00
|
|
|
StringName node_renamed_name;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-12-19 22:48:30 +01:00
|
|
|
bool use_font_oversampling;
|
2014-02-10 02:10:30 +01:00
|
|
|
int64_t current_frame;
|
2017-12-26 13:48:50 +01:00
|
|
|
int64_t current_event;
|
2014-02-10 02:10:30 +01:00
|
|
|
int node_count;
|
|
|
|
|
2014-10-12 07:13:22 +02:00
|
|
|
#ifdef TOOLS_ENABLED
|
|
|
|
Node *edited_scene_root;
|
|
|
|
#endif
|
2014-02-10 02:10:30 +01:00
|
|
|
struct UGCall {
|
|
|
|
|
|
|
|
StringName group;
|
|
|
|
StringName call;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
bool operator<(const UGCall &p_with) const { return group == p_with.group ? call < p_with.call : group < p_with.group; }
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
//safety for when a node is deleted while a group is being called
|
|
|
|
int call_lock;
|
2017-03-05 16:44:50 +01:00
|
|
|
Set<Node *> call_skip; //skip erased nodes
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2014-04-15 03:43:44 +02:00
|
|
|
StretchMode stretch_mode;
|
|
|
|
StretchAspect stretch_aspect;
|
|
|
|
Size2i stretch_min;
|
2017-10-19 16:12:46 +02:00
|
|
|
real_t stretch_shrink;
|
2014-04-15 03:43:44 +02:00
|
|
|
|
2019-01-26 18:56:22 +01:00
|
|
|
void _update_font_oversampling(float p_ratio);
|
2014-04-15 03:43:44 +02:00
|
|
|
void _update_root_rect();
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
List<ObjectID> delete_queue;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Map<UGCall, Vector<Variant> > unique_group_calls;
|
2014-02-10 02:10:30 +01:00
|
|
|
bool ugc_locked;
|
|
|
|
void _flush_ugc();
|
|
|
|
|
2018-07-02 07:30:40 +02:00
|
|
|
_FORCE_INLINE_ void _update_group_order(Group &g, bool p_use_priority = false);
|
2014-02-10 02:10:30 +01:00
|
|
|
void _update_listener();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Array _get_nodes_in_group(const StringName &p_group);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2015-05-17 21:33:35 +02:00
|
|
|
Node *current_scene;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2015-09-20 18:03:46 +02:00
|
|
|
Color debug_collisions_color;
|
|
|
|
Color debug_collision_contact_color;
|
|
|
|
Color debug_navigation_color;
|
|
|
|
Color debug_navigation_disabled_color;
|
2017-06-07 23:18:55 +02:00
|
|
|
Ref<ArrayMesh> debug_contact_mesh;
|
2015-09-20 18:03:46 +02:00
|
|
|
Ref<Material> navigation_material;
|
|
|
|
Ref<Material> navigation_disabled_material;
|
|
|
|
Ref<Material> collision_material;
|
|
|
|
int collision_debug_contacts;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void _change_scene(Node *p_to);
|
2014-02-10 02:10:30 +01:00
|
|
|
//void _call_group(uint32_t p_call_flags,const StringName& p_group,const StringName& p_function,const Variant& p_arg1,const Variant& p_arg2);
|
|
|
|
|
2016-08-07 02:39:50 +02:00
|
|
|
List<Ref<SceneTreeTimer> > timers;
|
|
|
|
|
2016-08-14 23:49:50 +02:00
|
|
|
///network///
|
|
|
|
|
2018-05-08 10:51:04 +02:00
|
|
|
Ref<MultiplayerAPI> multiplayer;
|
2018-06-02 14:32:30 +02:00
|
|
|
bool multiplayer_poll;
|
2016-08-14 23:49:50 +02:00
|
|
|
|
2016-08-19 21:48:08 +02:00
|
|
|
void _network_peer_connected(int p_id);
|
|
|
|
void _network_peer_disconnected(int p_id);
|
|
|
|
|
|
|
|
void _connected_to_server();
|
|
|
|
void _connection_failed();
|
|
|
|
void _server_disconnected();
|
2016-08-14 23:49:50 +02:00
|
|
|
|
2015-09-20 18:03:46 +02:00
|
|
|
static SceneTree *singleton;
|
2017-03-05 16:44:50 +01:00
|
|
|
friend class Node;
|
2016-08-14 23:49:50 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
void tree_changed();
|
2017-10-19 02:30:27 +02:00
|
|
|
void node_added(Node *p_node);
|
2014-02-10 02:10:30 +01:00
|
|
|
void node_removed(Node *p_node);
|
2019-05-24 15:27:22 +02:00
|
|
|
void node_renamed(Node *p_node);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Group *add_to_group(const StringName &p_group, Node *p_node);
|
|
|
|
void remove_from_group(const StringName &p_group, Node *p_node);
|
2018-07-02 07:30:40 +02:00
|
|
|
void make_group_changed(const StringName &p_group);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void _notify_group_pause(const StringName &p_group, int p_notification);
|
2017-05-20 17:38:03 +02:00
|
|
|
void _call_input_pause(const StringName &p_group, const StringName &p_method, const Ref<InputEvent> &p_input);
|
2020-02-19 20:27:19 +01:00
|
|
|
Variant _call_group_flags(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
|
|
|
|
Variant _call_group(const Variant **p_args, int p_argcount, Callable::CallError &r_error);
|
2017-01-14 14:03:53 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
void _flush_delete_queue();
|
2017-03-05 16:44:50 +01:00
|
|
|
//optimization
|
|
|
|
friend class CanvasItem;
|
|
|
|
friend class Spatial;
|
|
|
|
friend class Viewport;
|
2014-04-10 05:18:27 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
SelfList<Node>::List xform_change_list;
|
|
|
|
|
2020-02-07 02:52:05 +01:00
|
|
|
#ifdef DEBUG_ENABLED // No live editor in release build.
|
|
|
|
friend class LiveEditor;
|
2015-08-02 17:29:37 +02:00
|
|
|
#endif
|
2016-10-27 16:50:26 +02:00
|
|
|
|
|
|
|
enum {
|
2017-03-05 16:44:50 +01:00
|
|
|
MAX_IDLE_CALLBACKS = 256
|
2016-10-27 16:50:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static IdleCallback idle_callbacks[MAX_IDLE_CALLBACKS];
|
|
|
|
static int idle_callback_count;
|
|
|
|
void _call_idle_callbacks();
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
protected:
|
|
|
|
void _notification(int p_notification);
|
|
|
|
static void _bind_methods();
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum {
|
2019-04-04 15:34:03 +02:00
|
|
|
NOTIFICATION_TRANSFORM_CHANGED = 2000
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
2017-12-24 03:17:48 +01:00
|
|
|
enum GroupCallFlags {
|
2017-03-05 16:44:50 +01:00
|
|
|
GROUP_CALL_DEFAULT = 0,
|
|
|
|
GROUP_CALL_REVERSE = 1,
|
|
|
|
GROUP_CALL_REALTIME = 2,
|
|
|
|
GROUP_CALL_UNIQUE = 4,
|
|
|
|
GROUP_CALL_MULTILEVEL = 8,
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
_FORCE_INLINE_ Viewport *get_root() const { return root; }
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void call_group_flags(uint32_t p_call_flags, const StringName &p_group, const StringName &p_function, VARIANT_ARG_LIST);
|
|
|
|
void notify_group_flags(uint32_t p_call_flags, const StringName &p_group, int p_notification);
|
|
|
|
void set_group_flags(uint32_t p_call_flags, const StringName &p_group, const String &p_name, const Variant &p_value);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void call_group(const StringName &p_group, const StringName &p_function, VARIANT_ARG_LIST);
|
|
|
|
void notify_group(const StringName &p_group, int p_notification);
|
|
|
|
void set_group(const StringName &p_group, const String &p_name, const Variant &p_value);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2017-10-30 19:43:19 +01:00
|
|
|
void flush_transform_notifications();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
virtual void input_text(const String &p_text);
|
2017-05-20 17:38:03 +02:00
|
|
|
virtual void input_event(const Ref<InputEvent> &p_event);
|
2014-02-10 02:10:30 +01:00
|
|
|
virtual void init();
|
|
|
|
|
|
|
|
virtual bool iteration(float p_time);
|
|
|
|
virtual bool idle(float p_time);
|
|
|
|
|
|
|
|
virtual void finish();
|
|
|
|
|
|
|
|
void set_auto_accept_quit(bool p_enable);
|
2017-01-11 20:34:32 +01:00
|
|
|
void set_quit_on_go_back(bool p_enable);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2019-12-29 16:39:24 +01:00
|
|
|
void quit(int p_exit_code = -1);
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
void set_input_as_handled();
|
2017-03-16 17:52:50 +01:00
|
|
|
bool is_input_handled();
|
2017-09-30 16:19:07 +02:00
|
|
|
_FORCE_INLINE_ float get_physics_process_time() const { return physics_process_time; }
|
2014-02-10 02:10:30 +01:00
|
|
|
_FORCE_INLINE_ float get_idle_process_time() const { return idle_process_time; }
|
|
|
|
|
2017-04-07 16:17:16 +02:00
|
|
|
#ifdef TOOLS_ENABLED
|
2017-03-05 16:44:50 +01:00
|
|
|
bool is_node_being_edited(const Node *p_node) const;
|
2017-04-07 16:17:16 +02:00
|
|
|
#else
|
|
|
|
bool is_node_being_edited(const Node *p_node) const { return false; }
|
|
|
|
#endif
|
2016-01-02 21:18:45 +01:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
void set_pause(bool p_enabled);
|
|
|
|
bool is_paused() const;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_camera(const RID &p_camera);
|
2014-02-10 02:10:30 +01:00
|
|
|
RID get_camera() const;
|
|
|
|
|
2017-04-07 16:17:16 +02:00
|
|
|
#ifdef DEBUG_ENABLED
|
2015-09-19 04:10:58 +02:00
|
|
|
void set_debug_collisions_hint(bool p_enabled);
|
|
|
|
bool is_debugging_collisions_hint() const;
|
|
|
|
|
2015-09-20 18:03:46 +02:00
|
|
|
void set_debug_navigation_hint(bool p_enabled);
|
|
|
|
bool is_debugging_navigation_hint() const;
|
2017-04-07 16:17:16 +02:00
|
|
|
#else
|
|
|
|
void set_debug_collisions_hint(bool p_enabled) {}
|
|
|
|
bool is_debugging_collisions_hint() const { return false; }
|
|
|
|
|
|
|
|
void set_debug_navigation_hint(bool p_enabled) {}
|
|
|
|
bool is_debugging_navigation_hint() const { return false; }
|
|
|
|
#endif
|
2015-09-20 18:03:46 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_debug_collisions_color(const Color &p_color);
|
2015-09-20 18:03:46 +02:00
|
|
|
Color get_debug_collisions_color() const;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_debug_collision_contact_color(const Color &p_color);
|
2015-09-20 18:03:46 +02:00
|
|
|
Color get_debug_collision_contact_color() const;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_debug_navigation_color(const Color &p_color);
|
2015-09-20 18:03:46 +02:00
|
|
|
Color get_debug_navigation_color() const;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_debug_navigation_disabled_color(const Color &p_color);
|
2015-09-20 18:03:46 +02:00
|
|
|
Color get_debug_navigation_disabled_color() const;
|
|
|
|
|
|
|
|
Ref<Material> get_debug_navigation_material();
|
|
|
|
Ref<Material> get_debug_navigation_disabled_material();
|
|
|
|
Ref<Material> get_debug_collision_material();
|
2017-06-07 23:18:55 +02:00
|
|
|
Ref<ArrayMesh> get_debug_contact_mesh();
|
2015-09-20 18:03:46 +02:00
|
|
|
|
|
|
|
int get_collision_debug_contact_count() { return collision_debug_contacts; }
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
int64_t get_frame() const;
|
2017-12-26 13:48:50 +01:00
|
|
|
int64_t get_event_count() const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
int get_node_count() const;
|
|
|
|
|
|
|
|
void queue_delete(Object *p_object);
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void get_nodes_in_group(const StringName &p_group, List<Node *> *p_list);
|
|
|
|
bool has_group(const StringName &p_identifier) const;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2019-07-10 11:54:12 +02:00
|
|
|
void set_screen_stretch(StretchMode p_mode, StretchAspect p_aspect, const Size2 &p_minsize, real_t p_shrink = 1);
|
2014-04-15 03:43:44 +02:00
|
|
|
|
2017-12-19 22:48:30 +01:00
|
|
|
void set_use_font_oversampling(bool p_oversampling);
|
|
|
|
bool is_using_font_oversampling() const;
|
|
|
|
|
2017-12-06 21:36:34 +01:00
|
|
|
//void change_scene(const String& p_path);
|
|
|
|
//Node *get_loaded_scene();
|
2014-10-28 02:54:32 +01:00
|
|
|
|
2014-10-12 07:13:22 +02:00
|
|
|
void set_edited_scene_root(Node *p_node);
|
|
|
|
Node *get_edited_scene_root() const;
|
2014-04-15 03:43:44 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_current_scene(Node *p_scene);
|
|
|
|
Node *get_current_scene() const;
|
|
|
|
Error change_scene(const String &p_path);
|
|
|
|
Error change_scene_to(const Ref<PackedScene> &p_scene);
|
2015-05-17 21:33:35 +02:00
|
|
|
Error reload_current_scene();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Ref<SceneTreeTimer> create_timer(float p_delay_sec, bool p_process_pause = true);
|
2016-08-07 02:39:50 +02:00
|
|
|
|
2015-05-17 21:33:35 +02:00
|
|
|
//used by Main::start, don't use otherwise
|
2017-03-05 16:44:50 +01:00
|
|
|
void add_current_scene(Node *p_current);
|
2015-05-17 21:33:35 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
static SceneTree *get_singleton() { return singleton; }
|
2015-05-17 21:33:35 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void drop_files(const Vector<String> &p_files, int p_from_screen = 0);
|
2019-02-06 14:57:06 +01:00
|
|
|
void global_menu_action(const Variant &p_id, const Variant &p_meta);
|
2019-03-09 03:05:59 +01:00
|
|
|
void get_argument_options(const StringName &p_function, int p_idx, List<String> *r_options) const;
|
2015-05-17 21:33:35 +02:00
|
|
|
|
2016-08-14 23:49:50 +02:00
|
|
|
//network API
|
|
|
|
|
2018-05-08 10:51:04 +02:00
|
|
|
Ref<MultiplayerAPI> get_multiplayer() const;
|
2018-06-02 14:32:30 +02:00
|
|
|
void set_multiplayer_poll_enabled(bool p_enabled);
|
|
|
|
bool is_multiplayer_poll_enabled() const;
|
2018-05-08 10:51:04 +02:00
|
|
|
void set_multiplayer(Ref<MultiplayerAPI> p_multiplayer);
|
2017-03-05 16:44:50 +01:00
|
|
|
void set_network_peer(const Ref<NetworkedMultiplayerPeer> &p_network_peer);
|
2018-01-11 23:35:12 +01:00
|
|
|
Ref<NetworkedMultiplayerPeer> get_network_peer() const;
|
2016-08-14 23:49:50 +02:00
|
|
|
bool is_network_server() const;
|
2017-03-04 11:35:44 +01:00
|
|
|
bool has_network_peer() const;
|
2016-08-19 21:48:08 +02:00
|
|
|
int get_network_unique_id() const;
|
2017-07-03 15:44:45 +02:00
|
|
|
Vector<int> get_network_connected_peers() const;
|
2017-08-23 10:43:25 +02:00
|
|
|
int get_rpc_sender_id() const;
|
2016-08-19 21:48:08 +02:00
|
|
|
|
|
|
|
void set_refuse_new_network_connections(bool p_refuse);
|
|
|
|
bool is_refusing_new_network_connections() const;
|
2016-08-14 23:49:50 +02:00
|
|
|
|
2016-10-27 16:50:26 +02:00
|
|
|
static void add_idle_callback(IdleCallback p_callback);
|
2019-06-25 03:24:07 +02:00
|
|
|
|
|
|
|
//default texture settings
|
|
|
|
|
2014-11-06 01:20:42 +01:00
|
|
|
SceneTree();
|
|
|
|
~SceneTree();
|
2014-02-10 02:10:30 +01:00
|
|
|
};
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
VARIANT_ENUM_CAST(SceneTree::StretchMode);
|
|
|
|
VARIANT_ENUM_CAST(SceneTree::StretchAspect);
|
2017-12-24 03:17:48 +01:00
|
|
|
VARIANT_ENUM_CAST(SceneTree::GroupCallFlags);
|
2014-04-15 03:43:44 +02:00
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
#endif
|