diff --git a/backend/server.js b/backend/server.js index d309ab8..8c2aa87 100644 --- a/backend/server.js +++ b/backend/server.js @@ -11,7 +11,8 @@ const { db, run, get, all } = require('./database'); const app = express(); app.use(cors()); -app.use(express.json({ limit: '100mb' })); +app.use(express.json({ limit: '500mb' })); +app.use(express.urlencoded({ limit: '500mb', extended: true })); const JWT_SECRET = 'viz-3d-local-secret-key-1234'; diff --git a/nginx.conf b/nginx.conf index 0e6efb3..2441ddc 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,6 +1,7 @@ server { listen 80; server_name localhost; + client_max_body_size 500M; # Serve static assets location / { diff --git a/src/pages/Editor.tsx b/src/pages/Editor.tsx index cb08499..1201503 100644 --- a/src/pages/Editor.tsx +++ b/src/pages/Editor.tsx @@ -1371,6 +1371,13 @@ export default function Editor() { const material = Array.isArray(child.material) ? child.material[0] : child.material; const mProps = { ...globalMaterialProps }; + const extractTextureUrl = (texture: any) => { + if (!texture) return undefined; + if (texture.image && typeof texture.image.src === 'string') return texture.image.src; + if (texture.source && texture.source.data && typeof texture.source.data.src === 'string') return texture.source.data.src; + return undefined; + }; + if (material) { if (material.color) mProps.color = `#${material.color.getHexString()}`; if (material.roughness !== undefined) mProps.roughness = material.roughness; @@ -1385,6 +1392,20 @@ export default function Editor() { if (m.clearcoat !== undefined) mProps.clearcoat = m.clearcoat; if (m.sheen !== undefined) mProps.sheen = m.sheen; if (m.specularIntensity !== undefined) mProps.specularIntensity = m.specularIntensity; + + // Extract textures + if (m.map) mProps.map = extractTextureUrl(m.map); + if (m.normalMap) mProps.normalMap = extractTextureUrl(m.normalMap); + if (m.roughnessMap) mProps.roughnessMap = extractTextureUrl(m.roughnessMap); + if (m.metalnessMap) mProps.metalnessMap = extractTextureUrl(m.metalnessMap); + if (m.alphaMap) mProps.alphaMap = extractTextureUrl(m.alphaMap); + + // Extract UV properties from the main map if available + if (m.map) { + if (m.map.repeat) mProps.uvTiling = [m.map.repeat.x, m.map.repeat.y]; + if (m.map.offset) mProps.uvOffset = [m.map.offset.x, m.map.offset.y]; + if (m.map.rotation !== undefined) mProps.uvRotation = m.map.rotation * (180 / Math.PI); + } } newSceneObjects.push({