public void SetBehavior(SteamVR_Skeleton_PoserBehavior behavior) { this.behavior = behavior; // blendPoses = new SkeletonBlendablePose[behavior.skeletonAdditionalPoses.Count + 1]; blendPoses = new SkeletonBlendablePose[behavior.allPoses.Length]; for (int i = 0; i < blendPoseCount; i++) { blendPoses[i] = new SkeletonBlendablePose(GetPoseByIndex(behavior, i)); // blendPoses[i].PoseToSnapshots(); } blendingBehaviours.Clear(); for (int i = 0; i < behavior.blendingBehaviours.Count; i++) { blendingBehaviours.Add(new PoseBlendingBehaviour(behavior.blendingBehaviours[i])); } // NOTE: Is there a better way to get the bone count? idk // boneCount = behavior.skeletonMainPose.leftHand.bonePositions.Length; boneCount = behavior.allPoses[0].leftHand.bonePositions.Length; blendedSnapshotL = new SteamVR_Skeleton_PoseSnapshot(boneCount, HandType.LeftHand); blendedSnapshotR = new SteamVR_Skeleton_PoseSnapshot(boneCount, HandType.RightHand); }
protected void OnEnable() { poserBehavior = (SteamVR_Skeleton_PoserBehavior)target; allPosesProperty = serializedObject.FindProperty("allPoses"); blendingBehaviourArray = serializedObject.FindProperty("blendingBehaviours"); blendbuttonWidth = GUILayout.Width(28); blendButtonStyle = EditorStyles.miniButton; }
public SteamVR_Skeleton_Pose GetPoseByIndex(SteamVR_Skeleton_PoserBehavior originalPoser, int index) { return(originalPoser.allPoses[index]); // if (index == 0) { return originalPoser.skeletonMainPose; } // else { return originalPoser.skeletonAdditionalPoses[index - 1]; } }