Browse Source

Remake the main museum area.

testbranch
Lisa Rein 6 years ago
parent
commit
8f754ea04e
100 changed files with 8068 additions and 0 deletions
  1. 10
    0
      Assets/ProCore.meta
  2. 10
    0
      Assets/ProCore/ProBuilder.meta
  3. 2
    0
      Assets/ProCore/ProBuilder/API Examples.meta
  4. 9
    0
      Assets/ProCore/ProBuilder/API Examples/Editor.meta
  5. 48
    0
      Assets/ProCore/ProBuilder/API Examples/Editor/ClearUnusedAttributes.cs
  6. 12
    0
      Assets/ProCore/ProBuilder/API Examples/Editor/ClearUnusedAttributes.cs.meta
  7. 257
    0
      Assets/ProCore/ProBuilder/API Examples/Editor/CreateShadowObject.cs
  8. 12
    0
      Assets/ProCore/ProBuilder/API Examples/Editor/CreateShadowObject.cs.meta
  9. 137
    0
      Assets/ProCore/ProBuilder/API Examples/Editor/CustomAction.cs
  10. 12
    0
      Assets/ProCore/ProBuilder/API Examples/Editor/CustomAction.cs.meta
  11. 157
    0
      Assets/ProCore/ProBuilder/API Examples/Editor/EditorCallbackViewer.cs
  12. 12
    0
      Assets/ProCore/ProBuilder/API Examples/Editor/EditorCallbackViewer.cs.meta
  13. 42
    0
      Assets/ProCore/ProBuilder/API Examples/Editor/RenameNewObjects.cs
  14. 12
    0
      Assets/ProCore/ProBuilder/API Examples/Editor/RenameNewObjects.cs.meta
  15. 46
    0
      Assets/ProCore/ProBuilder/API Examples/Editor/SetCustomUnwrapParams.cs
  16. 12
    0
      Assets/ProCore/ProBuilder/API Examples/Editor/SetCustomUnwrapParams.cs.meta
  17. 9
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT.meta
  18. 3082
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Audio Visualizer.unity
  19. 8
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Audio Visualizer.unity.meta
  20. 9
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Material.meta
  21. 144
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Material/Ico.mat
  22. 8
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Material/Ico.mat.meta
  23. BIN
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Material/ProBuilderIcon.tga
  24. 55
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Material/ProBuilderIcon.tga.meta
  25. 4
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/README.txt
  26. 4
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/README.txt.meta
  27. 9
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Scripts.meta
  28. 77
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Scripts/CameraControls.cs
  29. 12
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Scripts/CameraControls.cs.meta
  30. 272
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Scripts/IcoBumpin.cs
  31. 12
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Scripts/IcoBumpin.cs.meta
  32. 9
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox.meta
  33. 199
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space.mat
  34. 8
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space.mat.meta
  35. BIN
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_back.png
  36. 55
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_back.png.meta
  37. BIN
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_down.png
  38. 55
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_down.png.meta
  39. BIN
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_front.png
  40. 55
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_front.png.meta
  41. BIN
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_left.png
  42. 55
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_left.png.meta
  43. BIN
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_right.png
  44. 55
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_right.png.meta
  45. BIN
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_up.png
  46. 55
    0
      Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_up.png.meta
  47. 5
    0
      Assets/ProCore/ProBuilder/API Examples/Misc.meta
  48. 110
    0
      Assets/ProCore/ProBuilder/API Examples/Misc/HueCube.cs
  49. 8
    0
      Assets/ProCore/ProBuilder/API Examples/Misc/HueCube.cs.meta
  50. 9
    0
      Assets/ProCore/ProBuilder/API Examples/Procedural Mesh.meta
  51. 274
    0
      Assets/ProCore/ProBuilder/API Examples/Procedural Mesh/Extrude Random Edges.unity
  52. 8
    0
      Assets/ProCore/ProBuilder/API Examples/Procedural Mesh/Extrude Random Edges.unity.meta
  53. 74
    0
      Assets/ProCore/ProBuilder/API Examples/Procedural Mesh/ExtrudeRandomEdges.cs
  54. 12
    0
      Assets/ProCore/ProBuilder/API Examples/Procedural Mesh/ExtrudeRandomEdges.cs.meta
  55. 2
    0
      Assets/ProCore/ProBuilder/API Examples/Runtime Editing.meta
  56. 2
    0
      Assets/ProCore/ProBuilder/API Examples/Runtime Editing/Materials.meta
  57. 28
    0
      Assets/ProCore/ProBuilder/API Examples/Runtime Editing/Materials/Selection.mat
  58. 2
    0
      Assets/ProCore/ProBuilder/API Examples/Runtime Editing/Materials/Selection.mat.meta
  59. 26
    0
      Assets/ProCore/ProBuilder/API Examples/Runtime Editing/Materials/backdrop.mat
  60. 2
    0
      Assets/ProCore/ProBuilder/API Examples/Runtime Editing/Materials/backdrop.mat.meta
  61. 26
    0
      Assets/ProCore/ProBuilder/API Examples/Runtime Editing/Materials/instructions.mat
  62. 2
    0
      Assets/ProCore/ProBuilder/API Examples/Runtime Editing/Materials/instructions.mat.meta
  63. 236
    0
      Assets/ProCore/ProBuilder/API Examples/Runtime Editing/RuntimeEdit.cs
  64. 7
    0
      Assets/ProCore/ProBuilder/API Examples/Runtime Editing/RuntimeEdit.cs.meta
  65. 548
    0
      Assets/ProCore/ProBuilder/API Examples/Runtime Editing/RuntimeEdit.unity
  66. 2
    0
      Assets/ProCore/ProBuilder/API Examples/Runtime Editing/RuntimeEdit.unity.meta
  67. 28
    0
      Assets/ProCore/ProBuilder/API Examples/Runtime Editing/backdrop.mat
  68. 8
    0
      Assets/ProCore/ProBuilder/API Examples/Runtime Editing/backdrop.mat.meta
  69. BIN
      Assets/ProCore/ProBuilder/API Examples/Runtime Editing/backdrop.png
  70. 33
    0
      Assets/ProCore/ProBuilder/API Examples/Runtime Editing/backdrop.png.meta
  71. BIN
      Assets/ProCore/ProBuilder/API Examples/Runtime Editing/instructions.png
  72. 33
    0
      Assets/ProCore/ProBuilder/API Examples/Runtime Editing/instructions.png.meta
  73. 9
    0
      Assets/ProCore/ProBuilder/API Examples/Vertex Colors.meta
  74. 125
    0
      Assets/ProCore/ProBuilder/API Examples/Vertex Colors/HighlightNearestFace.cs
  75. 12
    0
      Assets/ProCore/ProBuilder/API Examples/Vertex Colors/HighlightNearestFace.cs.meta
  76. 307
    0
      Assets/ProCore/ProBuilder/API Examples/Vertex Colors/HighlightNearestFace.unity
  77. 8
    0
      Assets/ProCore/ProBuilder/API Examples/Vertex Colors/HighlightNearestFace.unity.meta
  78. 2
    0
      Assets/ProCore/ProBuilder/About.meta
  79. 2
    0
      Assets/ProCore/ProBuilder/About/Editor.meta
  80. 349
    0
      Assets/ProCore/ProBuilder/About/Editor/pb_AboutWindow.cs
  81. 13
    0
      Assets/ProCore/ProBuilder/About/Editor/pb_AboutWindow.cs.meta
  82. 91
    0
      Assets/ProCore/ProBuilder/About/Editor/pb_UpdateAvailable.cs
  83. 12
    0
      Assets/ProCore/ProBuilder/About/Editor/pb_UpdateAvailable.cs.meta
  84. 116
    0
      Assets/ProCore/ProBuilder/About/Editor/pb_UpdateCheck.cs
  85. 12
    0
      Assets/ProCore/ProBuilder/About/Editor/pb_UpdateCheck.cs.meta
  86. 145
    0
      Assets/ProCore/ProBuilder/About/Editor/pb_VersionInfo.cs
  87. 12
    0
      Assets/ProCore/ProBuilder/About/Editor/pb_VersionInfo.cs.meta
  88. 133
    0
      Assets/ProCore/ProBuilder/About/Editor/pb_VersionUtil.cs
  89. 12
    0
      Assets/ProCore/ProBuilder/About/Editor/pb_VersionUtil.cs.meta
  90. 9
    0
      Assets/ProCore/ProBuilder/About/Font.meta
  91. BIN
      Assets/ProCore/ProBuilder/About/Font/Asap-Medium.otf
  92. 20
    0
      Assets/ProCore/ProBuilder/About/Font/Asap-Medium.otf.meta
  93. BIN
      Assets/ProCore/ProBuilder/About/Font/Asap-Regular.otf
  94. 20
    0
      Assets/ProCore/ProBuilder/About/Font/Asap-Regular.otf.meta
  95. 47
    0
      Assets/ProCore/ProBuilder/About/Font/SIL Open Font License.txt
  96. 8
    0
      Assets/ProCore/ProBuilder/About/Font/SIL Open Font License.txt.meta
  97. 2
    0
      Assets/ProCore/ProBuilder/About/Images.meta
  98. BIN
      Assets/ProCore/ProBuilder/About/Images/Banner.png
  99. 76
    0
      Assets/ProCore/ProBuilder/About/Images/Banner.png.meta
  100. 0
    0
      Assets/ProCore/ProBuilder/About/Images/Banner_Hover.png

+ 10
- 0
Assets/ProCore.meta View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 637b1d8eb93254f98a51329df0354a35
folderAsset: yes
timeCreated: 1520993145
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 10
- 0
Assets/ProCore/ProBuilder.meta View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: b818abaff1d44cd4794b3c965141a9ee
folderAsset: yes
timeCreated: 1509985871
licenseType: Store
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 2
- 0
Assets/ProCore/ProBuilder/API Examples.meta View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 1332cbbfda3dc3047a82ee075cc64ebc

+ 9
- 0
Assets/ProCore/ProBuilder/API Examples/Editor.meta View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 7cd8820d61722204399c0807f7b80b79
folderAsset: yes
timeCreated: 1462295535
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 48
- 0
Assets/ProCore/ProBuilder/API Examples/Editor/ClearUnusedAttributes.cs View File

@@ -0,0 +1,48 @@
/**
* This script demonstrates one use case for the pb_EditorUtility.onMeshCompiled delegate.
*
* Whenever ProBuilder compiles a mesh it removes the colors, tangents, and uv attributes.
*/

// Uncomment this line to enable this script.
// #define PROBUILDER_API_EXAMPLE

#if PROBUILDER_API_EXAMPLE

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

[InitializeOnLoad]
public class ClearUnusedAttributes : Editor
{
/**
* Static constructor is called and subscribes to the OnMeshCompiled delegate.
*/
static ClearUnusedAttributes()
{
pb_EditorUtility.AddOnMeshCompiledListener(OnMeshCompiled);
}

~ClearUnusedAttributes()
{
pb_EditorUtility.RemoveOnMeshCompiledListener(OnMeshCompiled);
}

/**
* When a ProBuilder object is compiled to UnityEngine.Mesh this is called.
*/
static void OnMeshCompiled(pb_Object pb, Mesh mesh)
{
mesh.uv = null;
mesh.colors32 = null;
mesh.tangents = null;

// Print out the mesh attributes in a neatly formatted string.
// Debug.Log( pb_MeshUtility.Print(mesh) );
}
}

#endif

+ 12
- 0
Assets/ProCore/ProBuilder/API Examples/Editor/ClearUnusedAttributes.cs.meta View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 255036df22ecf4d7a97b59060752d963
timeCreated: 1471362751
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 257
- 0
Assets/ProCore/ProBuilder/API Examples/Editor/CreateShadowObject.cs View File

@@ -0,0 +1,257 @@
/**
* This script demonstrates how to create a new action that can be accessed from the
* ProBuilder toolbar.
*
* A new menu item is registered under "Geometry" actions called "Gen. Shadows".
*
* To enable, remove the #if PROBUILDER_API_EXAMPLE and #endif directives.
*/

// Uncomment this line to enable the menu action.
// #define PROBUILDER_API_EXAMPLE

#if PROBUILDER_API_EXAMPLE

using UnityEngine;
using UnityEditor;
using ProBuilder2.Common;
using ProBuilder2.MeshOperations;
using ProBuilder2.EditorCommon;
using ProBuilder2.Interface;
using System.Linq;
using System.Collections.Generic;
using UnityEngine.Rendering;

