mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-10-24 06:48:43 -04:00
obs-text: Fix file reader occasionally not updating
Delayed reading the text file till the update after the timestamp changes, this should fix a minor issue where if the file updates twice in one second, only the first change it displayed.
This commit is contained in:
1 parent
2d84da2f7e
commit
2b085da63a
1 file changed
+7
-1
@@ -197,6 +197,7 @@ struct TextSource {
|
||||
bool read_from_file = false;
|
||||
string file;
|
||||
time_t file_timestamp = 0;
|
||||
bool update_file = false;
|
||||
float update_time_elapsed = 0.0f;
|
||||
|
||||
wstring text;
|
||||
@@ -775,10 +776,15 @@ inline void TextSource::Tick(float seconds)
|
||||
time_t t = get_modified_timestamp(file.c_str());
|
||||
update_time_elapsed = 0.0f;
|
||||
|
||||
if (file_timestamp != t) {
|
||||
if (update_file) {
|
||||
LoadFileText();
|
||||
RenderText();
|
||||
update_file = false;
|
||||
}
|
||||
|
||||
if (file_timestamp != t) {
|
||||
file_timestamp = t;
|
||||
update_file = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user