1 /** 2 Creates a new $(D Resource) or loads one from the filesystem. 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.visualscriptpreload; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.meta; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.object; 22 import godot.classdb; 23 import godot.visualscriptnode; 24 import godot.resource; 25 import godot.reference; 26 /** 27 Creates a new $(D Resource) or loads one from the filesystem. 28 29 $(B Input Ports:) 30 none 31 $(B Output Ports:) 32 - Data (object): `res` 33 */ 34 @GodotBaseClass struct VisualScriptPreload 35 { 36 enum string _GODOT_internal_name = "VisualScriptPreload"; 37 public: 38 @nogc nothrow: 39 union { godot_object _godot_object; VisualScriptNode _GODOT_base; } 40 alias _GODOT_base this; 41 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 42 package(godot) __gshared bool _classBindingInitialized = false; 43 package(godot) static struct _classBinding 44 { 45 __gshared: 46 @GodotName("set_preload") GodotMethod!(void, Resource) setPreload; 47 @GodotName("get_preload") GodotMethod!(Resource) getPreload; 48 } 49 bool opEquals(in VisualScriptPreload other) const { return _godot_object.ptr is other._godot_object.ptr; } 50 VisualScriptPreload opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 51 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 52 mixin baseCasts; 53 static VisualScriptPreload _new() 54 { 55 static godot_class_constructor constructor; 56 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("VisualScriptPreload"); 57 if(constructor is null) return typeof(this).init; 58 return cast(VisualScriptPreload)(constructor()); 59 } 60 @disable new(size_t s); 61 /** 62 63 */ 64 void setPreload(Resource resource) 65 { 66 checkClassBinding!(typeof(this))(); 67 ptrcall!(void)(_classBinding.setPreload, _godot_object, resource); 68 } 69 /** 70 71 */ 72 Ref!Resource getPreload() const 73 { 74 checkClassBinding!(typeof(this))(); 75 return ptrcall!(Resource)(_classBinding.getPreload, _godot_object); 76 } 77 /** 78 The $(D Resource) to load. 79 */ 80 @property Resource resource() 81 { 82 return getPreload(); 83 } 84 /// ditto 85 @property void resource(Resource v) 86 { 87 setPreload(v); 88 } 89 }