/**
* When creating your own actions please use your own namespace.
*/
namespace ProBuilder2.Actions
{
/**
* This class is responsible for loading the pb_MenuAction into the toolbar and menu.
*/
[InitializeOnLoad]
static class RegisterCustomAction
{
/**
* Static initializer is called when Unity loads the assembly.
*/
static RegisterCustomAction()
{
// This registers a new CreateShadowObject menu action with the toolbar.
pb_EditorToolbarLoader.RegisterMenuItem(InitCustomAction);
}

/**
* Helper function to load a new menu action object.
*/
static pb_MenuAction InitCustomAction()
{
return new CreateShadowObject();
}

/**
* Usually you'll want to add a menu item entry for your action.
* https://docs.unity3d.com/ScriptReference/MenuItem.html
*/
[MenuItem("Tools/ProBuilder/Object/Create Shadow Object", true)]
static bool MenuVerifyDoSomethingWithPbObject()
{
// Using pb_EditorToolbarLoader.GetInstance keeps MakeFacesDoubleSided as a singleton.
CreateShadowObject instance = pb_EditorToolbarLoader.GetInstance<CreateShadowObject>();
return instance != null && instance.IsEnabled();
}

[MenuItem("Tools/ProBuilder/Object/Create Shadow Object", false, pb_Constant.MENU_GEOMETRY + 3)]
static void MenuDoDoSomethingWithPbObject()
{
CreateShadowObject instance = pb_EditorToolbarLoader.GetInstance<CreateShadowObject>();

if(instance != null)
pb_EditorUtility.ShowNotification(instance.DoAction().notification);
}
}

/**
* This is the actual action that will be executed.
*/
public class CreateShadowObject : pb_MenuAction
{
public override pb_ToolbarGroup group { get { return pb_ToolbarGroup.Object; } }
public override Texture2D icon { get { return null; } }
public override pb_TooltipContent tooltip { get { return _tooltip; } }

private GUIContent gc_volumeSize = new GUIContent("Volume Size", "How far the shadow volume extends from the base mesh. To visualize, imagine the width of walls.\n\nYou can also select the child ShadowVolume object and turn the Shadow Casting Mode to \"One\" or \"Two\" sided to see the resulting mesh.");

private bool showPreview
{
get { return pb_PreferencesInternal.GetBool("pb_shadowVolumePreview", true); }
set { pb_PreferencesInternal.SetBool("pb_shadowVolumePreview", value); }
}

/**
* What to show in the hover tooltip window. pb_TooltipContent is similar to GUIContent, with the exception that it also
* includes an optional params[] char list in the constructor to define shortcut keys (ex, CMD_CONTROL, K).
*/
static readonly pb_TooltipContent _tooltip = new pb_TooltipContent
(
"Gen Shadow Obj",
"Creates a new ProBuilder mesh child with inverted normals that only exists to cast shadows. Use to create lit interior scenes with shadows from directional lights.\n\nNote that this exists largely as a workaround for real-time shadow light leaks. Baked shadows do not require this workaround.",
"" // Some combination of build settings can cause the compiler to not respection optional params in the pb_TooltipContent c'tor?
);

/**
* Determines if the action should be enabled or grayed out.
*/
public override bool IsEnabled()
{
// `selection` is a helper property on pb_MenuAction that returns a pb_Object[] array from the current selection.
return pb_Editor.instance != null &&
selection != null &&
selection.Length > 0;
}

/**
* Determines if the action should be loaded in the menu (ex, face actions shouldn't be shown when in vertex editing mode).
*/
public override bool IsHidden()
{
return pb_Editor.instance == null;
}

public override MenuActionState AltState()
{
return MenuActionState.VisibleAndEnabled;
}

public override void OnSettingsEnable()
{
if( showPreview )
DoAction();
}

public override void OnSettingsGUI()
{
GUILayout.Label("Create Shadow Volume Options", EditorStyles.boldLabel);

EditorGUI.BeginChangeCheck();

EditorGUI.BeginChangeCheck();
float volumeSize = pb_PreferencesInternal.GetFloat("pb_CreateShadowObject_volumeSize", .07f);
volumeSize = EditorGUILayout.Slider(gc_volumeSize, volumeSize, 0.001f, 1f);
if( EditorGUI.EndChangeCheck() )
pb_PreferencesInternal.SetFloat("pb_CreateShadowObject_volumeSize", volumeSize);

#if !UNITY_4_6 && !UNITY_4_7
EditorGUI.BeginChangeCheck();
ShadowCastingMode shadowMode = (ShadowCastingMode) pb_PreferencesInternal.GetInt("pb_CreateShadowObject_shadowMode", (int) ShadowCastingMode.ShadowsOnly);
shadowMode = (ShadowCastingMode) EditorGUILayout.EnumPopup("Shadow Casting Mode", shadowMode);
if(EditorGUI.EndChangeCheck())
pb_PreferencesInternal.SetInt("pb_CreateShadowObject_shadowMode", (int) shadowMode);
#endif

EditorGUI.BeginChangeCheck();
ExtrudeMethod extrudeMethod = (ExtrudeMethod) pb_PreferencesInternal.GetInt("pb_CreateShadowObject_extrudeMethod", (int) ExtrudeMethod.FaceNormal);
extrudeMethod = (ExtrudeMethod) EditorGUILayout.EnumPopup("Extrude Method", extrudeMethod);
if(EditorGUI.EndChangeCheck())
pb_PreferencesInternal.SetInt("pb_CreateShadowObject_extrudeMethod", (int) extrudeMethod);

if(EditorGUI.EndChangeCheck())
DoAction();

GUILayout.FlexibleSpace();

if(GUILayout.Button("Create Shadow Volume"))
{
DoAction();
SceneView.RepaintAll();
pb_MenuOption.CloseAll();
}
}

/**
* Do the thing. Return a pb_ActionResult indicating the success/failure of action.
*/
public override pb_ActionResult DoAction()
{
#if !UNITY_4_6 && !UNITY_4_7
ShadowCastingMode shadowMode = (ShadowCastingMode) pb_PreferencesInternal.GetInt("pb_CreateShadowObject_shadowMode", (int) ShadowCastingMode.ShadowsOnly);
#endif
float extrudeDistance = pb_PreferencesInternal.GetFloat("pb_CreateShadowObject_volumeSize", .08f);
ExtrudeMethod extrudeMethod = (ExtrudeMethod) pb_PreferencesInternal.GetInt("pb_CreateShadowObject_extrudeMethod", (int) ExtrudeMethod.FaceNormal);

foreach(pb_Object pb in selection)
{
pb_Object shadow = GetShadowObject(pb);

if(shadow == null)
continue;

foreach(pb_Face f in shadow.faces) { f.ReverseIndices(); f.manualUV = true; }
shadow.Extrude(shadow.faces, extrudeMethod, extrudeDistance);
shadow.ToMesh();
shadow.Refresh();
shadow.Optimize();

#if !UNITY_4_6 && !UNITY_4_7
MeshRenderer mr = shadow.gameObject.GetComponent<MeshRenderer>();
mr.shadowCastingMode = shadowMode;
if(shadowMode == ShadowCastingMode.ShadowsOnly)
mr.receiveShadows = false;
#endif

Collider collider = shadow.GetComponent<Collider>();

while(collider != null)
{
GameObject.DestroyImmediate(collider);
collider = shadow.GetComponent<Collider>();
}
}

// This is necessary! Otherwise the pb_Editor will be working with caches from
// outdated meshes and throw errors.
pb_Editor.Refresh();

return new pb_ActionResult(Status.Success, "Create Shadow Object");
}

private pb_Object GetShadowObject(pb_Object pb)
{
if(pb == null || pb.name.Contains("-ShadowVolume"))
return null;

for(int i = 0; i < pb.transform.childCount; i++)
{
Transform t = pb.transform.GetChild(i);

if(t.name.Equals(string.Format("{0}-ShadowVolume", pb.name)))
{
pb_Object shadow = t.GetComponent<pb_Object>();

if(shadow != null)
{
pbUndo.RecordObject(shadow, "Update Shadow Object");

pb_Face[] faces = new pb_Face[pb.faces.Length];

for(int nn = 0; nn < pb.faces.Length; nn++)
faces[nn] = new pb_Face(pb.faces[nn]);

shadow.GeometryWithVerticesFaces(pb.vertices, faces);
return shadow;
}
}
}

pb_Object new_shadow = pb_Object.InitWithObject(pb);
new_shadow.name = string.Format("{0}-ShadowVolume", pb.name);
new_shadow.MakeUnique();
new_shadow.transform.SetParent(pb.transform, false);
Undo.RegisterCreatedObjectUndo(new_shadow.gameObject, "Create Shadow Object");
return new_shadow;
}
}
}
#endif


+ 12
- 0
Assets/ProCore/ProBuilder/API Examples/Editor/CreateShadowObject.cs.meta View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4bbc3c3e2c0f81a44a2e2d4328f933a3
timeCreated: 1486739109
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 137
- 0
Assets/ProCore/ProBuilder/API Examples/Editor/CustomAction.cs View File

@@ -0,0 +1,137 @@
/**
* This script demonstrates how to create a new action that can be accessed from the
* ProBuilder toolbar.
*
* A new menu item is registered under "Geometry" actions called "Make Double-Sided".
*
* To enable, remove the #if PROBUILDER_API_EXAMPLE and #endif directives.
*/

// Uncomment this line to enable the menu action.
// #define PROBUILDER_API_EXAMPLE

#if PROBUILDER_API_EXAMPLE

using UnityEngine;
using UnityEditor;
using ProBuilder2.Common;
using ProBuilder2.EditorCommon;
using ProBuilder2.MeshOperations;
using ProBuilder2.Interface;
using System.Linq;
using System.Collections.Generic;

