Skip to content

Commit 3facb6e

Browse files
author
Roberto De Ioris
committed
2 parents 449356f + b669759 commit 3facb6e

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

tutorials/FixingMixamoRootMotionWithPython.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,3 +420,42 @@ Always pay attention when choosing asset names (expecially if you are automatica
420420
Remember that you can open the asset-related editor by simply calling ```ue.open_editor_for_asset(uobject)```
421421

422422
Note that calling ```ue.add_asset_view_context_menu_extension(callable)``` will generate a new context menu every time. There is currently no support for cleaning the context menu (well, except for restarting the editor :P)
423+
424+
## Update 20170927 by issue 228
425+
426+
https://github.com/20tab/UnrealEnginePython/issues/228
427+
428+
Marat Yakupov reported in issue 228 a problem with the mixamo ybot model. The problem is caused by the multiple sections available in the mesh. The mixamo.py has been updated to support multiple sections:
429+
430+
```python
431+
def fix_bones_influences(self, mesh, old_skeleton):
432+
active_bones = []
433+
for section in range(0, mesh.skeletal_mesh_sections_num()):
434+
vertices = mesh.skeletal_mesh_get_soft_vertices(0, section)
435+
ue.log_warning(len(vertices))
436+
new_vertices = []
437+
old_bone_map = mesh.skeletal_mesh_get_bone_map(0, section)
438+
new_bone_map = []
439+
440+
for vertex in vertices:
441+
bone_ids = list(vertex.influence_bones)
442+
for index, bone_id in enumerate(bone_ids):
443+
if vertex.influence_weights[index] > 0:
444+
bone_ids[index] = self.get_updated_bone_index(old_skeleton, mesh.Skeleton, old_bone_map, new_bone_map, bone_id)
445+
if new_bone_map[bone_ids[index]] not in active_bones:
446+
active_bones.append(new_bone_map[bone_ids[index]])
447+
vertex.influence_bones = bone_ids
448+
new_vertices.append(vertex)
449+
450+
# assign new vertices
451+
mesh.skeletal_mesh_set_soft_vertices(new_vertices, 0, section)
452+
# add the new bone mapping
453+
mesh.skeletal_mesh_set_bone_map(new_bone_map, 0, section)
454+
455+
# specify which bones are active and required (ensure root is added to required bones)
456+
mesh.skeletal_mesh_set_active_bone_indices(active_bones)
457+
# mark all the bones as required (eventually you can be more selective)
458+
mesh.skeletal_mesh_set_required_bones(list(range(0, mesh.Skeleton.skeleton_bones_get_num())))
459+
```
460+
461+
As you can see we still assume a single LOD (the 0 before the section is always the lod)

0 commit comments

Comments
 (0)