Skip to content

Commit

Permalink
Add render stamp support
Browse files Browse the repository at this point in the history
  • Loading branch information
usakhelo authored and dictoon committed Apr 29, 2018
1 parent c8ecd38 commit 308df1b
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ BEGIN
"SpinnerControl",WS_TABSTOP,84,79,6,10
END

IDD_FORMVIEW_RENDERERPARAMS_SYSTEM DIALOGEX 0, 0, 200, 73
IDD_FORMVIEW_RENDERERPARAMS_SYSTEM DIALOGEX 0, 0, 200, 87
STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
Expand All @@ -134,6 +134,8 @@ BEGIN
CONTROL "Open Log",IDC_BUTTON_LOG,"CustButton",WS_TABSTOP,110,20,42,12
CONTROL "Log material slots rendering",IDC_CHECK_LOG_MATERIAL_EDITOR,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,0,38,197,10
CONTROL "Render Stamp",IDC_CHECK_RENDER_STAMP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,0,73,59,10
CONTROL "Render Stamp Format",IDC_TEXT_RENDER_STAMP,"CustEdit",WS_TABSTOP,61,73,137,10
END

IDD_DIALOG_LOG DIALOGEX 150, 150, 364, 197
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,7 @@ namespace
HWND m_rollup;
ICustEdit* m_text_renderingthreads;
ISpinnerControl* m_spinner_renderingthreads;
ICustEdit* m_text_render_stamp;
AppleseedRenderer* m_renderer;

SystemPanel(
Expand All @@ -706,6 +707,7 @@ namespace
{
ReleaseISpinner(m_spinner_renderingthreads);
ReleaseICustEdit(m_text_renderingthreads);
ReleaseICustEdit(m_text_render_stamp);
m_rend_params->DeleteRollupPage(m_rollup);
}

Expand All @@ -726,6 +728,17 @@ namespace
CheckDlgButton(hwnd, IDC_CHECK_LOW_PRIORITY_MODE, m_settings.m_low_priority_mode ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwnd, IDC_CHECK_USE_MAX_PROCEDURAL_MAPS, m_settings.m_use_max_procedural_maps ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwnd, IDC_CHECK_LOG_MATERIAL_EDITOR, m_settings.m_log_material_editor_messages ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwnd, IDC_CHECK_RENDER_STAMP, m_settings.m_enable_render_stamp? BST_CHECKED : BST_UNCHECKED);

m_text_render_stamp = GetICustEdit(GetDlgItem(hwnd, IDC_TEXT_RENDER_STAMP));
m_text_render_stamp->SetText(m_settings.m_render_stamp_format);

enable_disable_controls();
}

void enable_disable_controls()
{
m_text_render_stamp->Enable(m_settings.m_enable_render_stamp);
}

virtual INT_PTR CALLBACK dialog_proc(
Expand All @@ -736,6 +749,17 @@ namespace
{
switch (umsg)
{
case WM_CUSTEDIT_ENTER:
switch (LOWORD(wparam))
{
case IDC_TEXT_RENDER_STAMP:
m_text_render_stamp->GetText(m_settings.m_render_stamp_format);
return TRUE;

default:
return FALSE;
}

case WM_COMMAND:
switch (LOWORD(wparam))
{
Expand Down Expand Up @@ -768,6 +792,11 @@ namespace
}
break;

case IDC_CHECK_RENDER_STAMP:
m_settings.m_enable_render_stamp = IsDlgButtonChecked(hwnd, IDC_CHECK_RENDER_STAMP) == BST_CHECKED;
enable_disable_controls();
return TRUE;

default:
return FALSE;
}
Expand Down
2 changes: 2 additions & 0 deletions src/appleseed-max-impl/appleseedrenderer/datachunks.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ const USHORT ChunkSettingsSystem = 0x1400;
const USHORT ChunkSettingsSystemRenderingThreads = 0x1410;
const USHORT ChunkSettingsSystemLowPriorityMode = 0x1420;
const USHORT ChunkSettingsSystemUseMaxProceduralMaps = 0x1430;
const USHORT ChunkSettingsSystemEnableRenderStamp = 0x1440;
const USHORT ChunkSettingsSystemRenderStampString = 0x1450;
4 changes: 3 additions & 1 deletion src/appleseed-max-impl/appleseedrenderer/projectbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,9 @@ namespace
.insert("tile_size", asf::Vector2i(settings.m_tile_size))
.insert("color_space", "linear_rgb")
.insert("filter", "blackman-harris")
.insert("filter_size", 1.5),
.insert("filter_size", 1.5)
.insert("enable_render_stamp", settings.m_enable_render_stamp)
.insert("render_stamp_format", wide_to_utf8(settings.m_render_stamp_format)),
aovs));

if (rend_params.rendType == RENDTYPE_REGION)
Expand Down
19 changes: 19 additions & 0 deletions src/appleseed-max-impl/appleseedrenderer/renderersettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ namespace
const int log_open_mode = load_system_setting(L"LogOpenMode", static_cast<int>(DialogLogTarget::OpenMode::Errors));
m_log_open_mode = static_cast<DialogLogTarget::OpenMode>(log_open_mode);
m_log_material_editor_messages = load_system_setting(L"LogMaterialEditorMessages", false);

m_enable_render_stamp = false;
m_render_stamp_format = L"appleseed {lib-version} | Time: {render-time}";
}
};
}
Expand Down Expand Up @@ -245,6 +248,14 @@ bool RendererSettings::save(ISave* isave) const
isave->BeginChunk(ChunkSettingsSystemUseMaxProceduralMaps);
success &= write<bool>(isave, m_use_max_procedural_maps);
isave->EndChunk();

isave->BeginChunk(ChunkSettingsSystemEnableRenderStamp);
success &= write<bool>(isave, m_enable_render_stamp);
isave->EndChunk();

isave->BeginChunk(ChunkSettingsSystemRenderStampString);
success &= write(isave, m_render_stamp_format);
isave->EndChunk();

isave->EndChunk();

Expand Down Expand Up @@ -469,6 +480,14 @@ IOResult RendererSettings::load_system_settings(ILoad* iload)
case ChunkSettingsSystemUseMaxProceduralMaps:
result = read<bool>(iload, &m_use_max_procedural_maps);
break;

case ChunkSettingsSystemEnableRenderStamp:
result = read<bool>(iload, &m_enable_render_stamp);
break;

case ChunkSettingsSystemRenderStampString:
result = read(iload, &m_render_stamp_format);
break;
}

if (result != IO_OK)
Expand Down
2 changes: 2 additions & 0 deletions src/appleseed-max-impl/appleseedrenderer/renderersettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ class RendererSettings
bool m_use_max_procedural_maps;
DialogLogTarget::OpenMode m_log_open_mode;
bool m_log_material_editor_messages;
bool m_enable_render_stamp;
MSTR m_render_stamp_format;

// Apply these settings to a given project.
void apply(renderer::Project& project) const;
Expand Down
3 changes: 3 additions & 0 deletions src/appleseed-max-impl/appleseedrenderer/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
#define IDC_STATIC_LOG 602
#define IDC_BUTTON_LOG 603
#define IDC_EDIT_LOG 604
#define IDC_CHECK_RENDER_STAMP 605
#define IDC_TEXT_RENDER_STAMP 606

#define ID_ACCELERATOR_LOG_CTRL_A 40001

// Next default values for new objects
Expand Down

0 comments on commit 308df1b

Please sign in to comment.