namespace MySpecialNamespace.Actions
{
/**
* This class is responsible for loading the pb_MenuAction into the toolbar and menu.
*/
[InitializeOnLoad]
static class RegisterCustomAction
{
/**
* Static initializer is called when Unity loads the assembly.
*/
static RegisterCustomAction()
{
// This registers a new MakeFacesDoubleSided menu action with the toolbar.
pb_EditorToolbarLoader.RegisterMenuItem(InitCustomAction);
}

/**
* Helper function to load a new menu action object.
*/
static pb_MenuAction InitCustomAction()
{
return new MakeFacesDoubleSided();
}

/**
* Usually you'll want to add a menu item entry for your action.
* https://docs.unity3d.com/ScriptReference/MenuItem.html
*/
[MenuItem("Tools/ProBuilder/Geometry/Make Faces Double-Sided", true)]
static bool MenuVerifyDoSomethingWithPbObject()
{
// Using pb_EditorToolbarLoader.GetInstance keeps MakeFacesDoubleSided as a singleton.
MakeFacesDoubleSided instance = pb_EditorToolbarLoader.GetInstance<MakeFacesDoubleSided>();
return instance != null && instance.IsEnabled();
}

[MenuItem("Tools/ProBuilder/Geometry/Make Faces Double-Sided", false, pb_Constant.MENU_GEOMETRY + 3)]
static void MenuDoDoSomethingWithPbObject()
{
MakeFacesDoubleSided instance = pb_EditorToolbarLoader.GetInstance<MakeFacesDoubleSided>();

if(instance != null)
pb_EditorUtility.ShowNotification(instance.DoAction().notification);
}
}

/**
* This is the actual action that will be executed.
*/
public class MakeFacesDoubleSided : pb_MenuAction
{
public override pb_ToolbarGroup group { get { return pb_ToolbarGroup.Geometry; } }
public override Texture2D icon { get { return null; } }
public override pb_TooltipContent tooltip { get { return _tooltip; } }

/**
* What to show in the hover tooltip window. pb_TooltipContent is similar to GUIContent, with the exception that it also
* includes an optional params[] char list in the constructor to define shortcut keys (ex, CMD_CONTROL, K).
*/
static readonly pb_TooltipContent _tooltip = new pb_TooltipContent
(
"Set Double-Sided",
"Adds another face to the back of the selected faces."
);

/**
* Determines if the action should be enabled or grayed out.
*/
public override bool IsEnabled()
{
// `selection` is a helper property on pb_MenuAction that returns a pb_Object[] array from the current selection.
return pb_Editor.instance != null &&
selection != null &&
selection.Length > 0 &&
selection.Any(x => x.SelectedFaceCount > 0);
}

/**
* Determines if the action should be loaded in the menu (ex, face actions shouldn't be shown when in vertex editing mode).
*/
public override bool IsHidden()
{
return pb_Editor.instance == null ||
pb_Editor.instance.editLevel != EditLevel.Geometry ||
pb_Editor.instance.selectionMode != SelectMode.Face;
}

/**
* Do the thing. Return a pb_ActionResult indicating the success/failure of action.
*/
public override pb_ActionResult DoAction()
{
pbUndo.RecordObjects(selection, "Make Double-Sided Faces");

foreach(pb_Object pb in selection)
{
pb_AppendDelete.DuplicateAndFlip(pb, pb.SelectedFaces);

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

// This is necessary! Otherwise the pb_Editor will be working with caches from
// outdated meshes and throw errors.
pb_Editor.Refresh();
return new pb_ActionResult(Status.Success, "Make Faces Double-Sided");
}
}
}
#endif


+ 12
- 0
Assets/ProCore/ProBuilder/API Examples/Editor/CustomAction.cs.meta View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1b70ba7a133f06b4ebfe9eac07618bb2
timeCreated: 1470926631
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 157
- 0
Assets/ProCore/ProBuilder/API Examples/Editor/EditorCallbackViewer.cs View File

@@ -0,0 +1,157 @@
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
using ProBuilder2.EditorCommon; // pb_Editor and pb_EditorUtility
using ProBuilder2.Interface; // pb_GUI_Utility
using ProBuilder2.Common; // EditLevel
using System.Linq; // Sum()

class EditorCallbackViewer : EditorWindow
{
[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/API Examples/Log Callbacks Window")]
static void MenuInitEditorCallbackViewer()
{
EditorWindow.GetWindow<EditorCallbackViewer>(true, "ProBuilder Callbacks", true).Show();
}

List<string> logs = new List<string>();
Vector2 scroll = Vector2.zero;
bool collapse = true;

static Color logBackgroundColor
{
get
{
return EditorGUIUtility.isProSkin ? new Color(.15f, .15f, .15f, .5f) : new Color(.8f, .8f, .8f, 1f);
}
}

static Color disabledColor
{
get
{
return EditorGUIUtility.isProSkin ? new Color(.3f, .3f, .3f, .5f) : new Color(.8f, .8f, .8f, 1f);
}
}

void OnEnable()
{
// Delegate for Top/Geometry/Texture mode changes.
pb_Editor.AddOnEditLevelChangedListener(OnEditLevelChanged);

// Called when a new ProBuilder object is created.
// note - this was added in ProBuilder 2.5.1
pb_EditorUtility.AddOnObjectCreatedListener(OnProBuilderObjectCreated);

// Called when the ProBuilder selection changes (can be object or element change).
// Also called when the geometry is modified by ProBuilder.
pb_Editor.OnSelectionUpdate += OnSelectionUpdate;

// Called when vertices are about to be modified.
pb_Editor.OnVertexMovementBegin += OnVertexMovementBegin;

// Called when vertices have been moved by ProBuilder.
pb_Editor.OnVertexMovementFinish += OnVertexMovementFinish;

// Called when the Unity mesh is rebuilt from ProBuilder mesh data.
pb_EditorUtility.AddOnMeshCompiledListener(OnMeshCompiled);
}

void OnDisable()
{
pb_Editor.RemoveOnEditLevelChangedListener(OnEditLevelChanged);
pb_EditorUtility.RemoveOnObjectCreatedListener(OnProBuilderObjectCreated);
pb_EditorUtility.RemoveOnMeshCompiledListener(OnMeshCompiled);
pb_Editor.OnSelectionUpdate -= OnSelectionUpdate;
pb_Editor.OnVertexMovementBegin -= OnVertexMovementBegin;
pb_Editor.OnVertexMovementFinish -= OnVertexMovementFinish;
}

void OnProBuilderObjectCreated(pb_Object pb)
{
AddLog("Instantiated new ProBuilder Object: " + pb.name);
}

void OnEditLevelChanged(int editLevel)
{
AddLog("Edit Level Changed: " + (EditLevel) editLevel);
}

void OnSelectionUpdate(pb_Object[] selection)
{
AddLog("Selection Updated: " + string.Format("{0} objects and {1} vertices selected.",
selection != null ? selection.Length : 0,
selection != null ? selection.Sum(x => x.SelectedTriangleCount) : 0));
}

void OnVertexMovementBegin(pb_Object[] selection)
{
AddLog("Began Moving Vertices");
}

void OnVertexMovementFinish(pb_Object[] selection)
{
AddLog("Finished Moving Vertices");
}
void OnMeshCompiled(pb_Object pb, Mesh mesh)
{
AddLog(string.Format("Mesh {0} rebuilt", pb.name));
}

void AddLog(string summary)
{
logs.Add(summary);
Repaint();
}

void OnGUI()
{
GUILayout.BeginHorizontal(EditorStyles.toolbar);

GUILayout.FlexibleSpace();

GUI.backgroundColor = collapse ? disabledColor : Color.white;
if(GUILayout.Button("Collapse", EditorStyles.toolbarButton))
collapse = !collapse;
GUI.backgroundColor = Color.white;

if(GUILayout.Button("Clear", EditorStyles.toolbarButton))
logs.Clear();

GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label("Callback Log", EditorStyles.boldLabel);
GUILayout.EndHorizontal();

Rect r = GUILayoutUtility.GetLastRect();
r.x = 0;
r.y = r.y + r.height + 6;
r.width = this.position.width;
r.height = this.position.height;

GUILayout.Space(4);

pb_EditorGUIUtility.DrawSolidColor(r, logBackgroundColor);

scroll = GUILayout.BeginScrollView(scroll);

int len = logs.Count;
int min = System.Math.Max(0, len - 1024);

for(int i = len - 1; i >= min; i--)
{
if( collapse &&
i > 0 &&
i < len - 1 &&
logs[i].Equals(logs[i-1]) &&
logs[i].Equals(logs[i+1]) )
continue;

GUILayout.Label(string.Format("{0,3}: {1}", i, logs[i]));
}

GUILayout.EndScrollView();
}
}

+ 12
- 0
Assets/ProCore/ProBuilder/API Examples/Editor/EditorCallbackViewer.cs.meta View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4dc43bb4409cdb043b8c42108c20d2eb
timeCreated: 1462295537
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 42
- 0
Assets/ProCore/ProBuilder/API Examples/Editor/RenameNewObjects.cs View File

@@ -0,0 +1,42 @@
/**
* This script demonstrates how one might use the OnproBuilderObjectCreated delegate.
*/

// Uncomment this line to enable this script.
// #define PROBUILDER_API_EXAMPLE

#if PROBUILDER_API_EXAMPLE

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

[InitializeOnLoad]
public class RenameNewObjects : Editor
{
/**
* Static constructor is called and subscribes to the OnProBuilderObjectCreated delegate.
*/
static RenameNewObjects()
{
pb_EditorUtility.AddOnObjectCreatedListener(OnProBuilderObjectCreated);
}

~RenameNewObjects()
{
pb_EditorUtility.RemoveOnObjectCreatedListener(OnProBuilderObjectCreated);
}

/**
* When a new object is created this function is called with a reference to the pb_Object
* last built.
*/
static void OnProBuilderObjectCreated(pb_Object pb)
{
pb.gameObject.name = string.Format("pb_{0}{1}", pb.gameObject.name, pb.GetInstanceID());
}
}

#endif

+ 12
- 0
Assets/ProCore/ProBuilder/API Examples/Editor/RenameNewObjects.cs.meta View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d59c0c36da11eb4438626da7051c9092
timeCreated: 1471362751
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 46
- 0
Assets/ProCore/ProBuilder/API Examples/Editor/SetCustomUnwrapParams.cs View File

@@ -0,0 +1,46 @@
/**
* Set new ProBuilder objects to use special UV2 unwrap params.
*/

// Uncomment this line to enable this script.
// #define PROBUILDER_API_EXAMPLE

#if PROBUILDER_API_EXAMPLE
using UnityEngine;
using UnityEditor;
using System.Collections;
using ProBuilder2.Common;
using ProBuilder2.EditorCommon;

[InitializeOnLoad]
public class SetUnwrapParams : Editor
{
/**
* Static constructor is called and subscribes to the OnProBuilderObjectCreated delegate.
*/
static SetUnwrapParams()
{
pb_EditorUtility.AddOnObjectCreatedListener(OnProBuilderObjectCreated);
}

~SetUnwrapParams()
{
pb_EditorUtility.RemoveOnObjectCreatedListener(OnProBuilderObjectCreated);
}

/**
* When a new object is created this function is called with a reference to the pb_Object
* last built.
*/
static void OnProBuilderObjectCreated(pb_Object pb)
{
pb_UnwrapParameters up = pb.unwrapParameters;
up.hardAngle = 88f; // range: 1f, 180f
up.packMargin = 15f; // range: 1f, 64f
up.angleError = 30f; // range: 1f, 75f
up.areaError = 15f; // range: 1f, 75f
}
}

#endif

+ 12
- 0
Assets/ProCore/ProBuilder/API Examples/Editor/SetCustomUnwrapParams.cs.meta View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f078f176bb8df5543a1ec7e3f1bcd4cd
timeCreated: 1472485272
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 9
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT.meta View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 227ec956bc61f9b4db4e9b031c7cd349
folderAsset: yes
timeCreated: 1430492099
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 3082
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Audio Visualizer.unity
File diff suppressed because it is too large
View File


+ 8
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Audio Visualizer.unity.meta View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0daf439e3ba1a4e469eabf083337aef7
timeCreated: 1430409674
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 9
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Material.meta View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 8d33b9d7789a85b46929af17f7ce5cf3
folderAsset: yes
timeCreated: 1430752296
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 144
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Material/Ico.mat View File

@@ -0,0 +1,144 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Ico
m_Shader: {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: []
m_CustomRenderQueue: -1
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _OcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _Cutoff
second: .5
data:
first:
name: _SrcBlend
second: 1
data:
first:
name: _DstBlend
second: 0
data:
first:
name: _Parallax
second: .0199999996
data:
first:
name: _ZWrite
second: 1
data:
first:
name: _Glossiness
second: .433999985
data:
first:
name: _BumpScale
second: 1
data:
first:
name: _OcclusionStrength
second: 1
data:
first:
name: _DetailNormalMapScale
second: 1
data:
first:
name: _UVSec
second: 0
data:
first:
name: _EmissionScaleUI
second: 0
data:
first:
name: _Mode
second: 0
data:
first:
name: _Metallic
second: .239999995
m_Colors:
data:
first:
name: _Color
second: {r: .264705896, g: .264705896, b: .264705896, a: 1}
data:
first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 0}
data:
first:
name: _EmissionColorUI
second: {r: 1, g: 1, b: 1, a: 1}

+ 8
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Material/Ico.mat.meta View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6acb458e3627cfb47b3a6cc6e8cbde22
timeCreated: 1430420618
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Material/ProBuilderIcon.tga View File


+ 55
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Material/ProBuilderIcon.tga.meta View File

@@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: d0260234d1358f84e89b381f81fe4228
timeCreated: 1431722871
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -2
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: 5
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

+ 4
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/README.txt View File

@@ -0,0 +1,4 @@
# Quick Start
1. Provide an audio clip to the AudioSource component on the FFT Source gameobject for this to work.
2. Once an audio clip is put in the `Audio Clip` field, run the scene.

+ 4
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/README.txt.meta View File

@@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 3a8a34809b06c50418c4d2ae4f91cbf1
TextScriptImporter:
userData:

+ 9
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Scripts.meta View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: d4fbaf964fde3a84493b674520e51822
folderAsset: yes
timeCreated: 1430752196
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 77
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Scripts/CameraControls.cs View File

@@ -0,0 +1,77 @@
/**
* Camera orbit controls.
*/

using UnityEngine;
using System.Collections;

namespace ProBuilder2.Examples
{
public class CameraControls : MonoBehaviour
{
const string INPUT_MOUSE_SCROLLWHEEL = "Mouse ScrollWheel";
const string INPUT_MOUSE_X = "Mouse X";
const string INPUT_MOUSE_Y = "Mouse Y";
const float MIN_CAM_DISTANCE = 10f;
const float MAX_CAM_DISTANCE = 40f;

// how fast the camera orbits
[Range(2f, 15f)]
public float orbitSpeed = 6f;

// how fast the camera zooms in and out
[Range(.3f,2f)]
public float zoomSpeed = .8f;

// the current distance from pivot point (locked to Vector3.zero)
float distance = 0f;

// how fast the idle camera movement is
public float idleRotation = 1f;

private Vector2 dir = new Vector2(.8f, .2f);

void Start()
{
distance = Vector3.Distance(transform.position, Vector3.zero);
}

void LateUpdate()
{
Vector3 eulerRotation = transform.localRotation.eulerAngles;
eulerRotation.z = 0f;

// orbits
if( Input.GetMouseButton(0) )
{
float rot_x = Input.GetAxis(INPUT_MOUSE_X);
float rot_y = -Input.GetAxis(INPUT_MOUSE_Y);

eulerRotation.x += rot_y * orbitSpeed;
eulerRotation.y += rot_x * orbitSpeed;

// idle direction is derived from last user input.
dir.x = rot_x;
dir.y = rot_y;
dir.Normalize();
}
else
{
eulerRotation.y += Time.deltaTime * idleRotation * dir.x;
eulerRotation.x += Time.deltaTime * Mathf.PerlinNoise(Time.time, 0f) * idleRotation * dir.y;
}

transform.localRotation = Quaternion.Euler( eulerRotation );
transform.position = transform.localRotation * (Vector3.forward * -distance);

if( Input.GetAxis(INPUT_MOUSE_SCROLLWHEEL) != 0f )
{
float delta = Input.GetAxis(INPUT_MOUSE_SCROLLWHEEL);

distance -= delta * (distance/MAX_CAM_DISTANCE) * (zoomSpeed * 1000) * Time.deltaTime;
distance = Mathf.Clamp(distance, MIN_CAM_DISTANCE, MAX_CAM_DISTANCE);
transform.position = transform.localRotation * (Vector3.forward * -distance);
}
}
}
}

+ 12
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Scripts/CameraControls.cs.meta View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 32fdb03cf8ee6094c841dd6f93b3e66a
timeCreated: 1430420844
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 272
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Scripts/IcoBumpin.cs View File

@@ -0,0 +1,272 @@
#if UNITY_EDITOR || UNITY_STANDALONE
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using ProBuilder2.Common;
using ProBuilder2.MeshOperations;

namespace ProBuilder2.Examples
{

[RequireComponent(typeof(AudioSource))]
public class IcoBumpin : MonoBehaviour
{
pb_Object ico; // A reference to the icosphere pb_Object component
Mesh icoMesh; // A reference to the icosphere mesh (cached because we access the vertex array every frame)
Transform icoTransform; // A reference to the icosphere transform component. Cached because I can't remember if GameObject.transform is still a performance drain :|
AudioSource audioSource;// Cached reference to the audiosource.

/**
* Holds a pb_Face, the normal of that face, and the index of every vertex that touches it (sharedIndices).
*/
struct FaceRef
{
public pb_Face face;
public Vector3 nrm; // face normal
public int[] indices; // all vertex indices (including shared connected vertices)

public FaceRef(pb_Face f, Vector3 n, int[] i)
{
face = f;
nrm = n;
indices = i;
}
}

// All faces that have been extruded
FaceRef[] outsides;

// Keep a copy of the original vertex array to calculate the distance from origin.
Vector3[] original_vertices, displaced_vertices;

// The radius of the mesh icosphere on instantiation.
[Range(1f, 10f)]
public float icoRadius = 2f;

// The number of subdivisions to give the icosphere.
[Range(0, 3)]
public int icoSubdivisions = 2;

// How far along the normal should each face be extruded when at idle (no audio input).
[Range(0f, 1f)]
public float startingExtrusion = .1f;

// The material to apply to the icosphere.
public Material material;

// The max distance a frequency range will extrude a face.
[Range(1f, 50f)]
public float extrusion = 30f;

// An FFT returns a spectrum including frequencies that are out of human hearing range -
// this restricts the number of bins used from the spectrum to the lower @fftBounds.
[Range(8, 128)]
public int fftBounds = 32;

// How high the icosphere transform will bounce (sample volume determines height).
[Range(0f, 10f)]
public float verticalBounce = 4f;

// Optionally weights the frequency amplitude when calculating extrude distance.
public AnimationCurve frequencyCurve;

// A reference to the line renderer that will be used to render the raw waveform.
public LineRenderer waveform;

// The y size of the waveform.
public float waveformHeight = 2f;

// How far from the icosphere should the waveform be.
public float waveformRadius = 20f;

// If @rotateWaveformRing is true, this is the speed it will travel.
public float waveformSpeed = .1f;

// If true, the waveform ring will randomly orbit the icosphere.
public bool rotateWaveformRing = false;

// If true, the waveform will bounce up and down with the icosphere.
public bool bounceWaveform = false;

public GameObject missingClipWarning;

// Icosphere's starting position.
Vector3 icoPosition = Vector3.zero;
float faces_length;

const float TWOPI = 6.283185f; // 2 * PI
const int WAVEFORM_SAMPLES = 1024; // How many samples make up the waveform ring.
const int FFT_SAMPLES = 4096; // How many samples are used in the FFT. More means higher resolution.

// Keep copy of the last frame's sample data to average with the current when calculating
// deformation amounts. Smoothes the visual effect.
float[] fft = new float[FFT_SAMPLES],
fft_history = new float[FFT_SAMPLES],
data = new float[WAVEFORM_SAMPLES],
data_history = new float[WAVEFORM_SAMPLES];

// Root mean square of raw data (volume, but not in dB).
float rms = 0f, rms_history = 0f;

/**
* Creates the icosphere, and loads all the cache information.
*/
void Start()
{
audioSource = GetComponent<AudioSource>();

if( audioSource.clip == null )
missingClipWarning.SetActive(true);

// Create a new icosphere.
ico = pb_ShapeGenerator.IcosahedronGenerator(icoRadius, icoSubdivisions);

// Shell is all the faces on the new icosphere.
pb_Face[] shell = ico.faces;

// Materials are set per-face on pb_Object meshes. pb_Objects will automatically
// condense the mesh to the smallest set of subMeshes possible based on materials.
#if !PROTOTYPE
foreach(pb_Face f in shell)
f.material = material;
#else
ico.gameObject.GetComponent<MeshRenderer>().sharedMaterial = material;
#endif

// Extrude all faces on the icosphere by a small amount. The third boolean parameter
// specifies that extrusion should treat each face as an individual, not try to group
// all faces together.
ico.Extrude(shell, ExtrudeMethod.IndividualFaces, startingExtrusion);

// ToMesh builds the mesh positions, submesh, and triangle arrays. Call after adding
// or deleting vertices, or changing face properties.
ico.ToMesh();

// Refresh builds the normals, tangents, and UVs.
ico.Refresh();

outsides = new FaceRef[shell.Length];
Dictionary<int, int> lookup = ico.sharedIndices.ToDictionary();

// Populate the outsides[] cache. This is a reference to the tops of each extruded column, including
// copies of the sharedIndices.
for(int i = 0; i < shell.Length; ++i)
outsides[i] = new FaceRef( shell[i],
pb_Math.Normal(ico, shell[i]),
ico.sharedIndices.AllIndicesWithValues(lookup, shell[i].distinctIndices).ToArray()
);

// Store copy of positions array un-modified
original_vertices = new Vector3[ico.vertices.Length];
System.Array.Copy(ico.vertices, original_vertices, ico.vertices.Length);

// displaced_vertices should mirror icosphere mesh vertices.
displaced_vertices = ico.vertices;

icoMesh = ico.msh;
icoTransform = ico.transform;

faces_length = (float)outsides.Length;

// Build the waveform ring.
icoPosition = icoTransform.position;
#if UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 || UNITY_5_3 || UNITY_5_4
waveform.SetVertexCount(WAVEFORM_SAMPLES);
#elif UNITY_5_5
waveform.numPositions = WAVEFORM_SAMPLES;
#else
waveform.positionCount = WAVEFORM_SAMPLES;
#endif


if( bounceWaveform )
waveform.transform.parent = icoTransform;

audioSource.Play();
}

void Update()
{
// fetch the fft spectrum
audioSource.GetSpectrumData(fft, 0, FFTWindow.BlackmanHarris);

// get raw data for waveform
audioSource.GetOutputData(data, 0);

// calculate root mean square (volume)
rms = RMS(data);

/**
* For each face, translate the vertices some distance depending on the frequency range assigned.
* Not using the TranslateVertices() pb_Object extension method because as a convenience, that method
* gathers the sharedIndices per-face on every call, which while not tremondously expensive in most
* contexts, is far too slow for use when dealing with audio, and especially so when the mesh is
* somewhat large.
*/
for(int i = 0; i < outsides.Length; i++)
{
float normalizedIndex = (i/faces_length);

int n = (int)(normalizedIndex*fftBounds);

Vector3 displacement = outsides[i].nrm * ( ((fft[n]+fft_history[n]) * .5f) * (frequencyCurve.Evaluate(normalizedIndex) * .5f + .5f)) * extrusion;

foreach(int t in outsides[i].indices)
{
displaced_vertices[t] = original_vertices[t] + displacement;
}
}

Vector3 vec = Vector3.zero;

// Waveform ring
for(int i = 0; i < WAVEFORM_SAMPLES; i++)
{
int n = i < WAVEFORM_SAMPLES-1 ? i : 0;
vec.x = Mathf.Cos((float)n/WAVEFORM_SAMPLES * TWOPI) * (waveformRadius + (((data[n] + data_history[n]) * .5f) * waveformHeight));
vec.z = Mathf.Sin((float)n/WAVEFORM_SAMPLES * TWOPI) * (waveformRadius + (((data[n] + data_history[n]) * .5f) * waveformHeight));

vec.y = 0f;

waveform.SetPosition(i, vec);
}

// Ring rotation
if( rotateWaveformRing )
{
Vector3 rot = waveform.transform.localRotation.eulerAngles;

rot.x = Mathf.PerlinNoise(Time.time * waveformSpeed, 0f) * 360f;
rot.y = Mathf.PerlinNoise(0f, Time.time * waveformSpeed) * 360f;

waveform.transform.localRotation = Quaternion.Euler(rot);
}

icoPosition.y = -verticalBounce + ((rms + rms_history) * verticalBounce);
icoTransform.position = icoPosition;

// Keep copy of last FFT samples so we can average with the current. Smoothes the movement.
System.Array.Copy(fft, fft_history, FFT_SAMPLES);
System.Array.Copy(data, data_history, WAVEFORM_SAMPLES);
rms_history = rms;

icoMesh.vertices = displaced_vertices;
}

/**
* Root mean square is a good approximation of perceived loudness.
*/
float RMS(float[] arr)
{
float v = 0f,
len = (float)arr.Length;

for(int i = 0; i < len; i++)
v += Mathf.Abs(arr[i]);

return Mathf.Sqrt(v / (float)len);
}
}
}
#endif

+ 12
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Scripts/IcoBumpin.cs.meta View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 846bc9a21176f194688069652bb1299b
timeCreated: 1430416040
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 9
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox.meta View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 705371b5d4fb86b4fa445d50ea42797b
folderAsset: yes
timeCreated: 1430743015
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 199
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space.mat View File

@@ -0,0 +1,199 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 5
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Space
m_Shader: {fileID: 104, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: -1
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _OcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _FrontTex
second:
m_Texture: {fileID: 2800000, guid: 760f3e975cb462c4cb9948cd150a6343, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BackTex
second:
m_Texture: {fileID: 2800000, guid: 5b16e194d8a47394d8bba2d7f22281dd, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _LeftTex
second:
m_Texture: {fileID: 2800000, guid: 4f323298b76d3fa45944036e8597b509, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _RightTex
second:
m_Texture: {fileID: 2800000, guid: f8ebd7b4946039d4587fbf987d710add, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _UpTex
second:
m_Texture: {fileID: 2800000, guid: 03f6d5b8c2b6ce54a9d3bad9227d22e8, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DownTex
second:
m_Texture: {fileID: 2800000, guid: 6925cd6e64cbdf14f823015144ddb2e2, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _Cutoff
second: .5
data:
first:
name: _Exposure
second: 1
data:
first:
name: _SrcBlend
second: 1
data:
first:
name: _DstBlend
second: 0
data:
first:
name: _Parallax
second: .0199999996
data:
first:
name: _ZWrite
second: 1
data:
first:
name: _Glossiness
second: .5
data:
first:
name: _BumpScale
second: 1
data:
first:
name: _OcclusionStrength
second: 1
data:
first:
name: _DetailNormalMapScale
second: 1
data:
first:
name: _UVSec
second: 0
data:
first:
name: _EmissionScaleUI
second: 0
data:
first:
name: _Mode
second: 0
data:
first:
name: _Metallic
second: 0
data:
first:
name: _Rotation
second: 0
m_Colors:
data:
first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}
data:
first:
name: _EmissionColorUI
second: {r: 1, g: 1, b: 1, a: 1}
data:
first:
name: _Tint
second: {r: .5, g: .5, b: .5, a: .5}

+ 8
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space.mat.meta View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: de1a4762e946d7a439d86780c041e661
timeCreated: 1430743144
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_back.png View File


+ 55
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_back.png.meta View File

@@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: 5b16e194d8a47394d8bba2d7f22281dd
timeCreated: 1430743015
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_down.png View File


+ 55
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_down.png.meta View File

@@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: 6925cd6e64cbdf14f823015144ddb2e2
timeCreated: 1430743015
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_front.png View File


+ 55
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_front.png.meta View File

@@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: 760f3e975cb462c4cb9948cd150a6343
timeCreated: 1430743015
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_left.png View File


+ 55
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_left.png.meta View File

@@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: 4f323298b76d3fa45944036e8597b509
timeCreated: 1430743015
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_right.png View File


+ 55
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_right.png.meta View File

@@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: f8ebd7b4946039d4587fbf987d710add
timeCreated: 1430743015
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_up.png View File


+ 55
- 0
Assets/ProCore/ProBuilder/API Examples/Icosphere FFT/Skybox/Space_up.png.meta View File

@@ -0,0 +1,55 @@
fileFormatVersion: 2
guid: 03f6d5b8c2b6ce54a9d3bad9227d22e8
timeCreated: 1430743015
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: 1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

+ 5
- 0
Assets/ProCore/ProBuilder/API Examples/Misc.meta View File

@@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 0729ab30ccdbbab4aabff8d0a7cb8357
folderAsset: yes
DefaultImporter:
userData:

+ 110
- 0
Assets/ProCore/ProBuilder/API Examples/Misc/HueCube.cs View File

@@ -0,0 +1,110 @@
#if UNITY_EDITOR || UNITY_STANDALONE
using UnityEngine;
using System.Collections;
using ProBuilder2.Common;
using System.Collections.Generic;

namespace ProBuilder2.Examples
{
/**
* Creates a cube on start and colors it's vertices programmitically.
*/
public class HueCube : MonoBehaviour
{
pb_Object pb;

void Start()
{
// Create a new ProBuilder cube to work with.
pb = pb_ShapeGenerator.CubeGenerator(Vector3.one);

// Cycle through each unique vertex in the cube (8 total), and assign a color
// to the index in the sharedIndices array.
int si_len = pb.sharedIndices.Length;
Color[] vertexColors = new Color[si_len];
for(int i = 0; i < si_len; i++)
{
vertexColors[i] = HSVtoRGB( (i/(float)si_len) * 360f, 1f, 1f);
}

// Now go through each face (vertex colors are stored the pb_Face class) and
// assign the pre-calculated index color to each index in the triangles array.
Color[] colors = pb.colors;

for(int CurSharedIndex = 0; CurSharedIndex < pb.sharedIndices.Length; CurSharedIndex++)
{
foreach(int CurIndex in pb.sharedIndices[CurSharedIndex].array)
{
colors[CurIndex] = vertexColors[CurSharedIndex];
}
}

pb.SetColors(colors);

// In order for these changes to take effect, you must refresh the mesh
// object.
pb.Refresh();
}

/**
* Convert HSV to RGB.
* http://www.cs.rit.edu/~ncs/color/t_convert.html
* r,g,b values are from 0 to 1
* h = [0,360], s = [0,1], v = [0,1]
* if s == 0, then h = -1 (undefined)
*/
static Color HSVtoRGB(float h, float s, float v )
{
float r, g, b;
int i;
float f, p, q, t;
if( s == 0 ) {
// achromatic (grey)
return new Color(v, v, v, 1f);
}
h /= 60; // sector 0 to 5
i = (int)Mathf.Floor( h );
f = h - i; // factorial part of h
p = v * ( 1 - s );
q = v * ( 1 - s * f );
t = v * ( 1 - s * ( 1 - f ) );

switch( i )
{
case 0:
r = v;
g = t;
b = p;
break;
case 1:
r = q;
g = v;
b = p;
break;
case 2:
r = p;
g = v;
b = t;
break;
case 3:
r = p;
g = q;
b = v;
break;
case 4:
r = t;
g = p;
b = v;
break;
default: // case 5:
r = v;
g = p;
b = q;
break;
}
return new Color(r, g, b, 1f);
}
}
}
#endif

+ 8
- 0
Assets/ProCore/ProBuilder/API Examples/Misc/HueCube.cs.meta View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 57910de6743b3ac49a59ade4c17e5764
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

+ 9
- 0
Assets/ProCore/ProBuilder/API Examples/Procedural Mesh.meta View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: fe0e93ec5a6d9451192001ac2e0bd1c3
folderAsset: yes
timeCreated: 1478810570
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 274
- 0
Assets/ProCore/ProBuilder/API Examples/Procedural Mesh/Extrude Random Edges.unity View File

@@ -0,0 +1,274 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
SceneSettings:
m_ObjectHideFlags: 0
m_PVSData:
m_PVSObjectsArray: []
m_PVSPortalsArray: []
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 6
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 6
m_GIWorkflowMode: 0
m_LightmapsMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 3
m_Resolution: 2
m_BakeResolution: 40
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AOMaxDistance: 1
m_Padding: 2
m_CompAOExponent: 1
m_LightmapParameters: {fileID: 0}
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_LightingDataAsset: {fileID: 0}
m_RuntimeCPUUsage: 25
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
accuratePlacement: 0
minRegionArea: 2
cellSize: 0.16666667
manualCellSize: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &231450020
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 231450022}
- 108: {fileID: 231450021}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &231450021
Light:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 231450020}
m_Enabled: 1
serializedVersion: 6
m_Type: 1
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 4
m_BounceIntensity: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
m_AreaSize: {x: 1, y: 1}
--- !u!4 &231450022
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 231450020}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
--- !u!1 &886956891
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 886956893}
- 114: {fileID: 886956892}
m_Layer: 0
m_Name: The Mesh
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &886956892
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 886956891}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 647536a1ee7364958a11fbb2798a2395, type: 3}
m_Name:
m_EditorClassIdentifier:
distance: 1
--- !u!4 &886956893
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 886956891}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
--- !u!1 &1926271974
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1926271979}
- 20: {fileID: 1926271978}
- 92: {fileID: 1926271977}
- 124: {fileID: 1926271976}
- 81: {fileID: 1926271975}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1926271975
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1926271974}
m_Enabled: 1
--- !u!124 &1926271976
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1926271974}
m_Enabled: 1
--- !u!92 &1926271977
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1926271974}
m_Enabled: 1
--- !u!20 &1926271978
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1926271974}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0.15294118, g: 0.15294118, b: 0.15294118, a: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
m_StereoMirrorMode: 0
--- !u!4 &1926271979
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1926271974}
m_LocalRotation: {x: 0.16308561, y: -0.83678967, z: 0.3770185, w: 0.36199895}
m_LocalPosition: {x: 3.97, y: 6.16, z: 3.73}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0

