Material mix error (BlendLuxCore Wheels v2.9a3)
Steps to reproduce: Make a mix material and mix 2 materials
Screenshots or rendered images:
Error message from Blender console: Reference to an undefined NamedObject name: 133918571256072Material
OS: Ubuntu 24.04 LTS Blender version: 4.2.5 LTS LuxCore version:2.9.0
I can't reproduce the error under Linux or Windows using Mix material alone.
Could you provide a test scene? It might be connected to further setup aspects like volumes. Quick search did yield a similar issue reported on the forum: https://forums.luxcorerender.org/viewtopic.php?p=1301#p1301
I have now made a bit more detailed test with this issue.
Steps to reproduce
- Make a blender scene, assign mix material to object, mix any shader. Save the scene
- Make a new blender scene. File -> Link -> Scene. Start rendering, at this point everything loads.
- Go back to the original scene made and adjust any shader parameter, save file.
- Go to second blender file and reload the linked file. then I get error (Reference to an undefined NamedObject name: 129294725863944Material)
- To fix this I need to go to solid mode and then to rendered mode again.
- When mix material node is not use, I do not experience this problem and after reloading linked files there is no error and scene is refreshed and start rendering. Test_files.zip
Okay I finally managed to reproduce it. There were two key details here:
- Both scenes are opened in parallel and stay opened. You posted on Discord about your dual-PC setup, that gave me the idea. I initially tried with one Blender session switching between them.
- Then, reloading the linked file via the outliner/Blender file menu while still in rendered view.
Have to investigate further if:
- The change of material name is down to BlendLuxCore (possibility that we improve) or Blender itself (we need to work around)
- The scene export to LuxCore is triggered at all (or correctly) when the linked update is happening
Update:
First, little clarification, the error actually appears even if there was no change to the linked material. Simply calling a refresh on the linked file in the second scene is enough.
Regarding the error: This seems to be triggered by this line: https://github.com/LuxCoreRender/BlendLuxCore/blob/67b0379d4518ce2efcdc5a11b87f3401f7e64d06/export/caches/init.py#L64
In the whole scene/material chain, this is the second time the Properties.Set()method is called, the first being here:
https://github.com/LuxCoreRender/BlendLuxCore/blob/67b0379d4518ce2efcdc5a11b87f3401f7e64d06/export/caches/object_cache.py#L474
Looking at the content of (scene_)props, the first time there are no new names pushed. The second time, additional keys appear which seem to be the material properties of the materials going into the mix shader, but not the mix shader itself. These new keys then trigger the error.
This suggests to me that the material key generation on the second time produces a bad result. To be investigated further.
Simply commenting out the erroneous second instance seems to fix the error, the material is updated correctly after a change in the first scene. However care should be taken what other side effect this will have. I assume the code is not there for no reason...