@needle-tools/materialx 1.4.0 → 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/README.md CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  Web runtime support to load and display MaterialX materials in Needle Engine and three.js via the MaterialX WebAssembly library. glTF files containing the `NEEDLE_materials_mtlx` extension can be loaded with this package. There is also experimental support for loading raw MaterialX XML files.
4
4
 
5
- > When using Needle Engine for Unity, this package can be added to your project via the Needle Engine component. Add it to the "NpmDef Dependencies" field. MaterialX files will then be automatically generated from compatible Shader Graphs with the "MaterialX" export type.
6
- > [Learn more in the Needle Engine documentation](https://engine.needle.tools/docs/how-to-guides/export/materialx.html).
5
+ [Learn more in the Needle Engine documentation](https://engine.needle.tools/docs/how-to-guides/export/materialx.html)
7
6
 
8
7
  [![](https://cloud.needle.tools/-/media/Xc99R6zbaD-kpoTw1cMRKA.gif)](https://engine.needle.tools/samples/material-x)
9
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@needle-tools/materialx",
3
- "version": "1.4.0",
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