public override void OnInspectorGUI()
        {
            UTAEvent castedTarget = (UTAEvent)target;

            // Get director
            if (m_DirectorObject == null)
            {
                UTADirector director = TimelineEditor.playableDirector.GetComponent <UTADirector>();
                m_DirectorObject = new SerializedObject(director);
            }
            m_DirectorObject.Update();

            // Get property
            if (m_LastKey != castedTarget.m_EventUUID)
            {
                m_LastKey      = castedTarget.m_EventUUID;
                m_LastProperty = GetEventProperty(castedTarget.m_EventUUID);
            }

            // Display property
            if (m_LastProperty != null)
            {
                EditorGUILayout.Space();
                EditorGUILayout.PropertyField(m_LastProperty, true);
                m_LastProperty.serializedObject.ApplyModifiedProperties();
            }

            serializedObject.ApplyModifiedProperties();
        }
Example #2
0
        public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
        {
            // Reference owner for OnDestroy
            m_Owner = owner;

            // Get event and check for duplicate if Ctrl+D has been used
            UTADirector ownerDirector = owner.GetComponent <UTADirector>();

            ownerDirector.CheckForDuplicateEvents();
            UnityEvent unityEvent = null;

            if (string.IsNullOrEmpty(m_EventUUID))
            {
                m_EventUUID = System.Guid.NewGuid().ToString();
                unityEvent  = ownerDirector.AddEvent(m_EventUUID);
            }
            else
            {
                unityEvent = ownerDirector.GetEvent(m_EventUUID);
            }

            // Create playable
            var playable = ScriptPlayable <UTAEventBehaviour> .Create(graph, template);

            UTAEventBehaviour clone = playable.GetBehaviour();

            clone.m_Event = unityEvent;

            return(playable);
        }
 private void InitializeDirectorDictionary()
 {
     m_Directors   = new Dictionary <string, UTADirector>();
     m_DirectorsIT = new List <UTADirector>();
     foreach (Transform t in transform)
     {
         UTADirector d = t.GetComponent <UTADirector>();
         m_Directors.Add(t.name, d);
         m_DirectorsIT.Add(d);
     }
 }
        public UTADirector CreateNewAnimation(PlayableAsset animation)
        {
            GameObject child = new GameObject(animation.name);

            child.transform.SetParent(transform);

            UTADirector utaDirector = child.AddComponent <UTADirector>();

            utaDirector.Prepare(animation);

            return(utaDirector);
        }
 protected void SelectCurrentObject(UTADirector director)
 {
     Selection.activeGameObject = director.gameObject;
 }