Bizarre File type issue with Tiles Rendering... Update 03/09

EDIT: There was a bug in the code below that meant the render element filenames were getting lost, this is now fixed as of, 14th August 2012.

So I managed to repoduce the bug under controlled circumstances, and as promised here is the code to put a work-around in. It stores all the values and properties of the Render Elements, removes them, adds them back in again, which seems to fix the file format issue.

To reproduce the bug:
Create new scene, add some objects
Set Renderoutput to test_01_.tif
Add some render elements.
Send to Deadline as tiles render but don’t delete the tiles.

Check the stitched Render elements, will be a valid TIF file, check the Render element tiles files, will be valid TIFfile.

Now change the Render Output to test_01_.tga
Send to Deadline again as Tile render and don’t delete the tiles.

Check the stitched render element, will be a valid TGAfile, check the Render Element Tiles files and they will be invalid TGA file, open up in IrfanView and it’ll tell you this file is a TIF file named incorrectly and will prompt you to rename as .tif

To add a fix, follow these steps, let me know if there’s any bugs please.

In SubmitMaxToDeadline.ms

after
checkbox chk_RenderElementsPermanentChanges "Permanent RE Path Changes " pos:[5,45] align:#left

Add

checkbox chk_RebuildRenderElements "Rebuild Render Elements   " pos:[225,45] align:#left

After
chk_RenderElementsPermanentChanges.state = SMTDSettings.RenderElementsPermanentChanges

Add

chk_RebuildRenderElements.state = SMTDSettings.RebuildRenderElements

After
SMTD_MainRollout.Ui_report ("+Rendering: RenderElements Permanent Changes set to [" + state as string + “]”)
)

Add

on chk_RebuildRenderElements changed state do ( setIniSetting SMTDPaths.InIFile "RenderingOptions" "RebuildRenderElements" ((SMTDSettings.RebuildRenderElements= state) as string) SMTD_MainRollout.Ui_report ("+Rendering: ReBuild RenderElements Changes set to [" + state as string + "]") )

In SubmitMaxToDeadline_Functions.ms

After
RenderElementsPermanentChanges = true,

Add:

RebuildRenderElements = true,

After:
SMTDSettings.RenderElementsPermanentChanges = SMTDFunctions.getInI “RenderingOptions” “RenderElementsPermanentChanges” SMTDSettings.RenderElementsPermanentChanges

Add:

SMTDSettings.RebuildRenderElements = SMTDFunctions.getInI "RenderingOptions" "RebuildRenderElements" SMTDSettings.RebuildRenderElements

After:
fn RenderElementsRestorePaths =
(

),

Add:

[code]fn RebuildRenderElements =
(
local reManager = maxOps.GetCurRenderElementMgr()
local AR_Elements = #()
local AR_ElementProps = #()
local AR_ElementFilenames = #()
for i = 1 to reManager.numrenderelements() do
(
local theelement = reManager.getrenderelement (i - 1)
append AR_Elements (classof theelement)
local a = #()
for prop in (getPropNames theelement) do
try(append a (getproperty theelement prop))catch(append a “”)
append AR_ElementProps a

			append AR_ElementFilenames (reManager.GetRenderElementFilename (i - 1))
		)
		reManager.RemoveAllRenderElements()
		for i = 1 to AR_Elements.count do
		(
			reManager.addrenderelement (execute((AR_Elements[i] as string) + "()"))
			local theelement = reManager.getrenderelement (i - 1)
			
			for j = 1 to (getPropNames theelement).count do
				try(setproperty theelement (getPropNames theelement)[j] AR_elementProps[i][j])catch()
			
			reManager.SetRenderElementFilename (i - 1) (getFilenamePath AR_ElementFilenames[i] + getFilenameFile AR_ElementFilenames[i] + getFilenameType RendOutputFilename)
		)
	),[/code]

After:
if SMTDSettings.OverrideLowPriorityThread do
(

)

Add:

[code]if SMTDSettings.RebuildRenderElements do
(
SMTD_MainRollout.Ui_report “>Rebuilding Render Elements”
SMTDFunctions.RebuildRenderElements()
SMTD_MainRollout.Ui_report “+Rebuilt Render Elements”

		)[/code]

Not sure if this next bit is necessary or not…

In SubmitMaxToDeadline_Defaults.ini

Under [RenderingOptions]
Add:
RebuildRenderElements=true