message: add texture add/replace functionality
  minor UI cleanup
diff: @@ -2266,6 +2266,7 @@ void MainWindow::buildWindowMaterialEditor()
  ImGui::TextDisabled("copied: '%s'", g_copiedMat->name().c_str());
  }
  + ImGui::Spacing();
  ImGui::Text("Replace material");
  static int currentMatType = 0;
  const char *matTypes[] = {"principled", "carPaint", "obj", "luminous"};
  @@ -2274,6 +2275,55 @@ void MainWindow::buildWindowMaterialEditor()
  auto newMat = sg::createNode(matName, matTypes[currentMatType]);
  baseMaterialRegistry->add(newMat);
  }
  +
  + ImGui::Spacing();
  + ImGui::Text("Add texture");
  + static bool showTextureFileBrowser = false;
  + static rkcommon::FileName matTexFileName("");
  + static char matTexParamName[64] = "";
  + ImGui::InputTextWithHint("texture##material",
  + "select...",
  + (char *)matTexFileName.base().c_str(),
  + 0);
  + if (ImGui::IsItemClicked())
  + showTextureFileBrowser = true;
  +
  + // Leave the fileBrowser open until file is selected
  + if (showTextureFileBrowser) {
  + FileList fileList = {};
  + if (fileBrowser(fileList, "Select Texture")) {
  + showTextureFileBrowser = false;
  + if (!fileList.empty()) {
  + matTexFileName = fileList[0];
  + }
  + }
  + }
  +
  + ImGui::InputText(
  + "paramName##material", matTexParamName, sizeof(matTexParamName));
  + if (ImGui::Button("Add##materialtexture")) {
  + std::string paramStr(matTexParamName);
  + if (!paramStr.empty()) {
  + std::shared_ptr<sg::Texture2D> sgTex =
  + std::static_pointer_cast<sg::Texture2D>(
  + sg::createNode(paramStr, "texture_2d"));
  + sgTex->load(matTexFileName, true, false);
  + auto newMat =
  + sg::createNode(selectedMat->name(), selectedMat->subType());
  + for (auto &c : selectedMat->children()) {
  + // keep existing textures if they're not the one we're currently
  + // adding/replacing
  + if (c.second->name() != "handles" && c.second->name() != paramStr) {
  + if (c.second->name().substr(0, 4) == "map_")
  + newMat->add(c.second);
  + else
  + newMat->child(c.second->name()).setValue(c.second->value());
  + }
  + }
  + newMat->add(sgTex, paramStr);
  + baseMaterialRegistry->add(newMat);
  + }
  + }
  }
  }
  ImGui::EndTabItem();
  