/// <summary>
        /// Ons the mecanim event add.
        /// </summary>
        /// <param name="args">Arguments.</param>
        void onMecanimEventAdd(TimeLineArgs <float> args)
        {
            //create and add node to internal bhv tree
            SendEventNormalizedNode child = mecanimNode.tree.AddNode(typeof(SendEventNormalizedNode)) as SendEventNormalizedNode;

            //add node to its parent list
            mecanimNode.Insert(args.selectedIndex, child);
            //child.timeNormalized.Value = args.selectedValue;
            (child.timeNormalized.serializedProperty as SerializedProperty).floatValue = args.selectedValue;

            mecanimNode.tree.SaveNodes();

            eventTimeValues = (float[])args.values;

            //recreate (not to optimal but doesn't have
            eventDisplayNames = mecanimNode.children.Select((val) => ((SendEventNormalizedNode)val).name).ToArray();



            //show popup
            SendEventNormalizedNodeEditorWindow.Show(child, eventTimeLineValuePopUpRect);



            Undo.RecordObject(target.self, "Add Node");

            EditorApplication.SaveScene();
        }
        ///  TIMELINE EVENTHANDLERS


        /// <summary>
        /// Ons the mecanim event edit.
        /// </summary>
        /// <param name="args">Arguments.</param>
        void onMecanimEventEdit(TimeLineArgs <float> args)
        {
            SendEventNormalizedNode child = mecanimNode.children [args.selectedIndex] as SendEventNormalizedNode;


            //child.timeNormalized.Value = args.selectedValue;
            (child.timeNormalized.serializedProperty as SerializedProperty).floatValue = args.selectedValue;
            //child.timeNormalized.ApplyModifiedProperties ();
            SendEventNormalizedNodeEditorWindow.Show(child, eventTimeLineValuePopUpRect);
        }
Beispiel #3
0
        public static void Show(SendEventNormalizedNode node, Rect position)
        {
            SendEventNormalizedNodeEditorWindow.node = node;
//
            if (SendEventNormalizedNodeEditorWindow.window != null)            //restore last
            {
                position = window.position;
            }


            SendEventNormalizedNodeEditorWindow.window = (SendEventNormalizedNodeEditorWindow)EditorWindow.GetWindow(typeof(SendEventNormalizedNodeEditorWindow));
            //EditorWindow.CreateInstance (typeof (SendEventNormalizedEditor));
            //(SendEventNormalizedEditor)
            SendEventNormalizedNodeEditorWindow.window.position = position;
            SendEventNormalizedNodeEditorWindow.window.Show();
        }
            int IComparer.Compare(object objX, object objY)
            {
                SendEventNormalizedNode animationEvent  = (SendEventNormalizedNode)objX;
                SendEventNormalizedNode animationEvent2 = (SendEventNormalizedNode)objY;
                //float time = (float)animationEvent.timeNormalized.Value;
                //float time2 = (float)animationEvent2.timeNormalized.Value;

                float time  = (animationEvent.timeNormalized.serializedProperty as SerializedProperty).floatValue;
                float time2 = (animationEvent2.timeNormalized.serializedProperty as SerializedProperty).floatValue;

                if (time != time2)
                {
                    return((int)Mathf.Sign(time - time2));
                }
                int hashCode  = animationEvent.GetHashCode();
                int hashCode2 = animationEvent2.GetHashCode();

                return(hashCode - hashCode2);
            }