@@ -0,0 +1,50 @@
#define PROTOTYPE
using UnityEngine;
using UnityEditor;
using System.Collections;
using ProBuilder2.EditorCommon;

namespace ProBuilder2.Actions
{
/**
* Menu interface for manually re-generating all ProBuilder geometry in scene.
*/
public class pb_ForceSceneRefresh : Editor
{
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Repair/Force Refresh Scene", false, pb_Constant.MENU_REPAIR)]
public static void MenuForceSceneRefresh()
{
ForceRefresh(true);
}

/**
* \brief Force refreshes all meshes in scene.
*/
private static void ForceRefresh(bool interactive)
{
pb_Object[] all = (pb_Object[])GameObject.FindObjectsOfType(typeof(pb_Object));
for(int i = 0; i < all.Length; i++)
{
if(interactive)
EditorUtility.DisplayProgressBar(
"Refreshing ProBuilder Objects",
"Reshaping pb_Object " + all[i].id + ".",
((float)i / all.Length));

try
{
all[i].ToMesh();
all[i].Refresh();
all[i].Optimize();
}
catch {}
}

if(interactive)
{
EditorUtility.ClearProgressBar();
EditorUtility.DisplayDialog("Refresh ProBuilder Objects", "Successfully refreshed all ProBuilder objects in scene.", "Okay");
}
}
}
}
@@ -0,0 +1,93 @@
#define PROTOTYPE
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using ProBuilder2.Common;
using ProBuilder2.MeshOperations;
using ProBuilder2.EditorCommon;

namespace ProBuilder2.Actions
{
/**
* Menu interface for manually regenerating all ProBuilder mesh references in scene.
*/
public class pb_RebuildMeshes : Editor
{
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Repair/Rebuild ProBuilder Objects", true, pb_Constant.MENU_REPAIR)]
private static bool VertifyRebuildMeshes()
{
return pbUtil.GetComponents<pb_Object>(Selection.transforms).Length > 0;
}

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Repair/Rebuild ProBuilder Objects", false, pb_Constant.MENU_REPAIR)]
public static void DoRebuildMeshes()
{
StripAndProBuilderize( pbUtil.GetComponents<pb_Object>(Selection.transforms) );
}

/**
* \brief Rebuild targets if they can't be refreshed.
*/
private static void StripAndProBuilderize(pb_Object[] targets, bool interactive = true)
{
for(int i = 0; i < targets.Length; i++)
{
if(interactive)
{
EditorUtility.DisplayProgressBar(
"Refreshing ProBuilder Objects",
"Reshaping pb_Object " + targets[i].id + ".",
((float)i / targets.Length));
}

pb_Object pb = targets[i];

try
{
pb.ToMesh();
pb.Refresh();
pb.Optimize();
}
catch
{
if(pb.msh != null)
RebuildProBuilderMesh(pb);
}
}

if(interactive)
{
EditorUtility.ClearProgressBar();
EditorUtility.DisplayDialog("Rebuild ProBuilder Objects", "Successfully rebuilt " + targets.Length + " ProBuilder Objects", "Okay");
}
}

private static void RebuildProBuilderMesh(pb_Object pb)
{
try
{
GameObject go = pb.gameObject;
pb.dontDestroyMeshOnDelete = true;
Undo.DestroyObjectImmediate(pb);

// don't delete pb_Entity here because it won't
// actually get removed till the next frame, and
// probuilderize wants to add it if it's missing
// (which it looks like it is from c# side but
// is not)

pb = Undo.AddComponent<pb_Object>(go);
pbMeshOps.ResetPbObjectWithMeshFilter(pb, true);

pb.ToMesh();
pb.Refresh();
pb.Optimize();
}
catch(System.Exception e)
{
Debug.LogError("Failed rebuilding ProBuilder mesh: " + e.ToString());
}
}
}
}
@@ -0,0 +1,67 @@
#define PROTOTYPE
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using ProBuilder2.Common;
using ProBuilder2.MeshOperations;
using ProBuilder2.EditorCommon;

