Skip to content

Commit

Permalink
Fixed the Bindingsbug
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelvanHerwaarden committed May 28, 2019
1 parent 03f054a commit 18f7883
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
Binary file modified latestBuild/BeyondDynamo.zip
Binary file not shown.
6 changes: 3 additions & 3 deletions src/BeyondDynamo/BeyondDynamo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,13 @@
<ItemGroup>
<Compile Include="BeyondDynamoConfig.cs" />
<Compile Include="BeyondDynamoExtension.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="BeyondDynamoFunctions.cs" />
<Compile Include="resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="BeyondDynamoFunctions.cs" />
<Compile Include="UI\About\About.cs">
<SubType>Form</SubType>
</Compile>
Expand Down Expand Up @@ -211,9 +211,9 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="resources.resx">
<SubType>Designer</SubType>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="UI\About\About.resx">
<DependentUpon>About.cs</DependentUpon>
Expand Down
10 changes: 6 additions & 4 deletions src/BeyondDynamo/BeyondDynamoExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private double currentVersion
{
get
{
return 1.0;
return 1.1;
}
}

Expand Down Expand Up @@ -293,11 +293,12 @@ public void Loaded(ViewLoadedParams p)


# region THESE FUNCTION ONLY WORK INSIDE A SCRIPT
RemoveBindingsCurrent = new MenuItem { Header = "Remove Bindings from Current Graph" };
RemoveBindingsCurrent = new MenuItem { Header = "BETA: Remove Bindings from Current Graph" };
RemoveBindingsCurrent.Click += (sender, args) =>
{
//Check if the Graph is saved somewhere
Dynamo.Graph.Workspaces.WorkspaceModel workspaceModel = VM.Model.CurrentWorkspace;
WorkspaceViewModel workspaceViewModel = VM.CurrentSpaceViewModel;
WorkspaceModel workspaceModel = workspaceViewModel.Model;
string filePath = workspaceModel.FileName;
bool succes = false;
if (filePath == string.Empty)
Expand All @@ -313,8 +314,9 @@ public void Loaded(ViewLoadedParams p)
return;
}


//Save the Graph, Close the Graph, Try to Remove Trace Data, Open the Graph again.
VM.Model.CurrentWorkspace.Save(filePath, false, VM.Model.EngineController);
workspaceViewModel.DynamoViewModel.SaveAs(filePath);
VM.Model.RemoveWorkspace(VM.Model.CurrentWorkspace);
succes = BeyondDynamoFunctions.RemoveBindings(filePath);
if (succes)
Expand Down
6 changes: 3 additions & 3 deletions src/BeyondDynamo/BeyondDynamoFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
using Forms = System.Windows.Forms;
using Newtonsoft.Json;
using Dynamo.UI.Commands;

namespace BeyondDynamo
{
/// <summary>
Expand Down Expand Up @@ -155,10 +154,10 @@ public static bool RemoveBindings(string DynamoFilepath)
//Create a JObject from the Json Text
JObject dynamoGraph = JObject.Parse(jsonString);

//Loop over the Output Nodes and get their names

JToken bindings = dynamoGraph.SelectToken("Bindings");
JContainer bindingsParent = null;
foreach(JToken child in bindings.Children())
foreach (JToken child in bindings.Children())
{
bindingsParent = child.Parent;
}
Expand All @@ -169,6 +168,7 @@ public static bool RemoveBindings(string DynamoFilepath)
}
//Write that string
File.WriteAllText(DynamoFilepath, dynamoGraph.ToString());

return succes;
}

Expand Down

0 comments on commit 18f7883

Please sign in to comment.