+ 8
- 0
Assets/ProCore/ProBuilder/API Examples/Procedural Mesh/Extrude Random Edges.unity.meta View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: be0a94d60788f47e297be6a98a5f888d
timeCreated: 1478810816
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 74
- 0
Assets/ProCore/ProBuilder/API Examples/Procedural Mesh/ExtrudeRandomEdges.cs View File

@@ -0,0 +1,74 @@
#if UNITY_EDITOR || UNITY_STANDALONE

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using ProBuilder2.Common;
using ProBuilder2.MeshOperations; // Extrude lives here
using System.Linq;

/**
* Do a snake-like thing with a quad and some extrudes.
*/
public class ExtrudeRandomEdges : MonoBehaviour
{
private pb_Object pb;
pb_Face lastExtrudedFace = null;
public float distance = 1f;

/**
* Build a starting point (in this case, a quad)
*/
void Start()
{
pb = pb_ShapeGenerator.PlaneGenerator(1, 1, 0, 0, ProBuilder2.Common.Axis.Up, false);
pb.SetFaceMaterial(pb.faces, pb_Constant.DefaultMaterial);
lastExtrudedFace = pb.faces[0];
}

void OnGUI()
{
if(GUILayout.Button("Extrude Random Edge"))
{
ExtrudeEdge();
}
}

void ExtrudeEdge()
{
pb_Face sourceFace = lastExtrudedFace;

// fetch a random perimeter edge connected to the last face extruded
List<pb_WingedEdge> wings = pb_WingedEdge.GetWingedEdges(pb);
IEnumerable<pb_WingedEdge> sourceWings = wings.Where(x => x.face == sourceFace);
List<pb_Edge> nonManifoldEdges = sourceWings.Where(x => x.opposite == null).Select(y => y.edge.local).ToList();
int rand = (int) Random.Range(0, nonManifoldEdges.Count);
pb_Edge sourceEdge = nonManifoldEdges[rand];

// get the direction this edge should extrude in
Vector3 dir = ((pb.vertices[sourceEdge.x] + pb.vertices[sourceEdge.y]) * .5f) - sourceFace.distinctIndices.Average(x => pb.vertices[x]);
dir.Normalize();

// this will be populated with the extruded edge
pb_Edge[] extrudedEdges;

// perform extrusion
pb.Extrude(new pb_Edge[] { sourceEdge }, 0f, false, true, out extrudedEdges);

// get the last extruded face
lastExtrudedFace = pb.faces.Last();

// not strictly necessary, but makes it easier to handle element selection
pb.SetSelectedEdges( extrudedEdges );

// translate the vertices
pb.TranslateVertices(pb.SelectedTriangles, dir * distance);

// rebuild mesh with new geometry added by extrude
pb.ToMesh();

// rebuild mesh normals, textures, collisions, etc
pb.Refresh();
}
}
#endif

+ 12
- 0
Assets/ProCore/ProBuilder/API Examples/Procedural Mesh/ExtrudeRandomEdges.cs.meta View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 647536a1ee7364958a11fbb2798a2395
timeCreated: 1476714504
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 2
- 0
Assets/ProCore/ProBuilder/API Examples/Runtime Editing.meta View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 01200e2d53910404684b5ca9a472bd0a

