Skip to content

Commit 73c12b5

Browse files
author
Unity Technologies
committed
Unity 2023.1.0a10 C# reference source code
1 parent 66ae70d commit 73c12b5

94 files changed

Lines changed: 1400 additions & 4331 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Editor/Mono/AssetPipeline/SpeedTreeImporter.bindings.cs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,56 @@ public bool SearchAndRemapMaterials(string materialFolderPath)
233233
return changedMappings;
234234
}
235235
}
236+
237+
class SpeedTreePostProcessor : AssetPostprocessor
238+
{
239+
private static void FixExtraTexture_sRGB(IEnumerable<UnityEngine.Object> subAssets)
240+
{
241+
AssetDatabase.StartAssetEditing();
242+
243+
foreach (var subAsset in subAssets)
244+
{
245+
if (subAsset is Material)
246+
{
247+
Material m = subAsset as Material;
248+
Texture tex = m.GetTexture("_ExtraTex");
249+
if (tex)
250+
{
251+
string texturePath = AssetDatabase.GetAssetOrScenePath(tex);
252+
TextureImporter texImporter = AssetImporter.GetAtPath(texturePath) as TextureImporter;
253+
if(texImporter)
254+
{
255+
// Multiple materials may be referencing the same ExtraTexture, therefore
256+
// we'll need to check the importer's setting and only queue a single reimport
257+
// for a given texture.
258+
if (texImporter.sRGBTexture)
259+
{
260+
texImporter.sRGBTexture = false; // extra texture does not contain color data, hence shouldn't be sRGB.
261+
texImporter.SaveAndReimport();
262+
}
263+
}
264+
}
265+
}
266+
}
267+
AssetDatabase.StopAssetEditing();
268+
}
269+
270+
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
271+
{
272+
foreach (var asset in importedAssets)
273+
{
274+
bool st8 = asset.EndsWith(".st", StringComparison.InvariantCultureIgnoreCase);
275+
if(st8)
276+
{
277+
// Check the external materials in case the user has extracted
278+
Dictionary<AssetImporter.SourceAssetIdentifier, UnityEngine.Object> externalAssets = (AssetImporter.GetAtPath(asset) as SpeedTreeImporter).GetExternalObjectMap();
279+
FixExtraTexture_sRGB(externalAssets.Values);
280+
281+
// Check the object subassets -- updates the materials if they're embedded in the SpeedTree asset
282+
UnityEngine.Object[] subAssets = AssetDatabase.LoadAllAssetsAtPath(asset);
283+
FixExtraTexture_sRGB(subAssets);
284+
}
285+
}
286+
}
287+
}
236288
}

Editor/Mono/AssetPipeline/TextureImporterEnums.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,14 @@ public enum TextureImporterFormat
217217
RG32 = 72,
218218
RGB48 = 73,
219219
RGBA64 = 74,
220+
R8_SIGNED = 75,
221+
RG16_SIGNED = 76,
222+
RGB24_SIGNED = 77,
223+
RGBA32_SIGNED = 78,
224+
R16_SIGNED = 79,
225+
RG32_SIGNED = 80,
226+
RGB48_SIGNED = 81,
227+
RGBA64_SIGNED = 82,
220228
}
221229

222230
// Mip map filter for [[TextureImporter]].

Editor/Mono/BuildPipeline/AssemblyStripper.cs

Lines changed: 68 additions & 363 deletions
Large diffs are not rendered by default.

Editor/Mono/BuildPipeline/AssemblyValidation.cs

Lines changed: 0 additions & 160 deletions
This file was deleted.

Editor/Mono/BuildPipeline/BuildUtils.cs

Lines changed: 0 additions & 157 deletions
This file was deleted.

0 commit comments

Comments
 (0)