feat:a better look exposed property node

main
taoria 3 years ago
parent 4858dfdbd6
commit a63463b934
  1. 20
      TNodeGraphViewImpl/Editor/NodeGraphView/DataGraphView.cs
  2. 31
      TNodeGraphViewImpl/Editor/NodeViews/DragNodeView.cs
  3. 10
      TNodeGraphViewImpl/Editor/Resources/DragNodeStyle.uss
  4. 3
      TNodeGraphViewImpl/Editor/Resources/DragNodeStyle.uss.meta
  5. 0
      TNodeGraphViewImpl/Editor/Resources/GraphViewBackground.uss
  6. 0
      TNodeGraphViewImpl/Editor/Resources/GraphViewBackground.uss.meta

@ -235,6 +235,7 @@ namespace TNodeGraphViewImpl.Editor.NodeGraphView{
//check if the drag data is BlackboardField
if (DragAndDrop.GetGenericData("DragSelection") is List<ISelectable>{Count: > 0} data){
DragAndDrop.visualMode = DragAndDropVisualMode.Move;
//high light the
}
}
#endregion
@ -411,12 +412,19 @@ namespace TNodeGraphViewImpl.Editor.NodeGraphView{
});
}
public override List<Port> 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(){

@ -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<StyleSheet>("DragNodeStyle"));
this.name = "DragNodeView";
}
}
}

@ -0,0 +1,10 @@
#node-border{
/*border-radius: 16px;*/
/*border-color: #000;*/
/*border-width: 1px;*/
}
Image{
max-height: 16;
max-width: 16;
}

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 91a9fc5305f445798d87f5d5b9994027
timeCreated: 1658396456
Loading…
Cancel
Save