Skip to content

Commit fd0e003

Browse files
committed
Revert main.
1 parent 740a571 commit fd0e003

1 file changed

Lines changed: 34 additions & 34 deletions

File tree

source/MaterialXGraphEditor/Main.cpp

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,40 @@
1818
namespace
1919
{
2020

21-
static void errorCallback(int error, const char* description)
21+
static void errorCallback(int error, const char* description)
22+
{
23+
fprintf(stderr, "Glfw Error %d: %s\n", error, description);
24+
}
25+
26+
const std::string options =
27+
" Options: \n"
28+
" --material [FILENAME] Specify the filename of the MTLX document to be displayed in the graph editor\n"
29+
" --mesh [FILENAME] Specify the filename of the OBJ or glTF mesh to be displayed in the graph editor\n"
30+
" --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"
31+
" --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"
32+
" --uiScale [FACTOR] Manually specify a UI scaling factor\n"
33+
" --font [FILENAME] Specify the name of the custom font file to use. If not specified the default font will be used.\n"
34+
" --fontSize [SIZE] Specify font size to use for the custom font. If not specified a default of 18 will be used.\n"
35+
" --captureFilename [FILENAME] Specify the filename to which the first rendered frame should be written\n"
36+
" --help Display the complete list of command-line options\n";
37+
38+
template <class T> void parseToken(std::string token, std::string type, T& res)
39+
{
40+
if (token.empty())
2241
{
23-
fprintf(stderr, "Glfw Error %d: %s\n", error, description);
42+
return;
2443
}
2544

26-
const std::string options =
27-
" Options: \n"
28-
" --material [FILENAME] Specify the filename of the MTLX document to be displayed in the graph editor\n"
29-
" --mesh [FILENAME] Specify the filename of the OBJ or glTF mesh to be displayed in the graph editor\n"
30-
" --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"
31-
" --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"
32-
" --uiScale [FACTOR] Manually specify a UI scaling factor\n"
33-
" --font [FILENAME] Specify the name of the custom font file to use. If not specified the default font will be used.\n"
34-
" --fontSize [SIZE] Specify font size to use for the custom font. If not specified a default of 18 will be used.\n"
35-
" --captureFilename [FILENAME] Specify the filename to which the first rendered frame should be written\n"
36-
" --help Display the complete list of command-line options\n";
37-
38-
template <class T> void parseToken(std::string token, std::string type, T& res)
45+
mx::ValuePtr value = mx::Value::createValueFromStrings(token, type);
46+
if (!value)
3947
{
40-
if (token.empty())
41-
{
42-
return;
43-
}
44-
45-
mx::ValuePtr value = mx::Value::createValueFromStrings(token, type);
46-
if (!value)
47-
{
48-
std::cout << "Unable to parse token " << token << " as type " << type << std::endl;
49-
return;
50-
}
51-
52-
res = value->asA<T>();
48+
std::cout << "Unable to parse token " << token << " as type " << type << std::endl;
49+
return;
5350
}
5451

52+
res = value->asA<T>();
53+
}
54+
5555
} // anonymous namespace
5656

5757
int main(int argc, char* const argv[])
@@ -203,11 +203,11 @@ int main(int argc, char* const argv[])
203203

204204
// Create graph editor.
205205
Graph* graph = new Graph(materialFilename,
206-
meshFilename,
207-
searchPath,
208-
libraryFolders,
209-
viewWidth,
210-
viewHeight);
206+
meshFilename,
207+
searchPath,
208+
libraryFolders,
209+
viewWidth,
210+
viewHeight);
211211
if (!captureFilename.empty())
212212
{
213213
graph->getRenderer()->requestFrameCapture(captureFilename);
@@ -262,7 +262,7 @@ int main(int argc, char* const argv[])
262262
double xpos = 0.0;
263263
double ypos = 0.0;
264264
glfwGetCursorPos(window, &xpos, &ypos);
265-
graph->drawGraph(ImVec2((float)xpos, (float)ypos));
265+
graph->drawGraph(ImVec2((float) xpos, (float) ypos));
266266
ImGui::Render();
267267
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
268268
glfwSwapBuffers(window);

0 commit comments

Comments
 (0)