blob: 49ecf7ca59020a107376871a60c7de025138a9f8 (
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
|
using System.Reflection;
using UnityEditor;
using UnityEngine.Assertions;
namespace VRWorldToolkit
{
/// <summary>
/// Utility for setting and getting internal model importer values
/// </summary>
public static class ModelImporterUtil
{
private static readonly System.Type systemType;
private static PropertyInfo mProperty_LegacyBlendShapeNormals;
static ModelImporterUtil()
{
systemType = Assembly.Load("UnityEditor.dll").GetType("UnityEditor.ModelImporter");
Assert.IsNotNull(systemType);
}
public static bool GetLegacyBlendShapeNormals(ModelImporter importer)
{
if (mProperty_LegacyBlendShapeNormals == null)
mProperty_LegacyBlendShapeNormals = systemType.GetProperty("legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes", BindingFlags.NonPublic | BindingFlags.Instance);
Assert.IsNotNull(mProperty_LegacyBlendShapeNormals);
return (bool)mProperty_LegacyBlendShapeNormals.GetValue(importer);
}
public static void SetLegacyBlendShapeNormals(ModelImporter importer, bool value)
{
if (mProperty_LegacyBlendShapeNormals == null)
mProperty_LegacyBlendShapeNormals = systemType.GetProperty("legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes", BindingFlags.NonPublic | BindingFlags.Instance);
Assert.IsNotNull(mProperty_LegacyBlendShapeNormals);
mProperty_LegacyBlendShapeNormals.SetValue(importer, value, null);
}
}
}
|