Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helix upgrade basics #10326

Merged
merged 14 commits into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ platform: Any CPU

configuration: Release

image: Visual Studio 2017

before_build:
- nuget restore .\src\Dynamo.All.sln

environment:
dynamo_solution: src/Dynamo.All.sln
image: Visual Studio 2017


build_script:
- where msbuild
- msbuild %dynamo_solution%


Expand Down
Binary file removed doc/distrib/Samples/Data/DynamoSample_2018.rvt
Binary file not shown.
Binary file added doc/distrib/Samples/Data/DynamoSample_2021.rvt
Binary file not shown.
11 changes: 11 additions & 0 deletions src/Dynamo.All.sln
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkspaceDependencyViewExtension", "WorkspaceDependencyViewExtension\WorkspaceDependencyViewExtension.csproj", "{5E76AAB3-6302-473E-9655-081B53FB1419}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibraryViewExtensionMSWebBrowser", "LibraryViewExtensionMSWebBrowser\LibraryViewExtensionMSWebBrowser.csproj", "{1A5DC90A-477E-4D4A-87BD-0BFB01F056CE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -811,6 +813,14 @@ Global
{5E76AAB3-6302-473E-9655-081B53FB1419}.Release|Any CPU.Build.0 = Release|Any CPU
{5E76AAB3-6302-473E-9655-081B53FB1419}.Release|x64.ActiveCfg = Release|Any CPU
{5E76AAB3-6302-473E-9655-081B53FB1419}.Release|x64.Build.0 = Release|Any CPU
{1A5DC90A-477E-4D4A-87BD-0BFB01F056CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1A5DC90A-477E-4D4A-87BD-0BFB01F056CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A5DC90A-477E-4D4A-87BD-0BFB01F056CE}.Debug|x64.ActiveCfg = Debug|Any CPU
{1A5DC90A-477E-4D4A-87BD-0BFB01F056CE}.Debug|x64.Build.0 = Debug|Any CPU
{1A5DC90A-477E-4D4A-87BD-0BFB01F056CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A5DC90A-477E-4D4A-87BD-0BFB01F056CE}.Release|Any CPU.Build.0 = Release|Any CPU
{1A5DC90A-477E-4D4A-87BD-0BFB01F056CE}.Release|x64.ActiveCfg = Release|Any CPU
{1A5DC90A-477E-4D4A-87BD-0BFB01F056CE}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -883,6 +893,7 @@ Global
{C0D6DEE5-5532-4345-9C66-4C00D7FDB8BE} = {FA7BE306-A3B0-45FA-9D87-0C69E6932C13}
{47D2166C-5261-4093-9660-E72B7035E666} = {88D45B00-E564-41DB-B57C-9509646CAA49}
{5E76AAB3-6302-473E-9655-081B53FB1419} = {88D45B00-E564-41DB-B57C-9509646CAA49}
{1A5DC90A-477E-4D4A-87BD-0BFB01F056CE} = {88D45B00-E564-41DB-B57C-9509646CAA49}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {89CB19C6-BF0A-4E6A-BFDA-79D143EAB59D}
Expand Down
4 changes: 4 additions & 0 deletions src/DynamoCore/Graph/Workspaces/HomeWorkspaceModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public class HomeWorkspaceModel : WorkspaceModel
private readonly bool verboseLogging;
private bool graphExecuted;

// Event to handle closing of the workspace references extension when the workspace is closed.
internal static event Action WorkspaceClosed;

// To check whether task is completed or not.
private bool executingTask;

Expand Down Expand Up @@ -419,6 +422,7 @@ private void NodeOnRequestSilenceNodeModifiedEvents(NodeModel node, bool value)
/// </summary>
public override void Clear()
{
WorkspaceClosed?.Invoke();
base.Clear();
PreloadedTraceData = null;
RunSettings.Reset();
Expand Down
2 changes: 2 additions & 0 deletions src/DynamoCore/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@
// Internals are visible to the Package Manager extension
// For workspace package dependency collection
[assembly: InternalsVisibleTo("WorkspaceDependencyViewExtension")]

[assembly: InternalsVisibleTo("LibraryViewExtensionMSWebBrowser")]
5 changes: 2 additions & 3 deletions src/DynamoCoreWpf/Extensions/ViewLoadedParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using Dynamo.Utilities;
using Dynamo.ViewModels;
using Dynamo.Visualization;
using Dynamo.Wpf.ViewModels;
using Dynamo.Wpf.ViewModels.Watch3D;

namespace Dynamo.Wpf.Extensions
Expand Down Expand Up @@ -99,7 +98,7 @@ public void AddMenuItem(MenuBarType type, MenuItem menuItem, int index = -1)
/// <returns></returns>
public void AddToExtensionsSideBar(IViewExtension viewExtension, ContentControl contentControl)
{
TabItem tabItem = dynamoView.AddTabItem(viewExtension, contentControl);
TabItem tabItem = dynamoView.AddExtensionTabItem(viewExtension, contentControl);

if (tabItem != null)
{
Expand All @@ -118,7 +117,7 @@ public void AddToExtensionsSideBar(IViewExtension viewExtension, ContentControl
/// <returns></returns>
public void CloseExtensioninInSideBar(IViewExtension viewExtension)
{
dynamoView.CloseTabItem(viewExtension);
dynamoView.CloseExtensionTabItem(viewExtension);
}

public void AddSeparator(MenuBarType type, Separator separatorObj, int index = -1)
Expand Down
6 changes: 1 addition & 5 deletions src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1873,11 +1873,7 @@ internal bool CanSelectAll(object parameter)
public void MakeNewHomeWorkspace(object parameter)
{
if (ClearHomeWorkspaceInternal())
{
model.ResetEngine();

ShowStartPage = false; // Hide start page if there's one.
}
this.ShowStartPage = false; // Hide start page if there's one.
}

internal bool CanMakeNewHomeWorkspace(object parameter)
Expand Down
8 changes: 1 addition & 7 deletions src/DynamoCoreWpf/ViewModels/Watch3D/DynamoEffectsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,7 @@ public DynamoEffectsManager() : base() {
AddDynamoTechniques();
}

/// <summary>
/// Load effects used by Dynamo for rendering. Custom input layouts are
/// created which specify extra COLOR components used to hold data
/// about the selection state and vertex coloration of objects.
/// See <see cref="T:DynamoMeshVertex"/>, <see cref="T:DynamoPointVertex"/>, and <see cref="T:DynamoLineVertex"/>
/// for examples of how these layouts are used.
/// </summary>

protected void AddDynamoTechniques()
{
var custom = new TechniqueDescription("RenderCustom")
Expand Down
81 changes: 33 additions & 48 deletions src/DynamoCoreWpf/ViewModels/Watch3D/HelixWatch3DViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,25 +258,6 @@ protected void OnRequestZoomToFit(BoundingBox bounds)
RequestZoomToFit(bounds);
}
}

public event Func<Element3D, bool> RequestRemoveViewportItem;
private bool OnRequestRemoveViewportItem(Element3D item)
{
if(RequestRemoveViewportItem != null)
{
return RequestRemoveViewportItem(item);
}
return false;
}

public event Action<Element3D> RequestAddViewportItem;
private void OnRequestAddViewportItem(Element3D item)
{
if(RequestAddViewportItem != null)
{
RequestAddViewportItem(item);
}
}
#endregion

#region properties
Expand Down Expand Up @@ -461,6 +442,20 @@ private void UpdateSceneItems()
if (sceneItems == null)
sceneItems = new ObservableElement3DCollection();

//perform these updates here instead of everytime we add a single render package.
foreach(var geoModel3d in values)
{
if(geoModel3d is HelixToolkit.Wpf.SharpDX.GeometryModel3D)
{
var geo = (geoModel3d as HelixToolkit.Wpf.SharpDX.GeometryModel3D).Geometry;

geo.UpdateVertices();
geo.UpdateColors();
geo.UpdateBounds();
geo.UpdateTriangles();
}
}

sceneItems.Clear();
sceneItems.AddRange(values);
}
Expand All @@ -480,6 +475,7 @@ public IEnumerable<Element3D> SceneItems

public IEffectsManager EffectsManager { get; private set; }

[Obsolete("Not Implemented - Do Not Use.")]
public bool SupportDeferredRender { get; private set; }

#endregion
Expand Down Expand Up @@ -644,7 +640,6 @@ protected override void OnClear()
foreach (var key in Element3DDictionary.Keys.Except(keysList).ToList())
{
var model = Element3DDictionary[key] as GeometryModel3D;
OnRequestRemoveViewportItem(model);
Element3DDictionary.Remove(key);

model.Dispose();
Expand Down Expand Up @@ -886,7 +881,6 @@ private void DeleteGeometries(KeyValuePair<string, Element3D>[] geometryModels,
var frozenModel = AttachedProperties.GetIsFrozen(model3D);
if (frozenModel) continue;

OnRequestRemoveViewportItem(model3D);
Element3DDictionary.Remove(kvp.Key);
model3D.Dispose();

Expand Down Expand Up @@ -1065,6 +1059,9 @@ internal void ComputeFrameUpdate()
private void OnSceneItemsChanged()
{
UpdateSceneItems();
//TODO unclear if these are still required.
//since sceneItems are observable and we force them to update
//by clearing and readdding all items.
RaisePropertyChanged("SceneItems");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont see any consumer of this property change even before, and the other two places are both commented out.. Making me thinking if we can totally remove this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well the consumer is implicit, it's the xaml binding.

OnRequestViewRefresh();
}
Expand Down Expand Up @@ -1488,7 +1485,6 @@ public override void AddLabelForPath(string path)
{
// first, remove current labels of the node
// it does not crash if there is no such key in dictionary
OnRequestRemoveViewportItem(Element3DDictionary[labelName]);
var sceneItemsChanged = Element3DDictionary.Remove(labelName);

// it may be requested an array of items to put labels
Expand Down Expand Up @@ -1529,7 +1525,6 @@ public override void AddLabelForPath(string path)
}

Element3DDictionary.Add(labelName, bbText);
OnRequestAddViewportItem(bbText);

sceneItemsChanged = true;
nodesSelected[nodePath] = path;
Expand Down Expand Up @@ -1564,7 +1559,6 @@ public override void ClearPathLabel(string path)
var labelName = nodePath + TextKey;
lock (Element3DDictionaryMutex)
{
OnRequestRemoveViewportItem(Element3DDictionary[labelName]);
var sceneItemsChanged = Element3DDictionary.Remove(labelName);

if (sceneItemsChanged)
Expand Down Expand Up @@ -1673,10 +1667,10 @@ private void AggregateRenderPackages(IEnumerable<HelixRenderPackage> packages)
{
pointGeometry3D = CreatePointGeometryModel3D(rp);
Element3DDictionary.Add(id, pointGeometry3D);
OnRequestAddViewportItem(pointGeometry3D);
}

var points = pointGeometry3D.Geometry as PointGeometry3D;
var points = pointGeometry3D.Geometry == null ? HelixRenderPackage.InitPointGeometry()
: pointGeometry3D.Geometry as PointGeometry3D;
var startIdx = points.Positions.Count;

points.Positions.AddRange(p.Positions);
Expand All @@ -1694,11 +1688,12 @@ private void AggregateRenderPackages(IEnumerable<HelixRenderPackage> packages)
}

AddLabelPlace(baseId, p.Positions[0], rp);
pointGeometry3D.Geometry = points;
if (pointGeometry3D.Geometry == null)
{
pointGeometry3D.Geometry = points;
}
pointGeometry3D.Name = baseId;
QilongTang marked this conversation as resolved.
Show resolved Hide resolved

points.UpdateVertices();
points.UpdateColors();
}

var l = rp.Lines;
Expand All @@ -1719,10 +1714,10 @@ private void AggregateRenderPackages(IEnumerable<HelixRenderPackage> packages)
// edges of meshes. Draw them with a different thickness.
lineGeometry3D = CreateLineGeometryModel3D(rp, rp.MeshVertices.Any()?0.5:1.0);
Element3DDictionary.Add(id, lineGeometry3D);
OnRequestAddViewportItem(lineGeometry3D);
}

var lineSet = lineGeometry3D.Geometry as LineGeometry3D;
var lineSet = lineGeometry3D.Geometry == null ? HelixRenderPackage.InitLineGeometry()
: lineGeometry3D.Geometry as LineGeometry3D;
var startIdx = lineSet.Positions.Count;

lineSet.Positions.AddRange(l.Positions);
Expand All @@ -1742,11 +1737,13 @@ private void AggregateRenderPackages(IEnumerable<HelixRenderPackage> packages)
: Enumerable.Range(startIdx, startIdx + l.Positions.Count));

AddLabelPlace(baseId, lineSet.Positions[startIdx], rp);
lineGeometry3D.Geometry = lineSet;
if(lineGeometry3D.Geometry == null)
{
lineGeometry3D.Geometry = lineSet;
}

lineGeometry3D.Name = baseId;
QilongTang marked this conversation as resolved.
Show resolved Hide resolved

lineSet.UpdateVertices();
lineSet.UpdateColors();
}

var m = rp.Mesh;
Expand All @@ -1765,7 +1762,6 @@ private void AggregateRenderPackages(IEnumerable<HelixRenderPackage> packages)
{
meshGeometry3D = CreateDynamoGeometryModel3D(rp);
Element3DDictionary.Add(id, meshGeometry3D);
OnRequestAddViewportItem(meshGeometry3D);
}

var mesh = meshGeometry3D.Geometry == null ? HelixRenderPackage.InitMeshGeometry()
Expand Down Expand Up @@ -1803,10 +1799,6 @@ private void AggregateRenderPackages(IEnumerable<HelixRenderPackage> packages)
meshGeometry3D.Geometry = mesh;
meshGeometry3D.Name = baseId;

mesh.UpdateVertices();
mesh.UpdateColors();
mesh.UpdateTextureCoordinates();
mesh.UpdateTriangles();
}

}
Expand Down Expand Up @@ -1877,8 +1869,6 @@ private bool UpdateGeometryModelForSpecialRenderPackage(HelixRenderPackage rp, s
manipulator.Material = PhongMaterials.Blue;

Element3DDictionary[id] = manipulator;
OnRequestRemoveViewportItem(model);
OnRequestAddViewportItem(manipulator);
return true;
case RenderDescriptions.AxisLine:
var centerline = model as DynamoLineGeometryModel3D;
Expand All @@ -1889,8 +1879,6 @@ private bool UpdateGeometryModelForSpecialRenderPackage(HelixRenderPackage rp, s
}
centerline.Geometry = rp.Lines;
Element3DDictionary[id] = centerline;
OnRequestRemoveViewportItem(model);
OnRequestAddViewportItem(centerline);
return true;
case RenderDescriptions.ManipulatorPlane:
var plane = model as DynamoLineGeometryModel3D;
Expand All @@ -1901,8 +1889,6 @@ private bool UpdateGeometryModelForSpecialRenderPackage(HelixRenderPackage rp, s
}
plane.Geometry = rp.Lines;
Element3DDictionary[id] = plane;
OnRequestRemoveViewportItem(model);
OnRequestAddViewportItem(plane);
return true;
default:
return false;
Expand Down Expand Up @@ -1997,7 +1983,6 @@ private void CreateOrUpdateText(string baseId, Vector3 pt, IRenderPackage rp)
Geometry = HelixRenderPackage.InitText3D(),
};
Element3DDictionary.Add(textId, bbText);
OnRequestAddViewportItem(bbText);
}
var geom = bbText.Geometry as BillboardText3D;

