Skip to content

Commit 65612e0

Browse files
mjkkirschnerDynamoEngOpssaintentropyaparajit-pratapQilongTang
authored
Mesh display using shaders (#10462)
* LibG Binaries Update (#10295) * "LibG/ASM224,7418555f" * "LibG/ASM224.4,918b3d73" * "LibG/ASM225,2b68d3dd" * "LibG/ASM226,2b308956" * Change mechanism to retreive the certificate from assembly (#10301) * DYN-2225 - Marshaling Performance optimization - Heap Cleanup (#10026) * fast path for zero size heap allocation * Cache mechanism for marshalling lookups * Do not allocate heap stack values for class properties for CLR objects * Test removing getter heap interaction for CLR object * Remove unused Heap Object set * make variables non-static * remove GetterFunctionPointer class Co-authored-by: aparajit-pratap <aparajit.pratap@autodesk.com> * DYN-2289: Fix crash with NodeToCode (#10305) * search for property by getter if not found * add test * Geometry Color Tests More (#10291) * Add geometry color check for Display_ByGeometryColor_HasColoredMesh Add geometry color check for Display_ByGeometryColor_HasColoredMesh * Test updates * Add Geometry Transparency Test * Update test name * update newly added test (#10313) * DYN-2286: fix for crash upon unresolved node undo (#10315) * fix for crash upon unresolved node undo * override Equals in PortModel * add recorded test * DYN-2328 Add test for geometry labeling (#10311) * DYN-2328 Add test for geometry lablling * DYN-2328 Add test for geometry labeling * Removing extra assignments * updating the test and the test dyn file. * Removing the extra variable that is not being used * First Github Action (#10131) This Github Action will greet Github users who submit a PR or issue first time to our repo * Removal of PR trigger for now (#10323) * Analytics Agreement Workflow Update (#10314) * Initial Commit to Update Analytics Agreement Workflow * update * Add unit test for deserializing analytics setting * Update instrumentation default agreement setting in unit test * Add more comments * Add missing resource string (#10329) * LibG Binaries Update (#10331) * "LibG/ASM224,7418555f" * "LibG/ASM224.4,918b3d73" * "LibG/ASM225,2b68d3dd" * "LibG/ASM226,5c8f1fdd" * Fix the library view display issues introduced by MS WebBrowser (#10316) * Disable the context menu on the library viewer. * Zoom the libarary view to adapt the current DPI scale. * Disable the horizontal scroll bar on the bottom of the library view. * Disable the library view is zoomed by keyboard or mouse wheel. * Zoom the library bar to adapt the current DPI scale. * Hide the extra search text bar close button. * [DYN-2382] LibraryViewExtensionMSWebBrowser does not scale correctly when using display scaling (#10335) * Disable the context menu on the library viewer. * Zoom the libarary view to adapt the current DPI scale. * Disable the horizontal scroll bar on the bottom of the library view. * Disable the library view is zoomed by keyboard or mouse wheel. * Zoom the library bar to adapt the current DPI scale. * Hide the extra search text bar close button. * Unsubscribing the event handler in dispose method * working color change on selection for points. * Skip GA Client Tear Down Process if NOT Necessary (#10340) * Skip Analytics Client Tear down if it is not needed * Add unit test covering analytics tear down * Touch test naming * [Analytics] Update Tracking Conditions (#10345) * Update Tracking Conditions * Add same check to ReportingUsage * Add properties comments * PR comment (#10347) * Code improvements: (#10348) 1. Unsubscribe DpiChanged event handler in the browser Dispose method. 2. Move the overflow-x style setting from script to html to avoid to set it when the script method is called every time. 3. Add necessary comments. * lots of cleanup work to do but this works isolate correctly sets all geo to low alpha, and the selected geo sets back to whatever other state it was in without isolate. * start adding morecolor tests * fix test * add more tests add cleanup to color cache * fix watch3d background color converter fix watch3d background color test fix watch3d image export function * need to move branches - saving work * give up on image comparison tests, will file that as followup, resize function in helix does not work. * break out some util methods need to rerun tests * review comments all tests pass * review comment * add show line numbers when watermarkLabel is collapsed (#10362) * Visual Identifier on Optional Inputs (#10361) * change port text to italic if using default input * Update Ports.xaml * Update README.md (#10387) * Update README.md * Update README.md * Update README.md * Update DynamoVisualProgramming.Core.nuspec * Update DynamoVisualProgramming.Core.nuspec * GA client not launching when terms not agreed (#10407) * GA client not launching when terms not agreed * Comments * Patch 283 (#10421) * Add WinVerityTrust wrapper * Utilzie new WinTrustWrapper method for cert verification * Add negative test * Add Package with faked certificate * Create sub namespace for WinVerityInteropp * Update the WinTrustInterop * Upate method call name * Add specific exceptions to the CertificateVerfication class * formating * fix summary * Cover Test for Configuration Folder (#10444) * Cover Test for Configuration Folder * Update DynamoCoreTests.csproj * Added a couple of asserts for the properties. (#10437) * Add Test for Properties and removed getter and setter from WorkspaceDependencyViewExtension.DependencyView property. * Update WorkspaceDependencyViewExtension.cs * this is working to link 2 simple shaders - they are just for testing though. (vertex shaders with lighting) embed testing shaders add technique that uses our 2 shaders add core and node classes for dynamo mesh which will set data on shader based on attached properties. * Fix for crash while drawing Point manipulator (gizmo) when LibG fails to load (#10148) * fix for crash in DM when LibG fails to load * return from recursive loop once we find the first non-null point * cache enabled flag for manipulator * more fixes * add documentation * add documentation * update shader names add handle mesh method to attached properties replacing all the material setting add code for setting bit flags and setting data on struct that actually makes it to shader add helix shader structs and functions that we need to compile our shaders add readme * fix broken tests dude to bad merge conflict fix * remove commented out vertex shader code * fix bug in shader fix comment and some todos * remove tested transofmrable interface * update comments * review comments * review comments2 Co-authored-by: DynamoEngOps <dynamo.engops@autodesk.com> Co-authored-by: Craig Long <craig.alan.long@gmail.com> Co-authored-by: aparajit-pratap <aparajit.pratap@autodesk.com> Co-authored-by: Aaron (Qilong) <173288704@qq.com> Co-authored-by: reddyashish <43763136+reddyashish@users.noreply.github.com> Co-authored-by: StarLee <42235642+CoolStarLee@users.noreply.github.com> Co-authored-by: Sylvester Knudsen <sylvesterknudsen@gmail.com>
1 parent 6d89d72 commit 65612e0

20 files changed

+1597
-139
lines changed

src/DynamoCoreWpf/DynamoCoreWpf.csproj

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@
162162
<Compile Include="Extensions\ViewStartupParams.cs" />
163163
<Compile Include="Interfaces\ILibraryViewCustomization.cs" />
164164
<Compile Include="Interfaces\LayoutSpecification.cs" />
165+
<Compile Include="Properties\Resources.Designer.cs">
166+
<AutoGen>True</AutoGen>
167+
<DesignTime>True</DesignTime>
168+
<DependentUpon>Resources.resx</DependentUpon>
169+
</Compile>
165170
<Compile Include="Utilities\CompactBubbleHandler.cs" />
166171
<Compile Include="Interfaces\IShellCom.cs" />
167172
<Compile Include="Rendering\HelixRenderPackage.cs" />
@@ -175,11 +180,6 @@
175180
<Compile Include="UI\ClassObjectTemplateSelector.cs" />
176181
<Compile Include="UI\DraggedAdorner.cs" />
177182
<Compile Include="UI\HeaderTemplateSelector.cs" />
178-
<Compile Include="Properties\Resources.Designer.cs">
179-
<AutoGen>True</AutoGen>
180-
<DesignTime>True</DesignTime>
181-
<DependentUpon>Resources.resx</DependentUpon>
182-
</Compile>
183183
<Compile Include="Properties\Resources.en-US.Designer.cs">
184184
<AutoGen>True</AutoGen>
185185
<DesignTime>True</DesignTime>
@@ -462,8 +462,8 @@
462462
<ItemGroup>
463463
<EmbeddedResource Include="Properties\Resources.resx">
464464
<Generator>PublicResXFileCodeGenerator</Generator>
465-
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
466465
<SubType>Designer</SubType>
466+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
467467
</EmbeddedResource>
468468
<EmbeddedResource Include="Properties\Resources.en-US.resx">
469469
<Generator>PublicResXFileCodeGenerator</Generator>
@@ -505,6 +505,8 @@
505505
<None Include="UI\Fonts\OpenSans-SemiboldItalic.ttf">
506506
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
507507
</None>
508+
<None Include="ViewModels\Watch3D\compiledShaders\psDynamoMesh" />
509+
<None Include="ViewModels\Watch3D\compiledShaders\vsDynamoMesh" />
508510
<Resource Include="UI\Images\cursors.psd" />
509511
<Resource Include="UI\Images\cursors1.psd" />
510512
</ItemGroup>
@@ -1284,7 +1286,9 @@
12841286
<Resource Include="UI\Images\icon-whats-new-small.png" />
12851287
<Resource Include="UI\Images\icon-dictionary-small.png" />
12861288
</ItemGroup>
1287-
<ItemGroup />
1289+
<ItemGroup>
1290+
<Folder Include="ViewModels\Watch3D\shaderSource\" />
1291+
</ItemGroup>
12881292
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
12891293
<Target Name="AfterBuild">
12901294
<MakeDir Directories="$(OutputPath)\viewExtensions\" />

src/DynamoCoreWpf/Properties/Resources.Designer.cs

Lines changed: 21 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/DynamoCoreWpf/Properties/Resources.en-US.resx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@
117117
<resheader name="writer">
118118
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119119
</resheader>
120-
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
121120
<data name="AboutWindowCannotGetVersion" xml:space="preserve">
122121
<value>Could not get version.</value>
123122
<comment>To indicate not abe to get Dynamo version</comment>
@@ -2221,4 +2220,11 @@ Uninstall the following packages: {0}?</value>
22212220
<data name="CrashPromptGithubNewIssueTitle" xml:space="preserve">
22222221
<value>Crash report from Dynamo {0}</value>
22232222
</data>
2223+
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
2224+
<data name="psDynamoMesh" type="System.Resources.ResXFileRef, System.Windows.Forms">
2225+
<value>..\ViewModels\Watch3D\compiledShaders\psDynamoMesh;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
2226+
</data>
2227+
<data name="vsDynamoMesh" type="System.Resources.ResXFileRef, System.Windows.Forms">
2228+
<value>..\ViewModels\Watch3D\compiledShaders\vsDynamoMesh;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
2229+
</data>
22242230
</root>

src/DynamoCoreWpf/Properties/Resources.resx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1975,7 +1975,6 @@ Do you want to install the latest Dynamo update?</value>
19751975
<data name="FolderNotWritableError" xml:space="preserve">
19761976
<value>You do not have write permission to {0}.</value>
19771977
</data>
1978-
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
19791978
<data name="ActionMember" xml:space="preserve">
19801979
<value>Action</value>
19811980
</data>
@@ -2221,4 +2220,11 @@ Uninstall the following packages: {0}?</value>
22212220
<data name="DynamoViewSettingMenuShowDataReportingDialogTooltip" xml:space="preserve">
22222221
<value>Display the dialog for user to pick agreement on data collecting.</value>
22232222
</data>
2223+
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
2224+
<data name="psDynamoMesh" type="System.Resources.ResXFileRef, System.Windows.Forms">
2225+
<value>..\ViewModels\Watch3D\compiledShaders\psDynamoMesh;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
2226+
</data>
2227+
<data name="vsDynamoMesh" type="System.Resources.ResXFileRef, System.Windows.Forms">
2228+
<value>..\ViewModels\Watch3D\compiledShaders\vsDynamoMesh;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
2229+
</data>
22242230
</root>

src/DynamoCoreWpf/ViewModels/Watch3D/AttachedProperties.cs

Lines changed: 33 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -16,41 +16,16 @@ public static class AttachedProperties
1616

1717
// handles determining color of elementGeometry3Ds when any property is set false
1818
// as the state of other properties must be checked to determine the correct color / material.
19-
private static void OnPropertySetFalse(DependencyObject obj)
19+
private static void OnPointOrLinePropertySetFalse(DependencyObject obj)
2020
{
2121
if (!(obj is GeometryModel3D && obj.GetType() != typeof(BillboardTextModel3D)))
2222
{
2323
return;
2424
}
25-
//mesh case
26-
var geom = (GeometryModel3D)obj;
27-
var meshGeom = geom as DynamoGeometryModel3D;
28-
if (meshGeom != null)
29-
{
30-
31-
// if selection is not enabled after this property was set false
32-
// then determine transparencey. IE selection state should always override
33-
// the other properties.
34-
if (!GetShowSelected(meshGeom))
35-
{
36-
if (GetIsolationMode(meshGeom))
37-
{
38-
meshGeom.Material = HelixWatch3DViewModel.IsolatedMaterial;
39-
}
40-
else if (GetIsFrozen(meshGeom))
41-
{
42-
meshGeom.Material = HelixWatch3DViewModel.FrozenMaterial;
43-
}
44-
else
45-
{
46-
//TODO handle vertex coloring in all these cases
47-
meshGeom.Material = HelixWatch3DViewModel.WhiteMaterial;
48-
}
49-
}
50-
51-
}
25+
5226
//point or line case
53-
else if (geom is DynamoPointGeometryModel3D || geom is DynamoLineGeometryModel3D)
27+
GeometryModel3D geom = obj as GeometryModel3D;
28+
if (geom is DynamoPointGeometryModel3D || geom is DynamoLineGeometryModel3D)
5429
{
5530
//if selection is not enabled determine if we should reset colors or set transparent colors
5631
if (!GetShowSelected(geom))
@@ -111,34 +86,10 @@ private static void ShowSelectedPropertyChanged(DependencyObject obj, Dependency
11186
var meshGeom = geom as DynamoGeometryModel3D;
11287
if (meshGeom != null)
11388
{
114-
if ((bool)args.NewValue)
115-
{
116-
//if the item is both selected and isolation mode is on, then we should color the item as normal OR as frozen.
117-
if (GetIsolationMode(meshGeom))
118-
{
119-
//selected, isolated, and frozen.
120-
if (GetIsFrozen(meshGeom))
121-
{
122-
meshGeom.Material = HelixWatch3DViewModel.FrozenMaterial;
123-
}
124-
//selected and isolated so color normal material
125-
//TODO handle vertex colors later.
126-
else
127-
{
128-
meshGeom.Material = HelixWatch3DViewModel.WhiteMaterial;
129-
}
130-
}
131-
//only selected.
132-
else
133-
{
134-
meshGeom.Material = HelixWatch3DViewModel.SelectedMaterial;
135-
}
136-
}
137-
else
138-
{
139-
OnPropertySetFalse(meshGeom);
140-
}
89+
HandleMeshPropertyChange(meshGeom, args);
14190
}
91+
92+
//implementation for lines and points
14293
else if (geom is DynamoPointGeometryModel3D || geom is DynamoLineGeometryModel3D)
14394
{
14495

@@ -168,7 +119,7 @@ private static void ShowSelectedPropertyChanged(DependencyObject obj, Dependency
168119
}
169120
else
170121
{
171-
OnPropertySetFalse(geom);
122+
OnPointOrLinePropertySetFalse(geom);
172123
}
173124
}
174125
}
@@ -245,17 +196,11 @@ private static void IsFrozenPropertyChanged(DependencyObject obj, DependencyProp
245196
{
246197
return;
247198
}
248-
var meshGeom3d = geom as DynamoGeometryModel3D;
249-
if (meshGeom3d != null)
199+
var meshGeom = geom as DynamoGeometryModel3D;
200+
if (meshGeom != null)
250201
{
251-
if ((bool)e.NewValue)
252-
{
253-
meshGeom3d.Material = HelixWatch3DViewModel.FrozenMaterial;
254-
}
255-
else
256-
{
257-
OnPropertySetFalse(meshGeom3d);
258-
}
202+
203+
HandleMeshPropertyChange(meshGeom, e);
259204
}
260205
else if (geom is DynamoPointGeometryModel3D || geom is DynamoLineGeometryModel3D)
261206
{
@@ -265,7 +210,7 @@ private static void IsFrozenPropertyChanged(DependencyObject obj, DependencyProp
265210
}
266211
else
267212
{
268-
OnPropertySetFalse(geom);
213+
OnPointOrLinePropertySetFalse(geom);
269214
}
270215
}
271216
}
@@ -302,19 +247,13 @@ private static void IsolationModePropertyChanged(DependencyObject obj, Dependenc
302247
return;
303248
}
304249
var geom = (GeometryModel3D)obj;
305-
var meshGeom3d = geom as DynamoGeometryModel3D;
306-
if (meshGeom3d != null)
250+
var meshGeom = geom as DynamoGeometryModel3D;
251+
if (meshGeom != null)
307252
{
308-
if ((bool)e.NewValue)
309-
{
310-
meshGeom3d.Material = HelixWatch3DViewModel.IsolatedMaterial;
311-
}
312-
else
313-
{
314-
OnPropertySetFalse(meshGeom3d);
315-
}
316253

317-
meshGeom3d.RequiresPerVertexColoration = true;
254+
HandleMeshPropertyChange(meshGeom, e);
255+
meshGeom.RequiresPerVertexColoration = true;
256+
318257
}
319258
else if (geom is DynamoPointGeometryModel3D || geom is DynamoLineGeometryModel3D)
320259
{
@@ -324,7 +263,7 @@ private static void IsolationModePropertyChanged(DependencyObject obj, Dependenc
324263
}
325264
else
326265
{
327-
OnPropertySetFalse(geom);
266+
OnPointOrLinePropertySetFalse(geom);
328267
}
329268
}
330269
}
@@ -381,6 +320,20 @@ public static bool IsSpecialRenderPackage(DependencyObject element)
381320
//#endregion
382321

383322
#region utils
323+
324+
/// <summary>
325+
/// Sets the property value on the DynamoMeshCore - this makes its way down to our shader and invalidates the render.
326+
/// </summary>
327+
/// <param name="meshGeom"></param>
328+
/// <param name="args"></param>
329+
private static void HandleMeshPropertyChange(DynamoGeometryModel3D meshGeom, DependencyPropertyChangedEventArgs args)
330+
{
331+
var meshCore = meshGeom?.SceneNode?.RenderCore as DynamoGeometryMeshCore;
332+
if (meshCore != null)
333+
{
334+
meshCore.SetPropertyData(args);
335+
}
336+
}
384337

385338
/// <summary>
386339
/// Sets all colors on Geometry to a single color.

0 commit comments

Comments
 (0)