KX_LibLoadStatus.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * ***** BEGIN GPL LICENSE BLOCK *****
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software Foundation,
  16. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. *
  18. * Contributor(s): Mitchell Stokes
  19. *
  20. * ***** END GPL LICENSE BLOCK *****
  21. */
  22. /** \file KX_LibLoadStatus.h
  23. * \ingroup bgeconv
  24. */
  25. #ifndef __KX_LIBLOADSTATUS_H__
  26. #define __KX_LIBLOADSTATUS_H__
  27. #include "EXP_PyObjectPlus.h"
  28. class KX_LibLoadStatus : public PyObjectPlus
  29. {
  30. Py_Header
  31. private:
  32. class KX_BlenderSceneConverter* m_converter;
  33. class KX_KetsjiEngine* m_engine;
  34. class KX_Scene* m_mergescene;
  35. void* m_data;
  36. STR_String m_libname;
  37. float m_progress;
  38. double m_starttime;
  39. double m_endtime;
  40. // The current status of this libload, used by the scene converter.
  41. bool m_finished;
  42. #ifdef WITH_PYTHON
  43. PyObject* m_finish_cb;
  44. PyObject* m_progress_cb;
  45. #endif
  46. public:
  47. KX_LibLoadStatus(class KX_BlenderSceneConverter* kx_converter,
  48. class KX_KetsjiEngine* kx_engine,
  49. class KX_Scene* merge_scene,
  50. const char *path);
  51. void Finish(); // Called when the libload is done
  52. void RunFinishCallback();
  53. void RunProgressCallback();
  54. class KX_BlenderSceneConverter *GetConverter();
  55. class KX_KetsjiEngine *GetEngine();
  56. class KX_Scene *GetMergeScene();
  57. void SetLibName(const char *name);
  58. const char *GetLibName();
  59. void SetData(void *data);
  60. void *GetData();
  61. inline bool IsFinished() const
  62. {
  63. return m_finished;
  64. }
  65. void SetProgress(float progress);
  66. float GetProgress();
  67. void AddProgress(float progress);
  68. #ifdef WITH_PYTHON
  69. static PyObject* pyattr_get_onfinish(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
  70. static int pyattr_set_onfinish(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
  71. static PyObject* pyattr_get_onprogress(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
  72. static int pyattr_set_onprogress(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
  73. static PyObject* pyattr_get_timetaken(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
  74. #endif
  75. };
  76. #endif // __KX_LIBLOADSTATUS_H__