Add from_ssc command for CEL scripts
parent
deeca96ddb
commit
9d25ab249f
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
from_ssc { fragment "Modify \"433 Eros:Eros:1898 DQ\" \"Sol\" {UniformRotation {Period 0.01}}" }
|
||||
}
|
|
@ -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 + "'");
|
||||
|
|
|
@ -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, "");
|
||||
}
|
||||
|
|
|
@ -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_
|
||||
|
|
Loading…
Reference in New Issue