@@ -726,6 +726,7 @@ void NodeParamView::AddNode(Node *n, Node *ctx, NodeParamViewContext *context)
|
||||
connect(item, &NodeParamViewItem::ArrayExpandedChanged, this, &NodeParamView::QueueKeyframePositionUpdate);
|
||||
connect(item, &NodeParamViewItem::ExpandedChanged, this, &NodeParamView::QueueKeyframePositionUpdate);
|
||||
connect(item, &NodeParamViewItem::Moved, this, &NodeParamView::QueueKeyframePositionUpdate);
|
||||
connect(item, &NodeParamViewItem::InputArraySizeChanged, this, &NodeParamView::InputArraySizeChanged);
|
||||
|
||||
item->SetKeyframeConnections(keyframe_view_->AddKeyframesOfNode(n));
|
||||
}
|
||||
@@ -999,4 +1000,42 @@ void NodeParamView::GroupInputPassthroughRemoved(NodeGroup *group, const NodeInp
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamView::InputArraySizeChanged(const QString &input, int, int new_size)
|
||||
{
|
||||
NodeParamViewItem *sender = static_cast<NodeParamViewItem *>(this->sender());
|
||||
|
||||
KeyframeView::NodeConnections &connections = sender->GetKeyframeConnections();
|
||||
KeyframeView::InputConnections &inputs = connections[input];
|
||||
|
||||
int adj_new_size = new_size + 1;
|
||||
|
||||
if (adj_new_size != inputs.size()) {
|
||||
if (adj_new_size < inputs.size()) {
|
||||
// Remove elements from keyframe view
|
||||
for (int i = adj_new_size; i < inputs.size(); i++) {
|
||||
const KeyframeView::ElementConnections &ec = inputs.at(i);
|
||||
for (auto kc : ec) {
|
||||
keyframe_view_->RemoveKeyframesOfTrack(kc);
|
||||
}
|
||||
}
|
||||
|
||||
// Resize vector to match new size
|
||||
inputs.resize(adj_new_size);
|
||||
} else {
|
||||
// Add elements
|
||||
int old_size = inputs.size();
|
||||
|
||||
// Resize vector to match
|
||||
inputs.resize(adj_new_size);
|
||||
|
||||
// Fill in extra elements
|
||||
for (int i = old_size; i < inputs.size(); i++) {
|
||||
inputs[i] = keyframe_view_->AddKeyframesOfElement(NodeInput(sender->GetNode(), input, i - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QueueKeyframePositionUpdate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -190,6 +190,8 @@ private slots:
|
||||
|
||||
void RequestEditTextInViewer();
|
||||
|
||||
void InputArraySizeChanged(const QString &input, int old_size, int new_size);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -50,7 +50,8 @@ NodeParamViewItem::NodeParamViewItem(Node *node, NodeParamViewCheckBoxBehavior c
|
||||
body_(nullptr),
|
||||
node_(node),
|
||||
create_checkboxes_(create_checkboxes),
|
||||
ctx_(nullptr)
|
||||
ctx_(nullptr),
|
||||
time_target_(nullptr)
|
||||
{
|
||||
node_->Retranslate();
|
||||
|
||||
@@ -58,6 +59,7 @@ NodeParamViewItem::NodeParamViewItem(Node *node, NodeParamViewCheckBoxBehavior c
|
||||
RecreateBody();
|
||||
|
||||
connect(node_, &Node::LabelChanged, this, &NodeParamViewItem::Retranslate);
|
||||
connect(node_, &Node::InputArraySizeChanged, this, &NodeParamViewItem::InputArraySizeChanged);
|
||||
|
||||
// FIXME: Implemented to pick up when an input is set to hidden or not - DEFINITELY not a fast
|
||||
// way of doing this, but "fine" for now.
|
||||
@@ -96,6 +98,7 @@ void NodeParamViewItem::RecreateBody()
|
||||
connect(body_, &NodeParamViewItemBody::RequestEditTextInViewer, this, &NodeParamViewItem::RequestEditTextInViewer);
|
||||
body_->Retranslate();
|
||||
body_->SetTimebase(timebase_);
|
||||
body_->SetTimeTarget(time_target_);
|
||||
SetBody(body_);
|
||||
}
|
||||
|
||||
@@ -117,6 +120,7 @@ void NodeParamViewItem::SetInputChecked(const NodeInput &input, bool e)
|
||||
NodeParamViewItemBody::NodeParamViewItemBody(Node* node, NodeParamViewCheckBoxBehavior create_checkboxes, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
node_(node),
|
||||
time_target_(nullptr),
|
||||
create_checkboxes_(create_checkboxes)
|
||||
{
|
||||
QGridLayout* root_layout = new QGridLayout(this);
|
||||
@@ -265,22 +269,32 @@ void NodeParamViewItemBody::CreateWidgets(QGridLayout* layout, Node *node, const
|
||||
if (node->IsInputConnectable(input)) {
|
||||
UpdateUIForEdgeConnection(input_ref);
|
||||
}
|
||||
|
||||
SetTimeTargetOnInputUI(ui_objects);
|
||||
SetTimebaseOnInputUI(ui_objects);
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::SetTimeTarget(ViewerOutput *target)
|
||||
{
|
||||
time_target_ = target;
|
||||
|
||||
foreach (const InputUI& ui_obj, input_ui_map_) {
|
||||
// Only keyframable inputs have a key control widget
|
||||
if (ui_obj.key_control) {
|
||||
ui_obj.key_control->SetTimeTarget(target);
|
||||
}
|
||||
if (ui_obj.connected_label) {
|
||||
ui_obj.connected_label->SetViewerNode(target);
|
||||
}
|
||||
ui_obj.widget_bridge->SetTimeTarget(target);
|
||||
SetTimeTargetOnInputUI(ui_obj);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::SetTimeTargetOnInputUI(const InputUI &ui_obj)
|
||||
{
|
||||
// Only keyframable inputs have a key control widget
|
||||
if (ui_obj.key_control) {
|
||||
ui_obj.key_control->SetTimeTarget(time_target_);
|
||||
}
|
||||
if (ui_obj.connected_label) {
|
||||
ui_obj.connected_label->SetViewerNode(time_target_);
|
||||
}
|
||||
ui_obj.widget_bridge->SetTimeTarget(time_target_);
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::Retranslate()
|
||||
{
|
||||
for (auto i=input_ui_map_.begin(); i!=input_ui_map_.end(); i++) {
|
||||
@@ -492,10 +506,15 @@ void NodeParamViewItemBody::SetTimebase(const rational& timebase)
|
||||
timebase_ = timebase;
|
||||
|
||||
foreach (const InputUI& ui_obj, input_ui_map_) {
|
||||
ui_obj.widget_bridge->SetTimebase(timebase);
|
||||
SetTimebaseOnInputUI(ui_obj);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::SetTimebaseOnInputUI(const InputUI& ui_obj)
|
||||
{
|
||||
ui_obj.widget_bridge->SetTimebase(timebase_);
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::SetInputChecked(const NodeInput &input, bool e)
|
||||
{
|
||||
if (input_ui_map_.contains(input)) {
|
||||
|
||||
@@ -104,6 +104,9 @@ private:
|
||||
NodeParamViewArrayButton* append_btn;
|
||||
};
|
||||
|
||||
void SetTimeTargetOnInputUI(const InputUI &ui);
|
||||
void SetTimebaseOnInputUI(const InputUI &ui);
|
||||
|
||||
Node *node_;
|
||||
|
||||
QHash<NodeInputPair, ArrayUI> array_ui_;
|
||||
@@ -112,6 +115,8 @@ private:
|
||||
|
||||
rational timebase_;
|
||||
|
||||
ViewerOutput *time_target_;
|
||||
|
||||
NodeParamViewCheckBoxBehavior create_checkboxes_;
|
||||
|
||||
QHash<NodeInputPair, NodeInputPair> input_group_lookup_;
|
||||
@@ -165,6 +170,8 @@ public:
|
||||
|
||||
void SetTimeTarget(ViewerOutput* target)
|
||||
{
|
||||
time_target_ = target;
|
||||
|
||||
body_->SetTimeTarget(target);
|
||||
}
|
||||
|
||||
@@ -194,7 +201,7 @@ public:
|
||||
|
||||
void SetInputChecked(const NodeInput &input, bool e);
|
||||
|
||||
const KeyframeView::NodeConnections &GetKeyframeConnections() const
|
||||
KeyframeView::NodeConnections &GetKeyframeConnections()
|
||||
{
|
||||
return keyframe_connections_;
|
||||
}
|
||||
@@ -213,6 +220,8 @@ signals:
|
||||
|
||||
void RequestEditTextInViewer();
|
||||
|
||||
void InputArraySizeChanged(const QString &input, int old_size, int new_size);
|
||||
|
||||
protected slots:
|
||||
virtual void Retranslate() override;
|
||||
|
||||
@@ -225,6 +234,8 @@ private:
|
||||
|
||||
Node *ctx_;
|
||||
|
||||
ViewerOutput *time_target_;
|
||||
|
||||
rational timebase_;
|
||||
|
||||
KeyframeView::NodeConnections keyframe_connections_;
|
||||
|
||||
Reference in New Issue
Block a user