Skip to content

Commit

Permalink
Merge pull request #3 from prefrontalcortex/master
Browse files Browse the repository at this point in the history
Feat: Ability to generate lightmap UVs
  • Loading branch information
keijiro authored Nov 23, 2021
2 parents 7aa1b72 + facfe23 commit 0e7860d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Packages/jp.keijiro.metamesh/Editor/MetameshImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public sealed class MetameshImporter : ScriptedImporter
[SerializeField] RoundedBox _roundedBox = new RoundedBox();
[SerializeField] Ring _ring = new Ring();
[SerializeField] Disc _disc = new Disc();
[SerializeField] bool _generateLightmapUVs = false;

public override void OnImportAsset(AssetImportContext context)
{
Expand Down Expand Up @@ -63,6 +64,7 @@ Mesh ImportAsMesh(string path)
}

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

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

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

public override void OnInspectorGUI()
Expand All @@ -53,6 +55,8 @@ public override void OnInspectorGUI()
case Shape.Disc : EditorGUILayout.PropertyField(_disc); break;
}

EditorGUILayout.PropertyField(_generateLightmapUVs);

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

0 comments on commit 0e7860d

Please sign in to comment.