1 /** 2 Manages the game loop via a hierarchy of nodes. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.scenetree; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.traits; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.globalenums; 22 import godot.object; 23 import godot.classdb; 24 import godot.mainloop; 25 import godot.node; 26 import godot.packedscene; 27 import godot.scenetreetimer; 28 import godot.multiplayerapi; 29 import godot.networkedmultiplayerpeer; 30 import godot.viewport; 31 /** 32 Manages the game loop via a hierarchy of nodes. 33 34 As one of the most important classes, the $(D SceneTree) manages the hierarchy of nodes in a scene as well as scenes themselves. Nodes can be added, retrieved and removed. The whole scene tree (and thus the current scene) can be paused. Scenes can be loaded, switched and reloaded. 35 You can also use the $(D SceneTree) to organize your nodes into groups: every node can be assigned as many groups as you want to create, e.g. an "enemy" group. You can then iterate these groups or even call methods and set properties on all the group's members at once. 36 $(D SceneTree) is the default $(D MainLoop) implementation used by scenes, and is thus in charge of the game loop. 37 */ 38 @GodotBaseClass struct SceneTree 39 { 40 package(godot) enum string _GODOT_internal_name = "SceneTree"; 41 public: 42 @nogc nothrow: 43 union { /** */ godot_object _godot_object; /** */ MainLoop _GODOT_base; } 44 alias _GODOT_base this; 45 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 46 package(godot) __gshared bool _classBindingInitialized = false; 47 package(godot) static struct GDNativeClassBinding 48 { 49 __gshared: 50 @GodotName("_change_scene") GodotMethod!(void, Node) _changeScene; 51 @GodotName("_connected_to_server") GodotMethod!(void) _connectedToServer; 52 @GodotName("_connection_failed") GodotMethod!(void) _connectionFailed; 53 @GodotName("_network_peer_connected") GodotMethod!(void, long) _networkPeerConnected; 54 @GodotName("_network_peer_disconnected") GodotMethod!(void, long) _networkPeerDisconnected; 55 @GodotName("_server_disconnected") GodotMethod!(void) _serverDisconnected; 56 @GodotName("call_group") GodotMethod!(Variant, String, String, GodotVarArgs) callGroup; 57 @GodotName("call_group_flags") GodotMethod!(Variant, long, String, String, GodotVarArgs) callGroupFlags; 58 @GodotName("change_scene") GodotMethod!(GodotError, String) changeScene; 59 @GodotName("change_scene_to") GodotMethod!(GodotError, PackedScene) changeSceneTo; 60 @GodotName("create_timer") GodotMethod!(SceneTreeTimer, double, bool) createTimer; 61 @GodotName("get_current_scene") GodotMethod!(Node) getCurrentScene; 62 @GodotName("get_edited_scene_root") GodotMethod!(Node) getEditedSceneRoot; 63 @GodotName("get_frame") GodotMethod!(long) getFrame; 64 @GodotName("get_multiplayer") GodotMethod!(MultiplayerAPI) getMultiplayer; 65 @GodotName("get_network_connected_peers") GodotMethod!(PoolIntArray) getNetworkConnectedPeers; 66 @GodotName("get_network_peer") GodotMethod!(NetworkedMultiplayerPeer) getNetworkPeer; 67 @GodotName("get_network_unique_id") GodotMethod!(long) getNetworkUniqueId; 68 @GodotName("get_node_count") GodotMethod!(long) getNodeCount; 69 @GodotName("get_nodes_in_group") GodotMethod!(Array, String) getNodesInGroup; 70 @GodotName("get_root") GodotMethod!(Viewport) getRoot; 71 @GodotName("get_rpc_sender_id") GodotMethod!(long) getRpcSenderId; 72 @GodotName("has_group") GodotMethod!(bool, String) hasGroup; 73 @GodotName("has_network_peer") GodotMethod!(bool) hasNetworkPeer; 74 @GodotName("is_debugging_collisions_hint") GodotMethod!(bool) isDebuggingCollisionsHint; 75 @GodotName("is_debugging_navigation_hint") GodotMethod!(bool) isDebuggingNavigationHint; 76 @GodotName("is_input_handled") GodotMethod!(bool) isInputHandled; 77 @GodotName("is_multiplayer_poll_enabled") GodotMethod!(bool) isMultiplayerPollEnabled; 78 @GodotName("is_network_server") GodotMethod!(bool) isNetworkServer; 79 @GodotName("is_paused") GodotMethod!(bool) isPaused; 80 @GodotName("is_refusing_new_network_connections") GodotMethod!(bool) isRefusingNewNetworkConnections; 81 @GodotName("is_using_font_oversampling") GodotMethod!(bool) isUsingFontOversampling; 82 @GodotName("notify_group") GodotMethod!(void, String, long) notifyGroup; 83 @GodotName("notify_group_flags") GodotMethod!(void, long, String, long) notifyGroupFlags; 84 @GodotName("queue_delete") GodotMethod!(void, GodotObject) queueDelete; 85 @GodotName("quit") GodotMethod!(void, long) quit; 86 @GodotName("reload_current_scene") GodotMethod!(GodotError) reloadCurrentScene; 87 @GodotName("set_auto_accept_quit") GodotMethod!(void, bool) setAutoAcceptQuit; 88 @GodotName("set_current_scene") GodotMethod!(void, Node) setCurrentScene; 89 @GodotName("set_debug_collisions_hint") GodotMethod!(void, bool) setDebugCollisionsHint; 90 @GodotName("set_debug_navigation_hint") GodotMethod!(void, bool) setDebugNavigationHint; 91 @GodotName("set_edited_scene_root") GodotMethod!(void, Node) setEditedSceneRoot; 92 @GodotName("set_group") GodotMethod!(void, String, String, Variant) setGroup; 93 @GodotName("set_group_flags") GodotMethod!(void, long, String, String, Variant) setGroupFlags; 94 @GodotName("set_input_as_handled") GodotMethod!(void) setInputAsHandled; 95 @GodotName("set_multiplayer") GodotMethod!(void, MultiplayerAPI) setMultiplayer; 96 @GodotName("set_multiplayer_poll_enabled") GodotMethod!(void, bool) setMultiplayerPollEnabled; 97 @GodotName("set_network_peer") GodotMethod!(void, NetworkedMultiplayerPeer) setNetworkPeer; 98 @GodotName("set_pause") GodotMethod!(void, bool) setPause; 99 @GodotName("set_quit_on_go_back") GodotMethod!(void, bool) setQuitOnGoBack; 100 @GodotName("set_refuse_new_network_connections") GodotMethod!(void, bool) setRefuseNewNetworkConnections; 101 @GodotName("set_screen_stretch") GodotMethod!(void, long, long, Vector2, double) setScreenStretch; 102 @GodotName("set_use_font_oversampling") GodotMethod!(void, bool) setUseFontOversampling; 103 } 104 /// 105 pragma(inline, true) bool opEquals(in SceneTree other) const 106 { return _godot_object.ptr is other._godot_object.ptr; } 107 /// 108 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 109 { _godot_object.ptr = n; return null; } 110 /// 111 pragma(inline, true) bool opEquals(typeof(null) n) const 112 { return _godot_object.ptr is n; } 113 /// 114 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 115 mixin baseCasts; 116 /// Construct a new instance of SceneTree. 117 /// Note: use `memnew!SceneTree` instead. 118 static SceneTree _new() 119 { 120 static godot_class_constructor constructor; 121 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("SceneTree"); 122 if(constructor is null) return typeof(this).init; 123 return cast(SceneTree)(constructor()); 124 } 125 @disable new(size_t s); 126 /// 127 enum StretchAspect : int 128 { 129 /** 130 Fill the window with the content stretched to cover excessive space. Content may appear stretched. 131 */ 132 stretchAspectIgnore = 0, 133 /** 134 Retain the same aspect ratio by padding with black bars on either axis. This prevents distortion. 135 */ 136 stretchAspectKeep = 1, 137 /** 138 Expand vertically. Left/right black bars may appear if the window is too wide. 139 */ 140 stretchAspectKeepWidth = 2, 141 /** 142 Expand horizontally. Top/bottom black bars may appear if the window is too tall. 143 */ 144 stretchAspectKeepHeight = 3, 145 /** 146 Expand in both directions, retaining the same aspect ratio. This prevents distortion while avoiding black bars. 147 */ 148 stretchAspectExpand = 4, 149 } 150 /// 151 enum GroupCallFlags : int 152 { 153 /** 154 Call a group with no flags (default). 155 */ 156 groupCallDefault = 0, 157 /** 158 Call a group in reverse scene order. 159 */ 160 groupCallReverse = 1, 161 /** 162 Call a group immediately (calls are normally made on idle). 163 */ 164 groupCallRealtime = 2, 165 /** 166 Call a group only once even if the call is executed many times. 167 */ 168 groupCallUnique = 4, 169 } 170 /// 171 enum StretchMode : int 172 { 173 /** 174 No stretching. 175 */ 176 stretchModeDisabled = 0, 177 /** 178 Render stretching in higher resolution (interpolated). 179 */ 180 stretchMode2d = 1, 181 /** 182 Keep the specified display resolution. No interpolation. Content may appear pixelated. 183 */ 184 stretchModeViewport = 2, 185 } 186 /// 187 enum Constants : int 188 { 189 groupCallDefault = 0, 190 stretchModeDisabled = 0, 191 stretchAspectIgnore = 0, 192 stretchMode2d = 1, 193 stretchAspectKeep = 1, 194 groupCallReverse = 1, 195 stretchModeViewport = 2, 196 groupCallRealtime = 2, 197 stretchAspectKeepWidth = 2, 198 stretchAspectKeepHeight = 3, 199 groupCallUnique = 4, 200 stretchAspectExpand = 4, 201 } 202 /** 203 204 */ 205 void _changeScene(Node arg0) 206 { 207 Array _GODOT_args = Array.make(); 208 _GODOT_args.append(arg0); 209 String _GODOT_method_name = String("_change_scene"); 210 this.callv(_GODOT_method_name, _GODOT_args); 211 } 212 /** 213 214 */ 215 void _connectedToServer() 216 { 217 Array _GODOT_args = Array.make(); 218 String _GODOT_method_name = String("_connected_to_server"); 219 this.callv(_GODOT_method_name, _GODOT_args); 220 } 221 /** 222 223 */ 224 void _connectionFailed() 225 { 226 Array _GODOT_args = Array.make(); 227 String _GODOT_method_name = String("_connection_failed"); 228 this.callv(_GODOT_method_name, _GODOT_args); 229 } 230 /** 231 232 */ 233 void _networkPeerConnected(in long arg0) 234 { 235 Array _GODOT_args = Array.make(); 236 _GODOT_args.append(arg0); 237 String _GODOT_method_name = String("_network_peer_connected"); 238 this.callv(_GODOT_method_name, _GODOT_args); 239 } 240 /** 241 242 */ 243 void _networkPeerDisconnected(in long arg0) 244 { 245 Array _GODOT_args = Array.make(); 246 _GODOT_args.append(arg0); 247 String _GODOT_method_name = String("_network_peer_disconnected"); 248 this.callv(_GODOT_method_name, _GODOT_args); 249 } 250 /** 251 252 */ 253 void _serverDisconnected() 254 { 255 Array _GODOT_args = Array.make(); 256 String _GODOT_method_name = String("_server_disconnected"); 257 this.callv(_GODOT_method_name, _GODOT_args); 258 } 259 /** 260 Calls `method` on each member of the given group. You can pass arguments to `method` by specifying them at the end of the method call. 261 $(B Note:) `method` may only have 5 arguments at most (7 arguments passed to this method in total). 262 $(B Note:) $(D callGroup) will always call methods with an one-frame delay, in a way similar to $(D GodotObject.callDeferred). To call methods immediately, use $(D callGroupFlags) with the $(D constant GROUP_CALL_REALTIME) flag. 263 */ 264 Variant callGroup(VarArgs...)(in String group, in String method, VarArgs varArgs) 265 { 266 Array _GODOT_args = Array.make(); 267 _GODOT_args.append(group); 268 _GODOT_args.append(method); 269 foreach(vai, VA; VarArgs) 270 { 271 _GODOT_args.append(varArgs[vai]); 272 } 273 String _GODOT_method_name = String("call_group"); 274 return this.callv(_GODOT_method_name, _GODOT_args); 275 } 276 /** 277 Calls `method` on each member of the given group, respecting the given $(D groupcallflags). You can pass arguments to `method` by specifying them at the end of the method call. 278 $(B Note:) `method` may only have 5 arguments at most (8 arguments passed to this method in total). 279 $(B Note:) Group call flags are used to control the method calling behavior. If the $(D constant GROUP_CALL_REALTIME) flag is present in the `flags` argument, methods will be called immediately. If this flag isn't present in `flags`, methods will be called with a one-frame delay in a way similar to $(D callGroup). 280 */ 281 Variant callGroupFlags(VarArgs...)(in long flags, in String group, in String method, VarArgs varArgs) 282 { 283 Array _GODOT_args = Array.make(); 284 _GODOT_args.append(flags); 285 _GODOT_args.append(group); 286 _GODOT_args.append(method); 287 foreach(vai, VA; VarArgs) 288 { 289 _GODOT_args.append(varArgs[vai]); 290 } 291 String _GODOT_method_name = String("call_group_flags"); 292 return this.callv(_GODOT_method_name, _GODOT_args); 293 } 294 /** 295 Changes the running scene to the one at the given `path`, after loading it into a $(D PackedScene) and creating a new instance. 296 Returns $(D constant OK) on success, $(D constant ERR_CANT_OPEN) if the `path` cannot be loaded into a $(D PackedScene), or $(D constant ERR_CANT_CREATE) if that scene cannot be instantiated. 297 $(B Note:) The scene change is deferred, which means that the new scene node is added on the next idle frame. You won't be able to access it immediately after the $(D changeScene) call. 298 */ 299 GodotError changeScene(in String path) 300 { 301 checkClassBinding!(typeof(this))(); 302 return ptrcall!(GodotError)(GDNativeClassBinding.changeScene, _godot_object, path); 303 } 304 /** 305 Changes the running scene to a new instance of the given $(D PackedScene). 306 Returns $(D constant OK) on success or $(D constant ERR_CANT_CREATE) if the scene cannot be instantiated. 307 $(B Note:) The scene change is deferred, which means that the new scene node is added on the next idle frame. You won't be able to access it immediately after the $(D changeSceneTo) call. 308 */ 309 GodotError changeSceneTo(PackedScene packed_scene) 310 { 311 checkClassBinding!(typeof(this))(); 312 return ptrcall!(GodotError)(GDNativeClassBinding.changeSceneTo, _godot_object, packed_scene); 313 } 314 /** 315 Returns a $(D SceneTreeTimer) which will $(D SceneTreeTimer.timeout) after the given time in seconds elapsed in this $(D SceneTree). If `pause_mode_process` is set to `false`, pausing the $(D SceneTree) will also pause the timer. 316 Commonly used to create a one-shot delay timer as in the following example: 317 318 319 func some_function(): 320 print("start") 321 yield(get_tree().create_timer(1.0), "timeout") 322 print("end") 323 324 325 The timer will be automatically freed after its time elapses. 326 */ 327 Ref!SceneTreeTimer createTimer(in double time_sec, in bool pause_mode_process = true) 328 { 329 checkClassBinding!(typeof(this))(); 330 return ptrcall!(SceneTreeTimer)(GDNativeClassBinding.createTimer, _godot_object, time_sec, pause_mode_process); 331 } 332 /** 333 334 */ 335 Node getCurrentScene() const 336 { 337 checkClassBinding!(typeof(this))(); 338 return ptrcall!(Node)(GDNativeClassBinding.getCurrentScene, _godot_object); 339 } 340 /** 341 342 */ 343 Node getEditedSceneRoot() const 344 { 345 checkClassBinding!(typeof(this))(); 346 return ptrcall!(Node)(GDNativeClassBinding.getEditedSceneRoot, _godot_object); 347 } 348 /** 349 Returns the current frame number, i.e. the total frame count since the application started. 350 */ 351 long getFrame() const 352 { 353 checkClassBinding!(typeof(this))(); 354 return ptrcall!(long)(GDNativeClassBinding.getFrame, _godot_object); 355 } 356 /** 357 358 */ 359 Ref!MultiplayerAPI getMultiplayer() const 360 { 361 checkClassBinding!(typeof(this))(); 362 return ptrcall!(MultiplayerAPI)(GDNativeClassBinding.getMultiplayer, _godot_object); 363 } 364 /** 365 Returns the peer IDs of all connected peers of this $(D SceneTree)'s $(D networkPeer). 366 */ 367 PoolIntArray getNetworkConnectedPeers() const 368 { 369 checkClassBinding!(typeof(this))(); 370 return ptrcall!(PoolIntArray)(GDNativeClassBinding.getNetworkConnectedPeers, _godot_object); 371 } 372 /** 373 374 */ 375 Ref!NetworkedMultiplayerPeer getNetworkPeer() const 376 { 377 checkClassBinding!(typeof(this))(); 378 return ptrcall!(NetworkedMultiplayerPeer)(GDNativeClassBinding.getNetworkPeer, _godot_object); 379 } 380 /** 381 Returns the unique peer ID of this $(D SceneTree)'s $(D networkPeer). 382 */ 383 long getNetworkUniqueId() const 384 { 385 checkClassBinding!(typeof(this))(); 386 return ptrcall!(long)(GDNativeClassBinding.getNetworkUniqueId, _godot_object); 387 } 388 /** 389 Returns the number of nodes in this $(D SceneTree). 390 */ 391 long getNodeCount() const 392 { 393 checkClassBinding!(typeof(this))(); 394 return ptrcall!(long)(GDNativeClassBinding.getNodeCount, _godot_object); 395 } 396 /** 397 Returns a list of all nodes assigned to the given group. 398 */ 399 Array getNodesInGroup(in String group) 400 { 401 checkClassBinding!(typeof(this))(); 402 return ptrcall!(Array)(GDNativeClassBinding.getNodesInGroup, _godot_object, group); 403 } 404 /** 405 406 */ 407 Viewport getRoot() const 408 { 409 checkClassBinding!(typeof(this))(); 410 return ptrcall!(Viewport)(GDNativeClassBinding.getRoot, _godot_object); 411 } 412 /** 413 Returns the sender's peer ID for the most recently received RPC call. 414 */ 415 long getRpcSenderId() const 416 { 417 checkClassBinding!(typeof(this))(); 418 return ptrcall!(long)(GDNativeClassBinding.getRpcSenderId, _godot_object); 419 } 420 /** 421 Returns `true` if the given group exists. 422 */ 423 bool hasGroup(in String name) const 424 { 425 checkClassBinding!(typeof(this))(); 426 return ptrcall!(bool)(GDNativeClassBinding.hasGroup, _godot_object, name); 427 } 428 /** 429 Returns `true` if there is a $(D networkPeer) set. 430 */ 431 bool hasNetworkPeer() const 432 { 433 checkClassBinding!(typeof(this))(); 434 return ptrcall!(bool)(GDNativeClassBinding.hasNetworkPeer, _godot_object); 435 } 436 /** 437 438 */ 439 bool isDebuggingCollisionsHint() const 440 { 441 checkClassBinding!(typeof(this))(); 442 return ptrcall!(bool)(GDNativeClassBinding.isDebuggingCollisionsHint, _godot_object); 443 } 444 /** 445 446 */ 447 bool isDebuggingNavigationHint() const 448 { 449 checkClassBinding!(typeof(this))(); 450 return ptrcall!(bool)(GDNativeClassBinding.isDebuggingNavigationHint, _godot_object); 451 } 452 /** 453 Returns `true` if the most recent $(D InputEvent) was marked as handled with $(D setInputAsHandled). 454 */ 455 bool isInputHandled() 456 { 457 checkClassBinding!(typeof(this))(); 458 return ptrcall!(bool)(GDNativeClassBinding.isInputHandled, _godot_object); 459 } 460 /** 461 462 */ 463 bool isMultiplayerPollEnabled() const 464 { 465 checkClassBinding!(typeof(this))(); 466 return ptrcall!(bool)(GDNativeClassBinding.isMultiplayerPollEnabled, _godot_object); 467 } 468 /** 469 Returns `true` if this $(D SceneTree)'s $(D networkPeer) is in server mode (listening for connections). 470 */ 471 bool isNetworkServer() const 472 { 473 checkClassBinding!(typeof(this))(); 474 return ptrcall!(bool)(GDNativeClassBinding.isNetworkServer, _godot_object); 475 } 476 /** 477 478 */ 479 bool isPaused() const 480 { 481 checkClassBinding!(typeof(this))(); 482 return ptrcall!(bool)(GDNativeClassBinding.isPaused, _godot_object); 483 } 484 /** 485 486 */ 487 bool isRefusingNewNetworkConnections() const 488 { 489 checkClassBinding!(typeof(this))(); 490 return ptrcall!(bool)(GDNativeClassBinding.isRefusingNewNetworkConnections, _godot_object); 491 } 492 /** 493 494 */ 495 bool isUsingFontOversampling() const 496 { 497 checkClassBinding!(typeof(this))(); 498 return ptrcall!(bool)(GDNativeClassBinding.isUsingFontOversampling, _godot_object); 499 } 500 /** 501 Sends the given notification to all members of the `group`. 502 */ 503 void notifyGroup(in String group, in long notification) 504 { 505 checkClassBinding!(typeof(this))(); 506 ptrcall!(void)(GDNativeClassBinding.notifyGroup, _godot_object, group, notification); 507 } 508 /** 509 Sends the given notification to all members of the `group`, respecting the given $(D groupcallflags). 510 */ 511 void notifyGroupFlags(in long call_flags, in String group, in long notification) 512 { 513 checkClassBinding!(typeof(this))(); 514 ptrcall!(void)(GDNativeClassBinding.notifyGroupFlags, _godot_object, call_flags, group, notification); 515 } 516 /** 517 Queues the given object for deletion, delaying the call to $(D GodotObject.free) to after the current frame. 518 */ 519 void queueDelete(GodotObject obj) 520 { 521 checkClassBinding!(typeof(this))(); 522 ptrcall!(void)(GDNativeClassBinding.queueDelete, _godot_object, obj); 523 } 524 /** 525 Quits the application at the end of the current iteration. A process `exit_code` can optionally be passed as an argument. If this argument is `0` or greater, it will override the $(D OS.exitCode) defined before quitting the application. 526 $(B Note:) On iOS this method doesn't work. Instead, as recommended by the iOS Human Interface Guidelines, the user is expected to close apps via the Home button. 527 */ 528 void quit(in long exit_code = -1) 529 { 530 checkClassBinding!(typeof(this))(); 531 ptrcall!(void)(GDNativeClassBinding.quit, _godot_object, exit_code); 532 } 533 /** 534 Reloads the currently active scene. 535 Returns $(D constant OK) on success, $(D constant ERR_UNCONFIGURED) if no $(D currentScene) was defined yet, $(D constant ERR_CANT_OPEN) if $(D currentScene) cannot be loaded into a $(D PackedScene), or $(D constant ERR_CANT_CREATE) if the scene cannot be instantiated. 536 */ 537 GodotError reloadCurrentScene() 538 { 539 checkClassBinding!(typeof(this))(); 540 return ptrcall!(GodotError)(GDNativeClassBinding.reloadCurrentScene, _godot_object); 541 } 542 /** 543 If `true`, the application automatically accepts quitting. Enabled by default. 544 For mobile platforms, see $(D setQuitOnGoBack). 545 */ 546 void setAutoAcceptQuit(in bool enabled) 547 { 548 checkClassBinding!(typeof(this))(); 549 ptrcall!(void)(GDNativeClassBinding.setAutoAcceptQuit, _godot_object, enabled); 550 } 551 /** 552 553 */ 554 void setCurrentScene(Node child_node) 555 { 556 checkClassBinding!(typeof(this))(); 557 ptrcall!(void)(GDNativeClassBinding.setCurrentScene, _godot_object, child_node); 558 } 559 /** 560 561 */ 562 void setDebugCollisionsHint(in bool enable) 563 { 564 checkClassBinding!(typeof(this))(); 565 ptrcall!(void)(GDNativeClassBinding.setDebugCollisionsHint, _godot_object, enable); 566 } 567 /** 568 569 */ 570 void setDebugNavigationHint(in bool enable) 571 { 572 checkClassBinding!(typeof(this))(); 573 ptrcall!(void)(GDNativeClassBinding.setDebugNavigationHint, _godot_object, enable); 574 } 575 /** 576 577 */ 578 void setEditedSceneRoot(Node scene) 579 { 580 checkClassBinding!(typeof(this))(); 581 ptrcall!(void)(GDNativeClassBinding.setEditedSceneRoot, _godot_object, scene); 582 } 583 /** 584 Sets the given `property` to `value` on all members of the given group. 585 */ 586 void setGroup(VariantArg2)(in String group, in String property, in VariantArg2 value) 587 { 588 checkClassBinding!(typeof(this))(); 589 ptrcall!(void)(GDNativeClassBinding.setGroup, _godot_object, group, property, value); 590 } 591 /** 592 Sets the given `property` to `value` on all members of the given group, respecting the given $(D groupcallflags). 593 */ 594 void setGroupFlags(VariantArg3)(in long call_flags, in String group, in String property, in VariantArg3 value) 595 { 596 checkClassBinding!(typeof(this))(); 597 ptrcall!(void)(GDNativeClassBinding.setGroupFlags, _godot_object, call_flags, group, property, value); 598 } 599 /** 600 Marks the most recent $(D InputEvent) as handled. 601 */ 602 void setInputAsHandled() 603 { 604 checkClassBinding!(typeof(this))(); 605 ptrcall!(void)(GDNativeClassBinding.setInputAsHandled, _godot_object); 606 } 607 /** 608 609 */ 610 void setMultiplayer(MultiplayerAPI multiplayer) 611 { 612 checkClassBinding!(typeof(this))(); 613 ptrcall!(void)(GDNativeClassBinding.setMultiplayer, _godot_object, multiplayer); 614 } 615 /** 616 617 */ 618 void setMultiplayerPollEnabled(in bool enabled) 619 { 620 checkClassBinding!(typeof(this))(); 621 ptrcall!(void)(GDNativeClassBinding.setMultiplayerPollEnabled, _godot_object, enabled); 622 } 623 /** 624 625 */ 626 void setNetworkPeer(NetworkedMultiplayerPeer peer) 627 { 628 checkClassBinding!(typeof(this))(); 629 ptrcall!(void)(GDNativeClassBinding.setNetworkPeer, _godot_object, peer); 630 } 631 /** 632 633 */ 634 void setPause(in bool enable) 635 { 636 checkClassBinding!(typeof(this))(); 637 ptrcall!(void)(GDNativeClassBinding.setPause, _godot_object, enable); 638 } 639 /** 640 If `true`, the application quits automatically on going back (e.g. on Android). Enabled by default. 641 To handle 'Go Back' button when this option is disabled, use $(D constant MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST). 642 */ 643 void setQuitOnGoBack(in bool enabled) 644 { 645 checkClassBinding!(typeof(this))(); 646 ptrcall!(void)(GDNativeClassBinding.setQuitOnGoBack, _godot_object, enabled); 647 } 648 /** 649 650 */ 651 void setRefuseNewNetworkConnections(in bool refuse) 652 { 653 checkClassBinding!(typeof(this))(); 654 ptrcall!(void)(GDNativeClassBinding.setRefuseNewNetworkConnections, _godot_object, refuse); 655 } 656 /** 657 Configures screen stretching to the given $(D stretchmode), $(D stretchaspect), minimum size and `shrink` ratio. 658 */ 659 void setScreenStretch(in long mode, in long aspect, in Vector2 minsize, in double shrink = 1) 660 { 661 checkClassBinding!(typeof(this))(); 662 ptrcall!(void)(GDNativeClassBinding.setScreenStretch, _godot_object, mode, aspect, minsize, shrink); 663 } 664 /** 665 666 */ 667 void setUseFontOversampling(in bool enable) 668 { 669 checkClassBinding!(typeof(this))(); 670 ptrcall!(void)(GDNativeClassBinding.setUseFontOversampling, _godot_object, enable); 671 } 672 /** 673 The current scene. 674 */ 675 @property Node currentScene() 676 { 677 return getCurrentScene(); 678 } 679 /// ditto 680 @property void currentScene(Node v) 681 { 682 setCurrentScene(v); 683 } 684 /** 685 If `true`, collision shapes will be visible when running the game from the editor for debugging purposes. 686 */ 687 @property bool debugCollisionsHint() 688 { 689 return isDebuggingCollisionsHint(); 690 } 691 /// ditto 692 @property void debugCollisionsHint(bool v) 693 { 694 setDebugCollisionsHint(v); 695 } 696 /** 697 If `true`, navigation polygons will be visible when running the game from the editor for debugging purposes. 698 */ 699 @property bool debugNavigationHint() 700 { 701 return isDebuggingNavigationHint(); 702 } 703 /// ditto 704 @property void debugNavigationHint(bool v) 705 { 706 setDebugNavigationHint(v); 707 } 708 /** 709 The root of the edited scene. 710 */ 711 @property Node editedSceneRoot() 712 { 713 return getEditedSceneRoot(); 714 } 715 /// ditto 716 @property void editedSceneRoot(Node v) 717 { 718 setEditedSceneRoot(v); 719 } 720 /** 721 The default $(D MultiplayerAPI) instance for this $(D SceneTree). 722 */ 723 @property MultiplayerAPI multiplayer() 724 { 725 return getMultiplayer(); 726 } 727 /// ditto 728 @property void multiplayer(MultiplayerAPI v) 729 { 730 setMultiplayer(v); 731 } 732 /** 733 If `true` (default value), enables automatic polling of the $(D MultiplayerAPI) for this SceneTree during $(D idleFrame). 734 If `false`, you need to manually call $(D MultiplayerAPI.poll) to process network packets and deliver RPCs/RSETs. This allows running RPCs/RSETs in a different loop (e.g. physics, thread, specific time step) and for manual $(D Mutex) protection when accessing the $(D MultiplayerAPI) from threads. 735 */ 736 @property bool multiplayerPoll() 737 { 738 return isMultiplayerPollEnabled(); 739 } 740 /// ditto 741 @property void multiplayerPoll(bool v) 742 { 743 setMultiplayerPollEnabled(v); 744 } 745 /** 746 The peer object to handle the RPC system (effectively enabling networking when set). Depending on the peer itself, the $(D SceneTree) will become a network server (check with $(D isNetworkServer)) and will set the root node's network mode to master, or it will become a regular peer with the root node set to puppet. All child nodes are set to inherit the network mode by default. Handling of networking-related events (connection, disconnection, new clients) is done by connecting to $(D SceneTree)'s signals. 747 */ 748 @property NetworkedMultiplayerPeer networkPeer() 749 { 750 return getNetworkPeer(); 751 } 752 /// ditto 753 @property void networkPeer(NetworkedMultiplayerPeer v) 754 { 755 setNetworkPeer(v); 756 } 757 /** 758 If `true`, the $(D SceneTree) is paused. Doing so will have the following behavior: 759 - 2D and 3D physics will be stopped. 760 - $(D Node._process), $(D Node._physicsProcess) and $(D Node._input) will not be called anymore in nodes. 761 */ 762 @property bool paused() 763 { 764 return isPaused(); 765 } 766 /// ditto 767 @property void paused(bool v) 768 { 769 setPause(v); 770 } 771 /** 772 If `true`, the $(D SceneTree)'s $(D networkPeer) refuses new incoming connections. 773 */ 774 @property bool refuseNewNetworkConnections() 775 { 776 return isRefusingNewNetworkConnections(); 777 } 778 /// ditto 779 @property void refuseNewNetworkConnections(bool v) 780 { 781 setRefuseNewNetworkConnections(v); 782 } 783 /** 784 The $(D SceneTree)'s root $(D Viewport). 785 */ 786 @property Viewport root() 787 { 788 return getRoot(); 789 } 790 /** 791 If `true`, font oversampling is used. 792 */ 793 @property bool useFontOversampling() 794 { 795 return isUsingFontOversampling(); 796 } 797 /// ditto 798 @property void useFontOversampling(bool v) 799 { 800 setUseFontOversampling(v); 801 } 802 }