Hi all,
I have a problem with format setting.
I setup format settings for Render Output file in 3ds max (ex. png, 16bit, alpha) and save a file.
Then i create a job in deadline and use a postload script to change a rendOutputFilename to new path with same file type. But the output file is saved with other format settings.
How i can save same format setting when change a rendOutputFilename? Maybe i can read format settings from rendOutputFilename?
Forum topic · General Scripting
Read image output format settings from Render Output
By antomor · 2019-07-31
Description
Comments (8)
antomor · 2019-08-22
thanks all for answers
All solutions not uses for me
Think in maxsript i can not read format options for rendOutputFilename.
I solved my problem with another method
`
pixamoon · 2019-08-03
Hi,
Try this one:
output_filename = rendOutputFilename
rendOutputFilename = ""
pngio.setType #true48
pngio.setAlpha true
rendOutputFilename = output_filename
renderSceneDialog.update()
Best,
Pixamoon
antomor · 2019-08-03
thank you, but i do not know format options in rendOutputFilename and want leave this options but change a rendOutputFilename.
.
jahman · 2019-08-03
if you know that output file is png perhaps you can access output settings like this?

`
pixamoon · 2019-08-06
ah, sorry, looked on your question too fast.
To get output settings I think you need to do it with actual dialogs and get info from them:
1. open Render Setup dialog
2. press Files... button
3. press Setup... button
4. get info from PNG Configuration dialog
Try this code:
(
local png_type, png_alpha
fn press_button_by_name hwnd str =
(
for o in windows.getChildrenHWND hwnd where (o[4] == "Button" or o[4] == "CustButton") and matchpattern o[5] pattern:str do UIAccessor.PressButton o[1]
)
fn dialog_ops_re =
(
try
(
local hwnd = DialogMonitorOPS.GetWindowHandle()
local wnd_text = UIAccessor.GetWindowText hwnd
if wnd_text != undefined then
(
if wnd_text == "Render Output File" then
(
press_button_by_name hwnd "Setup..."
press_button_by_name hwnd "Cancel"
)
if wnd_text == "PNG Configuration" then
(
for o in windows.getChildrenHWND hwnd do
(
if checked_type == undefined do
(
local checked_type = findItem #("Optimized palette (256)", "RGB 24 bit (16.7 Million)", "RGB 48 bit (281 Trillion)", "Grayscale 8 bit (256)", "Grayscale 16 bit (65,536)") o[5]
if checked_type > 0 and (windows.sendMessage o[1] 0x00F0 0 0) == 1 do
(
png_type = case checked_type of
(
1 : #paletted
2 : #true24
3 : #true48
4 : #gray8
5 : #gray16
default : undefined
)
)
)
if o[5] == "Alpha channel" do
(
png_alpha = ((windows.sendMessage o[1] 0x00F0 0 0) == 1)
)
)
press_button_by_name hwnd "Cancel"
)
)
)
catch(print (getCurrentException()))
true
)
fn get_output_png_settings =
(
DialogMonitorOPS.unRegisterNotification id:#pixamoon_output_png_settings
DialogMonitorOPS.RegisterNotification dialog_ops_re id:#pixamoon_output_png_settings
DialogMonitorOPS.Enabled = true
if not renderSceneDialog.isopen() do renderSceneDialog.open()
local hwnd
for o in windows.getChildrenHWND (windows.getDesktopHwnd()) where o[4] == "#32770" and matchPattern o[5] pattern:"Render Setup:*" and o[6] == windows.getMaxHwnd() do
(
hwnd = o[1]
exit
)
if hwnd == undefined then
(
messageBox "Couldn't find Render Setup Dialog"
)
else
(
press_button_by_name hwnd "Files..."
)
DialogMonitorOPS.unRegisterNotification id:#pixamoon_output_png_settings
DialogMonitorOPS.Enabled = false
)
if renderSceneDialog.isopen() do renderSceneDialog.commit()
if rendOutputFilename != undefined and toLower (getFilenameType rendOutputFilename) == ".png" then
(
png_type = undefined
png_alpha = undefined
get_output_png_settings()
print png_type
print png_alpha
)
else
(
messageBox "Output format is diffrent then .png"
)
ok
)
Best,
Pixamoon
antomor · 2019-08-07
Thank you for you solution. But this not my variant.
`
pixamoon · 2019-08-22
Sorry, so far I can find only this variant,
Let me know if you find other way to get output settings.
Best,
Pixamoon
.
jahman · 2019-08-22
does it work?
(
renderSceneDialog.close()
rendOutputFilename = ""
current_type = pngio.gettype() -- {#paletted|#true24|#true48|#gray8|#gray16}
case current_type of
(
#paletted : pngio.settype #true24
#true24 : pngio.settype #true48
#true48 : pngio.settype #gray8
#gray8 : pngio.settype #gray16
#gray16 : pngio.settype #paletted
default: pngio.settype #paletted
)
rendOutputFilename = "c:\\abc.png"
rendSaveFile = true
renderSceneDialog.update()
renderSceneDialog.open()
)