changed nodeparam naming behavior

This commit is contained in:
itsmattkc
2019-09-08 12:19:00 +10:00
parent 4b2f4bcdb2
commit b428eb9984
6 changed files with 21 additions and 14 deletions
+9 -5
View File
@@ -40,11 +40,6 @@ NodeParam::Type NodeInput::type()
void NodeInput::add_data_input(const NodeParam::DataType &data_type)
{
inputs_.append(data_type);
// If no name has been set, use a default name
if (name().isEmpty()) {
set_name(GetDefaultDataTypeName(data_type));
}
}
bool NodeInput::can_accept_type(const NodeParam::DataType &data_type)
@@ -133,6 +128,15 @@ void NodeInput::set_dependent(bool d)
dependent_ = d;
}
NodeParam::DataType NodeInput::data_type()
{
if (inputs_.isEmpty()) {
return kNone;
}
return inputs_.first();
}
const QList<NodeParam::DataType> &NodeInput::inputs()
{
return inputs_;
+2
View File
@@ -124,6 +124,8 @@ public:
*/
void set_dependent(bool d);
virtual DataType data_type() override;
/**
* @brief A list of input data types accepted by this parameter
*/
+1 -6
View File
@@ -32,7 +32,7 @@ NodeParam::Type NodeOutput::type()
return kOutput;
}
const NodeParam::DataType &NodeOutput::data_type()
NodeParam::DataType NodeOutput::data_type()
{
return data_type_;
}
@@ -40,11 +40,6 @@ const NodeParam::DataType &NodeOutput::data_type()
void NodeOutput::set_data_type(const NodeParam::DataType &type)
{
data_type_ = type;
// If no name has been set, use a default name
if (name().isEmpty()) {
set_name(GetDefaultDataTypeName(type));
}
}
QVariant NodeOutput::get_value(const rational& time)
+1 -1
View File
@@ -45,7 +45,7 @@ public:
* This can be used in conjunction with NodeInput::can_accept_type() to determine whether this parameter can be
* connected to it.
*/
const DataType& data_type();
virtual DataType data_type() override;
void set_data_type(const DataType& type);
/**
+5 -1
View File
@@ -38,8 +38,12 @@ const QString NodeParam::id()
return id_;
}
const QString &NodeParam::name()
QString NodeParam::name()
{
if (name_.isEmpty()) {
return GetDefaultDataTypeName(data_type());
}
return name_;
}
+3 -1
View File
@@ -129,7 +129,7 @@ public:
/**
* @brief Name of this parameter to be shown to the user
*/
const QString& name();
QString name();
void set_name(const QString& name);
/**
@@ -250,6 +250,8 @@ public:
*/
const rational& LastRequestedTime();
virtual DataType data_type() = 0;
signals:
/**
* @brief Signal emitted when an edge is added to this parameter