29 #ifndef SCENE_MAIN_LOOP_H 30 #define SCENE_MAIN_LOOP_H 33 #include "os/main_loop.h" 34 #include "scene/resources/world.h" 35 #include "scene/resources/world_2d.h" 36 #include "scene/main/scene_singleton.h" 37 #include "os/thread_safe.h" 38 #include "self_list.h" 61 STRETCH_MODE_DISABLED,
63 STRETCH_MODE_VIEWPORT,
68 STRETCH_ASPECT_IGNORE,
70 STRETCH_ASPECT_KEEP_WIDTH,
71 STRETCH_ASPECT_KEEP_HEIGHT,
79 uint64_t last_tree_version;
80 Group() { last_tree_version=0; };
85 uint64_t tree_version;
86 float fixed_process_time;
87 float idle_process_time;
92 bool debug_collisions_hint;
93 bool debug_navigation_hint;
101 Size2 last_screen_size;
106 int64_t current_frame;
110 Node *edited_scene_root;
117 bool operator<(
const UGCall& p_with)
const {
return group==p_with.group?call<p_with.call:group<p_with.group; }
125 StretchMode stretch_mode;
126 StretchAspect stretch_aspect;
129 void _update_root_rect();
136 void _flush_transform_notifications();
138 void _update_group_order(Group& g);
139 void _update_listener();
145 Color debug_collisions_color;
146 Color debug_collision_contact_color;
147 Color debug_navigation_color;
148 Color debug_navigation_disabled_color;
153 int collision_debug_contacts;
155 void _change_scene(
Node* p_to);
162 void node_removed(
Node *p_node);
168 void _notify_group_pause(
const StringName& p_group,
int p_notification);
173 static void _debugger_request_tree(
void *
self);
174 void _flush_delete_queue();
195 void _live_edit_node_path_func(
const NodePath &p_path,
int p_id) ;
196 void _live_edit_res_path_func(
const String &p_path,
int p_id) ;
198 void _live_edit_node_set_func(
int p_id,
const StringName& p_prop,
const Variant& p_value) ;
199 void _live_edit_node_set_res_func(
int p_id,
const StringName& p_prop,
const String& p_value) ;
200 void _live_edit_node_call_func(
int p_id,
const StringName& p_method,VARIANT_ARG_DECLARE) ;
201 void _live_edit_res_set_func(
int p_id,
const StringName& p_prop,
const Variant& p_value) ;
202 void _live_edit_res_set_res_func(
int p_id,
const StringName& p_prop,
const String& p_value) ;
203 void _live_edit_res_call_func(
int p_id,
const StringName& p_method,VARIANT_ARG_DECLARE) ;
204 void _live_edit_root_func(
const NodePath& p_scene_path,
const String& p_scene_from) ;
206 void _live_edit_create_node_func(
const NodePath& p_parent,
const String& p_type,
const String& p_name);
207 void _live_edit_instance_node_func(
const NodePath& p_parent,
const String& p_path,
const String& p_name);
208 void _live_edit_remove_node_func(
const NodePath& p_at);
209 void _live_edit_remove_and_keep_node_func(
const NodePath& p_at,ObjectID p_keep_id);
210 void _live_edit_restore_node_func(ObjectID p_id,
const NodePath& p_at,
int p_at_pos);
211 void _live_edit_duplicate_node_func(
const NodePath& p_at,
const String& p_new_name);
212 void _live_edit_reparent_node_func(
const NodePath& p_at,
const NodePath& p_new_place,
const String& p_new_name,
int p_at_pos);
214 static void _live_edit_node_path_funcs(
void *
self,
const NodePath &p_path,
int p_id) {
reinterpret_cast<SceneTree*
>(
self)->_live_edit_node_path_func(p_path,p_id); }
215 static void _live_edit_res_path_funcs(
void *
self,
const String &p_path,
int p_id) {
reinterpret_cast<SceneTree*
>(
self)->_live_edit_res_path_func(p_path,p_id); }
217 static void _live_edit_node_set_funcs(
void *
self,
int p_id,
const StringName& p_prop,
const Variant& p_value) {
reinterpret_cast<SceneTree*
>(
self)->_live_edit_node_set_func(p_id,p_prop,p_value); }
218 static void _live_edit_node_set_res_funcs(
void *
self,
int p_id,
const StringName& p_prop,
const String& p_value) {
reinterpret_cast<SceneTree*
>(
self)->_live_edit_node_set_res_func(p_id,p_prop,p_value); }
219 static void _live_edit_node_call_funcs(
void *
self,
int p_id,
const StringName& p_method,VARIANT_ARG_DECLARE) {
reinterpret_cast<SceneTree*
>(
self)->_live_edit_node_call_func(p_id,p_method,VARIANT_ARG_PASS); }
220 static void _live_edit_res_set_funcs(
void *
self,
int p_id,
const StringName& p_prop,
const Variant& p_value) {
reinterpret_cast<SceneTree*
>(
self)->_live_edit_res_set_func(p_id,p_prop,p_value); }
221 static void _live_edit_res_set_res_funcs(
void *
self,
int p_id,
const StringName& p_prop,
const String& p_value) {
reinterpret_cast<SceneTree*
>(
self)->_live_edit_res_set_res_func(p_id,p_prop,p_value); }
222 static void _live_edit_res_call_funcs(
void *
self,
int p_id,
const StringName& p_method,VARIANT_ARG_DECLARE) {
reinterpret_cast<SceneTree*
>(
self)->_live_edit_res_call_func(p_id,p_method,VARIANT_ARG_PASS); }
223 static void _live_edit_root_funcs(
void *
self,
const NodePath& p_scene_path,
const String& p_scene_from) {
reinterpret_cast<SceneTree*
>(
self)->_live_edit_root_func(p_scene_path,p_scene_from); }
225 static void _live_edit_create_node_funcs(
void*
self,
const NodePath& p_parent,
const String& p_type,
const String& p_name) {
reinterpret_cast<SceneTree*
>(
self)->_live_edit_create_node_func(p_parent,p_type,p_name); }
226 static void _live_edit_instance_node_funcs(
void*
self,
const NodePath& p_parent,
const String& p_path,
const String& p_name) {
reinterpret_cast<SceneTree*
>(
self)->_live_edit_instance_node_func(p_parent,p_path,p_name); }
227 static void _live_edit_remove_node_funcs(
void*
self,
const NodePath& p_at) {
reinterpret_cast<SceneTree*
>(
self)->_live_edit_remove_node_func(p_at); }
228 static void _live_edit_remove_and_keep_node_funcs(
void*
self,
const NodePath& p_at,ObjectID p_keep_id) {
reinterpret_cast<SceneTree*
>(
self)->_live_edit_remove_and_keep_node_func(p_at,p_keep_id); }
229 static void _live_edit_restore_node_funcs(
void*
self,ObjectID p_id,
const NodePath& p_at,
int p_at_pos) {
reinterpret_cast<SceneTree*
>(
self)->_live_edit_restore_node_func(p_id,p_at,p_at_pos); }
230 static void _live_edit_duplicate_node_funcs(
void*
self,
const NodePath& p_at,
const String& p_new_name) {
reinterpret_cast<SceneTree*
>(
self)->_live_edit_duplicate_node_func(p_at,p_new_name); }
231 static void _live_edit_reparent_node_funcs(
void*
self,
const NodePath& p_at,
const NodePath& p_new_place,
const String& p_new_name,
int p_at_pos) {
reinterpret_cast<SceneTree*
>(
self)->_live_edit_reparent_node_func(p_at,p_new_place,p_new_name,p_at_pos); }
236 void _notification(
int p_notification);
237 static void _bind_methods();
242 NOTIFICATION_TRANSFORM_CHANGED=29
245 enum CallGroupFlags {
246 GROUP_CALL_DEFAULT=0,
247 GROUP_CALL_REVERSE=1,
248 GROUP_CALL_REALTIME=2,
250 GROUP_CALL_MULIILEVEL=8,
253 _FORCE_INLINE_
Viewport *get_root()
const {
return root; }
255 uint32_t get_last_event_id()
const;
257 void call_group(uint32_t p_call_flags,
const StringName& p_group,
const StringName& p_function,VARIANT_ARG_LIST);
258 void notify_group(uint32_t p_call_flags,
const StringName& p_group,
int p_notification);
262 virtual void input_text(
const String& p_text );
263 virtual void input_event(
const InputEvent& p_event );
266 virtual bool iteration(
float p_time);
267 virtual bool idle(
float p_time);
269 virtual void finish();
271 void set_auto_accept_quit(
bool p_enable);
275 void set_input_as_handled();
276 _FORCE_INLINE_
float get_fixed_process_time()
const {
return fixed_process_time; }
277 _FORCE_INLINE_
float get_idle_process_time()
const {
return idle_process_time; }
279 void set_editor_hint(
bool p_enabled);
280 bool is_editor_hint()
const;
282 bool is_node_being_edited(
const Node* p_node)
const;
284 void set_pause(
bool p_enabled);
285 bool is_paused()
const;
287 void set_camera(
const RID& p_camera);
288 RID get_camera()
const;
290 void set_debug_collisions_hint(
bool p_enabled);
291 bool is_debugging_collisions_hint()
const;
293 void set_debug_navigation_hint(
bool p_enabled);
294 bool is_debugging_navigation_hint()
const;
296 void set_debug_collisions_color(
const Color& p_color);
297 Color get_debug_collisions_color()
const;
299 void set_debug_collision_contact_color(
const Color& p_color);
300 Color get_debug_collision_contact_color()
const;
302 void set_debug_navigation_color(
const Color& p_color);
303 Color get_debug_navigation_color()
const;
305 void set_debug_navigation_disabled_color(
const Color& p_color);
306 Color get_debug_navigation_disabled_color()
const;
314 int get_collision_debug_contact_count() {
return collision_debug_contacts; }
316 int64_t get_frame()
const;
318 int get_node_count()
const;
320 void queue_delete(
Object *p_object);
323 bool has_group(
const StringName& p_identifier)
const;
326 void set_screen_stretch(StretchMode p_mode,StretchAspect p_aspect,
const Size2 p_minsize);
332 void set_edited_scene_root(
Node *p_node);
333 Node *get_edited_scene_root()
const;
336 void set_current_scene(
Node* p_scene);
337 Node* get_current_scene()
const;
338 Error change_scene(
const String& p_path);
340 Error reload_current_scene();
343 void add_current_scene(
Node * p_current);
345 static SceneTree* get_singleton() {
return singleton; }
354 VARIANT_ENUM_CAST( SceneTree::StretchMode );
355 VARIANT_ENUM_CAST( SceneTree::StretchAspect );
Definition: self_list.h:35
Definition: main_loop.h:38
Definition: viewport.h:75
Definition: math_2d.h:369
Definition: string_db.h:48
Definition: canvas_item.h:87
Definition: scene_main_loop.h:51
Definition: material.h:42
Definition: packed_scene.h:187
Definition: script_language.h:255
Definition: variant.h:379