Author Topic: alg.mapexport.exportPath() crashing 2020.1.1  (Read 440 times)

Hey folks! I've been running into an issue with the 2020 versions of Substance Painter that appears to be a regression from 2019. We have a Javascript plugin that looks up the value of 'alg.mapexport.exportPath()' at a few junctures - both when the tool window is opened, as well as a callback to the 'onProjectOpened' event - but doing so appears to cause an immediate silent crash-to-desktop in 2020.1.0 and 2020.1.1 if there is not a project open currently. According to the scripting documentation, this function should return an empty string if no project is open, and that is indeed how it behaved in 2019. Is this issue known, and if so, is it planned for an upcoming patch? Thanks much!

Also, it appears the 'onProjectOpened' event is now firing prematurely, as if is raised before the new project is fully loaded (which is when the documentation indicates it should be raised.) I am definitely reproing a situation where in a callback to that event, 'alg.project.isOpen()' returns true, but accessing 'alg.mapexport.exportPath()' still causes an instantaneous hard-crash in Painter (as if there was no project loaded.)

I'm also finding that the 'alg.mapexport.getPathsExportDocumentMaps()' method crashes if a document is not fully loaded and you pass it a path other than a simple drive letter (e.g. 'C:/'). Passing it an empty string seems to avoid the crash in that case, but it also will cause the function to fail later when your documents are actually loaded. I tried passing it 'alg.documents_directory' but that would also cause the crash. I suspect this is tied to the same root cause that is crashing the '.exportPath()' method in that same namespace.

This method is important for our tools as we use it to enumerate the texturesets present on the current project - there doesn't appear to be another way to do so listed in the script documentation that I could find.

This is still an issue in 6.1.2

We fixed a few scripting issues in 2020.1.3 (6.1.3), can you give it a try ?
Don't forget your log file. It can be exported from the Help menu of the software.
-----------
Fabrice Piquet aka Froyok. Product Manager, Technical Artist and Documentation at Adobe.

It looks like 6.1.3 is a partial success - querying 'alg.mapexport.exportPath()' when nothing is loaded no longer hard crashes the entire application; however, it instead causes the following internal error to be reported in the log:

Code: [Select]
[Script] qrc:/js/mapexport.js:385: ExportError: Project export configuration not loaded
This error prevents my tool window from opening at all in that circumstance. The original 2019 behavior was that it would return an empty string or null if no document was loaded, and we could test for that in the script to control the tool's behavior.