mirror of
https://github.com/Siccity/xNode.git
synced 2026-03-26 22:49:02 +08:00
Context menu validation Should check for the name, not the info
This commit is contained in:
parent
483eafdd2a
commit
5bea336895
@ -86,16 +86,16 @@ namespace XNodeEditor {
|
|||||||
KeyValuePair<ContextMenu, System.Reflection.MethodInfo>[] items = GetContextMenuMethods(obj);
|
KeyValuePair<ContextMenu, System.Reflection.MethodInfo>[] items = GetContextMenuMethods(obj);
|
||||||
if (items.Length != 0) {
|
if (items.Length != 0) {
|
||||||
contextMenu.AddSeparator("");
|
contextMenu.AddSeparator("");
|
||||||
List<ContextMenu> invalidatedEntries = new List<ContextMenu>();
|
List<string> invalidatedEntries = new List<string>();
|
||||||
foreach (var checkValidate in items) {
|
foreach (var checkValidate in items) {
|
||||||
if (checkValidate.Key.validate && !(bool) checkValidate.Value.Invoke(obj, null))
|
if (checkValidate.Key.validate && !(bool) checkValidate.Value.Invoke(obj, null))
|
||||||
{
|
{
|
||||||
invalidatedEntries.Add(checkValidate.Key);
|
invalidatedEntries.Add(checkValidate.Key.menuItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < items.Length; i++) {
|
for (int i = 0; i < items.Length; i++) {
|
||||||
KeyValuePair<ContextMenu, System.Reflection.MethodInfo> kvp = items[i];
|
KeyValuePair<ContextMenu, System.Reflection.MethodInfo> kvp = items[i];
|
||||||
if (invalidatedEntries.Contains(kvp.Key))
|
if (invalidatedEntries.Contains(kvp.Key.menuItem))
|
||||||
{
|
{
|
||||||
contextMenu.AddDisabledItem(new GUIContent(kvp.Key.menuItem));
|
contextMenu.AddDisabledItem(new GUIContent(kvp.Key.menuItem));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user