Example #1
0
    public void CreatPrefab()
    {
        #region cloths
        EditorUtility.DisplayProgressBar(sex.ToString(), "clothes resources are dealing...", 1 / 7f);
        IEditorCloth cloths = EditorClothFactory.Creat(sex, restype);
        cloths.CreatPrefab();
        #endregion

        #region race
        EditorUtility.DisplayProgressBar(sex.ToString(), "create race...", 2 / 7f);
        TPoseEditor pose = TPoseEditorFactory.Creat(sex, obj, restype);
        RaceData    rd   = pose.CreatTPose();
        #endregion

        #region animator

        EditorUtility.DisplayProgressBar(sex.ToString(), "animations resources are dealing...", 3 / 7f);
        IEditorAnimation          anim       = EditorAnimationFactory.Creat(sex, restype);
        RuntimeAnimatorController controller = anim.Creat();

        #endregion

        #region base
        EditorUtility.DisplayProgressBar(sex.ToString(), "body parts resources are dealing...", 5 / 7f);

        List <SlotOverlayItem> sos = new List <SlotOverlayItem>();

        SlotOverlayItem     eyeItem      = new SlotOverlayItem();
        BaseClothItemEditor eyes         = new EyesEditor(obj, restype);
        SlotDataAsset       eyes_slot    = eyes.CreatSlot();
        OverlayDataAsset    eyes_overlay = eyes.CreatOverlay();
        eyeItem.slot      = eyes_slot;
        eyeItem.overlay   = eyes_overlay;
        eyeItem.partIndex = eyes.WearPos;

        SlotOverlayItem     faceItem     = new SlotOverlayItem();
        BaseClothItemEditor face         = new FaceEditor(obj, restype);
        SlotDataAsset       face_slot    = face.CreatSlot();
        OverlayDataAsset    face_overlay = face.CreatOverlay();
        faceItem.slot      = face_slot;
        faceItem.overlay   = face_overlay;
        faceItem.partIndex = face.WearPos;


        sos.Add(eyeItem);
        sos.Add(faceItem);
        #endregion

        #region CharacterPlayer
        EditorUtility.DisplayProgressBar(sex.ToString(), "create character...", 7 / 7f);
        Dictionary <string, object> dic = new Dictionary <string, object>();
        dic["animatorController"] = controller;
        dic["race"] = rd;
        dic["sos"]  = sos;

        string      assetpath = string.Format("{0}/{1}.prefab", prefabFold, obj.Name);
        IPrefabItem prefab    = new PrefabItem(assetpath);
        prefab.CreatPrefab(null, CreatPrefabFinish, dic);
        #endregion
    }
Example #2
0
    public void CreatPrefab()
    {
        List <string> files = PathHelper.getAllChildFiles(sexFold, ".fbx");

        for (int i = 0; i < files.Count; i++)
        {
            string filename = FileHelper.getFileNameNoTypeByPath(files[i]);
            EditorUtility.DisplayProgressBar(sex.ToString(), string.Format("{0}:{1}/{2}", filename, i + 1, files.Count), (i + 1) / (float)files.Count);
            if (filename.Contains("@") ||
                filename.Contains(CharacterConst.Female) ||
                filename.Contains(CharacterConst.Male))
            {
                continue;
            }

            string      assetpath = PathHelper.GetRelativeAssetPath(files[i]);
            IObjectBase obj       = new ObjectBase(assetpath);

            string      diffusepath     = sexFold + "/" + filename + ".png";
            IObjectBase texture_diffuse = new ObjectBase(diffusepath);
            (new CharacterTexture(diffusepath)).Handle();

            IEditorCloth clothitem = EditorClothItemFactory.Creat(sex, obj, texture_diffuse, resType);
            clothitem.CreatPrefab();
        }
    }
