Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MoCapPlugin
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LuFG VR VIS
VR-Group
Unreal-Development
Plugins
MoCapPlugin
Commits
2bc858be
Commit
2bc858be
authored
Apr 11, 2023
by
Patrick Nossol
Browse files
Options
Downloads
Patches
Plain Diff
split the looong preprocess recording method into submethods
parent
43651a83
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Source/MoCapPlugin/Private/MCController.cpp
+66
-26
66 additions, 26 deletions
Source/MoCapPlugin/Private/MCController.cpp
Source/MoCapPlugin/Public/MCController.h
+9
-0
9 additions, 0 deletions
Source/MoCapPlugin/Public/MCController.h
with
75 additions
and
26 deletions
Source/MoCapPlugin/Private/MCController.cpp
+
66
−
26
View file @
2bc858be
...
@@ -300,12 +300,8 @@ void AMCController::ScaleAnimDataInterval(int start, int end, float DeltaTime, L
...
@@ -300,12 +300,8 @@ void AMCController::ScaleAnimDataInterval(int start, int end, float DeltaTime, L
}
}
bool
AMCController
::
PreprocessRecording
(
float
StartHaltingPoint
,
float
EndHaltingPoint
)
{
void
AMCController
::
TranslateJsonToAnimData
()
{
UMCAnimInstance
*
AI
=
AnimSaveState
.
Pawn
->
GetAnimInstance
();
UMCAnimInstance
*
AI
=
AnimSaveState
.
Pawn
->
GetAnimInstance
();
//----translate json data to AnimSaveState.AnimData----
FTimespan
LastStamp
;
FTimespan
LastStamp
;
FTimespan
NextFrame
;
FTimespan
NextFrame
;
int
CurrentMarker
=
0
;
int
CurrentMarker
=
0
;
...
@@ -378,14 +374,9 @@ bool AMCController::PreprocessRecording(float StartHaltingPoint, float EndHaltin
...
@@ -378,14 +374,9 @@ bool AMCController::PreprocessRecording(float StartHaltingPoint, float EndHaltin
}
}
//If the animation is empty, continue
if
(
AnimSaveState
.
AnimData
.
Num
()
<=
1
)
{
return
false
;
}
}
//----process the anim data----
void
AMCController
::
InterpolateOutages
()
{
//---Sensor turned off -> interpolate
for
(
int
i
=
0
;
i
<
AnimSaveState
.
AnimData
.
Num
();
i
++
)
{
for
(
int
i
=
0
;
i
<
AnimSaveState
.
AnimData
.
Num
();
i
++
)
{
FProcessedAnimData
&
AnimData
=
AnimSaveState
.
AnimData
[
i
];
FProcessedAnimData
&
AnimData
=
AnimSaveState
.
AnimData
[
i
];
...
@@ -469,7 +460,9 @@ bool AMCController::PreprocessRecording(float StartHaltingPoint, float EndHaltin
...
@@ -469,7 +460,9 @@ bool AMCController::PreprocessRecording(float StartHaltingPoint, float EndHaltin
}
}
//---Smoothing of legs---
}
void
AMCController
::
LegHipSmoothing
()
{
int
smoothTimes
=
LegSmoothTimes
;
int
smoothTimes
=
LegSmoothTimes
;
for
(
int
l
=
0
;
l
<
smoothTimes
;
l
++
)
{
for
(
int
l
=
0
;
l
<
smoothTimes
;
l
++
)
{
...
@@ -538,8 +531,9 @@ bool AMCController::PreprocessRecording(float StartHaltingPoint, float EndHaltin
...
@@ -538,8 +531,9 @@ bool AMCController::PreprocessRecording(float StartHaltingPoint, float EndHaltin
}
}
}
}
//---find halting points and scale them up---
}
void
AMCController
::
ScaleHaltingAreas
(
float
StartHaltingPoint
,
float
EndHaltingPoint
)
{
//end point
//end point
if
(
EndHaltingPoint
>
0.f
)
{
if
(
EndHaltingPoint
>
0.f
)
{
...
@@ -669,8 +663,9 @@ bool AMCController::PreprocessRecording(float StartHaltingPoint, float EndHaltin
...
@@ -669,8 +663,9 @@ bool AMCController::PreprocessRecording(float StartHaltingPoint, float EndHaltin
}
}
//---shift whole body so that it is centered around the green foot indicators---
}
void
AMCController
::
CenterBodyOnFootIndicators
()
{
int
amount
=
0
;
int
amount
=
0
;
int
start
=
0
;
int
start
=
0
;
...
@@ -712,8 +707,9 @@ bool AMCController::PreprocessRecording(float StartHaltingPoint, float EndHaltin
...
@@ -712,8 +707,9 @@ bool AMCController::PreprocessRecording(float StartHaltingPoint, float EndHaltin
}
}
//---Shift Hip To Reducing Center---
}
void
AMCController
::
HipHandling
()
{
FVector
HipReducingCenterAbsolute
=
HipReducingCenter
+
0.5f
*
(
LeftFootPlane
->
GetActorLocation
()
+
RightFootPlane
->
GetActorLocation
());
FVector
HipReducingCenterAbsolute
=
HipReducingCenter
+
0.5f
*
(
LeftFootPlane
->
GetActorLocation
()
+
RightFootPlane
->
GetActorLocation
());
if
(
HipShiftToReducingCenter
)
{
if
(
HipShiftToReducingCenter
)
{
...
@@ -809,7 +805,9 @@ bool AMCController::PreprocessRecording(float StartHaltingPoint, float EndHaltin
...
@@ -809,7 +805,9 @@ bool AMCController::PreprocessRecording(float StartHaltingPoint, float EndHaltin
}
}
//---Controlling Chest Position---
}
void
AMCController
::
ChestHandling
()
{
if
(
ChestControlFactor
>
0.f
)
{
if
(
ChestControlFactor
>
0.f
)
{
FVector
AvgChestPos
;
FVector
AvgChestPos
;
...
@@ -871,10 +869,11 @@ bool AMCController::PreprocessRecording(float StartHaltingPoint, float EndHaltin
...
@@ -871,10 +869,11 @@ bool AMCController::PreprocessRecording(float StartHaltingPoint, float EndHaltin
}
}
}
}
//---adjust feet position so that they are located at the green foot indicators---
}
amount
=
0
;
void
AMCController
::
FeetPositions
()
{
start
=
0
;
int
amount
=
0
;
int
start
=
0
;
for
(
int
i
=
0
;
i
<
AnimSaveState
.
AnimData
.
Num
()
&&
LockFeet
&&
LeftFootPlane
&&
RightFootPlane
;
i
++
)
{
for
(
int
i
=
0
;
i
<
AnimSaveState
.
AnimData
.
Num
()
&&
LockFeet
&&
LeftFootPlane
&&
RightFootPlane
;
i
++
)
{
...
@@ -992,7 +991,9 @@ bool AMCController::PreprocessRecording(float StartHaltingPoint, float EndHaltin
...
@@ -992,7 +991,9 @@ bool AMCController::PreprocessRecording(float StartHaltingPoint, float EndHaltin
}
}
//---return to default pose at start and end---
}
void
AMCController
::
TakeDefaultPose
()
{
FSensorData
DefaultPose
;
FSensorData
DefaultPose
;
if
(
ReturnToDefaultPose
)
{
if
(
ReturnToDefaultPose
)
{
...
@@ -1085,6 +1086,45 @@ bool AMCController::PreprocessRecording(float StartHaltingPoint, float EndHaltin
...
@@ -1085,6 +1086,45 @@ bool AMCController::PreprocessRecording(float StartHaltingPoint, float EndHaltin
}
}
}
}
}
bool
AMCController
::
PreprocessRecording
(
float
StartHaltingPoint
,
float
EndHaltingPoint
)
{
//----translate json data to AnimSaveState.AnimData----
TranslateJsonToAnimData
();
//If the animation is empty, continue
if
(
AnimSaveState
.
AnimData
.
Num
()
<=
1
)
{
return
false
;
}
//--------process the anim data-----------
//---Sensor turned off -> interpolate
InterpolateOutages
();
//---Smoothing of legs---
LegHipSmoothing
();
//---find halting points and scale them up---
ScaleHaltingAreas
(
StartHaltingPoint
,
EndHaltingPoint
);
//---shift whole body so that it is centered around the green foot indicators---
CenterBodyOnFootIndicators
();
//---Shift Hip To Reducing Center---
HipHandling
();
//---Controlling Chest Position---
ChestHandling
();
//---adjust feet position so that they are located at the green foot indicators---
FeetPositions
();
//---return to default pose at start and end---
TakeDefaultPose
();
AnimSaveState
.
NextFrame
=
FTimespan
();
AnimSaveState
.
NextFrame
=
FTimespan
();
return
true
;
return
true
;
...
...
This diff is collapsed.
Click to expand it.
Source/MoCapPlugin/Public/MCController.h
+
9
−
0
View file @
2bc858be
...
@@ -102,6 +102,15 @@ protected:
...
@@ -102,6 +102,15 @@ protected:
void
SaveToAnimMode
();
void
SaveToAnimMode
();
void
ScaleAnimDataInterval
(
int
start
,
int
end
,
float
DeltaTime
,
LinearTransformType
LinearTransType
,
float
EasingExponent
);
void
ScaleAnimDataInterval
(
int
start
,
int
end
,
float
DeltaTime
,
LinearTransformType
LinearTransType
,
float
EasingExponent
);
void
TranslateJsonToAnimData
();
void
InterpolateOutages
();
void
LegHipSmoothing
();
void
ScaleHaltingAreas
(
float
StartHaltingPoint
,
float
EndHaltingPoint
);
void
CenterBodyOnFootIndicators
();
void
HipHandling
();
void
ChestHandling
();
void
FeetPositions
();
void
TakeDefaultPose
();
bool
PreprocessRecording
(
float
StartHaltingPoint
,
float
EndHaltingPoint
);
bool
PreprocessRecording
(
float
StartHaltingPoint
,
float
EndHaltingPoint
);
void
InputNextFrame
();
void
InputNextFrame
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment