/// <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); }