Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
fix: revert overwriting color in cad model
Brad Barbin8530f8902ee2
diff --git a/packages/react/src/ModelViewer.tsx b/packages/react/src/ModelViewer.tsxindex f202dac0c7..06a7aa4f32 100644--- a/packages/react/src/ModelViewer.tsx+++ b/packages/react/src/ModelViewer.tsx@@ -27,6 +27,9 @@ export const supportedModelTypes = ["stp",];+const darkColor = "#9797a5";+const lightColor = "#8c8a8a";+export function ModelViewer({file,url,@@ -61,18 +64,13 @@ export function ModelViewer({45.0),backgroundColor: isDarkMode- ? new OV.RGBAColor(21, 22, 25, 0)+ ? new OV.RGBAColor(20, 22, 25, 0): new OV.RGBAColor(255, 255, 255, 0),defaultColor: new OV.RGBColor(0, 125, 125),onModelLoaded: (model) => {if (viewerRef.current) {const viewer3D = viewerRef.current.GetViewer();- // updateColor(- // color ??- // getComputedStyle(document.documentElement)- // .getPropertyValue("--card")- // .trim()- // );+ updateColor(color ?? (isDarkMode ? darkColor : lightColor));viewer3D.Resize(parentDiv.current?.clientWidth,@@ -196,26 +194,26 @@ export function ModelViewer({viewer.LoadModelFromUrlList([url]);}- // function updateColor(color: string) {- // if (!viewerRef.current) return;+ function updateColor(color: string) {+ if (!viewerRef.current) return;- // const viewer3D = viewerRef.current.GetViewer();- // viewer3D.mainModel.EnumerateMeshes((mesh) => {- // if (Array.isArray(mesh.material)) {- // mesh.material.forEach((material) => {- // if (material) {- // (material as THREE.MeshStandardMaterial).color.set(color);- // }- // });- // }- // });- // }+ const viewer3D = viewerRef.current.GetViewer();+ viewer3D.mainModel.EnumerateMeshes((mesh) => {+ if (Array.isArray(mesh.material)) {+ mesh.material.forEach((material) => {+ if (material) {+ (material as THREE.MeshStandardMaterial).color.set(color);+ }+ });+ }+ });+ }- // useEffect(() => {- // if (color) {- // updateColor(color);- // }- // }, [color]);+ useEffect(() => {+ if (color) {+ updateColor(color);+ }+ }, [color]);useEffect(() => {if (!file || !viewerRef.current) return;@@ -239,13 +237,9 @@ export function ModelViewer({: new OV.RGBAColor(255, 255, 255, 255));- // if (!color) {- // updateColor(- // getComputedStyle(document.documentElement)- // .getPropertyValue("--card")- // .trim()- // );- // }+ if (!color) {+ updateColor(isDarkMode ? darkColor : lightColor);+ }}}, [isDarkMode, color]);