Exemple #1
0
    static void WriteToJson(Poses poses)
    {
        var json   = JsonUtility.ToJson(poses, true);
        var writer = File.CreateText(filepath);

        writer.Close();

        File.WriteAllText(filepath, json);
    }
Exemple #2
0
        public async Task <JsonResult> OnGetPoseImageAsync(int index, String poseName)
        {
            //Retrieve the entire chakra list
            List <Chakra> ChakraList = await cosmosDbService.GetChakrasAsync();

            //Using the index value and pose name retrieve the Pose.
            Poses p = ChakraList[index].Poses.Where(x => x.name == poseName).FirstOrDefault();

            return(new JsonResult(p));
        }
        public PlayercastStatue(Mobile owner)
        {
            BaseStatue.AddStatue(this);

            Blessed = true;
            Body    = 0x190;
            Hue     = 0;
            Name    = "a statue";

            m_Material = MaterialType.GrayMarble;
            m_Owner    = owner;
            m_Pose     = Poses.Ready;

            BeginUpdate();
        }
        public override void AddPose(Pose pose)
        {
            Poses.Add(pose);

            // precompute the matrix for each joint for each animation frame
            SkeletalPose p = pose as SkeletalPose;
            SkeletalPose calculatedPose = new SkeletalPose(p.MatrixArray.Length);

            // multiply each animation joint matrix by its relevant inverse bind pose joint matrix
            for (int i = 0; i < calculatedPose.MatrixArray.Length; i++)
            {
                calculatedPose[i] = Skeleton.InverseBindPose[i] * p[i];
            }

            posePoses.Add(pose.Name, calculatedPose);
        }
Exemple #5
0
    static Poses ReadFromJson()
    {
        var poses = new Poses();

        if (File.Exists(filepath))
        {
            var json = File.ReadAllText(filepath);
            poses = JsonUtility.FromJson <Poses>(json);
        }

        if (poses == null)
        {
            poses = new Poses();
        }

        return(poses);
    }
Exemple #6
0
        public void SetPose(Poses pose)
        {
            switch (pose)
            {
            case Poses.Normal:
                _playerGameObject.Sprite.UpdateTexture(_playerPose);
                break;

            case Poses.Pose_1:
                _playerGameObject.Sprite.UpdateTexture(_pose1);
                break;

            case Poses.Pose_2:
                _playerGameObject.Sprite.UpdateTexture(_pose2);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            #region v0
            m_Plinth    = reader.ReadItem() as Plinth;
            m_HasPlinth = (m_Plinth != null);

            m_Material = (MaterialType)reader.ReadInt();

            m_Owner = reader.ReadMobile();

            m_Pose = (Poses)reader.ReadInt();
            #endregion

            if (!BaseStatue.AllStatues.Contains(this))
            {
                BaseStatue.AddStatue(this);
            }

            BeginUpdate();
        }
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			#region v0
			m_Plinth = reader.ReadItem() as Plinth;
			m_HasPlinth = (m_Plinth != null);

			m_Material = (MaterialType)reader.ReadInt();

			m_Owner = reader.ReadMobile();

			m_Pose = (Poses)reader.ReadInt();
			#endregion

			if( !BaseStatue.AllStatues.Contains( this ) )
				BaseStatue.AddStatue( this );

			BeginUpdate();
		}
		public PlayercastStatue( Mobile owner )
		{
			BaseStatue.AddStatue( this );

			Blessed = true;
			Body = 0x190;
			Hue = 0;
			Name = "a statue";

			m_Material = MaterialType.GrayMarble;
			m_Owner = owner;
			m_Pose = Poses.Ready;

			BeginUpdate();
		}
 // Update is called once per frame
 void Update()
 {
     // Update skeleton pose
     if (kinectManager != null && kinectManager.GetData() != null)
     {
         pose = EstimatePose();
     }
 }
