I decided to do some experimenting with the Substance Maya Toolset Mel script written by
@Froyok and I've run into a problem I can't think of an easy solution for.
When I try to run the template baking it won't generate any of the inputs. The error I get is this:
Found no parameters in "test.sbsar"
So I opened the script and inserted some debug print commands - these show that the batch command is returning this:
<div>"C:/Program Files/Allegorithmic/Substance BatchTools/5/sbsrender.exe" info "D:/substance_test/test.sbsar"
input - 'C:/Program' is not recognized as an internal or external command,</div><div>input - operable program or batch file.</div><div>input - <br></div>
This is because the command being fed to sbsrender.exe has spaces in the path string. So it recognises "C:/Program" as one command without including the rest of the path. However I can't think of a reliable way to replace the spaces that is compliant with windows batch formatting. If I run the same input string from a windows command dialog (CMD) it will work correctly.
I tried using substituteAllString to reformat the string with "^ " instead of " " - this didn't work.
Replies
I don't do Mel, does it handle processes sensibly or are you forced to just send a massive string to windows and hope? (maybe put some extra quotes round it)
But you're right - I'm thinking the best thing would be to just ignore this and rewrite some similar tools in python inside substance designer itself.
Looks like you're on designer v5 from the path in your OP so you have no designer scripting nor access to the automation toolkit. Your best bet is to knock up a little python library to construct command lines and launch it from maya or scripts depending on what you're doing.
It's worth noting that a few of the command switches got changed on v6 so if you're referring to online docs for batch tools and stuff doesn't work it may not be your fault.