implemented base UI keyframe functionality
This commit implements much of the base functionality for creating and destroying keyframes in the UI. Not complete yet, but getting there.
This commit is contained in:
@@ -10,6 +10,23 @@ KeyframeView::KeyframeView(QWidget *parent) :
|
||||
setDragMode(QGraphicsView::RubberBandDrag);
|
||||
}
|
||||
|
||||
void KeyframeView::AddKeyframe(NodeKeyframePtr key, int y)
|
||||
{
|
||||
QPoint global_pt(0, y);
|
||||
QPoint local_pt = mapFromGlobal(global_pt);
|
||||
QPointF scene_pt = mapToScene(local_pt);
|
||||
|
||||
KeyframeViewItem* item = new KeyframeViewItem(key, scene_pt.y());
|
||||
item->SetScale(scale_);
|
||||
item_map_.insert(key.get(), item);
|
||||
scene()->addItem(item);
|
||||
}
|
||||
|
||||
void KeyframeView::RemoveKeyframe(NodeKeyframePtr key)
|
||||
{
|
||||
delete item_map_.value(key.get());
|
||||
}
|
||||
|
||||
void KeyframeView::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (PlayheadPress(event)) {
|
||||
@@ -36,3 +53,12 @@ void KeyframeView::mouseReleaseEvent(QMouseEvent *event)
|
||||
|
||||
QGraphicsView::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void KeyframeView::ScaleChangedEvent(double scale)
|
||||
{
|
||||
QMap<NodeKeyframe*, KeyframeViewItem*>::const_iterator iterator;
|
||||
|
||||
for (iterator=item_map_.begin();iterator!=item_map_.end();iterator++) {
|
||||
iterator.value()->SetScale(scale);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user