浏览代码

Merge branch 'master' into vfx-demo

/main
Thomas ICHÉ 5 年前
当前提交
7bf8f8fe
共有 4 个文件被更改,包括 61 次插入36 次删除
  1. 4
      Editor/Discover/DiscoverEditor.cs
  2. 6
      Editor/Discover/DiscoverWindow.cs
  3. 79
      Editor/FindAndReplace/FindAndReplaceWindow.cs
  4. 8
      Editor/HierarchyHints/HierarchyHints.cs

4
Editor/Discover/DiscoverEditor.cs


using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
#if UNITY_2019_3_OR_NEWER
using UnityEngine.VFX;
#else
#endif
using UnityEngine.Timeline;
namespace GameplayIngredients.Editor

6
Editor/Discover/DiscoverWindow.cs


bool hasContent = discoverObjects != null && discoverObjects.Count > 0;
// Draw Navigation
// Draw Navigation Bar
EditorGUI.BeginDisabledGroup(!hasContent);
using (new GUILayout.AreaScope(new Rect(discoverAsset.WindowWidth - 168, 8, 160, 20)))
{

}
}
Vector2 globalContentScroll;
globalContentScroll = GUILayout.BeginScrollView(globalContentScroll);
using (new GUILayout.VerticalScope(Styles.indent))
{
GUILayout.Label(discoverAsset.Title, Styles.header);

}
}
GUILayout.FlexibleSpace();
GUILayout.EndScrollView();
}
Discover selectedDiscover;

79
Editor/FindAndReplace/FindAndReplaceWindow.cs


static readonly Dictionary<string, Type> s_assemblyTypes = GetTypes();
private static Dictionary<string,Type> GetTypes()
private static Dictionary<string, Type> GetTypes()
foreach(var assembly in AppDomain.CurrentDomain.GetAssemblies())
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
foreach(Type t in assembly.GetTypes())
foreach (Type t in assembly.GetTypes())
if(typeof(Component).IsAssignableFrom(t) && !all.ContainsKey(t.Name))
if (typeof(Component).IsAssignableFrom(t) && !all.ContainsKey(t.Name))
all.Add(t.Name, t);
}
}

Material materialSearch;
[SerializeField]
bool replacePosition = true;
bool keepPosition = true;
bool replaceRotation = true;
bool keepRotation = true;
bool replaceScale = false;
bool keepScale = false;
bool replaceParenting = true;
bool keepParenting = true;
bool replaceName = true;
bool keepName = true;
bool replaceTag = false;
bool keepTag = false;
bool replaceLayer = true;
bool keepLayer = true;
bool replaceStatic = false;
bool keepStatic = false;
[SerializeField]
bool unpackPrefab = false;

