-
-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
526 changed files
with
41,770 additions
and
2,503 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
fbe9985b182e64aa110aef3f8d4336887550ff8f | ||
eba58b2225c2d33e091b4c584904418d82853092 | ||
2b1f4a2df600df58374b4f43e92ac9ee1531900b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Text; | ||
using TiltBrush; | ||
using UnityEditor; | ||
using UnityEngine; | ||
using Valve.Newtonsoft.Json.Utilities; | ||
using Object = UnityEngine.Object; | ||
|
||
public class BrushLister : MonoBehaviour | ||
{ | ||
private static StringBuilder brushList; | ||
private static List<Guid> deprecated; | ||
private static TiltBrushManifest brushManifest; | ||
private static TiltBrushManifest brushManifestX; | ||
|
||
[MenuItem("Tilt/Info/Brush Lister")] | ||
static void ListBrushes() | ||
{ | ||
brushList = new StringBuilder(); | ||
|
||
Object[] defaultBrushes = Resources.LoadAll("Brushes", typeof(BrushDescriptor)).ToArray(); | ||
var experimentalBrushes = Resources.LoadAll("X/Brushes", typeof(BrushDescriptor)).ToArray(); | ||
|
||
brushManifest = AssetDatabase.LoadAssetAtPath<TiltBrushManifest>("Assets/Manifest.asset"); | ||
brushManifestX = AssetDatabase.LoadAssetAtPath<TiltBrushManifest>("Assets/Manifest_Experimental.asset"); | ||
|
||
deprecated = new List<Guid>(); | ||
|
||
foreach (BrushDescriptor b in defaultBrushes) { if (b.m_Supersedes != null) deprecated.Add(b.m_Supersedes.m_Guid); } | ||
foreach (BrushDescriptor b in experimentalBrushes) { if (b.m_Supersedes != null) deprecated.Add(b.m_Supersedes.m_Guid); } | ||
|
||
foreach (BrushDescriptor brush in defaultBrushes) { AppendValidBrushString(brush, false); } | ||
foreach (BrushDescriptor brush in experimentalBrushes) | ||
{ | ||
try { AppendValidBrushString(brush, true); } | ||
catch (Exception UnassignedReferenceException) | ||
{ | ||
Debug.Log($"Experimental brush loading error: {UnassignedReferenceException}"); | ||
} | ||
} | ||
|
||
Debug.Log($"{brushList}"); | ||
} | ||
|
||
public static string getBrushRowString(BrushDescriptor brush, bool experimental) | ||
{ | ||
// Exclude legacy brushes | ||
if (brush.m_SupersededBy != null) return ""; | ||
var brushScripts = sniffBrushScript(brush); | ||
string prefabName = brush.m_BrushPrefab != null ? brush.m_BrushPrefab.name : ""; | ||
string materialName = brush.Material != null ? brush.Material.name : ""; | ||
string shaderName = brush.Material != null ? brush.Material.shader.name : ""; | ||
string manifest = ""; | ||
if (brushManifest.Brushes.Contains(brush) && brushManifestX.Brushes.Contains(brush)) | ||
{ | ||
manifest = "both"; | ||
} | ||
else if (brushManifest.Brushes.Contains(brush)) | ||
{ | ||
manifest = "Default"; | ||
} | ||
else if (brushManifestX.Brushes.Contains(brush)) | ||
{ | ||
manifest = "Experimental"; | ||
} | ||
return $"{brush.m_Description}\t{brush.m_AudioReactive}\t{prefabName}\t{materialName}\t{shaderName}\t{brushScripts}\t{experimental}\t{brush.m_SupersededBy}\t{manifest}"; | ||
} | ||
|
||
public static string sniffBrushScript(BrushDescriptor brush) | ||
{ | ||
GameObject prefab = brush.m_BrushPrefab; | ||
if (prefab == null) return ""; | ||
var componentNames = new List<string>(); | ||
foreach (MonoBehaviour c in prefab.GetComponents<MonoBehaviour>()) | ||
{ | ||
if (c.GetType() == typeof(MeshFilter) || c.GetType() == typeof(Transform) || c.GetType() == typeof(MeshRenderer)) continue; | ||
componentNames.Add(c.GetType().ToString().Replace("TiltBrush.", "")); | ||
} | ||
return string.Join(",", componentNames); | ||
} | ||
|
||
public static void AppendValidBrushString(BrushDescriptor brush, bool experimental) | ||
{ | ||
if (deprecated.Contains(brush.m_Guid)) return; | ||
var rowString = getBrushRowString(brush, experimental); | ||
if (rowString != "") brushList.AppendLine($"{rowString}"); | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
Assets/Scripts/OculusMRCCameraUpdate.cs.meta → Assets/Editor/BrushLister.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.