PeriDyno 1.2.1
Loading...
Searching...
No Matches
WtNodeWidget.h
Go to the documentation of this file.
1#pragma once
2
3#include "Node.h"
4#include "WtNodeData.hpp"
5#include "WtNodeDataModel.h"
6#include "WtFieldData.h"
7
8using dyno::Node;
9using dyno::FBase;
10
12{
13public:
14 WtNodeWidget(std::shared_ptr<Node> base = nullptr);
15 virtual ~WtNodeWidget();
16
17public:
18 std::string caption() const override;
19
20 std::string name() const override;
21
22 std::string nodeTips() const override;
23
24 std::string portCaption(PortType portType, PortIndex portIndex) const override;
25
26 std::string portTips(PortType portType, PortIndex portIndex) const override;
27
28 std::string validationMessage() const override;
29
30 unsigned int nPorts(PortType portType) const override;
31
32 bool portCaptionVisible(PortType portType, PortIndex portIndex) const override;
33
34 bool allowExported() const override { return true; }
35
44 bool tryInData(PortIndex portIndex, std::shared_ptr<WtNodeData> nodeData) override;
45
46 void setInData(std::shared_ptr<WtNodeData> data, PortIndex portIndex) override;
47
48 NodeDataType dataType(PortType portType, PortIndex portIndex) const override;
49
50 //QWidget* embeddedWidget() override { return nullptr; }
51
52 NodeValidationState validationState() const override;
53
55
56 std::shared_ptr<Node> getNode();
57
58 std::shared_ptr<WtNodeData> outData(PortIndex port) override;
59
60 std::vector<FBase*>& getOutputFields() const;
61 std::vector<FBase*>& getInputFields() const;
65 void enableEditing();
66
70 void disableEditing();
71
72protected:
73 virtual void updateModule();
74
75protected:
76 using ExportNodePtr = std::shared_ptr<WtExportNode>;
77 using ImportNodePtr = std::vector<std::shared_ptr<WtImportNode>>;
78
81
82 using OutFieldPtr = std::vector<std::shared_ptr<WtFieldData>>;
83 using InFieldPtr = std::vector<std::shared_ptr<WtFieldData>>;
84
87
88 std::shared_ptr<Node> mNode = nullptr;
89
91 std::string modelValidationError = std::string("Missing or incorrect inputs");
92
93private:
94 bool mEditingEnabled = true;
95};
int PortIndex
PortType
NodeValidationState
bool portCaptionVisible(PortType portType, PortIndex portIndex) const override
It is possible to hide port caption in GUI.
std::vector< std::shared_ptr< WtFieldData > > InFieldPtr
std::string portTips(PortType portType, PortIndex portIndex) const override
std::vector< FBase * > & getInputFields() const
void enableEditing()
When enabled, the scenegraph can be updated as long as the corresponding GUI is updated.
std::shared_ptr< WtExportNode > ExportNodePtr
std::vector< std::shared_ptr< WtImportNode > > ImportNodePtr
unsigned int nPorts(PortType portType) const override
std::shared_ptr< Node > mNode
OutFieldPtr mFieldExport
bool mEditingEnabled
std::string name() const override
Name makes this model unique.
virtual ~WtNodeWidget()
bool allowExported() const override
void disableEditing()
When disabled, the scenegraph can not be affected by the corresponding GUI.
std::shared_ptr< Node > getNode()
ExportNodePtr mNodeExport
std::vector< std::shared_ptr< WtFieldData > > OutFieldPtr
WtNodeDataModel::ConnectionPolicy portInConnectionPolicy(PortIndex portIndex) const override
std::string modelValidationError
std::shared_ptr< WtNodeData > outData(PortIndex port) override
std::string caption() const override
std::string nodeTips() const override
NodeValidationState modelValidationState
ImportNodePtr mNodeInport
std::string portCaption(PortType portType, PortIndex portIndex) const override
Port caption is used in GUI to label individual ports.
virtual void updateModule()
NodeDataType dataType(PortType portType, PortIndex portIndex) const override
InFieldPtr mFieldInport
WtNodeWidget(std::shared_ptr< Node > base=nullptr)
bool tryInData(PortIndex portIndex, std::shared_ptr< WtNodeData > nodeData) override
To test whether nodaData can be set as the input data for portIndex.
std::string validationMessage() const override
NodeValidationState validationState() const override
std::vector< FBase * > & getOutputFields() const
void setInData(std::shared_ptr< WtNodeData > data, PortIndex portIndex) override
Triggers the algorithm.