{
EditorGUIUtility.labelWidth = 120;
GUILayout.Space(4);
GUILayout.Label("Search and Filter", Styles.boldLabel);
GUILayout.Label("Search Scene Objects", Styles.boldLabel);
switch(searchBy)
switch (searchBy)
{
case SearchBy.Name:
nameSearch = EditorGUILayout.TextField(Contents.nameSearch, nameSearch);

GUILayout.FlexibleSpace();
GUILayout.Label("Replace By", Styles.boldLabel);
GUILayout.Label("Replace Results", Styles.boldLabel);
if (prefabReplacement != null)
{
PrefabAssetType type = PrefabUtility.GetPrefabAssetType(prefabReplacement);
bool isAPrefab = type == PrefabAssetType.Model || type == PrefabAssetType.Regular || type == PrefabAssetType.Variant;
if(isAPrefab)
unpackPrefab = EditorGUILayout.Toggle("Unpack Prefab", unpackPrefab);
}
EditorGUI.BeginDisabledGroup(prefabReplacement == null);
GUILayout.Label("Keep Properties:");
replacePosition = GUILayout.Toggle(replacePosition, "Position", EditorStyles.miniButtonLeft, GUILayout.Height(16));
replaceRotation = GUILayout.Toggle(replaceRotation, "Rotation", EditorStyles.miniButtonMid, GUILayout.Height(16));
replaceScale = GUILayout.Toggle(replaceScale, "Scale", EditorStyles.miniButtonMid, GUILayout.Height(16));
replaceParenting = GUILayout.Toggle(replaceParenting, "Parenting", EditorStyles.miniButtonRight, GUILayout.Height(16));
keepPosition = GUILayout.Toggle(keepPosition, "Position", EditorStyles.miniButtonLeft, GUILayout.Height(16));
keepRotation = GUILayout.Toggle(keepRotation, "Rotation", EditorStyles.miniButtonMid, GUILayout.Height(16));
keepScale = GUILayout.Toggle(keepScale, "Scale", EditorStyles.miniButtonMid, GUILayout.Height(16));
keepParenting = GUILayout.Toggle(keepParenting, "Parenting", EditorStyles.miniButtonRight, GUILayout.Height(16));
replaceName = GUILayout.Toggle(replaceName, "Name", EditorStyles.miniButtonLeft, GUILayout.Height(16));
replaceTag = GUILayout.Toggle(replaceTag, "Tag", EditorStyles.miniButtonMid, GUILayout.Height(16));
replaceLayer = GUILayout.Toggle(replaceLayer, "Layer", EditorStyles.miniButtonMid, GUILayout.Height(16));
replaceStatic = GUILayout.Toggle(replaceStatic, "Static", EditorStyles.miniButtonMid, GUILayout.Height(16));
unpackPrefab = GUILayout.Toggle(unpackPrefab, "Unpack Prefab", EditorStyles.miniButtonRight, GUILayout.Height(16));
keepName = GUILayout.Toggle(keepName, "Name", EditorStyles.miniButtonLeft, GUILayout.Height(16));
keepTag = GUILayout.Toggle(keepTag, "Tag", EditorStyles.miniButtonMid, GUILayout.Height(16));
keepLayer = GUILayout.Toggle(keepLayer, "Layer", EditorStyles.miniButtonMid, GUILayout.Height(16));
keepStatic = GUILayout.Toggle(keepStatic, "Static", EditorStyles.miniButtonRight, GUILayout.Height(16));
}
if (GUILayout.Button("Replace All", Styles.bigButton, GUILayout.Height(24)) && prefabReplacement != null)

searchResults[i] = newObj;
}
}
EditorGUI.EndDisabledGroup();
GUILayout.Space(8);
}

if (PrefabUtility.GetPrefabAssetType(replacement) != PrefabAssetType.NotAPrefab && !unpackPrefab)
newObj = (GameObject)PrefabUtility.InstantiatePrefab(replacement);
else
newObj = (GameObject)Instantiate<GameObject>(replacement);
newObj = Instantiate(replacement);
if (replaceName)
newObj.name = replacement.name;
else
if (keepName)
if(replacePosition)
if(keepPosition)
if(replaceRotation)
if(keepRotation)
if(replaceParenting)
if(keepParenting)
if(replaceScale)
if(keepScale)
if(replaceTag)
if(keepTag)
if(replaceLayer)
if(keepLayer)
if(replaceStatic)
if(keepStatic)
newObj.isStatic = toReplace.isStatic;
foreach(var other in others)

8
Editor/HierarchyHints/HierarchyHints.cs


using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
#if UNITY_2019_3_OR_NEWER
using UnityEngine.VFX;
#else
#endif
using UnityEditor;
using GameplayIngredients.StateMachines;
using UnityEngine.Playables;

if (!Active) return;
var fullRect = selectionRect;
#if UNITY_2019_3_OR_NEWER
fullRect.xMin = 32;
#else
#endif
fullRect.xMax = EditorGUIUtility.currentViewWidth;
GameObject o = EditorUtility.InstanceIDToObject(instanceID) as GameObject;
if (o == null) return;

正在加载...
取消
保存