+ 2
- 0
Assets/ProCore/ProBuilder/API Examples/Runtime Editing/Materials.meta View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 150cc202fcd784e43b0b570a1c04e9b3

+ 28
- 0
Assets/ProCore/ProBuilder/API Examples/Runtime Editing/Materials/Selection.mat View File

@@ -0,0 +1,28 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Selection
m_Shader: {fileID: 4800000, guid: b7eb90c4fea16d34ab4d7caa19b870a3, type: 3}
m_ShaderKeywords: []
m_CustomRenderQueue: -1
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats: {}
m_Colors:
data:
first:
name: _Color
second: {r: 1, g: .283582091, b: .283582091, a: .592156887}

+ 2
- 0
Assets/ProCore/ProBuilder/API Examples/Runtime Editing/Materials/Selection.mat.meta View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c2ebcf09fae3a364b9b97caadd6b0017

+ 26
- 0
Assets/ProCore/ProBuilder/API Examples/Runtime Editing/Materials/backdrop.mat View File

@@ -0,0 +1,26 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: backdrop
m_Shader: {fileID: 7, guid: 0000000000000000e000000000000000, type: 0}
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 2800000, guid: 0b4c1564f776ac24f9df3708f138aeb6, type: 1}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats: {}
m_Colors:
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

+ 2
- 0
Assets/ProCore/ProBuilder/API Examples/Runtime Editing/Materials/backdrop.mat.meta View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a9b45cd97b8d5c64da839b63544e443d

+ 26
- 0
Assets/ProCore/ProBuilder/API Examples/Runtime Editing/Materials/instructions.mat View File

@@ -0,0 +1,26 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: instructions
m_Shader: {fileID: 10750, guid: 0000000000000000f000000000000000, type: 0}
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 2800000, guid: 93c5001afc1d69045b548160641d1c8f, type: 1}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats: {}
m_Colors:
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

+ 2
- 0
Assets/ProCore/ProBuilder/API Examples/Runtime Editing/Materials/instructions.mat.meta View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 247a692b4ab40424eb62d238e05454d9

+ 236
- 0
Assets/ProCore/ProBuilder/API Examples/Runtime Editing/RuntimeEdit.cs View File

@@ -0,0 +1,236 @@
#if UNITY_STANDALONE || UNITY_EDITOR

using UnityEngine;
using System.Collections;
using ProBuilder2.Common;

namespace ProBuilder2.Examples
{

/**
* \brief This class allows the user to select a single face at a time and move it forwards or backwards.
* More advanced usage of the ProBuilder API should make use of the pb_Object->SelectedFaces list to keep
* track of the selected faces.
*/
public class RuntimeEdit : MonoBehaviour
{
class pb_Selection
{
public pb_Object pb; ///< This is the currently selected ProBuilder object.
public pb_Face face; ///< Keep a reference to the currently selected face.

public pb_Selection(pb_Object _pb, pb_Face _face)
{
pb = _pb;
face = _face;
}

public bool HasObject()
{
return pb != null;
}

public bool IsValid()
{
return pb != null && face != null;
}

public bool Equals(pb_Selection sel)
{
if(sel != null && sel.IsValid())
return (pb == sel.pb && face == sel.face);
else
return false;
}

public void Destroy()
{
if(pb != null)
GameObject.Destroy(pb.gameObject);
}

public override string ToString()
{
return "pb_Object: " + pb == null ? "Null" : pb.name +
"\npb_Face: " + ( (face == null) ? "Null" : face.ToString() );
}
}

pb_Selection currentSelection;
pb_Selection previousSelection;

private pb_Object preview;
public Material previewMaterial;

/**
* \brief Wake up!
*/
void Awake()
{
SpawnCube();
}

/**
* \brief This is the usual Unity OnGUI method. We only use it to show a 'Reset' button.
*/
void OnGUI()
{
// To reset, nuke the pb_Object and build a new one.
if(GUI.Button(new Rect(5, Screen.height - 25, 80, 20), "Reset"))
{
currentSelection.Destroy();
Destroy(preview.gameObject);
SpawnCube();
}
}

/**
* \brief Creates a new ProBuilder cube and sets it up with a concave MeshCollider.
*/
void SpawnCube()
{
// This creates a basic cube with ProBuilder features enabled. See the ProBuilder.Shape enum to
// see all possible primitive types.
pb_Object pb = pb_ShapeGenerator.CubeGenerator(Vector3.one);

// The runtime component requires that a concave mesh collider be present in order for face selection
// to work.
pb.gameObject.AddComponent<MeshCollider>().convex = false;

// Now set it to the currentSelection
currentSelection = new pb_Selection(pb, null);
}

Vector2 mousePosition_initial = Vector2.zero;
bool dragging = false;
public float rotateSpeed = 100f;

/**
* \brief This is responsible for moving the camera around and not much else.
*/
public void LateUpdate()
{
if(!currentSelection.HasObject())
return;

if(Input.GetMouseButtonDown(1) || (Input.GetMouseButtonDown(0) && Input.GetKey(KeyCode.LeftAlt)))
{
mousePosition_initial = Input.mousePosition;
dragging = true;
}

if(dragging)
{
Vector2 delta = (Vector3)mousePosition_initial - (Vector3)Input.mousePosition;
Vector3 dir = new Vector3(delta.y, delta.x, 0f);

currentSelection.pb.gameObject.transform.RotateAround(Vector3.zero, dir, rotateSpeed * Time.deltaTime);

// If there is a currently selected face, update the preview.
if(currentSelection.IsValid())
RefreshSelectedFacePreview();
}

if(Input.GetMouseButtonUp(1) || Input.GetMouseButtonUp(0))
{
dragging = false;
}
}

/**
* \brief The 'meat' of the operation. This listens for a click event, then checks for a positive
* face selection. If the click has hit a pb_Object, select it.
*/
public void Update()
{
if(Input.GetMouseButtonUp(0) && !Input.GetKey(KeyCode.LeftAlt)) {

if(FaceCheck(Input.mousePosition))
{
if(currentSelection.IsValid())
{
// Check if this face has been previously selected, and if so, move the face.
// Otherwise, just accept this click as a selection.
if(!currentSelection.Equals(previousSelection))
{
previousSelection = new pb_Selection(currentSelection.pb, currentSelection.face);
RefreshSelectedFacePreview();
return;
}

Vector3 localNormal = pb_Math.Normal( pbUtil.ValuesWithIndices(currentSelection.pb.vertices, currentSelection.face.distinctIndices) );

if(Input.GetKey(KeyCode.LeftShift))
currentSelection.pb.TranslateVertices( currentSelection.face.distinctIndices, localNormal.normalized * -.5f );
else
currentSelection.pb.TranslateVertices( currentSelection.face.distinctIndices, localNormal.normalized * .5f );

// Refresh will update the Collision mesh volume, face UVs as applicatble, and normal information.
currentSelection.pb.Refresh();

// this create the selected face preview
RefreshSelectedFacePreview();
}
}
}
}

/**
* \brief This is how we figure out what face is clicked.
*/
public bool FaceCheck(Vector3 pos)
{
Ray ray = Camera.main.ScreenPointToRay (pos);
RaycastHit hit;

if( Physics.Raycast(ray.origin, ray.direction, out hit))
{
pb_Object hitpb = hit.transform.gameObject.GetComponent<pb_Object>();

if(hitpb == null)
return false;

Mesh m = hitpb.msh;

int[] tri = new int[3] {
m.triangles[hit.triangleIndex * 3 + 0],
m.triangles[hit.triangleIndex * 3 + 1],
m.triangles[hit.triangleIndex * 3 + 2]
};

currentSelection.pb = hitpb;

return hitpb.FaceWithTriangle(tri, out currentSelection.face);
}
return false;
}

void RefreshSelectedFacePreview()
{
// Copy the currently selected vertices in world space.
// World space so that we don't have to apply transforms
// to match the current selection.
Vector3[] verts = currentSelection.pb.VerticesInWorldSpace(currentSelection.face.indices);

// face.indices == triangles, so wind the face to match
int[] indices = new int[verts.Length];
for(int i = 0; i < indices.Length; i++)
indices[i] = i;

// Now go through and move the verts we just grabbed out about .1m from the original face.
Vector3 normal = pb_Math.Normal(verts);

for(int i = 0; i < verts.Length; i++)
verts[i] += normal.normalized * .01f;

if(preview)
Destroy(preview.gameObject);

preview = pb_Object.CreateInstanceWithVerticesFaces(verts, new pb_Face[] { new pb_Face(indices) });
preview.SetFaceMaterial(preview.faces, previewMaterial);
preview.ToMesh();
preview.Refresh();
}
}
}
#endif

+ 7
- 0
Assets/ProCore/ProBuilder/API Examples/Runtime Editing/RuntimeEdit.cs.meta View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e239496fc63271243ab37cc30b42a0e8
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}

+ 548
- 0
Assets/ProCore/ProBuilder/API Examples/Runtime Editing/RuntimeEdit.unity View File

@@ -0,0 +1,548 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
SceneSettings:
m_ObjectHideFlags: 0
m_PVSData:
m_PVSObjectsArray: []
m_PVSPortalsArray: []
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: .25
backfaceThreshold: 100
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 6
m_Fog: 0
m_FogColor: {r: .5, g: .5, b: .5, a: 1}
m_FogMode: 3
m_FogDensity: .00999999978
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_AmbientEquatorColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_AmbientGroundColor: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 3
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: .5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
--- !u!127 &3
LevelGameManager:
m_ObjectHideFlags: 0
--- !u!157 &4
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 5
m_GIWorkflowMode: 1
m_LightmapsMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 3
m_Resolution: 1
m_BakeResolution: 50
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AOMaxDistance: 1
m_Padding: 2
m_CompAOExponent: 0
m_LightmapParameters: {fileID: 0}
m_TextureCompression: 0
m_FinalGather: 0
m_FinalGatherRayCount: 1024
m_LightmapSnapshot: {fileID: 0}
m_RuntimeCPUUsage: 25
--- !u!196 &5
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentRadius: .5
agentHeight: 2
agentSlope: 45
agentClimb: .400000006
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
accuratePlacement: 0
minRegionArea: 2
cellSize: .166666657
manualCellSize: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &549287195
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 549287196}
- 114: {fileID: 549287197}
m_Layer: 0
m_Name: Runtime Editor
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &549287196
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 549287195}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
--- !u!114 &549287197
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 549287195}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e239496fc63271243ab37cc30b42a0e8, type: 3}
m_Name:
m_EditorClassIdentifier:
previewMaterial: {fileID: 2100000, guid: c2ebcf09fae3a364b9b97caadd6b0017, type: 2}
rotateSpeed: 100
--- !u!1 &646566838
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 646566839}
- 33: {fileID: 646566841}
- 64: {fileID: 646566842}
- 23: {fileID: 646566840}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &646566839
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 646566838}
m_LocalRotation: {x: .562421918, y: .303603142, z: -.232962832, w: .732963264}
m_LocalPosition: {x: -3.33320165, y: 1.23632455, z: -3.22161746}
m_LocalScale: {x: 1, y: 1, z: .5}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
--- !u!23 &646566840
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 646566838}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_Materials:
- {fileID: 2100000, guid: 247a692b4ab40424eb62d238e05454d9, type: 2}
m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0}
m_UseLightProbes: 0
m_ReflectionProbeUsage: 1
m_ProbeAnchor: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_ImportantGI: 0
m_AutoUVMaxDistance: .5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!33 &646566841
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 646566838}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!64 &646566842
MeshCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 646566838}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Convex: 0
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &1341752778
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1341752779}
- 108: {fileID: 1341752780}
m_Layer: 0
m_Name: Directional light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1341752779
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1341752778}
m_LocalRotation: {x: .571863174, y: -.726181448, z: .125739634, w: .360309243}
m_LocalPosition: {x: 2.90795159, y: 4.26741171, z: 4.78148508}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!108 &1341752780
Light:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1341752778}
m_Enabled: 1
serializedVersion: 6
m_Type: 1
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: .75999999
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:
m_Type: 1
m_Resolution: 3
m_Strength: .834999979
m_Bias: .0500000007
m_NormalBias: .400000006
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 1
m_BounceIntensity: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
m_AreaSize: {x: 1, y: 1}
--- !u!43 &1356376159
Mesh:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: pb_Mesh5086
serializedVersion: 8
m_SubMeshes:
- serializedVersion: 2
firstByte: 0
indexCount: 36
topology: 0
firstVertex: 0
vertexCount: 24
localAABB:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 8.30000019, y: 8.30000019, z: 8.30000019}
m_Shapes:
vertices: []
shapes: []
channels: []
fullWeights: []
m_BindPose: []
m_BoneNameHashes:
m_RootBoneNameHash: 0
m_MeshCompression: 0
m_IsReadable: 1
m_KeepVertices: 1
m_KeepIndices: 1
m_IndexBuffer: 00000200010001000200030004000600050005000600070008000a00090009000a000b000c000e000d000d000e000f00100012001100110012001300140016001500150016001700
m_Skin: []
m_VertexData:
m_CurrentChannels: 159
m_VertexCount: 24
m_Channels:
- stream: 0
offset: 0
format: 0
dimension: 3
- stream: 0
offset: 12
format: 0
dimension: 3
- stream: 0
offset: 24
format: 2
dimension: 4
- stream: 0
offset: 28
format: 0
dimension: 2
- stream: 0
offset: 36
format: 0
dimension: 2
- stream: 0
offset: 0
format: 0
dimension: 0
- stream: 0
offset: 0
format: 0
dimension: 0
- stream: 0
offset: 44
format: 0
dimension: 4
m_DataSize: 1440
_typelessdata: cdcc04c1cdcc04c1cdcc04410000000000000000000080bfffffffff0000000000000000211d2d3f0bd7a33c0000803f0000000000000000000080bfcdcc0441cdcc04c1cdcc04410000000000000000000080bfffffffff0000803f00000000211d2d3f69fea73e0000803f0000000000000000000080bfcdcc04c1cdcc0441cdcc04410000000000000000000080bfffffffff000000000000803f9dfd7b3f0bd7a33c0000803f0000000000000000000080bfcdcc0441cdcc0441cdcc04410000000000000000000080bfffffffff0000803f0000803f9dfd7b3f69fea73e0000803f0000000000000000000080bfcdcc0441cdcc04c1cdcc0441000080bf0000000000000000ffffffff000000000000000069fea73e0bd7a33c0000000000000000000080bf000080bfcdcc0441cdcc04c1cdcc04c1000080bf0000000000000000ffffffff0000803f000000000bd7a33c0bd7a33c0000000000000000000080bf000080bfcdcc0441cdcc0441cdcc0441000080bf0000000000000000ffffffff000000000000803f69fea73e69fea73e0000000000000000000080bf000080bfcdcc0441cdcc0441cdcc04c1000080bf0000000000000000ffffffff0000803f0000803f0bd7a33c69fea73e0000000000000000000080bf000080bfcdcc0441cdcc04c1cdcc04c100000000000000000000803fffffffff000000000000000069fea73e69fe273f000080bf0000000000000000000080bfcdcc04c1cdcc04c1cdcc04c100000000000000000000803fffffffff0000803f0000000069fea73ed93bb23e000080bf0000000000000000000080bfcdcc0441cdcc0441cdcc04c100000000000000000000803fffffffff000000000000803f0bd7a33c69fe273f000080bf0000000000000000000080bfcdcc04c1cdcc0441cdcc04c100000000000000000000803fffffffff0000803f0000803f0bd7a33cd93bb23e000080bf0000000000000000000080bfcdcc04c1cdcc04c1cdcc04c10000803f0000000000000000ffffffff000000000000000069fe273fd93bb23e00000000000000000000803f000080bfcdcc04c1cdcc04c1cdcc04410000803f0000000000000000ffffffff0000803f00000000d93bb23ed93bb23e00000000000000000000803f000080bfcdcc04c1cdcc0441cdcc04c10000803f0000000000000000ffffffff000000000000803f69fe273f69fe273f00000000000000000000803f000080bfcdcc04c1cdcc0441cdcc04410000803f0000000000000000ffffffff0000803f0000803fd93bb23e69fe273f00000000000000000000803f000080bfcdcc04c1cdcc0441cdcc044100000000000080bf00000000ffffffff0000803f0000803fd93bb23e0bd7a33c000080bf0000000000000000000080bfcdcc0441cdcc0441cdcc044100000000000080bf00000000ffffffff000000000000803fd93bb23e69fea73e000080bf0000000000000000000080bfcdcc04c1cdcc0441cdcc04c100000000000080bf00000000ffffffff0000803f0000000069fe273f0bd7a33c000080bf0000000000000000000080bfcdcc0441cdcc0441cdcc04c100000000000080bf00000000ffffffff000000000000000069fe273f69fea73e000080bf0000000000000000000080bfcdcc04c1cdcc04c1cdcc04c1000000000000803f00000000ffffffff00000000000000000bd7a33c211d2d3f0000803f0000000000000000000080bfcdcc0441cdcc04c1cdcc04c1000000000000803f00000000ffffffff0000803f000000000bd7a33c9dfd7b3f0000803f0000000000000000000080bfcdcc04c1cdcc04c1cdcc0441000000000000803f00000000ffffffff000000000000803f69fea73e211d2d3f0000803f0000000000000000000080bfcdcc0441cdcc04c1cdcc0441000000000000803f00000000ffffffff0000803f0000803f69fea73e9dfd7b3f0000803f0000000000000000000080bf
m_CompressedMesh:
m_Vertices:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_UV:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_Normals:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_Tangents:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_Weights:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_NormalSigns:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_TangentSigns:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_FloatColors:
m_NumItems: 0
m_Range: 0
m_Start: 0
m_Data:
m_BitSize: 0
m_BoneIndices:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_Triangles:
m_NumItems: 0
m_Data:
m_BitSize: 0
m_UVInfo: 0
m_LocalAABB:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 8.30000019, y: 8.30000019, z: 8.30000019}
m_MeshUsageFlags: 0
m_BakedConvexCollisionMesh:
m_BakedTriangleCollisionMesh:
m_MeshOptimized: 0
--- !u!1 &1445808442
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1445808443}
- 33: {fileID: 1445808445}
- 23: {fileID: 1445808444}
- 65: {fileID: 1445808446}
m_Layer: 0
m_Name: pb-Cube[Detail]-227056
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 17
m_IsActive: 1
--- !u!4 &1445808443
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1445808442}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
--- !u!23 &1445808444
MeshRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1445808442}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 1
m_Materials:
- {fileID: 2100000, guid: a9b45cd97b8d5c64da839b63544e443d, type: 2}
m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0}
m_UseLightProbes: 0
m_ReflectionProbeUsage: 1
m_ProbeAnchor: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_ImportantGI: 0
m_AutoUVMaxDistance: .5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!33 &1445808445
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1445808442}
m_Mesh: {fileID: 1356376159}
--- !u!65 &1445808446
BoxCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1445808442}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 16.6000004, y: 16.6000004, z: 16.6000004}
m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &1793184021
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1793184022}
- 20: {fileID: 1793184023}
- 92: {fileID: 1793184025}
- 124: {fileID: 1793184026}
- 81: {fileID: 1793184024}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1793184022
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1793184021}
m_LocalRotation: {x: -.0683115572, y: .913429022, z: -.172177941, w: -.362402797}
m_LocalPosition: {x: 3.42436981, y: 1.84477139, z: 3.61898613}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
--- !u!20 &1793184023
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1793184021}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: .300000012
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 100
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_HDR: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: .0219999999
--- !u!81 &1793184024
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1793184021}
m_Enabled: 1
--- !u!92 &1793184025
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1793184021}
m_Enabled: 1
--- !u!124 &1793184026
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1793184021}
m_Enabled: 1

