ID 425758 - Material files exported from materials created by an imported session, lose their loaded reference images

Follow

Problem summary

Exporting a Material that contains nodes like SphereMap loaded with an image, via the Python API, then exporting that material again as .mma, loses the image data. This issue also appears to happen when exporting via session scripts rather than Python API, and affects nodes like Sphere Map, Camera Projection, Projection but not Tiled nodes. 
 

Customer reported version
mari_4.6v2
 

Customer reported platform
 

Steps to reproduce

1) Create an empty folder inside of a temp directory. e.g C:/temp/ExportTest

2) Open the example head project in Mari

3) Create a material inside of the Node Graph, for example BRDF

4) Go inside the Material group and create a SphereMap node

5) Select for the SphereMap an image from disk. You can see this becomes available in the Image Manager

6) Delete the image file from disc or rename it to something else so that the loaded image only exists inside of the Mari project

7) Select the Material node and run the following script in the Python console:


geo = mari.current.geo()graph = geo.nodeGraph()selectedNodes = graph.selectedNodeList()graph.exportNodesAsArchive('C:/temp/ExportTest',selectedNodes,True,[])

8) Remove the Material node and previously loaded image from the Image Manager

9) Run the following command in the same Python console session: 


 graph.importNodesFromArchive('C:/temp/ExportTest',[],{})

10) Go inside the Material node created after the import and notice the SphereMap still displays the image as expected 

11) Select the Material node and within its Node Properties use 'Export as Material' saving it as an .mma file on disk 

12) Remove again the Material node and image from the Image Manager

13) Within the Node Graph right click and select File->Import Material, loading the previously saved .mma file 

14) Go inside the Material node created after the import.

Result: The SphereMap no longer displays the image as expected, rather displays red Xs. 
 

Expected behaviour
Importing a material via the Python API or session scripts, then exporting it as .mma file should preserve the loaded image.
 

Actual behaviour
.mma exported materials originally created via a Python import, lose loaded images
 

Workaround
Using the Tiled node instead of nodes like SphereMap appears to work. Or using a Tiled node together with one of the affected nodes, like SphereMap, triggers a dynamic update of the missing image from the working node, as long as both nodes use the same image.
 

Reproduced by support

This bug has been reproduced in:
4.6v2 - Windows 7, RHEL 7, macOS 10.13
4.5v1 - Windows, RHEL 7

Earliest version tested

4.5v1 -  This feature did not exist in previous versions 

    We're sorry to hear that

    Please tell us why