Skip to content

Commit

Permalink
- added vertex sharing option to UI
Browse files Browse the repository at this point in the history
- vertex sharing on by default
  • Loading branch information
jasonm-unity committed Jul 5, 2017
1 parent f575ddc commit 9da2a3b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
Expand Up @@ -22,6 +22,8 @@ public override void OnInspectorGUI()
AddBoolProperty(serSettings.FindPropertyRelative(() => settings.m_swapHandedness), "Swap handedness", "");
AddBoolProperty(serSettings.FindPropertyRelative(() => settings.m_swapFaceWinding), "Swap face winding", "");
AddBoolProperty(serSettings.FindPropertyRelative(() => settings.m_submeshPerUVTile), "Submesh per UV tile", "");
AddBoolProperty(serSettings.FindPropertyRelative(() => settings.m_shareVertices), "Merge Vertices (experimental)", "Allow vertex sharing between faces when possible.");
AddBoolProperty(serSettings.FindPropertyRelative(() => settings.m_treatVertexExtraDataAsStatics), "Vertex extra data is static (exp.)", "When set, UV's/normals/tangents are fetched from file only on topology change event.");

AddEnumProperty(serSettings.FindPropertyRelative(() => settings.m_normalsMode), "Normals mode", "", settings.m_normalsMode.GetType());
AddEnumProperty(serSettings.FindPropertyRelative(() => settings.m_tangentsMode), "Tangent mode", "", settings.m_tangentsMode.GetType());
Expand Down
Expand Up @@ -86,9 +86,19 @@ public void OnGUI()
});
AlembicUI.AddHorzLine(() =>
{
m_ImportSettings.m_submeshPerUVTile = EditorGUILayout.Toggle("Submesh per UV tile",
m_ImportSettings.m_submeshPerUVTile);
m_ImportSettings.m_submeshPerUVTile = EditorGUILayout.Toggle("Submesh per UV tile", m_ImportSettings.m_submeshPerUVTile);
});

AlembicUI.AddHorzLine(() =>
{
m_ImportSettings.m_shareVertices = EditorGUILayout.Toggle("Merge Vertices (experimental)", m_ImportSettings.m_shareVertices);
});

AlembicUI.AddHorzLine(() =>
{
m_ImportSettings.m_treatVertexExtraDataAsStatics = EditorGUILayout.Toggle("Vertex extra data is static (experimental)", m_ImportSettings.m_treatVertexExtraDataAsStatics);
});

AlembicUI.AddHorzLine(() =>
{
string[] enumNamesList = System.Enum.GetNames(typeof(AbcAPI.aiNormalsMode));
Expand Down
4 changes: 4 additions & 0 deletions AlembicImporter/Assets/UTJ/Alembic/Scripts/Importer/AbcAPI.cs
Expand Up @@ -136,6 +136,8 @@ public struct aiConfig
public Bool useThreads;
public int cacheSamples;
public Bool submeshPerUVTile;
public Bool shareVertices;
public Bool treatVertexExtraDataAsStatics;

public void SetDefaults()
{
Expand All @@ -149,6 +151,8 @@ public void SetDefaults()
useThreads = true;
cacheSamples = 0;
submeshPerUVTile = false;
shareVertices = true;
treatVertexExtraDataAsStatics = true;
}
}

Expand Down
Expand Up @@ -28,6 +28,8 @@ public class AlembicImportSettings
[SerializeField] public bool m_swapHandedness = true;
[SerializeField] public bool m_swapFaceWinding = false;
[SerializeField] public bool m_submeshPerUVTile = false;
[SerializeField] public bool m_shareVertices = true;
[SerializeField] public bool m_treatVertexExtraDataAsStatics = true;
[SerializeField] public bool m_importMeshes = true;
[SerializeField] public AbcAPI.aiNormalsMode m_normalsMode = AbcAPI.aiNormalsMode.ComputeIfMissing;
[SerializeField] public AbcAPI.aiTangentsMode m_tangentsMode = AbcAPI.aiTangentsMode.None;
Expand Down
Expand Up @@ -41,6 +41,7 @@ private bool AbcIsValid()
private void AbcSyncConfig()
{
m_config.swapHandedness = ImportSettings.m_swapHandedness;
m_config.shareVertices = ImportSettings.m_shareVertices;
m_config.swapFaceWinding = ImportSettings.m_swapFaceWinding;
m_config.normalsMode = ImportSettings.m_normalsMode;
m_config.tangentsMode = ImportSettings.m_tangentsMode;
Expand All @@ -50,6 +51,7 @@ private void AbcSyncConfig()
m_config.useThreads = ImportSettings.m_useThreads;
m_config.cacheSamples = ImportSettings.m_sampleCacheSize;
m_config.submeshPerUVTile = ImportSettings.m_submeshPerUVTile;
m_config.treatVertexExtraDataAsStatics = ImportSettings.m_treatVertexExtraDataAsStatics;

if (AbcIsValid())
{
Expand Down

0 comments on commit 9da2a3b

Please sign in to comment.