SceneSelection.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 Cut();
  26. void Copy();
  27. void Paste();
  28. void Delete();
  29. /// Add a node to the selection, if clear specified removes current nodes first
  30. void AddNode(Node* node, bool clear = false);
  31. void RemoveNode(Node* node, bool quiet = false);
  32. void GetBounds(BoundingBox& bbox);
  33. bool Contains(Node* node);
  34. Node* GetSelectedNode(unsigned index) const;
  35. unsigned GetSelectedNodeCount() const { return nodes_.Size(); }
  36. void Clear();
  37. private:
  38. void DrawNodeDebug(Node* node, DebugRenderer* debug, bool drawNode = true);
  39. void HandlePostRenderUpdate(StringHash eventType, VariantMap& eventData);
  40. void HandleNodeRemoved(StringHash eventType, VariantMap& eventData);
  41. void HandleSceneEditPrefabSave(StringHash eventType, VariantMap& eventData);
  42. void HandleSceneEditPrefabRevert(StringHash eventType, VariantMap& eventData);
  43. void HandleSceneEditPrefabBreak(StringHash eventType, VariantMap& eventData);
  44. WeakPtr<SceneEditor3D> sceneEditor3D_;
  45. WeakPtr<Scene> scene_;
  46. Vector<SharedPtr<Node>> clipBoardNodes_;
  47. Vector<SharedPtr<Node>> nodes_;
  48. };
  49. }