浏览代码

Fixes #217 by searching all assemblies in the app domain

/main
Peter Bay Bastian 7 年前
当前提交
c595547c
共有 1 个文件被更改,包括 9 次插入6 次删除
  1. 15
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/SearchWindowProvider.cs

15
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/SearchWindowProvider.cs


{
// First build up temporary data structure containing group & title as an array of strings (the last one is the actual title) and associated node type.
var nodeEntries = new List<NodeEntry>();
foreach (var type in Assembly.GetAssembly(typeof(AbstractMaterialNode)).GetTypes())
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
if (type.IsClass && !type.IsAbstract && (type.IsSubclassOf(typeof(AbstractMaterialNode))) && type != typeof(PropertyNode))
foreach (var type in assembly.GetTypes())
var attrs = type.GetCustomAttributes(typeof(TitleAttribute), false) as TitleAttribute[];
if (attrs != null && attrs.Length > 0)
if (type.IsClass && !type.IsAbstract && (type.IsSubclassOf(typeof(AbstractMaterialNode))) && type != typeof(PropertyNode))
var node = (AbstractMaterialNode) Activator.CreateInstance(type);
AddEntries(node, attrs[0].title, nodeEntries);
var attrs = type.GetCustomAttributes(typeof(TitleAttribute), false) as TitleAttribute[];
if (attrs != null && attrs.Length > 0)
{
var node = (AbstractMaterialNode)Activator.CreateInstance(type);
AddEntries(node, attrs[0].title, nodeEntries);
}
}
}
}

正在加载...
取消
保存