scene_loader.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*************************************************************************/
  2. /* scene_loader.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* http://www.godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  9. /* */
  10. /* Permission is hereby granted, free of charge, to any person obtaining */
  11. /* a copy of this software and associated documentation files (the */
  12. /* "Software"), to deal in the Software without restriction, including */
  13. /* without limitation the rights to use, copy, modify, merge, publish, */
  14. /* distribute, sublicense, and/or sell copies of the Software, and to */
  15. /* permit persons to whom the Software is furnished to do so, subject to */
  16. /* the following conditions: */
  17. /* */
  18. /* The above copyright notice and this permission notice shall be */
  19. /* included in all copies or substantial portions of the Software. */
  20. /* */
  21. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  22. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  23. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  24. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  25. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  26. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  27. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  28. /*************************************************************************/
  29. #ifndef SCENE_LOADER_H
  30. #define SCENE_LOADER_H
  31. #include "scene/main/node.h"
  32. /**
  33. @author Juan Linietsky <[email protected]>
  34. */
  35. #ifdef OLD_SCENE_FORMAT_ENABLED
  36. class SceneInteractiveLoader : public Reference {
  37. OBJ_TYPE(SceneInteractiveLoader,Reference);
  38. protected:
  39. static void _bind_methods();
  40. public:
  41. virtual void set_local_path(const String& p_local_path)=0;
  42. virtual Node *get_scene()=0;
  43. virtual Error poll()=0;
  44. virtual int get_stage() const=0;
  45. virtual int get_stage_count() const=0;
  46. SceneInteractiveLoader() {}
  47. };
  48. class SceneFormatLoader {
  49. public:
  50. virtual Ref<SceneInteractiveLoader> load_interactive(const String &p_path,bool p_root_scene_hint=false);
  51. virtual Node* load(const String &p_path,bool p_root_scene_hint=false)=0;
  52. virtual void get_recognized_extensions(List<String> *p_extensions) const=0;
  53. bool recognize(const String& p_extension) const;
  54. virtual ~SceneFormatLoader() {}
  55. };
  56. class SceneLoader {
  57. enum {
  58. MAX_LOADERS=64
  59. };
  60. static SceneFormatLoader *loader[MAX_LOADERS];
  61. static int loader_count;
  62. public:
  63. static Ref<SceneInteractiveLoader> load_interactive(const String &p_path,bool p_save_root_state=false);
  64. static Node* load(const String &p_path,bool p_save_root_state=false);
  65. static void add_scene_format_loader(SceneFormatLoader *p_format_loader);
  66. static void get_recognized_extensions(List<String> *p_extensions);
  67. };
  68. #endif
  69. #endif