Initial Commit
This commit is contained in:
parent
53eb92e9af
commit
270ab7d11f
15341 changed files with 700234 additions and 0 deletions
|
@ -0,0 +1,61 @@
|
|||
using System.Linq;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
/// <summary>
|
||||
/// Fetches input values from the parent super unit for this graph.
|
||||
/// </summary>
|
||||
[UnitCategory("Nesting")]
|
||||
[UnitOrder(1)]
|
||||
[UnitTitle("Input")]
|
||||
public sealed class GraphInput : Unit
|
||||
{
|
||||
public override bool canDefine => graph != null;
|
||||
|
||||
protected override void Definition()
|
||||
{
|
||||
isControlRoot = true;
|
||||
|
||||
foreach (var controlInputDefinition in graph.validPortDefinitions.OfType<ControlInputDefinition>())
|
||||
{
|
||||
ControlOutput(controlInputDefinition.key);
|
||||
}
|
||||
|
||||
foreach (var valueInputDefinition in graph.validPortDefinitions.OfType<ValueInputDefinition>())
|
||||
{
|
||||
var key = valueInputDefinition.key;
|
||||
var type = valueInputDefinition.type;
|
||||
|
||||
ValueOutput(type, key, (flow) =>
|
||||
{
|
||||
var superUnit = flow.stack.GetParent<SuperUnit>();
|
||||
|
||||
if (flow.enableDebug)
|
||||
{
|
||||
var editorData = flow.stack.GetElementDebugData<IUnitDebugData>(superUnit);
|
||||
|
||||
editorData.lastInvokeFrame = EditorTimeBinding.frame;
|
||||
editorData.lastInvokeTime = EditorTimeBinding.time;
|
||||
}
|
||||
|
||||
flow.stack.ExitParentElement();
|
||||
superUnit.EnsureDefined();
|
||||
var value = flow.GetValue(superUnit.valueInputs[key], type);
|
||||
flow.stack.EnterParentElement(superUnit);
|
||||
|
||||
return value;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected override void AfterDefine()
|
||||
{
|
||||
graph.onPortDefinitionsChanged += Define;
|
||||
}
|
||||
|
||||
protected override void BeforeUndefine()
|
||||
{
|
||||
graph.onPortDefinitionsChanged -= Define;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1dae8c3432bf04c91bc877618e08117e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,54 @@
|
|||
using System.Linq;
|
||||
|
||||
namespace Unity.VisualScripting
|
||||
{
|
||||
/// <summary>
|
||||
/// Passes output values from this graph to the parent super unit.
|
||||
/// </summary>
|
||||
[UnitCategory("Nesting")]
|
||||
[UnitOrder(2)]
|
||||
[UnitTitle("Output")]
|
||||
public sealed class GraphOutput : Unit
|
||||
{
|
||||
public override bool canDefine => graph != null;
|
||||
|
||||
protected override void Definition()
|
||||
{
|
||||
isControlRoot = true;
|
||||
|
||||
foreach (var controlOutputDefinition in graph.validPortDefinitions.OfType<ControlOutputDefinition>())
|
||||
{
|
||||
var key = controlOutputDefinition.key;
|
||||
|
||||
ControlInput(key, (flow) =>
|
||||
{
|
||||
var superUnit = flow.stack.GetParent<SuperUnit>();
|
||||
|
||||
flow.stack.ExitParentElement();
|
||||
|
||||
superUnit.EnsureDefined();
|
||||
|
||||
return superUnit.controlOutputs[key];
|
||||
});
|
||||
}
|
||||
|
||||
foreach (var valueOutputDefinition in graph.validPortDefinitions.OfType<ValueOutputDefinition>())
|
||||
{
|
||||
var key = valueOutputDefinition.key;
|
||||
var type = valueOutputDefinition.type;
|
||||
|
||||
ValueInput(type, key);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void AfterDefine()
|
||||
{
|
||||
graph.onPortDefinitionsChanged += Define;
|
||||
}
|
||||
|
||||
protected override void BeforeUndefine()
|
||||
{
|
||||
graph.onPortDefinitionsChanged -= Define;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1e7022f31fb6241748cc2cb35bace5b6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue