Skip to content

Commit

Permalink
fix isolate selected regression, and longstanding issue with selectio…
Browse files Browse the repository at this point in the history
…n highlight. (#11037)

* this works, but ideally it would be done in the shader to avoid this sorting

* update shader to make selected geometry more prominent than vertColored geo
new tests

* move camera closer
regen images
disable update image define
remove unneccesary sorting

* fix copy paste error
  • Loading branch information
mjkkirschner authored Aug 24, 2020
1 parent 1a1addf commit 89818c3
Show file tree
Hide file tree
Showing 8 changed files with 198 additions and 7 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,23 @@ PSInput main(VSInput input)
uint flags = int(vParams.x);
bool isSelected = flags & 2;
bool requiresPerVertexColoration = flags & 32;

float4 inputp;
if (isSelected || requiresPerVertexColoration)
float3 nudge = normalize(input.n) * 0.0001;

inputp = input.p;
if (requiresPerVertexColoration)
{
// Nudge the vertex out slightly along its normal.
float3 nudge = normalize(input.n) * 0.0001;
inputp = float4(input.p.x + nudge.x, input.p.y + nudge.y, input.p.z + nudge.z, input.p.w);
// Nudge the vertex out slightly along its normal a tiny bit.
inputp = float4(inputp.x + nudge.x, inputp.y + nudge.y, inputp.z + nudge.z, inputp.w);
}
else
if (isSelected)
{
inputp = input.p;
// Nudge the vertex out slightly along its normal a bit more.
nudge = nudge * 100;
inputp = float4(inputp.x + nudge.x, inputp.y + nudge.y, inputp.z + nudge.z, inputp.w);
}


//set position into world space
output.p = mul(inputp, mWorld);
Expand Down
43 changes: 43 additions & 0 deletions src/VisualizationTests/HelixImageComparisonTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,49 @@ public void VertColorFrozenMeshGeometryRender()
node3.IsFrozen = true;
RenderCurrentViewAndCompare(MethodBase.GetCurrentMethod().Name);
}
[Test]
public void SelectedSolidsOverlapping1()
{
OpenVisualizationTest(@"imageComparison\twooverlappedspheres.dyn");
RunCurrentModel();
var node1 = ViewModel.CurrentSpace.Nodes.Where(x => x.Name.Contains("sphere1")).FirstOrDefault();
DynamoSelection.Instance.ClearSelection();
DynamoSelection.Instance.Selection.Add(node1);
RenderCurrentViewAndCompare(MethodBase.GetCurrentMethod().Name);
}
[Test]
public void SelectedSolidsOverlapping2()
{
OpenVisualizationTest(@"imageComparison\twooverlappedspheres.dyn");
RunCurrentModel();
var node1 = ViewModel.CurrentSpace.Nodes.Where(x => x.Name.Contains("sphere2")).FirstOrDefault();
DynamoSelection.Instance.ClearSelection();
DynamoSelection.Instance.Selection.Add(node1);
RenderCurrentViewAndCompare(MethodBase.GetCurrentMethod().Name);
}
[Test]
public void SelectedSolidsOverlappingIsolated1()
{
OpenVisualizationTest(@"imageComparison\twooverlappedspheres.dyn");
View.BackgroundPreview.ViewModel.IsolationMode = true;
RunCurrentModel();
var node1 = ViewModel.CurrentSpace.Nodes.Where(x => x.Name.Contains("sphere1")).FirstOrDefault();
DynamoSelection.Instance.ClearSelection();
DynamoSelection.Instance.Selection.Add(node1);
RenderCurrentViewAndCompare(MethodBase.GetCurrentMethod().Name);
}
[Test]
public void SelectedSolidsOverlappingIsolated2()
{
OpenVisualizationTest(@"imageComparison\twooverlappedspheres.dyn");
View.BackgroundPreview.ViewModel.IsolationMode = true;
RunCurrentModel();
var node1 = ViewModel.CurrentSpace.Nodes.Where(x => x.Name.Contains("sphere2")).FirstOrDefault();
DynamoSelection.Instance.ClearSelection();
DynamoSelection.Instance.Selection.Add(node1);
RenderCurrentViewAndCompare(MethodBase.GetCurrentMethod().Name);
}

#endregion

#region pointsAndLines
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
143 changes: 143 additions & 0 deletions test/core/visualization/imageComparison/twooverlappedspheres.dyn
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
{
"Uuid": "7a753dd2-d694-4222-8815-22bca6046723",
"IsCustomNode": false,
"Description": null,
"Name": "twooverlappedspheres",
"ElementResolver": {
"ResolutionMap": {}
},
"Inputs": [],
"Outputs": [],
"Nodes": [
{
"ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore",
"NodeType": "FunctionNode",
"FunctionSignature": "Autodesk.DesignScript.Geometry.Sphere.ByCenterPointRadius@Autodesk.DesignScript.Geometry.Point,double",
"Id": "0a748143be4a4fd1b0074a26070964b8",
"Inputs": [
{
"Id": "37fb4f115c604a118a469317a705eb7b",
"Name": "centerPoint",
"Description": "Point\nDefault value : Autodesk.DesignScript.Geometry.Point.ByCoordinates(0, 0, 0)",
"UsingDefaultValue": true,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
},
{
"Id": "38130f43b9564aa9a98216a3495f14e3",
"Name": "radius",
"Description": "double\nDefault value : 1",
"UsingDefaultValue": true,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Outputs": [
{
"Id": "2581dd0237c94e09a3c5417b0b6d2d25",
"Name": "Sphere",
"Description": "Sphere",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Replication": "Auto",
"Description": "Create a Solid Sphere cetered at the input Point, with given radius.\n\nSphere.ByCenterPointRadius (centerPoint: Point = Autodesk.DesignScript.Geometry.Point.ByCoordinates(0, 0, 0), radius: double = 1): Sphere"
},
{
"ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore",
"NodeType": "FunctionNode",
"FunctionSignature": "Autodesk.DesignScript.Geometry.Sphere.ByCenterPointRadius@Autodesk.DesignScript.Geometry.Point,double",
"Id": "27c5050395aa479eb855bc5f83ba742e",
"Inputs": [
{
"Id": "f6390ad30df54e58b6a11c07cf1579f0",
"Name": "centerPoint",
"Description": "Point\nDefault value : Autodesk.DesignScript.Geometry.Point.ByCoordinates(0, 0, 0)",
"UsingDefaultValue": true,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
},
{
"Id": "c1350014b314450f83ff4c11dd47da10",
"Name": "radius",
"Description": "double\nDefault value : 1",
"UsingDefaultValue": true,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Outputs": [
{
"Id": "aa086c5e28f6481c9a52743a0c887601",
"Name": "Sphere",
"Description": "Sphere",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Replication": "Auto",
"Description": "Create a Solid Sphere cetered at the input Point, with given radius.\n\nSphere.ByCenterPointRadius (centerPoint: Point = Autodesk.DesignScript.Geometry.Point.ByCoordinates(0, 0, 0), radius: double = 1): Sphere"
}
],
"Connectors": [],
"Dependencies": [],
"NodeLibraryDependencies": [],
"Bindings": [],
"View": {
"Dynamo": {
"ScaleFactor": 1.0,
"HasRunWithoutCrash": true,
"IsVisibleInDynamoLibrary": true,
"Version": "2.9.0.2336",
"RunType": "Automatic",
"RunPeriod": "1000"
},
"Camera": {
"Name": "Background Preview",
"EyeX": -1.2032631635665894,
"EyeY": 1.733094334602356,
"EyeZ": 4.1445307731628418,
"LookX": 1.2032631635665894,
"LookY": -1.733094334602356,
"LookZ": -4.1445307731628418,
"UpX": 0.046017393469810486,
"UpY": 0.98628562688827515,
"UpZ": -0.15850274264812469
},
"NodeViews": [
{
"ShowGeometry": true,
"Name": "sphere1",
"Id": "0a748143be4a4fd1b0074a26070964b8",
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 78.0,
"Y": 215.0
},
{
"ShowGeometry": true,
"Name": "sphere2",
"Id": "27c5050395aa479eb855bc5f83ba742e",
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 321.0,
"Y": 220.0
}
],
"Annotations": [],
"X": -28.534948309330503,
"Y": -17.32101017353429,
"Zoom": 1.1047642563030275
}
}

0 comments on commit 89818c3

Please sign in to comment.