protected sealed override bool CanDrawValueProperty(InspectorProperty property) { if (!NodeEditor.InNodeEditor) { return(false); } if (property.ChildResolver is IDynamicDataNodePropertyPortResolver) { var parent = property.ParentValueProperty; if (parent == null) { parent = property.Tree.SecretRootProperty; } if (parent.ChildResolver is INodePortResolver) { var resolver = parent.ChildResolver as INodePortResolver; NodePortInfo portInfo = resolver.GetNodePortInfo(property.Name); if (portInfo != null) { return(true); } } return(false); } return(false); }
protected override void Initialize() { // Port is already resolved for the base var parent = Property.ParentValueProperty; if (parent == null) { parent = Property.Tree.SecretRootProperty; } portResolver = parent.ChildResolver as INodePortResolver; nodePortInfo = portResolver.GetNodePortInfo(Property.Name); UpdateDynamicPorts(); fakeListInfo = InspectorPropertyInfo.CreateValue( NodePropertyPort.NodePortListPropertyName, 0, Property.ValueEntry.SerializationBackend, new GetterSetter <TValue, List <TValue> >( GetDynamicPorts, (ref TValue owner, List <TValue> value) => { } ), Property.Attributes .Where(x => x is ListDrawerSettingsAttribute || x is NodePortAttribute || x is ShowDrawerChainAttribute || x is ShowPropertyResolverAttribute ) ); }
protected override void Initialize() { Property.ValueEntry.Update(); // Port is already resolved for the base var parent = Property.ParentValueProperty; #if ODIN_INSPECTOR_3 if (parent == null) { parent = Property.Tree.RootProperty; } #else if (parent == null) { parent = Property.Tree.SecretRootProperty; } #endif portResolver = parent.ChildResolver as INodePortResolver; nodePortInfo = portResolver.GetNodePortInfo(Property.Name); noDataResolver = Property.ParentValueProperty == null ? null : parent.ChildResolver as IDynamicNoDataNodePropertyPortResolver; base.Initialize(); for (int i = 0; i < ChildCount; ++i) { var info = GetInfoForPortAtIndex(i); } }
public override bool CanResolveForPropertyFilter(InspectorProperty property) { if (!NodeEditor.InNodeEditor) { return(false); } var parent = property.ParentValueProperty; if (parent == null) // Root only { parent = property.Tree.SecretRootProperty; var resolver = parent.ChildResolver as INodePortResolver; if (resolver == null) { return(false); } NodePortInfo portInfo = resolver.GetNodePortInfo(property.Name); return(portInfo != null && portInfo.IsDynamicPortList && !typeof(TValue).ImplementsOrInherits(typeof(System.Collections.IList))); } return(false); }
protected sealed override bool CanDrawAttributeProperty(InspectorProperty property) { if (!NodeEditor.InNodeEditor) { return(false); } var parent = property.ParentValueProperty; #if ODIN_INSPECTOR_3 if (parent == null) { parent = property.Tree.RootProperty; } #else if (parent == null) { parent = property.Tree.SecretRootProperty; } #endif if (parent.ChildResolver is INodePortResolver) { var resolver = parent.ChildResolver as INodePortResolver; NodePortInfo portInfo = resolver.GetNodePortInfo(property.Name); if (portInfo != null) { return((portInfo.IsDynamic || !portInfo.IsDynamicPortList) && CanDrawNodePort(resolver, portInfo, property)); } return(false); } return(false); }
public override bool CanDrawProperty(InspectorProperty property) { if (!NodeEditor.InNodeEditor) { return(false); } var parent = property.ParentValueProperty; if (parent == null) { parent = property.Tree.SecretRootProperty; } if (parent.ChildResolver is INodePortResolver) { var resolver = parent.ChildResolver as INodePortResolver; NodePortInfo portInfo = resolver.GetNodePortInfo(property.Name); if (portInfo != null) { return(false); } } else { return(false); } if (property.ChildResolver is GroupPropertyResolver) { return(false); } return(property.GetAttribute <DontFoldAttribute>() == null); }
public override bool CanResolveForPropertyFilter(InspectorProperty property) { if (!NodeEditor.InNodeEditor) { return(false); } var parent = property.ParentValueProperty; if (parent != null) // Parent value property *should* only be valid for something living under the NoData dynamic list { if (parent.ChildResolver is IDynamicNoDataNodePropertyPortResolver) { return(true); } } if (parent == null) { parent = property.Tree.SecretRootProperty; } var resolver = parent.ChildResolver as INodePortResolver; if (resolver == null) { return(false); } NodePortInfo portInfo = resolver.GetNodePortInfo(property.Name); return(portInfo != null); // I am a port! }
protected NodePort GetNodePort(int index) { NodePortInfo nodePortInfo = GetNodePortInfo(index); if (nodePortInfo != null) { return(nodePortInfo.Port); } return(null); }
protected override bool CanDrawNodePort(INodePortResolver portResolver, NodePortInfo nodePortInfo, InspectorProperty property) { // Don't draw ports for lists that are also ports if (property.ChildResolver is ICollectionResolver) { if (property.ChildResolver is IDynamicDataNodePropertyPortResolver) { return(false); } } return(true); }
protected override bool CanDrawNodePort(INodePortResolver portResolver, NodePortInfo nodePortInfo, InspectorProperty property) { if (!base.CanDrawNodePort(portResolver, nodePortInfo, property)) { return(false); } if (property.GetAttribute <HideConnectionLabelAttribute>() != null) { return(false); } return(property.Parent != null && property.Parent.ChildResolver is IDynamicDataNodePropertyPortResolver); }
protected InspectorPropertyInfo GetInfoForPortAtIndex(int index) { InspectorPropertyInfo childPortInfo; if (!childPortInfos.TryGetValue(index, out childPortInfo)) { InspectorPropertyInfo sourceChildInfo = base.GetChildInfo(index); string portName = $"{nodePortInfo.BaseFieldName} {index}"; Node node = nodePortInfo.Node; NodePort port = node.GetPort(portName); childPortInfo = InspectorPropertyInfo.CreateValue( $"{CollectionResolverUtilities.DefaultIndexToChildName( index )}:port", 0, Property.ValueEntry.SerializationBackend, new GetterSetter <TList, NodePort>( ( ref TList owner ) => port, (ref TList owner, NodePort value) => { } ) , new HideInInspector() ); var childNodePortInfo = new NodePortInfo( childPortInfo, sourceChildInfo, portName, typeof(TElement), node, // Needed? nodePortInfo.ShowBackingValue, nodePortInfo.ConnectionType, nodePortInfo.TypeConstraint, nodePortInfo.IsDynamicPortList, true, nodePortInfo.IsInput, noDataResolver == null ); propertyToNodeProperty[sourceChildInfo.PropertyName] = childPortInfo.PropertyName; nameToNodePropertyInfo[childPortInfo.PropertyName] = childNodePortInfo; childPortInfos[index] = childPortInfo; } return(childPortInfo); }
public static bool DisplayMissingPort(InspectorProperty property, INodePortResolver resolver, NodePortInfo nodePortInfo) { if (nodePortInfo == null) { SirenixEditorGUI.ErrorMessageBox($"This info went missing. {property.Name}"); return(true); } if (nodePortInfo.Port == null) { using (new EditorGUILayout.VerticalScope()) { SirenixEditorGUI.ErrorMessageBox("This port went missing."); using (new EditorGUILayout.HorizontalScope()) { if (nodePortInfo.IsDynamic) { if (GUILayout.Button("Restore")) { resolver.RememberDynamicPort(property); } if (GUILayout.Button("Remove")) { resolver.ForgetDynamicPort(property); } } else { if (GUILayout.Button("Restore")) { nodePortInfo.Node.UpdatePorts(); } } } } return(true); } return(false); }
public static void DrawPortHandle(NodePortInfo nodePortInfo, int overridePortHeight = -1) { DrawPortHandle(nodePortInfo.Port, overridePortHeight); }
protected virtual bool CanDrawNodePort(INodePortResolver portResolver, NodePortInfo nodePortInfo, InspectorProperty property) { return(true); }
protected override bool CanDrawNodePort(NodePortInfo nodePortInfo, InspectorProperty property) { return(nodePortInfo.ConnectionType == ConnectionType.Override); }
public static void DrawPortHandle(NodePortInfo nodePortInfo) { DrawPortHandle(nodePortInfo.Port); }
protected override bool CanDrawNodePort(INodePortResolver portResolver, NodePortInfo nodePortInfo, InspectorProperty property) { return(property.GetAttribute <DisplayDynamicPortsAttribute>().ShowRemoveButton); }