Skip to content

Commit

Permalink
Merge pull request #5 from prefrontalcortex/feat-meshes-readable
Browse files Browse the repository at this point in the history
feat: Ability to keep meshes readable
  • Loading branch information
keijiro authored May 2, 2022
2 parents 00cf950 + 8a80010 commit 361b556
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Packages/jp.keijiro.metamesh/Editor/MetameshImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public sealed class MetameshImporter : ScriptedImporter
[SerializeField] Ring _ring = new Ring();
[SerializeField] Disc _disc = new Disc();
[SerializeField] bool _generateLightmapUVs = false;
[SerializeField] bool _readWriteMeshes = false;

public override void OnImportAsset(AssetImportContext context)
{
Expand Down Expand Up @@ -65,7 +66,7 @@ Mesh ImportAsMesh(string path)

mesh.RecalculateBounds();
if(_generateLightmapUVs) Unwrapping.GenerateSecondaryUVSet(mesh);
mesh.UploadMeshData(true);
mesh.UploadMeshData(!_readWriteMeshes);

return mesh;
}
Expand Down
3 changes: 3 additions & 0 deletions Packages/jp.keijiro.metamesh/Editor/MetameshImporterEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ sealed class MetameshImporterEditor : ScriptedImporterEditor
SerializedProperty _ring;
SerializedProperty _disc;
SerializedProperty _generateLightmapUVs;
SerializedProperty _readWriteMeshes;

public override void OnEnable()
{
Expand All @@ -35,6 +36,7 @@ public override void OnEnable()
_ring = serializedObject.FindProperty("_ring");
_disc = serializedObject.FindProperty("_disc");
_generateLightmapUVs = serializedObject.FindProperty("_generateLightmapUVs");
_readWriteMeshes = serializedObject.FindProperty("_readWriteMeshes");
}

public override void OnInspectorGUI()
Expand All @@ -56,6 +58,7 @@ public override void OnInspectorGUI()
}

EditorGUILayout.PropertyField(_generateLightmapUVs);
EditorGUILayout.PropertyField(_readWriteMeshes);

serializedObject.ApplyModifiedProperties();
ApplyRevertGUI();
Expand Down

0 comments on commit 361b556

Please sign in to comment.