ModelImporter.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #pragma once
  2. #include "AssetImporter.h"
  3. namespace Atomic
  4. {
  5. class Node;
  6. }
  7. using namespace Atomic;
  8. namespace ToolCore
  9. {
  10. class AnimationImportInfo : public Object
  11. {
  12. friend class ModelImporter;
  13. public:
  14. OBJECT(AnimationImportInfo);
  15. AnimationImportInfo(Context* context) : Object(context), startTime_(-1.0f), endTime_(-1.0f)
  16. {
  17. }
  18. const String& GetName() const { return name_; }
  19. float GetStartTime() const { return startTime_; }
  20. float GetEndTime() const { return endTime_; }
  21. void SetStartTime(float time) { startTime_ = time; }
  22. void SetEndTime(float time) { endTime_ = time; }
  23. private:
  24. String name_;
  25. float startTime_;
  26. float endTime_;
  27. };
  28. class ModelImporter : public AssetImporter
  29. {
  30. OBJECT(ModelImporter);
  31. public:
  32. /// Construct.
  33. ModelImporter(Context* context, Asset* asset);
  34. virtual ~ModelImporter();
  35. virtual void SetDefaults();
  36. float GetScale() { return scale_; }
  37. void SetScale(float scale) {scale_ = scale; }
  38. bool GetImportAnimations() { return importAnimations_; }
  39. void SetImportAnimations(bool importAnimations) { importAnimations_ = importAnimations; }
  40. bool Import(const String& guid);
  41. protected:
  42. bool ImportModel();
  43. bool ImportAnimations();
  44. bool ImportAnimation(const String &filename, const String& name, float startTime=-1.0f, float endTime=-1.0f);
  45. virtual bool LoadSettingsInternal();
  46. virtual bool SaveSettingsInternal();
  47. float scale_;
  48. bool importAnimations_;
  49. Vector<SharedPtr<AnimationImportInfo>> animationInfo_;
  50. SharedPtr<Node> importNode_;
  51. };
  52. }