public AnimationStateSet(AnimationStateSet rhs) : this(OgrePINVOKE.new_AnimationStateSet__SWIG_1(AnimationStateSet.getCPtr(rhs)), true)
 {
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public AnimationState(string animName, AnimationStateSet parent, float timePos, float length) : this(OgrePINVOKE.new_AnimationState__SWIG_2(animName, AnimationStateSet.getCPtr(parent), timePos, length), true)
 {
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public AnimationState(AnimationStateSet parent, AnimationState rhs) : this(OgrePINVOKE.new_AnimationState__SWIG_3(AnimationStateSet.getCPtr(parent), AnimationState.getCPtr(rhs)), true)
 {
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Beispiel #4
0
 public override void _refreshAnimationState(AnimationStateSet animSet)
 {
     OgrePINVOKE.SkeletonInstance__refreshAnimationState(swigCPtr, AnimationStateSet.getCPtr(animSet));
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Beispiel #5
0
 public void _initAnimationState(AnimationStateSet animSet)
 {
     OgrePINVOKE.SkeletonPtr__initAnimationState(swigCPtr, AnimationStateSet.getCPtr(animSet));
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Beispiel #6
0
 public void _refreshAnimationState(AnimationStateSet animSet)
 {
     OgrePINVOKE.Mesh__refreshAnimationState(swigCPtr, AnimationStateSet.getCPtr(animSet));
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public void copyMatchingState(AnimationStateSet target)
 {
     OgrePINVOKE.AnimationStateSet_copyMatchingState(swigCPtr, AnimationStateSet.getCPtr(target));
     if (OgrePINVOKE.SWIGPendingException.Pending)
     {
         throw OgrePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Beispiel #8
0
        /// <summary>
        /// This method prints on the console the list of animation tags
        /// </summary>
        private void PrintAnimationNames()
        {
            AnimationStateSet      animStateSet = robot.GameEntity.AllAnimationStates;      // Get the set of animation states in the Entity
            AnimationStateIterator animIterator = animStateSet.GetAnimationStateIterator(); // Iterates through the animation states

            while (animIterator.MoveNext())                                                 // Gets the next animation state in the set
            {
                // Console.WriteLine(animIterator.CurrentKey);                      // Print out the animation name in the current key
            }
        }
Beispiel #9
0
        private void PrintAnimationNames()
        {
            AnimationStateSet      animStateSet = robotEntity.AllAnimationStates;
            AnimationStateIterator animIterator = animStateSet.GetAnimationStateIterator();

            while (animIterator.MoveNext())
            {
                Console.WriteLine(animIterator.CurrentKey);
            }
        }
Beispiel #10
0
 public void Initialize(AnimationStateSet animationStateSet = null)
 {
     treeView.state.expandedIDs   = state.expandedIDs;
     treeView.state.lastClickedID = state.lastClickedID;
     treeView.state.searchString  = state.searchString;
     treeView.state.selectedIDs   = state.selectedIDs;
     state = treeView.state;
     this.animationStateSet = animationStateSet;
     (treeView.TreeModal as AnimationStateModel).AnimationStateSet = this.animationStateSet;
     treeView.Reload();
 }
        public AnimationStateSet getAllAnimationStates()
        {
            global::System.IntPtr cPtr = OgrePINVOKE.InstancedEntity_getAllAnimationStates(swigCPtr);
            AnimationStateSet     ret  = (cPtr == global::System.IntPtr.Zero) ? null : new AnimationStateSet(cPtr, false);

            if (OgrePINVOKE.SWIGPendingException.Pending)
            {
                throw OgrePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Beispiel #12
0
        public AnimationMgr(AnimationStateSet animSet, string[] animsName, string[] nonLoopedAnims)
        {
            this.mAllAnims            = new List <string>(animsName);
            this.mAnimStates          = new AnimationState[this.mAllAnims.Count];
            this.mNonLoopedAnimations = new List <string>(nonLoopedAnims);
            for (int i = 0; i < this.mAnimStates.Length; i++)
            {
                this.mAnimStates[i] = animSet.GetAnimationState(this.mAllAnims[i]);   // Stores all the AnimationState

                // All the animation excepted JumpStart and JumpLoop are looped
                this.mAnimStates[i].Loop = !this.mNonLoopedAnimations.Contains(this.mAllAnims[i]);
            }

            this.mWantedAnims = new List <Anim>();
        }
Beispiel #13
0
        private bool IsValidAnimationName(string newName)
        {
            bool nameFound = false;

            AnimationStateSet      animStateSet = robotEntity.AllAnimationStates;
            AnimationStateIterator animIterator = animStateSet.GetAnimationStateIterator();

            while (animIterator.MoveNext() && nameFound)
            {
                if (newName == animIterator.CurrentKey)
                {
                    nameFound = true;
                }
            }
            return(nameFound);
        }
Beispiel #14
0
        public void findAnimations(Entity entity)
        {
            if (playingAnimationState != null)
            {
                playingAnimationState.Playing = false;
                playingAnimationState         = null;
            }
            this.currentEntity = entity;
            listBox.removeAllItems();
            AnimationStateSet animationStateSet = entity.getAllAnimationStates();

            if (animationStateSet != null)
            {
                foreach (AnimationState state in animationStateSet.AnimationStates)
                {
                    listBox.addItem(state.getAnimationName(), new AnimationWindowListItem(state));
                }
            }
        }
Beispiel #15
0
        ///<summary>
        ///  Adds an Entity to the static geometry.
        ///  <remarks>
        ///    This method takes an existing Entity and adds its details to the list of elements to include when building. Note that the Entity itself is not copied or referenced in this method; an Entity is passed simply so that you can change the materials of attached SubEntity objects if you want. You can add the same Entity instance multiple times with different material settings completely safely, and destroy the Entity before destroying this InstancedGeometry if you like. The Entity passed in is simply Must be called before 'Build'.
        ///  </remarks>
        ///</summary>
        ///<param name="ent"> The Entity to use as a definition (the Mesh and Materials referenced will be recorded for the build call). </param>
        ///<param name="position"> The world position at which to add this Entity </param>
        ///<param name="orientation"> The world orientation at which to add this Entity </param>
        ///<param name="scale"> </param>
        public virtual void AddEntity(Entity ent, Vector3 position, Quaternion orientation, Vector3 scale)
        {
            Mesh msh = ent.Mesh;

            // Validate
            if (msh.IsLodManual)
            {
                LogManager.Instance.Write(
                    "(InstancedGeometry): Manual LOD is not supported. Using only highest LOD level for mesh " + msh.Name);
            }

            //get the skeleton of the entity, if that's not already done
            if (ent.Mesh.Skeleton != null && mBaseSkeleton == null)
            {
                mBaseSkeleton     = ent.Mesh.Skeleton;
                mSkeletonInstance = new SkeletonInstance(mBaseSkeleton);
                mSkeletonInstance.Load();
                mAnimationState = ent.GetAllAnimationStates();
            }

            BoundingBox sharedWorldBounds;

            // queue this entities submeshes and choice of material
            // also build the lists of geometry to be used for the source of lods


            for (int i = 0; i < ent.SubEntityCount; ++i)
            {
                SubEntity se = ent.GetSubEntity(i);
                var       q  = new QueuedSubMesh();

                // Get the geometry for this SubMesh
                q.submesh         = se.SubMesh;
                q.geometryLodList = DetermineGeometry(q.submesh);
                q.materialName    = se.MaterialName;
                q.orientation     = orientation;
                q.position        = position;
                q.scale           = scale;
                q.ID = mObjectCount;
            }

            mObjectCount++;
        }
Beispiel #16
0
        /// <summary>
        /// This method deternimes whether the name inserted is in the list of valid animation names
        /// </summary>
        /// <param name="newName">An animation name</param>
        /// <returns></returns>
        private bool IsValidAnimationName(string newName)
        {
            bool nameFound = false;

            AnimationStateSet animStateSet = enemyModel.Robot.GameEntity.AllAnimationStates;

            AnimationStateIterator animIterator = animStateSet.GetAnimationStateIterator();     ///Iterator.currentkey its like indexing a list and has methods that do it for you.


            while (animIterator.MoveNext())
            {
                Console.WriteLine(animIterator.CurrentKey);
            }
            return(nameFound);

            //while (animaIterator.MoveNext())
            //{
            //    Console.WriteLine(animaIterator.CurrentKey);
            //}
            //return nameFound;
        }
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AnimationStateSet obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Beispiel #18
0
        private bool DrawAnimatorCondition(ref AnimatorCondition condition, out bool remove)
        {
            bool modified = false;

            remove = false;
            EditorGUILayout.BeginHorizontal();
            {
                if (!nameToParameter.ContainsKey(condition.parameter))
                {
                    string name = EditorGUILayout.TextField(condition.parameter);
                    if (name != condition.parameter)
                    {
                        condition.parameter = name;
                        modified            = true;
                    }
                    AnimatorConditionMode mode = (AnimatorConditionMode)EditorGUILayout.EnumPopup(condition.mode);
                    if (mode != condition.mode)
                    {
                        condition.mode = mode;
                        modified       = true;
                    }
                    string result = EditorGUILayout.TextField("" + condition.threshold);
                    float  resultValue;
                    if (float.TryParse(result, out resultValue) && resultValue != condition.threshold)
                    {
                        condition.threshold = resultValue;
                        modified            = true;
                    }
                }
                else
                {
                    int parameterIndex = nameToParameterIndex[condition.parameter];
                    int index          = EditorGUILayout.Popup(parameterIndex, parameterNames);
                    AnimatorControllerParameter parameter = parameters[index];
                    if (index != parameterIndex)
                    {
                        condition.parameter = parameter.name;
                        modified            = true;
                    }
                    if (parameter.type == AnimatorControllerParameterType.Bool)
                    {
                        int selectedCondition = Math.Max(0, System.Array.IndexOf(boolConditions, condition.mode));
                        int conditionIdx      = EditorGUILayout.Popup(selectedCondition, boolConditionNames);
                        if (conditionIdx != selectedCondition)
                        {
                            condition.mode = boolConditions[conditionIdx];
                            modified       = true;
                        }
                    }
                    else if (parameter.type != AnimatorControllerParameterType.Trigger)
                    {
                        int selectedCondition = System.Array.IndexOf(conditionModes, condition.mode);
                        int conditionIdx      = EditorGUILayout.Popup(selectedCondition, conditionModeNames);
                        if (conditionIdx != selectedCondition)
                        {
                            condition.mode = conditionModes[conditionIdx];
                            modified       = true;
                        }

                        AnimationStateSet set = null;
                        if (parameter.name.EndsWith("ItemID"))
                        {
                            set = stateCollection.ItemIds;
                        }
                        else if (parameter.name.EndsWith("StateIndex"))
                        {
                            set = stateCollection.ItemStateIndexes;
                        }
                        else if (parameter.name.EndsWith("AbilityIndex"))
                        {
                            set = stateCollection.AbilityIndexes;
                        }
                        else
                        {
                            string result = EditorGUILayout.TextField("" + condition.threshold);
                            float  resultValue;
                            if (float.TryParse(result, out resultValue) && resultValue != condition.threshold)
                            {
                                condition.threshold = resultValue;
                                modified            = true;
                            }
                        }
                        if (null != set)
                        {
                            int id = set.DrawStateSet((int)condition.threshold);
                            if (id != condition.threshold)
                            {
                                condition.threshold = id;
                                modified            = true;
                            }
                        }
                    }
                }

                if (GUILayout.Button(InspectorStyles.DeleteIcon, InspectorStyles.NoPaddingButtonStyle, GUILayout.Width(16), GUILayout.Height(16)))
                {
                    remove   = true;
                    modified = true;
                }
            }
            EditorGUILayout.EndHorizontal();
            return(modified);
        }
        public void UpdateFields()
        {
            boneNameLabel.Text = selectedBone;
            if (skeleton.ContainsBone(boneNameLabel.Text))
            {
                Bone       bone = skeleton.GetBone(boneNameLabel.Text);
                Quaternion q    = ModelViewer.GetRotation(bone.FullTransform);
                boneNameLabel.Text = bone.Name;
                bonePosition.Text  = bone.FullTransform.Translation.ToString();
                boneRotation.Text  = q.ToString();
                boneRotation2.Text = string.Format("X:{0} Y:{1} Z:{2}", q.PitchInDegrees, q.YawInDegrees, q.RollInDegrees);
                q = bone.Orientation;
                relPosition.Text  = bone.Position.ToString();
                relRotation.Text  = q.ToString();
                relRotation2.Text = string.Format("X:{0} Y:{1} Z:{2}", q.PitchInDegrees, q.YawInDegrees, q.RollInDegrees);
                Bone    bindBone = skeleton.GetBone(boneNameLabel.Text);
                Matrix4 bindBoneFullTransform = bindBone.BindDerivedInverseTransform.Inverse();
                q = ModelViewer.GetRotation(bindBoneFullTransform);
                bindPosition.Text  = bindBoneFullTransform.Translation.ToString();
                bindRotation.Text  = q.ToString();
                bindRotation2.Text = string.Format("X:{0} Y:{1} Z:{2}", q.PitchInDegrees, q.YawInDegrees, q.RollInDegrees);
                AnimationState currentAnimation = modelViewer.CurrentAnimation;
                if (currentAnimation != null)
                {
                    animationName.Text = "Animation: " + currentAnimation.Name;
                    float currentTime = currentAnimation.Time;
                    animationTime.Text = "Time: " + currentTime.ToString();
                    Animation          anim = skeleton.GetAnimation(currentAnimation.Name);
                    NodeAnimationTrack animTrack = anim.NodeTracks[bone.Handle];
                    KeyFrame           keyFrame1, keyFrame2;
                    ushort             dummy;
                    animTrack.GetKeyFramesAtTime(currentTime, out keyFrame1, out keyFrame2, out dummy);
                    AnimationStateSet helperAnimSet = new AnimationStateSet();
                    helperSkeleton.InitAnimationState(helperAnimSet);
                    AnimationState helperAnimation = helperAnimSet.GetAnimationState(currentAnimation.Name);
                    helperAnimation.IsEnabled = true;
                    helperAnimation.Time      = keyFrame1.Time;
                    helperSkeleton.SetAnimationState(helperAnimSet);
                    Bone helperBone = helperSkeleton.GetBone(bone.Handle);
                    // currentAnimation.Time;
                    keyFrame1Time.Text = helperAnimation.Time.ToString();
                    q = ModelViewer.GetRotation(helperBone.FullTransform);
                    keyFrame1Position.Text  = helperBone.FullTransform.Translation.ToString();
                    keyFrame1Rotation.Text  = q.ToString();
                    keyFrame1Rotation2.Text = string.Format("X:{0} Y:{1} Z:{2}", q.PitchInDegrees, q.YawInDegrees, q.RollInDegrees);
                    helperAnimation.Time    = keyFrame2.Time;
                    helperSkeleton.SetAnimationState(helperAnimSet);
                    keyFrame2Time.Text = helperAnimation.Time.ToString();
                    q = ModelViewer.GetRotation(helperBone.FullTransform);
                    keyFrame2Position.Text  = helperBone.FullTransform.Translation.ToString();
                    keyFrame2Rotation.Text  = q.ToString();
                    keyFrame2Rotation2.Text = string.Format("X:{0} Y:{1} Z:{2}", q.PitchInDegrees, q.YawInDegrees, q.RollInDegrees);
#if NOT
                    keyFrame1Time.Text = keyFrame1.Time.ToString();
                    q = keyFrame1.Rotation;
                    keyFrame1Position.Text  = helperBone.Translate.ToString();
                    keyFrame1Rotation.Text  = q.ToString();
                    keyFrame1Rotation2.Text = string.Format("X:{0} Y:{1} Z:{2}", q.PitchInDegrees, q.YawInDegrees, q.RollInDegrees);
                    keyFrame2Time.Text      = keyFrame2.Time.ToString();
                    q = keyFrame2.Rotation;
                    keyFrame2Position.Text  = keyFrame2.Translate.ToString();
                    keyFrame2Rotation.Text  = q.ToString();
                    keyFrame2Rotation2.Text = string.Format("X:{0} Y:{1} Z:{2}", q.PitchInDegrees, q.YawInDegrees, q.RollInDegrees);
#endif
                }
                else
                {
                    animationName.Text = "No animation selected";
                }
                bonePosition.Show();
                boneRotation.Show();
                boneRotation2.Show();
                relPosition.Show();
                relRotation.Show();
                relRotation2.Show();
                bindPosition.Show();
                bindRotation.Show();
                bindRotation2.Show();
                if (currentAnimation != null)
                {
                    prevKeyframeLabel.Show();
                    keyFrame1TimeLabel.Show();
                    keyFrame1PositionLabel.Show();
                    keyFrame1RotationLabel.Show();
                    keyFrame1Time.Show();
                    keyFrame1Position.Show();
                    keyFrame1Rotation.Show();
                    keyFrame1Rotation2.Show();
                    nextKeyframeLabel.Show();
                    keyFrame2TimeLabel.Show();
                    keyFrame2PositionLabel.Show();
                    keyFrame2RotationLabel.Show();
                    keyFrame2Time.Show();
                    keyFrame2Position.Show();
                    keyFrame2Rotation.Show();
                    keyFrame2Rotation2.Show();
                }
                else
                {
                    prevKeyframeLabel.Hide();
                    keyFrame1TimeLabel.Hide();
                    keyFrame1PositionLabel.Hide();
                    keyFrame1RotationLabel.Hide();
                    keyFrame1Time.Hide();
                    keyFrame1Position.Hide();
                    keyFrame1Rotation.Hide();
                    keyFrame1Rotation2.Hide();
                    nextKeyframeLabel.Hide();
                    keyFrame2TimeLabel.Hide();
                    keyFrame2PositionLabel.Hide();
                    keyFrame2RotationLabel.Hide();
                    keyFrame2Time.Hide();
                    keyFrame2Position.Hide();
                    keyFrame2Rotation.Hide();
                    keyFrame2Rotation2.Hide();
                }
            }
            else
            {
                boneNameLabel.Text = "Invalid Bone Selected";
                bonePosition.Hide();
                boneRotation.Hide();
                boneRotation2.Hide();
                relPosition.Hide();
                relRotation.Hide();
                relRotation2.Hide();
                bindPosition.Hide();
                bindRotation.Hide();
                bindRotation2.Hide();
                prevKeyframeLabel.Hide();
                keyFrame1TimeLabel.Hide();
                keyFrame1PositionLabel.Hide();
                keyFrame1RotationLabel.Hide();
                keyFrame1Time.Hide();
                keyFrame1Position.Hide();
                keyFrame1Rotation.Hide();
                keyFrame1Rotation2.Hide();
                nextKeyframeLabel.Hide();
                keyFrame2TimeLabel.Hide();
                keyFrame2PositionLabel.Hide();
                keyFrame2RotationLabel.Hide();
                keyFrame2Time.Hide();
                keyFrame2Position.Hide();
                keyFrame2Rotation.Hide();
                keyFrame2Rotation2.Hide();
            }
        }