TerraForge3D  2.3.1
3D Terrain And Landscape Generator
DummyNode.cpp
1#include "Generators/CPUNodeEditor/Nodes/DummyNode.h"
2#include "Base/ImGuiShapes.h"
3#include "Generators/CPUNodeEditor/CPUNodeEditor.h"
4#include <iostream>
5
6NodeOutput DummyNode::Evaluate(NodeInputParam input, NodeEditorPin *pin)
7{
8 return NodeOutput();
9}
10
11bool DummyNode::OnLink(NodeEditorPin *pin, NodeEditorLink *link)
12{
13 std::cout << "OnLink -> (Pin:" << pin->id << " Link : " << link->to->id << "\n";
14 return true;
15}
16
17void DummyNode::OnDelete()
18{
19 std::cout << "OnDelete Node : " << id << "\n";
20}
21
22void DummyNode::Load(nlohmann::json data)
23{
24}
25
26nlohmann::json DummyNode::Save()
27{
28 nlohmann::json data;
29 data["type"] = MeshNodeEditor::MeshNodeType::Dummy;
30 return data;
31}
32
33void DummyNode::OnRender()
34{
35 DrawHeader("Dummy Node");
36 inputPins[0]->Render();
37 ImGui::Text("In");
38 ImGui::SameLine();
39 ImGui::Text("Out");
40 outputPins[0]->Render();
41 ImGui::Text("Stats");
42 ImGui::Text(("Node ID : " + std::to_string(id)).c_str());
43 bool tmp = inputPins[0]->IsLinked();
44 ImGui::Text("Inp Pin : ");
45 ImGui::SameLine();
46 ImGui::Checkbox(("##"+std::to_string(inputPins[0]->id)).c_str(), &tmp);
47 ImGui::Text(("ID : " + std::to_string(inputPins[0]->id)).c_str());
48 tmp = outputPins[0]->IsLinked();
49 ImGui::Text("Out Pin : ");
50 ImGui::SameLine();
51 ImGui::Checkbox(("##" + std::to_string(inputPins[0]->id)).c_str(), &tmp);
52 ImGui::Text(("ID : " + std::to_string(outputPins[0]->id)).c_str());
53}
54
55DummyNode::DummyNode()
56{
57 headerColor = ImColor(DUMMY_NODE_COLOR);
58 inputPins.push_back(new NodeEditorPin());
59 outputPins.push_back(new NodeEditorPin(NodeEditorPinType::Output));
60}
a class to store JSON values
Definition: json.hpp:17860