浏览代码

changes from feedback

/validation-tool
Wesley Mareovich Smith 3 年前
当前提交
8ffdb3e3
共有 4 个文件被更改,包括 16 次插入9 次删除
  1. 2
      com.unity.perception/Editor/Character/CharacterTooling.cs
  2. 10
      com.unity.perception/Editor/Character/CharacterToolingLibrary.cs
  3. 4
      com.unity.perception/Editor/Character/CharacterToolingUI.cs
  4. 9
      com.unity.perception/Tests/Editor/CharacterToolingTests.cs

2
com.unity.perception/Editor/Character/CharacterTooling.cs


}
/// <summary>
/// Ensures there is pose data in the parent and child game objects of a character by checking for pos and rot
/// Ensures there is pose data in the parent and child game objects of a character by checking for position and rotation
/// </summary>
/// <param name="gameObject">Target character selected</param>
/// <param name="failedGameObjects">List of game objects that don't have nay pose data</param>

10
com.unity.perception/Editor/Character/CharacterToolingLibrary.cs


var verticies = skinnedMeshRenderer.sharedMesh.vertices;
var head = animator.GetBoneTransform(HumanBodyBones.Head);
//Currently stage left and stage right
//Currently stage left and stage right for the eyes
var leftEye = animator.GetBoneTransform(HumanBodyBones.RightEye);
var rightEye = animator.GetBoneTransform(HumanBodyBones.LeftEye);

}
else
{
// getting the angle direction from the start point of the eyes and the distance between the left and right eyes
eyeDistance = Vector3.Distance(leftEye.position, rightEye.position);
directionLeft = Quaternion.AngleAxis(-45, -leftEye.right) * -leftEye.up;
directionRight = Quaternion.AngleAxis(-45, rightEye.right) * -rightEye.up;

rayRightEye.origin = rightEye.position;
rayRightEye.direction = directionRight * eyeDistance;
// Find the center of the face
// Find the center of the face by taking where the left and right eye rays drawn at 45 degrees intersect to find
// the average point of the nose
for (var i = 0f; i < distanceCheck; i += 0.01f)
{
var pointR = rayRightEye.GetPoint(i);

rayEarLeft.origin = earCenter;
rayEarLeft.direction = Vector3.left * distanceCheck;
// Find both the left and right ear from the ear center
// Find both the left and right ear from the ear center in the right and left directions
for (int v = 0; v < verticies.Length; v++)
{
for (var c = eyeDistance / 2; c < distanceCheck; c += 0.001f)

var pointVert = verticies[v];
var def = 0.09f;
var offsetR = pointVert - pointEarRight;
// Need to fix the left offset because of negative numbers
// TODO: Need to fix the left offset because of negative numbers
var offsetL = pointVert - pointEarLeft;
var lenR = offsetR.sqrMagnitude;
var lenL = offsetL.sqrMagnitude;

4
com.unity.perception/Editor/Character/CharacterToolingUI.cs


GameObject selection = null;
int toolbarSelection = 0;
bool drawFaceRays = false;
string savePath = string.Empty;
string savePath = "Assets/";
private void OnSelectionChange()
{

if (!checkForJoints)
{
if (savePath == string.Empty)
if (savePath == "Assets/")
test = m_contentTests.CharacterCreateNose(selection, drawFaceRays);
else
test = m_contentTests.CharacterCreateNose(selection, drawFaceRays, savePath);

9
com.unity.perception/Tests/Editor/CharacterToolingTests.cs


[Test, TestCaseSource(typeof(AssetCollection), "GameObject")]
public void CreateEarsNoseJoints(GameObject gameObject)
{
var test = contentTests.CharacterCreateNose(gameObject, true);
var model = contentTests.CharacterCreateNose(gameObject, true);
var validate = false;
if (model)
validate = contentTests.ValidateNoseAndEars(gameObject);
else if (!model)
Assert.Fail("Failed to create the Ear and Nose Joints");
Assert.True(test, "Failed to create ear and nose joints");
Assert.True(validate, "Failed to create ear and nose joints");
}
[Test, TestCaseSource(typeof(AssetCollection), "GameObject")]

正在加载...
取消
保存