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

Reorder Helix elements for Isolate Geometry Mode to display isolated geometry #11163

Merged
merged 3 commits into from
Oct 6, 2020
Merged
Changes from 1 commit
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
22 changes: 22 additions & 0 deletions src/DynamoCoreWpf/ViewModels/Watch3D/HelixWatch3DViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,28 @@ protected HelixWatch3DViewModel(NodeModel model, Watch3DViewModelStartupParams p

SetupScene();
InitializeHelix();
DynamoSelection.Instance.Selection.CollectionChanged += OnSelectionCollectionChanged;
aparajit-pratap marked this conversation as resolved.
Show resolved Hide resolved
}

private void OnSelectionCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (Element3DDictionary == null)
{
sceneItems = new ObservableElement3DCollection();
return;
}

var values = Element3DDictionary.Values.ToList();
if (Camera != null)
{
values.Sort(new Element3DComparer(Camera.Position));
Copy link
Member

Choose a reason for hiding this comment

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

Why does this need to happen every time the selection changes? Couldn't it be done once when the isolation mode is enabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried that. Doesn't work for some reason.

}

if (sceneItems == null)
sceneItems = new ObservableElement3DCollection();

sceneItems.Clear();
sceneItems.AddRange(values);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This logic has been lifted off of UpdateSceneItems, however, UpdateSceneItems seems to be doing some extra work like cycling through the list of elements and updating vertices, triangles, and colors, which I'm not sure if that is necessary in this case. Skipping that saves some time.

}

public void SerializeCamera(XmlElement camerasElement)
Expand Down