namespace ProBuilder2.Actions
{
/**
* Menu interface for manually regenerating all ProBuilder shared indices caches in selection.
*/
public class pb_RebuildSharedIndices : Editor
{
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Repair/Rebuild Shared Indices Cache", true, pb_Constant.MENU_REPAIR)]
private static bool VertifyRebuildMeshes()
{
return pbUtil.GetComponents<pb_Object>(Selection.transforms).Length > 0;
}

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Repair/Rebuild Shared Indices Cache", false, pb_Constant.MENU_REPAIR)]
public static void DoRebuildMeshes()
{
RebuildSharedIndices( pbUtil.GetComponents<pb_Object>(Selection.transforms) );
}

/**
* \brief Rebuild targets if they can't be refreshed.
*/
private static void RebuildSharedIndices(pb_Object[] targets, bool interactive = true)
{
for(int i = 0; i < targets.Length; i++)
{
if(interactive)
{
EditorUtility.DisplayProgressBar(
"Refreshing ProBuilder Objects",
"Reshaping pb_Object " + targets[i].id + ".",
((float)i / targets.Length));
}

pb_Object pb = targets[i];

try
{
pb.SetSharedIndices(pb_IntArrayUtility.ExtractSharedIndices(pb.vertices));

pb.ToMesh();
pb.Refresh();
pb.Optimize();
}
catch(System.Exception e)
{
Debug.LogError("Failed rebuilding " + pb.name + " shared indices cache.\n" + e.ToString());
}
}

if(interactive)
{
EditorUtility.ClearProgressBar();
EditorUtility.DisplayDialog("Rebuild Shared Index Cache", "Successfully rebuilt " + targets.Length + " shared index caches", "Okay");
}
}
}
}
@@ -0,0 +1,35 @@
#define PROTOTYPE
using UnityEditor;
using UnityEngine;
using System.Collections;
using ProBuilder2.MeshOperations;
using ProBuilder2.Common;
using ProBuilder2.EditorCommon;

namespace ProBuilder2.Actions
{
/**
* Menu interface for removing degerate triangles.
*/
public class pb_RemoveDegenerateTris : Editor
{
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Repair/Remove Degenerate Triangles", false, pb_Constant.MENU_REPAIR)]
public static void MenuRemoveDegenerateTriangles()
{
int count = 0;
foreach(pb_Object pb in pbUtil.GetComponents<pb_Object>(Selection.transforms))
{
pb.ToMesh();

int[] rm;
pb.RemoveDegenerateTriangles(out rm);
count += rm.Length;

pb.Refresh();
pb.Optimize();
}

pb_EditorUtility.ShowNotification("Removed " + (count/3) + " degenerate triangles.");
}
}
}
@@ -0,0 +1,36 @@
#define PROTOTYPE
using UnityEditor;
using UnityEngine;
using System.Collections;
using ProBuilder2.MeshOperations;
using ProBuilder2.Common;
using ProBuilder2.EditorCommon;

namespace ProBuilder2.Actions
{
/**
* Menu interface for replacing vertex colors on broken objces.
*/
public class pb_RepairColors : Editor
{
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Repair/Rebuild Vertex Colors", false, pb_Constant.MENU_REPAIR)]
public static void MenuRepairColors()
{
int count = 0;
foreach(pb_Object pb in pbUtil.GetComponents<pb_Object>(Selection.transforms))
{
if( pb.colors == null || pb.colors.Length != pb.vertexCount )
{
pb.ToMesh();
pb.SetColors(pbUtil.FilledArray<Color>(Color.white, pb.vertexCount));
pb.Refresh();
pb.Optimize();

count++;
}
}

pb_EditorUtility.ShowNotification("Rebuilt colors for " + count + " ProBuilder Objects.");
}
}
}
@@ -0,0 +1,47 @@
#define PROTOTYPE
#pragma warning disable 0168

