diff --git a/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp b/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp index 7f502ffa7..aec50c364 100644 --- a/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp +++ b/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp @@ -143,10 +143,17 @@ void NodeParamViewWidgetBridge::CreateWidgets() void NodeParamViewWidgetBridge::SetInputValue(const QVariant &value, int track) { - rational node_time = GetCurrentTimeAsNodeTime(); - QUndoCommand* command = new QUndoCommand(); + SetInputValueInternal(value, track, command); + + Core::instance()->undo_stack()->pushIfHasChildren(command); +} + +void NodeParamViewWidgetBridge::SetInputValueInternal(const QVariant &value, int track, QUndoCommand *command) +{ + rational node_time = GetCurrentTimeAsNodeTime(); + if (input_->is_keyframing()) { NodeKeyframePtr existing_key = input_->get_keyframe_at_time_on_track(node_time, track); @@ -164,8 +171,6 @@ void NodeParamViewWidgetBridge::SetInputValue(const QVariant &value, int track) } else { new NodeParamSetStandardValueCommand(input_, track, value, command); } - - Core::instance()->undo_stack()->pushIfHasChildren(command); } void NodeParamViewWidgetBridge::ProcessSlider(SliderBase *slider, const QVariant &value) @@ -308,8 +313,20 @@ void NodeParamViewWidgetBridge::WidgetCallback() // FIXME: File selector break; case NodeParam::kColor: - // FIXME: Color selector + { + // Sender is a ColorButton + Color c = static_cast(sender())->GetColor(); + + QUndoCommand* command = new QUndoCommand(); + + SetInputValueInternal(c.red(), 0, command); + SetInputValueInternal(c.green(), 1, command); + SetInputValueInternal(c.blue(), 2, command); + SetInputValueInternal(c.alpha(), 3, command); + + Core::instance()->undo_stack()->pushIfHasChildren(command); break; + } case NodeParam::kText: { // Sender is a QLineEdit @@ -402,8 +419,10 @@ void NodeParamViewWidgetBridge::UpdateWidgetValues() // FIXME: File selector break; case NodeParam::kColor: - // FIXME: Color selector + { + static_cast(widgets_.first())->SetColor(input_->get_value_at_time(node_time).value()); break; + } case NodeParam::kText: { static_cast(widgets_.first())->setText(input_->get_value_at_time(node_time).toString()); diff --git a/app/widget/nodeparamview/nodeparamviewwidgetbridge.h b/app/widget/nodeparamview/nodeparamviewwidgetbridge.h index bb2b65a35..88f09f51d 100644 --- a/app/widget/nodeparamview/nodeparamviewwidgetbridge.h +++ b/app/widget/nodeparamview/nodeparamviewwidgetbridge.h @@ -22,6 +22,8 @@ private: void SetInputValue(const QVariant& value, int track); + void SetInputValueInternal(const QVariant& value, int track, QUndoCommand* command); + void ProcessSlider(SliderBase* slider, const QVariant& value); void CreateSliders(int count);