Skip to content

Conversation

didimitrie
Copy link
Member

@didimitrie didimitrie commented Aug 14, 2024

CNX-186: Proper material support for receiving in Rhino, Sketchup and co.

the tl;dr:

Revit generates from one object multiple display values, all with their own render materials. We now correctly send render material proxies out of revit with this information, and correctly view/assign them in rhino, sketchp and acad (arcgis is a todo that i will need to delegate).

To do so, there are several changes:

On send, in revit:

  • each display value mesh from revit gets its own auto generated application id.
  • the render material proxies are generated by the revit's MeshByMaterialDictionaryToSpeckle converter
  • the revit converter context stack now keeps a singleton cache of these render material proxies that persists across send operations. note it needs to have this scope as caching at the connector level bypasses the converter.

On receive:

  • the fallback converter's generic object return can now mean two things:
    • 1-1 scenario: a single object
    • 1-many scenario: an enumerable of (originalDisplayValueBase, hostAppDisplayValueObject)
  • this is required to enable correct material mapping between display values with multiple materials
  • I've converged both rhino and acad on a more opionionated and clear path of BakeObject and BakeObjectAsGroups.

Related changes:

  • The display value extractor class now stops caring about transforms
  • Removed an unused dependency (conversion cache ported from 2.0)

This PR also includes some other unrelated fly by fixes:

NOTE: Do not merge without patching ArcGIS, as it will break due to the fallback converter's new behaviour.

Copy link

codecov bot commented Aug 14, 2024

Codecov Report

Attention: Patch coverage is 0% with 52 lines in your changes missing coverage. Please review.

Project coverage is 8.64%. Comparing base (5c3249c) to head (b76636c).
Report is 1 commits behind head on dev.

Files Patch % Lines
.../Raw/Geometry/MeshByMaterialDictionaryToSpeckle.cs 0.00% 21 Missing ⚠️
.../Helpers/RevitRenderMaterialProxyCacheSingleton.cs 0.00% 15 Missing ⚠️
...rters.RevitShared/Helpers/DisplayValueExtractor.cs 0.00% 8 Missing ⚠️
...RevitShared/Helpers/RevitConversionContextStack.cs 0.00% 3 Missing ⚠️
...verters.RevitShared/RevitRootToSpeckleConverter.cs 0.00% 3 Missing ⚠️
...hared/ToSpeckle/Raw/MaterialConversionToSpeckle.cs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             dev    #149      +/-   ##
========================================
- Coverage   8.64%   8.64%   -0.01%     
========================================
  Files        236     236              
  Lines       4489    4490       +1     
  Branches     528     526       -2     
========================================
  Hits         388     388              
- Misses      4084    4085       +1     
  Partials      17      17              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@didimitrie didimitrie marked this pull request as ready for review August 17, 2024 13:23
@didimitrie didimitrie merged commit dbc359f into dev Aug 19, 2024
5 checks passed
@didimitrie didimitrie deleted the dim/revit-materials branch August 19, 2024 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants