1
0
mirror of synced 2024-12-01 02:37:18 +01:00

Added comments node

This commit is contained in:
WerWolv 2021-02-04 12:46:38 +01:00
parent 5eb289f1fe
commit ac100936c7
2 changed files with 26 additions and 4 deletions

View File

@ -112,6 +112,24 @@ namespace hex::plugin::builtin {
ImColor m_color;
};
class NodeComment : public dp::Node {
public:
NodeComment() : Node("Comment", { }) {
this->m_comment.resize(0xFFF, 0x00);
}
void drawNode() override {
ImGui::InputTextMultiline("##string", reinterpret_cast<char*>(this->m_comment.data()), this->m_comment.size() - 1, ImVec2(150, 100));
}
void process() override {
}
private:
std::string m_comment;
};
class NodeDisplayInteger : public dp::Node {
public:
@ -461,8 +479,8 @@ namespace hex::plugin::builtin {
std::vector<u8> output;
for (u32 i = 0; i < input.size(); i += 2) {
char c1 = tolower(input[i]);
char c2 = tolower(input[i + 1]);
char c1 = static_cast<char>(std::tolower(input[i]));
char c2 = static_cast<char>(std::tolower(input[i + 1]));
if (!std::isxdigit(c1) || !isxdigit(c2))
throwNodeError("Can't decode non-hexadecimal character");
@ -491,6 +509,7 @@ namespace hex::plugin::builtin {
ContentRegistry::DataProcessorNode::add<NodeNullptr>("Constants", "Nullptr");
ContentRegistry::DataProcessorNode::add<NodeString>("Constants", "String");
ContentRegistry::DataProcessorNode::add<NodeRGBA8>("Constants", "RGBA8 Color");
ContentRegistry::DataProcessorNode::add<NodeComment>("Constants", "Comment");
ContentRegistry::DataProcessorNode::add<NodeDisplayInteger>("Display", "Integer");
ContentRegistry::DataProcessorNode::add<NodeDisplayFloat>("Display", "Float");

View File

@ -123,7 +123,6 @@ namespace hex {
printf("Node implementation bug! %s\n", e.what());
}
}
void ViewDataProcessor::drawContent() {
@ -185,12 +184,16 @@ namespace hex {
this->m_nodes.push_back(node);
bool hasOutput = false;
bool hasInput = false;
for (auto &attr : node->getAttributes()) {
if (attr.getIOType() == dp::Attribute::IOType::Out)
hasOutput = true;
if (attr.getIOType() == dp::Attribute::IOType::In)
hasInput = true;
}
if (!hasOutput)
if (hasInput && !hasOutput)
this->m_endNodes.push_back(node);
imnodes::SetNodeScreenSpacePos(node->getID(), this->m_rightClickedCoords);