public ActionResult AddOrEdit(Animesh mov)
 {
     using (DBModel db = new DBModel())
     {
         try
         {
             if (mov.ID == 0)
             {
                 db.Animeshes.Add(mov);
                 db.SaveChanges();
                 return(Json(new { success = true, message = "Saved Successfully!!" }, JsonRequestBehavior.AllowGet));
             }
             else
             {
                 db.Entry(mov).State = EntityState.Modified;
                 db.SaveChanges();
                 return(Json(new { success = true, message = "Updated Successfully!!" }, JsonRequestBehavior.AllowGet));
             }
         }
         catch (DbEntityValidationException e)
         {
             foreach (var eve in e.EntityValidationErrors)
             {
                 Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                   eve.Entry.Entity.GetType().Name, eve.Entry.State);
                 foreach (var ve in eve.ValidationErrors)
                 {
                     Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                       ve.PropertyName, ve.ErrorMessage);
                 }
             }
             throw;
         }
     }
 }
 public ActionResult Delete(int id)
 {
     using (DBModel db = new DBModel())
     {
         Animesh mov = db.Animeshes.Where(x => x.ID == id).FirstOrDefault <Animesh>();
         db.Animeshes.Remove(mov);
         db.SaveChanges();
         return(Json(new { success = true, message = "Deleted Successfully!!" }, JsonRequestBehavior.AllowGet));
     }
 }
Пример #3
0
        public static AnimeshController <HalfEdgeTopology> Controller(this Animesh mesh, ISceneView sv)
        {
            var controller = mesh.Components.Get <AnimeshController <HalfEdgeTopology> >();

            if (controller == null)
            {
                mesh.Components.Add(controller = new AnimeshController <HalfEdgeTopology>(sv));
            }
            return(controller);
        }
 private static IEnumerable <int> GetLinkedBoneIndexes(Animesh animesh)
 {
     foreach (var vertex in animesh.Vertices)
     {
         if (vertex.BlendIndices.Index0 != 0)
         {
             yield return(vertex.BlendIndices.Index0);
         }
         if (vertex.BlendIndices.Index1 != 0)
         {
             yield return(vertex.BlendIndices.Index1);
         }
         if (vertex.BlendIndices.Index2 != 0)
         {
             yield return(vertex.BlendIndices.Index2);
         }
         if (vertex.BlendIndices.Index3 != 0)
         {
             yield return(vertex.BlendIndices.Index3);
         }
     }
 }
Пример #5
0
 void Awake()
 {
     navMeshAgent = GetComponent <UnityEngine.AI.NavMeshAgent>();
     animesh      = transform.GetChild(0).GetComponent <Animesh>();
 }
Пример #6
0
 public static AnimeshController <HalfEdgeTopology> Controller(this Animesh mesh) =>
 mesh.Components.Get <AnimeshController <HalfEdgeTopology> >();
Пример #7
0
 public static Vector2 TransformedVertexPosition(this Animesh mesh, int index) =>
 mesh.ApplySkinning(mesh.CalcVertexPositionInParentSpace(index), mesh.Controller().Vertices[index].SkinningWeights);
Пример #8
0
 public static Vector2 CalcVertexPositionInParentSpace(this Animesh mesh, int index) =>
 mesh.CalcLocalToParentTransform().TransformVector(mesh.CalcVertexPositionInCurrentSpace(index));
Пример #9
0
 public static Vector2 CalcVertexPositionInCurrentSpace(this Animesh mesh, int index) =>
 mesh.Controller().Vertices[index].Pos;
Пример #10
0
 public static Vector2 ApplySkinning(this Animesh mesh, Vector2 vector, SkinningWeights weights) =>
 mesh.ParentWidget.BoneArray.ApplySkinningToVector(vector, weights);