using UnityEngine;
using UnityEditor;
using System.Collections;
using ProBuilder2.EditorCommon;

namespace ProBuilder2.Actions
{
/**
* Menu interface for manually regenerating all ProBuilder mesh references in scene.
*/
public class pb_RepairMeshReferences : Editor
{
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Repair/Repair Mesh References", false, pb_Constant.MENU_REPAIR)]
public static void MenuRefreshMeshReferences()
{
RefreshMeshReferences(true);
}

/**
* \brief Force refreshes all meshes in scene.
*/
private static void RefreshMeshReferences(bool interactive)
{
pb_Object[] all = (pb_Object[])GameObject.FindObjectsOfType(typeof(pb_Object));
for(int i = 0; i < all.Length; i++)
{
if(interactive)
EditorUtility.DisplayProgressBar(
"Refreshing ProBuilder Objects",
"Reshaping pb_Object " + all[i].id + ".",
((float)i / all.Length));

pb_Object pb = all[i];

pb_EditorUtility.VerifyMesh(pb);
}
if(interactive)
{
EditorUtility.ClearProgressBar();
EditorUtility.DisplayDialog("Refresh ProBuilder Objects", "Successfully refreshed all ProBuilder objects in scene.", "Okay");
}
}
}
}
@@ -0,0 +1,31 @@
#define PROTOTYPE
using UnityEditor;
using UnityEngine;
using ProBuilder2.EditorCommon;

namespace ProBuilder2.Actions
{
/**
* UV scale parameter was inverted with the 2.3 update. This provides functions to quickly fix that.
*/
public class pb_RepairUV : Editor
{
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Repair/Invert UV Scale (Scene)", false, pb_Constant.MENU_REPAIR + 30)]
public static void MenuInvertSceneFaceUVScale()
{
pb_Upgrade.InvertUVScale_Scene();
}

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Repair/Invert UV Scale (Selected Objects)", false, pb_Constant.MENU_REPAIR + 30)]
public static void MenuInvertSelectedObjectsUVScale()
{
pb_Upgrade.InvertUVScale_Selection();
}

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Repair/Invert UV Scale (Selected Faces)", false, pb_Constant.MENU_REPAIR + 30)]
public static void MenuInvertSelectedFacesUVScale()
{
pb_Upgrade.InvertUVScale_SelectedFaces();
}
}
}
@@ -0,0 +1,55 @@
#define PROTOTYPE
using UnityEngine;
using UnityEditor;
using System.Collections;
using ProBuilder2.EditorCommon;
using ProBuilder2.Common;
using System.Linq;

namespace ProBuilder2.Actions
{
/**
* Menu interface for resetting the materials associated with special entity types.
*/
public class pb_ResetEntityMaterials : Editor
{
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Repair/Repair Entity Materials", false, pb_Constant.MENU_REPAIR)]
public static void MenuRefreshMeshReferences()
{
RepairEntityMaterials();
}

/**
* \brief Force refreshes all meshes in scene.
*/
private static void RepairEntityMaterials()
{
IEnumerable all = GameObject.FindObjectsOfType(typeof(pb_Entity))
.Where(x => ((pb_Entity)x).entityType == EntityType.Collider || ((pb_Entity)x).entityType == EntityType.Trigger);

Material ColliderMat = pb_Constant.ColliderMaterial;
Material TriggerMat = pb_Constant.TriggerMaterial;

if( ColliderMat == null )
{
Debug.LogError("ProBuilder cannot find Collider material! Make sure the Collider material asset is in \"Assets/ProCore/ProBuilder/Resources/Material\" folder.");
return;
}

if( TriggerMat == null )
{
Debug.LogError("ProBuilder cannot find Trigger material! Make sure the Trigger material asset is in \"Assets/ProCore/ProBuilder/Resources/Material\" folder.");
return;
}

foreach(pb_Entity ent in all)
{
MeshRenderer mr = ent.transform.GetComponent<MeshRenderer>() ?? ent.gameObject.AddComponent<MeshRenderer>();

mr.sharedMaterials = new Material[1] { ent.entityType == EntityType.Collider ? ColliderMat : TriggerMat };
}

EditorUtility.DisplayDialog("Repair Entity Materials", "Successfully reset special entity materials in scene.", "Okay");
}
}
}
@@ -0,0 +1,67 @@
#define PROTOTYPE
using UnityEngine;
using UnityEditor;
using System.Collections;
using ProBuilder2.EditorCommon;
using System.Linq;

