TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ Update()

void CPUNodeEditor::Update ( )

Definition at line 330 of file CPUNodeEditor.cpp.

331{
332 if(windowStat)
333 {
334 ImGui::Begin((name + "##" + uid).c_str(), &windowStat);
335
336 if (ImGui::Button(("Add Node##CPUNE" + uid).c_str()))
337 {
338 ImGui::OpenPopup("NodeMakerDropped");
339 }
340
341 ImGui::SameLine();
342
343 if (ImGui::Button(("Reset##CPUNE" + uid).c_str()))
344 {
345 editor->Reset();
346 }
347
348 ImGui::SameLine();
349
350 if (ImGui::Button(("Export##CPUNE" + uid).c_str()))
351 {
352 std::string file = ShowSaveFileDialog("*.terr3d");
353
354 if (file.size() > 3)
355 {
356 if (file.find(".terr3d") == std::string::npos)
357 {
358 file += ".terr3d";
359 }
360
361 SaveToFile(file, editor->Save().dump(4));
362 }
363 }
364
365 ImGui::SameLine();
366
367 if (ImGui::Button(("Import##CPUNE" + uid).c_str()))
368 {
369 std::string file = ShowOpenFileDialog("*.terr3d");
370
371 if (file.size() > 3)
372 {
373 bool tmp = false;
374 editor->Reset();
375 editor->Load(nlohmann::json::parse(ReadShaderSourceFile(file, &tmp)));
376 }
377 }
378
379 editor->Render();
380
381 if (ImGui::IsWindowFocused() && (((IsKeyDown(TERR3D_KEY_RIGHT_SHIFT) || IsKeyDown(TERR3D_KEY_LEFT_SHIFT)) && IsKeyDown(TERR3D_KEY_A)) || IsMouseButtonDown(TERR3D_MOUSE_BUTTON_MIDDLE)))
382 {
383 ImGui::OpenPopup("NodeMakerDropped");
384 }
385
386 if(ImGui::BeginPopup("NodeMakerDropped"))
387 {
388 ShowNodeMaker(uid, editor);
389
390 if (ImGui::Button(("Close##CPUNE" + uid).c_str()))
391 {
392 ImGui::CloseCurrentPopup();
393 }
394
395 ImGui::EndPopup();
396 }
397
398 ImGui::End();
399 }
400}
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json parse(InputType &&i, const parser_callback_t cb=nullptr, const bool allow_exceptions=true, const bool ignore_comments=false)
deserialize from a compatible input
Definition: json.hpp:24605
string_t dump(const int indent=-1, const char indent_char=' ', const bool ensure_ascii=false, const error_handler_t error_handler=error_handler_t::strict) const
serialization
Definition: json.hpp:20117