keyframeview: implemented transforming keyframe times to and from sequence time
Since the node graph can have transform cross nodes, input keyframes may occur at a different times requiring transforming between sequence time and media time. This commit implements such a mechanism in all UI classes that need it.
This commit is contained in:
+4
-3
@@ -540,15 +540,16 @@ QList<TimeRange> Node::TransformTimeTo(const TimeRange &time, Node *target, Node
|
||||
foreach (NodeInput* input, inputs) {
|
||||
if (input->IsConnected()) {
|
||||
TimeRange input_adjustment = InputTimeAdjustment(input, time);
|
||||
Node* connected = input->get_connected_node();
|
||||
|
||||
if (input->get_connected_node() == target) {
|
||||
if (connected == target) {
|
||||
// We found the target, no need to keep traversing
|
||||
if (!paths_found.contains(input_adjustment)) {
|
||||
paths_found.append(input_adjustment);
|
||||
}
|
||||
} else {
|
||||
// We did NOT find the target, traverse this
|
||||
paths_found.append(TransformTimeTo(input_adjustment, target, direction));
|
||||
paths_found.append(connected->TransformTimeTo(input_adjustment, target, direction));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -567,7 +568,7 @@ QList<TimeRange> Node::TransformTimeTo(const TimeRange &time, Node *target, Node
|
||||
if (input_node == target) {
|
||||
paths_found.append(output_adjustment);
|
||||
} else {
|
||||
paths_found.append(TransformTimeTo(output_adjustment, target, direction));
|
||||
paths_found.append(input_node->TransformTimeTo(output_adjustment, target, direction));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -221,7 +221,7 @@ public:
|
||||
/**
|
||||
* @brief Find a node of a certain type that this Node outputs to
|
||||
*/
|
||||
const T* FindOutputNode() const;
|
||||
T* FindOutputNode();
|
||||
|
||||
/**
|
||||
* @brief Convert a pointer to a value that can be sent between NodeParams
|
||||
@@ -416,7 +416,7 @@ T* Node::ValueToPtr(const QVariant &ptr)
|
||||
}
|
||||
|
||||
template<class T>
|
||||
const Node* FindOutputNodeInternal(const Node* n) {
|
||||
Node* FindOutputNodeInternal(Node* n) {
|
||||
foreach (NodeEdgePtr edge, n->output()->edges()) {
|
||||
Node* connected = edge->input()->parentNode();
|
||||
T* cast_test = dynamic_cast<T*>(connected);
|
||||
@@ -424,7 +424,7 @@ const Node* FindOutputNodeInternal(const Node* n) {
|
||||
if (cast_test) {
|
||||
return cast_test;
|
||||
} else {
|
||||
const Node* drill_test = FindOutputNodeInternal<T>(connected);
|
||||
Node* drill_test = FindOutputNodeInternal<T>(connected);
|
||||
if (drill_test) {
|
||||
return drill_test;
|
||||
}
|
||||
@@ -435,9 +435,9 @@ const Node* FindOutputNodeInternal(const Node* n) {
|
||||
}
|
||||
|
||||
template<class T>
|
||||
const T* Node::FindOutputNode() const
|
||||
T* Node::FindOutputNode()
|
||||
{
|
||||
return static_cast<const T*>(FindOutputNodeInternal<T>(this));
|
||||
return static_cast<T*>(FindOutputNodeInternal<T>(this));
|
||||
}
|
||||
|
||||
#endif // NODE_H
|
||||
|
||||
Reference in New Issue
Block a user