// ...
void DrawDecoObjectList()
{
EditorGUILayout.BeginHorizontal();
_isFoldoutDecoObjectList = EditorGUILayout.Toggle(_isFoldoutDecoObjectList, EditorStyles.foldout, GUILayout.Width(10));
EditorGUILayout.LabelField("[PartsDecoEditor]", EditorStyles.boldLabel);
if (GUILayout.Button("DecoObject 추가"))
{
PartsDecoInfo newDummyObject = new PartsDecoInfo()
{
DirectionType = PartsDecoDirectionType.Default,
ParentBoneName = "Bip001 Pelvis",
DecoObject = null,
};
// 파츠 DecoObject 좌표 기본값
Vector3 decoLocalPosition = Vector3.zero;
Quaternion decoLocalRotation = Quaternion.identity;
// 해당 문자열 포함여부로 파츠 및 성별 구분
if (_fbxPartsObject.ToString().Contains("B_F_"))
{
Debug.Log("가방_여성");
decoLocalPosition = new Vector3(0.025f, 0.184f, 0.128f);
decoLocalRotation = Quaternion.Euler(60, 180, 270);
}
else if (_fbxPartsObject.ToString().Contains("B_M_"))
{
Debug.Log("가방_남성");
decoLocalPosition = new Vector3(-0.04f, 0.202f, 0.115f);
decoLocalRotation = Quaternion.Euler(60, 180, 270);
}
else if (_fbxPartsObject.ToString().Contains("R_F_"))
{
Debug.Log("귀걸이_여성");
newDummyObject.ParentBoneName = "Bip001 Head";
decoLocalPosition = new Vector3(-0.036f, 0.045f, 0);
decoLocalRotation = Quaternion.Euler(270, 90, 0);
}
else if (_fbxPartsObject.ToString().Contains("R_M_"))
{
Debug.Log("귀걸이_남성");
newDummyObject.ParentBoneName = "Bip001 Head";
decoLocalPosition = new Vector3(-0.036f, 0.045f, 0);
decoLocalRotation = Quaternion.Euler(270, 90, 0);
}
else if (_fbxPartsObject.ToString().Contains("F_F_"))
{
Debug.Log("얼굴_여성");
newDummyObject.ParentBoneName = "Bip001 Head";
decoLocalRotation = Quaternion.Euler(90, 270, 0);
}
else if (_fbxPartsObject.ToString().Contains("F_M_"))
{
Debug.Log("얼굴_남성");
newDummyObject.ParentBoneName = "Bip001 Head";
decoLocalRotation = Quaternion.Euler(90, 270, 0);
}
else if (_fbxPartsObject.ToString().Contains("U_F_"))
{
Debug.Log("얼굴악세_여성");
newDummyObject.ParentBoneName = "Bip001 Head";
decoLocalRotation = Quaternion.Euler(90, 270, 0);
}
else if (_fbxPartsObject.ToString().Contains("U_M_"))
{
Debug.Log("얼굴악세_남성");
newDummyObject.ParentBoneName = "Bip001 Head";
decoLocalRotation = Quaternion.Euler(90, 270, 0);
}
else if (_fbxPartsObject.ToString().Contains("H_F_"))
{
Debug.Log("헤어_여성");
newDummyObject.ParentBoneName = "Bip001 Head";
decoLocalRotation = Quaternion.Euler(90, 270, 0);
}
else if (_fbxPartsObject.ToString().Contains("H_M_"))
{
Debug.Log("헤어_남성");
newDummyObject.ParentBoneName = "Bip001 Head";
decoLocalRotation = Quaternion.Euler(90, 270, 0);
}
else if (_fbxPartsObject.ToString().Contains("I_F_"))
{
Debug.Log("헤어악세_여성");
newDummyObject.ParentBoneName = "Bip001 Head";
decoLocalRotation = Quaternion.Euler(90, 270, 0);
}
else if (_fbxPartsObject.ToString().Contains("I_M_"))
{
Debug.Log("헤어악세_남성");
newDummyObject.ParentBoneName = "Bip001 Head";
decoLocalRotation = Quaternion.Euler(90, 270, 0);
}
else if (_fbxPartsObject.ToString().Contains("A_F_"))
{
if (_instancePartsDataInfo.DecoList.Count % 2 == 0)
{
Debug.Log("핸드_여성_오른손");
newDummyObject.ParentBoneName = "Bip001 R Hand";
newDummyObject.DirectionType = PartsDecoDirectionType.Right;
}
else
{
Debug.Log("핸드_여성_왼손");
newDummyObject.ParentBoneName = "Bip001 L Hand";
newDummyObject.DirectionType = PartsDecoDirectionType.Left;
}
decoLocalPosition = new Vector3(-0.123f, -0.015f, 0);
decoLocalRotation = Quaternion.Euler(0, 0, 270);
}
else if (_fbxPartsObject.ToString().Contains("A_M_"))
{
if (_instancePartsDataInfo.DecoList.Count % 2 == 0)
{
Debug.Log("핸드_남성_오른손");
newDummyObject.ParentBoneName = "Bip001 R Hand";
newDummyObject.DirectionType = PartsDecoDirectionType.Right;
}
else
{
Debug.Log("핸드_남성_왼손");
newDummyObject.ParentBoneName = "Bip001 L Hand";
newDummyObject.DirectionType = PartsDecoDirectionType.Left;
}
decoLocalPosition = new Vector3(-0.117f, -0.037f, 0);
decoLocalRotation = Quaternion.Euler(0, 0, 270);
}
else if (_fbxPartsObject.ToString().Contains("J_F_"))
{
Debug.Log("자켓_여성");
decoLocalPosition = new Vector3(0.9f, 0, 0);
decoLocalRotation = Quaternion.Euler(90, 270, 0);
}
else if (_fbxPartsObject.ToString().Contains("J_M_"))
{
Debug.Log("자켓_남성");
decoLocalPosition = new Vector3(0.9f, 0, 0);
decoLocalRotation = Quaternion.Euler(90, 270, 0);
}
else if (_fbxPartsObject.ToString().Contains("K_F_"))
{
Debug.Log("목걸이_여성");
newDummyObject.ParentBoneName = "Bip001 Neck";
decoLocalPosition = new Vector3(0.05f, 0.16f, 0);
decoLocalRotation = Quaternion.Euler(70, 90, 180);
}
else if (_fbxPartsObject.ToString().Contains("K_M_"))
{
Debug.Log("목걸이_남성");
newDummyObject.ParentBoneName = "Bip001 Neck";
decoLocalPosition = new Vector3(0.05f, 0.16f, 0);
decoLocalRotation = Quaternion.Euler(70, 90, 180);
}
else if (_fbxPartsObject.ToString().Contains("P_F_"))
{
Debug.Log("팬츠_여성");
decoLocalPosition = new Vector3(0.9f, 0, 0);
decoLocalRotation = Quaternion.Euler(90, 270, 0);
}
else if (_fbxPartsObject.ToString().Contains("P_M_"))
{
Debug.Log("팬츠_남성");
decoLocalPosition = new Vector3(0.9f, 0, 0);
decoLocalRotation = Quaternion.Euler(90, 270, 0);
}
else if (_fbxPartsObject.ToString().Contains("T_F_"))
{
Debug.Log("세트_여성");
decoLocalPosition = new Vector3(0.9f, 0, 0);
decoLocalRotation = Quaternion.Euler(90, 270, 0);
}
else if (_fbxPartsObject.ToString().Contains("T_M_"))
{
Debug.Log("세트_남성");
decoLocalPosition = new Vector3(0.9f, 0, 0);
decoLocalRotation = Quaternion.Euler(90, 270, 0);
}
else if (_fbxPartsObject.ToString().Contains("S_F_"))
{
if (_instancePartsDataInfo.DecoList.Count % 2 == 0)
{
Debug.Log("신발_여성_오른발");
newDummyObject.ParentBoneName = "Bip001 R Foot";
newDummyObject.DirectionType = PartsDecoDirectionType.Right;
}
else
{
Debug.Log("신발_여성_왼발");
newDummyObject.ParentBoneName = "Bip001 L Foot";
newDummyObject.DirectionType = PartsDecoDirectionType.Left;
}
decoLocalPosition = new Vector3(-0.136f, 0.114f, -0.004f);
decoLocalRotation = Quaternion.Euler(90, 90, 0);
}
else if (_fbxPartsObject.ToString().Contains("S_M_"))
{
if (_instancePartsDataInfo.DecoList.Count % 2 == 0)
{
Debug.Log("신발_남성_오른발");
newDummyObject.ParentBoneName = "Bip001 R Foot";
newDummyObject.DirectionType = PartsDecoDirectionType.Right;
}
else
{
Debug.Log("신발_남성_왼발");
newDummyObject.ParentBoneName = "Bip001 L Foot";
newDummyObject.DirectionType = PartsDecoDirectionType.Left;
}
decoLocalPosition = new Vector3(-0.136f, 0.114f, -0.004f);
decoLocalRotation = Quaternion.Euler(90, 90, 0);
}
var decoGameObject = new GameObject("DecoParentObject");
decoGameObject.transform.localPosition = decoLocalPosition;
decoGameObject.transform.localRotation = decoLocalRotation;
decoGameObject.transform.localScale = Vector3.one;
decoGameObject.transform.SetParent(_instancePartsDataInfo.transform, false);
newDummyObject.DecoParentTransform = decoGameObject.transform;
_instancePartsDataInfo.DecoList.Add(newDummyObject);
}
EditorGUILayout.EndHorizontal();
// 이하 생략...