Skip to content

Commit

Permalink
import
Browse files Browse the repository at this point in the history
  • Loading branch information
i-saint committed Dec 21, 2017
0 parents commit 2f21aff
Show file tree
Hide file tree
Showing 36 changed files with 2,762 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
*.ipch
*.sdf
*.opendb
*.db
*.user
*.log
*.tlog

*.exe
*.dll
*.bundle
*.dylib
*.so
*.unitypackage

*.fbx
*.obj

.vs/
_out/
_tmp/
_build_*/
external/
Library/
Temp/

TestLocal/
TestLocal.meta

/*.csproj
/*.sln
19 changes: 19 additions & 0 deletions Assets/BlendShapeBuilderPackaging.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;


public class BlendShapeBuilderPackaging
{
[MenuItem("Assets/Make BlendShapeBuilder.unitypackage")]
public static void MakePackage()
{
string[] files = new string[]
{
"Assets/UTJ/BlendShapeBuilder",
};
AssetDatabase.ExportPackage(files, "BlendShapeBuilder.unitypackage", ExportPackageOptions.Recurse);
}

}
#endif // UNITY_EDITOR
13 changes: 13 additions & 0 deletions Assets/BlendShapeBuilderPackaging.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/UTJ.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Assets/UTJ/BlendShapeBuilder.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Assets/UTJ/BlendShapeBuilder/Data.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions Assets/UTJ/BlendShapeBuilder/Data/BlendShapeBuilderSettings.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0973484e77d2fb45b910d8acec902e0, type: 3}
m_Name: BlendShapeBuilderSettings
m_EditorClassIdentifier:
baseMesh: {fileID: 0}
preserveExistingBlendShapes: 1
blendShapeData: []

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Assets/UTJ/BlendShapeBuilder/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions Assets/UTJ/BlendShapeBuilder/Editor/BlendShapeBuilderData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using UnityEngine;
using UnityEditor;
using System;
using System.Collections.Generic;

namespace UTJ.BlendShapeBuilder
{
[Serializable]
public class BlendShapeFrameData
{
public float weight = 100.0f;
public UnityEngine.Object mesh;
public bool vertex = true;
public bool normal = true;
public bool tangent = true;
}

[Serializable]
public class BlendShapeData
{
public bool fold = true;
public string name = "";
public List<BlendShapeFrameData> frames = new List<BlendShapeFrameData>();

public void ClearInvalidFrames()
{
frames.RemoveAll(item => { return item.mesh == null; });
}

public void NormalizeWeights()
{
int n = frames.Count;
float step = 100.0f / n;
for (int i = 0; i < n; ++i)
{
frames[i].weight = step * (i + 1);
}
}

public void SortByWeights()
{
frames.Sort((x, y) => x.weight.CompareTo(y.weight));
}
}

[Serializable]
public class BlendShapeBuilderData : ScriptableObject
{
public UnityEngine.Object baseMesh;
public bool preserveExistingBlendShapes = true;
public List<BlendShapeData> blendShapeData = new List<BlendShapeData>();
}
}

13 changes: 13 additions & 0 deletions Assets/UTJ/BlendShapeBuilder/Editor/BlendShapeBuilderData.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2f21aff

Please sign in to comment.