lua: ability to SetBranchText.
doesn't make much sense to add text to existing branches from lua, but highly useful to set some text to a new branch. and we also have a default branch text variable now.
This commit is contained in:
parent
796a62f883
commit
2ce108e310
BizHawk.Client.Common/movie/tasproj
BizHawk.Client.EmuHawk/tools
|
@ -85,6 +85,7 @@ namespace BizHawk.Client.Common
|
|||
public TasMovieMarkerList Markers { get; set; }
|
||||
public bool BindMarkersToInput { get; set; }
|
||||
public bool UseInputCache { get; set; }
|
||||
public string NewBranchText = "";
|
||||
public int CurrentBranch { get; set; }
|
||||
public int BranchCount { get { return Branches.Count; } }
|
||||
public TasBranch GetBranch(int index)
|
||||
|
|
|
@ -37,6 +37,22 @@ namespace BizHawk.Client.EmuHawk
|
|||
return GlobalWin.Tools.Has<TAStudio>(); // TODO: eventually tastudio should have an engaged flag
|
||||
}
|
||||
|
||||
[LuaMethodAttributes(
|
||||
"setbranchtext",
|
||||
"adds the given message to the existing branch, or to the branch that will be created next if branch index is not specified"
|
||||
)]
|
||||
public void SetBranchText(string text, int? index = null)
|
||||
{
|
||||
if (index != null)
|
||||
{
|
||||
Tastudio.CurrentTasMovie.GetBranch(index.Value).UserText = text;
|
||||
}
|
||||
else
|
||||
{
|
||||
Tastudio.CurrentTasMovie.NewBranchText = text;
|
||||
}
|
||||
}
|
||||
|
||||
[LuaMethodAttributes(
|
||||
"getmarker",
|
||||
"returns the marker text at the given frame, or an empty string if there is no marker for the given frame"
|
||||
|
|
|
@ -116,6 +116,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public void Branch()
|
||||
{
|
||||
TasBranch branch = CreateBranch();
|
||||
Movie.NewBranchText = ""; // reset every time it's used
|
||||
Movie.AddBranch(branch);
|
||||
BranchView.RowCount = Movie.BranchCount;
|
||||
Movie.CurrentBranch = Movie.BranchCount - 1;
|
||||
|
@ -149,7 +150,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
ChangeLog = new TasMovieChangeLog(Movie),
|
||||
TimeStamp = DateTime.Now,
|
||||
Markers = Movie.Markers.DeepClone(),
|
||||
UserText = ""
|
||||
UserText = Movie.NewBranchText
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue