mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-05 11:09:37 -06:00
Send topic on presync instead of from itmemanager (closes #2037)
This commit is contained in:
@@ -154,6 +154,13 @@ SkyBrowserModule::SkyBrowserModule()
|
||||
if (_cameraRotation.isAnimating() && _allowCameraRotation) {
|
||||
incrementallyRotateCamera();
|
||||
}
|
||||
|
||||
// Trigger callbacks (should maybe have a check to see if update is needed)
|
||||
using K = CallbackHandle;
|
||||
using V = CallbackFunction;
|
||||
for (const std::pair<K, V>& it : _preSyncCallbacks) {
|
||||
it.second(); // call function
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -397,6 +404,31 @@ bool SkyBrowserModule::isSelectedPairFacingCamera() const {
|
||||
return found ? found->isFacingCamera() : false;
|
||||
}
|
||||
|
||||
SkyBrowserModule::CallbackHandle SkyBrowserModule::addPreSyncCallback(
|
||||
CallbackFunction cb)
|
||||
{
|
||||
CallbackHandle handle = _nextCallbackHandle++;
|
||||
_preSyncCallbacks.emplace_back(handle, std::move(cb));
|
||||
return handle;
|
||||
}
|
||||
|
||||
void SkyBrowserModule::removePreSyncCallback(CallbackHandle handle) {
|
||||
const auto it = std::find_if(
|
||||
_preSyncCallbacks.begin(),
|
||||
_preSyncCallbacks.end(),
|
||||
[handle](const std::pair<CallbackHandle, CallbackFunction>& cb) {
|
||||
return cb.first == handle;
|
||||
}
|
||||
);
|
||||
|
||||
ghoul_assert(
|
||||
it != _preSyncCallbacks.end(),
|
||||
"handle must be a valid callback handle"
|
||||
);
|
||||
|
||||
_preSyncCallbacks.erase(it);
|
||||
}
|
||||
|
||||
scripting::LuaLibrary SkyBrowserModule::luaLibrary() const {
|
||||
return {
|
||||
"skybrowser",
|
||||
|
||||
Reference in New Issue
Block a user