Skip to content

Commit

Permalink
Merge pull request #205 from hossinasaadi/frame-time
Browse files Browse the repository at this point in the history
overriding BVH Frame Time
  • Loading branch information
hjessmith authored Aug 16, 2023
2 parents db49f18 + 69d2e44 commit c5c3bc7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions animated_drawings/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,15 @@ def __init__(self, motion_cfg_fn: str) -> None: # noqa: C901
logging.critical(msg)
assert False, msg

# validate frame time override
try:
self.frame_time: Optional[float] = motion_cfg.get('frame_time', None)
assert isinstance(self.frame_time, (NoneType, float)), 'is not None or float'
except (AssertionError, ValueError) as e:
msg = f'Error in frame_time config parameter: {e}'
logging.critical(msg)
assert False, msg

# validate groundplane joint
try:
self.groundplane_joint: str = motion_cfg['groundplane_joint']
Expand Down
4 changes: 4 additions & 0 deletions animated_drawings/model/retargeter.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ def __init__(self, motion_cfg: MotionConfig, retarget_cfg: RetargetConfig) -> No
# bvh joints defining a set of vectors that skeleton's fwd is perpendicular to
self.forward_perp_vector_joint_names: List[Tuple[str, str]] = motion_cfg.forward_perp_joint_vectors

# override the frame_time, if one was specified within motion_cfg
if motion_cfg.frame_time:
self.bvh.frame_time = motion_cfg.frame_time

# rotate BVH skeleton so up is +Y
if motion_cfg.up == '+y':
pass # no rotation needed
Expand Down
3 changes: 3 additions & 0 deletions examples/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ If you want to skip beginning motion frames, this can be set to an int between 0
- <b>end_frame_idx</b> <em>(int)</em>:
If you want to skip ending motion frames, this can be set to an int between `start_frame_idx+1` and the BVH Frames Count, inclusive.

- <b>frame_time</b> <em>(float)</em>:
If you want to override the frame time specified within the BVH, you can set it here.

- <b>groundplane_joint</b> <em>(str)</em>:
The name of a joint that exists within the BVH's skeleton.
When visualizing the BVH's motion, the skeleton will have it's worldspace y offset adjusted so this joint is within the y=0 plane at `start_frame_idx`.
Expand Down

0 comments on commit c5c3bc7

Please sign in to comment.