@@ -431,27 +431,6 @@ namespace FlaxEditor.Surface
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HasIndependentBoxes => Archetype.IndependentBoxes != null;
|
public bool HasIndependentBoxes => Archetype.IndependentBoxes != null;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a value indicating whether this node has dependent boxes with assigned valid types. Otherwise any box has no dependent type assigned.
|
|
||||||
/// </summary>
|
|
||||||
public bool HasDependentBoxesSetup
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (Archetype.DependentBoxes == null || Archetype.IndependentBoxes == null)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
for (int i = 0; i < Archetype.DependentBoxes.Length; i++)
|
|
||||||
{
|
|
||||||
var b = GetBox(Archetype.DependentBoxes[i]);
|
|
||||||
if (b != null && b.CurrentType == b.DefaultType)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static readonly List<SurfaceNode> UpdateStack = new List<SurfaceNode>();
|
private static readonly List<SurfaceNode> UpdateStack = new List<SurfaceNode>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -178,19 +178,31 @@ namespace FlaxEditor.Surface
|
|||||||
|
|
||||||
// Update boxes types for nodes that dependant box types based on incoming connections
|
// Update boxes types for nodes that dependant box types based on incoming connections
|
||||||
{
|
{
|
||||||
bool keepUpdating = false;
|
bool keepUpdating = true;
|
||||||
int updateLimit = 100;
|
int updatesMin = 2, updatesMax = 100;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
keepUpdating = false;
|
||||||
for (int i = 0; i < RootControl.Children.Count; i++)
|
for (int i = 0; i < RootControl.Children.Count; i++)
|
||||||
{
|
{
|
||||||
if (RootControl.Children[i] is SurfaceNode node && !node.HasDependentBoxesSetup)
|
if (RootControl.Children[i] is SurfaceNode node)
|
||||||
{
|
{
|
||||||
node.UpdateBoxesTypes();
|
node.UpdateBoxesTypes();
|
||||||
|
var arch = node.Archetype;
|
||||||
|
if (arch.DependentBoxes != null && arch.IndependentBoxes != null)
|
||||||
|
{
|
||||||
|
foreach (var boxId in arch.DependentBoxes)
|
||||||
|
{
|
||||||
|
var b = node.GetBox(boxId);
|
||||||
|
if (b != null && b.CurrentType == b.DefaultType)
|
||||||
|
{
|
||||||
keepUpdating = true;
|
keepUpdating = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (keepUpdating && updateLimit-- > 0);
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while ((keepUpdating && --updatesMax > 0) || --updatesMin > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Loaded?.Invoke(this);
|
Loaded?.Invoke(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user