@@ -462,10 +462,10 @@ public void LoadBranch(int index)
462
462
}
463
463
464
464
/// <remarks>assumes a TAStudio project is loaded</remarks>
465
- private TasMovieMarkerList /*?*/ MarkerListForBranch ( int ? branchIndex )
466
- => branchIndex is int i
467
- ? Tastudio . CurrentTasMovie . Branches . ElementAtOrDefault ( i ) ? . Markers
468
- : Tastudio . CurrentTasMovie . Markers ;
465
+ private TasMovieMarkerList /*?*/ MarkerListForBranch ( string /*?*/ branchID )
466
+ => Guid . TryParseExact ( branchID , format : "D" , out var parsed )
467
+ ? Tastudio . CurrentTasMovie . Branches . FirstOrDefault ( branch => branch . Uuid == parsed ) ? . Markers
468
+ : branchID is null ? Tastudio . CurrentTasMovie . Markers : null ; // not a typo; null `branchID` indicates main log
469
469
470
470
[ LuaMethodExample ( """
471
471
local marker_label = tastudio.getmarker(tastudio.find_marker_on_or_before(100));
@@ -474,9 +474,9 @@ public void LoadBranch(int index)
474
474
name : "find_marker_on_or_before" ,
475
475
description : "Returns the frame number of the marker closest to the given frame (including that frame, but not after it)."
476
476
+ " This may be the power-on marker at 0. Returns nil if the arguments are invalid or TAStudio isn't active."
477
- + " If branchIndex is specified, searches the markers in that branch instead." ) ]
478
- public int ? FindMarkerOnOrBefore ( int frame , int ? branchIndex = null )
479
- => Engaged ( ) && MarkerListForBranch ( branchIndex ) is TasMovieMarkerList markers
477
+ + " If branchID is specified, searches the markers in that branch instead." ) ]
478
+ public int ? FindMarkerOnOrBefore ( int frame , string /*?*/ branchID = null )
479
+ => Engaged ( ) && MarkerListForBranch ( branchID ) is TasMovieMarkerList markers
480
480
? markers . PreviousOrCurrent ( frame ) ? . Frame
481
481
: null ;
482
482
@@ -486,9 +486,9 @@ public void LoadBranch(int index)
486
486
[ LuaMethod (
487
487
name : "get_frames_with_markers" ,
488
488
description : "Returns a list of all the frames which have markers on them."
489
- + " If branchIndex is specified, instead returns the frames which have markers in that branch." ) ]
490
- public LuaTable GetFramesWithMarkers ( int ? branchIndex = null )
491
- => Engaged ( ) && MarkerListForBranch ( branchIndex ) is TasMovieMarkerList markers
489
+ + " If branchID is specified, instead returns the frames which have markers in that branch." ) ]
490
+ public LuaTable GetFramesWithMarkers ( string /*?*/ branchID = null )
491
+ => Engaged ( ) && MarkerListForBranch ( branchID ) is TasMovieMarkerList markers
492
492
? _th . EnumerateToLuaTable ( markers . Select ( static m => m . Frame ) )
493
493
: _th . CreateTable ( ) ;
494
494
0 commit comments