@needle-tools/materialx 1.4.1 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/materialx",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -62,7 +62,7 @@ export class MaterialXLoader {
62
62
  this.parser = parser;
63
63
  this.options = options;
64
64
  this.context = context;
65
-
65
+
66
66
  if (debug) console.log("MaterialXLoader created for parser");
67
67
  // Start loading of MaterialX environment if the root extension exists
68
68
  if (this.materialX_root_data) {
@@ -294,19 +294,17 @@ export async function createMaterialXMaterial(mtlx, materialNodeNameOrIndex, loa
294
294
  */
295
295
 
296
296
  if (!renderableElement) {
297
- console.warn(`[MaterialX] No renderable element found in MaterialX document (${materialNodeNameOrIndex}) → Please provide a name or index. Options: ${materialNodes.map(n => n.getNamePath()).join(", ")}`);
297
+ if (materialNodes.length <= 0) {
298
+ console.warn(`[MaterialX] No material nodes found in MaterialX document.`);
299
+ }
300
+ else {
301
+ console.warn(`[MaterialX] No renderable element found in MaterialX document (${materialNodeNameOrIndex}) → Please provide a name or index. ${materialNodes.length} options: ${materialNodes.map(n => n.getNamePath()).join(", ")}`);
302
+ }
298
303
  const fallbackMaterial = new MeshStandardMaterial();
299
304
  fallbackMaterial.color.set(0xff00ff);
300
305
  fallbackMaterial.name = `MaterialX_NoRenderable_${materialNodeNameOrIndex}`;
301
306
  return fallbackMaterial;
302
307
  }
303
- else if(typeof materialNodeNameOrIndex === "number") {
304
- console.warn(`[MaterialX] Material node not found by index (${materialNodeNameOrIndex}), using first renderable element: ${renderableElement.getNamePath()}`);
305
- const fallbackMaterial = new MeshStandardMaterial();
306
- fallbackMaterial.color.set(0xff00ff);
307
- fallbackMaterial.name = `MaterialX_NodeNotFound_${materialNodeNameOrIndex}`;
308
- return fallbackMaterial;
309
- }
310
308
 
311
309
  if (debug) console.log("[MaterialX] Using renderable element for shader generation");
312
310