|
|
|
|
|
|
static string[] toolbarNames = null; |
|
|
|
|
|
|
|
CharacterTooling m_contentTests = new CharacterTooling(); |
|
|
|
Object keypointTemplate; |
|
|
|
UnityEngine.Object keypointTemplate; |
|
|
|
bool checkJoints = false; |
|
|
|
bool vaildCharacter = false; |
|
|
|
string savePath = "Assets/"; |
|
|
|
string status = "Unknown"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(selection != null) |
|
|
|
{ |
|
|
|
var head = FindBodyPart("head", selection.transform); |
|
|
|
var leftEye = FindBodyPart("leftEye", selection.transform); |
|
|
|
var rightEye = FindBodyPart("rightEye", selection.transform); |
|
|
|
|
|
|
|
if (head != null || leftEye != null || rightEye != null) |
|
|
|
{ |
|
|
|
status = "Character ready to add joints"; |
|
|
|
vaildCharacter = true; |
|
|
|
checkJoints = m_contentTests.ValidateNoseAndEars(selection); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
status = "Missing either the head/left or right eye joint transforms!"; |
|
|
|
vaildCharacter = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void OnInspectorUpdate() |
|
|
|
|
|
|
{ |
|
|
|
if (selection != null && selection.GetType() == typeof(GameObject)) |
|
|
|
{ |
|
|
|
EditorGUILayout.TextField("Selected Asset : ", selection.name); |
|
|
|
EditorGUILayout.TextField("Selected Character : ", selection.name); |
|
|
|
savePath = EditorGUILayout.TextField("Prefab Save Location : ", savePath); |
|
|
|
GUILayout.Label("Keypoint Template : ", EditorStyles.whiteLargeLabel); |
|
|
|
keypointTemplate = EditorGUILayout.ObjectField(keypointTemplate, typeof(KeypointTemplate), true, GUILayout.MaxWidth(500)); |
|
|
|
|
|
|
case 0: |
|
|
|
GUILayout.Label("Character Tools", EditorStyles.whiteLargeLabel); |
|
|
|
|
|
|
|
var checkForJoints = m_contentTests.ValidateNoseAndEars(selection); |
|
|
|
|
|
|
|
if (checkForJoints) |
|
|
|
status = "Joints already exist"; |
|
|
|
|
|
|
|
if (checkJoints) |
|
|
|
{ |
|
|
|
status = "Joints already exist"; |
|
|
|
if (GUILayout.Button("Create Nose and Ears", GUILayout.Width(160))) |
|
|
|
} |
|
|
|
else if (!checkJoints && vaildCharacter) |
|
|
|
|
|
|
|
if (!checkForJoints) |
|
|
|
status = "Joints don't exist"; |
|
|
|
if (GUILayout.Button("Create Nose and Ears", GUILayout.Width(160))) |
|
|
|
{ |
|
|
|
if (savePath == "Assets/") |
|
|
|
apiResult = m_contentTests.CharacterCreateNose(selection, out newModel, keypointTemplate, drawFaceRays); |
|
|
|
|
|
|
status = "Ear and Nose joints created"; |
|
|
|
else if (!modelValidate) |
|
|
|
status = "Failed to create the Ear and Nose joints"; |
|
|
|
} |
|
|
|
else if(checkForJoints) |
|
|
|
{ |
|
|
|
status = "Joints have already been created on this Asset"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
GUILayout.Label("The selected assets is invalid, please select a different Game Object.", EditorStyles.boldLabel); |
|
|
|
} |
|
|
|
} |
|
|
|
} |