summaryrefslogtreecommitdiff
path: root/Runtime/Serialize/SerializationMetaFlags.h
blob: fc47207409124e8831ff99934e04c39223ddedf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
#ifndef SERIALIZATIONMETAFLAGS_H
#define SERIALIZATIONMETAFLAGS_H

#include "Runtime/Utilities/EnumFlags.h"

/// Meta flags can be used like this:
/// transfer.Transfer (someVar, "varname", kHideInEditorMask);
/// The proxytransfer for example reads the metaflag mask and stores it in the TypeTree
enum TransferMetaFlags
{	
	kNoTransferFlags        = 0,
	/// Putting this mask in a transfer will make the variable be hidden in the property editor
	kHideInEditorMask		= 1 << 0,

	/// Makes a variable not editable in the property editor
	kNotEditableMask     = 1 << 4,
	
	/// There are 3 types of PPtrs: kStrongPPtrMask, default (weak pointer)
	/// a Strong PPtr forces the referenced object to be cloned.
	/// A Weak PPtr doesnt clone the referenced object, but if the referenced object is being cloned anyway (eg. If another (strong) pptr references this object)
	/// this PPtr will be remapped to the cloned object
	/// If an  object  referenced by a WeakPPtr is not cloned, it will stay the same when duplicating and cloning, but be NULLed when templating
	kStrongPPtrMask     = 1 << 6,
	// unused  = 1 << 7,
	
	/// kEditorDisplaysCheckBoxMask makes an integer variable appear as a checkbox in the editor
	kEditorDisplaysCheckBoxMask = 1 << 8,

	// unused = 1 << 9,
	// unused = 1 << 10,

	/// Show in simplified editor
	kSimpleEditorMask = 1 << 11,
	
	/// When the options of a serializer tells you to serialize debug properties kSerializeDebugProperties
	/// All debug properties have to be marked kDebugPropertyMask
	/// Debug properties are shown in expert mode in the inspector but are not serialized normally
	kDebugPropertyMask = 1 << 12,

	kAlignBytesFlag = 1 << 14,
	kAnyChildUsesAlignBytesFlag = 1 << 15,
	kIgnoreWithInspectorUndoMask= 1 << 16,

	// unused = 1 << 18,
	
	// Ignore this property when reading or writing .meta files
	kIgnoreInMetaFiles = 1 << 19,
	
	// When reading meta files and this property is not present, read array entry name instead (for backwards compatibility).
	kTransferAsArrayEntryNameInMetaFiles = 1 << 20,

	// When writing YAML Files, uses the flow mapping style (all properties in one line, with "{}").
	kTransferUsingFlowMappingStyle = 1 << 21,
	
	// Tells SerializedProperty to generate bitwise difference information for this field.
	kGenerateBitwiseDifferences = 1 << 22,

	kDontAnimate     = 1 << 23,

};
ENUM_FLAGS(TransferMetaFlags);

enum TransferInstructionFlags
{
	kNoTransferInstructionFlags = 0,
	
	kNeedsInstanceIDRemapping = 1 << 0, // Should we convert PPtrs into pathID, fileID using the PerisistentManager or should we just store the memory InstanceID in the fileID?
	kAssetMetaDataOnly = 1 << 1, // Only serialize data needed for .meta files
	kYamlGlobalPPtrReference = 1 << 2,
	#if UNITY_EDITOR
	kLoadAndUnloadAssetsDuringBuild = 1 << 3,
	kSerializeDebugProperties = 1 << 4, // Should we serialize debug properties (eg. Serialize mono private variables)
	#endif
	kIgnoreDebugPropertiesForIndex = 1 << 5, // Should we ignore Debug properties when calculating the TypeTree index
	#if UNITY_EDITOR
	kBuildPlayerOnlySerializeBuildProperties = 1 << 6, // Used by eg. build player to make materials cull any properties are aren't used anymore !
	#endif
	kWorkaround35MeshSerializationFuckup = 1 << 7,
	
