Beispiel #1
0
        private void DrawSkeleton(Rect rect)
        {
            GUILayout.BeginArea(rect);
            {
                EditorGUILayout.BeginVertical();
                {
                    EGUILayout.DrawBoxHeader("Skeleton Data", EGUIStyles.BoxedHeaderCenterStyle, GUILayout.ExpandWidth(true));
                    if (currentCreatorData != null && skeletonCreatorDataDrawer != null)
                    {
                        skeletonCreatorDataDrawer.OnGUILayout();

                        AvatarSkeletonCreatorData skeletonCreatorData = currentCreatorData.skeletonData;

                        string     targetPrefabPath = skeletonCreatorData.GetSkeletonPrefabPath();
                        GameObject targetPrefab     = null;
                        if (!string.IsNullOrEmpty(targetPrefabPath))
                        {
                            targetPrefab = AssetDatabase.LoadAssetAtPath <GameObject>(targetPrefabPath);
                        }
                        EditorGUILayout.Space();
                        EditorGUILayout.Space();

                        EditorGUILayout.ObjectField("Output", targetPrefab, typeof(GameObject), false);

                        EditorGUILayout.Space();

                        GUILayout.FlexibleSpace();

                        if (GUILayout.Button("Create Skeleton"))
                        {
                            GameObject skeletonPrefab = AvatarCreatorUtil.CreateSkeleton(skeletonCreatorData);
                            if (skeletonPrefab == null)
                            {
                                EditorUtility.DisplayDialog("Error", "Create Failed.\n Please view the details from the console!!!", "OK");
                            }
                            else
                            {
                                SelectionUtility.PingObject(skeletonPrefab);
                            }
                        }

                        if (GUILayout.Button("Preview Skeleton"))
                        {
                            PreviewSkeleton();
                        }
                    }
                }
                EditorGUILayout.EndVertical();
            }
            GUILayout.EndArea();
        }
Beispiel #2
0
        private bool CreatePart(AvatarPartCreatorData data)
        {
            var partData = AvatarCreatorUtil.CreatePart(currentCreatorData.skeletonPartData.outputFolder, data);

            if (partData == null)
            {
                EditorUtility.DisplayDialog("Error", "Create Failed.\n Please view the details from the console!!!", "OK");
                return(false);
            }
            else
            {
                SelectionUtility.PingObject(partData);
                return(true);
            }
        }