+ 2
- 0
Assets/ProCore/ProBuilder/API Examples/Runtime Editing/RuntimeEdit.unity.meta View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 08536632091129e419e7207ef5a8d77d

+ 28
- 0
Assets/ProCore/ProBuilder/API Examples/Runtime Editing/backdrop.mat View File

@@ -0,0 +1,28 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 4
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: backdrop
m_Shader: {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_CustomRenderQueue: -1
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 2800000, guid: 0b4c1564f776ac24f9df3708f138aeb6, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats: {}
m_Colors:
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

+ 8
- 0
Assets/ProCore/ProBuilder/API Examples/Runtime Editing/backdrop.mat.meta View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ccd5dae07c449434e8d3b0ef8ac86683
timeCreated: 1424269530
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/ProCore/ProBuilder/API Examples/Runtime Editing/backdrop.png View File


+ 33
- 0
Assets/ProCore/ProBuilder/API Examples/Runtime Editing/backdrop.png.meta View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 0b4c1564f776ac24f9df3708f138aeb6
TextureImporter:
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
textureFormat: -1
maxTextureSize: 1024
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
textureType: -1
buildTargetSettings: []

BIN
Assets/ProCore/ProBuilder/API Examples/Runtime Editing/instructions.png View File


+ 33
- 0
Assets/ProCore/ProBuilder/API Examples/Runtime Editing/instructions.png.meta View File

@@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 93c5001afc1d69045b548160641d1c8f
TextureImporter:
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
textureFormat: -2
maxTextureSize: 512
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
textureType: 5
buildTargetSettings: []

+ 9
- 0
Assets/ProCore/ProBuilder/API Examples/Vertex Colors.meta View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 8236ba7ee347b4b42af677362f84dcbf
folderAsset: yes
timeCreated: 1480083961
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 125
- 0
Assets/ProCore/ProBuilder/API Examples/Vertex Colors/HighlightNearestFace.cs View File

@@ -0,0 +1,125 @@
using UnityEngine;
using System.Collections;
using ProBuilder2.Common;

/**
* Move a sphere around the surface of a ProBuilder mesh, changing the
* vertex color of the nearest face.
*
* Scene setup: Create a Unity Sphere primitive in a new scene, then attach
* this script to the sphere. Press 'Play'
*/
public class HighlightNearestFace : MonoBehaviour
{
// The distance covered by the plane.
public float travel = 50f;
// The speed at which the sphere will move.
public float speed = .2f;
// ProBuilder mesh component
private pb_Object target;
// The nearest face to this sphere.
private pb_Face nearest = null;

void Start()
{
// Generate a 50x50 plane with 25 subdivisions, facing up, with no smoothing applied.
target = pb_ShapeGenerator.PlaneGenerator(travel, travel, 25, 25, ProBuilder2.Common.Axis.Up, false);

target.SetFaceMaterial(target.faces, pb_Constant.DefaultMaterial);

target.transform.position = new Vector3(travel * .5f, 0f, travel * .5f);

// Rebuild the mesh (apply pb_Object data to UnityEngine.Mesh)
target.ToMesh();

// Rebuild UVs, Colors, Collisions, Normals, and Tangents
target.Refresh();

// Orient the camera in a good position
Camera cam = Camera.main;
cam.transform.position = new Vector3(25f, 40f, 0f);
cam.transform.localRotation = Quaternion.Euler( new Vector3(65f, 0f, 0f) );
}

void Update()
{
float time = Time.time * speed;

Vector3 position = new Vector3(
Mathf.PerlinNoise(time, time) * travel,
2,
Mathf.PerlinNoise(time + 1f, time + 1f) * travel
);

transform.position = position;

if(target == null)
{
Debug.LogWarning("Missing the ProBuilder Mesh target!");
return;
}

// instead of testing distance by converting each face's center to world space,
// convert the world space of this object to the pb-Object local transform.
Vector3 pbRelativePosition = target.transform.InverseTransformPoint(transform.position);

// reset the last colored face to white
if(nearest != null)
target.SetFaceColor(nearest, Color.white);

// iterate each face in the pb_Object looking for the one nearest
// to this object.
int faceCount = target.faces.Length;
float smallestDistance = Mathf.Infinity;
nearest = target.faces[0];

for(int i = 0; i < faceCount; i++)
{
float distance = Vector3.Distance(pbRelativePosition, FaceCenter(target, target.faces[i]));

if(distance < smallestDistance)
{
smallestDistance = distance;
nearest = target.faces[i];
}
}

// Set a single face's vertex colors. If you're updating more than one face, consider using
// the pb_Object.SetColors(Color[] colors); function instead.
target.SetFaceColor(nearest, Color.blue);

// Apply the stored vertex color array to the Unity mesh.
target.RefreshColors();
}

/**
* Returns the average of each vertex position in a face.
* In local space.
*/
private Vector3 FaceCenter(pb_Object pb, pb_Face face)
{
Vector3[] vertices = pb.vertices;

Vector3 average = Vector3.zero;

// face holds triangle data. distinctIndices is a
// cached collection of the distinct indices that
// make up the triangles. Ex:
// tris = {0, 1, 2, 2, 3, 0}
// distinct indices = {0, 1, 2, 3}
foreach(int index in face.distinctIndices)
{
average.x += vertices[index].x;
average.y += vertices[index].y;
average.z += vertices[index].z;
}

float len = (float) face.distinctIndices.Length;

average.x /= len;
average.y /= len;
average.z /= len;

return average;
}
}

+ 12
- 0
Assets/ProCore/ProBuilder/API Examples/Vertex Colors/HighlightNearestFace.cs.meta View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2e18c39b0273f88429ae202c72d6f00e
timeCreated: 1480083573
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 307
- 0
Assets/ProCore/ProBuilder/API Examples/Vertex Colors/HighlightNearestFace.unity View File

@@ -0,0 +1,307 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
SceneSettings:
m_ObjectHideFlags: 0
m_PVSData:
m_PVSObjectsArray: []
m_PVSPortalsArray: []
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: .25
backfaceThreshold: 100
--- !u!104 &2
RenderSettings:
m_Fog: 0
m_FogColor: {r: .5, g: .5, b: .5, a: 1}
m_FogMode: 3
m_FogDensity: .00999999978
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientLight: {r: .200000003, g: .200000003, b: .200000003, a: 1}
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: .5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 0}
m_ObjectHideFlags: 0
--- !u!127 &3
LevelGameManager:
m_ObjectHideFlags: 0
--- !u!157 &4
LightmapSettings:
m_ObjectHideFlags: 0
m_LightProbes: {fileID: 0}
m_Lightmaps: []
m_LightmapsMode: 1
m_BakedColorSpace: 0
m_UseDualLightmapsInForward: 0
m_LightmapEditorSettings:
m_Resolution: 50
m_LastUsedResolution: 0
m_TextureWidth: 1024
m_TextureHeight: 1024
m_BounceBoost: 1
m_BounceIntensity: 1
m_SkyLightColor: {r: .860000014, g: .930000007, b: 1, a: 1}
m_SkyLightIntensity: 0
m_Quality: 0
m_Bounces: 1
m_FinalGatherRays: 1000
m_FinalGatherContrastThreshold: .0500000007
m_FinalGatherGradientThreshold: 0
m_FinalGatherInterpolationPoints: 15
m_AOAmount: 0
m_AOMaxDistance: .100000001
m_AOContrast: 1
m_LODSurfaceMappingDistance: 1
m_Padding: 0
m_TextureCompression: 0
m_LockAtlas: 0
--- !u!196 &5
NavMeshSettings:
m_ObjectHideFlags: 0
m_BuildSettings:
agentRadius: .5
agentHeight: 2
agentSlope: 45
agentClimb: .400000006
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
accuratePlacement: 0
minRegionArea: 2
widthInaccuracy: 16.666666
heightInaccuracy: 10
tileSizeHint: 0
m_NavMesh: {fileID: 0}
--- !u!1 &292121580
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 292121582}
- 108: {fileID: 292121581}
m_Layer: 0
m_Name: Directional light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &292121581
Light:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 292121580}
m_Enabled: 1
serializedVersion: 3
m_Type: 1
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: .5
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:
m_Type: 0
m_Resolution: -1
m_Strength: 1
m_Bias: .0500000007
m_Softness: 4
m_SoftnessFade: 1
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_ActuallyLightmapped: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 1
m_ShadowSamples: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
m_IndirectIntensity: 1
m_AreaSize: {x: 1, y: 1}
--- !u!4 &292121582
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 292121580}
m_LocalRotation: {x: .408217937, y: -.234569728, z: .109381661, w: .875426114}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
--- !u!1 &1107377143
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1107377148}
- 20: {fileID: 1107377147}
- 124: {fileID: 1107377146}
- 92: {fileID: 1107377145}
- 81: {fileID: 1107377144}
m_Layer: 0
m_Name: Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &1107377144
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1107377143}
m_Enabled: 1
--- !u!92 &1107377145
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1107377143}
m_Enabled: 1
--- !u!124 &1107377146
Behaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1107377143}
m_Enabled: 1
--- !u!20 &1107377147
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1107377143}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: .192156866, g: .301960796, b: .474509805, a: .0196078438}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: .300000012
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_HDR: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: .0219999999
--- !u!4 &1107377148
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1107377143}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
--- !u!1 &1234896137
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 1234896142}
- 33: {fileID: 1234896141}
- 135: {fileID: 1234896140}
- 23: {fileID: 1234896139}
- 114: {fileID: 1234896138}
m_Layer: 0
m_Name: Sphere
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1234896138
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1234896137}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2e18c39b0273f88429ae202c72d6f00e, type: 3}
m_Name:
m_EditorClassIdentifier:
travel: 50
speed: .200000003
--- !u!23 &1234896139
Renderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1234896137}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_LightmapIndex: 255
m_LightmapTilingOffset: {x: 1, y: 1, z: 0, w: 0}
m_Materials:
- {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0}
m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0}
m_UseLightProbes: 0
m_LightProbeAnchor: {fileID: 0}
m_ScaleInLightmap: 1
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!135 &1234896140
SphereCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1234896137}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Radius: .5
m_Center: {x: 0, y: 0, z: 0}
--- !u!33 &1234896141
MeshFilter:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1234896137}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1234896142
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1234896137}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0

