SceneSelection.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. #pragma once
  8. #include <Atomic/Core/Object.h>
  9. using namespace Atomic;
  10. namespace Atomic
  11. {
  12. class Node;
  13. class Scene;
  14. }
  15. namespace AtomicEditor
  16. {
  17. class SceneEditor3D;
  18. class SceneSelection: public Object
  19. {
  20. OBJECT(SceneSelection);
  21. public:
  22. SceneSelection(Context* context, SceneEditor3D* sceneEditor);
  23. virtual ~SceneSelection();
  24. Vector<SharedPtr<Node>>& GetNodes() { return nodes_; }
  25. void Copy();
  26. void Paste();
  27. void Delete();
  28. /// Add a node to the selection, if clear specified removes current nodes first
  29. void AddNode(Node* node, bool clear = false);
  30. void RemoveNode(Node* node, bool quiet = false);
  31. void GetBounds(BoundingBox& bbox);
  32. bool Contains(Node* node);
  33. Node* GetSelectedNode(unsigned index) const;
  34. unsigned GetSelectedNodeCount() const { return nodes_.Size(); }
  35. void Clear();
  36. private:
  37. void DrawNodeDebug(Node* node, DebugRenderer* debug, bool drawNode = true);
  38. void HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData);
  39. void HandleNodeRemoved(StringHash eventType, VariantMap& eventData);
  40. WeakPtr<SceneEditor3D> sceneEditor3D_;
  41. WeakPtr<Scene> scene_;
  42. Vector<SharedPtr<Node>> clipBoardNodes_;
  43. Vector<SharedPtr<Node>> nodes_;
  44. };
  45. }