|
18 | 18 | namespace |
19 | 19 | { |
20 | 20 |
|
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()) |
22 | 41 | { |
23 | | - fprintf(stderr, "Glfw Error %d: %s\n", error, description); |
| 42 | + return; |
24 | 43 | } |
25 | 44 |
|
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) |
39 | 47 | { |
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; |
53 | 50 | } |
54 | 51 |
|
| 52 | + res = value->asA<T>(); |
| 53 | +} |
| 54 | + |
55 | 55 | } // anonymous namespace |
56 | 56 |
|
57 | 57 | int main(int argc, char* const argv[]) |
@@ -203,11 +203,11 @@ int main(int argc, char* const argv[]) |
203 | 203 |
|
204 | 204 | // Create graph editor. |
205 | 205 | 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); |
211 | 211 | if (!captureFilename.empty()) |
212 | 212 | { |
213 | 213 | graph->getRenderer()->requestFrameCapture(captureFilename); |
@@ -262,7 +262,7 @@ int main(int argc, char* const argv[]) |
262 | 262 | double xpos = 0.0; |
263 | 263 | double ypos = 0.0; |
264 | 264 | glfwGetCursorPos(window, &xpos, &ypos); |
265 | | - graph->drawGraph(ImVec2((float)xpos, (float)ypos)); |
| 265 | + graph->drawGraph(ImVec2((float) xpos, (float) ypos)); |
266 | 266 | ImGui::Render(); |
267 | 267 | ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); |
268 | 268 | glfwSwapBuffers(window); |
|
0 commit comments