mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-04 09:59:44 -05:00
Removing the asset_helper file (#1868)
- Remove the asset_helper file and call the onInitialize and onDeinitialize functions directly - Small compile fix on Windows - Removes the need for the registerIdentifierWithMeta function by automatically doing that for all asset.export statements - Allow the passing of either identifiers (as before) or entire tables to the removeSceneGraphNode, removeScreenSpaceRenderable, deleteLayer, removeAction, and export methods. In that case, the Identifier key from the table is extracted and used instead
This commit is contained in:
@@ -83,8 +83,9 @@ int addLayer(lua_State* L) {
|
||||
*/
|
||||
int deleteLayer(lua_State* L) {
|
||||
ghoul::lua::checkArgumentsAndThrow(L, 3, "lua::deleteLayer");
|
||||
auto [globeName, layerGroupName, layerName] =
|
||||
ghoul::lua::values<std::string, std::string, std::string>(L);
|
||||
auto [globeName, layerGroupName, layerOrName] = ghoul::lua::values<
|
||||
std::string, std::string, std::variant<std::string, ghoul::Dictionary>
|
||||
>(L);
|
||||
|
||||
// Get the node and make sure it exists
|
||||
SceneGraphNode* n = global::renderEngine->scene()->sceneGraphNode(globeName);
|
||||
@@ -106,6 +107,26 @@ int deleteLayer(lua_State* L) {
|
||||
return ghoul::lua::luaError(L, "Unknown layer group: " + layerGroupName);
|
||||
}
|
||||
|
||||
std::string layerName;
|
||||
if (std::holds_alternative<std::string>(layerOrName)) {
|
||||
layerName = std::get<std::string>(layerOrName);
|
||||
}
|
||||
else {
|
||||
ghoul_assert(
|
||||
std::holds_alternative<ghoul::Dictionary>(layerOrName),
|
||||
"Missing case"
|
||||
);
|
||||
|
||||
ghoul::Dictionary d = std::get<ghoul::Dictionary>(layerOrName);
|
||||
if (!d.hasValue<std::string>("Identifier")) {
|
||||
return ghoul::lua::luaError(
|
||||
L,
|
||||
"Table passed to deleteLayer does not contain an Identifier"
|
||||
);
|
||||
}
|
||||
layerName = d.value<std::string>("Identifier");
|
||||
}
|
||||
|
||||
globe->layerManager().deleteLayer(groupID, layerName);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user