PDA

View Full Version : RealRenderHistory Bug


CycloneS
07-13-2008, 01:28 AM
Hi,

I am using a script called RealRenderHistory by Borislav Petrov
found here http://www.scriptspot.com/bobo/darkmoon/rrh

I am very fond of this script but I have encountered a bug in the "preview" window. When I render 10 frames, 100 frames etc the preview window does not display them in order. It seems to happen when the file names go up from 9-10, 99-100 etc. I am using 3dsmax9. Does anyone know what might be causing this bug or how to fix it? Thanks for the help.

ZeBoxx2
07-13-2008, 10:32 AM
hehe.. I think Bobo might cringe a little when he re-reads that code... I know I do when I see my own old code *shudders at the thought*

The basic problem is in the float inaccuracy and implicit float to int casting. While a particular value being calculated may look like it's 10.0, it's actually something like 9.99999999999. When that's cast to an int, it ends up being 9. Whoops.

The main function that gets called to update the display is 'update_history_display'. In it you'll find this piece of code that is the culprit:

local image_index = (val*get_image_files.count/100.0 as integer)+1


That seemingly-odd piece of code is to deal with the user clicking on the progress bar to go to a particular image. The progress bar's value goes from 0.0 to 100.0, so it has to map that percentage to an image value.

However, that also gets run when you use the spinner. That spinner already contains the correct image index, so to make the spinner conform to the function, the spinner's 'changed val' handler contains:

new_val = (100.0*(val-1)/rrh_current_frame.range.y)


Unfortunately, due to float inaccuracies, those two calculations don't always cancel eachother out 100%, thus leading to the problem.

Now as for the fix... essentially, the code to handle the progress bar's 0.0 to 100.0 (percent) should be handled in the progress bar's handler, rather than in the updating function. A lot of the calls to "update_history_display" seem to rely on that function taking the 0.0 to 100.0 range, though, so the code would have to be adjusted in quite a few locations. A simpler 'fix' would be to round the value.

Add the following function somewhere in the rollout - for example, above "fn build_image_report":

fn numRound val digits:0 = (
local negator, mult, valInt, valDec, result
negator = 1
if (val != abs(val)) do (
negator = -1
val = abs(val)
)
mult = 10.0 ^ digits
val = val * mult
valInt = val as integer
valDec = val - valInt
if (valDec < 0.5) then ( result = valInt )
else if (valDec > 0.5) then ( result = valInt + 1 )
else (
if ((mod valInt 2) == 0) then ( result = valInt )
else ( result = valInt + 1 )
)
result = result / mult * negator
if (digits == 0) then ( return (result as integer) )
else ( return result )
)


Then in "update_history_display", change the following:

-- local image_index = (val*get_image_files.count/100.0 as integer)+1
local image_index = numRound ((val*get_image_files.count/100.0 as integer)+1)


Again, though - ideally the function would be adjusted to take the image index directly and handling the 0.0% .. 100.0% bit in the progressbar only. Lots of little bits of code in the source to adjust if doing so :)

CycloneS
07-14-2008, 04:17 AM
I know almost nothing about maxscript and I actualy understood what you said. Very straightforward :) thanks. I changed the code but it seemed to have no affect on the script. This is the changed code based on Bobo's script and your suggestions. Am I doing something wrong?

Thanks.


