public static void RegisterAllSurfaces(ChiselBrushContainerAsset brushContainerAsset)
 {
     if (!brushContainerAsset || brushContainerAsset.SubMeshCount == 0)
     {
         return;
     }
     foreach (var brushMesh in brushContainerAsset.BrushMeshes)
     {
         if (brushMesh.polygons == null)
         {
             continue;
         }
         foreach (var polygon in brushMesh.polygons)
         {
             if (polygon.surface == null)
             {
                 continue;
             }
             if (polygon.surface.brushMaterial == null)
             {
                 polygon.surface.brushMaterial = ChiselBrushMaterial.CreateInstance();
                 if (polygon.surface.brushMaterial != null)
                 {
                     polygon.surface.brushMaterial.LayerUsage      = polygon.surface.brushMaterial.LayerUsage;
                     polygon.surface.brushMaterial.PhysicsMaterial = polygon.surface.brushMaterial.PhysicsMaterial;
                     polygon.surface.brushMaterial.RenderMaterial  = polygon.surface.brushMaterial.RenderMaterial;
                 }
             }
             ChiselBrushMaterialManager.Register(polygon.surface.brushMaterial);
         }
     }
 }
Esempio n. 2
0
 public static void RegisterAllSurfaces(ChiselBrushContainerAsset brushContainerAsset)
 {
     if (!brushContainerAsset || brushContainerAsset.SubMeshCount == 0)
     {
         return;
     }
     foreach (var brushMesh in brushContainerAsset.BrushMeshes)
     {
         if (brushMesh.polygons == null)
         {
             continue;
         }
         foreach (var polygon in brushMesh.polygons)
         {
             if (polygon.surface == null ||
                 polygon.surface.brushMaterial == null)
             {
                 continue;
             }
             ChiselBrushMaterialManager.Register(polygon.surface.brushMaterial);
         }
     }
 }