Expand Down Expand Up @@ -2051,7 +2036,7 @@ private DynamoLineGeometryModel3D CreateLineGeometryModel3D(HelixRenderPackage r
{
var lineGeometry3D = new DynamoLineGeometryModel3D()
{
Geometry = HelixRenderPackage.InitLineGeometry(),
//Do not set Geometry here
Transform = new MatrixTransform3D(rp.Transform.ToMatrix3D()),
Color = Colors.White,
Thickness = thickness,
Expand All @@ -2065,7 +2050,7 @@ private DynamoPointGeometryModel3D CreatePointGeometryModel3D(HelixRenderPackage
{
var pointGeometry3D = new DynamoPointGeometryModel3D
{
Geometry = HelixRenderPackage.InitPointGeometry(),
//Do not set Geometry here
Transform = new MatrixTransform3D(rp.Transform.ToMatrix3D()),
Color = Colors.White,
Figure = PointFigure.Ellipse,
Expand Down
4 changes: 2 additions & 2 deletions src/DynamoCoreWpf/Views/Core/DynamoView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1715,10 +1715,10 @@

<!--Template for tab header in the extensions side bar-->
<DataTemplate x:Key="TabHeader" DataType="TabItem">
<DockPanel HorizontalAlignment="Stretch" MinWidth="{Binding Source={x:Static configuration:Configurations.ExtensionsSideBarTabMinWidth}}">
<DockPanel HorizontalAlignment="Stretch" Name ="TabPanel" MinWidth="{Binding Source={x:Static configuration:Configurations.ExtensionsSideBarTabMinWidth}}">
<TextBlock Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}}, Path=Header}" HorizontalAlignment="Stretch"/>
<!--Button to close a particular tab-->
<Button Name="CloseButton" Style="{StaticResource CloseButtonStyle}" DockPanel.Dock="Right" Click="CloseTab"
<Button Name="CloseButton" Style="{StaticResource CloseButtonStyle}" DockPanel.Dock="Right" Click="CloseExtensionTab"
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}}, Path=Name}">
<Image Width="14" Height="14" HorizontalAlignment="Right" VerticalAlignment="Center">
<Image.Style>
Expand Down
Loading