Skip to content

Commit

Permalink
HYDRA-973 - set HDST_RENDER_SELECTED_EDGE_FROM_FACE as 0 by default (#…
Browse files Browse the repository at this point in the history
…171)

* set HDST_RENDER_SELECTED_EDGE_FROM_FACE as 0 by default

* fix build warning on Mac/Linux
  • Loading branch information
lilike-adsk authored Sep 26, 2024
1 parent 1b69d5f commit 72fbaff
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions lib/mayaHydra/mayaPlugin/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ namespace {
std::vector<PXR_NS::MtohRenderOverride*> _renderOverrides;

std::vector<MCallbackId> _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<char> envVarData;
envVarData.resize(envVarSize);
snprintf(envVarData.data(), envVarSize, "%s", envVarSet);
putenv(envVarData.data());
}
}

void initialize()
Expand Down Expand Up @@ -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<char> 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");

Expand Down

0 comments on commit 72fbaff

Please sign in to comment.