PrefabComponent.h 806 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #include "../Scene/Component.h"
  3. namespace Atomic
  4. {
  5. class ATOMIC_API PrefabComponent : public Component
  6. {
  7. ATOMIC_OBJECT(PrefabComponent, Component);
  8. public:
  9. /// Construct.
  10. PrefabComponent(Context* context);
  11. /// Destruct.
  12. virtual ~PrefabComponent();
  13. /// Register object factory.
  14. static void RegisterObject(Context* context);
  15. void SetPrefabGUID(const String& guid);
  16. const String& GetPrefabGUID() const { return prefabGUID_; }
  17. bool SavePrefab();
  18. void UndoPrefab();
  19. void BreakPrefab();
  20. protected:
  21. /// Handle scene node being assigned at creation.
  22. virtual void OnNodeSet(Node* node);
  23. private:
  24. void HandlePrefabChanged(StringHash eventType, VariantMap& eventData);
  25. void LoadPrefabNode();
  26. String prefabGUID_;
  27. };
  28. }