Skip to content

Commit

Permalink
Ensure nested mashup sources are always serialized
Browse files Browse the repository at this point in the history
  • Loading branch information
glopesdev committed Sep 27, 2022
1 parent c70ca30 commit 888782c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions Bonsai.Editor/Layout/LayoutHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,16 +273,13 @@ static void SerializeMashupVisualizerSettings(
foreach (var source in mashupVisualizer.MashupSources)
{
var sourceIndex = GetMashupSourceIndex(source, topologicalOrder);
if (sourceIndex.HasValue)
{
var mashupSource = SerializeMashupSource(sourceIndex.Value, source.Visualizer, topologicalOrder);
root.Add(mashupSource);
}
var mashupSource = SerializeMashupSource(sourceIndex, source.Visualizer, topologicalOrder);
root.Add(mashupSource);
}
}

static XElement SerializeMashupSource(
int sourceIndex,
int? sourceIndex,
DialogTypeVisualizer visualizer,
IEnumerable<Node<ExpressionBuilder, ExpressionBuilderArgument>> topologicalOrder)
{
Expand All @@ -301,7 +298,7 @@ static XElement SerializeMashupSource(

visualizerSettings = new XDocument(
new XElement(MashupSettingsElement,
new XElement(MashupSourceElement, sourceIndex),
sourceIndex.HasValue ? new XElement(MashupSourceElement, sourceIndex.Value) : null,
new XElement(nameof(VisualizerDialogSettings.VisualizerTypeName), visualizerType.FullName),
new XElement(nameof(VisualizerDialogSettings.VisualizerSettings), visualizerSettings.Root)));
return visualizerSettings.Root;
Expand Down

0 comments on commit 888782c

Please sign in to comment.