SetTransformPath() private method

private SetTransformPath ( int index, string path ) : void
index int
path string
return void
Example #1
0
		static void CreateMask()
		{
			Animator animator;

			if(!Selection.activeGameObject)
			{
				return;
			}

			animator = Selection.activeGameObject.GetComponent<Animator>();

			if(!animator)
			{
				return;
			}

			List<Transform> transforms = new List<Transform>();

			AvatarMask avatarMask = new AvatarMask();

			animator.GetComponentsInChildren<Transform>(true,transforms);

			avatarMask.transformCount = transforms.Count;
			
			int index = 0;
			
			foreach(Transform transform in transforms)
			{
				avatarMask.SetTransformPath(index, AnimationUtility.CalculateTransformPath(transform,animator.transform));
				avatarMask.SetTransformActive(index, true);
				index++;
			}
			
			ScriptableObjectUtility.CreateAssetWithSavePanel<AvatarMask>(avatarMask,"Create Mask",animator.name+".mask","mask","Create a new Avatar Mask");
		}
 public static void UpdateTransformMask(AvatarMask mask, string[] refTransformsPath, string[] humanTransforms)
 {
   // ISSUE: object of a compiler-generated type is created
   // ISSUE: variable of a compiler-generated type
   AvatarMaskUtility.\u003CUpdateTransformMask\u003Ec__AnonStorey87 maskCAnonStorey87 = new AvatarMaskUtility.\u003CUpdateTransformMask\u003Ec__AnonStorey87();
   // ISSUE: reference to a compiler-generated field
   maskCAnonStorey87.refTransformsPath = refTransformsPath;
   // ISSUE: reference to a compiler-generated field
   mask.transformCount = maskCAnonStorey87.refTransformsPath.Length;
   // ISSUE: object of a compiler-generated type is created
   // ISSUE: variable of a compiler-generated type
   AvatarMaskUtility.\u003CUpdateTransformMask\u003Ec__AnonStorey88 maskCAnonStorey88 = new AvatarMaskUtility.\u003CUpdateTransformMask\u003Ec__AnonStorey88();
   // ISSUE: reference to a compiler-generated field
   maskCAnonStorey88.\u003C\u003Ef__ref\u0024135 = maskCAnonStorey87;
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   for (maskCAnonStorey88.i = 0; maskCAnonStorey88.i < maskCAnonStorey87.refTransformsPath.Length; maskCAnonStorey88.i = maskCAnonStorey88.i + 1)
   {
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     mask.SetTransformPath(maskCAnonStorey88.i, maskCAnonStorey87.refTransformsPath[maskCAnonStorey88.i]);
     // ISSUE: reference to a compiler-generated method
     bool flag = humanTransforms == null || ArrayUtility.FindIndex<string>(humanTransforms, new Predicate<string>(maskCAnonStorey88.\u003C\u003Em__149)) != -1;
     // ISSUE: reference to a compiler-generated field
     mask.SetTransformActive(maskCAnonStorey88.i, flag);
   }
 }
 public void ConfigureMaskFromClip(ref AvatarMask mask)
 {
     mask.transformCount = this.m_TransformMask.Length;
     for (int i = 0; i < mask.transformCount; i++)
     {
         mask.SetTransformPath(i, this.m_TransformMask[i].path);
         mask.SetTransformActive(i, this.m_TransformMask[i].weight > 0f);
     }
     for (int j = 0; j < this.m_BodyMask.Length; j++)
     {
         mask.SetHumanoidBodyPartActive((AvatarMaskBodyPart) j, this.m_BodyMask[j] != 0);
     }
 }
 public void MaskFromClip(AvatarMask mask)
 {
     SerializedProperty property = this.Get("bodyMask");
     if ((property != null) && property.isArray)
     {
         for (AvatarMaskBodyPart part = AvatarMaskBodyPart.Root; part < AvatarMaskBodyPart.LastBodyPart; part += 1)
         {
             mask.SetHumanoidBodyPartActive(part, property.GetArrayElementAtIndex((int) part).intValue != 0);
         }
     }
     SerializedProperty property2 = this.Get("transformMask");
     if ((property2 != null) && property2.isArray)
     {
         if ((property2.arraySize > 0) && (mask.transformCount != property2.arraySize))
         {
             mask.transformCount = property2.arraySize;
         }
         int arraySize = property2.arraySize;
         if (arraySize != 0)
         {
             SerializedProperty arrayElementAtIndex = property2.GetArrayElementAtIndex(0);
             for (int i = 0; i < arraySize; i++)
             {
                 SerializedProperty property4 = arrayElementAtIndex.FindPropertyRelative("m_Path");
                 SerializedProperty property5 = arrayElementAtIndex.FindPropertyRelative("m_Weight");
                 mask.SetTransformPath(i, property4.stringValue);
                 mask.SetTransformActive(i, property5.floatValue > 0.5);
                 arrayElementAtIndex.Next(false);
             }
         }
     }
 }
 public static void builAvatarMask(GameObject gameObject, SpineData spineData, Animator animator, string directory, string name)
 {
     Avatar avatar = AvatarBuilder.BuildGenericAvatar(gameObject,"");
     animator.avatar = avatar;
     AvatarMask avatarMask = new AvatarMask();
     string[] transofrmPaths = getTransformPaths(gameObject, spineData);
     avatarMask.transformCount = transofrmPaths.Length;
     for (int i=0; i< transofrmPaths.Length; i++){
         avatarMask.SetTransformPath(i, transofrmPaths[i]);
         avatarMask.SetTransformActive(i, true);
     }
     createFolderIfNoExists(directory, ANIMATION_FOLDER);
     AssetDatabase.CreateAsset(avatar    , directory + "/" + ANIMATION_FOLDER + "/" + name + ".anim.asset");
     AssetDatabase.CreateAsset(avatarMask, directory + "/" + ANIMATION_FOLDER + "/" + name + ".mask.asset");
 }
 public void MaskFromClip(AvatarMask mask)
 {
   SerializedProperty serializedProperty1 = this.Get("bodyMask");
   if (serializedProperty1 != null && serializedProperty1.isArray)
   {
     for (AvatarMaskBodyPart index = AvatarMaskBodyPart.Root; index < AvatarMaskBodyPart.LastBodyPart; ++index)
       mask.SetHumanoidBodyPartActive(index, serializedProperty1.GetArrayElementAtIndex((int) index).intValue != 0);
   }
   SerializedProperty serializedProperty2 = this.Get("transformMask");
   if (serializedProperty2 == null || !serializedProperty2.isArray)
     return;
   if (serializedProperty2.arraySize > 0 && mask.transformCount != serializedProperty2.arraySize)
     mask.transformCount = serializedProperty2.arraySize;
   int arraySize = serializedProperty2.arraySize;
   for (int index = 0; index < arraySize; ++index)
   {
     SerializedProperty propertyRelative1 = serializedProperty2.GetArrayElementAtIndex(index).FindPropertyRelative("m_Path");
     SerializedProperty propertyRelative2 = serializedProperty2.GetArrayElementAtIndex(index).FindPropertyRelative("m_Weight");
     mask.SetTransformPath(index, propertyRelative1.stringValue);
     mask.SetTransformActive(index, (double) propertyRelative2.floatValue > 0.5);
   }
 }
 public void MaskFromClip(AvatarMask mask)
 {
     SerializedProperty property = this.Get("bodyMask");
     if ((property != null) && property.isArray)
     {
         for (int i = 0; i < mask.humanoidBodyPartCount; i++)
         {
             mask.SetHumanoidBodyPartActive(i, property.GetArrayElementAtIndex(i).intValue != 0);
         }
     }
     SerializedProperty property2 = this.Get("transformMask");
     if ((property2 != null) && property2.isArray)
     {
         if ((property2.arraySize > 0) && (mask.transformCount != property2.arraySize))
         {
             mask.transformCount = property2.arraySize;
         }
         int arraySize = property2.arraySize;
         for (int j = 0; j < arraySize; j++)
         {
             SerializedProperty property3 = property2.GetArrayElementAtIndex(j).FindPropertyRelative("m_Path");
             SerializedProperty property4 = property2.GetArrayElementAtIndex(j).FindPropertyRelative("m_Weight");
             mask.SetTransformPath(j, property3.stringValue);
             mask.SetTransformActive(j, property4.floatValue > 0.5);
         }
     }
 }