fix:blackboard entry bug

main
taoria 3 years ago
parent c838416b73
commit 73ee3ec911
  1. 16
      Samples/Editor/Graph Editor Data.asset
  2. 8
      Samples/Editor/Graph Editor Data.asset.meta
  3. 88
      Samples/New HelloGraph.asset
  4. 24
      TNodeGraphViewImpl/Editor/NodeGraphView/DataGraphView.cs
  5. 4
      TNodeGraphViewImpl/Editor/NodeViews/NodeView.cs

@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0557874e9b43b074fb0f712d67ac01e7, type: 3}
m_Name: Graph Editor Data
m_EditorClassIdentifier:
graphImplType: 0
autoUpdate: 0

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 26c77e8bb72228e4d81789ee852ada41
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

@ -14,31 +14,95 @@ MonoBehaviour:
m_EditorClassIdentifier:
nodeList:
- id: 0
nodeLinks: []
- id: 1
- id: 2
- id: 3
nodeLinks:
- inPort:
portEntryName: A
nodeDataId: 1cf6c28a-a878-4ca6-9170-423975702f0f
outPort:
portEntryName: Value
nodeDataId: a8a42372-3106-4028-ba4a-b1e92df29396
- inPort:
portEntryName: B
nodeDataId: 1cf6c28a-a878-4ca6-9170-423975702f0f
outPort:
portEntryName: Value
nodeDataId: e211ba2b-6ea0-46e8-a319-aa05602eaf46
- inPort:
portEntryName: A
nodeDataId: 1cf6c28a-a878-4ca6-9170-423975702f0f
outPort:
portEntryName: Value
nodeDataId: e211ba2b-6ea0-46e8-a319-aa05602eaf46
blackboardData:
id: 1
id: 4
sceneReference:
editorModels: []
graphViewModel:
id: 2
id: 5
references:
version: 1
00000000:
type: {class: AddNode, ns: Samples, asm: Assembly-CSharp}
data:
positionInView:
serializedVersion: 2
x: 292
y: -32
width: 0
height: 0
id: 1cf6c28a-a878-4ca6-9170-423975702f0f
nodeName: AddNode
entryPoint: 0
isTest: 0
00000001:
type: {class: BlackboardDragNode, ns: TNodeCore.Runtime.Models, asm: TNodeCore}
data:
positionInView:
serializedVersion: 2
x: 54.89991
y: 86.95003
x: 29
y: -10
width: 0
height: 0
id: 2c26caec-abd2-4034-b68e-28a2843d347e
id: a8a42372-3106-4028-ba4a-b1e92df29396
nodeName:
entryPoint: 0
isTest: 0
blackDragData: V3S.0
isListElement: 1
00000002:
type: {class: BlackboardDragNode, ns: TNodeCore.Runtime.Models, asm: TNodeCore}
data:
positionInView:
serializedVersion: 2
x: 38
y: 70
width: 0
height: 0
id: e211ba2b-6ea0-46e8-a319-aa05602eaf46
nodeName:
entryPoint: 0
isTest: 0
blackDragData: V2S.0
isListElement: 1
00000003:
type: {class: BlackboardDragNode, ns: TNodeCore.Runtime.Models, asm: TNodeCore}
data:
positionInView:
serializedVersion: 2
x: -10
y: -95
width: 0
height: 0
id: 33d100b8-692c-445f-99e0-329727670e93
nodeName:
entryPoint: 0
isTest: 0
blackDragData: HelloGameObject
isListElement: 0
00000001:
00000004:
type: {class: HelloBlackboard, ns: TNode.Samples, asm: Assembly-CSharp}
data:
positionInView:
@ -50,9 +114,11 @@ MonoBehaviour:
id:
HelloString:
HelloGameObject: {fileID: 0}
V3S: []
V2S: []
00000002:
V3S:
- {x: 0, y: 0, z: 0}
V2S:
- {x: 0, y: 0}
00000005:
type: {class: GraphViewModel, ns: TNode.TNodeCore.Editor.Models, asm: TNodeCore}
data:
positionInView:
@ -63,5 +129,5 @@ MonoBehaviour:
height: 0
id:
persistScale: 1
persistOffset: {x: 441, y: 254}
persistOffset: {x: 487, y: 320}
isBlackboardOn: 1

@ -1,4 +1,5 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
@ -373,7 +374,24 @@ namespace TNodeGraphViewImpl.Editor.NodeGraphView{
//Make a constructor of BlackboardDragNode<field.PropertyType > by reflection
var dragNodeData = NodeCreator.InstantiateNodeData<BlackboardDragNode>();
dragNodeData.BlackboardData = GetBlackboardData();
//Check if the entry's property type is a IList
if (typeof(IList).IsAssignableFrom(entry.propertyType)){
//Check if it's a array
if (entry.propertyType.IsArray){
dragNodeData.BlackboardDragType = entry.propertyType.GetElementType();
}
else{
dragNodeData.BlackboardDragType = entry.propertyType.GetGenericArguments()[0];
}
Debug.Log(dragNodeData.BlackboardDragType);
}
else{
dragNodeData.BlackboardDragType = entry.propertyType;
}
Debug.Log(entry.propertyType);
dragNodeData.BlackDragData = entry.propertyPath;
AddTNode(dragNodeData,new Rect(realPos,new Vector2(200,200)));
@ -466,9 +484,9 @@ namespace TNodeGraphViewImpl.Editor.NodeGraphView{
private void LoadPersistentGraphViewData(){
var r= _data.GraphViewModel;
this.viewTransformChanged-=OnViewTransformChanged;
this.UpdateViewTransform(r.persistOffset,new Vector3(r.persistScale,r.persistScale,1));
this.viewTransformChanged+=OnViewTransformChanged;
viewTransformChanged-=OnViewTransformChanged;
UpdateViewTransform(r.persistOffset,new Vector3(r.persistScale,r.persistScale,1));
viewTransformChanged+=OnViewTransformChanged;
}

@ -153,7 +153,9 @@ namespace TNodeGraphViewImpl.Editor.NodeViews{
case TypeHandling.Specified:
return portAttribute.HandledType??typeof(object);
case TypeHandling.Path:
return GetDataType(portAttribute.TypePath);
var type = GetDataType(portAttribute.TypePath);
Debug.Log(type);
return type;
default:
throw new ArgumentOutOfRangeException();
}

Loading…
Cancel
Save