Persist material editor column widths in preferences
MaterialBrowserWidth / MaterialPreviewWidth in preferences.ini, saved from the live splitter positions on shutdown and restored (clamped to the splitter ranges) at startup. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -424,11 +424,25 @@ void Application::LoadPreferences()
|
||||
else if (key == "OcioView") m_prefs.ocioView = val;
|
||||
else if (key == "OcioColorSpace") m_prefs.ocioColorSpace = val;
|
||||
else if (key == "OcioLook") m_prefs.ocioLook = val;
|
||||
else if (key == "MaterialBrowserWidth")
|
||||
m_prefs.materialBrowserWidth = [&]{ try { return std::stof(val); } catch(...){ return 220.0f; } }();
|
||||
else if (key == "MaterialPreviewWidth")
|
||||
m_prefs.materialPreviewWidth = [&]{ try { return std::stof(val); } catch(...){ return 320.0f; } }();
|
||||
}
|
||||
|
||||
if (m_materialEditorPanel)
|
||||
m_materialEditorPanel->SetColumnWidths(m_prefs.materialBrowserWidth,
|
||||
m_prefs.materialPreviewWidth);
|
||||
}
|
||||
|
||||
void Application::SavePreferences()
|
||||
{
|
||||
// Pull the latest splitter positions; called from Shutdown before the
|
||||
// panel is reset, and from the preferences dialog while it's alive.
|
||||
if (m_materialEditorPanel)
|
||||
m_materialEditorPanel->GetColumnWidths(m_prefs.materialBrowserWidth,
|
||||
m_prefs.materialPreviewWidth);
|
||||
|
||||
std::ofstream f(m_prefsPath);
|
||||
if (!f) return;
|
||||
f << "[Preferences]\n";
|
||||
@@ -438,6 +452,8 @@ void Application::SavePreferences()
|
||||
f << "OcioView=" << m_prefs.ocioView << "\n";
|
||||
f << "OcioColorSpace=" << m_prefs.ocioColorSpace << "\n";
|
||||
f << "OcioLook=" << m_prefs.ocioLook << "\n";
|
||||
f << "MaterialBrowserWidth=" << m_prefs.materialBrowserWidth << "\n";
|
||||
f << "MaterialPreviewWidth=" << m_prefs.materialPreviewWidth << "\n";
|
||||
}
|
||||
|
||||
void Application::ApplyPrefsToAllViewports()
|
||||
|
||||
Reference in New Issue
Block a user