Home Coding, Scripting, Shaders

Substance Maya Toolset script filename issue

polycounter
Offline / Send Message
sprunghunt polycounter
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 -&nbsp;<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

  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    If it's any help, this stuff works fine from standalone python and c#.  

    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) 
  • sprunghunt
    Offline / Send Message
    sprunghunt polycounter
    poopipe said:
    If it's any help, this stuff works fine from standalone python and c#.  

    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) 
    The way this is supposed to work is that you're sending a command line to the various .exe's and there's some discrepancy between how strings are represented in mel and the windows shell. 

    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. 
  • poopipe
    Offline / Send Message
    poopipe grand marshal polycounter
    The scripting in designer is pretty half hearted at the moment - it'll get better with time though. 

    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. 
Sign In or Register to comment.