static void DrawGizmo(MagicaMeshCloth scr, GizmoType gizmoType)
        {
            bool selected = (gizmoType & GizmoType.Selected) != 0 || (ClothMonitorMenu.Monitor != null && ClothMonitorMenu.Monitor.UI.AlwaysClothShow);

            if (ClothMonitorMenu.Monitor == null)
            {
                return;
            }

            if (selected == false)
            {
                return;
            }


            // デフォーマー状態表示
            //if (scr.Deformer != null && scr.Deformer.VerifyData())
            //{
            //    if (PointSelector.EditEnable == false)
            //    {
            //        // デフォーマーギズモ
            //        DeformerGizmoDrawer.DrawDeformerGizmo(scr.Deformer, scr, 0.01f);
            //    }
            //}

            if (scr.VerifyData() == Define.Error.None)
            {
                // クロスギズモ
                if (PointSelector.EditEnable == false)
                {
                    ClothGizmoDrawer.DrawClothGizmo(scr, scr.ClothData, scr.Params, scr.Setup, scr, scr);
                }
            }
        }
示例#2
0
        //=========================================================================================
        /// <summary>
        /// データ作成
        /// </summary>
        void CreateData()
        {
            MagicaMeshCloth scr = target as MagicaMeshCloth;

            Debug.Log("Started creating. [" + scr.name + "]");

            // 共有選択データが存在しない場合は作成する
            if (scr.ClothSelection == null)
            {
                InitSelectorData();
            }

            // チームハッシュを設定
            scr.TeamData.ValidateColliderList();

            // クロスデータ共有データ作成
            string dataname = "MeshClothData_" + scr.name;
            var    cloth    = ShareDataObject.CreateShareData <ClothData>(dataname);

            // クロスデータ用にセレクションデータを拡張する
            // (1)無効頂点の隣接が移動/固定頂点なら拡張に変更する
            // (2)移動/固定頂点に影響する子頂点に接続する無効頂点は拡張に変更する
            var selection = scr.Deformer.MeshData.ExtendSelection(
                scr.ClothSelection.GetSelectionData(scr.Deformer.MeshData, scr.Deformer.GetRenderDeformerMeshList()),
                true,
                true
                );

            // クロスデータ作成
            cloth.CreateData(
                scr,
                scr.Params,
                scr.TeamData,
                scr.Deformer.MeshData,
                scr.Deformer,
                selection
                );

            // クロスデータを設定
            var cdata = serializedObject.FindProperty("clothData");

            cdata.objectReferenceValue = cloth;
            serializedObject.ApplyModifiedProperties();

            // 検証
            scr.CreateVerifyData();
            serializedObject.ApplyModifiedProperties();

            EditorUtility.SetDirty(cloth);

            if (scr.VerifyData() == Define.Error.None)
            {
                Debug.Log("Creation completed. [" + scr.name + "]");
            }
            else
            {
                Debug.LogError("Creation failed.");
            }
        }
示例#3
0
        /// <summary>
        /// データ検証
        /// </summary>
        private void VerifyData()
        {
            MagicaMeshCloth scr = target as MagicaMeshCloth;

            if (scr.VerifyData() != Define.Error.None)
            {
                // 検証エラー
                serializedObject.ApplyModifiedProperties();
            }
        }