| 123 | } |
| 124 | |
| 125 | void ScriptingSystem::executeCommand(const std::string& name) |
| 126 | { |
| 127 | // Sanity check |
| 128 | if (!_initialised) |
| 129 | { |
| 130 | rError() << "Cannot execute script command " << name |
| 131 | << ", ScriptingSystem not initialised yet." << std::endl; |
| 132 | return; |
| 133 | } |
| 134 | |
| 135 | // Lookup the name |
| 136 | auto found = _commands.find(name); |
| 137 | |
| 138 | if (found == _commands.end()) |
| 139 | { |
| 140 | rError() << "Couldn't find command " << name << std::endl; |
| 141 | return; |
| 142 | } |
| 143 | |
| 144 | UndoableCommand cmd("runScriptCommand " + name); |
| 145 | |
| 146 | // Execute the script file behind this command |
| 147 | executeScriptFile(found->second->getFilename(), true); |
| 148 | } |
| 149 | |
| 150 | void ScriptingSystem::loadCommandScript(const std::string& scriptFilename) |
| 151 | { |