20tab / UnrealEnginePython

Embed Python in Unreal Engine 4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Edit joint attribute SkeletalMesh

michaelStettler opened this issue · comments

I am trying to modify a specific joint rotation's value. I used the following to access my Skeleton and I can find my joint of interest:

from unreal_engine.classes import SkeletalMesh, Skeleton

monkey = ue.load_object(SkeletalMesh, '/Game/Mesh/monkey')
skeleton = monkey.Skeleton
print(skeleton.skeleton_find_bone_index('M_jaw_jnt02'))

But I can't figure out how to access the joint attributes and modify its value. I tried to read carefully the tutorial about Static and Skeletal Mesh ([tutorial])(https://github.com/20tab/UnrealEnginePython/blob/master/tutorials/SnippetsForStaticAndSkeletalMeshes.md#animations-root-motion-from-svg-path) but haven't found anything.

I am hoping to have something like:
joint = skeleton.get_joint('M_jaw_jnt02')
joint.set_actor_rotation(rotation)

Any help welcomed!

So I did find a way to workaround my issue. I use Blueprint to drive my joints using a poseable mesh as explained here: https://answers.unrealengine.com/questions/263556/how-to-create-a-poseable-mesh.html
Then I set up a small blueprint code where I createed a variable (OpenMouth) to drive my joint of interest (M_jaw_jnt02). Finally, I use the two following commands on my python script to set my variable (OpenMouth) to true and it all worked fine!

    avatar = ue.load_object(Blueprint, '/Game/BluePrintClass/BP_MonkeyHead')
    avatar.GeneratedClass.get_cdo().OpenMouth = True