Skip to content

Commit

Permalink
Change parameter name to uiScale
Browse files Browse the repository at this point in the history
  • Loading branch information
virokannas committed Jun 28, 2024
1 parent b22e289 commit 8c8b522
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions source/MaterialXGraphEditor/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const std::string options =
" --path [FILEPATH] Specify an additional data search path location (e.g. '/projects/MaterialX'). This absolute path will be queried when locating data libraries, XInclude references, and referenced images.\n"
" --library [FILEPATH] Specify an additional data library folder (e.g. 'vendorlib', 'studiolib'). This relative path will be appended to each location in the data search path when loading data libraries.\n"
" --captureFilename [FILENAME] Specify the filename to which the first rendered frame should be written\n"
" --scaleFactor [FACTOR] Manually specify a HiDPI scaling factor\n"
" --uiScale [FACTOR] Manually specify a HiDPI scaling factor\n"
" --help Display the complete list of command-line options\n";

template <class T> void parseToken(std::string token, std::string type, T& res)
Expand Down Expand Up @@ -66,7 +66,7 @@ int main(int argc, char* const argv[])
mx::FilePathVec libraryFolders;
int viewWidth = 256;
int viewHeight = 256;
float scaleFactor = 0.0;
float uiScaleFactor = 0.0;
std::string captureFilename;

for (size_t i = 0; i < tokens.size(); i++)
Expand Down Expand Up @@ -102,12 +102,12 @@ int main(int argc, char* const argv[])
{
parseToken(nextToken, "string", captureFilename);
}
else if (token == "--scaleFactor")
else if (token == "--uiScale")
{
parseToken(nextToken, "float", scaleFactor);
if (scaleFactor <= 0.0) {
parseToken(nextToken, "float", uiScaleFactor);
if (uiScaleFactor <= 0.0) {
std::cout << "Scale factor must be a positive, non-zero value. Ignoring the supplied value." << std::endl;
scaleFactor = 0.0;
uiScaleFactor = 0.0;
}
}
else if (token == "--help")
Expand Down Expand Up @@ -209,9 +209,9 @@ int main(int argc, char* const argv[])
float xscale = 1.0f, yscale = 1.0f;
glfwGetMonitorContentScale(monitor, &xscale, &yscale);
ImGuiStyle& style = ImGui::GetStyle();
float dpiScale = scaleFactor == 0.0 ? (xscale > yscale ? xscale : yscale) : scaleFactor;
style.ScaleAllSizes(dpiScale);
graph->setFontScale(dpiScale);
float uiScale = uiScaleFactor == 0.0 ? (xscale > yscale ? xscale : yscale) : uiScaleFactor;
style.ScaleAllSizes(uiScale);
graph->setFontScale(uiScale);
}

// Create editor config and context.
Expand Down

0 comments on commit 8c8b522

Please sign in to comment.