diff --git a/scripts/tests/from_ssc.cel b/scripts/tests/from_ssc.cel new file mode 100644 index 000000000..910818421 --- /dev/null +++ b/scripts/tests/from_ssc.cel @@ -0,0 +1,3 @@ +{ + from_ssc { fragment "Modify \"433 Eros:Eros:1898 DQ\" \"Sol\" {UniformRotation {Period 0.01}}" } +} diff --git a/src/celengine/cmdparser.cpp b/src/celengine/cmdparser.cpp index e82fff93e..eda03804d 100644 --- a/src/celengine/cmdparser.cpp +++ b/src/celengine/cmdparser.cpp @@ -895,6 +895,12 @@ Command* CommandParser::parseCommand() paramList->getString("path", path); cmd = new CommandSetRingsTexture(object, texture, path); } + else if (commandName == "from_ssc") + { + string fragment; + paramList->getString("fragment", fragment); + cmd = new CommandFromSSC(fragment); + } else { error("Unknown command name '" + commandName + "'"); diff --git a/src/celengine/command.cpp b/src/celengine/command.cpp index ae6b3ab5c..6f93dd03e 100644 --- a/src/celengine/command.cpp +++ b/src/celengine/command.cpp @@ -1175,3 +1175,20 @@ void CommandSetRingsTexture::process(ExecutionEnvironment& env) sel.body()->getRings()->texture = MultiResTexture(textureName, path); } } + + +/////////////// +// FromSSC command +CommandFromSSC::CommandFromSSC(string _fragment) : + fragment(_fragment) +{ +} + +void CommandFromSSC::process(ExecutionEnvironment& env) +{ + Universe* u = env.getSimulation()->getUniverse(); + if (u == nullptr) + return; + istringstream in(fragment); + LoadSolarSystemObjects(in, *u, ""); +} diff --git a/src/celengine/command.h b/src/celengine/command.h index 7a301e7fe..03e10a6fe 100644 --- a/src/celengine/command.h +++ b/src/celengine/command.h @@ -813,4 +813,15 @@ class CommandSetRingsTexture : public InstantaneousCommand std::string object, textureName, path; }; + +class CommandFromSSC : public InstantaneousCommand +{ + public: + CommandFromSSC(std::string); + void process(ExecutionEnvironment&); + + private: + std::string fragment; +}; + #endif // _COMMAND_H_