Skip to content

Commit 7f81efa

Browse files
committed
Patch prev diff
1 parent a8d040f commit 7f81efa

File tree

7 files changed

+30
-9
lines changed

7 files changed

+30
-9
lines changed

Editor/Core/Config.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ public static bool enableInjection{
3535
public static float handleSize
3636
{ set => SetFloat(HandleSize, value); get => GetFloat(HandleSize); }
3737

38+
public static float historySpan
39+
{ set => SetFloat(HistorySpan, value); get => GetFloat(HistorySpan, 10f); }
40+
3841
public static bool logToConsole
3942
{ set => SetBool(LogToConsole, value); get => GetBool(LogToConsole, false); }
4043

Editor/Core/ConfigKeys.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public static class ConfigKeys{
1313
Name = "prolog.config",
1414
Path = "Assets/prolog.config",
1515
TrailOffset = "Activ.Loggr.TrailOffset",
16-
HandleSize = "Activ.Loggr.HandleSize";
16+
HandleSize = "Activ.Loggr.HandleSize",
17+
HistorySpan = "Activ.Loggr.HistorySpan";
1718

1819
}}

Editor/Core/UI/LogWindow-DebugChan.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public void OnGenericMessage(string message, object sender, int messageCount){
1616

1717
void DrawLoggerTextView(){
1818
string content;
19-
if(browsing){
19+
if(browsing && !useHistory){
2020
content = model.dcRange.Format();
2121
}else{
2222
content = EvalTextContent();
@@ -33,7 +33,10 @@ string EvalTextContent(){
3333
return "Debug-Chan: no selection";
3434
}
3535
if(useHistory && Ed.isPaused){
36-
var text = logger[model.selection]?.Format() ?? "No messages";
36+
var text = logger[model.selection]?.Format() ?? "Debug-Chan: No messages";
37+
// NOTE: history does not include latest frame.
38+
var frame = logger.CurrentFrame(model.selection);
39+
if(frame != null) text += frame.Format();
3740
return model.selection.name + "\n\n" + text;
3841
}else{
3942
var frame = logger.CurrentFrame(model.selection);

Editor/Core/UI/LogWindow.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void DrawEnableInjection(){
9292
}
9393

9494
void DrawTextView(string text, ref Vector2 scroll){
95-
scroll = BeginScrollView(scroll);
95+
scroll = BeginScrollView(scroll, GL.Height(360));
9696
GUI.backgroundColor = Color.black;
9797
ConfigTextAreaStyle();
9898
GL.TextArea(text, GL.ExpandHeight(true));
@@ -117,19 +117,24 @@ void DrawScrubber(){
117117
if(browsing){
118118
frameNo = model.currentFrame ?? frameNo;
119119
}
120+
model.currentFrame = frameNo;
120121
var style = GUI.skin.button;
121122
normalButtonFont = style.font;
122123
style.font = monofont;
123-
if(ScrubberButton("<")) SelectPrev();
124+
// TODO for now still broken; also, use case unclear
125+
//if(ScrubberButton("<")) SelectPrev();
124126
if(isPlaying){
125127
GL.Button($"#{frameNo:0000}", GL.MaxWidth(64f), GL.MinHeight(ScrubberButtonsHeight));
126128
}else{
127129
GL.Button($"-----", GL.MaxWidth(64f), GL.MinHeight(ScrubberButtonsHeight));
128130
}
129-
if(ScrubberButton(">")) SelectNext();
130-
style.font = normalButtonFont;
131-
GL.FlexibleSpace();
131+
//if(ScrubberButton(">")) SelectNext();
132132
if(!isPlaying && ScrubberButton($"Clear")) Clear();
133+
GL.FlexibleSpace();
134+
EGL.LabelField("last", GL.Width(24));
135+
Config.historySpan = EGL.DelayedFloatField(Config.historySpan, GL.Width(32));
136+
EGL.LabelField("s", GL.Width(16));
137+
style.font = normalButtonFont;
133138
EndHorizontal();
134139
}
135140

Editor/Core/UI/LogWindowModel.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void Next(){
3838

3939
public void Prev(){
4040
int? index = Ints.Max(
41-
filtered.LastStopBefore(currentFrame, current),
41+
filtered?.LastStopBefore(currentFrame, current),
4242
DebugChan.logger.LastStopBefore(currentFrame, current)
4343
);
4444
SetCurrentFrame(index);
@@ -62,6 +62,8 @@ public string Output(bool useHistory, string rtype){
6262
}
6363

6464
public void OnPrologFrame(PrologFrame frame){
65+
if(frame == null) return;
66+
//Debug.Log($"Got new frame {frame}");
6567
filtered += frame;
6668
Activ.Loggr.UI.LogWindow.instance?.Repaint();
6769
}

Editor/Prolog/Model/Frame.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ public Frame(Message msg){
1717
}
1818

1919
Frame(Frame source, Filter filter){
20+
if(source == null){
21+
Debug.LogError("source frame is null");
22+
}
23+
if(filter == null){
24+
Debug.LogError("no filter");
25+
}
2026
index = source.index;
2127
foreach(var k in source.messages)
2228
if(filter.Accept(k)) messages.Add(k);

Editor/Prolog/Model/History.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public int End(int i) // End of range at i
7070
=> i == !this - 1 ? Time.frameCount : frames[i + 1].index - 1;
7171

7272
public static History operator + (History self, Frame frame){
73+
if(frame == null) return self;
7374
if(self == null) return self;
7475
frame *= self.filter;
7576
if(frame % self.last) return self;

0 commit comments

Comments
 (0)