+ 8
- 0
Assets/ProCore/ProBuilder/API Examples/Vertex Colors/HighlightNearestFace.unity.meta View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6fcda48fd084a3e4f873789c611e4356
timeCreated: 1480083961
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 2
- 0
Assets/ProCore/ProBuilder/About.meta View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 1ce525f641d034e44b7eaf91ebbe3675

+ 2
- 0
Assets/ProCore/ProBuilder/About/Editor.meta View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f4f1998645f3e4c4e8ab737a40c99b74

+ 349
- 0
Assets/ProCore/ProBuilder/About/Editor/pb_AboutWindow.cs View File

@@ -0,0 +1,349 @@
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using ProBuilder2.Common;

namespace ProBuilder2.EditorCommon
{
/**
* INSTRUCTIONS
*
* - Only modify properties in the USER SETTINGS region.
* - All content is loaded from external files (pc_AboutEntry_YourProduct. Use the templates!
*/

/**
* Used to pop up the window on import.
*/
[InitializeOnLoad]
static class pb_AboutWindowSetup
{
static pb_AboutWindowSetup()
{
EditorApplication.delayCall += () => { pb_AboutWindow.Init(false); };
}
}

/**
* Changelog.txt file should follow this format:
*
* | # Product Name 2.1.0
* |
* | ## Features
* |
* | - All kinds of awesome stuff
* | - New flux capacitor design achieves time travel at lower velocities.
* | - Dark matter reactor recalibrated.
* |
* | ## Bug Fixes
* |
* | - No longer explodes when spacebar is pressed.
* | - Fix rolling issue in rickmeter.
* |
* | # Changes
* |
* | - Changed Blue to Red.
* | - Enter key now causes explosions.
*
* This path is relative to the PRODUCT_ROOT path.
*
* Note that your changelog may contain multiple entries. Only the top-most
* entry will be displayed.
*/
public class pb_AboutWindow : EditorWindow
{
// Modify these constants to customize about screen.
const string PACKAGE_NAME = "ProBuilder";

private static string aboutRoot = "Assets/ProCore/" + PACKAGE_NAME + "/About";

// Path to the root folder
internal static string AboutRoot
{
get
{
if( Directory.Exists(aboutRoot) )
{
return aboutRoot;
}
else
{
aboutRoot = pb_FileUtil.FindFolder("ProBuilder/About");
if(aboutRoot.EndsWith("/"))
aboutRoot = aboutRoot.Remove(aboutRoot.LastIndexOf("/"), 1);
return aboutRoot;
}
}
}

GUIContent gc_Learn = new GUIContent("Learn ProBuilder", "Documentation");
GUIContent gc_Forum = new GUIContent("Support Forum", "ProCore Support Forum");
GUIContent gc_Contact = new GUIContent("Contact Us", "Send us an email!");
GUIContent gc_Banner = new GUIContent("", "ProBuilder Quick-Start Video Tutorials");

private const string VIDEO_URL = @"http://bit.ly/pbstarter";
private const string LEARN_URL = @"http://procore3d.com/docs/probuilder";
private const string SUPPORT_URL = @"http://www.procore3d.com/forum/";
private const string CONTACT_EMAIL = @"http://www.procore3d.com/about/";
private const float BANNER_WIDTH = 480f;
private const float BANNER_HEIGHT = 270f;

internal const string FONT_REGULAR = "Asap-Regular.otf";
internal const string FONT_MEDIUM = "Asap-Medium.otf";

// Use less contast-y white and black font colors for better readabililty
public static readonly Color font_white = HexToColor(0xCECECE);
public static readonly Color font_black = HexToColor(0x545454);
public static readonly Color font_blue_normal = HexToColor(0x00AAEF);
public static readonly Color font_blue_hover = HexToColor(0x008BEF);


private string productName = pb_Constant.PRODUCT_NAME;
private pb_AboutEntry about = null;
private string changelogRichText = "";

internal static GUIStyle bannerStyle,
header1Style,
versionInfoStyle,
linkStyle,
separatorStyle,
changelogStyle,
changelogTextStyle;

Vector2 scroll = Vector2.zero;

/**
* Return true if Init took place, false if not.
*/
public static bool Init (bool fromMenu)
{
pb_AboutEntry about;

if(!pb_VersionUtil.GetAboutEntry(out about))
{
Debug.LogWarning("Couldn't find pb_AboutEntry_ProBuilder.txt");
return false;
}

if(fromMenu || pb_PreferencesInternal.GetString(about.identifier) != about.version)
{
pb_AboutWindow win;
win = (pb_AboutWindow)EditorWindow.GetWindow(typeof(pb_AboutWindow), true, about.name, true);
win.ShowUtility();
win.SetAbout(about);
pb_PreferencesInternal.SetString(about.identifier, about.version, pb_PreferenceLocation.Global);
return true;
}
else
{
return false;
}
}

private static Color HexToColor(uint x)
{
return new Color( ((x >> 16) & 0xFF) / 255f,
((x >> 8) & 0xFF) / 255f,
(x & 0xFF) / 255f,
1f);
}

public static void InitGuiStyles()
{
bannerStyle = new GUIStyle()
{
// RectOffset(left, right, top, bottom)
margin = new RectOffset(12, 12, 12, 12),
normal = new GUIStyleState() {
background = LoadAssetAtPath<Texture2D>(string.Format("{0}/Images/Banner_Normal.png", AboutRoot))
},
hover = new GUIStyleState() {
background = LoadAssetAtPath<Texture2D>(string.Format("{0}/Images/Banner_Hover.png", AboutRoot))
},
};

header1Style = new GUIStyle()
{
margin = new RectOffset(10, 10, 10, 10),
alignment = TextAnchor.MiddleCenter,
fontSize = 24,
// fontStyle = FontStyle.Bold,
font = LoadAssetAtPath<Font>(string.Format("{0}/Font/{1}", AboutRoot, FONT_MEDIUM)),
normal = new GUIStyleState() { textColor = EditorGUIUtility.isProSkin ? font_white : font_black }
};

versionInfoStyle = new GUIStyle()
{
margin = new RectOffset(10, 10, 10, 10),
fontSize = 14,
font = LoadAssetAtPath<Font>(string.Format("{0}/Font/{1}", AboutRoot, FONT_REGULAR)),
normal = new GUIStyleState() { textColor = EditorGUIUtility.isProSkin ? font_white : font_black }
};

linkStyle = new GUIStyle()
{
margin = new RectOffset(10, 10, 10, 10),
alignment = TextAnchor.MiddleCenter,
fontSize = 16,
font = LoadAssetAtPath<Font>(string.Format("{0}/Font/{1}", AboutRoot, FONT_REGULAR)),
normal = new GUIStyleState() {
textColor = font_blue_normal,
background = LoadAssetAtPath<Texture2D>(
string.Format("{0}/Images/ScrollBackground_{1}.png",
AboutRoot,
EditorGUIUtility.isProSkin ? "Pro" : "Light"))
},
hover = new GUIStyleState() {
textColor = font_blue_hover,
background = LoadAssetAtPath<Texture2D>(
string.Format("{0}/Images/ScrollBackground_{1}.png",
AboutRoot,
EditorGUIUtility.isProSkin ? "Pro" : "Light"))
}
};

separatorStyle = new GUIStyle()
{
margin = new RectOffset(10, 10, 10, 10),
alignment = TextAnchor.MiddleCenter,
fontSize = 16,
font = LoadAssetAtPath<Font>(string.Format("{0}/Font/{1}", AboutRoot, FONT_REGULAR)),
normal = new GUIStyleState() { textColor = EditorGUIUtility.isProSkin ? font_white : font_black }
};

changelogStyle = new GUIStyle()
{
margin = new RectOffset(10, 10, 10, 10),
font = LoadAssetAtPath<Font>(string.Format("{0}/Font/{1}", AboutRoot, FONT_REGULAR)),
richText = true,
normal = new GUIStyleState() { background = LoadAssetAtPath<Texture2D>(
string.Format("{0}/Images/ScrollBackground_{1}.png",
AboutRoot,
EditorGUIUtility.isProSkin ? "Pro" : "Light"))
}
};

changelogTextStyle = new GUIStyle()
{
margin = new RectOffset(10, 10, 10, 10),
font = LoadAssetAtPath<Font>(string.Format("{0}/Font/{1}", AboutRoot, FONT_REGULAR)),
fontSize = 14,
normal = new GUIStyleState() { textColor = EditorGUIUtility.isProSkin ? font_white : font_black },
richText = true,
wordWrap = true
};
}

public void OnEnable()
{
InitGuiStyles();

Texture2D banner = bannerStyle.normal.background;

if(banner == null)
{
Debug.LogWarning("Could not load About window resources");
this.Close();
}
else
{
bannerStyle.fixedWidth = BANNER_WIDTH; // banner.width;
bannerStyle.fixedHeight = BANNER_HEIGHT; // banner.height;

this.wantsMouseMove = true;

this.minSize = new Vector2(BANNER_WIDTH + 24, BANNER_HEIGHT * 2.5f);
this.maxSize = new Vector2(BANNER_WIDTH + 24, BANNER_HEIGHT * 2.5f);

if(!productName.Contains("Basic"))
productName = "ProBuilder Advanced";
}
}

void SetAbout(pb_AboutEntry about)
{
this.about = about;

if(!File.Exists(about.changelogPath))
about.changelogPath = pb_FileUtil.FindFile("ProBuilder/About/changelog.txt");

if(File.Exists(about.changelogPath))
{
string raw = File.ReadAllText(about.changelogPath);

if(!string.IsNullOrEmpty(raw))
{
pb_VersionInfo vi;
pb_VersionUtil.FormatChangelog(raw, out vi, out changelogRichText);
}
}
}

internal static T LoadAssetAtPath<T>(string InPath) where T : UnityEngine.Object
{
return (T) AssetDatabase.LoadAssetAtPath(InPath, typeof(T));
}

void OnGUI()
{
Vector2 mousePosition = Event.current.mousePosition;

if( GUILayout.Button(gc_Banner, bannerStyle) )
Application.OpenURL(VIDEO_URL);

if(GUILayoutUtility.GetLastRect().Contains(mousePosition))
Repaint();

GUILayout.BeginVertical(changelogStyle);

GUILayout.Label(productName, header1Style);

GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();

if(GUILayout.Button(gc_Learn, linkStyle))
Application.OpenURL(LEARN_URL);

GUILayout.Label("|", separatorStyle);

if(GUILayout.Button(gc_Forum, linkStyle))
Application.OpenURL(SUPPORT_URL);

GUILayout.Label("|", separatorStyle);

if(GUILayout.Button(gc_Contact, linkStyle))
Application.OpenURL(CONTACT_EMAIL);

GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();

if(GUILayoutUtility.GetLastRect().Contains(mousePosition))
Repaint();

GUILayout.EndVertical();

// always bold the first line (cause it's the version info stuff)
scroll = EditorGUILayout.BeginScrollView(scroll, changelogStyle);
GUILayout.Label(string.Format("Version: {0}", about.version), versionInfoStyle);
GUILayout.Label("\n" + changelogRichText, changelogTextStyle);
EditorGUILayout.EndScrollView();
}

/**
* Draw a horizontal line across the screen and update the guilayout.
*/
void HorizontalLine()
{
Rect r = GUILayoutUtility.GetLastRect();
Color og = GUI.backgroundColor;
GUI.backgroundColor = Color.black;
GUI.Box(new Rect(0f, r.y + r.height + 2, Screen.width, 2f), "");
GUI.backgroundColor = og;

GUILayout.Space(6);
}
}
}

+ 13
- 0
Assets/ProCore/ProBuilder/About/Editor/pb_AboutWindow.cs.meta View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: fca06bdb2c29e7344b757645530b0eff
timeCreated: 1485893835
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences:
- gravityFont: {fileID: 12800000, guid: 28ed1153d48f34485be1063881729e18, type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 91
- 0
Assets/ProCore/ProBuilder/About/Editor/pb_UpdateAvailable.cs View File

@@ -0,0 +1,91 @@
using UnityEngine;
using UnityEditor;
using ProBuilder2.Common;

namespace ProBuilder2.EditorCommon
{
class pb_UpdateAvailable : EditorWindow
{
public static void Init(pb_VersionInfo newVersion, string changelog)
{
pb_UpdateAvailable win = EditorWindow.GetWindow<pb_UpdateAvailable>(true, "ProBuilder Update Available", true);
win.m_NewVersion = newVersion;
win.m_NewChangelog = changelog;
}

[SerializeField] pb_VersionInfo m_NewVersion;
[SerializeField] string m_NewChangelog;
Vector2 scroll = Vector2.zero;
GUIContent gc_DownloadUpdate = new GUIContent("", "Open Asset Store Download Page");

private static GUIStyle downloadImageStyle = null,
updateHeader = null;

private bool checkForProBuilderUpdates
{
get { return pb_PreferencesInternal.GetBool(pb_Constant.pbCheckForProBuilderUpdates, true); }
set { pb_PreferencesInternal.SetBool(pb_Constant.pbCheckForProBuilderUpdates, value); }
}

void OnEnable()
{
pb_AboutWindow.InitGuiStyles();

wantsMouseMove = true;
minSize = new Vector2(400f, 350f);

downloadImageStyle = new GUIStyle()
{
margin = new RectOffset(10, 10, 10, 10),
fixedWidth = 154,
fixedHeight = 85,
normal = new GUIStyleState() {
background = pb_AboutWindow.LoadAssetAtPath<Texture2D>(string.Format("{0}/Images/DownloadPB_Normal.png", pb_AboutWindow.AboutRoot))
},
hover = new GUIStyleState() {
background = pb_AboutWindow.LoadAssetAtPath<Texture2D>(string.Format("{0}/Images/DownloadPB_Hover.png", pb_AboutWindow.AboutRoot))
},
};

updateHeader = new GUIStyle()
{
margin = new RectOffset(0, 0, 0, 0),
alignment = TextAnchor.MiddleCenter,
fixedHeight = 85,
fontSize = 24,
wordWrap = true,
font = pb_AboutWindow.LoadAssetAtPath<Font>(string.Format("{0}/Font/{1}", pb_AboutWindow.AboutRoot, pb_AboutWindow.FONT_MEDIUM)),
normal = new GUIStyleState() { textColor = EditorGUIUtility.isProSkin ? pb_AboutWindow.font_white : pb_AboutWindow.font_black }
};
}

void OnGUI()
{
GUILayout.BeginHorizontal();

if( GUILayout.Button(gc_DownloadUpdate, downloadImageStyle) )
Application.OpenURL("http://u3d.as/30b");

if(GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition))
Repaint();

GUILayout.BeginVertical(pb_AboutWindow.changelogStyle);
GUILayout.Label("ProBuilder Update\nAvailable", updateHeader);
GUILayout.EndVertical();

GUILayout.EndHorizontal();

scroll = EditorGUILayout.BeginScrollView(scroll, pb_AboutWindow.changelogStyle);
GUILayout.Label(string.Format("Version: {0}", m_NewVersion.text), pb_AboutWindow.versionInfoStyle);
GUILayout.Label("\n" + m_NewChangelog, pb_AboutWindow.changelogTextStyle);
EditorGUILayout.EndScrollView();

GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
checkForProBuilderUpdates = EditorGUILayout.Toggle("Show Update Notifications", checkForProBuilderUpdates);
GUILayout.Space(4);
GUILayout.EndHorizontal();
GUILayout.Space(10);
}
}
}

