diff --git a/TNodeGraphViewImpl/Editor/NodeGraphView/DataGraphView.cs b/TNodeGraphViewImpl/Editor/NodeGraphView/DataGraphView.cs index 3f6d369..a33661d 100644 --- a/TNodeGraphViewImpl/Editor/NodeGraphView/DataGraphView.cs +++ b/TNodeGraphViewImpl/Editor/NodeGraphView/DataGraphView.cs @@ -235,6 +235,7 @@ namespace TNodeGraphViewImpl.Editor.NodeGraphView{ //check if the drag data is BlackboardField if (DragAndDrop.GetGenericData("DragSelection") is List{Count: > 0} data){ DragAndDrop.visualMode = DragAndDropVisualMode.Move; + //high light the } } #endregion @@ -411,12 +412,19 @@ namespace TNodeGraphViewImpl.Editor.NodeGraphView{ }); } public override List GetCompatiblePorts(Port startPort, NodeAdapter nodeAdapter){ - - return ports.Where(x => startPort!=x && - (x.portType == startPort.portType || - x.portType.IsAssignableFrom(startPort.portType) || - RuntimeCache.Instance.GetSupportedTypes(startPort.portType).Contains(x.portType))).ToList(); - + var supportedTypes = RuntimeCache.Instance.GetSupportedTypes(startPort.portType); + + var compatiblePorts = ports.Where(x => startPort != x && + (x.portType == startPort.portType || + x.portType.IsAssignableFrom(startPort.portType) + )).ToList(); + if (supportedTypes != null){ + compatiblePorts.AddRange(ports.Where(x => supportedTypes.Contains(x.portType)).ToList()); + } + + return compatiblePorts; + + } public virtual void OnGraphViewCreate(){ diff --git a/TNodeGraphViewImpl/Editor/NodeViews/DragNodeView.cs b/TNodeGraphViewImpl/Editor/NodeViews/DragNodeView.cs index 35ca0b0..a48bb79 100644 --- a/TNodeGraphViewImpl/Editor/NodeViews/DragNodeView.cs +++ b/TNodeGraphViewImpl/Editor/NodeViews/DragNodeView.cs @@ -25,16 +25,29 @@ namespace TNode.Editor.NodeViews{ BlackboardDataWrapper blackboardWrapper = (BlackboardDataWrapper)blackboard; var serializedData = new SerializedObject(blackboardWrapper); var serializedProperty = serializedData.FindProperty("data").FindPropertyRelative(obj.blackDragData); - PropertyField field = new PropertyField(serializedProperty,""); - field.Bind(serializedData); - label.parent.parent.style.flexDirection = FlexDirection.RowReverse; - label.parent.parent.Add(field); - label.parent.parent.style.alignItems = Align.Center; - label.parent.parent.style.justifyContent = Justify.Center; - label.parent.parent.style.paddingTop = 0; - label.parent.parent.style.paddingBottom = 0; - label.RemoveFromHierarchy(); + // + // field.Bind(serializedData); + // var p = label.parent.parent.parent; + // p.Add(field); + // field.SendToBack(); + // field.SetEnabled(false); + // p.style.alignItems = Align.Center; + // p.style.justifyContent = Justify.Center; + // p.style.paddingTop = 0; + // p.style.paddingBottom = 0; + label.text = obj.blackDragData; + //Get serialized property's icon + var icon = AssetPreview.GetMiniThumbnail(serializedProperty.objectReferenceValue); + + label.parent.Add(new Image(){ + image = icon + }); + //more round style for entire element + style.borderBottomLeftRadius = style.borderBottomRightRadius = + style.borderTopLeftRadius = style.borderTopRightRadius = 25; + styleSheets.Add(Resources.Load("DragNodeStyle")); + this.name = "DragNodeView"; } } } \ No newline at end of file diff --git a/TNodeGraphViewImpl/Editor/Resources/DragNodeStyle.uss b/TNodeGraphViewImpl/Editor/Resources/DragNodeStyle.uss new file mode 100644 index 0000000..8e49b02 --- /dev/null +++ b/TNodeGraphViewImpl/Editor/Resources/DragNodeStyle.uss @@ -0,0 +1,10 @@ +#node-border{ + + /*border-radius: 16px;*/ + /*border-color: #000;*/ + /*border-width: 1px;*/ +} +Image{ + max-height: 16; + max-width: 16; +} \ No newline at end of file diff --git a/TNodeGraphViewImpl/Editor/Resources/DragNodeStyle.uss.meta b/TNodeGraphViewImpl/Editor/Resources/DragNodeStyle.uss.meta new file mode 100644 index 0000000..c0ee79f --- /dev/null +++ b/TNodeGraphViewImpl/Editor/Resources/DragNodeStyle.uss.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 91a9fc5305f445798d87f5d5b9994027 +timeCreated: 1658396456 \ No newline at end of file diff --git a/TNodeCore/Editor/Resources/GraphViewBackground.uss b/TNodeGraphViewImpl/Editor/Resources/GraphViewBackground.uss similarity index 100% rename from TNodeCore/Editor/Resources/GraphViewBackground.uss rename to TNodeGraphViewImpl/Editor/Resources/GraphViewBackground.uss diff --git a/TNodeCore/Editor/Resources/GraphViewBackground.uss.meta b/TNodeGraphViewImpl/Editor/Resources/GraphViewBackground.uss.meta similarity index 100% rename from TNodeCore/Editor/Resources/GraphViewBackground.uss.meta rename to TNodeGraphViewImpl/Editor/Resources/GraphViewBackground.uss.meta