From 8bef8e690e7adac2e9f26bbb190da1b328699d42 Mon Sep 17 00:00:00 2001
From: "Aaron (Qilong)" <173288704@qq.com>
Date: Mon, 16 Sep 2024 16:03:52 -0400
Subject: [PATCH 1/3] DYN-5161 The "Show Connectors" feature should register
newly placed nodes (#13170)
---
.../Graph/Connectors/ConnectorModel.cs | 4 ++
src/DynamoCore/Models/RecordableCommands.cs | 21 ++++++----
.../ViewModels/Core/ConnectorViewModel.cs | 40 ++++++++++---------
3 files changed, 39 insertions(+), 26 deletions(-)
diff --git a/src/DynamoCore/Graph/Connectors/ConnectorModel.cs b/src/DynamoCore/Graph/Connectors/ConnectorModel.cs
index 4309f96b9e9..70756d5bf64 100644
--- a/src/DynamoCore/Graph/Connectors/ConnectorModel.cs
+++ b/src/DynamoCore/Graph/Connectors/ConnectorModel.cs
@@ -3,6 +3,7 @@
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Xml;
+using Dynamo.Configuration;
using Dynamo.Graph.Nodes;
using Dynamo.Graph.Workspaces;
using Dynamo.Utilities;
@@ -159,6 +160,9 @@ private ConnectorModel(
GUID = guid;
Start = start.OutPorts[startIndex];
PortModel endPort = end.InPorts[endIndex];
+ // Reading visibility settings from preferences and setting the visibility of the connector
+ // so that setting changes within the session can be relfected instantly
+ IsHidden = !PreferenceSettings.Instance.ShowConnector;
Debug.WriteLine("Creating a connector between ports {0}(owner:{1}) and {2}(owner:{3}).",
start.GUID, Start.Owner == null ? "null" : Start.Owner.Name, end.GUID, endPort.Owner == null ? "null" : endPort.Owner.Name);
diff --git a/src/DynamoCore/Models/RecordableCommands.cs b/src/DynamoCore/Models/RecordableCommands.cs
index 33250cac9ed..874d1de44dd 100644
--- a/src/DynamoCore/Models/RecordableCommands.cs
+++ b/src/DynamoCore/Models/RecordableCommands.cs
@@ -11,6 +11,7 @@
using System.Runtime.Serialization;
using System.Xml;
using System.Globalization;
+using Dynamo.Configuration;
namespace Dynamo.Models
{
@@ -1563,15 +1564,16 @@ public enum Mode
BeginCreateConnections
}
- void setProperties(int portIndex, PortType portType, Mode mode)
+ void SetProperties(int portIndex, PortType portType, Mode mode)
{
PortIndex = portIndex;
Type = portType;
ConnectionMode = mode;
+ IsHidden = !PreferenceSettings.Instance.ShowConnector;
}
///
- ///
+ /// Recordable command ConnectionCommand constructor
///
///
///
@@ -1581,11 +1583,11 @@ void setProperties(int portIndex, PortType portType, Mode mode)
public MakeConnectionCommand(string nodeId, int portIndex, PortType portType, Mode mode)
: base(new[] { Guid.Parse(nodeId) })
{
- setProperties(portIndex, portType, mode);
+ SetProperties(portIndex, portType, mode);
}
///
- ///
+ /// Recordable command ConnectionCommand constructor
///
///
///
@@ -1594,11 +1596,11 @@ public MakeConnectionCommand(string nodeId, int portIndex, PortType portType, Mo
public MakeConnectionCommand(Guid nodeId, int portIndex, PortType portType, Mode mode)
: base(new[] { nodeId })
{
- setProperties(portIndex, portType, mode);
+ SetProperties(portIndex, portType, mode);
}
///
- ///
+ /// Recordable command ConnectionCommand constructor
///
///
///
@@ -1607,7 +1609,7 @@ public MakeConnectionCommand(Guid nodeId, int portIndex, PortType portType, Mode
public MakeConnectionCommand(IEnumerable nodeId, int portIndex, PortType portType, Mode mode)
: base(nodeId)
{
- setProperties(portIndex, portType, mode);
+ SetProperties(portIndex, portType, mode);
}
internal static MakeConnectionCommand DeserializeCore(XmlElement element)
@@ -1616,7 +1618,6 @@ internal static MakeConnectionCommand DeserializeCore(XmlElement element)
int portIndex = helper.ReadInteger("PortIndex");
var portType = ((PortType)helper.ReadInteger("Type"));
var mode = ((Mode)helper.ReadInteger("ConnectionMode"));
-
var modelGuids = DeserializeGuid(element, helper);
return new MakeConnectionCommand(modelGuids, portIndex, portType, mode);
@@ -1635,6 +1636,9 @@ internal static MakeConnectionCommand DeserializeCore(XmlElement element)
[DataMember]
public Mode ConnectionMode { get; private set; }
+ [DataMember]
+ internal bool IsHidden { get; private set; }
+
#endregion
#region Protected Overridable Methods
@@ -1651,6 +1655,7 @@ protected override void SerializeCore(XmlElement element)
helper.SetAttribute("PortIndex", PortIndex);
helper.SetAttribute("Type", ((int)Type));
helper.SetAttribute("ConnectionMode", ((int)ConnectionMode));
+ helper.SetAttribute("IsHidden", IsHidden);
}
#endregion
diff --git a/src/DynamoCoreWpf/ViewModels/Core/ConnectorViewModel.cs b/src/DynamoCoreWpf/ViewModels/Core/ConnectorViewModel.cs
index c4f440a69a6..69fba9e46b9 100644
--- a/src/DynamoCoreWpf/ViewModels/Core/ConnectorViewModel.cs
+++ b/src/DynamoCoreWpf/ViewModels/Core/ConnectorViewModel.cs
@@ -1450,22 +1450,18 @@ public void Redraw(object parameter)
{
var p2 = new Point();
- if (parameter is Point)
+ if (parameter is Point point)
{
- p2 = (Point)parameter;
+ p2 = point;
}
- else if (parameter is Point2D)
+ else if (parameter is Point2D d)
{
- p2 = ((Point2D)parameter).AsWindowsType();
+ p2 = d.AsWindowsType();
}
CurvePoint3 = p2;
-
- var offset = 0.0;
- double distance = 0;
-
- distance = Math.Sqrt(Math.Pow(CurvePoint3.X - CurvePoint0.X, 2) + Math.Pow(CurvePoint3.Y - CurvePoint0.Y, 2));
- offset = .45 * distance;
+ double distance = Math.Sqrt(Math.Pow(CurvePoint3.X - CurvePoint0.X, 2) + Math.Pow(CurvePoint3.Y - CurvePoint0.Y, 2));
+ double offset = .45 * distance;
CurvePoint1 = new Point(CurvePoint0.X + offset, CurvePoint0.Y);
CurvePoint2 = new Point(p2.X - offset, p2.Y);
@@ -1485,20 +1481,28 @@ public void Redraw(object parameter)
//RaisePropertyChanged(string.Empty);
- PathFigure pathFigure = new PathFigure();
- pathFigure.StartPoint = CurvePoint0;
+ PathFigure pathFigure = new PathFigure
+ {
+ StartPoint = CurvePoint0
+ };
BezierSegment segment = new BezierSegment(CurvePoint1, CurvePoint2, CurvePoint3, true);
- var segmentCollection = new PathSegmentCollection(1);
- segmentCollection.Add(segment);
+ var segmentCollection = new PathSegmentCollection(1)
+ {
+ segment
+ };
pathFigure.Segments = segmentCollection;
PathFigureCollection pathFigureCollection = new PathFigureCollection();
pathFigureCollection.Add(pathFigure);
- ComputedBezierPathGeometry = new PathGeometry();
- ComputedBezierPathGeometry.Figures = pathFigureCollection;
- ComputedBezierPath = new Path();
- ComputedBezierPath.Data = ComputedBezierPathGeometry;
+ ComputedBezierPathGeometry = new PathGeometry
+ {
+ Figures = pathFigureCollection
+ };
+ ComputedBezierPath = new Path
+ {
+ Data = ComputedBezierPathGeometry
+ };
}
private PathFigure DrawSegmentBetweenPointPairs(Point startPt, Point endPt, ref List controlPointList)
From 1b7c2658faf55f5d4af7607444f85941ecfc8128 Mon Sep 17 00:00:00 2001
From: Ivo Petrov <48355182+ivaylo-matov@users.noreply.github.com>
Date: Mon, 16 Sep 2024 21:22:40 +0100
Subject: [PATCH 2/3] [DYN-7330] Add a button to show sample graph folder and
sample dataset (update) (#15485)
---
src/DynamoCoreWpf/Controls/StartPage.xaml.cs | 4 ++++
src/DynamoCoreWpf/DynamoCoreWpf.csproj | 2 +-
src/DynamoCoreWpf/Views/HomePage/HomePage.xaml.cs | 9 +++++----
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/DynamoCoreWpf/Controls/StartPage.xaml.cs b/src/DynamoCoreWpf/Controls/StartPage.xaml.cs
index ca92535604d..1ee8f9944de 100644
--- a/src/DynamoCoreWpf/Controls/StartPage.xaml.cs
+++ b/src/DynamoCoreWpf/Controls/StartPage.xaml.cs
@@ -295,6 +295,10 @@ private void SetSampleDatasetsPath()
{
sampleDatasetsPath = datasetsPath;
}
+ else
+ {
+ DynamoViewModel.Model.Logger.Log("Error, Dataset folder not found.");
+ }
}
}
catch (Exception ex)
diff --git a/src/DynamoCoreWpf/DynamoCoreWpf.csproj b/src/DynamoCoreWpf/DynamoCoreWpf.csproj
index ef816e2e081..bf4f97c5d2c 100644
--- a/src/DynamoCoreWpf/DynamoCoreWpf.csproj
+++ b/src/DynamoCoreWpf/DynamoCoreWpf.csproj
@@ -59,7 +59,7 @@
- 1.0.18
+ 1.0.19
DynamoHome
diff --git a/src/DynamoCoreWpf/Views/HomePage/HomePage.xaml.cs b/src/DynamoCoreWpf/Views/HomePage/HomePage.xaml.cs
index 906f6c5761f..63ff2b8ac44 100644
--- a/src/DynamoCoreWpf/Views/HomePage/HomePage.xaml.cs
+++ b/src/DynamoCoreWpf/Views/HomePage/HomePage.xaml.cs
@@ -615,8 +615,10 @@ internal void ShowSampleFilesInFolder()
return;
}
- Process.Start(new ProcessStartInfo("explorer.exe", "/select,"
- + this.startPage.SampleFolderPath)
+ // Open the default Explorer location if the Sample folder cannot be found
+ string explorerArg = this.startPage.SampleFolderPath != null ? "/select," + this.startPage.SampleFolderPath : "";
+
+ Process.Start(new ProcessStartInfo("explorer.exe", explorerArg)
{ UseShellExecute = true });
Logging.Analytics.TrackEvent(Logging.Actions.Show, Logging.Categories.DynamoHomeOperations, "Sample Files");
}
@@ -630,8 +632,7 @@ internal void ShowSampleDatasetsInFolder()
return;
}
- Process.Start(new ProcessStartInfo("explorer.exe", /*"/select,"*/
- /*+ */this.startPage.SampleDatasetsPath)
+ Process.Start(new ProcessStartInfo("explorer.exe", this.startPage.SampleDatasetsPath)
{ UseShellExecute = true });
Logging.Analytics.TrackEvent(Logging.Actions.Show, Logging.Categories.DynamoHomeOperations, "Dataset Files");
}
From c567326d34efefd206a70181843c7a72a0756ffb Mon Sep 17 00:00:00 2001
From: chubakueno
Date: Mon, 16 Sep 2024 16:28:49 -0500
Subject: [PATCH 3/3] DYN-7268 Package manager loading fix when no IDSDK is
available (#15484)
---
src/DynamoCoreWpf/Views/HomePage/HomePage.xaml.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/DynamoCoreWpf/Views/HomePage/HomePage.xaml.cs b/src/DynamoCoreWpf/Views/HomePage/HomePage.xaml.cs
index 63ff2b8ac44..68e58344c96 100644
--- a/src/DynamoCoreWpf/Views/HomePage/HomePage.xaml.cs
+++ b/src/DynamoCoreWpf/Views/HomePage/HomePage.xaml.cs
@@ -125,7 +125,7 @@ private void OnDataContextChanged(object sender, DependencyPropertyChangedEventA
private void DynamoViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
- if(dynWebView?.CoreWebView2 != null && e.PropertyName.Equals(nameof(startPage.DynamoViewModel.ShowStartPage)))
+ if(e.PropertyName == nameof(startPage.DynamoViewModel.ShowStartPage) && dynWebView?.CoreWebView2 != null)
{
dynWebView.CoreWebView2.ExecuteScriptAsync(@$"window.setShowStartPageChanged('{startPage.DynamoViewModel.ShowStartPage}')");
}