AWS Thinkbox Discussion Forums

Deadline Stripping Double Underscores

Deadline 10.0.0.41

Deadline, SMTD is stripping two underscores from the render element paths. The preview window reflects this and I can confirm that the stripped path is sent to Deadline. I have nothing in pathing that should be doing this. Why is this happening?

This one’s new to me. I’ve asked Bobo if he knows if/why we added that in.

Anything?

Yes, the “good” news is I was able to reproduce it.
The bad news is I have not found the exact cause for it yet. But I am looking into it.

Thank you for reporting the problem, and sorry for the inconvenience! :blush:

Its not a dealbreaker–glad its being looked into.

Figured it out.

Here is the long story:

Prior to Deadline 10, we were using a fixed logic for building all output filenames. In other words, the Stereo Camera token, the State Set token, the Region signature and the base name plus any Render Element renaming were all hard-coded in dozens of places throughout the code, and it was a pain to maintain.

In Deadline 10, we moved ALL of the output filename building logic to a single function called SMTDFunctions.GetFormatterOutputFilename() which gets all the necessary tokens and options, and spits out a filename that is consistent throughout SMTD. In addition, we added a (currently not publicized) feature to define a custom order of the various tokens mentioned above. So whereas in the past you would always get a filename like LE_outputfilename_tile01of20.0000.exr, one can now define a SMTDSettings.OutputFilenamePattern property with tokens describing where to put each of the components. It also exposes a SMTDSettings.OutputFilenameTokenDelimiter which defaults to underscore to be used inside that token pattern.

The default of SMTDSettings.OutputFilenamePattern is “$SC$TD$SS$TD$BN”, where
$SC = Stereo Camera Token
$TD = “"
$SS = State Set Name
$TD = "

$BN = Base Output Filemame taken from the render output of Max or the renderer / render element, plus region suffix if needed.

Thus if your Render Element is set to be called “test__VRayAlpha.exr”, and you are rendering the Left Eye Stereo Camera from a State Set called “RedColors”, the above would convert to

LE_RedColors_test__VRayAlpha.exr

But if you don’t like that order and want to start with StateSet and then have the Stereo Camera, and you don’t want to use the default token, you could set SMTDSettings.OutputFilenameTokenDelimiter="-" and SMTDSettings.OutputFilenamePattern = “$SS$TD$SC$TD$BN” and your output would look like

RedColors-LE-test__VRayAlpha.exr

You can also use hard-coded tokens, so “$SS-$SC-$BN” is also valid, with hard-coded dashes instead of using the token delimiter.

This code also includes a line that replaces any outstanding $ characters with a hard-coded underscore, and then replaces any double token delimiters with a single one, to avoid long stretches of just token delimiters like _____. This is what was killing your double underscore in the base name, because that replacement happened AFTER the $BN was replaced with the actual Render Element base filename.

The problem wouldn’t have occurred if the $TD definition in SMTDSettings.OutputFilenameTokenDelimiter was anything else than “". For example setting SMTDSettings.OutputFilenameTokenDelimiter="-" would then look for “–” to replace with “-”, and double underscores would not have been hit. But since we default the $TD to be "”, it had unexpected side effects…

To test a possible solution, I moved the $BN replacement to happen after the double underscore removal, but I also needed to move the $ replacement with _ to happen after the $BN replacement because otherwise it was killing my $BN to just BN and it did not get replaced.

I believe that having some double delimiters in the resulting output filename should be acceptable.

The original code in SubmitMaxToDeadline_Functions.ms around line 5769 was

			TokenPattern = substituteString TokenPattern "$SC" stereoCameraToken			--replace stereo camera token
			TokenPattern = substituteString TokenPattern "$SS" stateSetName					--replace state set name token
			TokenPattern = substituteString TokenPattern "$BN" baseName						--replace base name token
			TokenPattern = substituteString TokenPattern "$TD" tokenDelimiter				--replace token delimiter
			TokenPattern = substituteString TokenPattern "$"   "_"							--replace any leftover $ with underscore
			
			TokenPattern = substituteString TokenPattern (tokenDelimiter+tokenDelimiter) tokenDelimiter									--replace double delimiter tokens with single delimiter
			if matchPattern TokenPattern pattern:(tokenDelimiter+"*") do TokenPattern = substring TokenPattern 2 -1						--strip prefix delimiter

I changed it to

			TokenPattern = substituteString TokenPattern "$SC" stereoCameraToken			--replace stereo camera token
			TokenPattern = substituteString TokenPattern "$SS" stateSetName					--replace state set name token
			TokenPattern = substituteString TokenPattern "$TD" tokenDelimiter				--replace token delimiter
			
			TokenPattern = substituteString TokenPattern (tokenDelimiter+tokenDelimiter) tokenDelimiter									--replace double delimiter tokens with single delimiter
			if matchPattern TokenPattern pattern:(tokenDelimiter+"*") do TokenPattern = substring TokenPattern 2 -1						--strip prefix delimiter
			
			TokenPattern = substituteString TokenPattern "$BN" baseName						--replace base name token
			TokenPattern = substituteString TokenPattern "$"   "_"							--replace any leftover $ with underscore

Try moving those two lines like above, save the file, and relaunch SMTD. See if you like the results better.

Hope this explains it…

Verified! Thanks for the fix.

Privacy | Site terms | Cookie preferences