Skip to content

Commit

Permalink
add validation
Browse files Browse the repository at this point in the history
  • Loading branch information
PoChang007 committed Jun 23, 2020
1 parent 93c243b commit 713083d
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Assets/MeshUtility/Editor/MeshUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,25 @@ namespace MeshUtility
public class MeshUtility : MonoBehaviour
{
private const string ASSET_SUFFIX = ".mesh.asset";
private static readonly Vector3 Zero_Movement = Vector3.zero;
private const string MENU_NAME = "Mesh Utility/Separate Skinned Meshes Contained BlendShape";
private static readonly Vector3 ZERO_MOVEMENT = Vector3.zero;

private enum BlendShapeLogic
{
WithBlendShape,
WithoutBlendShape,
}

[MenuItem("Mesh Utility/Separate Skinned Meshes Contained BlendShape")]
[MenuItem(MENU_NAME, validate = true)]
private static bool ShowLogValidation()
{
if (Selection.activeTransform == null)
return false;
else
return true;
}

[MenuItem(MENU_NAME)]
public static void SeparateSkinnedMeshContainedBlendShape()
{
var go = Selection.activeTransform.gameObject;
Expand Down Expand Up @@ -67,7 +77,7 @@ private static void SeparatePolyWithBlendShape(SkinnedMeshRenderer skinnedMeshRe

for (int j = 0; j < deltaVertices.Length; j++)
{
if (!deltaVertices[j].Equals(Zero_Movement))
if (!deltaVertices[j].Equals(ZERO_MOVEMENT))
{
if (!indicesUsedByBlendShape.Values.Contains(j))
{
Expand Down

0 comments on commit 713083d

Please sign in to comment.