Skip to content

Commit

Permalink
add isolation example
Browse files Browse the repository at this point in the history
  • Loading branch information
Wasserwecken committed May 26, 2024
1 parent bbc9f76 commit 88b6b26
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cff-version: 1.2.0
message: "You may want to cite this software like below."
title: "Read, write, edit and create .bvh files with hierarchical 3D transforms"
date-released: 2022-12-17
version: 1.4.2
version: 1.4.3
authors:
- family-names: Dolch
given-names: Eric
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,26 @@ bvhRoot = bvhio.convertHierarchyToBvh(hierarchyRoot, hierarchyRoot.getKeyframeRa
bvhio.writeBvh('test.bvh', bvhio.BvhContainer(bvhRoot, len(bvhRoot.Keyframes), 1/30))
```

### Isolate joints from the hierachy (remove root joint)
```python
import bvhio

# load data
root = bvhio.readAsHierarchy('bvhio/tests/example.bvh')

# get the joint to isolate.
# if there is a root joint you want to remove,
# you probably want to filter for the hips.
chest = root.filter('Chest')[0]

# detach the joint from the parent and set a new root
# the restpose and keyframes are modified for this joint to match the original animation
root = chest.clearParent(keep=['position', 'rotation', 'scale', 'rest', 'anim'])

# store the subhierarchy as own file
bvhio.writeHierarchy('test.bvh', root, 1/30)
```

### Interpolate between keyframes
```python
import bvhio
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "bvhio"
version = "1.4.2"
version = "1.4.3"
authors = [ { name="Wasserwecken", email="author@example.com" }, ]
description = "Read, write, edit and create .bvh files with hierarchical 3D transforms."
readme = "README.md"
Expand Down

0 comments on commit 88b6b26

Please sign in to comment.