1 /**
2 A script that is executed when exporting the project.
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.editorexportplugin;
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.reference;
24 /**
25 A script that is executed when exporting the project.
26 
27 Editor export plugins are automatically activated whenever the user exports the project. Their most common use is to determine what files are being included in the exported project. For each plugin, $(D _exportBegin) is called at the beginning of the export process and then $(D _exportFile) is called for each exported file.
28 */
29 @GodotBaseClass struct EditorExportPlugin
30 {
31 	package(godot) enum string _GODOT_internal_name = "EditorExportPlugin";
32 public:
33 @nogc nothrow:
34 	union { /** */ godot_object _godot_object; /** */ Reference _GODOT_base; }
35 	alias _GODOT_base this;
36 	alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses);
37 	package(godot) __gshared bool _classBindingInitialized = false;
38 	package(godot) static struct GDNativeClassBinding
39 	{
40 		__gshared:
41 		@GodotName("_export_begin") GodotMethod!(void, PoolStringArray, bool, String, long) _exportBegin;
42 		@GodotName("_export_end") GodotMethod!(void) _exportEnd;
43 		@GodotName("_export_file") GodotMethod!(void, String, String, PoolStringArray) _exportFile;
44 		@GodotName("add_file") GodotMethod!(void, String, PoolByteArray, bool) addFile;
45 		@GodotName("add_ios_bundle_file") GodotMethod!(void, String) addIosBundleFile;
46 		@GodotName("add_ios_cpp_code") GodotMethod!(void, String) addIosCppCode;
47 		@GodotName("add_ios_embedded_framework") GodotMethod!(void, String) addIosEmbeddedFramework;
48 		@GodotName("add_ios_framework") GodotMethod!(void, String) addIosFramework;
49 		@GodotName("add_ios_linker_flags") GodotMethod!(void, String) addIosLinkerFlags;
50 		@GodotName("add_ios_plist_content") GodotMethod!(void, String) addIosPlistContent;
51 		@GodotName("add_ios_project_static_lib") GodotMethod!(void, String) addIosProjectStaticLib;
52 		@GodotName("add_shared_object") GodotMethod!(void, String, PoolStringArray) addSharedObject;
53 		@GodotName("skip") GodotMethod!(void) skip;
54 	}
55 	/// 
56 	pragma(inline, true) bool opEquals(in EditorExportPlugin other) const
57 	{ return _godot_object.ptr is other._godot_object.ptr; }
58 	/// 
59 	pragma(inline, true) typeof(null) opAssign(typeof(null) n)
60 	{ _godot_object.ptr = n; return null; }
61 	/// 
62 	pragma(inline, true) bool opEquals(typeof(null) n) const
63 	{ return _godot_object.ptr is n; }
64 	/// 
65 	size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; }
66 	mixin baseCasts;
67 	/// Construct a new instance of EditorExportPlugin.
68 	/// Note: use `memnew!EditorExportPlugin` instead.
69 	static EditorExportPlugin _new()
70 	{
71 		static godot_class_constructor constructor;
72 		if(constructor is null) constructor = _godot_api.godot_get_class_constructor("EditorExportPlugin");
73 		if(constructor is null) return typeof(this).init;
74 		return cast(EditorExportPlugin)(constructor());
75 	}
76 	@disable new(size_t s);
77 	/**
78 	Virtual method to be overridden by the user. It is called when the export starts and provides all information about the export. `features` is the list of features for the export, `is_debug` is `true` for debug builds, `path` is the target path for the exported project. `flags` is only used when running a runnable profile, e.g. when using native run on Android.
79 	*/
80 	void _exportBegin(in PoolStringArray features, in bool is_debug, in String path, in long flags)
81 	{
82 		Array _GODOT_args = Array.make();
83 		_GODOT_args.append(features);
84 		_GODOT_args.append(is_debug);
85 		_GODOT_args.append(path);
86 		_GODOT_args.append(flags);
87 		String _GODOT_method_name = String("_export_begin");
88 		this.callv(_GODOT_method_name, _GODOT_args);
89 	}
90 	/**
91 	Virtual method to be overridden by the user. Called when the export is finished.
92 	*/
93 	void _exportEnd()
94 	{
95 		Array _GODOT_args = Array.make();
96 		String _GODOT_method_name = String("_export_end");
97 		this.callv(_GODOT_method_name, _GODOT_args);
98 	}
99 	/**
100 	Virtual method to be overridden by the user. Called for each exported file, providing arguments that can be used to identify the file. `path` is the path of the file, `type` is the $(D Resource) represented by the file (e.g. $(D PackedScene)) and `features` is the list of features for the export.
101 	Calling $(D skip) inside this callback will make the file not included in the export.
102 	*/
103 	void _exportFile(in String path, in String type, in PoolStringArray features)
104 	{
105 		Array _GODOT_args = Array.make();
106 		_GODOT_args.append(path);
107 		_GODOT_args.append(type);
108 		_GODOT_args.append(features);
109 		String _GODOT_method_name = String("_export_file");
110 		this.callv(_GODOT_method_name, _GODOT_args);
111 	}
112 	/**
113 	Adds a custom file to be exported. `path` is the virtual path that can be used to load the file, `file` is the binary data of the file. If `remap` is `true`, file will not be exported, but instead remapped to the given `path`.
114 	*/
115 	void addFile(in String path, in PoolByteArray file, in bool remap)
116 	{
117 		checkClassBinding!(typeof(this))();
118 		ptrcall!(void)(GDNativeClassBinding.addFile, _godot_object, path, file, remap);
119 	}
120 	/**
121 	Adds an iOS bundle file from the given `path` to the exported project.
122 	*/
123 	void addIosBundleFile(in String path)
124 	{
125 		checkClassBinding!(typeof(this))();
126 		ptrcall!(void)(GDNativeClassBinding.addIosBundleFile, _godot_object, path);
127 	}
128 	/**
129 	Adds a C++ code to the iOS export. The final code is created from the code appended by each active export plugin.
130 	*/
131 	void addIosCppCode(in String code)
132 	{
133 		checkClassBinding!(typeof(this))();
134 		ptrcall!(void)(GDNativeClassBinding.addIosCppCode, _godot_object, code);
135 	}
136 	/**
137 	Adds a dynamic library (*.dylib, *.framework) to Linking Phase in iOS's Xcode project and embeds it into resulting binary.
138 	$(B Note:) For static libraries (*.a) works in same way as $(D addIosFramework).
139 	This method should not be used for System libraries as they are already present on the device.
140 	*/
141 	void addIosEmbeddedFramework(in String path)
142 	{
143 		checkClassBinding!(typeof(this))();
144 		ptrcall!(void)(GDNativeClassBinding.addIosEmbeddedFramework, _godot_object, path);
145 	}
146 	/**
147 	Adds a static library (*.a) or dynamic library (*.dylib, *.framework) to Linking Phase in iOS's Xcode project.
148 	*/
149 	void addIosFramework(in String path)
150 	{
151 		checkClassBinding!(typeof(this))();
152 		ptrcall!(void)(GDNativeClassBinding.addIosFramework, _godot_object, path);
153 	}
154 	/**
155 	Adds linker flags for the iOS export.
156 	*/
157 	void addIosLinkerFlags(in String flags)
158 	{
159 		checkClassBinding!(typeof(this))();
160 		ptrcall!(void)(GDNativeClassBinding.addIosLinkerFlags, _godot_object, flags);
161 	}
162 	/**
163 	Adds content for iOS Property List files.
164 	*/
165 	void addIosPlistContent(in String plist_content)
166 	{
167 		checkClassBinding!(typeof(this))();
168 		ptrcall!(void)(GDNativeClassBinding.addIosPlistContent, _godot_object, plist_content);
169 	}
170 	/**
171 	Adds a static lib from the given `path` to the iOS project.
172 	*/
173 	void addIosProjectStaticLib(in String path)
174 	{
175 		checkClassBinding!(typeof(this))();
176 		ptrcall!(void)(GDNativeClassBinding.addIosProjectStaticLib, _godot_object, path);
177 	}
178 	/**
179 	Adds a shared object with the given `tags` and destination `path`.
180 	*/
181 	void addSharedObject(in String path, in PoolStringArray tags)
182 	{
183 		checkClassBinding!(typeof(this))();
184 		ptrcall!(void)(GDNativeClassBinding.addSharedObject, _godot_object, path, tags);
185 	}
186 	/**
187 	To be called inside $(D _exportFile). Skips the current file, so it's not included in the export.
188 	*/
189 	void skip()
190 	{
191 		checkClassBinding!(typeof(this))();
192 		ptrcall!(void)(GDNativeClassBinding.skip, _godot_object);
193 	}
194 }