public bool Compare(DeformerSelection data) { if (selectData.Count != data.selectData.Count) { return(false); } for (int i = 0; i < selectData.Count; i++) { if (selectData[i] != data.selectData[i]) { return(false); } } if (vertexHashList.Count != data.vertexHashList.Count) { return(false); } for (int i = 0; i < vertexHashList.Count; i++) { if (vertexHashList[i] != data.vertexHashList[i]) { return(false); } } return(true); }
/// <summary> /// メッシュ頂点の選択データを設定する /// </summary> /// <param name="meshData"></param> /// <param name="selects"></param> public void SetSelectionData(MeshData meshData, List <int> selects, List <MeshData> childMeshDataList) { // 選択データ初期化 selectionList.Clear(); if (meshData != null && meshData.ChildCount > 0) { for (int i = 0; i < meshData.ChildCount; i++) { var dsel = new DeformerSelection(); int cvcnt = meshData.childDataList[i].VertexCount; for (int j = 0; j < cvcnt; j++) { dsel.selectData.Add(Invalid); dsel.vertexHashList.Add(0); // ハッシュ0=無効 } selectionList.Add(dsel); } } else { // そのまま var dsel = new DeformerSelection(); int cvcnt = selects.Count; for (int j = 0; j < cvcnt; j++) { dsel.selectData.Add(Invalid); dsel.vertexHashList.Add(0); // ハッシュ0=無効 } selectionList.Add(dsel); } // 選択データに追加 for (int i = 0; i < selects.Count; i++) { int data = selects[i]; if (meshData != null && meshData.ChildCount > 0) { // 親頂点に影響する子頂点情報 Dictionary <int, List <uint> > dict = meshData.GetVirtualToChildVertexDict(); // 親頂点に影響する子頂点に記録 if (dict.ContainsKey(i)) { foreach (var pack in dict[i]) { int cmindex = DataUtility.Unpack16Hi(pack); int cvindex = DataUtility.Unpack16Low(pack); selectionList[cmindex].selectData[cvindex] = data; // 頂点ハッシュも記録 if (cmindex < childMeshDataList.Count) { var cmdata = childMeshDataList[cmindex]; if (cmdata != null && cvindex < cmdata.VertexHashCount) { selectionList[cmindex].vertexHashList[cvindex] = cmdata.vertexHashList[cvindex]; } } } } } else { // そのまま selectionList[0].selectData[i] = data; } } // データハッシュ設定 CreateVerifyData(); }