mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-09 13:14:53 -06:00
Rearranged profile initializations and verified that all init correctly
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
|
||||
#include <openspace/interaction/actionmanager.h>
|
||||
|
||||
#include <openspace/scene/profile.h>
|
||||
#include <openspace/scripting/lualibrary.h>
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
@@ -104,37 +103,6 @@ void ActionManager::triggerAction(const std::string& identifier,
|
||||
}
|
||||
}
|
||||
|
||||
void ActionManager::setFromProfile_actions(const Profile& p)
|
||||
{
|
||||
for (Profile::Action a : p.actions) {
|
||||
if (a.identifier.empty()) {
|
||||
LERROR("Identifier must to provided to register action");
|
||||
}
|
||||
if (hasAction(a.identifier)) {
|
||||
LERROR(fmt::format("Action for identifier '{}' already existed & registered",
|
||||
a.identifier));
|
||||
}
|
||||
if (a.script.empty()) {
|
||||
LERROR(fmt::format("Identifier '{}' doesn't provide a Lua command to execute",
|
||||
a.identifier));
|
||||
}
|
||||
interaction::Action action;
|
||||
action.identifier = a.identifier;
|
||||
action.command = a.script;
|
||||
if (!a.name.empty()) {
|
||||
action.name = a.name;
|
||||
}
|
||||
if (!a.documentation.empty()) {
|
||||
action.documentation = a.documentation;
|
||||
}
|
||||
if (!a.guiPath.empty()) {
|
||||
action.guiPath = a.guiPath;
|
||||
}
|
||||
action.synchronization = interaction::Action::IsSynchronized(a.isLocal);
|
||||
registerAction(std::move(action));
|
||||
}
|
||||
}
|
||||
|
||||
scripting::LuaLibrary ActionManager::luaLibrary() {
|
||||
return {
|
||||
"action",
|
||||
|
||||
@@ -142,23 +142,6 @@ std::string KeybindingManager::generateJson() const {
|
||||
return json.str();
|
||||
}
|
||||
|
||||
void KeybindingManager::setFromProfile_keybindings(const Profile& p)
|
||||
{
|
||||
for (Profile::Keybinding k : p.keybindings) {
|
||||
if (k.action.empty()) {
|
||||
LERROR("Action must not be empty");
|
||||
}
|
||||
if (!global::actionManager->hasAction(k.action)) {
|
||||
LERROR(fmt::format("Action '{}' does not exist", k.action));
|
||||
}
|
||||
if (k.key.key == openspace::Key::Unknown) {
|
||||
LERROR(fmt::format("Could not find key '{}'",
|
||||
std::to_string(static_cast<uint16_t>(k.key.key))));
|
||||
}
|
||||
bindKey(k.key.key, k.key.modifier, k.action);
|
||||
}
|
||||
}
|
||||
|
||||
scripting::LuaLibrary KeybindingManager::luaLibrary() {
|
||||
return {
|
||||
"",
|
||||
|
||||
Reference in New Issue
Block a user