Command.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
  3. // LICENSE: Atomic Game Engine Editor and Tools EULA
  4. // Please see LICENSE_ATOMIC_EDITOR_AND_TOOLS.md in repository root for
  5. // license information: https://github.com/AtomicGameEngine/AtomicGameEngine
  6. //
  7. #include "../ToolSystem.h"
  8. #include "../Project/Project.h"
  9. #include "Command.h"
  10. namespace ToolCore
  11. {
  12. Command::Command(Context* context) : Object(context),
  13. timeOut_(0.0f)
  14. {
  15. }
  16. Command::~Command()
  17. {
  18. }
  19. bool Command::Parse(const String& command)
  20. {
  21. Vector<String> args = command.Split(' ');
  22. String errorMsg;
  23. return Parse(args, 0, errorMsg);
  24. }
  25. void Command::Error(const String& errorMsg)
  26. {
  27. VariantMap eventData;
  28. eventData[CommandError::P_MESSAGE] = errorMsg;
  29. SendEvent(E_COMMANDERROR, eventData);
  30. }
  31. void Command::Finished()
  32. {
  33. ToolSystem* tsystem = GetSubsystem<ToolSystem>();
  34. Project* project = tsystem->GetProject();
  35. if (project && project->IsDirty())
  36. project->Save(project->GetProjectFilePath());
  37. SendEvent(E_COMMANDFINISHED);
  38. }
  39. }