Merge pull request #629 from AttorneyOnline/fix/static-effects
Fix various AOLayer issues
This commit is contained in:
commit
b519dbaae3
@ -148,7 +148,7 @@ private:
|
|||||||
|
|
||||||
// used in populate_vectors
|
// used in populate_vectors
|
||||||
void load_next_frame();
|
void load_next_frame();
|
||||||
std::atomic_bool exit_loop; //awful solution but i'm not fucking using QThread
|
std::atomic_bool exit_loop = false; //awful solution but i'm not fucking using QThread
|
||||||
QFuture<void> frame_loader;
|
QFuture<void> frame_loader;
|
||||||
QMutex mutex;
|
QMutex mutex;
|
||||||
QWaitCondition frameAdded;
|
QWaitCondition frameAdded;
|
||||||
|
@ -241,6 +241,8 @@ void EffectLayer::load_image(QString p_filename, bool p_looping)
|
|||||||
play_once = true;
|
play_once = true;
|
||||||
continuous = false;
|
continuous = false;
|
||||||
force_continuous = true;
|
force_continuous = true;
|
||||||
|
cull_image = false;
|
||||||
|
|
||||||
start_playback(p_filename); // path resolution is handled by the caller for EffectLayer objects
|
start_playback(p_filename); // path resolution is handled by the caller for EffectLayer objects
|
||||||
play();
|
play();
|
||||||
}
|
}
|
||||||
@ -282,9 +284,11 @@ void AOLayer::start_playback(QString p_image)
|
|||||||
this->kill();
|
this->kill();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QMutexLocker locker(&mutex);
|
|
||||||
if (frame_loader.isRunning())
|
if (frame_loader.isRunning())
|
||||||
exit_loop = true; // tell the loader to stop, we have a new image to load
|
exit_loop = true; // tell the loader to stop, we have a new image to load
|
||||||
|
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
this->show();
|
this->show();
|
||||||
|
|
||||||
if (!ao_app->is_continuous_enabled()) {
|
if (!ao_app->is_continuous_enabled()) {
|
||||||
@ -315,10 +319,10 @@ void AOLayer::start_playback(QString p_image)
|
|||||||
qDebug() << "[AOLayer::start_playback] Stretch:" << stretch << "Filename:" << p_image;
|
qDebug() << "[AOLayer::start_playback] Stretch:" << stretch << "Filename:" << p_image;
|
||||||
#endif
|
#endif
|
||||||
m_reader.setFileName(p_image);
|
m_reader.setFileName(p_image);
|
||||||
if (m_reader.loopCount() == 0)
|
|
||||||
play_once = true;
|
|
||||||
last_max_frames = max_frames;
|
last_max_frames = max_frames;
|
||||||
max_frames = m_reader.imageCount();
|
max_frames = m_reader.imageCount();
|
||||||
|
if (m_reader.loopCount() == 0 && max_frames > 1)
|
||||||
|
play_once = true;
|
||||||
if (!continuous
|
if (!continuous
|
||||||
|| ((continuous) && (max_frames != last_max_frames))
|
|| ((continuous) && (max_frames != last_max_frames))
|
||||||
|| max_frames == 0
|
|| max_frames == 0
|
||||||
@ -559,13 +563,20 @@ void AOLayer::movie_ticker()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AOLayer::populate_vectors() {
|
void AOLayer::populate_vectors() {
|
||||||
while (!exit_loop && movie_frames.size() < max_frames) {
|
|
||||||
load_next_frame();
|
|
||||||
#ifdef DEBUG_MOVIE
|
#ifdef DEBUG_MOVIE
|
||||||
qDebug() << "[AOLayer::populate_vectors] Loaded frame" << movie_frames.size();
|
qDebug() << "[AOLayer::populate_vectors] Started thread";
|
||||||
#endif
|
#endif
|
||||||
}
|
while (!exit_loop && movie_frames.size() < max_frames) {
|
||||||
exit_loop = false;
|
load_next_frame();
|
||||||
|
#ifdef DEBUG_MOVIE
|
||||||
|
qDebug() << "[AOLayer::populate_vectors] Loaded frame" << movie_frames.size();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#ifdef DEBUG_MOVIE
|
||||||
|
if (exit_loop)
|
||||||
|
qDebug() << "[AOLayer::populate_vectors] Exit requested";
|
||||||
|
#endif
|
||||||
|
exit_loop = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOLayer::load_next_frame() {
|
void AOLayer::load_next_frame() {
|
||||||
|
@ -875,14 +875,15 @@ QString AOApplication::get_effect(QString effect, QString p_char,
|
|||||||
if (p_folder == "")
|
if (p_folder == "")
|
||||||
p_folder = read_char_ini(p_char, "effects", "Options");
|
p_folder = read_char_ini(p_char, "effects", "Options");
|
||||||
|
|
||||||
QString p_path = get_image("effects/" + effect, current_theme, get_subtheme(), default_theme, "");
|
QStringList paths {
|
||||||
QString p_misc_path = get_image(effect, current_theme, get_subtheme(), default_theme, p_folder);
|
get_image("effects/" + effect, current_theme, get_subtheme(), default_theme, ""),
|
||||||
|
get_image(effect, current_theme, get_subtheme(), default_theme, p_folder)
|
||||||
|
};
|
||||||
|
|
||||||
if (!file_exists(p_misc_path) && !file_exists(p_path))
|
for (const auto &p : paths)
|
||||||
return "";
|
if (file_exists(p))
|
||||||
else if (file_exists(p_misc_path))
|
return p;
|
||||||
return p_misc_path;
|
return {};
|
||||||
return p_path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::get_effect_property(QString fx_name, QString p_char,
|
QString AOApplication::get_effect_property(QString fx_name, QString p_char,
|
||||||
|
Loading…
Reference in New Issue
Block a user