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:
@@ -148,6 +148,11 @@ std::vector<const ShaderNodeTypeInfo*> FilterShaderNodeTypes(
|
||||
return matches;
|
||||
}
|
||||
|
||||
// Clamp range shared by the column splitters and SetColumnWidths (persisted
|
||||
// preferences may carry hand-edited or stale values).
|
||||
constexpr float kBrowserMinWidth = 140.0f, kBrowserMaxWidth = 500.0f;
|
||||
constexpr float kPreviewMinWidth = 220.0f, kPreviewMaxWidth = 640.0f;
|
||||
|
||||
// Vertical drag-splitter between the material editor's columns. Adjusts
|
||||
// *width by the mouse drag (negated for a right-hand column, which grows
|
||||
// when dragged left); colours match the viewport's split dividers.
|
||||
@@ -238,6 +243,11 @@ void MaterialEditorPanel::SetStage(pxr::UsdStageRefPtr stage) {
|
||||
m_browserSelection = pxr::SdfPath();
|
||||
}
|
||||
|
||||
void MaterialEditorPanel::SetColumnWidths(float browserWidth, float previewWidth) {
|
||||
m_browserWidth = std::clamp(browserWidth, kBrowserMinWidth, kBrowserMaxWidth);
|
||||
m_previewWidth = std::clamp(previewWidth, kPreviewMinWidth, kPreviewMaxWidth);
|
||||
}
|
||||
|
||||
void MaterialEditorPanel::SetColorCorrectionFromPrefs(int ccMode, const std::string& ocioDisplay,
|
||||
const std::string& ocioView,
|
||||
const std::string& ocioColorSpace,
|
||||
@@ -261,14 +271,14 @@ void MaterialEditorPanel::Render() {
|
||||
RenderMaterialBrowser();
|
||||
ImGui::EndChild();
|
||||
|
||||
VerticalSplitter("##MaterialSplitL", &m_browserWidth, 140.0f, 500.0f,
|
||||
VerticalSplitter("##MaterialSplitL", &m_browserWidth, kBrowserMinWidth, kBrowserMaxWidth,
|
||||
/*rightSideColumn=*/false);
|
||||
|
||||
ImGui::BeginChild("MaterialCanvasRegion", ImVec2(-(m_previewWidth + 6.0f), 0.0f), false);
|
||||
RenderNodeGraphCanvas();
|
||||
ImGui::EndChild();
|
||||
|
||||
VerticalSplitter("##MaterialSplitR", &m_previewWidth, 220.0f, 640.0f,
|
||||
VerticalSplitter("##MaterialSplitR", &m_previewWidth, kPreviewMinWidth, kPreviewMaxWidth,
|
||||
/*rightSideColumn=*/true);
|
||||
|
||||
ImGui::BeginChild("MaterialPreviewRegion", ImVec2(0.0f, 0.0f), true);
|
||||
|
||||
Reference in New Issue
Block a user