mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-13 23:46:29 +02:00
Fix play back of input recording's numeric values
This commit is contained in:
parent
14d39d1747
commit
683e633469
4 changed files with 26 additions and 6 deletions
|
@ -297,6 +297,13 @@ namespace controller {
|
|||
return 0.0f;
|
||||
}
|
||||
|
||||
InputRecorder::ActionStates InputRecorder::getActionstates() {
|
||||
if (_actionStateList.size() > 0) {
|
||||
return _actionStateList[_playCount];
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
controller::Pose InputRecorder::getPoseState(const QString& action) {
|
||||
if (_poseStateList.size() > 0) {
|
||||
return _poseStateList[_playCount][action];
|
||||
|
|
|
@ -45,6 +45,7 @@ namespace controller {
|
|||
void setActionState(const QString& action, float value);
|
||||
void setActionState(const QString& action, const controller::Pose& pose);
|
||||
float getActionState(const QString& action);
|
||||
ActionStates getActionstates();
|
||||
controller::Pose getPoseState(const QString& action);
|
||||
QString getSaveDirectory();
|
||||
void frameTick();
|
||||
|
|
|
@ -489,6 +489,21 @@ void UserInputMapper::runMappings() {
|
|||
}
|
||||
applyRoutes(_standardRoutes);
|
||||
|
||||
InputRecorder* inputRecorder = InputRecorder::getInstance();
|
||||
if (inputRecorder->isPlayingback()) {
|
||||
if (debugRoutes) {
|
||||
qCDebug(controllers) << "Playing back recording actions";
|
||||
}
|
||||
|
||||
// Play back each numeric action even if there is no current route active for the action.
|
||||
auto actionStates = inputRecorder->getActionstates();
|
||||
for (InputRecorder::ActionStates::iterator it = actionStates.begin(); it != actionStates.end(); ++it) {
|
||||
setActionState((Action)findAction(it->first), it->second);
|
||||
}
|
||||
|
||||
// Poses are played back in StandardEndpoint.
|
||||
}
|
||||
|
||||
if (debugRoutes) {
|
||||
qCDebug(controllers) << "Done with mappings";
|
||||
}
|
||||
|
|
|
@ -18,19 +18,16 @@ using namespace controller;
|
|||
void ActionEndpoint::apply(AxisValue newValue, const Pointer& source) {
|
||||
auto userInputMapper = DependencyManager::get<UserInputMapper>();
|
||||
InputRecorder* inputRecorder = InputRecorder::getInstance();
|
||||
QString actionName;
|
||||
if (inputRecorder->isPlayingback() || inputRecorder->isRecording()) {
|
||||
actionName = userInputMapper->getActionName(Action(_input.getChannel()));
|
||||
if (inputRecorder->isPlayingback()) {
|
||||
newValue = AxisValue(inputRecorder->getActionState(actionName), 0);
|
||||
}
|
||||
QString actionName = userInputMapper->getActionName(Action(_input.getChannel()));
|
||||
inputRecorder->setActionState(actionName, newValue.value);
|
||||
}
|
||||
|
||||
_currentValue.value += newValue.value;
|
||||
|
||||
if (_input != Input::INVALID_INPUT) {
|
||||
userInputMapper->deltaActionState(Action(_input.getChannel()), newValue.value);
|
||||
}
|
||||
inputRecorder->setActionState(actionName, newValue.value);
|
||||
}
|
||||
|
||||
void ActionEndpoint::apply(const Pose& value, const Pointer& source) {
|
||||
|
|
Loading…
Reference in a new issue