MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/MaterialX / Graph

Method Graph

source/MaterialXGraphEditor/Graph.cpp:123–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121//
122
123Graph::Graph(const std::string& materialFilename,
124 const std::string& meshFilename,
125 const mx::FileSearchPath& searchPath,
126 const mx::FilePathVec& libraryFolders,
127 int viewWidth,
128 int viewHeight,
129 float previewWidth) :
130 _materialFilename(materialFilename),
131 _searchPath(searchPath),
132 _libraryFolders(libraryFolders),
133 _needsLayout(false),
134 _layoutPending(false),
135 _needsNavigation(false),
136 _delete(false),
137 _fileDialogSave(FileDialog::EnterNewFilename),
138 _popup(false),
139 _shaderPopup(false),
140 _searchNodeId(-1),
141 _addNewNode(false),
142 _ctrlClick(false),
143 _isCut(false),
144 _autoLayout(false),
145 _frameCount(INT_MIN),
146 _fontScale(1.0f),
147 _previewSize(previewWidth),
148 _saveNodePositions(true)
149{
150 loadStandardLibraries();
151 setPinColor();
152
153 // Set up filters load and save
154 _mtlxFilter.push_back(".mtlx");
155 _geomFilter.push_back(".obj");
156 _geomFilter.push_back(".glb");
157 _geomFilter.push_back(".gltf");
158
159 _graphDoc = loadDocument(materialFilename);
160 createNodeUIList(_stdLib);
161 initializeGraph();
162
163 // Create a renderer using the initial startup document.
164 mx::FilePath captureFilename = "resources/Materials/Examples/example.png";
165 std::string envRadianceFilename = "resources/Lights/san_giuseppe_bridge_split.hdr";
166 _renderer = std::make_shared<RenderView>(_graphDoc, _stdLib, meshFilename, envRadianceFilename,
167 _searchPath, viewWidth, viewHeight);
168 _renderer->initialize();
169 for (const std::string& ext : _renderer->getImageHandler()->supportedExtensions())
170 {
171 _imageFilter.emplace_back("." + ext);
172 }
173 _renderer->updateMaterials(nullptr);
174 for (const std::string& incl : _renderer->getXincludeFiles())
175 {
176 _xincludeFiles.insert(incl);
177 }
178}
179
180mx::ElementPredicate Graph::getElementPredicate() const

Callers

nothing calls this directly

Calls 7

push_backMethod · 0.80
insertMethod · 0.80
loadStandardLibrariesFunction · 0.50
initializeMethod · 0.45
supportedExtensionsMethod · 0.45
getImageHandlerMethod · 0.45
updateMaterialsMethod · 0.45

Tested by

no test coverage detected