Merge branch 'node-view-show-ctx'
This commit is contained in:
@@ -58,6 +58,10 @@ double Bezier::CalculateTFromX(bool cubic, double x, double a, double b, double
|
||||
double top = 1.0;
|
||||
|
||||
while (true) {
|
||||
if (bottom == top) {
|
||||
return bottom;
|
||||
}
|
||||
|
||||
double mid = (bottom + top) * 0.5;
|
||||
double test = cubic ? CubicTtoY(a, b, c, d, mid) : QuadraticTtoY(a, b, c, mid);
|
||||
|
||||
|
||||
+53
-31
@@ -24,37 +24,10 @@
|
||||
#include "node/factory.h"
|
||||
#include "widget/nodeparamview/nodeparamviewundo.h"
|
||||
#include "widget/nodeview/nodeviewundo.h"
|
||||
//#include "widget/timelinewidget/undo/timelineundogeneral.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
void XMLConnectNodes(const XMLNodeData &xml_node_data, uint version, MultiUndoCommand *command)
|
||||
{
|
||||
foreach (const XMLNodeData::SerializedConnection& con, xml_node_data.desired_connections) {
|
||||
Node *out = xml_node_data.node_ptrs.value(con.output_node);
|
||||
|
||||
if (out) {
|
||||
// Use output param as hint tag since we grandfathered those in
|
||||
Node::ValueHint hint(con.output_param);
|
||||
|
||||
if (command) {
|
||||
command->add_child(new NodeEdgeAddCommand(out, con.input));
|
||||
|
||||
if (version < 210907) {
|
||||
/// Deprecated: backwards compatibility only
|
||||
command->add_child(new NodeSetValueHintCommand(con.input, hint));
|
||||
}
|
||||
} else {
|
||||
Node::ConnectEdge(out, con.input);
|
||||
|
||||
if (version < 210907) {
|
||||
/// Deprecated: backwards compatibility only
|
||||
con.input.node()->SetValueHintForInput(con.input.input(), hint, con.input.element());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool XMLReadNextStartElement(QXmlStreamReader *reader)
|
||||
{
|
||||
QXmlStreamReader::TokenType token;
|
||||
@@ -71,10 +44,59 @@ bool XMLReadNextStartElement(QXmlStreamReader *reader)
|
||||
return false;
|
||||
}
|
||||
|
||||
void XMLLinkBlocks(const XMLNodeData &xml_node_data)
|
||||
void XMLNodeData::PostConnect(uint version, MultiUndoCommand *command) const
|
||||
{
|
||||
foreach (const XMLNodeData::BlockLink& l, xml_node_data.block_links) {
|
||||
Block::Link(l.block, static_cast<Block*>(xml_node_data.node_ptrs.value(l.link)));
|
||||
foreach (const XMLNodeData::SerializedConnection& con, desired_connections) {
|
||||
if (Node *out = node_ptrs.value(con.output_node)) {
|
||||
// Use output param as hint tag since we grandfathered those in
|
||||
Node::ValueHint hint(con.output_param);
|
||||
|
||||
if (command) {
|
||||
command->add_child(new NodeEdgeAddCommand(out, con.input));
|
||||
} else {
|
||||
Node::ConnectEdge(out, con.input);
|
||||
}
|
||||
|
||||
if (version < 210907) {
|
||||
/// Deprecated: backwards compatibility only
|
||||
if (command) {
|
||||
command->add_child(new NodeSetValueHintCommand(con.input, hint));
|
||||
} else {
|
||||
con.input.node()->SetValueHintForInput(con.input.input(), hint, con.input.element());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (const XMLNodeData::BlockLink& l, block_links) {
|
||||
Node *a = l.block;
|
||||
Node *b = node_ptrs.value(l.link);
|
||||
if (command) {
|
||||
command->add_child(new NodeLinkCommand(a, b, true));
|
||||
} else {
|
||||
Node::Link(a, b);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (const XMLNodeData::GroupLink &l, group_input_links) {
|
||||
if (Node *input_node = node_ptrs.value(l.input_node)) {
|
||||
NodeInput resolved(input_node, l.input_id, l.input_element);
|
||||
if (command) {
|
||||
command->add_child(new NodeGroupAddInputPassthrough(l.group, resolved));
|
||||
} else {
|
||||
l.group->AddInputPassthrough(resolved);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto it=group_output_links.cbegin(); it!=group_output_links.cend(); it++) {
|
||||
if (Node *output_node = node_ptrs.value(it.value())) {
|
||||
if (command) {
|
||||
command->add_child(new NodeGroupSetOutputPassthrough(it.key(), output_node));
|
||||
} else {
|
||||
it.key()->SetOutputPassthrough(output_node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-4
@@ -31,6 +31,7 @@ namespace olive {
|
||||
class Block;
|
||||
class Node;
|
||||
class NodeInput;
|
||||
class NodeGroup;
|
||||
|
||||
#define XMLAttributeLoop(reader, item) \
|
||||
foreach (const QXmlStreamAttribute& item, reader->attributes())
|
||||
@@ -49,14 +50,23 @@ struct XMLNodeData {
|
||||
quintptr link;
|
||||
};
|
||||
|
||||
struct GroupLink {
|
||||
NodeGroup *group;
|
||||
quintptr input_node;
|
||||
QString input_id;
|
||||
int input_element;
|
||||
};
|
||||
|
||||
QHash<quintptr, Node*> node_ptrs;
|
||||
QList<SerializedConnection> desired_connections;
|
||||
QList<BlockLink> block_links;
|
||||
QVector<GroupLink> group_input_links;
|
||||
QHash<NodeGroup*, quintptr> group_output_links;
|
||||
|
||||
void PostConnect(uint version, MultiUndoCommand *command = nullptr) const;
|
||||
|
||||
};
|
||||
|
||||
void XMLConnectNodes(const XMLNodeData& xml_node_data, uint version, MultiUndoCommand *command = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Workaround for QXmlStreamReader::readNextStartElement not detecting the end of a document
|
||||
*
|
||||
@@ -68,8 +78,6 @@ void XMLConnectNodes(const XMLNodeData& xml_node_data, uint version, MultiUndoCo
|
||||
*/
|
||||
bool XMLReadNextStartElement(QXmlStreamReader* reader);
|
||||
|
||||
void XMLLinkBlocks(const XMLNodeData& xml_node_data);
|
||||
|
||||
}
|
||||
|
||||
#endif // XMLREADLOOP_H
|
||||
|
||||
Reference in New Issue
Block a user