namespace ProBuilder2.Actions
{
/**
* Menu interface for applying materials to pb_Object after upgrading from Basic to Advanced.
*/
public class pb_UpgradeBasicToAdvanced : Editor
{
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Repair/Upgrade Scene to Advanced", false, pb_Constant.MENU_REPAIR + 10)]
public static void MenuUpgradeSceneAdvanced()
{
if( !EditorUtility.DisplayDialog("Upgrade Scene to Advanced", "This utility sets the materials on every ProBuilder object in the scene. Continue?", "Okay", "Cancel") )
return;

DoUpgrade((pb_Object[]) Resources.FindObjectsOfTypeAll(typeof(pb_Object)));

EditorUtility.DisplayDialog("Upgrade ProBuilder Objects", "Successfully upgraded all ProBuilder objects in scene.\n\nIf any of the objects in the scene were prefabs you'll need to 'Apply' changes.", "Okay");
}

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Repair/Upgrade Selection to Advanced", false, pb_Constant.MENU_REPAIR + 10)]
public static void MenuUpgradeSelectionAdvanced()
{
if( !EditorUtility.DisplayDialog("Upgrade Selection to Advanced", "This utility sets the materials on every selected ProBuilder object. Continue?", "Okay", "Cancel") )
return;

DoUpgrade( Selection.gameObjects.SelectMany(x => x.GetComponentsInChildren<pb_Object>()).ToArray() );

EditorUtility.DisplayDialog("Upgrade ProBuilder Objects", "Successfully upgraded all ProBuilder objects in selection", "Okay");
}

private static void DoUpgrade(pb_Object[] all)
{
bool interactive = all != null && all.Length > 8;

for(int i = 0 ; i < all.Length; i++)
{
pb_Object pb = all[i];

if(interactive)
{
EditorUtility.DisplayProgressBar(
"Applying Materials",
"Setting pb_Object " + all[i].id + ".",
((float)i / all.Length));
}

pb.SetFaceMaterial(pb.faces, pb.gameObject.GetComponent<MeshRenderer>().sharedMaterial);

pb.ToMesh();
pb.Refresh();
pb.Optimize();
}

if(interactive)
{
EditorUtility.ClearProgressBar();
}

}
}
}
@@ -0,0 +1,18 @@
#define PROTOTYPE
using UnityEditor;
using UnityEngine;
using ProBuilder2.MeshOperations;
using System.Collections.Generic;
using System.Linq;
using ProBuilder2.Common;
using ProBuilder2.EditorCommon;

namespace ProBuilder2.Actions
{
/**
* Deprecated as of 2.6.0.
* This file remains only for backwards compatibility; you may
* safely delete it.
*/
public class pb_EdgeSelection : Editor {}
}
@@ -0,0 +1,18 @@
#define PROTOTYPE
using UnityEngine;
using UnityEditor;
using System.Collections;
using ProBuilder2.Common;
using ProBuilder2.EditorCommon;

namespace ProBuilder2.Actions
{
/**
* Menu interface for 'Grow Selection' and 'Shrink Selection'
*
* Deprecated as of 2.6.0.
* This file remains only for backwards compatibility; you may
* safely delete it.
*/
public class pb_ExpandSelection : Editor {}
}
@@ -0,0 +1,22 @@
#define PROTOTYPE
// Thanks to forum member @Igmon for this feature suggestion:
// http://www.sixbysevenstudio.com/forum/viewtopic.php?f=14&t=2374&p=4351#p4351

