mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-06-05 22:23:34 +00:00
Added keyboard shortcuts for play/prev anim/next anim to character editor
This commit is contained in:
parent
709087d2fe
commit
7880dd34f4
@ -58,7 +58,24 @@ CCharacterEditor::CCharacterEditor(QWidget *parent)
|
|||||||
SplitterSizes << width() * 0.2 << width() * 0.8;
|
SplitterSizes << width() * 0.2 << width() * 0.8;
|
||||||
ui->splitter->setSizes(SplitterSizes);
|
ui->splitter->setSizes(SplitterSizes);
|
||||||
|
|
||||||
connect(ui->SkeletonHierarchyTreeView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(OnSkeletonTreeSelectionChanged(QModelIndex)));
|
connect(ui->SkeletonHierarchyTreeView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(OnSkeletonTreeSelectionChanged(QModelIndex)));
|
||||||
|
|
||||||
|
// Set up keyboard shortcuts
|
||||||
|
QAction *pTogglePlayAction = new QAction(this);
|
||||||
|
pTogglePlayAction->setShortcut(QKeySequence("Space"));
|
||||||
|
connect(pTogglePlayAction, SIGNAL(triggered()), this, SLOT(TogglePlay()));
|
||||||
|
|
||||||
|
QAction *pPrevAnimAction = new QAction(this);
|
||||||
|
pPrevAnimAction->setShortcut(QKeySequence("R"));
|
||||||
|
connect(pPrevAnimAction, SIGNAL(triggered()), this, SLOT(PrevAnim()));
|
||||||
|
|
||||||
|
QAction *pNextAnimAction = new QAction(this);
|
||||||
|
pNextAnimAction->setShortcut(QKeySequence("F"));
|
||||||
|
connect(pNextAnimAction, SIGNAL(triggered()), this, SLOT(NextAnim()));
|
||||||
|
|
||||||
|
QList<QAction*> ShortcutActions;
|
||||||
|
ShortcutActions << pTogglePlayAction << pPrevAnimAction << pNextAnimAction;
|
||||||
|
addActions(ShortcutActions);
|
||||||
}
|
}
|
||||||
|
|
||||||
CCharacterEditor::~CCharacterEditor()
|
CCharacterEditor::~CCharacterEditor()
|
||||||
@ -171,6 +188,9 @@ void CCharacterEditor::Open()
|
|||||||
mSkeletonModel.SetSkeleton(pSkel);
|
mSkeletonModel.SetSkeleton(pSkel);
|
||||||
ui->SkeletonHierarchyTreeView->expandAll();
|
ui->SkeletonHierarchyTreeView->expandAll();
|
||||||
ui->SkeletonHierarchyTreeView->resizeColumnToContents(0);
|
ui->SkeletonHierarchyTreeView->resizeColumnToContents(0);
|
||||||
|
|
||||||
|
// Would rather it just clear the selection on load, but it keeps selecting root by itself, so this is my workaround. :/
|
||||||
|
ui->SkeletonHierarchyTreeView->selectionModel()->setCurrentIndex( mSkeletonModel.index(0, 0, QModelIndex()), QItemSelectionModel::ClearAndSelect );
|
||||||
}
|
}
|
||||||
|
|
||||||
gResCache.Clean();
|
gResCache.Clean();
|
||||||
@ -238,9 +258,24 @@ void CCharacterEditor::SetActiveAnimation(int AnimIndex)
|
|||||||
ui->AnimSlider->setMaximum((int) (CurrentAnimation() ? CurrentAnimation()->Duration() * 1000 : 0));
|
ui->AnimSlider->setMaximum((int) (CurrentAnimation() ? CurrentAnimation()->Duration() * 1000 : 0));
|
||||||
ui->AnimSlider->blockSignals(false);
|
ui->AnimSlider->blockSignals(false);
|
||||||
|
|
||||||
|
mpAnimComboBox->blockSignals(true);
|
||||||
|
mpAnimComboBox->setCurrentIndex(AnimIndex);
|
||||||
|
mpAnimComboBox->blockSignals(false);
|
||||||
|
|
||||||
SetAnimTime(0.f);
|
SetAnimTime(0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCharacterEditor::PrevAnim()
|
||||||
|
{
|
||||||
|
if (mCurrentAnim > 0) SetActiveAnimation(mCurrentAnim - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCharacterEditor::NextAnim()
|
||||||
|
{
|
||||||
|
u32 MaxAnim = (mpSet ? mpSet->NumAnims() - 1 : 0);
|
||||||
|
if (mCurrentAnim < MaxAnim) SetActiveAnimation(mCurrentAnim + 1);
|
||||||
|
}
|
||||||
|
|
||||||
void CCharacterEditor::SetAnimTime(int Time)
|
void CCharacterEditor::SetAnimTime(int Time)
|
||||||
{
|
{
|
||||||
float FloatTime = Time / 1000.f;
|
float FloatTime = Time / 1000.f;
|
||||||
|
@ -56,6 +56,8 @@ public slots:
|
|||||||
void OnSkeletonTreeSelectionChanged(const QModelIndex& rkIndex);
|
void OnSkeletonTreeSelectionChanged(const QModelIndex& rkIndex);
|
||||||
void SetActiveCharacterIndex(int CharIndex);
|
void SetActiveCharacterIndex(int CharIndex);
|
||||||
void SetActiveAnimation(int AnimIndex);
|
void SetActiveAnimation(int AnimIndex);
|
||||||
|
void PrevAnim();
|
||||||
|
void NextAnim();
|
||||||
|
|
||||||
void SetAnimTime(int Time);
|
void SetAnimTime(int Time);
|
||||||
void SetAnimTime(float Time);
|
void SetAnimTime(float Time);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user