private UpdateTransformMask ( |
||
mask | ||
serializedProperty | UnityEditor.SerializedProperty | |
Résultat | void |
private void UpdateMask(ClipAnimationMaskType maskType) { if (this.clipInfo != null) { if (maskType == ClipAnimationMaskType.CreateFromThisModel) { SerializedObject serializedObject = this.clipInfo.maskTypeProperty.serializedObject; ModelImporter modelImporter = serializedObject.targetObject as ModelImporter; AvatarMaskUtility.UpdateTransformMask(this.m_TransformMask, modelImporter.transformPaths, this.humanTransforms); this.FillNodeInfos(); } else if (maskType == ClipAnimationMaskType.CopyFromOther) { AvatarMask avatarMask = this.clipInfo.maskSourceProperty.objectReferenceValue as AvatarMask; if (avatarMask != null) { AvatarMask avatarMask2 = base.target as AvatarMask; avatarMask2.Copy(avatarMask); if (this.humanTransforms != null) { AvatarMaskUtility.SetActiveHumanTransforms(avatarMask2, this.humanTransforms); } this.clipInfo.MaskToClip(avatarMask2); this.FillNodeInfos(); } } else if (maskType == ClipAnimationMaskType.None) { AvatarMask mask = new AvatarMask(); ModelImporter.UpdateTransformMask(mask, this.clipInfo.transformMaskProperty); } AvatarMask mask2 = base.target as AvatarMask; this.clipInfo.MaskFromClip(mask2); } }
static public void UpdateTransformMask(SerializedProperty transformMask, string[] refTransformsPath, string[] currentPaths, bool areActivePaths = true) { // if areActivePaths=true, currentPaths is treated as the list of active transform paths // else, currentPaths is treated as the list of inactive transform paths AvatarMask refMask = new AvatarMask(); refMask.transformCount = refTransformsPath.Length; for (int i = 0; i < refTransformsPath.Length; i++) { bool isActiveTransform; if (currentPaths == null) { isActiveTransform = true; } else if (areActivePaths) { isActiveTransform = ArrayUtility.FindIndex(currentPaths, s => refTransformsPath[i] == s) != -1; } else { isActiveTransform = ArrayUtility.FindIndex(currentPaths, s => refTransformsPath[i] == s) == -1; } refMask.SetTransformPath(i, refTransformsPath[i]); refMask.SetTransformActive(i, isActiveTransform); } ModelImporter.UpdateTransformMask(refMask, transformMask); }
private void UpdateMask(ClipAnimationMaskType maskType) { if (clipInfo == null) { return; } if (maskType == ClipAnimationMaskType.CreateFromThisModel) { SerializedObject so = clipInfo.maskTypeProperty.serializedObject; ModelImporter modelImporter = so.targetObject as ModelImporter; AvatarMaskUtility.UpdateTransformMask(m_TransformMask, modelImporter.transformPaths, humanTransforms); UpdateTransformInfos(); } else if (maskType == ClipAnimationMaskType.CopyFromOther) { AvatarMask maskSource = clipInfo.maskSourceProperty.objectReferenceValue as AvatarMask; if (maskSource != null) { AvatarMask maskDest = target as AvatarMask; maskDest.Copy(maskSource); // If this is a human clip make sure that all human transform path are set to true if (humanTransforms != null) { AvatarMaskUtility.SetActiveHumanTransforms(maskDest, humanTransforms); } clipInfo.MaskToClip(maskDest); UpdateTransformInfos(); } } else if (maskType == ClipAnimationMaskType.None) { var emptyMask = new AvatarMask(); ModelImporter.UpdateTransformMask(emptyMask, clipInfo.transformMaskProperty); } AvatarMask mask = target as AvatarMask; clipInfo.MaskFromClip(mask); }
public void MaskToClip(AvatarMask mask) { SerializedProperty serializedProperty = this.Get("bodyMask"); if (serializedProperty != null && serializedProperty.isArray) { for (AvatarMaskBodyPart avatarMaskBodyPart = AvatarMaskBodyPart.Root; avatarMaskBodyPart < AvatarMaskBodyPart.LastBodyPart; avatarMaskBodyPart++) { if (avatarMaskBodyPart >= (AvatarMaskBodyPart)serializedProperty.arraySize) { serializedProperty.InsertArrayElementAtIndex((int)avatarMaskBodyPart); } serializedProperty.GetArrayElementAtIndex((int)avatarMaskBodyPart).intValue = ((!mask.GetHumanoidBodyPartActive(avatarMaskBodyPart)) ? 0 : 1); } } SerializedProperty serializedProperty2 = this.Get("transformMask"); ModelImporter.UpdateTransformMask(mask, serializedProperty2); }
public void MaskToClip(AvatarMask mask) { SerializedProperty property = this.Get("bodyMask"); if ((property != null) && property.isArray) { for (AvatarMaskBodyPart part = AvatarMaskBodyPart.Root; part < AvatarMaskBodyPart.LastBodyPart; part += 1) { if (part >= property.arraySize) { property.InsertArrayElementAtIndex((int)part); } property.GetArrayElementAtIndex((int)part).intValue = !mask.GetHumanoidBodyPartActive(part) ? 0 : 1; } } SerializedProperty serializedProperty = this.Get("transformMask"); ModelImporter.UpdateTransformMask(mask, serializedProperty); }
public void MaskToClip(AvatarMask mask) { SerializedProperty serializedProperty = this.Get("bodyMask"); if (serializedProperty != null && serializedProperty.isArray) { for (int i = 0; i < mask.humanoidBodyPartCount; i++) { if (i >= serializedProperty.arraySize) { serializedProperty.InsertArrayElementAtIndex(i); } serializedProperty.GetArrayElementAtIndex(i).intValue = ((!mask.GetHumanoidBodyPartActive(i)) ? 0 : 1); } } SerializedProperty serializedProperty2 = this.Get("transformMask"); ModelImporter.UpdateTransformMask(mask, serializedProperty2); }
public void MaskToClip(AvatarMask mask) { SerializedProperty serializedProperty1 = this.Get("bodyMask"); if (serializedProperty1 != null && serializedProperty1.isArray) { for (AvatarMaskBodyPart index = AvatarMaskBodyPart.Root; index < AvatarMaskBodyPart.LastBodyPart; ++index) { if (index >= (AvatarMaskBodyPart)serializedProperty1.arraySize) { serializedProperty1.InsertArrayElementAtIndex((int)index); } serializedProperty1.GetArrayElementAtIndex((int)index).intValue = !mask.GetHumanoidBodyPartActive(index) ? 0 : 1; } } SerializedProperty serializedProperty2 = this.Get("transformMask"); ModelImporter.UpdateTransformMask(mask, serializedProperty2); }
public void MaskToClip(AvatarMask mask) { SerializedProperty bodyMask = Get("bodyMask"); if (bodyMask != null && bodyMask.isArray) { for (AvatarMaskBodyPart i = 0; i < AvatarMaskBodyPart.LastBodyPart; i++) { if ((int)i >= bodyMask.arraySize) { bodyMask.InsertArrayElementAtIndex((int)i); } bodyMask.GetArrayElementAtIndex((int)i).intValue = mask.GetHumanoidBodyPartActive(i) ? 1 : 0; } } SerializedProperty transformMask = transformMaskProperty; ModelImporter.UpdateTransformMask(mask, transformMask); }