enforce read-only/stateless structure of new rendering system
Most if not all Node references are const now, so their state is entirely held in the renderers rather than the Nodes themselves.
This commit is contained in:
@@ -27,19 +27,19 @@ NodeDependency::NodeDependency() :
|
||||
{
|
||||
}
|
||||
|
||||
NodeDependency::NodeDependency(Node *node, const TimeRange &range) :
|
||||
NodeDependency::NodeDependency(const Node *node, const TimeRange &range) :
|
||||
node_(node),
|
||||
range_(range)
|
||||
{
|
||||
}
|
||||
|
||||
NodeDependency::NodeDependency(Node *node, const rational &in, const rational &out) :
|
||||
NodeDependency::NodeDependency(const Node *node, const rational &in, const rational &out) :
|
||||
node_(node),
|
||||
range_(in, out)
|
||||
{
|
||||
}
|
||||
|
||||
Node *NodeDependency::node() const
|
||||
const Node *NodeDependency::node() const
|
||||
{
|
||||
return node_;
|
||||
}
|
||||
|
||||
@@ -30,16 +30,16 @@ class Node;
|
||||
class NodeDependency {
|
||||
public:
|
||||
NodeDependency();
|
||||
NodeDependency(Node* node, const TimeRange& range);
|
||||
NodeDependency(Node* node, const rational& in, const rational &out);
|
||||
NodeDependency(const Node* node, const TimeRange& range);
|
||||
NodeDependency(const Node* node, const rational& in, const rational &out);
|
||||
|
||||
Node* node() const;
|
||||
const Node* node() const;
|
||||
const rational& in() const;
|
||||
const rational& out() const;
|
||||
const TimeRange& range() const;
|
||||
|
||||
private:
|
||||
Node* node_;
|
||||
const Node* node_;
|
||||
TimeRange range_;
|
||||
};
|
||||
|
||||
|
||||
+9
-19
@@ -55,7 +55,7 @@ QString NodeInput::name()
|
||||
return NodeParam::name();
|
||||
}
|
||||
|
||||
const NodeParam::DataType &NodeInput::data_type()
|
||||
const NodeParam::DataType &NodeInput::data_type() const
|
||||
{
|
||||
return data_type_;
|
||||
}
|
||||
@@ -65,7 +65,7 @@ void NodeInput::set_data_type(const NodeParam::DataType &type)
|
||||
data_type_ = type;
|
||||
}
|
||||
|
||||
NodeOutput *NodeInput::get_connected_output()
|
||||
NodeOutput *NodeInput::get_connected_output() const
|
||||
{
|
||||
if (!edges_.isEmpty()) {
|
||||
return edges_.first()->output();
|
||||
@@ -74,7 +74,7 @@ NodeOutput *NodeInput::get_connected_output()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Node *NodeInput::get_connected_node()
|
||||
Node *NodeInput::get_connected_node() const
|
||||
{
|
||||
NodeOutput* output = get_connected_output();
|
||||
|
||||
@@ -85,7 +85,7 @@ Node *NodeInput::get_connected_node()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QVariant NodeInput::get_value_at_time(const rational &time)
|
||||
QVariant NodeInput::get_value_at_time(const rational &time) const
|
||||
{
|
||||
if (is_keyframing()) {
|
||||
if (keyframes_.first().time() >= time) {
|
||||
@@ -231,7 +231,7 @@ void NodeInput::set_value_at_time(const rational &time, const QVariant &value)
|
||||
emit ValueChanged(signal_vc_range.in(), signal_vc_range.out());
|
||||
}
|
||||
|
||||
bool NodeInput::is_keyframing()
|
||||
bool NodeInput::is_keyframing() const
|
||||
{
|
||||
return keyframing_;
|
||||
}
|
||||
@@ -241,22 +241,12 @@ void NodeInput::set_is_keyframing(bool k)
|
||||
keyframing_ = k;
|
||||
}
|
||||
|
||||
bool NodeInput::dependent()
|
||||
{
|
||||
return dependent_;
|
||||
}
|
||||
|
||||
void NodeInput::set_dependent(bool d)
|
||||
{
|
||||
dependent_ = d;
|
||||
}
|
||||
|
||||
const QVariant &NodeInput::minimum()
|
||||
const QVariant &NodeInput::minimum() const
|
||||
{
|
||||
return minimum_;
|
||||
}
|
||||
|
||||
bool NodeInput::has_minimum()
|
||||
bool NodeInput::has_minimum() const
|
||||
{
|
||||
return has_minimum_;
|
||||
}
|
||||
@@ -267,12 +257,12 @@ void NodeInput::set_minimum(const QVariant &min)
|
||||
has_minimum_ = true;
|
||||
}
|
||||
|
||||
const QVariant &NodeInput::maximum()
|
||||
const QVariant &NodeInput::maximum() const
|
||||
{
|
||||
return maximum_;
|
||||
}
|
||||
|
||||
bool NodeInput::has_maximum()
|
||||
bool NodeInput::has_maximum() const
|
||||
{
|
||||
return has_maximum_;
|
||||
}
|
||||
|
||||
+9
-21
@@ -57,7 +57,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();
|
||||
const DataType& data_type() const;
|
||||
void set_data_type(const DataType& type);
|
||||
|
||||
/**
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
*
|
||||
* The output parameter if connected or nullptr if not
|
||||
*/
|
||||
NodeOutput* get_connected_output();
|
||||
NodeOutput* get_connected_output() const;
|
||||
|
||||
/**
|
||||
* @brief If this input is connected to an output, retrieve the Node whose output is connected
|
||||
@@ -76,12 +76,12 @@ public:
|
||||
*
|
||||
* The connected Node if connected or nullptr if not
|
||||
*/
|
||||
Node* get_connected_node();
|
||||
Node* get_connected_node() const;
|
||||
|
||||
/**
|
||||
* @brief Calculate what the stored value should be at a certain time
|
||||
*/
|
||||
QVariant get_value_at_time(const rational& time);
|
||||
QVariant get_value_at_time(const rational& time) const;
|
||||
|
||||
/**
|
||||
* @brief Sets what value should be seen at a specific time
|
||||
@@ -91,31 +91,19 @@ public:
|
||||
/**
|
||||
* @brief Return whether keyframing is enabled on this input or not
|
||||
*/
|
||||
bool is_keyframing();
|
||||
bool is_keyframing() const;
|
||||
|
||||
/**
|
||||
* @brief Set whether keyframing is enabled on this input or not
|
||||
*/
|
||||
void set_is_keyframing(bool k);
|
||||
|
||||
/**
|
||||
* @brief Return whether the Node is dependent on this input or not
|
||||
*
|
||||
* \see set_dependent()
|
||||
*/
|
||||
bool dependent();
|
||||
|
||||
/**
|
||||
* @brief Set whether the Node is dependent on this input
|
||||
*/
|
||||
void set_dependent(bool d);
|
||||
|
||||
const QVariant& minimum();
|
||||
bool has_minimum();
|
||||
const QVariant& minimum() const;
|
||||
bool has_minimum() const;
|
||||
void set_minimum(const QVariant& min);
|
||||
|
||||
const QVariant& maximum();
|
||||
bool has_maximum();
|
||||
const QVariant& maximum() const;
|
||||
bool has_maximum() const;
|
||||
void set_maximum(const QVariant& max);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user