/// <summary> /// データ検証 /// </summary> private void VerifyData() { MagicaMeshSpring scr = target as MagicaMeshSpring; if (scr.VerifyData() != Define.Error.None) { // 検証エラー serializedObject.ApplyModifiedProperties(); } }
//========================================================================================= /// <summary> /// データ作成 /// </summary> void CreateData() { MagicaMeshSpring scr = target as MagicaMeshSpring; Debug.Log("Started creating. [" + scr.name + "]"); // センタートランスフォーム if (scr.CenterTransform == null) { serializedObject.FindProperty("centerTransform").objectReferenceValue = scr.transform; } // デフォーマーリスト整理 //scr.VerifyDeformer(); // 共有データオブジェクト作成 SpringData sdata = ShareDataObject.CreateShareData <SpringData>("SpringData_" + scr.name); serializedObject.ApplyModifiedProperties(); CreateClothData(scr, sdata, scr.GetDeformer(0)); // データ検証 sdata.CreateVerifyData(); // 新しいデータを設定 serializedObject.FindProperty("springData").objectReferenceValue = sdata; serializedObject.ApplyModifiedProperties(); // 仮想デフォーマーのハッシュを設定 //var property = serializedObject.FindProperty("virtualDeformerHash"); //property.intValue = scr.VirtualDeformerHash; //serializedObject.ApplyModifiedProperties(); // データ検証 scr.CreateVerifyData(); serializedObject.ApplyModifiedProperties(); EditorUtility.SetDirty(sdata); if (scr.VerifyData() == Define.Error.None) { Debug.Log("Creation completed. [" + scr.name + "]"); } else { Debug.LogError("Creation failed."); } }
static void DrawGizmo(MagicaMeshSpring scr, GizmoType gizmoType) { bool selected = (gizmoType & GizmoType.Selected) != 0 || (ClothMonitorMenu.Monitor != null && ClothMonitorMenu.Monitor.UI.AlwaysClothShow); if (PointSelector.EditEnable) { return; } // スプリング球 if (selected) { DrawSpringSphere(scr); } if (ClothMonitorMenu.Monitor == null) { return; } // データ整合性チェック if (scr.VerifyData() != Define.Error.None) { return; } // デフォーマーギズモ /*var dcnt = scr.Contents.DeformerCount; * for (int i = 0; i < dcnt; i++) * { * var deformer = scr.Contents.GetDeformer(i); * if (deformer == null || deformer.IsValidData() == false) * continue; * * var datalist = scr.Contents.SpringData.deformerDataList; * if (i >= datalist.Count) * continue; * * var springData = datalist[i]; * if (springData.vertexCount == 0) * continue; * * //DeformerGizmoDrawer.DrawDeformerGizmo(deformer, springData); * }*/ if (ClothMonitorMenu.Monitor.UI.DrawCloth == false) { return; } if (selected == false) { return; } // クロスギズモ ClothGizmoDrawer.DrawClothGizmo( scr, scr.ClothData, scr.Params, scr.Setup, scr, scr ); }