ShaderNode: Add captions

This commit is contained in:
Lynix 2020-05-22 19:21:56 +02:00
parent 33c8fe2562
commit 5169e0fe83
2 changed files with 32 additions and 0 deletions

View File

@ -121,6 +121,33 @@ auto SampleTexture::dataType(QtNodes::PortType portType, QtNodes::PortIndex port
} }
} }
QString SampleTexture::portCaption(QtNodes::PortType portType, QtNodes::PortIndex portIndex) const
{
switch (portType)
{
case QtNodes::PortType::In:
{
assert(portIndex == 0);
return tr("UV");
}
case QtNodes::PortType::Out:
{
assert(portIndex == 0);
return tr("Sample");
}
default:
assert(false);
throw std::runtime_error("Invalid PortType");
}
}
bool SampleTexture::portCaptionVisible(QtNodes::PortType portType, QtNodes::PortIndex portIndex) const
{
return true;
}
std::shared_ptr<QtNodes::NodeData> SampleTexture::outData(QtNodes::PortIndex port) std::shared_ptr<QtNodes::NodeData> SampleTexture::outData(QtNodes::PortIndex port)
{ {
assert(port == 0); assert(port == 0);

View File

@ -25,6 +25,11 @@ class SampleTexture : public ShaderNode
unsigned int nPorts(QtNodes::PortType portType) const override; unsigned int nPorts(QtNodes::PortType portType) const override;
QtNodes::NodeDataType dataType(QtNodes::PortType portType, QtNodes::PortIndex portIndex) const override; QtNodes::NodeDataType dataType(QtNodes::PortType portType, QtNodes::PortIndex portIndex) const override;
QString portCaption(QtNodes::PortType portType, QtNodes::PortIndex portIndex) const override;
bool portCaptionVisible(QtNodes::PortType portType, QtNodes::PortIndex portIndex) const override;
std::shared_ptr<QtNodes::NodeData> outData(QtNodes::PortIndex port) override; std::shared_ptr<QtNodes::NodeData> outData(QtNodes::PortIndex port) override;
protected: protected: