Skip to content

Commit

Permalink
fix(viewer-lib): Fixed the issue where v2 lines would not display pro…
Browse files Browse the repository at this point in the history
…perly when having both displayStyle and renderMaterial. Now displayStyle takes precedence
  • Loading branch information
AlexandruPopovici committed Jan 30, 2025
1 parent 0cd9487 commit 6e1d625
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 6 additions & 2 deletions packages/viewer-sandbox/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ const getStream = () => {
// prettier-ignore
// 'https://app.speckle.systems/streams/da9e320dad/commits/5388ef24b8?c=%5B-7.66134,10.82932,6.41935,-0.07739,-13.88552,1.8697,0,1%5D'
// Revit sample house (good for bim-like stuff with many display meshes)
// 'https://app.speckle.systems/streams/da9e320dad/commits/5388ef24b8'
'https://app.speckle.systems/streams/da9e320dad/commits/5388ef24b8'
// 'https://latest.speckle.systems/streams/c1faab5c62/commits/ab1a1ab2b6'
// 'https://app.speckle.systems/streams/da9e320dad/commits/5388ef24b8'
// 'https://latest.speckle.systems/streams/58b5648c4d/commits/60371ecb2d'
Expand Down Expand Up @@ -472,7 +472,11 @@ const getStream = () => {
// 'https://latest.speckle.systems/projects/db06488e1c/models/21f3930771'

// FAR OFF
'https://app.speckle.systems/projects/bdd828221e/models/eb99326dc3'
// 'https://app.speckle.systems/projects/bdd828221e/models/eb99326dc3'
// 'https://latest.speckle.systems/projects/5e9c38fae7/models/d44c54b6b7'

// v2 colored lines
// 'https://app.speckle.systems/projects/052b576a45/models/c756235fcc'
)
}

Expand Down
9 changes: 7 additions & 2 deletions packages/viewer/src/modules/materials/Materials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,13 @@ export default class Materials {
(renderView.geometryType === GeometryType.LINE ||
renderView.geometryType === GeometryType.POINT)

const displayStyleFirst = renderView.geometryType === GeometryType.LINE
if (!materialData) {
materialData =
renderView.renderData.renderMaterial || renderView.renderData.displayStyle
materialData = displayStyleFirst
? renderView.renderData.displayStyle || renderView.renderData.renderMaterial
: renderView.renderData.renderMaterial || renderView.renderData.displayStyle
}

/** DUI3 rules which apply only if the technical material exist (color proxies) in absence of a render material or display style from DUI2
* The technical material will contribute to the material hash
*/
Expand All @@ -292,6 +295,8 @@ export default class Materials {
: Materials.isDisplayStyle(materialData) &&
renderView.geometryType !== GeometryType.MESH
? Materials.displayStyleToString(materialData)
: Materials.isRendeMaterial(materialData)
? Materials.renderMaterialToString(materialData)
: ''
if ((materialData as MaterialOptions).stencilOutlines) {
mat += '/' + (materialData as MaterialOptions).stencilOutlines
Expand Down

0 comments on commit 6e1d625

Please sign in to comment.