private void ShouldHide(FieldInfo fieldInfo, out bool should, out bool readOnly) { HideIf_BTAttribute hideAttr = fieldInfo.GetCustomAttribute <HideIf_BTAttribute>(); ReadOnlyAttribute roAttr = fieldInfo.GetCustomAttribute <ReadOnlyAttribute>(); should = false; readOnly = false; if (hideAttr != null) { readOnly = hideAttr.readOnly; if (ZetanUtility.TryGetMemberValue(hideAttr.path, nodeEditor.node, out var fv, out var mi) && mi != null) { if (typeof(SharedVariable).IsAssignableFrom(fv.GetType())) { if (fv is SharedVariable sv) { if ((sv.isGlobal || sv.isShared) && !string.IsNullOrEmpty(sv.name)) { if (sv.isGlobal) { sv = global.GetVariable(sv.name); } else if (sv.isShared) { sv = tree.GetVariable(sv.name); } if (sv != null && Equals(sv.GetValue(), hideAttr.value)) { should = true; } } else if (!sv.isGlobal && !sv.isShared && Equals(sv.GetValue(), hideAttr.value)) { should = true; } } } else if (Equals(fv, hideAttr.value)) { should = true; } } } else if (roAttr != null) { readOnly = !roAttr.onlyRuntime || roAttr.onlyRuntime && Application.isPlaying; } }
public SharedVariable GetVariable(string name) { return(globalVariables.GetVariable(name)); }