macroScript RHistoryToggle category:"Bobo_s Tools" buttontext:"RHistory"
(
--------------------------------------------
--RealRenderHistory
--version 0.0.2 (Beta)
--Last Edited: 12/01/2004
--Copyright (c) 2002-2004 by Borislav Petrov
--bobo@franticfilms.com
--http://www.scriptspot.com/bobo/darkmoon/rrh
--------------------------------------------
global RRH_StoreLastRenderData
persistent global RRH_RenderHistoryEnabled
on isChecked return RRH_RenderHistoryEnabled
on execute do
(
if RRH_RenderHistoryEnabled == undefined then
RRH_RenderHistoryEnabled = true
else
RRH_RenderHistoryEnabled = not RRH_RenderHistoryEnabled

if RRH_RenderHistoryEnabled then
(
--Make sure there is a RenderHistory directory to store images into...
makedir ((GetDir #preview)+"/renderHistory")

fn RRH_StoreLastRenderData =
(
local frame_info =
local last_image = GetLastRenderedImage()
local check_for_files = getFiles ((GetDir #preview)+"/renderHistory/RRH_"+(getFileNameFile maxFileName)+"*.rpf")
local file_exist = true
local increment = 1
while file_exist do
(
local out_file_name = (GetDir #preview)+"/renderHistory/RRH_"+(getFileNameFile maxFileName)+"_"+(check_for_files.count+increment) as string + ".rpf"
if (getFiles out_file_name).count == 0 then
file_exist = false
else
increment += 1
)
local scene_info_path = out_file_name+".ini"
scene_info_file = createFile scene_info_path
setIniSetting scene_info_path "General" "SceneName" (getFileNameFile maxFileName)
setIniSetting scene_info_path "General" "RenderDate" localtime
setIniSetting scene_info_path "General" "ImageWidth" (last_image.width as string)
setIniSetting scene_info_path "General" "ImageHeight" (last_image.height as string)
setIniSetting scene_info_path "General" "CacheFile" out_file_name
if (maxVersion())[1] < 6000 then
(
if getUseDraftRenderer() then
current_renderer = "Draft"
else
current_renderer = "Production"
)
else
current_renderer = "Production"

setIniSetting scene_info_path "Renderer" "Renderer" (classof (renderers.current) as string)
setIniSetting scene_info_path "Renderer" "RendererSetup" current_renderer
setIniSetting scene_info_path "Renderer" "OutputPath" rendOutputFilename
setIniSetting scene_info_path "Renderer" "RenderWidth" (renderWidth as string)
setIniSetting scene_info_path "Renderer" "RenderHeight" (renderHeight as string)
setIniSetting scene_info_path "Renderer" "ImageAspect" (getRendImageAspect() as string)
setIniSetting scene_info_path "Renderer" "PixelAspect" (renderPixelAspect as string)
setIniSetting scene_info_path "Renderer" "ApertureWidth" (getRendApertureWidth() as string)
setIniSetting scene_info_path "Renderer" "ColorCheck" (rendColorCheck as string)
setIniSetting scene_info_path "Renderer" "SuperBlack" (rendSuperBlack as string)
setIniSetting scene_info_path "Renderer" "SuperBlackThreshold" (rendSuperBlackThresh as string)
setIniSetting scene_info_path "Renderer" "RenderHidden" (rendHidden as string)
setIniSetting scene_info_path "Renderer" "Force2Sided" (rendForce2Side as string)
setIniSetting scene_info_path "Renderer" "RenderAtmosphere" (rendAtmosphere as string)
setIniSetting scene_info_path "Renderer" "RenderDisplacements" (renderDisplacements as string)
setIniSetting scene_info_path "Renderer" "RenderEffects" (renderEffects as string)
setIniSetting scene_info_path "Renderer" "DitherTrueColor" (rendDitherTrue as string)
setIniSetting scene_info_path "Renderer" "Dither256Color" (rendDither256 as string)
setIniSetting scene_info_path "Renderer" "MultiThreaded" (rendMultiThread as string)

setIniSetting scene_info_path "AntiAliasing" "Filter" (classof (scanlineRender.antiAliasFilter) as string)
setIniSetting scene_info_path "AntiAliasing" "FilterSize" (scanlineRender.antiAliasFilterSize as string)
setIniSetting scene_info_path "AntiAliasing" "PixelSampler" (scanlineRender.enablePixelSampler as string)


setIniSetting scene_info_path "SceneInfo" "TotalObjectsCount" (objects.count as string)
setIniSetting scene_info_path "SceneInfo" "GeometryObjectsCount" (geometry.count as string)
setIniSetting scene_info_path "SceneInfo" "CameraObjectsCount" (cameras.count as string)
setIniSetting scene_info_path "SceneInfo" "LightsObjectsCount" (lights.count as string)

last_image.filename = out_file_name
save last_image
close last_image
last_image = undefined
try(rrh_rollout.update_history_display 100.0)catch()
)
callbacks.removeScripts #postRender id:#rrhistory
callbacks.addScript #postRender "RRH_StoreLastRenderData()" id:#rrhistory
)
else
(
callbacks.removeScripts #postRender id:#rrhistory
)--end if
)--end on execute
)--end script

macroScript RHistoryBrowse category:"Bobo_s Tools" buttontext:"See RHistory"
(
global rrh_rollout
local preview_image = bitmap 320 240
local vfb_image = bitmap 320 240
local image_index = 1
local get_image_files = #()
local LeftMouseDown = false
rollout rrh_rollout "RealRenderHistory"
(
bitmap rrh_preview width:320 height:240 bitmap:preview_image pos:[1,0]
progressbar rrh_slider align:#center value:0 width:320 height:20 pos:[1,240]
checkbutton rrh_display_vfb "Show VFB" height:20 width:70 checked:false pos:[2,260] highlightcolor:(color 200 255 200) tooltip:"Show Images in VFB"
button rrh_load_ramplayer "RAMplayer" height:20 width:70 pos:[2,280] tooltip:"Load Images in RAMplayer"
checkbutton rrh_scene_only "Scene Only" height:20 width:70 pos:[72,260] highlightcolor:(color 200 255 200) checked:true tooltip:"Show Current Scene Images only / Show All Images"
checkbutton rrh_drag_image "Image Drag" height:20 width:70 pos:[72,280] highlightcolor:(color 200 200 255) tooltip:"Click and Drag Mouse over Image to Scroll History"

button rrh_delete_image "Delete" height:20 width:60 pos:[142,260] tooltip:"Delete Current Image"
button rrh_delete_all "Delete All" height:20 width:60 pos:[142,280] tooltip:"Delete All Images"
button rrh_image_info "Settings" height:20 width:60 pos:[202,260] enabled:false
button rrh_scene_info "Report" height:20 width:60 pos:[202,280] tooltip:"Generate Image Report"

spinner rrh_current_frame range:[1,1,1] type:#integer pos:[262,262] fieldwidth:40

fn numRound val digits:0 = (
local negator, mult, valInt, valDec, result
negator = 1
if (val != abs(val)) do (
negator = -1
val = abs(val)
)
mult = 10.0 ^ digits
val = val * mult
valInt = val as integer
valDec = val - valInt
if (valDec < 0.5) then ( result = valInt )
else if (valDec > 0.5) then ( result = valInt + 1 )
else (
if ((mod valInt 2) == 0) then ( result = valInt )
else ( result = valInt + 1 )
)
result = result / mult * negator
if (digits == 0) then ( return (result as integer) )
else ( return result )
)

fn build_image_report scene_info_path image_info_path =
(
image_info_file = createFile image_info_path
format "==========================================\n" to:image_info_file
format "RENDER HISTORY - IMAGE REPORT\n" to:image_info_file
format "==========================================\n" to:image_info_file

str = getIniSetting scene_info_path "General" "SceneName"
format "Scene Name: \t\t%\n" str to:image_info_file
str = getIniSetting scene_info_path "General" "RenderDate"
format "Render Date: \t\t%\n" str to:image_info_file
str1 = getIniSetting scene_info_path "General" "ImageWidth"
str2 = getIniSetting scene_info_path "General" "ImageHeight"
format "Image Size: \t\t% x %\n" str1 str2 to:image_info_file
str = getIniSetting scene_info_path "General" "CacheFile"
format "RRH Cache Name: \t%\n" str to:image_info_file
format "==========================================\n" to:image_info_file
format "RENDERER SETTINGS:\n" to:image_info_file
str = getIniSetting scene_info_path "Renderer" "Renderer"
format "Current Renderer: \t%\n" str to:image_info_file
str = getIniSetting scene_info_path "Renderer" "RendererSetup"
format "Renderer Setup: \t%\n" str to:image_info_file
str = getIniSetting scene_info_path "Renderer" "OutputPath"
format "Output Path: %\n" str to:image_info_file

str1 = getIniSetting scene_info_path "Renderer" "RenderWidth"
str2 = getIniSetting scene_info_path "Renderer" "RenderHeight"
format "Render Size: \t\t% x %\n" str1 str2 to:image_info_file
str = getIniSetting scene_info_path "Renderer" "ImageAspect"
format "Image Aspect: \t\t%\n" str to:image_info_file
str = getIniSetting scene_info_path "Renderer" "PixelAspect"
format "Pixel Aspect: \t\t%\n" str to:image_info_file

str = getIniSetting scene_info_path "Renderer" "ApertureWidth"
format "Aperture Width: \t%\n" str to:image_info_file
str = getIniSetting scene_info_path "Renderer" "ColorCheck"
format "Color Check: \t\t%\n" str to:image_info_file
str = getIniSetting scene_info_path "Renderer" "SuperBlack"
format "Super Black: \t\t%\n" str to:image_info_file
str = getIniSetting scene_info_path "Renderer" "SuperBlackThreshold"
format "S.Black Threshold: \t%\n" str to:image_info_file
str = getIniSetting scene_info_path "Renderer" "RenderHidden"
format "Render Hidden: \t\t%\n" str to:image_info_file
str = getIniSetting scene_info_path "Renderer" "Force2Sided"
format "Force 2 Sided: \t\t%\n" str to:image_info_file
str = getIniSetting scene_info_path "Renderer" "RenderAtmosphere"
format "Atmosphere: \t\t%\n" str to:image_info_file
str = getIniSetting scene_info_path "Renderer" "RenderDisplacements"
format "Displacement: \t\t%\n" str to:image_info_file
str = getIniSetting scene_info_path "Renderer" "RenderEffects"
format "RenderEffects: \t\t%\n" str to:image_info_file
str = getIniSetting scene_info_path "Renderer" "DitherTrueColor"
format "Dither TrueColor: \t%\n" str to:image_info_file
str = getIniSetting scene_info_path "Renderer" "Dither256Color"
format "Dither 8-bit: \t\t%\n" str to:image_info_file
str = getIniSetting scene_info_path "Renderer" "MultiThreaded"
format "Multi-Threaded: \t%\n" str to:image_info_file
str = getIniSetting scene_info_path "AntiAliasing" "Filter"
format "AA-Filter: \t%\n" str to:image_info_file
str = getIniSetting scene_info_path "AntiAliasing" "FilterSize"
format "AA-Filter Size: \t%\n" str to:image_info_file
str = getIniSetting scene_info_path "AntiAliasing" "PixelSampler"
format "Pixel Sampler: \t%\n" str to:image_info_file

format "==========================================\n" to:image_info_file
format "SCENE INFO:\n" to:image_info_file
str = getIniSetting scene_info_path "SceneInfo" "TotalObjectsCount"
format "Total Objects Count: %\n" str to:image_info_file
str = getIniSetting scene_info_path "SceneInfo" "GeometryObjectsCount"
format "Geometry Objects Count: %\n" str to:image_info_file
str = getIniSetting scene_info_path "SceneInfo" "CameraObjectsCount"
format "Cameras Count: %\n" str to:image_info_file
str = getIniSetting scene_info_path "SceneInfo" "LightsObjectsCount"
format "Lights Count: %\n" str to:image_info_file
format "==========================================\n" to:image_info_file

close image_info_file
edit image_info_path
)

fn build_ramplayer_ifl =
(
if rrh_scene_only.checked then file_name = (getFileNameFile maxFileName) else file_name = ""
local get_image_files = getFiles ((GetDir #preview)+"/renderHistory/RRH_"+file_name+"*.rpf")
local ifl_path_1 = ((GetDir #preview)+"/renderHistory/RRH_List_1.ifl")
local ifl_path_2 = ((GetDir #preview)+"/renderHistory/RRH_List_2.ifl")
local temp_ifl_1 = createfile ifl_path_1
local temp_ifl_2 = createfile ifl_path_2
format "%\n" (fileNameFromPath get_image_files[1]) to:temp_ifl_1
for i in get_image_files do
(
format "%\n" (fileNameFromPath i) to:temp_ifl_1
format "%\n" (fileNameFromPath i) to:temp_ifl_2
)
close temp_ifl_1
close temp_ifl_2
RAMplayer ifl_path_1 ifl_path_2
)

fn update_history_display val =
(
if rrh_scene_only.checked then file_name = (getFileNameFile maxFileName) else file_name = ""
local get_image_files = getFiles ((GetDir #preview)+"/renderHistory/RRH_"+file_name+"*.rpf")
local image_index = numRound ((val*get_image_files.count/100.0 as integer)+1)
if image_index > get_image_files.count then image_index = get_image_files.count
if image_index > 0 then
(
current_image = openbitmap get_image_files[image_index]
copy current_image preview_image
rrh_preview.bitmap = preview_image

if rrh_display_vfb.checked then
(
if vfb_image.height != current_image.height or vfb_image.width != current_image.width then
(
close vfb_image
vfb_image = bitmap current_image.width current_image.height
)
copy current_image vfb_image
display vfb_image
)
close current_image
)
else
(
current_image = bitmap 32 24
copy current_image preview_image
rrh_preview.bitmap = preview_image
copy current_image vfb_image
image_index= 1
)
rrh_current_frame.range = [1,get_image_files.count, image_index]
rrh_slider.value = 100.0 * image_index / get_image_files.count
)

on rrh_slider clicked val do update_history_display val

on rrh_current_frame changed val do
(
new_val = (100.0*(val-1)/rrh_current_frame.range.y)
update_history_display new_val
)
on rrh_display_vfb changed state do
(
if state == false then
undisplay vfb_image
else
update_history_display rrh_slider.value
)

on rrh_load_ramplayer pressed do build_ramplayer_ifl()

on rrh_delete_all pressed do
(
if rrh_scene_only.checked then
(
file_name = (getFileNameFile maxFileName)
q = queryBox "Delete Current Scene Images from History?" title:"RRH"
)
else
(
file_name = ""
q = queryBox "Delete ALL Images from History?" title:"RRH"
)
if q then
(
local get_image_files = getFiles ((GetDir #preview)+"/renderHistory/RRH_"+file_name+"*.rpf")
for i in get_image_files do
(
deleteFile i
deleteFile (i+".ini")
deleteFile (i+".txt")
)
update_history_display rrh_slider.value
)
)
on rrh_delete_image pressed do
(
if rrh_scene_only.checked then
file_name = (getFileNameFile maxFileName)
else
file_name = ""
q = queryBox "Delete Current Image from History?" title:"RRH"
if q then
(
local get_image_files = getFiles ((GetDir #preview)+"/renderHistory/RRH_"+file_name+"*.rpf")
deleteFile get_image_files[rrh_current_frame.value]
deleteFile (get_image_files[rrh_current_frame.value]+".ini")
deleteFile (get_image_files[rrh_current_frame.value]+".txt")
update_history_display rrh_slider.value
)
)
on rrh_scene_info pressed do
(
if rrh_scene_only.checked then
file_name = (getFileNameFile maxFileName)
else
file_name = ""
local get_image_files = getFiles ((GetDir #preview)+"/renderHistory/RRH_"+file_name+"*.rpf")
build_image_report (get_image_files[rrh_current_frame.value]+".ini") (get_image_files[rrh_current_frame.value]+".txt")
)

on rrh_scene_only changed state do update_history_display rrh_slider.value
on rrh_rollout close do undisplay vfb_image
on rrh_rollout lButtonDown pos do LeftMouseDown = True
on rrh_rollout lButtonUp pos do LeftMouseDown = False

on rrh_rollout mouseMove pos do
(
if LeftMouseDown and rrh_drag_image.checked then
(
val = 100.0*((pos.x/320.0))
if val < 0 then val = 0
update_history_display val
)
)

)
freescenebitmaps()
gc light:true
destroyDialog rrh_rollout
createDialog rrh_rollout 320 300 100 100
rrh_rollout.update_history_display 100.0
)

ZeBoxx2
07-14-2008, 05:21 AM
nope - that looks like (and just tested) it should work just fine. Did you re-evaluate the scripts after you edited them (not just saved). Did you try replacing the toolbar button(s) (or however you use the macroscripts)?

I'm attaching a zip file with the renders I rendered out to check what would happen (presumably you'll have to extract them with file/date tags intact or else getFiles() will grab the files out of order; each image has been frame stamped).

Beyond that - perhaps your problem isn't the same one I tackled? As I understood it, the problem was that if you rendered a number of frames, you may run into the problem that if your spinner value says '10', it's not actually loading the 10th image you rendered but the 9th. Is that a correct description of the problem you were/are seeing? If not - can you elaborate on the problem?

CycloneS
07-14-2008, 05:44 AM
yea that's correct.

I copied your images into the history folder. The history browser says theres 13 images. #1 displays "0f", #2 displays "9f", #3 displays "10f", then #6 displays "1f" etc

I noticed in the ini files that your using max5. maybe its a max9 only bug. I'm also using dual monitors so maybe the script is getting confused? meaning its using the wrong monitor for the mouse positions for the progress bar or something?

I edited the script in notepad, saved it then went to max and ran the script.

Bobo
07-14-2008, 06:36 AM
yea that's correct.

I copied your images into the history folder. The history browser says theres 13 images. #1 displays "0f", #2 displays "9f", #3 displays "10f", then #6 displays "1f" etc

I noticed in the ini files that your using max5. maybe its a max9 only bug. I'm also using dual monitors so maybe the script is getting confused? meaning its using the wrong monitor for the mouse positions for the progress bar or something?

I edited the script in notepad, saved it then went to max and ran the script.

Just came back from Hellboy II and it is almost 1 am here, so I am going to bed, but will take a closer look (and probably cringe ;)) tomorrow.

ZeBoxx2
07-14-2008, 12:35 PM
I copied your images into the history folder. The history browser says theres 13 images. #1 displays "0f", #2 displays "9f", #3 displays "10f", then #6 displays "1f" etc
The file date/time indices were probably not extracted correctly; or the files were written out asynchronously.

Try with this script:

myText = text()
addModifier myText (mesh_select())
for i = 1 to 20 do (
myText.text = i as string
-- drat, getLastRenderedImage() doesn't work with render(), crashed RHistory.
max quick render
)

Basically it makes a text shape that shows up when rendering and counts up from 1 to 20. Enable RHistory before running the above code, then view RHistory - should be fine.

I noticed in the ini files that your using max5. maybe its a max9 only bug.
Tested the above with the code you pasted in Max 9 :)

I'm also using dual monitors so maybe the script is getting confused? meaning its using the wrong monitor for the mouse positions for the progress bar or something?
Seems doubtful - then you would also get wrong feedback in the progressbar itself.

Try with the above code that should write out files in the correct sequence; if that still fails, check for Bobo's major rewriting of the code tomorrow ;)

Bobo
07-14-2008, 08:42 PM
Try with the above code that should write out files in the correct sequence; if that still fails, check for Bobo's major rewriting of the code tomorrow ;)

The problem is this:

When this was written back in 2002/2004, I was running FAT32, which returns files in creation order as opposed to NTFS which returns files in alphabetical order. Thus, I never saw the problem before because it was returning the files correctly on the machine I wrote it on.

Now it does
"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__1.rpf"
"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__10.rpf"
"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__2.rpf"
"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__3.rpf"
"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__4.rpf"
"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__5.rpf"
"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__6.rpf"
"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__7.rpf"
"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__8.rpf"
"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__9.rpf"

which is obviously the cause for the 10th file to appear second.

I will simply include a large leading zeroes prefix to the number to align them correctly, so it would look like

"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__00001.rpf"
"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__00002.rpf"
"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__00003.rpf"
"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__00004.rpf"
"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__00005.rpf"
"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__00006.rpf"
"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__00007.rpf"
"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__00008.rpf"
"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__00009.rpf"
"C:\Program Files\Autodesk\3ds Max 2008\previews\renderHistory\RRH__00010.rpf"

after a sort call.

The alternative would be to add some sorting code to deal with the old numbering in a new way by collecting the number strings, converting to numbers, doing an indexed sort and using that. I might do both for backwards compatibility...

ZeBoxx2
07-14-2008, 08:44 PM
ooooh... why yes, I -am- running FAT32 on this thing :)

*eyes the craziness that is NTFS*

Should the render history basically hold an actual render history file that refers to the files directly? Essentially an IFL, if you will?

Bobo
07-14-2008, 09:36 PM
I made all changes I mentioned, including adding 6 digits with leading zeros and using qsort() for backwards compatibility so now it should both create better file names and sort the old files based on their numbering, with zeros or not.
This also improves the handling of deleted frames - if you delete frames in the middle of the numbering, the next rendering will be stored with the highest currently available number plus one. Previously, it had some ugly iterative code based on the number of files found and whether the corresponding file existed or not. I was glad to kick that code out :)
I also fixed the RAM Player option to sort using the same code.

There might still be issues, please report them here.

Bobo
07-14-2008, 09:37 PM
ooooh... why yes, I -am- running FAT32 on this thing :)

*eyes the craziness that is NTFS*

Should the render history basically hold an actual render history file that refers to the files directly? Essentially an IFL, if you will?

Well, I don't trust a single file. The way it is now, copying the history around between machines would be easy as the "list" is collected on the fly... Two IFLs are created when pressing the RAM Player button, but they are temp. files, not the main storage.

CycloneS
07-15-2008, 04:19 PM
Thanks ZeBoxx2 for the help and the script. I used it to test Bobo's new script.

Bobo thanks a lot for fixing the script! Images are now displayed in the correct order. There are a few major bugs when deleting images though. When I press the delete button it deletes the wrong file, it does not delete the .ini file and sometimes after deleting a file and then making a new render the script does not save the new render with the next highest image #. It get's saved as one of the missing image #s.

Edit - hmm. I was going write the steps required to execute the bug but.... It seems so be working fine now? I tried your updated script last night and if I remember correctly the file names were "RRH__1.rpf" and didn't have zeros. But now this morning I can't seem to re-create the bug and the file names are now "RRH__000001.rpf"

hehe must have been user error or something...or the script wasn't refreshed properly in max..? sorry :banghead:

CycloneS
07-15-2008, 07:36 PM
Bobo, now that the bug is gone I can enjoy using your script. This was one of the few things maya has that I wish came in 3dsmax. Thanks for creating it and fixing the bug so quickly! :)

If you still want to improve the script even further here is a list of features/improvements I wouldn't mind seeing in a new version. :)

In order:

1. Display current file name in history browser. Display date render was created would be cool to.

2. Script is automatically turned on when 3dsmax is started. Maybe have the option to turn this on/off

3. Progress Bar Skips Images - The progress bar could be a little smoother when scrolling a large amount of images. It seems to only have 100 steps. I think that means one step = 1% right? So if you have 200 images you wouldn't be able to view all of them without skipping images and would have to use the spinner. Is it possible to move your mouse 1pixel at a time and have the progress bar move the same amount. That is if you have enough images in the history. hmm maybe using a scrollbar instead of a progress bar would allow for this?

4. When "Show VFB" is turned on the default window position is in the middle of my two monitors. This is fine but when I move the window to a better spot and scroll through the images the window moves back to the original default position if the next render is of a different resolution. This gets a bit frustrating when I have to constantly re-position the window every time I scroll through the images.

5. Ability to save to an uncompressed image format like .png which can be viewed in Windows Picture Viewer. Or the option to chose any file format you like.

6. Resizable history browser window, where image is displayed at the original rendered resolution and the ability to dynamically resize the image/window. I know max doesn't even dynamically resize the images in the frame buffer but at least max allows you to change the image size in the window by 50% at a time. The script has a "Show VFB" option but its not as intuitive as just having to worry about one window.

7. Incorporate the image browser into the VFB window. It would be very cool and the most intuitive UI. But I'm assuming it would be a lot harder to script and might not even be possible with maxscript.

I hope you don't mind me posting my ideas.
Thanks again. :)

Bobo
07-15-2008, 07:47 PM
Bobo, now that the bug is gone I can enjoy using your script. This was one of the few things maya has that I wish came in 3dsmax. Thanks for creating it and fixing the bug so quickly! :)

If you still want to improve the script even further here is a list of features/improvements I wouldn't mind seeing in a new version. :)

In order:

1. Display current file name in history browser. Display date render was created would be cool to.


That's easy, will do something about it.



2. Script is automatically turned on when 3dsmax is started. Maybe have the option to turn this on/off

Not sure what you mean - in order to enable it, you have to check the checkbutton manually. Do you want it to start automatically?


3. Progress Bar Skips Images - The progress bar could be a little smoother when scrolling a large amount of images. It seems to only have 100 steps. I think that means one step = 1% right? So if you have 200 images you wouldn't be able to view all of them without skipping images and would have to use the spinner. Is it possible to move your mouse 1pixel at a time and have the progress bar move the same amount. That is if you have enough images in the history. hmm maybe using a scrollbar instead of a progress bar would allow for this?


Does the option to drag in the image view give you a better resolution?
I haven't used it in production, so I don't know much about these limitations. I just wrote it and forgot about it ;)


4. When "Show VFB" is turned on the default window position is in the middle of my two monitors. This is fine but when I move the window to a better spot and scroll through the images the window moves back to the original default position if the next render is of a different resolution. This gets a bit frustrating when I have to constantly re-position the window every time I scroll through the images.

Controlling the position of the VFB is only possible in Max 2009. But it is possible.



5. Ability to save to an uncompressed image format like .png which can be viewed in Windows Picture Viewer. Or the option to chose any file format you like.

RPF is not compressed AFAIK, but you cannot view it externally. The reason I went with RPF was the fact it could save all channels rendered. I might add the option to save to any format, as I use mostly EXR myself.


6. Resizable history browser window, where image is displayed at the original rendered resolution and the ability to dynamically resize the image/window. I know max doesn't even dynamically resize the images in the frame buffer but at least max allows you to change the image size in the window by 50% at a time. The script has a "Show VFB" option but its not as intuitive as just having to worry about one window.


Waste of screen space. The browser was meant to show you a thumbnail of what was rendered, and then in the VFB you can check pixel data by right-clicking, filter RGB/Alpha, show channels (if saved) and so on. I could not do this in the scripted view and that's why I never attempted to. If the VFB position were controllable (see 4.), it would be much better to use...


7. Incorporate the image browser into the VFB window. It would be very cool and the most intuitive UI. But I'm assuming it would be a lot harder to script and might not even be possible with maxscript.

Again, this is possible only since Max 2009. I am not using 2009 right now, and it will take a while before everybody gets access to it, so I am not sure how soon I will add this. But I had the plan to do it...

CycloneS
07-15-2008, 08:57 PM
Thanks for reviewing my feature requests. :)

Not sure what you mean - in order to enable it, you have to check the checkbutton manually. Do you want it to start automatically?
yea. That way when I start up max I don't have to worry about turning it on. I usually forget things... ;)


Does the option to drag in the image view give you a better resolution?
I haven't used it in production, so I don't know much about these limitations. I just wrote it and forgot about it ;)

Its not perfect but its 60% better. Thanks for the tip.


RPF is not compressed AFAIK, but you cannot view it externally. The reason I went with RPF was the fact it could save all channels rendered. I might add the option to save to any format, as I use mostly EXR myself.

Yea I knew its uncompressed. Nothing wrong with the choice of format though. I actually like using the raw max files. It just means when my project is over and I back-up the renders to dvd I can't view them without starting up max or send them to other people without converting. Maybe a solution is to have an option to "Export/Copy" all availble images in the History Browser to a desired format. I'm sure theres already a converter somewhere but it would be nice if it was integrated into the same script.

CGTalk Moderation
07-15-2008, 08:57 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.