Add per-viewport cull style option
Exposes UsdImagingGLCullStyle as a Cull Style sub-menu in the gear popup (Back Unless Double-Sided / Back / Front / Nothing / No Opinion). Defaults to BackUnlessDoubleSided, matching usdview. Setting persists per-viewport to viewport_settings.ini. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -670,6 +670,7 @@ void ViewportPanel::SaveSettings(const std::string& path) const
|
||||
f << "AmbientLightOnly=" << (s.ambientLightOnly ? 1 : 0) << "\n";
|
||||
f << "DomeLightEnabled=" << (s.domeLightEnabled ? 1 : 0) << "\n";
|
||||
f << "ShadingMode=" << s.shadingMode << "\n";
|
||||
f << "CullStyle=" << s.cullStyle << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -741,6 +742,7 @@ void ViewportPanel::LoadSettings(const std::string& path)
|
||||
else if (key == "AmbientLightOnly") ts.ambientLightOnly = (val == "1");
|
||||
else if (key == "DomeLightEnabled") ts.domeLightEnabled = (val == "1");
|
||||
else if (key == "ShadingMode") ts.shadingMode = toInt(val, ts.shadingMode);
|
||||
else if (key == "CullStyle") ts.cullStyle = toInt(val, ts.cullStyle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ ViewportTileSettings ViewportTile::GetSettings() const
|
||||
s.ambientLightOnly = m_renderer.GetAmbientLightOnly();
|
||||
s.domeLightEnabled = m_renderer.GetDomeLightEnabled();
|
||||
s.shadingMode = static_cast<int>(m_renderer.GetShadingMode());
|
||||
s.cullStyle = static_cast<int>(m_renderer.GetCullStyle());
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -126,6 +127,7 @@ void ViewportTile::ApplySettings(const ViewportTileSettings& s)
|
||||
m_renderer.SetAmbientLightOnly(s.ambientLightOnly);
|
||||
m_renderer.SetDomeLightEnabled(s.domeLightEnabled);
|
||||
m_renderer.SetShadingMode(static_cast<ShadingMode>(s.shadingMode));
|
||||
m_renderer.SetCullStyle(static_cast<CullStyle>(s.cullStyle));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -1018,6 +1020,21 @@ void ViewportTile::RenderCompactToolbar(int tileIndex)
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
// -- Cull Style --------------------------------------------------
|
||||
if (ImGui::BeginMenu("Cull Style")) {
|
||||
CullStyle curCull = m_renderer.GetCullStyle();
|
||||
auto cullItem = [&](const char* label, CullStyle style) {
|
||||
if (ImGui::MenuItem(label, nullptr, curCull == style))
|
||||
m_renderer.SetCullStyle(style);
|
||||
};
|
||||
cullItem("Back Unless Double-Sided", CullStyle::BackUnlessDoubleSided);
|
||||
cullItem("Back", CullStyle::Back);
|
||||
cullItem("Front", CullStyle::Front);
|
||||
cullItem("Nothing", CullStyle::Nothing);
|
||||
cullItem("No Opinion", CullStyle::NoOpinion);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
// -- AOV ---------------------------------------------------------
|
||||
{
|
||||
pxr::TfTokenVector aovs = m_renderer.GetRendererAovs();
|
||||
|
||||
@@ -32,6 +32,7 @@ struct ViewportTileSettings {
|
||||
bool ambientLightOnly = true;
|
||||
bool domeLightEnabled = false;
|
||||
int shadingMode = 0;
|
||||
int cullStyle = 4; // CullStyle::BackUnlessDoubleSided
|
||||
bool showGuides = false;
|
||||
bool showProxy = true;
|
||||
bool showRender = false;
|
||||
|
||||
Reference in New Issue
Block a user