Ejemplo n.º 1
0
        protected void ApplyTemplate()
        {
            Undo.RegisterCompleteObjectUndo((UnityEngine.Object) this, "Apply Template");
            HumanTemplate humanTemplate = this.OpenHumanTemplate();

            if ((UnityEngine.Object)humanTemplate == (UnityEngine.Object)null)
            {
                return;
            }
            for (int index = 0; index < this.m_Bones.Length; ++index)
            {
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                AvatarMappingEditor.\u003CApplyTemplate\u003Ec__AnonStorey9E templateCAnonStorey9E = new AvatarMappingEditor.\u003CApplyTemplate\u003Ec__AnonStorey9E();
                // ISSUE: reference to a compiler-generated field
                templateCAnonStorey9E.boneName = humanTemplate.Find(this.m_Bones[index].humanBoneName);
                // ISSUE: reference to a compiler-generated field
                if (templateCAnonStorey9E.boneName.Length > 0)
                {
                    // ISSUE: reference to a compiler-generated method
                    Transform transform = this.modelBones.Keys.FirstOrDefault <Transform>(new Func <Transform, bool>(templateCAnonStorey9E.\u003C\u003Em__1CB));
                    this.m_Bones[index].bone = transform;
                }
                else
                {
                    this.m_Bones[index].bone = (Transform)null;
                }
                this.m_Bones[index].Serialize(this.serializedObject);
            }
            this.ValidateMapping();
            SceneView.RepaintAll();
        }
Ejemplo n.º 2
0
        protected void ApplyTemplate()
        {
            Undo.RegisterCompleteObjectUndo(this, "Apply Template");
            HumanTemplate template = this.OpenHumanTemplate();

            if (template != null)
            {
                for (int i = 0; i < this.m_Bones.Length; i++)
                {
Ejemplo n.º 3
0
        private void SaveHumanTemplate()
        {
            string text = EditorUtility.SaveFilePanelInProject("Create New Human Template", "New Human Template", "ht", "Create a new human template");

            if (!(text == ""))
            {
                HumanTemplate humanTemplate = new HumanTemplate();
                humanTemplate.ClearTemplate();
                for (int i = 0; i < this.m_Bones.Length; i++)
                {
                    if (this.m_Bones[i].bone != null)
                    {
                        humanTemplate.Insert(this.m_Bones[i].humanBoneName, this.m_Bones[i].bone.name);
                    }
                }
                AssetDatabase.CreateAsset(humanTemplate, text);
            }
        }
Ejemplo n.º 4
0
        private void SaveHumanTemplate()
        {
            string path = EditorUtility.SaveFilePanelInProject("Create New Human Template", "New Human Template", "ht", string.Format("Create a new human template"));

            if (path == string.Empty)
            {
                return;
            }
            HumanTemplate humanTemplate = new HumanTemplate();

            humanTemplate.ClearTemplate();
            for (int index = 0; index < this.m_Bones.Length; ++index)
            {
                if ((UnityEngine.Object) this.m_Bones[index].bone != (UnityEngine.Object)null)
                {
                    humanTemplate.Insert(this.m_Bones[index].humanBoneName, this.m_Bones[index].bone.name);
                }
            }
            AssetDatabase.CreateAsset((UnityEngine.Object)humanTemplate, path);
        }
Ejemplo n.º 5
0
        private HumanTemplate OpenHumanTemplate()
        {
            string directory = "Assets/";
            string str       = EditorUtility.OpenFilePanel("Open Human Template", directory, "ht");

            if (str == string.Empty)
            {
                return((HumanTemplate)null);
            }
            HumanTemplate humanTemplate = AssetDatabase.LoadMainAssetAtPath(FileUtil.GetProjectRelativePath(str)) as HumanTemplate;

            if ((UnityEngine.Object)humanTemplate == (UnityEngine.Object)null && EditorUtility.DisplayDialog("Human Template not found in project", "Import asset '" + str + "' into project", "Yes", "No"))
            {
                string uniqueAssetPath = AssetDatabase.GenerateUniqueAssetPath(directory + FileUtil.GetLastPathNameComponent(str));
                FileUtil.CopyFileOrDirectory(str, uniqueAssetPath);
                AssetDatabase.Refresh();
                humanTemplate = AssetDatabase.LoadMainAssetAtPath(uniqueAssetPath) as HumanTemplate;
                if ((UnityEngine.Object)humanTemplate == (UnityEngine.Object)null)
                {
                    Debug.Log((object)("Failed importing file '" + str + "' to '" + uniqueAssetPath + "'"));
                }
            }
            return(humanTemplate);
        }
 extern private static void Internal_Create([Writable] HumanTemplate self);
 private void SaveHumanTemplate()
 {
   string path = EditorUtility.SaveFilePanelInProject("Create New Human Template", "New Human Template", "ht", string.Format("Create a new human template"));
   if (path == string.Empty)
     return;
   HumanTemplate humanTemplate = new HumanTemplate();
   humanTemplate.ClearTemplate();
   for (int index = 0; index < this.m_Bones.Length; ++index)
   {
     if ((UnityEngine.Object) this.m_Bones[index].bone != (UnityEngine.Object) null)
       humanTemplate.Insert(this.m_Bones[index].humanBoneName, this.m_Bones[index].bone.name);
   }
   AssetDatabase.CreateAsset((UnityEngine.Object) humanTemplate, path);
 }
Ejemplo n.º 8
0
 public HumanTemplate()
 {
     HumanTemplate.Internal_Create(this);
 }
		private void SaveHumanTemplate()
		{
			string message = string.Format("Create a new human template", new object[0]);
			string text = EditorUtility.SaveFilePanelInProject("Create New Human Template", "New Human Template", "ht", message);
			if (text == string.Empty)
			{
				return;
			}
			HumanTemplate humanTemplate = new HumanTemplate();
			humanTemplate.ClearTemplate();
			for (int i = 0; i < this.m_Bones.Length; i++)
			{
				if (this.m_Bones[i].bone != null)
				{
					humanTemplate.Insert(this.m_Bones[i].humanBoneName, this.m_Bones[i].bone.name);
				}
			}
			AssetDatabase.CreateAsset(humanTemplate, text);
		}