diff --git a/lib/mayaHydra/mayaPlugin/plugin.cpp b/lib/mayaHydra/mayaPlugin/plugin.cpp index 8624510a4..af7e160aa 100644 --- a/lib/mayaHydra/mayaPlugin/plugin.cpp +++ b/lib/mayaHydra/mayaPlugin/plugin.cpp @@ -69,6 +69,16 @@ namespace { std::vector _renderOverrides; std::vector _pluginLoadingCallbackIds; + + void setEnvVar(const char* envVarSet) + { + // putenv requires char* and I'm not willing to use const cast! + const auto envVarSize = strlen(envVarSet) + 1; + std::vector envVarData; + envVarData.resize(envVarSize); + snprintf(envVarData.data(), envVarSize, "%s", envVarSet); + putenv(envVarData.data()); + } } void initialize() @@ -133,14 +143,11 @@ PLUGIN_EXPORT MStatus initializePlugin(MObject obj) return ret; } - // For now this is required for the HdSt backed to use lights. - // putenv requires char* and I'm not willing to use const cast! - constexpr const char* envVarSet = "USDIMAGING_ENABLE_SCENE_LIGHTS=1"; - const auto envVarSize = strlen(envVarSet) + 1; - std::vector envVarData; - envVarData.resize(envVarSize); - snprintf(envVarData.data(), envVarSize, "%s", envVarSet); - putenv(envVarData.data()); + // For now this is required for the HdSt backend to use lights. + setEnvVar("USDIMAGING_ENABLE_SCENE_LIGHTS=1"); + + // Performance optimization: disable RENDER_SELECTED_EDGE_FROM_FACE feature that could trigger unnecessary running of gometry shader. + setEnvVar("HDST_RENDER_SELECTED_EDGE_FROM_FACE=0"); MFnPlugin plugin(obj, "Autodesk", PLUGIN_VERSION, "Any");