	kSerializeGameRelease = 1 << 8, // Should Transfer classes use optimized reading. Allowing them to read memory directly that normally has a type using ReadDirect.
	kSwapEndianess = 1 << 9, // Should we swap endianess when reading / writing a file
	kSaveGlobalManagers = 1 << 10, // Should global managers be saved when writing the game build
	kDontReadObjectsFromDiskBeforeWriting = 1 << 11,
	kSerializeMonoReload = 1 << 12, // Should we backupmono mono variables for an assembly reload?
	kDontRequireAllMetaFlags = 1 << 13, // Can we fast path calculating all meta data. This lets us skip a bunch of code when serializing mono data.
	kSerializeForPrefabSystem = 1 << 14,
	#if UNITY_EDITOR
	kWarnAboutLeakedObjects = 1 << 15,
	// Unused = 1 << 16,
	// Unused = 1 << 17,
	kEditorPlayMode = 1 << 18,
	kBuildResourceImage = 1 << 19,
	kSerializeEditorMinimalScene = 1 << 21,
	kGenerateBakedPhysixMeshes = 1 << 22,
	#endif
	kThreadedSerialization = 1 << 23,
	kIsBuiltinResourcesFile = 1 << 24,
	kPerformUnloadDependencyTracking		= 1 << 25,
	kDisableWriteTypeTree = 1 << 26,
	kAutoreplaceEditorWindow = 1 << 27,// Editor only
	kSerializeForInspector = 1 << 29,
	kSerializedAssetBundleVersion = 1 << 30, // When writing (typetrees disabled), allow later Unity versions an attempt to read SerializedFile.
	kAllowTextSerialization = 1 << 31
};
ENUM_FLAGS(TransferInstructionFlags);

enum BuildAssetBundleOptions
{
	kAssetBundleUncompressed = 1 << 11,
	kAssetBundleCollectDependencies = 1 << 20,
	kAssetBundleIncludeCompleteAssets = 1 << 21,
	kAssetBundleDisableWriteTypeTree = 1 << 26,
	kAssetBundleDeterministic = 1 << 28,
};
ENUM_FLAGS(BuildAssetBundleOptions);


enum ActiveResourceImage
{
	kResourceImageNotSupported = -2,
	kResourceImageInactive = -1,
	kGPUResourceImage = 0,
	kResourceImage = 1,
	kStreamingResourceImage = 2,
	kNbResourceImages = 3
};

/// This needs to be in Sync with BuildTarget in C#
enum BuildTargetPlatform
{
	kBuildNoTargetPlatform = -2,
	kBuildAnyPlayerData = -1,
	kBuildValidPlayer = 1,
	
	// We don't support building for these any more, but we still need the constants for asset bundle
	// backwards compatibility.
	kBuildStandaloneOSXPPC = 3,
	
	kBuildStandaloneOSXIntel = 4,
	kBuildStandaloneOSXIntel64 = 27,
	kBuildStandaloneOSXUniversal = 2,
	kBuildStandaloneWinPlayer = 5,
	kBuildWebPlayerLZMA = 6,
	kBuildWebPlayerLZMAStreamed = 7,
	kBuildWii = 8,
	kBuild_iPhone = 9,
	kBuildPS3 = 10,
	kBuildXBOX360 = 11,
	// was kBuild_Broadcom = 12,
	kBuild_Android = 13,
	kBuildWinGLESEmu = 14,
	// was kBuildWinGLES20Emu = 15,
	kBuildNaCl = 16,
    kBuildStandaloneLinux = 17,
	kBuildFlash = 18,
	kBuildStandaloneWin64Player = 19,
	kBuildWebGL = 20,
	kBuildMetroPlayerX86 = 21,
	kBuildMetroPlayerX64 = 22,
	kBuildMetroPlayerARM = 23,
	kBuildStandaloneLinux64 = 24,
	kBuildStandaloneLinuxUniversal = 25,	
	kBuildWP8Player = 26,
	kBuildBB10 = 28,
	kBuildTizen = 29,
	kBuildPlayerTypeCount = 30,
};

struct BuildUsageTag
{
	bool   forceTextureReadable;
	bool   strippedPrefabObject;
	UInt32 meshUsageFlags;
	UInt32 meshSupportedChannels;
	
