mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-24 04:58:59 -05:00
Making iSWA compile with the changes in the ScriptManager
This commit is contained in:
@@ -107,7 +107,10 @@ bool IswaCygnet::initialize(){
|
||||
}else{
|
||||
_delete.onChange([this](){
|
||||
deinitialize();
|
||||
OsEng.scriptEngine().queueScript("openspace.removeSceneGraphNode('" + name() + "')");
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.removeSceneGraphNode('" + name() + "')",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -260,7 +263,10 @@ void IswaCygnet::initializeGroup(){
|
||||
|
||||
groupEvent->subscribe(name(), "clearGroup", [&](ghoul::Dictionary dict){
|
||||
LDEBUG(name() + " Event clearGroup");
|
||||
OsEng.scriptEngine().queueScript("openspace.removeSceneGraphNode('" + name() + "')");
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.removeSceneGraphNode('" + name() + "')",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,10 @@ void IswaKameleonGroup::updateFieldlineSeeds(){
|
||||
// if this option was turned off
|
||||
if( std::find(selectedOptions.begin(), selectedOptions.end(), seedPath.first)==selectedOptions.end() && std::get<2>(seedPath.second)){
|
||||
LDEBUG("Removed fieldlines: " + std::get<0>(seedPath.second));
|
||||
OsEng.scriptEngine().queueScript("openspace.removeSceneGraphNode('" + std::get<0>(seedPath.second) + "')");
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.removeSceneGraphNode('" + std::get<0>(seedPath.second) + "')",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
std::get<2>(seedPath.second) = false;
|
||||
// if this option was turned on
|
||||
} else if( std::find(selectedOptions.begin(), selectedOptions.end(), seedPath.first)!=selectedOptions.end() && !std::get<2>(seedPath.second)) {
|
||||
@@ -146,7 +149,10 @@ void IswaKameleonGroup::clearFieldlines(){
|
||||
for (auto& seedPath: _fieldlineState) {
|
||||
if(std::get<2>(seedPath.second)){
|
||||
LDEBUG("Removed fieldlines: " + std::get<0>(seedPath.second));
|
||||
OsEng.scriptEngine().queueScript("openspace.removeSceneGraphNode('" + std::get<0>(seedPath.second) + "')");
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.removeSceneGraphNode('" + std::get<0>(seedPath.second) + "')",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
std::get<2>(seedPath.second) = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +232,10 @@ void KameleonPlane::updateFieldlineSeeds(){
|
||||
if(OsEng.renderEngine().scene()->sceneGraphNode(std::get<0>(seedPath.second)) == nullptr) return;
|
||||
|
||||
LDEBUG("Removed fieldlines: " + std::get<0>(seedPath.second));
|
||||
OsEng.scriptEngine().queueScript("openspace.removeSceneGraphNode('" + std::get<0>(seedPath.second) + "')");
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.removeSceneGraphNode('" + std::get<0>(seedPath.second) + "')",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
std::get<2>(seedPath.second) = false;
|
||||
// if this option was turned on
|
||||
} else if( std::find(selectedOptions.begin(), selectedOptions.end(), seedPath.first)!=selectedOptions.end() && !std::get<2>(seedPath.second)) {
|
||||
|
||||
@@ -59,7 +59,8 @@ ScreenSpaceCygnet::ScreenSpaceCygnet(const ghoul::Dictionary& dictionary)
|
||||
|
||||
_delete.onChange([this](){
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.iswa.removeScreenSpaceCygnet("+std::to_string(_cygnetId)+");"
|
||||
"openspace.iswa.removeScreenSpaceCygnet("+std::to_string(_cygnetId)+");",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
});
|
||||
// IswaManager::ref().deleteIswaCygnet(name());});
|
||||
|
||||
@@ -439,7 +439,10 @@ std::string IswaManager::jsonSphereToLuaTable(std::shared_ptr<MetadataFuture> da
|
||||
void IswaManager::createScreenSpace(int id){
|
||||
std::string script = "openspace.iswa.addScreenSpaceCygnet("
|
||||
"{CygnetId =" + std::to_string(id) + "});";
|
||||
OsEng.scriptEngine().queueScript(script);
|
||||
OsEng.scriptEngine().queueScript(
|
||||
script,
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
}
|
||||
|
||||
void IswaManager::createPlane(std::shared_ptr<MetadataFuture> data){
|
||||
@@ -475,7 +478,10 @@ void IswaManager::createPlane(std::shared_ptr<MetadataFuture> data){
|
||||
std::string luaTable = jsonPlaneToLuaTable(data);
|
||||
if(luaTable != ""){
|
||||
std::string script = "openspace.addSceneGraphNode(" + luaTable + ");";
|
||||
OsEng.scriptEngine().queueScript(script);
|
||||
OsEng.scriptEngine().queueScript(
|
||||
script,
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -504,7 +510,10 @@ void IswaManager::createSphere(std::shared_ptr<MetadataFuture> data){
|
||||
std::string luaTable = jsonSphereToLuaTable(data);
|
||||
if(luaTable != ""){
|
||||
std::string script = "openspace.addSceneGraphNode(" + luaTable + ");";
|
||||
OsEng.scriptEngine().queueScript(script);
|
||||
OsEng.scriptEngine().queueScript(
|
||||
script,
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -536,7 +545,10 @@ void IswaManager::createKameleonPlane(CdfInfo info, std::string cut){
|
||||
std::string luaTable = parseKWToLuaTable(info, cut);
|
||||
if(!luaTable.empty()){
|
||||
std::string script = "openspace.addSceneGraphNode(" + luaTable + ");";
|
||||
OsEng.scriptEngine().queueScript(script);
|
||||
OsEng.scriptEngine().queueScript(
|
||||
script,
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
}
|
||||
}else{
|
||||
LWARNING( absPath(info.path) + " is not a cdf file or can't be found.");
|
||||
@@ -570,7 +582,10 @@ void IswaManager::createFieldline(std::string name, std::string cdfPath, std::st
|
||||
"}";
|
||||
if(!luaTable.empty()){
|
||||
std::string script = "openspace.addSceneGraphNode(" + luaTable + ");";
|
||||
OsEng.scriptEngine().queueScript(script);
|
||||
OsEng.scriptEngine().queueScript(
|
||||
script,
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
}
|
||||
}else{
|
||||
LWARNING( cdfPath + " is not a cdf file or can't be found.");
|
||||
@@ -661,21 +676,18 @@ scripting::LuaLibrary IswaManager::luaLibrary() {
|
||||
&luascriptfunctions::iswa_addCygnet,
|
||||
"int, string, string",
|
||||
"Adds a IswaCygnet",
|
||||
true
|
||||
},
|
||||
{
|
||||
"addScreenSpaceCygnet",
|
||||
&luascriptfunctions::iswa_addScreenSpaceCygnet,
|
||||
"int, string, string",
|
||||
"Adds a Screen Space Cygnets",
|
||||
true
|
||||
},
|
||||
{
|
||||
"addKameleonPlanes",
|
||||
&luascriptfunctions::iswa_addKameleonPlanes,
|
||||
"string, int",
|
||||
"Adds KameleonPlanes from cdf file.",
|
||||
true
|
||||
},
|
||||
// {
|
||||
// "addKameleonPlane",
|
||||
@@ -689,35 +701,30 @@ scripting::LuaLibrary IswaManager::luaLibrary() {
|
||||
&luascriptfunctions::iswa_addCdfFiles,
|
||||
"string",
|
||||
"Adds a cdf files to choose from.",
|
||||
true
|
||||
},
|
||||
{
|
||||
"removeCygnet",
|
||||
&luascriptfunctions::iswa_removeCygnet,
|
||||
"string",
|
||||
"Remove a Cygnets",
|
||||
true
|
||||
},
|
||||
{
|
||||
"removeScreenSpaceCygnet",
|
||||
&luascriptfunctions::iswa_removeScrenSpaceCygnet,
|
||||
"int",
|
||||
"Remove a Screen Space Cygnets",
|
||||
true
|
||||
},
|
||||
{
|
||||
"removeGroup",
|
||||
&luascriptfunctions::iswa_removeGroup,
|
||||
"int",
|
||||
"Remove a group of Cygnets",
|
||||
true
|
||||
},
|
||||
{
|
||||
"setBaseUrl",
|
||||
&luascriptfunctions::iswa_setBaseUrl,
|
||||
"string",
|
||||
"sets the base url",
|
||||
true
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -114,7 +114,10 @@ int iswa_addScreenSpaceCygnet(lua_State* L){
|
||||
|
||||
int iswa_removeCygnet(lua_State* L){
|
||||
std::string name = luaL_checkstring(L, -1);
|
||||
OsEng.scriptEngine().queueScript("openspace.removeSceneGraphNode('" + name + "')");
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.removeSceneGraphNode('" + name + "')",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
// IswaManager::ref().deleteIswaCygnet(s);
|
||||
return 0;
|
||||
}
|
||||
@@ -134,7 +137,10 @@ int iswa_removeScrenSpaceCygnet(lua_State* L){
|
||||
info->selected = false;
|
||||
|
||||
std::string script = "openspace.unregisterScreenSpaceRenderable('" + cygnetInformation[id]->name + "');";
|
||||
OsEng.scriptEngine().queueScript(script);
|
||||
OsEng.scriptEngine().queueScript(
|
||||
script,
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,8 @@ void GuiIswaComponent::render() {
|
||||
|
||||
if (ImGui::SmallButton("Add Cygnet")) {
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.iswa.addCygnet(" + std::string(addCygnetBuffer) + ");"
|
||||
"openspace.iswa.addCygnet(" + std::string(addCygnetBuffer) + ");",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
}
|
||||
|
||||
@@ -83,9 +84,15 @@ void GuiIswaComponent::render() {
|
||||
std::string x = "openspace.iswa.addCygnet(-4, 'Data', 'GMData');";
|
||||
std::string y = "openspace.iswa.addCygnet(-5, 'Data', 'GMData');";
|
||||
std::string z = "openspace.iswa.addCygnet(-6, 'Data', 'GMData');";
|
||||
OsEng.scriptEngine().queueScript(x + y + z);
|
||||
OsEng.scriptEngine().queueScript(
|
||||
x + y + z,
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
} else {
|
||||
OsEng.scriptEngine().queueScript("openspace.iswa.removeGroup('GMData');");
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.iswa.removeGroup('GMData');",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,19 +101,29 @@ void GuiIswaComponent::render() {
|
||||
std::string x = "openspace.iswa.addCygnet(-4, 'Texture', 'GMImage');";
|
||||
std::string y = "openspace.iswa.addCygnet(-5, 'Texture', 'GMImage');";
|
||||
std::string z = "openspace.iswa.addCygnet(-6, 'Texture', 'GMImage');";
|
||||
OsEng.scriptEngine().queueScript(x + y + z);
|
||||
OsEng.scriptEngine().queueScript(
|
||||
x + y + z,
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
} else {
|
||||
OsEng.scriptEngine().queueScript("openspace.iswa.removeGroup('GMImage');");
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.iswa.removeGroup('GMImage');",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if(_ionData != oldIonDataValue) {
|
||||
if(_ionData) {
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.iswa.addCygnet(-10,'Data','Ionosphere');"
|
||||
"openspace.iswa.addCygnet(-10,'Data','Ionosphere');",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
} else {
|
||||
OsEng.scriptEngine().queueScript("openspace.iswa.removeGroup('Ionosphere');");
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.iswa.removeGroup('Ionosphere');",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,13 +164,16 @@ void GuiIswaComponent::render() {
|
||||
groupName +
|
||||
"'," +
|
||||
std::to_string(cdfOption) +
|
||||
");"
|
||||
");",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.time.setTime('" + date + "');"
|
||||
"openspace.time.setTime('" + date + "');",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.time.setDeltaTime(0);"
|
||||
"openspace.time.setDeltaTime(0);",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -181,13 +201,15 @@ void GuiIswaComponent::render() {
|
||||
if (info->selected) {
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.iswa.addScreenSpaceCygnet("
|
||||
"{CygnetId = " + std::to_string(id) + " });"
|
||||
"{CygnetId = " + std::to_string(id) + " });",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
} else {
|
||||
OsEng.scriptEngine().queueScript(
|
||||
"openspace.iswa.removeScreenSpaceCygnet(" +
|
||||
std::to_string(id) +
|
||||
");"
|
||||
");",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user