Example #3
0
        //=========================================================================================
        /// <summary>
        /// デフォーマーギズモの表示
        /// </summary>
        /// <param name="editorMesh"></param>
        /// <param name="meshData">nullの場合はすべての頂点を表示</param>
        /// <param name="clothSelection"></param>
        /// <param name="size"></param>
        public static void DrawDeformerGizmo(
            IEditorMesh editorMesh,
            IEditorCloth editorCloth,
            float size = 0.005f
            )
        {
            if (ClothMonitorMenu.Monitor == null)
            {
                return;
            }
            if (ClothMonitorMenu.Monitor.UI.DrawDeformer == false)
            {
                return;
            }

            if (ClothMonitorMenu.Monitor.UI.DrawDeformerVertexPosition == false &&
                ClothMonitorMenu.Monitor.UI.DrawDeformerTriangle == false &&
                ClothMonitorMenu.Monitor.UI.DrawDeformerLine == false &&
                ClothMonitorMenu.Monitor.UI.DrawDeformerVertexAxis == false
#if MAGICACLOTH_DEBUG
                && ClothMonitorMenu.Monitor.UI.DrawDeformerVertexNumber == false &&
                ClothMonitorMenu.Monitor.UI.DrawDeformerTriangleNormal == false
#endif
                )
            {
                return;
            }

            // メッシュ頂点法線接線
            List <Vector3> posList;
            List <Vector3> norList;
            List <Vector3> tanList;
            int            vcnt = editorMesh.GetEditorPositionNormalTangent(out posList, out norList, out tanList);
            if (posList.Count == 0)
            {
                return;
            }

            // 頂点使用状態
            List <int> useList = null;
            List <int> selList = null;
            if (editorCloth != null)
            {
                useList = editorCloth.GetUseList();
                selList = editorCloth.GetSelectionList();
            }

            // 頂点
            DrawVertex(vcnt, posList, norList, tanList, useList, selList, size);

            // トライアングル
            DrawTriangle(editorMesh, posList, norList, tanList, useList);

            // ライン
            DrawLine(editorMesh, posList, norList, tanList, useList);
        }
        public static bool DrawClothGizmo(
            PhysicsTeam team,
            ClothData clothData,
            ClothParams param,
            ClothSetup setup,
            IEditorMesh editorMesh,
            IEditorCloth editorCloth
            )
        {
            if (ClothMonitorMenu.Monitor.UI.DrawCloth == false)
            {
                return(false);
            }

            if (ClothMonitorMenu.Monitor.UI.DrawClothVertex == false &&
                ClothMonitorMenu.Monitor.UI.DrawClothDepth == false &&
                ClothMonitorMenu.Monitor.UI.DrawClothBase == false &&
                ClothMonitorMenu.Monitor.UI.DrawClothCollider == false &&
                ClothMonitorMenu.Monitor.UI.DrawClothStructDistanceLine == false &&
                ClothMonitorMenu.Monitor.UI.DrawClothBendDistanceLine == false &&
                ClothMonitorMenu.Monitor.UI.DrawClothNearDistanceLine == false &&
                ClothMonitorMenu.Monitor.UI.DrawClothRotationLine == false &&
                ClothMonitorMenu.Monitor.UI.DrawClothTriangleBend == false &&
                ClothMonitorMenu.Monitor.UI.DrawClothPenetration == false
                //&& ClothMonitorMenu.Monitor.UI.DrawClothBaseSkinning == false
                && ClothMonitorMenu.Monitor.UI.DrawClothAxis == false
                //&& ClothMonitorMenu.Monitor.UI.DrawClothVolume == false
#if MAGICACLOTH_DEBUG
                && ClothMonitorMenu.Monitor.UI.DrawClothVertexNumber == false &&
                ClothMonitorMenu.Monitor.UI.DrawClothVertexIndex == false &&
                ClothMonitorMenu.Monitor.UI.DrawPenetrationOrigin == false
                //&& ClothMonitorMenu.Monitor.UI.DrawAdjustRotationLine == false
#endif
                )
            {
                return(false);
            }

            if (clothData == null)
            {
                return(false);
            }

            if (Application.isPlaying)
            {
                if (clothData == null)
                {
                    return(false);
                }

                if (team.IsActive() == false)
                {
                    return(false);
                }

                // 頂点使用状態
                //var useList = editorCloth.GetUseList();
                var selList = editorCloth.GetSelectionList();

                // 頂点情報
                DrawVertexRuntime(team, clothData, param, setup, selList);

                // コライダー
                DrawCollider(team);

                // ライン
                DrawLineRuntime(team, clothData, setup, selList);

                // トライアングルベンド
                DrawTriangleBendRuntime(team, clothData, setup);

                // 回転ライン
                DrawRotationLineRuntime(team, clothData, setup, selList);

                // コライダー移動制限
                DrawPenetrationRuntime(team, param, clothData, selList);

                // ボリューム
                //DrawVolumeRuntime(team, clothData, setup);

                // 回転調整ライン
                //DrawAdjustRotationLineRuntime(team, clothData);
            }
            else
            {
                // メッシュ頂点法線接線
                List <Vector3> posList;
                List <Vector3> norList;
                List <Vector3> tanList;
                int            vcnt = editorMesh.GetEditorPositionNormalTangent(out posList, out norList, out tanList);

                // 頂点使用状態
                //var useList = editorCloth.GetUseList();
                var selList = editorCloth.GetSelectionList();

                // 頂点情報
                DrawVertexClothData(clothData, param, vcnt, posList, norList, tanList, selList);

                // コライダー
                DrawCollider(team);

                // ライン
                DrawLineClothData(clothData, posList, selList);

                // トライアングルベンド
                DrawTriangleBendClothData(clothData, posList);

                // 回転ライン
                DrawRotationLineClothData(clothData, posList, selList);

                // コライダー移動制限
                DrawPenetrationClothData(team, param, clothData, posList, norList, tanList, selList);

                // ベーススキニング
                //DrawBaseSkinningClothData(team, clothData, posList, selList);

                // ボリューム
                //DrawVolumeClothData(clothData, posList);

                // 回転調整ライン
                //DrawAdjustRotationLineClothData(clothData, posList);
            }

            return(true);
        }