using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using ProBuilder2.Common;
using ProBuilder2.EditorCommon;

namespace ProBuilder2.Actions
{
/**
* Menu interface for inverting the current element selection.
*
* Deprecated as of 2.6.0.
* This file remains only for backwards compatibility; you may
* safely delete it.
*/
public class pb_InvertSelection : Editor {}
}
@@ -0,0 +1,20 @@
#define PROTOTYPE
using UnityEditor;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using ProBuilder2.Common;
using ProBuilder2.EditorCommon;
using System.Linq;

namespace ProBuilder2.Actions
{
/**
* Menu actions for selecting faces with a material or vertex color.
*
* Deprecated as of 2.6.0.
* This file remains only for backwards compatibility; you may
* safely delete it.
*/
public class pb_MaterialSelection : Editor {}
}
Binary file not shown.
@@ -0,0 +1,128 @@
#define PROTOTYPE
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using ProBuilder2.Common;
using ProBuilder2.EditorCommon;

public class pb_MenuItems : EditorWindow
{
// const string DOCUMENTATION_URL = "http://www.protoolsforunity3d.com/docs/probuilder/";
const string DOCUMENTATION_URL = "http://procore3d.github.io/probuilder2/";

static pb_Editor editor { get { return pb_Editor.instance; } }

#region WINDOW

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/About", false, pb_Constant.MENU_ABOUT)]
public static void MenuInitAbout()
{
pb_AboutWindow.Init(true);
}

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Documentation", false, pb_Constant.MENU_ABOUT)]
public static void MenuInitDocumentation()
{
Application.OpenURL(DOCUMENTATION_URL);
}

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/" + pb_Constant.PRODUCT_NAME + " Window", false, pb_Constant.MENU_EDITOR)]
public static void OpenEditorWindow()
{
pb_Editor.MenuOpenWindow();
}
#endregion

#region CONTEXT SENSITIVE SHORTCUTS

static pb_Object[] selection { get { return Selection.transforms.GetComponents<pb_Object>(); } }

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Geometry/Extrude %e", true)]
static bool MenuVerifyExtrude()
{
pb_Editor e = pb_Editor.instance;

return e != null &&
e.editLevel == EditLevel.Geometry &&
selection != null &&
selection.Length > 0 &&
(selection.Any(x => x.SelectedEdgeCount > 0) || selection.Any(x => x.SelectedFaces.Length > 0));
}

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Geometry/Extrude %e", false, pb_Constant.MENU_GEOMETRY + 3)]
static void MenuDoExtrude()
{
pb_Menu_Commands.MenuExtrude(selection, false);
}
#endregion

#region VERTEX COLORS

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 1 &#1", true, pb_Constant.MENU_VERTEX_COLORS)]
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 2 &#2", true, pb_Constant.MENU_VERTEX_COLORS)]
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 3 &#3", true, pb_Constant.MENU_VERTEX_COLORS)]
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 4 &#4", true, pb_Constant.MENU_VERTEX_COLORS)]
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 5 &#5", true, pb_Constant.MENU_VERTEX_COLORS)]
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 6 &#6", true, pb_Constant.MENU_VERTEX_COLORS)]
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 7 &#7", true, pb_Constant.MENU_VERTEX_COLORS)]
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 8 &#8", true, pb_Constant.MENU_VERTEX_COLORS)]
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 9 &#9", true, pb_Constant.MENU_VERTEX_COLORS)]
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 0 &#0", true, pb_Constant.MENU_VERTEX_COLORS)]
public static bool VerifyApplyVertexColor()
{
return pb_Editor.instance != null && pb_Editor.instance.selectedVertexCount > 0;
}

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 1 &#1", false, pb_Constant.MENU_VERTEX_COLORS)]
public static void MenuSetVertexColorPreset1() {
pb_Vertex_Color_Toolbar.SetFaceColors(1);
}

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 2 &#2", false, pb_Constant.MENU_VERTEX_COLORS)]
public static void MenuSetVertexColorPreset2() {
pb_Vertex_Color_Toolbar.SetFaceColors(2);
}

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 3 &#3", false, pb_Constant.MENU_VERTEX_COLORS)]
public static void MenuSetVertexColorPreset3() {
pb_Vertex_Color_Toolbar.SetFaceColors(3);
}

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 4 &#4", false, pb_Constant.MENU_VERTEX_COLORS)]
public static void MenuSetVertexColorPreset4() {
pb_Vertex_Color_Toolbar.SetFaceColors(4);
}

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 5 &#5", false, pb_Constant.MENU_VERTEX_COLORS)]
public static void MenuSetVertexColorPreset5() {
pb_Vertex_Color_Toolbar.SetFaceColors(5);
}

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 6 &#6", false, pb_Constant.MENU_VERTEX_COLORS)]
public static void MenuSetVertexColorPreset6() {
pb_Vertex_Color_Toolbar.SetFaceColors(6);
}

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 7 &#7", false, pb_Constant.MENU_VERTEX_COLORS)]
public static void MenuSetVertexColorPreset7() {
pb_Vertex_Color_Toolbar.SetFaceColors(7);
}

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 8 &#8", false, pb_Constant.MENU_VERTEX_COLORS)]
public static void MenuSetVertexColorPreset8() {
pb_Vertex_Color_Toolbar.SetFaceColors(8);
}

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 9 &#9", false, pb_Constant.MENU_VERTEX_COLORS)]
public static void MenuSetVertexColorPreset9() {
pb_Vertex_Color_Toolbar.SetFaceColors(9);
}

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Vertex Colors/Set Selected Faces to Preset 0 &#0", false, pb_Constant.MENU_VERTEX_COLORS)]
public static void MenuSetVertexColorPreset0() {
pb_Vertex_Color_Toolbar.SetFaceColors(0);
}
#endregion
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -0,0 +1,74 @@
#define PROTOTYPE
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using ProBuilder2.Common;
using ProBuilder2.MeshOperations;
using System.Linq;

namespace ProBuilder2.EditorCommon
{

/**
* When building the project, remove all references to pb_Objects.
*/
public class pb_ScenePostProcessor
{
[PostProcessScene]
public static void OnPostprocessScene()
{
Material invisibleFaceMaterial = (Material)Resources.Load("Materials/InvisibleFace");

/**
* Hide nodraw faces if present.
*/
foreach(pb_Object pb in GameObject.FindObjectsOfType(typeof(pb_Object)))
{
if(pb.GetComponent<MeshRenderer>() == null)
continue;

if( pb.GetComponent<MeshRenderer>().sharedMaterials.Any(x => x != null && x.name.Contains("NoDraw")) )
{
Material[] mats = pb.GetComponent<MeshRenderer>().sharedMaterials;

for(int i = 0; i < mats.Length; i++)
{
if(mats[i].name.Contains("NoDraw"))
mats[i] = invisibleFaceMaterial;
}

pb.GetComponent<MeshRenderer>().sharedMaterials = mats;
}
}

if(EditorApplication.isPlayingOrWillChangePlaymode)
return;

foreach(pb_Object pb in GameObject.FindObjectsOfType(typeof(pb_Object)))
{
GameObject go = pb.gameObject;

pb_Entity entity = pb.gameObject.GetComponent<pb_Entity>();

if( entity == null )
continue;

if(entity.entityType == EntityType.Collider || entity.entityType == EntityType.Trigger)
go.GetComponent<MeshRenderer>().enabled = false;

// clear hideflags on prefab meshes
if(pb.msh != null)
pb.msh.hideFlags = HideFlags.None;

if(!pb_Preferences_Internal.GetBool(pb_Constant.pbStripProBuilderOnBuild))
return;

pb.dontDestroyMeshOnDelete = true;

GameObject.DestroyImmediate( pb );
GameObject.DestroyImmediate( go.GetComponent<pb_Entity>() );

}
}
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.