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

Method propertyEditor

source/MaterialXGraphEditor/Graph.cpp:3271–3719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3269}
3270
3271void Graph::propertyEditor()
3272{
3273 // Get parent dimensions
3274 ImVec2 textPos = ImGui::GetCursorScreenPos(); // Position for the background
3275 float parentWidth = ImGui::GetContentRegionAvail().x; // Available width in the parent
3276
3277 // Draw the title bar
3278 const ImGuiStyle& style = ImGui::GetStyle();
3279 ImVec4 menuBarBgColor = style.Colors[ImGuiCol_MenuBarBg];
3280 ImU32 bgColor = ImGui::ColorConvertFloat4ToU32(menuBarBgColor); // Convert to 32-bit color
3281 ImDrawList* drawList = ImGui::GetWindowDrawList();
3282 drawList->AddRectFilled(textPos,
3283 ImVec2(textPos.x + parentWidth, textPos.y + ImGui::GetTextLineHeight()),
3284 bgColor);
3285 ImGui::Text("Node Property Editor");
3286
3287 if (_currUiNode)
3288 {
3289 // Set and edit name
3290 ImGui::Text("Name: ");
3291 ImGui::SameLine();
3292 std::string original = _currUiNode->getName();
3293 std::string temp = original;
3294 float availableWidth = ImGui::GetContentRegionAvail().x;
3295 ImGui::PushItemWidth(availableWidth);
3296 ImGui::InputText("##edit", &temp);
3297 ImGui::PopItemWidth();
3298
3299 std::string docString = "NodeDef Doc String: \n";
3300 if (_currUiNode->getNode())
3301 {
3302 if (temp != original)
3303 {
3304 std::string name = _currUiNode->getNode()->getParent()->createValidChildName(temp);
3305
3306 std::vector<UiNodePtr> downstreamNodes = _currUiNode->getOutputConnections();
3307 for (UiNodePtr uiNode : downstreamNodes)
3308 {
3309 if (!uiNode->getInput() && uiNode->getNode())
3310 {
3311 for (mx::InputPtr input : uiNode->getNode()->getActiveInputs())
3312 {
3313 if (input->getConnectedNode() == _currUiNode->getNode())
3314 {
3315 _currUiNode->getNode()->setName(name);
3316 uiNode->getNode()->setConnectedNode(input->getName(), _currUiNode->getNode());
3317 }
3318 }
3319 }
3320 }
3321 _currUiNode->setName(name);
3322 _currUiNode->getNode()->setName(name);
3323 }
3324 }
3325 else if (_currUiNode->getInput())
3326 {
3327 mx::InputPtr currUINodeInput = _currUiNode->getInput();
3328

Callers

nothing calls this directly

Calls 15

getUIPropertiesFunction · 0.85
getActiveInputsMethod · 0.80
getInterfaceInputMethod · 0.80
getNodeGraphMethod · 0.80
getCategoryMethod · 0.80
setAttributeMethod · 0.80
c_strMethod · 0.80
setShowAllInputsMethod · 0.80
getConnectedMethod · 0.80

Tested by

no test coverage detected