public static Vertex[] CreateVertexList(PropInfo source) { var list = new List <Vertex>(); var tempDictVPos = new Dictionary <Vector3, Vertex>(); var sourceVertices = source.m_mesh.vertices; var dependencyData = source.m_material.name; bool loadDependencyData = false; if (dependencyData.Contains("[ProceduralObj]")) { dependencyData = dependencyData.Replace("[ProceduralObj]", ""); loadDependencyData = true; } for (int i = 0; i < sourceVertices.Count(); i++) { Vector3 _vertex = sourceVertices[i]; Vertex v = new Vertex(); v.Position = _vertex; v.Index = i; v.Locked = false; if (tempDictVPos.ContainsKey(_vertex)) { v.IsDependent = true; v.DependencyIndex = tempDictVPos[_vertex].Index; } else { v.IsDependent = false; tempDictVPos.Add(_vertex, v); } list.Add(v); } if (loadDependencyData) { ProceduralObjectAssetUtils.LoadDependencies(list, dependencyData); } return(list.ToArray()); }
public static Vertex[] CreateVertexList(ProceduralObject source) { var list = new List <Vertex>(); var sourceVertices = source.m_mesh.vertices; var dependencyData = source.m_material.name; bool loadDependencyData = false; if (dependencyData.Contains("[ProceduralObj]")) { dependencyData = dependencyData.Replace("[ProceduralObj]", ""); loadDependencyData = true; // Debug.Log("data found for object " + source.basePrefabName + " : " + dependencyData); } for (int i = 0; i < sourceVertices.Count(); i++) { Vector3 _vertex = sourceVertices[i]; Vertex v = new Vertex(); v.Position = _vertex; v.Index = i; v.Locked = false; List <Vertex> depV = list.Where(vertex => vertex.Position == _vertex).ToList(); if (depV.Count > 0) { v.IsDependent = true; v.DependencyIndex = depV.First().Index; } else { v.IsDependent = false; } list.Add(v); } if (loadDependencyData) { ProceduralObjectAssetUtils.LoadDependencies(list, dependencyData); } return(list.ToArray()); }