Move preview renderer and HDR pickers above the shader ball

Drop the 'Shader Ball' label; the renderer switch and HDR environment
dropdowns sit side by side at the top of the preview column, above the
swatch. Both pickers take an optional item width.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-06 03:26:39 +08:00
parent c5ca6a7501
commit 6b8cb2406e
3 changed files with 14 additions and 12 deletions
+6 -6
View File
@@ -287,8 +287,12 @@ void MaterialEditorPanel::Render() {
}
void MaterialEditorPanel::RenderPreviewPanel() {
ImGui::TextUnformatted("Shader Ball");
ImGui::Separator();
// Renderer switch and HDR environment side by side above the preview.
const float halfWidth =
(ImGui::GetContentRegionAvail().x - ImGui::GetStyle().ItemSpacing.x) * 0.5f;
m_preview.RenderRendererDropdown(halfWidth);
ImGui::SameLine();
m_preview.RenderLightingDropdown(halfWidth);
if (m_stage && !m_materialPath.IsEmpty()) {
// Hypershade-style: with a node selected, the ball previews that
@@ -324,10 +328,6 @@ void MaterialEditorPanel::RenderPreviewPanel() {
ImGui::Dummy(ImVec2(size, size));
}
ImGui::Separator();
m_preview.RenderRendererDropdown();
m_preview.RenderLightingDropdown();
ImGui::Separator();
ImGui::TextUnformatted("Node Properties");
ImGui::Separator();
+4 -4
View File
@@ -257,9 +257,9 @@ void MaterialPreviewRenderer::UpdateDomeOrientation() {
m_dirty = true;
}
void MaterialPreviewRenderer::RenderLightingDropdown() {
void MaterialPreviewRenderer::RenderLightingDropdown(float width) {
if (!m_initialized) return;
ImGui::SetNextItemWidth(-1.0f);
ImGui::SetNextItemWidth(width);
if (ImGui::BeginCombo("##PreviewLighting", kLightPresets[m_lightPreset].label)) {
for (int i = 0; i < kLightPresetCount; ++i) {
if (ImGui::Selectable(kLightPresets[i].label, i == m_lightPreset) && i != m_lightPreset)
@@ -309,13 +309,13 @@ void MaterialPreviewRenderer::SetColorCorrection(int ccMode, const std::string&
m_dirty = true;
}
void MaterialPreviewRenderer::RenderRendererDropdown() {
void MaterialPreviewRenderer::RenderRendererDropdown(float width) {
pxr::TfToken currentId = m_renderer.GetCurrentRendererId();
std::string displayName = currentId.IsEmpty()
? "Renderer"
: UsdSceneRenderer::GetRendererDisplayName(currentId);
ImGui::Button(displayName.c_str(), ImVec2(-1.0f, 0.0f));
ImGui::Button(displayName.c_str(), ImVec2(width, 0.0f));
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Shader-ball render delegate");
+4 -2
View File
@@ -50,12 +50,14 @@ public:
const std::string& ocioLook);
/// Renderer-delegate picker UI (matches the viewport's dropdown pattern).
void RenderRendererDropdown();
/// width: ImGui item width (-1 = fill available).
void RenderRendererDropdown(float width = -1.0f);
/// HDR-environment picker (External / Room / Interior / Sunset). Presets
/// map to bundled resources/hdri/*.exr dome-light textures; a preset
/// whose file is missing falls back to the distant key light.
void RenderLightingDropdown();
/// width: ImGui item width (-1 = fill available).
void RenderLightingDropdown(float width = -1.0f);
private:
void EnsureInitialized();