You've already forked nodeeditor
mirror of
https://github.com/AxioDL/nodeeditor.git
synced 2026-03-30 11:48:31 -07:00
56 lines
777 B
C++
56 lines
777 B
C++
#include "MathOperationDataModel.hpp"
|
|
|
|
#include "NumberData.hpp"
|
|
|
|
unsigned int
|
|
MathOperationDataModel::
|
|
nPorts(PortType portType) const
|
|
{
|
|
unsigned int result;
|
|
|
|
if (portType == PortType::In)
|
|
result = 2;
|
|
else
|
|
result = 1;
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
NodeDataType
|
|
MathOperationDataModel::
|
|
dataType(PortType, PortIndex) const
|
|
{
|
|
return NumberData().type();
|
|
}
|
|
|
|
|
|
std::shared_ptr<NodeData>
|
|
MathOperationDataModel::
|
|
outData(PortIndex)
|
|
{
|
|
return std::static_pointer_cast<NodeData>(_result);
|
|
}
|
|
|
|
|
|
void
|
|
MathOperationDataModel::
|
|
setInData(std::shared_ptr<NodeData> data, PortIndex portIndex)
|
|
{
|
|
auto numberData =
|
|
std::dynamic_pointer_cast<NumberData>(data);
|
|
|
|
if (portIndex == 0)
|
|
{
|
|
_number1 = numberData;
|
|
}
|
|
else
|
|
{
|
|
_number2 = numberData;
|
|
}
|
|
|
|
compute();
|
|
}
|
|
|
|
|