Answered

Hi, the new API looks great, can you please write us a copy pose script to show us an elaborate example?

Anonymous 10 months ago updated by Peter - Soxware Developer 10 months ago 1

It would be nice to see this in action. It takes quite a while going through the trial and error and it would help a lot to see some actual functionality carried out by the new API in conjunction with the pose/clip editors.

UMotion Version:
Latest
Unity Version:
2020 LTS

Answer

Answer
Answered

Hi,

thank you very much for your support request.

With PoseEditor.GetSelectedTransforms() you can get access to the current selection. Just iterate over the transforms and store the local position, rotation and/or scale values.

List<transform> transformsList = new List<transform>();
PoseEditor.GetSelectedTransforms(transformsList);

List<Quaternion> copiedLocalRotations = new List<Quaternion>();
foreach (Transform transform in transformsList)
{
   copiedLocalRotations.Add(transform.localRotation);
}


To apply the saved pose use PoseEditor.TrySetFkLocalPosition/Rotation/Scale().

for (int index = 0; index < transformsList.Count; index++)
{
   PoseEditor.TrySetFkLocalRotation(transformsList[index], copiedLocalRotations[index], "Paste Pose", false);
}


A complete documentation of the UMotion API can be found here: https://www.soxware.com/umotion-manual/UMotionAPI.html

Please let me know in case you have any follow-up questions.


Best regards,
Peter

Answer
Answered

Hi,

thank you very much for your support request.

With PoseEditor.GetSelectedTransforms() you can get access to the current selection. Just iterate over the transforms and store the local position, rotation and/or scale values.

List<transform> transformsList = new List<transform>();
PoseEditor.GetSelectedTransforms(transformsList);

List<Quaternion> copiedLocalRotations = new List<Quaternion>();
foreach (Transform transform in transformsList)
{
   copiedLocalRotations.Add(transform.localRotation);
}


To apply the saved pose use PoseEditor.TrySetFkLocalPosition/Rotation/Scale().

for (int index = 0; index < transformsList.Count; index++)
{
   PoseEditor.TrySetFkLocalRotation(transformsList[index], copiedLocalRotations[index], "Paste Pose", false);
}


A complete documentation of the UMotion API can be found here: https://www.soxware.com/umotion-manual/UMotionAPI.html

Please let me know in case you have any follow-up questions.


Best regards,
Peter