	BuildUsageTag ()
	{
		forceTextureReadable = false;
		meshUsageFlags = 0;
		meshSupportedChannels = 0;
		strippedPrefabObject = false;
	}
};


struct BuildTargetSelection
{
	BuildTargetPlatform platform;
	int subTarget;

	BuildTargetSelection() : platform(kBuildNoTargetPlatform), subTarget(0) { }
	BuildTargetSelection(BuildTargetPlatform platform_, int subTarget_) : platform(platform_), subTarget(subTarget_) {}

	bool operator == (const BuildTargetSelection& rhs) const
	{
		if (platform != rhs.platform)
			return false;
		if (subTarget != rhs.subTarget)
			return false;

		return true;
	}
	bool operator != (const BuildTargetSelection& rhs) const
	{
		return ! operator == (rhs);
	}

	static BuildTargetSelection NoTarget() { return BuildTargetSelection(kBuildNoTargetPlatform,0); }
};


enum WebPlayerBuildSubTarget
{
	kWebBuildSubtargetDefault = 0,
	kWebBuildSubtargetDirect3D = 1, // windows only (D3D9 & D3D11)
	kWebBuildSubtargetOpenGL = 2, // non-windows only (OpenGL)
};


/// This needs to be in Sync with XboxRunMethod in C#
enum XboxBuildSubtarget
{
	kXboxBuildSubtargetDevelopment = 0,
	kXboxBuildSubtargetMaster = 1,
	kXboxBuildSubtargetDebug = 2
};

/// This needs to be in Sync with WiiBuildDebugLevel in C#
enum WiiBuildDebugLevel
{
	kWiiBuildDebugLevel_Full = 0,
	kWiiBuildDebugLevel_Minimal = 1,
	kWiiBuildDebugLevel_None = 2,
};

/// This needs to be in Sync with XboxRunMethod in C#
enum XboxRunMethod
{
	kXboxRunMethodHDD = 0,
	kXboxRunMethodDiscEmuFast = 1,
	kXboxRunMethodDiscEmuAccurate = 2
};

/// This needs to be in Sync with AndroidBuildSubtarget in C#
enum AndroidBuildSubtarget
{
	kAndroidBuildSubtarget_Generic = 0,
	kAndroidBuildSubtarget_DXT = 1,
	kAndroidBuildSubtarget_PVRTC = 2,
	kAndroidBuildSubtarget_ATC = 3,
	kAndroidBuildSubtarget_ETC = 4,
	kAndroidBuildSubtarget_ETC2 = 5,
	kAndroidBuildSubtarget_ASTC = 6,
};

/// This needs to be in Sync with BB10BuildSubtarget in C#
enum BlackBerryBuildSubtarget
{
	kBlackBerryBuildSubtarget_Generic = 0,
	kBlackBerryBuildSubtarget_PVRTC = 1,
	kBlackBerryBuildSubtarget_ATC = 2,
	kBlackBerryBuildSubtarget_ETC = 3
};

/// This needs to be in Sync with BB10BuildType in C#
enum BlackBerryBuildType
{
	kBlackBerryBuildType_Debug = 0,
	kBlackBerryBuildType_Submission = 1
};

/// This needs to be in Sync with BuildOptions in C#
enum BuildPlayerOptions
{
	kBuildPlayerOptionsNone = 0,
	kDevelopmentBuild = 1 << 0,
	kAutoRun = 1 << 2,
	kSelectBuiltPlayer = 1 << 3,
	kBuildAdditionalStreamedScenes = 1 << 4,
	kAcceptExternalModificationsToPlayer = 1 << 5,
	kInstallInBuildsFolder = 1 << 6,
	kWebPlayerOfflineDeployment = 1 << 7,
	kConnectWithProfiler = 1 << 8,
	kAllowDebugging = 1 << 9,
	kSymlinkLibraries = 1 << 10,
	kBuildPlayerUncompressed = 1 << 11,
	kConnectToHost = 1 << 12,
	kDeployOnline = 1 << 13,
	kHeadlessModeEnabled = 1 << 14
};

#endif