Skip to content

Commit 4daf1c7

Browse files
authored
Fix color in USDZ export (#4690)
* update hotspot docs * fix setBaseColorFactor bug
1 parent 6e7fc85 commit 4daf1c7

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

packages/model-viewer/src/features/scene-graph/pbr-metallic-roughness.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ export class PBRMetallicRoughness extends ThreeDOMElement implements
9090
}
9191
for (const material of this[$threeMaterials]) {
9292
material.color.set(color);
93-
if (rgba instanceof Array) {
94-
material.opacity = (rgba)[3];
93+
if (rgba instanceof Array && rgba.length > 3) {
94+
material.opacity = rgba[3];
9595
} else {
9696
rgba = [0, 0, 0, material.opacity];
9797
color.toArray(rgba);

packages/modelviewer.dev/data/docs.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -797,9 +797,9 @@
797797
],
798798
"Methods": [
799799
{
800-
"name": "updateHotspot({name, position, normal})",
800+
"name": "updateHotspot({name, position?, normal?, surface?})",
801801
"htmlName": "updateHotspot",
802-
"description": "Updates the position and/or normal of the hotspot associated with <span class='attribute'>slot=\"name\"</span>. The position and normal are given in the same string format as the hotspot attributes <span class='attribute'>data-position</span> and <span class='attribute'>data-normal</span>, which are also in the same format as the <span class='attribute'>camera-target</span> attribute."
802+
"description": "Updates the position, norma, and/or surface of the hotspot associated with <span class='attribute'>slot=\"name\"</span>. The position, normal, and surface are given in the same string format as the hotspot attributes <span class='attribute'>data-position</span>, <span class='attribute'>data-normal</span>, and <span class='attribute'>data-surface</span> from the slot <a href=\"#annotations-slots\">definition</a>."
803803
},
804804
{
805805
"name": "queryHotspot(name)",
@@ -830,7 +830,7 @@
830830
{
831831
"name": "hotspot-*",
832832
"htmlName": "hotspot",
833-
"description": "Any child element under <span class=\"attribute\">&lt;model-viewer&gt;</span> with a slot name starting with \"hotspot\" will be aligned with the 3D model using its <span class='attribute'>data-position</span> and <span class='attribute'>data-normal</span> attributes in model coordinates. Alternately, the <span class='attribute'>data-surface</span> attribute can be used to instead specify the glTF mesh, primitive, three vertex indices and three barycentric coordinates to specify a surface point that will animate along with the mesh. It is recommended to use the <a href=\"./#entrydocs-annotations-methods-surfaceFromPoint\">surfaceFromPoint</a> method to generate this string interactively. See the <a href=\"../examples/annotations/#animatedHotspots\">annotations example</a> for details."
833+
"description": "Any child element under <span class=\"attribute\">&lt;model-viewer&gt;</span> with a slot name starting with \"hotspot\" will be aligned with the 3D model using its <span class='attribute'>data-position</span> and <span class='attribute'>data-normal</span> attributes in model coordinates, in the same format as <span class='attribute'>camera-target</span>. Alternately, the <span class='attribute'>data-surface</span> attribute can be used to instead specify the glTF mesh, primitive, three vertex indices and three barycentric coordinates to specify a surface point that will animate along with the mesh. It is recommended to use the <a href=\"./#entrydocs-annotations-methods-surfaceFromPoint\">surfaceFromPoint</a> method to generate this string interactively. See the <a href=\"../examples/annotations/#animatedHotspots\">annotations example</a> for details."
834834
}
835835
]
836836
},
@@ -1147,4 +1147,4 @@
11471147
}
11481148
]
11491149
}
1150-
]
1150+
]

0 commit comments

Comments
 (0)