commit
aafab2bc4b
48 changed files with 830 additions and 0 deletions
@ -0,0 +1,8 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 95903e6a18543fb46ba6bd05887b9e85 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
externalObjects: {} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
@ -0,0 +1,8 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 131a6b21c8605f84396be9f6751fb6e3 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
externalObjects: {} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
@ -0,0 +1,208 @@ |
||||
%YAML 1.1 |
||||
%TAG !u! tag:unity3d.com,2011: |
||||
--- !u!29 &1 |
||||
OcclusionCullingSettings: |
||||
m_ObjectHideFlags: 0 |
||||
serializedVersion: 2 |
||||
m_OcclusionBakeSettings: |
||||
smallestOccluder: 5 |
||||
smallestHole: 0.25 |
||||
backfaceThreshold: 100 |
||||
m_SceneGUID: 00000000000000000000000000000000 |
||||
m_OcclusionCullingData: {fileID: 0} |
||||
--- !u!104 &2 |
||||
RenderSettings: |
||||
m_ObjectHideFlags: 0 |
||||
serializedVersion: 9 |
||||
m_Fog: 0 |
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
||||
m_FogMode: 3 |
||||
m_FogDensity: 0.01 |
||||
m_LinearFogStart: 0 |
||||
m_LinearFogEnd: 300 |
||||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} |
||||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} |
||||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} |
||||
m_AmbientIntensity: 1 |
||||
m_AmbientMode: 3 |
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
||||
m_SkyboxMaterial: {fileID: 0} |
||||
m_HaloStrength: 0.5 |
||||
m_FlareStrength: 1 |
||||
m_FlareFadeSpeed: 3 |
||||
m_HaloTexture: {fileID: 0} |
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
||||
m_DefaultReflectionMode: 0 |
||||
m_DefaultReflectionResolution: 128 |
||||
m_ReflectionBounces: 1 |
||||
m_ReflectionIntensity: 1 |
||||
m_CustomReflection: {fileID: 0} |
||||
m_Sun: {fileID: 0} |
||||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} |
||||
m_UseRadianceAmbientProbe: 0 |
||||
--- !u!157 &3 |
||||
LightmapSettings: |
||||
m_ObjectHideFlags: 0 |
||||
serializedVersion: 12 |
||||
m_GIWorkflowMode: 1 |
||||
m_GISettings: |
||||
serializedVersion: 2 |
||||
m_BounceScale: 1 |
||||
m_IndirectOutputScale: 1 |
||||
m_AlbedoBoost: 1 |
||||
m_EnvironmentLightingMode: 0 |
||||
m_EnableBakedLightmaps: 0 |
||||
m_EnableRealtimeLightmaps: 0 |
||||
m_LightmapEditorSettings: |
||||
serializedVersion: 12 |
||||
m_Resolution: 2 |
||||
m_BakeResolution: 40 |
||||
m_AtlasSize: 1024 |
||||
m_AO: 0 |
||||
m_AOMaxDistance: 1 |
||||
m_CompAOExponent: 1 |
||||
m_CompAOExponentDirect: 0 |
||||
m_ExtractAmbientOcclusion: 0 |
||||
m_Padding: 2 |
||||
m_LightmapParameters: {fileID: 0} |
||||
m_LightmapsBakeMode: 1 |
||||
m_TextureCompression: 1 |
||||
m_FinalGather: 0 |
||||
m_FinalGatherFiltering: 1 |
||||
m_FinalGatherRayCount: 256 |
||||
m_ReflectionCompression: 2 |
||||
m_MixedBakeMode: 2 |
||||
m_BakeBackend: 0 |
||||
m_PVRSampling: 1 |
||||
m_PVRDirectSampleCount: 32 |
||||
m_PVRSampleCount: 500 |
||||
m_PVRBounces: 2 |
||||
m_PVREnvironmentSampleCount: 500 |
||||
m_PVREnvironmentReferencePointCount: 2048 |
||||
m_PVRFilteringMode: 2 |
||||
m_PVRDenoiserTypeDirect: 0 |
||||
m_PVRDenoiserTypeIndirect: 0 |
||||
m_PVRDenoiserTypeAO: 0 |
||||
m_PVRFilterTypeDirect: 0 |
||||
m_PVRFilterTypeIndirect: 0 |
||||
m_PVRFilterTypeAO: 0 |
||||
m_PVREnvironmentMIS: 0 |
||||
m_PVRCulling: 1 |
||||
m_PVRFilteringGaussRadiusDirect: 1 |
||||
m_PVRFilteringGaussRadiusIndirect: 5 |
||||
m_PVRFilteringGaussRadiusAO: 2 |
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5 |
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2 |
||||
m_PVRFilteringAtrousPositionSigmaAO: 1 |
||||
m_ExportTrainingData: 0 |
||||
m_TrainingDataDestination: TrainingData |
||||
m_LightProbeSampleCountMultiplier: 4 |
||||
m_LightingDataAsset: {fileID: 0} |
||||
m_LightingSettings: {fileID: 0} |
||||
--- !u!196 &4 |
||||
NavMeshSettings: |
||||
serializedVersion: 2 |
||||
m_ObjectHideFlags: 0 |
||||
m_BuildSettings: |
||||
serializedVersion: 2 |
||||
agentTypeID: 0 |
||||
agentRadius: 0.5 |
||||
agentHeight: 2 |
||||
agentSlope: 45 |
||||
agentClimb: 0.4 |
||||
ledgeDropHeight: 0 |
||||
maxJumpAcrossDistance: 0 |
||||
minRegionArea: 2 |
||||
manualCellSize: 0 |
||||
cellSize: 0.16666667 |
||||
manualTileSize: 0 |
||||
tileSize: 256 |
||||
accuratePlacement: 0 |
||||
maxJobWorkers: 0 |
||||
preserveTilesOutsideBounds: 0 |
||||
debug: |
||||
m_Flags: 0 |
||||
m_NavMeshData: {fileID: 0} |
||||
--- !u!1 &519420028 |
||||
GameObject: |
||||
m_ObjectHideFlags: 0 |
||||
m_CorrespondingSourceObject: {fileID: 0} |
||||
m_PrefabInstance: {fileID: 0} |
||||
m_PrefabAsset: {fileID: 0} |
||||
serializedVersion: 6 |
||||
m_Component: |
||||
- component: {fileID: 519420032} |
||||
- component: {fileID: 519420031} |
||||
- component: {fileID: 519420029} |
||||
m_Layer: 0 |
||||
m_Name: Main Camera |
||||
m_TagString: MainCamera |
||||
m_Icon: {fileID: 0} |
||||
m_NavMeshLayer: 0 |
||||
m_StaticEditorFlags: 0 |
||||
m_IsActive: 1 |
||||
--- !u!81 &519420029 |
||||
AudioListener: |
||||
m_ObjectHideFlags: 0 |
||||
m_CorrespondingSourceObject: {fileID: 0} |
||||
m_PrefabInstance: {fileID: 0} |
||||
m_PrefabAsset: {fileID: 0} |
||||
m_GameObject: {fileID: 519420028} |
||||
m_Enabled: 1 |
||||
--- !u!20 &519420031 |
||||
Camera: |
||||
m_ObjectHideFlags: 0 |
||||
m_CorrespondingSourceObject: {fileID: 0} |
||||
m_PrefabInstance: {fileID: 0} |
||||
m_PrefabAsset: {fileID: 0} |
||||
m_GameObject: {fileID: 519420028} |
||||
m_Enabled: 1 |
||||
serializedVersion: 2 |
||||
m_ClearFlags: 2 |
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} |
||||
m_projectionMatrixMode: 1 |
||||
m_GateFitMode: 2 |
||||
m_FOVAxisMode: 0 |
||||
m_SensorSize: {x: 36, y: 24} |
||||
m_LensShift: {x: 0, y: 0} |
||||
m_FocalLength: 50 |
||||
m_NormalizedViewPortRect: |
||||
serializedVersion: 2 |
||||
x: 0 |
||||
y: 0 |
||||
width: 1 |
||||
height: 1 |
||||
near clip plane: 0.3 |
||||
far clip plane: 1000 |
||||
field of view: 60 |
||||
orthographic: 1 |
||||
orthographic size: 5 |
||||
m_Depth: -1 |
||||
m_CullingMask: |
||||
serializedVersion: 2 |
||||
m_Bits: 4294967295 |
||||
m_RenderingPath: -1 |
||||
m_TargetTexture: {fileID: 0} |
||||
m_TargetDisplay: 0 |
||||
m_TargetEye: 0 |
||||
m_HDR: 1 |
||||
m_AllowMSAA: 0 |
||||
m_AllowDynamicResolution: 0 |
||||
m_ForceIntoRT: 0 |
||||
m_OcclusionCulling: 0 |
||||
m_StereoConvergence: 10 |
||||
m_StereoSeparation: 0.022 |
||||
--- !u!4 &519420032 |
||||
Transform: |
||||
m_ObjectHideFlags: 0 |
||||
m_CorrespondingSourceObject: {fileID: 0} |
||||
m_PrefabInstance: {fileID: 0} |
||||
m_PrefabAsset: {fileID: 0} |
||||
m_GameObject: {fileID: 519420028} |
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
||||
m_LocalPosition: {x: 0, y: 0, z: -10} |
||||
m_LocalScale: {x: 1, y: 1, z: 1} |
||||
m_Children: [] |
||||
m_Father: {fileID: 0} |
||||
m_RootOrder: 0 |
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
@ -0,0 +1,7 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 2cda990e2423bbf4892e6590ba056729 |
||||
DefaultImporter: |
||||
externalObjects: {} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
@ -0,0 +1,8 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 8b1257251e593d24e807cb3c1b690097 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
externalObjects: {} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
@ -0,0 +1,69 @@ |
||||
using Codice.CM.Common; |
||||
using TNode.BaseViews; |
||||
using TNode.Tools; |
||||
using UnityEditor; |
||||
using UnityEngine; |
||||
using UnityEngine.Serialization; |
||||
using UnityEngine.UIElements; |
||||
|
||||
namespace TNode.Editor{ |
||||
|
||||
public abstract class GraphEditor<T> : EditorWindow where T:GraphData{ |
||||
protected DataGraphView<T> _graphView; |
||||
[FormerlySerializedAs("m_VisualTreeAsset")] [SerializeField] |
||||
private VisualTreeAsset mVisualTreeAsset = default; |
||||
|
||||
public void CreateGUI() |
||||
{ |
||||
// Each editor window contains a root VisualElement object |
||||
VisualElement root = rootVisualElement; |
||||
|
||||
// Instantiate UXML |
||||
VisualElement labelFromUXML = mVisualTreeAsset.Instantiate(); |
||||
root.Add(labelFromUXML); |
||||
|
||||
BuildGraphView(); |
||||
|
||||
|
||||
|
||||
DefineGraphEditorActions(); |
||||
|
||||
|
||||
OnCreate(); |
||||
} |
||||
private void BuildGraphView(){ |
||||
_graphView = NodeEditorExtensions.CreateInstance<DataGraphView<T>>(); |
||||
rootVisualElement.Add(_graphView); |
||||
_graphView.StretchToParentSize(); |
||||
} |
||||
|
||||
private void DefineGraphEditorActions(){ |
||||
//Register a event when user press ctrl + s |
||||
rootVisualElement.RegisterCallback<KeyUpEvent>((evt) => { |
||||
if (evt.keyCode == KeyCode.S && evt.ctrlKey) |
||||
{ |
||||
Save(); |
||||
} |
||||
}); |
||||
|
||||
} |
||||
|
||||
private void Save(){ |
||||
//if no graph is loaded ,create a file save dialogue |
||||
if (_graphView.Data == null) |
||||
{ |
||||
string path = EditorUtility.SaveFilePanel("Save Graph", "", "", "asset"); |
||||
if (path.Length != 0){ |
||||
//Create a new asset file with type of T |
||||
T asset = ScriptableObject.CreateInstance<T>(); |
||||
AssetDatabase.CreateAsset(asset, path); |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
protected virtual void OnCreate(){ |
||||
|
||||
} |
||||
} |
||||
} |
@ -0,0 +1,12 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 392314ca0623a2f4eba9178374a650e2 |
||||
MonoImporter: |
||||
externalObjects: {} |
||||
serializedVersion: 2 |
||||
defaultReferences: |
||||
- m_VisualTreeAsset: {fileID: 9197481963319205126, guid: b67f6dcbe2361b649ad2b7845207321b, type: 3} |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
@ -0,0 +1,5 @@ |
||||
.custom-label { |
||||
font-size: 20px; |
||||
-unity-font-style: bold; |
||||
color: rgb(68, 138, 255); |
||||
} |
@ -0,0 +1,11 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 695180bcb9ddc3b47bbf70fe1f5dd651 |
||||
ScriptedImporter: |
||||
internalIDToNameTable: [] |
||||
externalObjects: {} |
||||
serializedVersion: 2 |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} |
||||
disableValidation: 0 |
@ -0,0 +1,3 @@ |
||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True"> |
||||
<Style src="project://database/Assets/TNode/Editor/GraphEditor.uss?fileID=7433441132597879392&guid=695180bcb9ddc3b47bbf70fe1f5dd651&type=3#TGraphView" /> |
||||
</ui:UXML> |
@ -0,0 +1,10 @@ |
||||
fileFormatVersion: 2 |
||||
guid: b67f6dcbe2361b649ad2b7845207321b |
||||
ScriptedImporter: |
||||
internalIDToNameTable: [] |
||||
externalObjects: {} |
||||
serializedVersion: 2 |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0} |
@ -0,0 +1,8 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 18f38c39496afae47ab40fb512c3ce7c |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
externalObjects: {} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
@ -0,0 +1,23 @@ |
||||
%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: b991a97e1e8f4ac7bbebd5263dafb1c3, type: 3} |
||||
m_Name: Hello |
||||
m_EditorClassIdentifier: |
||||
nodes: [] |
||||
nodeLinks: [] |
||||
entryNode: |
||||
rid: -2 |
||||
references: |
||||
version: 2 |
||||
RefIds: |
||||
- rid: -2 |
||||
type: {class: , ns: , asm: } |
@ -0,0 +1,8 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 4c206553cd2be4144994dc84eefb649d |
||||
NativeFormatImporter: |
||||
externalObjects: {} |
||||
mainObjectFileID: 11400000 |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
@ -0,0 +1,30 @@ |
||||
using UnityEditor; |
||||
using UnityEngine; |
||||
using UnityEngine.UIElements; |
||||
|
||||
public class TestGraphEditor : EditorWindow |
||||
{ |
||||
[SerializeField] |
||||
private VisualTreeAsset m_VisualTreeAsset = default; |
||||
|
||||
[MenuItem("Window/UI Toolkit/TestGraphEditor")] |
||||
public static void ShowExample() |
||||
{ |
||||
TestGraphEditor wnd = GetWindow<TestGraphEditor>(); |
||||
wnd.titleContent = new GUIContent("TestGraphEditor"); |
||||
} |
||||
|
||||
public void CreateGUI() |
||||
{ |
||||
// Each editor window contains a root VisualElement object |
||||
VisualElement root = rootVisualElement; |
||||
|
||||
// VisualElements objects can contain other VisualElement following a tree hierarchy. |
||||
VisualElement label = new Label("Hello World! From C#"); |
||||
root.Add(label); |
||||
|
||||
// Instantiate UXML |
||||
VisualElement labelFromUXML = m_VisualTreeAsset.Instantiate(); |
||||
root.Add(labelFromUXML); |
||||
} |
||||
} |
@ -0,0 +1,11 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 7755292ea9ad7684eb1fc2040280fe50 |
||||
MonoImporter: |
||||
externalObjects: {} |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
@ -0,0 +1,5 @@ |
||||
.custom-label { |
||||
font-size: 20px; |
||||
-unity-font-style: bold; |
||||
color: rgb(68, 138, 255); |
||||
} |
@ -0,0 +1,11 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 867e511d719e0f14e871be51fb547391 |
||||
ScriptedImporter: |
||||
internalIDToNameTable: [] |
||||
externalObjects: {} |
||||
serializedVersion: 2 |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} |
||||
disableValidation: 0 |
@ -0,0 +1,12 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<engine:UXML |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xmlns:engine="UnityEngine.UIElements" |
||||
xmlns:editor="UnityEditor.UIElements" |
||||
xsi:noNamespaceSchemaLocation="../../UIElementsSchema/UIElements.xsd" |
||||
> |
||||
<Style src="project://database/Assets/Usage/TestGraphEditor.uss?fileID=7433441132597879392&guid=867e511d719e0f14e871be51fb547391&type=3#TestGraphEditor" /> |
||||
<engine:Label text="Hello World! From UXML" /> |
||||
<engine:Label class="custom-label" text="Hello World! With Style" /> |
||||
|
||||
</engine:UXML> |
@ -0,0 +1,10 @@ |
||||
fileFormatVersion: 2 |
||||
guid: ffc40a0c26876d9409f59e3252e7c29b |
||||
ScriptedImporter: |
||||
internalIDToNameTable: [] |
||||
externalObjects: {} |
||||
serializedVersion: 2 |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0} |
Loading…
Reference in new issue