room_manager_editor_plugin.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /**************************************************************************/
  2. /* room_manager_editor_plugin.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef ROOM_MANAGER_EDITOR_PLUGIN_H
  31. #define ROOM_MANAGER_EDITOR_PLUGIN_H
  32. #include "editor/editor_node.h"
  33. #include "editor/editor_plugin.h"
  34. #include "scene/3d/occluder.h"
  35. #include "scene/3d/portal.h"
  36. #include "scene/3d/room.h"
  37. #include "scene/3d/room_manager.h"
  38. #include "scene/resources/material.h"
  39. class RoomManagerEditorPlugin : public EditorPlugin {
  40. GDCLASS(RoomManagerEditorPlugin, EditorPlugin);
  41. RoomManager *_room_manager;
  42. ToolButton *button_flip_portals;
  43. EditorNode *editor;
  44. void _flip_portals();
  45. protected:
  46. static void _bind_methods();
  47. public:
  48. virtual String get_name() const { return "RoomManager"; }
  49. bool has_main_screen() const { return false; }
  50. virtual void edit(Object *p_object);
  51. virtual bool handles(Object *p_object) const;
  52. virtual void make_visible(bool p_visible);
  53. RoomManagerEditorPlugin(EditorNode *p_node);
  54. ~RoomManagerEditorPlugin();
  55. };
  56. ///////////////////////
  57. class RoomEditorPlugin : public EditorPlugin {
  58. GDCLASS(RoomEditorPlugin, EditorPlugin);
  59. Room *_room;
  60. ToolButton *button_generate;
  61. EditorNode *editor;
  62. UndoRedo *undo_redo;
  63. void _generate_points();
  64. protected:
  65. static void _bind_methods();
  66. public:
  67. virtual String get_name() const { return "Room"; }
  68. bool has_main_screen() const { return false; }
  69. virtual void edit(Object *p_object);
  70. virtual bool handles(Object *p_object) const;
  71. virtual void make_visible(bool p_visible);
  72. RoomEditorPlugin(EditorNode *p_node);
  73. ~RoomEditorPlugin();
  74. };
  75. ///////////////////////
  76. class PortalEditorPlugin : public EditorPlugin {
  77. GDCLASS(PortalEditorPlugin, EditorPlugin);
  78. Portal *_portal;
  79. ToolButton *button_flip;
  80. EditorNode *editor;
  81. void _flip_portal();
  82. protected:
  83. static void _bind_methods();
  84. public:
  85. virtual String get_name() const { return "Portal"; }
  86. bool has_main_screen() const { return false; }
  87. virtual void edit(Object *p_object);
  88. virtual bool handles(Object *p_object) const;
  89. virtual void make_visible(bool p_visible);
  90. PortalEditorPlugin(EditorNode *p_node);
  91. ~PortalEditorPlugin();
  92. };
  93. ///////////////////////
  94. class OccluderEditorPlugin : public EditorPlugin {
  95. GDCLASS(OccluderEditorPlugin, EditorPlugin);
  96. Occluder *_occluder;
  97. ToolButton *button_center;
  98. EditorNode *editor;
  99. UndoRedo *undo_redo;
  100. void _center();
  101. protected:
  102. static void _bind_methods();
  103. public:
  104. virtual String get_name() const { return "Occluder"; }
  105. bool has_main_screen() const { return false; }
  106. virtual void edit(Object *p_object);
  107. virtual bool handles(Object *p_object) const;
  108. virtual void make_visible(bool p_visible);
  109. OccluderEditorPlugin(EditorNode *p_node);
  110. ~OccluderEditorPlugin();
  111. };
  112. #endif // ROOM_MANAGER_EDITOR_PLUGIN_H