+ 12
- 0
Assets/ProCore/ProBuilder/About/Editor/pb_UpdateAvailable.cs.meta View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 9d4c868a7342844649d0dce8c2a58a4f
timeCreated: 1487708635
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 116
- 0
Assets/ProCore/ProBuilder/About/Editor/pb_UpdateCheck.cs View File

@@ -0,0 +1,116 @@
using UnityEngine;
using UnityEditor;
using System.Text.RegularExpressions;
using ProBuilder2.Common;

namespace ProBuilder2.EditorCommon
{
/**
* Check for updates to ProBuilder.
*/
[InitializeOnLoad]
static class pb_UpdateCheck
{
const string PROBUILDER_VERSION_URL = "http://procore3d.github.io/probuilder2/current.txt";
const string pbLastWebVersionChecked = "pbLastWebVersionChecked";
static WWW updateQuery;
static bool calledFromMenu = false;

static pb_UpdateCheck()
{
if(pb_PreferencesInternal.GetBool(pb_Constant.pbCheckForProBuilderUpdates))
{
calledFromMenu = false;
CheckForUpdate();
}
}

[MenuItem("Tools/" + pb_Constant.PRODUCT_NAME + "/Check for Updates", false, pb_Constant.MENU_ABOUT + 1)]
static void MenuCheckForUpdate()
{
calledFromMenu = true;
CheckForUpdate();
}

public static void CheckForUpdate()
{
if(updateQuery == null)
{
updateQuery = new WWW(PROBUILDER_VERSION_URL);
EditorApplication.update += Update;
}
}

static void Update()
{
if (updateQuery != null)
{
if (!updateQuery.isDone)
return;

try
{
if (string.IsNullOrEmpty(updateQuery.error) || !Regex.IsMatch(updateQuery.text, "404 not found", RegexOptions.IgnoreCase) )
{
pb_VersionInfo webVersion;
string webChangelog;

if(!pb_VersionUtil.FormatChangelog(updateQuery.text, out webVersion, out webChangelog))
{
FailedConnection();
}
else
{
pb_VersionInfo current;

// first test if the installed version is already up to date
if( !pb_VersionUtil.GetCurrent(out current) || webVersion.CompareTo(current) > 0 )
{
// next, test if a notification for this version has already been shown
string lastNotification = pb_PreferencesInternal.GetString(pbLastWebVersionChecked, "");

if(calledFromMenu || !lastNotification.Equals(webVersion.text))
{
pb_UpdateAvailable.Init(webVersion, webChangelog);
pb_PreferencesInternal.SetString(pbLastWebVersionChecked, webVersion.text);
}
}
else
{
UpToDate(current.ToString());
}
}
}
else
{
FailedConnection();
}
}
catch(System.Exception e)
{
FailedConnection(string.Format("Error: Is build target is Webplayer?\n\n{0}", e.ToString()));
}

updateQuery = null;
}

calledFromMenu = false;
EditorApplication.update -= Update;
}

static void UpToDate(string version)
{
if(calledFromMenu)
EditorUtility.DisplayDialog("ProBuilder Update Check", string.Format("You're up to date!\n\nInstalled Version: {0}\nLatest Version: {0}", version), "Okay");
}

static void FailedConnection(string error = null)
{
if(calledFromMenu)
EditorUtility.DisplayDialog(
"ProBuilder Update Check",
error == null ? "Failed to connect to server!" : string.Format("Failed to connect to server!\n\n{0}", error.ToString()),
"Okay");
}
}
}

+ 12
- 0
Assets/ProCore/ProBuilder/About/Editor/pb_UpdateCheck.cs.meta View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 67dd077e8983d4474916d2b02018b937
timeCreated: 1487703505
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 145
- 0
Assets/ProCore/ProBuilder/About/Editor/pb_VersionInfo.cs View File

@@ -0,0 +1,145 @@
using System.Text.RegularExpressions;

namespace ProBuilder2.EditorCommon
{
public enum VersionType
{
Final = 3,
Beta = 2,
Patch = 1
}

[System.Serializable]
public struct pb_VersionInfo : System.IEquatable<pb_VersionInfo>, System.IComparable<pb_VersionInfo>
{
public int major;
public int minor;
public int patch;
public int build;
public VersionType type;
public string text;
public bool valid;

public override bool Equals(object o)
{
return o is pb_VersionInfo && this.Equals((pb_VersionInfo) o);
}

public override int GetHashCode()
{
int hash = 13;

unchecked
{
if(valid)
{
hash = (hash * 7) + major.GetHashCode();
hash = (hash * 7) + minor.GetHashCode();
hash = (hash * 7) + patch.GetHashCode();
hash = (hash * 7) + build.GetHashCode();
hash = (hash * 7) + type.GetHashCode();
}
else
{
return text.GetHashCode();
}
}

return hash;
}

public bool Equals(pb_VersionInfo version)
{
if(valid != version.valid)
return false;

if(valid)
{
return major == version.major &&
minor == version.minor &&
patch == version.patch &&
type == version.type &&
build == version.build;
}
else
{
if( string.IsNullOrEmpty(text) || string.IsNullOrEmpty(version.text) )
return false;

return text.Equals(version.text);
}
}

public int CompareTo(pb_VersionInfo version)
{
const int GREATER = 1;
const int LESS = -1;

if(this.Equals(version))
return 0;
else if(major > version.major)
return GREATER;
else if(major < version.major)
return LESS;
else if(minor > version.minor)
return GREATER;
else if(minor < version.minor)
return LESS;
else if(patch > version.patch)
return GREATER;
else if(patch < version.patch)
return LESS;
else if((int)type > (int)version.type)
return GREATER;
else if((int)type < (int)version.type)
return LESS;
else if(build > version.build)
return GREATER;
else
return LESS;
}

public override string ToString()
{
return string.Format("{0}.{1}.{2}{3}{4}", major, minor, patch, type.ToString().ToLower()[0], build);
}

/**
* Create a pb_VersionInfo type from a string.
* Ex: "2.5.3b1"
*/
public static pb_VersionInfo FromString(string str)
{
pb_VersionInfo version = new pb_VersionInfo();
version.text = str;

try
{
string[] split = Regex.Split(str, @"[\.A-Za-z]");
Match type = Regex.Match(str, @"A-Za-z");
int.TryParse(split[0], out version.major);
int.TryParse(split[1], out version.minor);
int.TryParse(split[2], out version.patch);
int.TryParse(split[3], out version.build);
version.type = GetVersionType(type != null && type.Success ? type.Value : "");
version.valid = true;
}
catch
{
version.valid = false;
}

return version;
}

static VersionType GetVersionType(string type)
{
if( type.Equals("b") || type.Equals("B") )
return VersionType.Beta;
else if( type.Equals("p") || type.Equals("P") )
return VersionType.Patch;

return VersionType.Final;
}
}
}

+ 12
- 0
Assets/ProCore/ProBuilder/About/Editor/pb_VersionInfo.cs.meta View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 3d9c925b318d04a55bd2d4ad282f4f9f
timeCreated: 1487711113
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 133
- 0
Assets/ProCore/ProBuilder/About/Editor/pb_VersionUtil.cs View File

@@ -0,0 +1,133 @@
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Text;
using System.Collections;
using System.Text.RegularExpressions;

namespace ProBuilder2.EditorCommon
{
/**
* Contains information that the pb_AboutEntry.txt file holds.
*/
[System.Serializable]
internal class pb_AboutEntry
{
public string name;
public string identifier;
public string version;
public string date;
public string changelogPath;

public const string KEY_NAME = "name: ";
public const string KEY_IDENTIFIER = "identifier: ";
public const string KEY_VERSION = "version: ";
public const string KEY_DATE = "date: ";
public const string KEY_CHANGELOG = "changelog: ";
}

/**
* Utility methods for finding and extracting version & changelog information.
*/
internal static class pb_VersionUtil
{
/**
* Get information from the currently installed ProBuilder version.
*/
public static bool GetAboutEntry(out pb_AboutEntry about)
{
about = null;

string[] matches = Directory.GetFiles("./Assets", "pc_AboutEntry_ProBuilder.txt", SearchOption.AllDirectories);

if(matches == null || matches.Length < 1)
return false;

for(int i = 0; i < matches.Length && about == null; i++)
about = ParseAboutEntry(matches[i]);

return about != null;
}

public static bool GetCurrent(out pb_VersionInfo version)
{
pb_AboutEntry about;

if(!GetAboutEntry(out about))
{
version = new pb_VersionInfo();
return false;
}

version = pb_VersionInfo.FromString(about.version);
return true;
}

/**
* Extracts and formats the latest changelog entry into rich text. Also grabs the version.
*/
public static bool FormatChangelog(string raw, out pb_VersionInfo version, out string formatted_changes)
{
bool success = true;

// get first version entry
string[] split = Regex.Split(raw, "(?mi)^#\\s", RegexOptions.Multiline);

// get the version info
try
{
Match versionMatch = Regex.Match(split[1], @"(?<=^ProBuilder\s).[0-9]*\.[0-9]*\.[0-9]*[a-z][0-9]*");
version = pb_VersionInfo.FromString(versionMatch.Success ? versionMatch.Value : split[1].Split('\n')[0]);
}
catch
{
version = pb_VersionInfo.FromString("not found");
success = false;
}

try
{
StringBuilder sb = new StringBuilder();
string[] newLineSplit = split[1].Trim().Split('\n');
for(int i = 2; i < newLineSplit.Length; i++)
sb.AppendLine(newLineSplit[i]);

formatted_changes = sb.ToString();
formatted_changes = Regex.Replace(formatted_changes, "^-", "\u2022", RegexOptions.Multiline);
formatted_changes = Regex.Replace(formatted_changes, @"(?<=^##\\s).*", "<size=16><b>${0}</b></size>", RegexOptions.Multiline);
formatted_changes = Regex.Replace(formatted_changes, @"^##\ ", "", RegexOptions.Multiline);
}
catch
{
formatted_changes = "";
success = false;
}

return success;
}

private static pb_AboutEntry ParseAboutEntry(string path)
{
if (!File.Exists(path))
return null;

pb_AboutEntry about = new pb_AboutEntry();

foreach(string str in File.ReadAllLines(path))
{
if(str.StartsWith(pb_AboutEntry.KEY_NAME))
about.name = str.Replace(pb_AboutEntry.KEY_NAME, "").Trim();
else if(str.StartsWith(pb_AboutEntry.KEY_IDENTIFIER))
about.identifier = str.Replace(pb_AboutEntry.KEY_IDENTIFIER, "").Trim();
else if(str.StartsWith(pb_AboutEntry.KEY_VERSION))
about.version = str.Replace(pb_AboutEntry.KEY_VERSION, "").Trim();
else if(str.StartsWith(pb_AboutEntry.KEY_DATE))
about.date = str.Replace(pb_AboutEntry.KEY_DATE, "").Trim();
else if(str.StartsWith(pb_AboutEntry.KEY_CHANGELOG))
about.changelogPath = str.Replace(pb_AboutEntry.KEY_CHANGELOG, "").Trim();
}

return about;
}
}
}

+ 12
- 0
Assets/ProCore/ProBuilder/About/Editor/pb_VersionUtil.cs.meta View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d1add08945e58c444a133612549b4260
timeCreated: 1487944665
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 9
- 0
Assets/ProCore/ProBuilder/About/Font.meta View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: ae10479e200f949b4af89b788185b48f
folderAsset: yes
timeCreated: 1485893747
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/ProCore/ProBuilder/About/Font/Asap-Medium.otf View File


+ 20
- 0
Assets/ProCore/ProBuilder/About/Font/Asap-Medium.otf.meta View File

@@ -0,0 +1,20 @@
fileFormatVersion: 2
guid: f79c0638c9ad24986acd8d34c0e20256
timeCreated: 1485898685
licenseType: Store
TrueTypeFontImporter:
serializedVersion: 3
fontSize: 16
forceTextureCase: -2
characterSpacing: 1
characterPadding: 0
includeFontData: 1
fontNames: []
fallbackFontReferences:
- {fileID: 12800000, guid: ff3a015580ef046ac85fa087703e0a2d, type: 3}
customCharacters:
fontRenderingMode: 3
ascentCalculationMode: 1
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/ProCore/ProBuilder/About/Font/Asap-Regular.otf View File


+ 20
- 0
Assets/ProCore/ProBuilder/About/Font/Asap-Regular.otf.meta View File

@@ -0,0 +1,20 @@
fileFormatVersion: 2
guid: ff3a015580ef046ac85fa087703e0a2d
timeCreated: 1485898392
licenseType: Store
TrueTypeFontImporter:
serializedVersion: 3
fontSize: 16
forceTextureCase: -2
characterSpacing: 1
characterPadding: 0
includeFontData: 1
fontNames: []
fallbackFontReferences:
- {fileID: 12800000, guid: f79c0638c9ad24986acd8d34c0e20256, type: 3}
customCharacters:
fontRenderingMode: 3
ascentCalculationMode: 1
userData:
assetBundleName:
assetBundleVariant:

+ 47
- 0
Assets/ProCore/ProBuilder/About/Font/SIL Open Font License.txt View File

@@ -0,0 +1,47 @@
Copyright (c) 2011-2015, Omnibus-Type (www.omnibus-type.com|omnibus.type@gmail.com).

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL

-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others.

The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the copyright statement(s).

"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment.

"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission.

5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.

+ 8
- 0
Assets/ProCore/ProBuilder/About/Font/SIL Open Font License.txt.meta View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 18e88fe929cd84916b50f8677be466e3
timeCreated: 1485898392
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 2
- 0
Assets/ProCore/ProBuilder/About/Images.meta View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f326e8a65c528eb42a075a91b0dfafd8

BIN
Assets/ProCore/ProBuilder/About/Images/Banner.png View File


+ 76
- 0
Assets/ProCore/ProBuilder/About/Images/Banner.png.meta View File

@@ -0,0 +1,76 @@
fileFormatVersion: 2
guid: fe4eda0c9e27af144a7995139929f8ba
timeCreated: 1509985917
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 0
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 0
aniso: -1
mipBias: -1
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 0
Assets/ProCore/ProBuilder/About/Images/Banner_Hover.png View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save