Exemple #11
0
 public virtual void AddPose(Pose pose)
 {
     Poses.Add(pose);
 }
        private void ExportTakesToKeyframes(int formatType, ParseFBX fbx, string rotateXdeg, string rotateYdeg, string rotateZdeg)
        {
            string rigType = "unknown";
            List<string> headFilter = new List<string>();
            List<string> armsFilter = new List<string>();
            List<Poses> clipPoses = new List<Poses>();

            // == Extract list of clips

            // For extractng the data
            string[] items;
            // Starting on the fourth line following the file name and the rotation
            for (int s = 3; s < source.Count; s++)
            {
                items = ParseData.SplitItemByDivision(source[s]);
                switch (items[0].ToLowerInvariant())
                {
                    case GlobalSettings.itemRigType:
                        if (items.Length > 1)
                        {
                            rigType = items[1].ToLowerInvariant();
                        }
                        break;
                    case GlobalSettings.itemHeadBones:
                        if (items.Length > 1)
                        {
                            for (int b = 1; b < items.Length; b++)
                            {
                                headFilter.Add(items[b]);
                            }
                        }
                        break;
                    case GlobalSettings.itemArmsBones:
                        if (items.Length > 1)
                        {
                            for (int b = 1; b < items.Length; b++)
                            {
                                armsFilter.Add(items[b]);
                            }
                        }
                        break;
                    case GlobalSettings.itemHeadTake:
                        if (items.Length > 2)
                        {
                            Poses pose = new Poses();
                            pose.poseType = GlobalSettings.itemHeadTake;
                            pose.takeName = items[1];
                            pose.poseName = items[2];
                            pose.centreFrame = 0;
                            if (items.Length > 3)
                            {
                                pose.centreFrame = ParseData.FloatFromString(items[3]);
                            }
                            clipPoses.Add(pose);
                        }
                        break;
                    case GlobalSettings.itemArmsTake:
                        if (items.Length > 2)
                        {
                            Poses pose = new Poses();
                            pose.poseType = GlobalSettings.itemArmsTake;
                            pose.takeName = items[1];
                            pose.poseName = items[2];
                            pose.centreFrame = 0;
                            if (items.Length > 3)
                            {
                                pose.centreFrame = ParseData.FloatFromString(items[3]);
                            }
                            clipPoses.Add(pose);
                        }
                        break;
                    case GlobalSettings.itemClipTake:
                        if (items.Length > 2)
                        {
                            Poses pose = new Poses();
                            pose.poseType = GlobalSettings.itemClipTake;
                            pose.takeName = items[1];
                            pose.poseName = items[2];
                            pose.centreFrame = 0;
                            clipPoses.Add(pose);
                        }
                        break;
                    case GlobalSettings.itemMergeClips:
                        if (items.Length > 3)
                        {
                            string upperfile = fbx.GetFullPath(items[1]);
                            string lowerfile = fbx.GetFullPath(items[2]);
                            string mergefile = fbx.GetKeyframeFileName(rigType, items[3], GlobalSettings.itemClipTake);
                            MergeAnimationsFromFiles(
                                upperfile, lowerfile, mergefile,
                                rotateXdeg, rotateYdeg, rotateZdeg,
                                headFilter, armsFilter);
                        }
                        break;
                }
            }

            // == Export each clip
            for (int c = 0; c < clipPoses.Count; c++)
            {
                // Get the filename to load each take from
                string fileName = "";
                if (formatType == 1)
                {
                    // In type 1 only the animation (action, take) name is included in the config file
                    fileName = fbx.GetTakeFileName(clipPoses[c].takeName);
                }
                else if (formatType == 2)
                {
                    // In type 2 the file including extension that contains the
                    // animation is included in the config file
                    fileName = fbx.GetFullPath(clipPoses[c].takeName);
                }
                else
                {
                    // Error but we should never get this far anyway
                    return;
                }
                if (File.Exists(fileName))
                {
                    // Add each animation in to the form
                    form.LoadAnimationTakes(fileName, rotateXdeg, rotateYdeg, rotateZdeg);
                    // The animation loaded must have been selected as the current animation for this to work
                    List<string> exportData;
                    if (clipPoses[c].poseType == GlobalSettings.itemHeadTake)
                    {
                        exportData = GetSaveClipData(form.GetCurrentClip(), false, form.GetBoneMap(), clipPoses[c].takeName, headFilter, clipPoses[c].centreFrame);
                    }
                    else if (clipPoses[c].poseType == GlobalSettings.itemArmsTake)
                    {
                        exportData = GetSaveClipData(form.GetCurrentClip(), false, form.GetBoneMap(), clipPoses[c].takeName, armsFilter, clipPoses[c].centreFrame);
                    }
                    else
                    {
                        exportData = GetSaveClipData(form.GetCurrentClip(), true, form.GetBoneMap(), clipPoses[c].takeName, null, 0);
                    }

                    if (exportData == null || exportData.Count < 1)
                    {
                        // Nothing to save go to the next one
                        continue;
                    }
                    // Save the file
                    fileName = fbx.GetKeyframeFileName(rigType, clipPoses[c].poseName, clipPoses[c].poseType);
                    form.AddMessageLine("Saving: " + fileName);
                    File.WriteAllLines(fileName, exportData);
                }
                else
                {
                    form.AddMessageLine("Animation does not exist: " + fileName);
                }
            }
        }
        public JsonResult OnGetPoseImage(int chakraIndex, String poseName)
        {
            Poses pose = (Poses)PosesByChakra[chakraIndex].Where(x => x.name == poseName);

            return(new JsonResult(pose.picture));
        }
Exemple #14
0
 // Start is called before the first frame update
 void Start()
 {
     myPose = Poses.LatSpread;
 }