Chris Gregan
8 years ago
committed by
GitHub
10 changed files with 323 additions and 0 deletions
After Width: | Height: | Size: 5.0 KiB |
@ -0,0 +1,92 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 6368c1c16ebb1694091262337e4f8c44 |
||||
timeCreated: 1500456217 |
||||
licenseType: Free |
||||
TextureImporter: |
||||
fileIDToRecycleName: {} |
||||
serializedVersion: 4 |
||||
mipmaps: |
||||
mipMapMode: 0 |
||||
enableMipMap: 0 |
||||
sRGBTexture: 0 |
||||
linearTexture: 0 |
||||
fadeOut: 0 |
||||
borderMipMap: 0 |
||||
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: |
||||
filterMode: 1 |
||||
aniso: -1 |
||||
mipBias: -1 |
||||
wrapMode: 1 |
||||
nPOTScale: 0 |
||||
lightmap: 0 |
||||
compressionQuality: 50 |
||||
spriteMode: 1 |
||||
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: 1 |
||||
spriteTessellationDetail: -1 |
||||
textureType: 2 |
||||
textureShape: 1 |
||||
maxTextureSizeSet: 0 |
||||
compressionQualitySet: 0 |
||||
textureFormatSet: 0 |
||||
platformSettings: |
||||
- buildTarget: DefaultTexturePlatform |
||||
maxTextureSize: 1024 |
||||
textureFormat: -1 |
||||
textureCompression: 0 |
||||
compressionQuality: 50 |
||||
crunchedCompression: 0 |
||||
allowsAlphaSplitting: 0 |
||||
overridden: 0 |
||||
- buildTarget: Standalone |
||||
maxTextureSize: 1024 |
||||
textureFormat: -1 |
||||
textureCompression: 0 |
||||
compressionQuality: 50 |
||||
crunchedCompression: 0 |
||||
allowsAlphaSplitting: 0 |
||||
overridden: 0 |
||||
- buildTarget: Android |
||||
maxTextureSize: 1024 |
||||
textureFormat: -1 |
||||
textureCompression: 0 |
||||
compressionQuality: 50 |
||||
crunchedCompression: 0 |
||||
allowsAlphaSplitting: 0 |
||||
overridden: 0 |
||||
- buildTarget: WebGL |
||||
maxTextureSize: 1024 |
||||
textureFormat: -1 |
||||
textureCompression: 0 |
||||
compressionQuality: 50 |
||||
crunchedCompression: 0 |
||||
allowsAlphaSplitting: 0 |
||||
overridden: 0 |
||||
spriteSheet: |
||||
serializedVersion: 2 |
||||
sprites: [] |
||||
outline: [] |
||||
spritePackingTag: |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
After Width: | Height: | Size: 5.0 KiB |
@ -0,0 +1,92 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 1c99c9bf7557e23469ed5dfce00504c0 |
||||
timeCreated: 1500455974 |
||||
licenseType: Free |
||||
TextureImporter: |
||||
fileIDToRecycleName: {} |
||||
serializedVersion: 4 |
||||
mipmaps: |
||||
mipMapMode: 0 |
||||
enableMipMap: 0 |
||||
sRGBTexture: 0 |
||||
linearTexture: 0 |
||||
fadeOut: 0 |
||||
borderMipMap: 0 |
||||
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: |
||||
filterMode: 1 |
||||
aniso: -1 |
||||
mipBias: -1 |
||||
wrapMode: 1 |
||||
nPOTScale: 0 |
||||
lightmap: 0 |
||||
compressionQuality: 50 |
||||
spriteMode: 1 |
||||
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: 1 |
||||
spriteTessellationDetail: -1 |
||||
textureType: 2 |
||||
textureShape: 1 |
||||
maxTextureSizeSet: 0 |
||||
compressionQualitySet: 0 |
||||
textureFormatSet: 0 |
||||
platformSettings: |
||||
- buildTarget: DefaultTexturePlatform |
||||
maxTextureSize: 1024 |
||||
textureFormat: -1 |
||||
textureCompression: 0 |
||||
compressionQuality: 50 |
||||
crunchedCompression: 0 |
||||
allowsAlphaSplitting: 0 |
||||
overridden: 0 |
||||
- buildTarget: Standalone |
||||
maxTextureSize: 1024 |
||||
textureFormat: -1 |
||||
textureCompression: 0 |
||||
compressionQuality: 50 |
||||
crunchedCompression: 0 |
||||
allowsAlphaSplitting: 0 |
||||
overridden: 0 |
||||
- buildTarget: Android |
||||
maxTextureSize: 1024 |
||||
textureFormat: -1 |
||||
textureCompression: 0 |
||||
compressionQuality: 50 |
||||
crunchedCompression: 0 |
||||
allowsAlphaSplitting: 0 |
||||
overridden: 0 |
||||
- buildTarget: WebGL |
||||
maxTextureSize: 1024 |
||||
textureFormat: -1 |
||||
textureCompression: 0 |
||||
compressionQuality: 50 |
||||
crunchedCompression: 0 |
||||
allowsAlphaSplitting: 0 |
||||
overridden: 0 |
||||
spriteSheet: |
||||
serializedVersion: 2 |
||||
sprites: [] |
||||
outline: [] |
||||
spritePackingTag: |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
@ -0,0 +1,43 @@
|
||||
using UnityEngine; |
||||
using UnityEditor; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
namespace EditorUtils |
||||
{ |
||||
/// <summary> |
||||
/// Shows Fungus section in the Edit->Preferences in unity allows you to configure Fungus behaviour |
||||
/// |
||||
/// ref https://docs.unity3d.com/ScriptReference/PreferenceItem.html |
||||
/// </summary> |
||||
public class FungusEditorPreferences |
||||
{ |
||||
// Have we loaded the prefs yet |
||||
private static bool prefsLoaded = false; |
||||
|
||||
public static bool hideMushroomInHierarchy = false; |
||||
|
||||
// Add preferences section named "My Preferences" to the Preferences Window |
||||
[PreferenceItem("Fungus")] |
||||
|
||||
public static void PreferencesGUI() |
||||
{ |
||||
// Load the preferences |
||||
if (!prefsLoaded) |
||||
{ |
||||
hideMushroomInHierarchy = EditorPrefs.GetBool("hideMushroomInHierarchy", false); |
||||
prefsLoaded = true; |
||||
} |
||||
|
||||
// Preferences GUI |
||||
hideMushroomInHierarchy = EditorGUILayout.Toggle("Hide Mushroom Flowchart Icon", hideMushroomInHierarchy); |
||||
|
||||
// Save the preferences |
||||
if (GUI.changed) |
||||
{ |
||||
EditorPrefs.SetBool("hideMushroomInHierarchy", hideMushroomInHierarchy); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: cde6865c94505574e8ccf958a03f8463 |
||||
timeCreated: 1500456646 |
||||
licenseType: Free |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
@ -0,0 +1,67 @@
|
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using UnityEngine; |
||||
using UnityEditor; |
||||
using System.Linq; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
/// <summary> |
||||
/// Static class that hooks into the hierachy changed and item gui callbacks to put |
||||
/// a fungus icon infront of all GOs that have a flowchart on them |
||||
/// |
||||
/// Reference; http://answers.unity3d.com/questions/431952/how-to-show-an-icon-in-hierarchy-view.html |
||||
/// |
||||
/// TODO |
||||
/// There is what appears like a bug but is currently out of our control. When Unity reloads the built scripts it fires |
||||
/// InitializeOnLoad but doesn't then fire HierarchyChanged so icons disappear until a change occurs |
||||
/// </summary> |
||||
[InitializeOnLoad] |
||||
public class HierarchyIcons |
||||
{ |
||||
// the fungus mushroom icon |
||||
static Texture2D TextureIcon { get { return Fungus.EditorUtils.FungusEditorResources.FungusMushroom; } } |
||||
|
||||
//sorted list of the GO instance IDs that have flowcharts on them |
||||
static List<int> flowchartIDs = new List<int>(); |
||||
|
||||
static HierarchyIcons() |
||||
{ |
||||
EditorApplication.hierarchyWindowItemOnGUI += HierarchyIconCallback; |
||||
EditorApplication.hierarchyWindowChanged += HierarchyChanged; |
||||
} |
||||
|
||||
//track all gameobjectIds that have flowcharts on them |
||||
static void HierarchyChanged() |
||||
{ |
||||
flowchartIDs.Clear(); |
||||
|
||||
if (EditorUtils.FungusEditorPreferences.hideMushroomInHierarchy) |
||||
return; |
||||
|
||||
var flowcharts = GameObject.FindObjectsOfType<Flowchart>(); |
||||
|
||||
flowchartIDs = flowcharts.Select(x => x.gameObject.GetInstanceID()).Distinct().ToList(); |
||||
flowchartIDs.Sort(); |
||||
} |
||||
|
||||
//Draw icon if the isntance id is in our cached list |
||||
static void HierarchyIconCallback(int instanceID, Rect selectionRect) |
||||
{ |
||||
if (EditorUtils.FungusEditorPreferences.hideMushroomInHierarchy) |
||||
return; |
||||
|
||||
// place the icon to the left of the element |
||||
Rect r = new Rect(selectionRect); |
||||
r.x = 0; |
||||
r.width = r.height; |
||||
|
||||
//GameObject go = EditorUtility.InstanceIDToObject(instanceID) as GameObject; |
||||
|
||||
//binary search as it is much faster to cache and int bin search than GetComponent |
||||
// should be less GC too |
||||
if (flowchartIDs.BinarySearch(instanceID) >= 0) |
||||
GUI.Label(r, TextureIcon); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2 |
||||
guid: a347e274da09aa44dbb68f1375508d11 |
||||
timeCreated: 1500115754 |
||||
licenseType: Free |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
Loading…
Reference in new issue