2
0

inspector_dock.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*************************************************************************/
  2. /* inspector_dock.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
  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 INSPECTOR_DOCK_H
  31. #define INSPECTOR_DOCK_H
  32. #include "editor/animation_track_editor.h"
  33. #include "editor/connections_dialog.h"
  34. #include "editor/create_dialog.h"
  35. #include "editor/editor_data.h"
  36. #include "editor/editor_inspector.h"
  37. #include "editor/editor_path.h"
  38. #include "scene/gui/box_container.h"
  39. #include "scene/gui/button.h"
  40. #include "scene/gui/control.h"
  41. #include "scene/gui/label.h"
  42. #include "scene/gui/popup_menu.h"
  43. class EditorNode;
  44. class InspectorDock : public VBoxContainer {
  45. GDCLASS(InspectorDock, VBoxContainer);
  46. enum MenuOptions {
  47. RESOURCE_LOAD,
  48. RESOURCE_SAVE,
  49. RESOURCE_SAVE_AS,
  50. RESOURCE_MAKE_BUILT_IN,
  51. RESOURCE_COPY,
  52. RESOURCE_EDIT_CLIPBOARD,
  53. OBJECT_COPY_PARAMS,
  54. OBJECT_PASTE_PARAMS,
  55. OBJECT_UNIQUE_RESOURCES,
  56. OBJECT_REQUEST_HELP,
  57. COLLAPSE_ALL,
  58. EXPAND_ALL,
  59. OBJECT_METHOD_BASE = 500
  60. };
  61. EditorNode *editor;
  62. EditorData *editor_data;
  63. EditorInspector *inspector;
  64. Object *current;
  65. Button *backward_button;
  66. Button *forward_button;
  67. EditorFileDialog *load_resource_dialog;
  68. CreateDialog *new_resource_dialog;
  69. Button *resource_new_button;
  70. Button *resource_load_button;
  71. MenuButton *resource_save_button;
  72. MenuButton *history_menu;
  73. LineEdit *search;
  74. MenuButton *object_menu;
  75. EditorPath *editor_path;
  76. Button *warning;
  77. AcceptDialog *warning_dialog;
  78. void _menu_option(int p_option);
  79. void _new_resource();
  80. void _load_resource(const String &p_type = "");
  81. void _open_resource_selector() { _load_resource(); }; // just used to call from arg-less signal
  82. void _resource_file_selected(String p_file);
  83. void _save_resource(bool save_as);
  84. void _unref_resource();
  85. void _copy_resource();
  86. void _paste_resource();
  87. void _warning_pressed();
  88. void _resource_created();
  89. void _resource_selected(const RES &p_res, const String &p_property);
  90. void _edit_forward();
  91. void _edit_back();
  92. void _menu_collapseall();
  93. void _menu_expandall();
  94. void _select_history(int p_idx);
  95. void _prepare_history();
  96. void _property_keyed(const String &p_keyed, const Variant &p_value, bool p_advance);
  97. void _transform_keyed(Object *sp, const String &p_sub, const Transform &p_key);
  98. protected:
  99. static void _bind_methods();
  100. void _notification(int p_what);
  101. public:
  102. void go_back();
  103. void update_keying();
  104. void edit_resource(const Ref<Resource> &p_resource);
  105. void open_resource(const String &p_type);
  106. void clear();
  107. void set_warning(const String &p_message);
  108. void update(Object *p_object);
  109. Container *get_addon_area();
  110. EditorInspector *get_inspector() { return inspector; }
  111. InspectorDock(EditorNode *p_editor, EditorData &p_editor_data);
  112. ~InspectorDock();
  113. };
  114. #endif