protected override void updateHeaderControl4(Rect position) { Transform actor = (TrackGroup.Behaviour as ActorTrackGroup).Actor; Color temp = GUI.color; GUI.color = (actor == null) ? Color.red : Color.green; int controlID = GUIUtility.GetControlID("ActorTrackGroupControl".GetHashCode(), FocusType.Passive, position); GUI.enabled = !state.IsInPreviewMode; if (GUI.Button(position, string.Empty, styles.pickerStyle)) { EditorGUIUtility.ShowObjectPicker <Transform>(actor, true, string.Empty, controlID); } GUI.enabled = true; if (Event.current.commandName == "ObjectSelectorUpdated") { if (EditorGUIUtility.GetObjectPickerControlID() == controlID) { GameObject pickedObject = EditorGUIUtility.GetObjectPickerObject() as GameObject; if (pickedObject != null) { ActorTrackGroup atg = (TrackGroup.Behaviour as ActorTrackGroup); Undo.RecordObject(atg, string.Format("Changed {0}", atg.name)); atg.Actor = pickedObject.transform; } } } GUI.color = temp; }
/// <summary> /// Draw the inspector /// </summary> public override void OnInspectorGUI() { base.serializedObject.Update(); ActorTrackGroup actorGroup = base.serializedObject.targetObject as ActorTrackGroup; TimelineTrack[] tracks = actorGroup.GetTracks(); EditorGUILayout.PropertyField(actor); if (tracks.Length > 0) { containerFoldout = EditorGUILayout.Foldout(containerFoldout, tracksContent); if (containerFoldout) { EditorGUI.indentLevel++; foreach (TimelineTrack track in tracks) { EditorGUILayout.ObjectField(track.name, track, typeof(ActorTrack), true); } EditorGUI.indentLevel--; } } if (GUILayout.Button(addTrackContent)) { GenericMenu createMenu = new GenericMenu(); createMenu.AddItem(addCurveTrackContent, false, addCurveTrack); createMenu.AddItem(addEventTrackContent, false, addEventTrack); createMenu.ShowAsContext(); } base.serializedObject.ApplyModifiedProperties(); }
internal static ActorItemTrack CreateActorItemTrack(ActorTrackGroup trackGroup) { GameObject eventTrackGO = new GameObject(EVENT_TRACK_LABEL, typeof(ActorItemTrack)); eventTrackGO.transform.parent = trackGroup.transform; return(eventTrackGO.GetComponent <ActorItemTrack>()); }
internal static CurveTrack CreateCurveTrack(ActorTrackGroup trackGroup) { GameObject curveTrackGO = new GameObject(CURVE_TRACK_LABEL, typeof(CurveTrack)); curveTrackGO.transform.parent = trackGroup.transform; return(curveTrackGO.GetComponent <CurveTrack>()); }
public static void Initialize(ActorTrackGroup actorGroup) { if (actorGroup.ActorTrackType == ActorTrackGroup.ActorType.Static) { return; } Transform actorTrans = actorGroup.transform.Find("_Entity"); if (actorTrans != null) { int childCount = actorTrans.childCount; for (int i = childCount - 1; i >= 0; i--) { Transform childTrans = actorTrans.GetChild(i); GameObject.DestroyImmediate(childTrans.gameObject); } actorGroup.Actor = actorTrans; } if (actorTrans == null) { GameObject actorObj = new GameObject("_Entity"); ////Util.SetParent(actorObj, actorGroup.gameObject); actorGroup.Actor = actorObj.transform; } string destPath = string.Concat(RES_PATH, actorGroup.AssetPath); if (destPath.EndsWith(".prefab")) { GameObject actor = AssetDatabase.LoadAssetAtPath <GameObject>(destPath); actor = GameObject.Instantiate(actor) as GameObject; ////Util.SetParent(actor, actorGroup.Actor.gameObject); actor.SetActive(true); Animator animator = actor.GetComponent <Animator>(); if (animator) { animator.enabled = true; } //EntityTrackGroup.AddFastShadow(actor); } else if (destPath.EndsWith(".ogg")) { string fileName = Path.GetFileNameWithoutExtension(destPath); GameObject audioObj = new GameObject(fileName); AudioSource audioSrc = audioObj.AddComponent <AudioSource>(); audioSrc.clip = AssetDatabase.LoadAssetAtPath <AudioClip>(destPath); //Util.SetParent(audioObj, actorGroup.Actor.gameObject); PlayAudioEvent[] playAudios = actorGroup.GetComponentsInChildren <PlayAudioEvent>(); foreach (PlayAudioEvent playAudio in playAudios) { playAudio.Duration = audioSrc.clip.length; } } }
/// <summary> /// Draw the inspector /// </summary> public override void OnInspectorGUI() { base.serializedObject.Update(); ActorTrackGroup actorGroup = base.serializedObject.targetObject as ActorTrackGroup; TimelineTrack[] tracks = actorGroup.GetTracks(); Cutscene cutscene = actorGroup.Cutscene; bool isCutsceneActive = false; if (cutscene == null) { EditorGUILayout.HelpBox("Track Group must be a child of a Cutscene in the hierarchy", MessageType.Error); } else { isCutsceneActive = !(cutscene.State == Cutscene.CutsceneState.Inactive); if (isCutsceneActive) { EditorGUILayout.HelpBox("Cutscene is Active. Actors cannot be altered at the moment.", MessageType.Info); } } GUI.enabled = !isCutsceneActive; EditorGUILayout.PropertyField(actor); GUI.enabled = true; EditorGUILayout.PropertyField(editorRevert); EditorGUILayout.PropertyField(runtimeRevert); EditorGUILayout.PropertyField(optimizable); if (tracks.Length > 0) { containerFoldout = EditorGUILayout.Foldout(containerFoldout, tracksContent); if (containerFoldout) { EditorGUI.indentLevel++; foreach (TimelineTrack track in tracks) { EditorGUILayout.BeginHorizontal(); track.name = EditorGUILayout.TextField(track.name); if (GUILayout.Button(inspectorIcon, GUILayout.Width(24))) { Selection.activeObject = track; } EditorGUILayout.EndHorizontal(); } EditorGUI.indentLevel--; } } if (GUILayout.Button(addTrackContent)) { CutsceneControlHelper.ShowAddTrackContextMenu(actorGroup); } base.serializedObject.ApplyModifiedProperties(); }
void Awake() { actorTrack = this.GetComponent <ActorTrackGroup>(); // cutSceneTrigger = this.GetComponent<CutsceneTrigger>(); CSFEvent = this.GetComponent <CameraSmoothFollowEvent>(); cameraFocus = this.GetComponent <CameraFocusEvent>(); scion = this.GetComponent <ScionPostProcessBase>(); }
/// <summary> /// Create a track container for an actor in this cutscene. /// </summary> /// <param name="transform">The transform of the game object</param> /// <returns>the newly created container</returns> public static TrackGroup CreateActorTrackGroup(Cutscene cutscene, Transform transform) { string trackGroupName = ACTOR_GROUP_NAME; if (transform != null) { trackGroupName = string.Format("{0} Group", transform.name); } GameObject actorGroupGO = new GameObject(trackGroupName, typeof(ActorTrackGroup)); actorGroupGO.transform.parent = cutscene.transform; ActorTrackGroup actorTrackGroup = actorGroupGO.GetComponent <ActorTrackGroup>(); actorTrackGroup.Actor = transform; return(actorTrackGroup); }
public Transform GetActorTransform(TrackGroup targetGroup) { ActorTrackGroup targetTrackGroup = targetGroup as ActorTrackGroup; if (targetTrackGroup) { return(targetTrackGroup.Actor); } EntityTrackGroup entityTrackGroup = targetGroup as EntityTrackGroup; if (entityTrackGroup) { return(entityTrackGroup.Actor); } Debug.LogError("找不到目标对应的演员!"); return(null); }
void RandomEmitterFunc(AutoSkillParticleEmitterItem targetObj) { if (targetObj.emitterType == Example.SkillParticleEmitter.EmitterType.RANDOM) { SkillParticleActionItem[] children = targetObj.transform.GetComponentsInChildren <SkillParticleActionItem>(); for (int i = 0; i < children.Length; i++) { GameObject.DestroyImmediate(children[i].gameObject); } children = null; GameObject Actor = null; if (targetObj.TimelineTrack.TrackGroup is ActorTrackGroup) { ActorTrackGroup ag = (ActorTrackGroup)targetObj.TimelineTrack.TrackGroup; Actor = ag.Actor.gameObject; } if (targetObj.waves <= 0) { targetObj.waves = 1; } if (targetObj.emitterShapeType == Example.SkillShapeNew.ShapeType.CIRCLE) { CircleSkillShape circle = (CircleSkillShape)targetObj.emitterShape; if (targetObj.particlePathType == Example.SkillPath.PathType.FIXED_POSITION) { EmittRandomAreaCircleParticles(targetObj, Actor, circle); } } if (targetObj.emitterShapeType == Example.SkillShapeNew.ShapeType.BOX) { BoxSkillShape box = (BoxSkillShape)targetObj.emitterShape; if (targetObj.particlePathType == Example.SkillPath.PathType.FIXED_POSITION) { OnEmittRandomAreaBoxParticles(targetObj, Actor, box); } } } }
void directorControl_DragPerformed(object sender, CinemaDirectorDragArgs e) { Cutscene c = e.cutscene as Cutscene; if (c != null) { if (e.references != null) { if (e.references.Length == 1) { GameObject gameObject = e.references[0] as GameObject; if (gameObject != null) { ActorTrackGroup atg = CutsceneItemFactory.CreateTrackGroup(c, typeof(ActorTrackGroup), string.Format("{0} Track Group", gameObject.name)) as ActorTrackGroup; atg.Actor = gameObject.GetComponent <Transform>(); Undo.RegisterCreatedObjectUndo(atg.gameObject, string.Format("Created {0}", atg.gameObject.name)); } } } } }
private void addCurveTrack() { ActorTrackGroup atg = TrackGroup.Behaviour as ActorTrackGroup; Undo.RegisterCreatedObjectUndo(CutsceneItemFactory.CreateCurveTrack(atg).gameObject, "Create Curve Track"); }
/// <summary> /// Draw the inspector /// </summary> public override void OnInspectorGUI() { base.serializedObject.Update(); ActorTrackGroup actorGroup = base.serializedObject.targetObject as ActorTrackGroup; TimelineTrack[] tracks = actorGroup.GetTracks(); Cutscene cutscene = actorGroup.Cutscene; bool isCutsceneActive = false; if (cutscene == null) { EditorGUILayout.HelpBox("Track Group must be a child of a Cutscene in the hierarchy", MessageType.Error); } else { isCutsceneActive = !(cutscene.State == Cutscene.CutsceneState.Inactive); if (isCutsceneActive) { EditorGUILayout.HelpBox("Cutscene is Active. Actors cannot be altered at the moment.", MessageType.Info); } } EditorGUI.BeginChangeCheck(); GUI.enabled = !isCutsceneActive; EditorGUILayout.PropertyField(actor); GUI.enabled = true; if (EditorGUI.EndChangeCheck()) { if (actor.objectReferenceValue != null) { actorTag.stringValue = (actor.objectReferenceValue as Transform).tag; //CutsceneActor actorComp = (actor.objectReferenceValue as Transform).GetComponent<CutsceneActor>(); //if (actorComp == null) // actorComp = (actor.objectReferenceValue as Transform).gameObject.AddComponent<CutsceneActor>(); //actorGUID.stringValue = actorComp.ActorGUID; } else { actorTag.stringValue = ""; //actorGUID.stringValue = ""; } } else { if (actor.objectReferenceValue != null && (string.IsNullOrEmpty(actorTag.stringValue) || actorTag.stringValue.Equals("Untagged") /* || string.IsNullOrEmpty(actorGUID.stringValue)*/)) { actorTag.stringValue = (actor.objectReferenceValue as Transform).tag; //CutsceneActor actorComp = (actor.objectReferenceValue as Transform).GetComponent<CutsceneActor>(); //if (actorComp == null) // actorComp = (actor.objectReferenceValue as Transform).gameObject.AddComponent<CutsceneActor>(); //actorGUID.stringValue = actorComp.ActorGUID; } } GUI.enabled = false; EditorGUILayout.PropertyField(actorTag); //EditorGUILayout.PropertyField(actorGUID); GUI.enabled = true; EditorGUILayout.PropertyField(editorRevert); EditorGUILayout.PropertyField(runtimeRevert); EditorGUILayout.PropertyField(optimizable); if (tracks.Length > 0) { containerFoldout = EditorGUILayout.Foldout(containerFoldout, tracksContent); if (containerFoldout) { EditorGUI.indentLevel++; foreach (TimelineTrack track in tracks) { EditorGUILayout.BeginHorizontal(); track.name = EditorGUILayout.TextField(track.name); if (GUILayout.Button(inspectorIcon, GUILayout.Width(24))) { Selection.activeObject = track; } EditorGUILayout.EndHorizontal(); } EditorGUI.indentLevel--; } } if (GUILayout.Button(addTrackContent)) { CutsceneControlHelper.ShowAddTrackContextMenu(actorGroup); } base.serializedObject.ApplyModifiedProperties(); }
/// <summary> /// 初始化数据 /// </summary> /// <param name="key"></param> /// <param name="obj"></param> /// <param name="movieData"></param> public MovieReplaceInfo(string replaceId, string resName, GameObject obj, MovieData movieData) { CurrMovieData = movieData; ReplaceId = replaceId; ResName = resName; CurrObjLevel = 0; if (obj == null) { return; } OldGameObject = obj; SelfActive = OldGameObject.activeSelf; CurrObjctName = obj.name; var tra = obj.transform; var url = movieData.GetUrl(tra, out CurrObjLevel); LocalPosition = tra.localPosition; LocalScale = tra.localScale; LocalRotation = tra.localRotation; Layer = obj.layer; if (CurrObjLevel > 0) { CurrObjctUrlbase = url.Substring(0, url.LastIndexOf(CurrObjctName) - 1); } var anim = obj.GetComponent <Animation>(); IsAnimation = anim != null; var animator = obj.GetComponent <Animator>(); IsAnimator = animator != null; if (IsAnimation && IsAnimator) { Debug.LogError("剧情物体 " + CurrObjctUrlbase + "/" + CurrObjctName + " 同时存在 Animator 及 Animation"); } if (animator) { CurrAnimationController = animator.runtimeAnimatorController.name; } else if (IsAnimation) { CurrAnimationController = anim.name; } else { CurrAnimationController = ""; } var particle = obj.GetComponentInChildren <ParticleSystem>(); var setting = obj.GetComponent <EffectSetting>(); isParticle = (particle != null) || (setting != null); if (isParticle) { if (setting != null) { ParticleRootNode = setting.rootNode; particleRelativePath = setting.relativePath; particleOffset = setting.offset; particleRotation = setting.rotation; } } else { if (setting != null) { ParticleRootNode = setting.rootNode; particleRelativePath = setting.relativePath; particleOffset = setting.offset; particleRotation = setting.rotation; } } List <ActorTrackGroup> groups = new List <ActorTrackGroup>(); List <TiedGameObject> tiedObjs = new List <TiedGameObject>(); foreach (TrackGroup g in movieData.cutscene.TrackGroups) { if (g is ActorTrackGroup) { ActorTrackGroup ag = (ActorTrackGroup)g; if (ag.Actor == obj.transform) { groups.Add(ag); } } TimelineTrack[] tracks = g.GetTracks(); for (int j = 0; j < tracks.Length; j++) { TimelineItem[] items = tracks[j].GetTimelineItems(); for (int k = 0; k < items.Length; k++) { GameObject[] objs = items[k].GetTiedGameObject(); if (objs != null && objs.Length > 0) { for (int m = 0; m < items.Length; m++) { if (objs[m] == obj) { TiedGameObject tie = new TiedGameObject(); tie.item = items[k]; tie.index = m; tiedObjs.Add(tie); } } } } } } TiedObjs = tiedObjs.ToArray(); TrackGroups = groups.ToArray(); }
public override void OnInspectorGUI() { Obj = new SerializedObject(this.target); this.firetime = Obj.FindProperty("firetime"); this.duration = Obj.FindProperty("duration"); this.emitterShapeType = Obj.FindProperty("emitterShapeType"); this.emitterType = Obj.FindProperty("emitterType"); this.emitterOffset = Obj.FindProperty("emitterOffset"); this.emitterCount = Obj.FindProperty("emitterCount"); this.emitterShape = Obj.FindProperty("emitterShape"); this.effectPrefab = Obj.FindProperty("effectPrefab"); this.particlePathType = Obj.FindProperty("particlePathType"); this.particleHitShapeType = Obj.FindProperty("particleHitShapeType"); this.particleStartFrame = Obj.FindProperty("particleStartFrame"); this.particleDuration = Obj.FindProperty("particleDuration"); this.waves = Obj.FindProperty("waves"); this.waveDelay = Obj.FindProperty("waveDelay"); EditorGUILayout.PropertyField(firetime); EditorGUILayout.PropertyField(duration); EditorGUILayout.PropertyField(emitterShape); EditorGUILayout.PropertyField(emitterType); EditorGUILayout.PropertyField(emitterShapeType); EditorGUILayout.PropertyField(emitterOffset); EditorGUILayout.PropertyField(emitterCount); EditorGUILayout.PropertyField(waves); EditorGUILayout.PropertyField(waveDelay); EditorGUILayout.PropertyField(effectPrefab); EditorGUILayout.PropertyField(particlePathType); EditorGUILayout.PropertyField(particleHitShapeType); EditorGUILayout.PropertyField(particleStartFrame); EditorGUILayout.PropertyField(particleDuration); AutoSkillParticleEmitterItem targetObj = this.target as AutoSkillParticleEmitterItem; // Example.SkillPath.PathType oldPath = targetObj.particlePathType; Example.SkillShapeNew.ShapeType oldShape = targetObj.emitterShapeType; Example.SkillShapeNew.ShapeType oldhitShape = targetObj.particleHitShapeType; Obj.ApplyModifiedProperties(); targetObj.emitterShape = ReplaceShape(oldShape, targetObj.emitterShapeType, targetObj.gameObject, targetObj.emitterShape, targetObj.Actor(), targetObj.emitterOffset); if (targetObj.emitterShape != null) { targetObj.emitterShape.shapeType = targetObj.emitterShapeType; } targetObj.hitShape = ReplaceShape(oldhitShape, targetObj.particleHitShapeType, targetObj.gameObject, targetObj.hitShape, targetObj.Actor(), Vector3.zero); if (targetObj.hitShape != null) { targetObj.hitShape.shapeType = targetObj.particleHitShapeType; } if (targetObj.emitterType == Example.SkillParticleEmitter.EmitterType.RANDOM) { if (targetObj.emitterShapeType != Example.SkillShapeNew.ShapeType.CIRCLE && targetObj.emitterShapeType != Example.SkillShapeNew.ShapeType.BOX) { EditorGUILayout.HelpBox("随机发射形状仅支持Circle和Box", MessageType.Error); } if (targetObj.particlePathType != Example.SkillPath.PathType.FIXED_POSITION) { EditorGUILayout.HelpBox("随机发射仅支持FIXED_POSITION粒子线路类型", MessageType.Error); } } else { if (targetObj.particlePathType != Example.SkillPath.PathType.LINE) { EditorGUILayout.HelpBox("不支持除直线以外的粒子线路类型", MessageType.Error); } } if (targetObj.emitterType == Example.SkillParticleEmitter.EmitterType.RANDOM) { if (GUILayout.Button("生成")) { RandomEmitterFunc(targetObj); } } if (targetObj.emitterType == Example.SkillParticleEmitter.EmitterType.FIXED) { if (GUILayout.Button("生成")) { SkillParticleActionItem[] children = targetObj.transform.GetComponentsInChildren <SkillParticleActionItem>(); for (int i = 0; i < children.Length; i++) { GameObject.DestroyImmediate(children[i].gameObject); } children = null; GameObject Actor = null; if (targetObj.TimelineTrack.TrackGroup is ActorTrackGroup) { ActorTrackGroup ag = (ActorTrackGroup)targetObj.TimelineTrack.TrackGroup; Actor = ag.Actor.gameObject; } if (targetObj.waves <= 0) { targetObj.waves = 1; } targetObj.emitterShape.Build(targetObj); } } }
/// <summary> /// Draw the inspector /// </summary> public override void OnInspectorGUI() { base.serializedObject.Update(); ActorTrackGroup actorGroup = base.serializedObject.targetObject as ActorTrackGroup; TimelineTrack[] tracks = actorGroup.GetTracks(); Cutscene cutscene = actorGroup.Cutscene; bool isCutsceneActive = false; if (cutscene == null) { EditorGUILayout.HelpBox("Track Group must be a child of a Cutscene in the hierarchy", MessageType.Error); } else { isCutsceneActive = !(cutscene.State == Cutscene.CutsceneState.Inactive); if (isCutsceneActive) { EditorGUILayout.HelpBox("Cutscene is Active. Actors cannot be altered at the moment.", MessageType.Info); } } int actorType = this.actorTypeProperty.enumValueIndex; ActorTrackGroup.ActorType newActorType = (ActorTrackGroup.ActorType)EditorGUILayout.EnumPopup(new GUIContent("Actor Type"), (ActorTrackGroup.ActorType)actorType); this.actorTypeProperty.enumValueIndex = (int)newActorType; GUI.enabled = !isCutsceneActive; if (newActorType == ActorTrackGroup.ActorType.Static) { EditorGUILayout.PropertyField(actorProperty, new GUIContent("actor")); } else { UnityEngine.Object obj = EditorGUILayout.ObjectField(new GUIContent("Asset"), actorProperty.objectReferenceValue, typeof(UnityEngine.Object), false); if (obj != null && obj != actorProperty.objectReferenceValue) { string srcPath = AssetDatabase.GetAssetPath(obj); string fileName = Path.GetFileName(srcPath); string destPath = srcPath; if (destPath.StartsWith(EFFECT_SRC_PATH)) { if (!Directory.Exists(GEN_EFFECT_PATH)) { Directory.CreateDirectory(GEN_EFFECT_PATH); } destPath = string.Concat(GEN_EFFECT_PATH, fileName); File.Copy(srcPath, destPath, true); AssetDatabase.ImportAsset(destPath); AssetDatabase.Refresh(); } string relativePath = destPath.Replace(RES_PATH, ""); bool isGen = this.assetPathProperty.stringValue != relativePath; this.assetPathProperty.stringValue = relativePath; if (isGen) { Initialize(actorGroup); actorProperty.objectReferenceValue = actorGroup.Actor; } } EditorGUILayout.PropertyField(assetPathProperty); } GUI.enabled = true; EditorGUILayout.PropertyField(optimizable); if (tracks.Length > 0) { containerFoldout = EditorGUILayout.Foldout(containerFoldout, tracksContent); if (containerFoldout) { EditorGUI.indentLevel++; foreach (TimelineTrack track in tracks) { EditorGUILayout.BeginHorizontal(); track.name = EditorGUILayout.TextField(track.name); if (GUILayout.Button(inspectorIcon, GUILayout.Width(24))) { Selection.activeObject = track; } EditorGUILayout.EndHorizontal(); } EditorGUI.indentLevel--; } } if (GUILayout.Button(addTrackContent)) { CutsceneControlHelper.ShowAddTrackContextMenu(actorGroup); } if (newActorType == ActorTrackGroup.ActorType.Dynamic && GUILayout.Button(reflushEntity)) { Initialize(actorGroup); } base.serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { playanimation = new SerializedObject(this.target); this.firetime = playanimation.FindProperty("firetime"); this.duration = playanimation.FindProperty("duration"); this.StateName = playanimation.FindProperty("StateName"); this.Layer = playanimation.FindProperty("Layer"); PlayAnimatorTimeline animation = (target as PlayAnimatorTimeline); EditorGUILayout.PropertyField(firetime); EditorGUILayout.PropertyField(duration); playanimation.ApplyModifiedProperties(); CharacterTrackGroup ctg = animation.transform.parent.parent.gameObject.GetComponent <CharacterTrackGroup>(); ActorTrackGroup atg = animation.transform.parent.parent.gameObject.GetComponent <ActorTrackGroup>(); if (ctg == null && atg == null) { EditorGUILayout.HelpBox("Has No CharacterTrackGroup ", MessageType.Error); return; } Animator amr = null; if (ctg != null) { amr = ctg.Actor.GetComponentInChildren <Animator>(); } else if (atg != null) { amr = atg.Actor.GetComponentInChildren <Animator>(); } if (amr == null) { EditorGUILayout.HelpBox("Character Has No Animator ", MessageType.Error); return; } amr.Rebind(); RuntimeAnimatorController rt = amr.runtimeAnimatorController; if (rt == null) { EditorGUILayout.HelpBox(ERROR_MSG, MessageType.Error); return; } List <string> layers = MecanimAnimationUtility.GetAllLayerNamesWithAnimator(amr); var newlayer = EditorGUILayout.Popup("Layers", Layer.intValue, layers.ToArray()); if (newlayer != Layer.intValue) { Layer.intValue = newlayer; } //List<string> availableStateNames = MecanimAnimationUtility.GetAllStateNamesWithController(rt); List <string> availableStateNames = MecanimAnimationUtility.GetAllStateNamesWithControllerInLayer(rt as UnityEditor.Animations.AnimatorController, Layer.intValue); int existingState = availableStateNames.IndexOf(StateName.stringValue); var newState = EditorGUILayout.Popup("State", existingState, availableStateNames.ToArray()); if (newState != existingState) { existingState = newState; StateName.stringValue = availableStateNames[newState]; } EditorGUILayout.PropertyField(StateName); /* this.duration.floatValue = MecanimAnimationUtility.GetStateDurationWithAnimatorController(StateName.stringValue, rt); * if (this.duration.floatValue <= 0) * { * this.duration.floatValue = 1; * }*/ playanimation.ApplyModifiedProperties(); }
internal void addEventTrack() { ActorTrackGroup actorTrackGroup = base.serializedObject.targetObject as ActorTrackGroup; Undo.RegisterCreatedObjectUndo(CutsceneItemFactory.CreateActorItemTrack(actorTrackGroup).gameObject, "Create Actor Track"); }