inspector_dock.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. class EditorNode;
  42. class InspectorDock : public VBoxContainer {
  43. GDCLASS(InspectorDock, VBoxContainer);
  44. enum MenuOptions {
  45. RESOURCE_LOAD,
  46. RESOURCE_SAVE,
  47. RESOURCE_SAVE_AS,
  48. RESOURCE_MAKE_BUILT_IN,
  49. RESOURCE_COPY,
  50. RESOURCE_EDIT_CLIPBOARD,
  51. OBJECT_COPY_PARAMS,
  52. OBJECT_PASTE_PARAMS,
  53. OBJECT_UNIQUE_RESOURCES,
  54. OBJECT_REQUEST_HELP,
  55. COLLAPSE_ALL,
  56. EXPAND_ALL,
  57. OBJECT_METHOD_BASE = 500
  58. };
  59. EditorNode *editor;
  60. EditorData *editor_data;
  61. EditorInspector *inspector;
  62. Object *current;
  63. Button *backward_button;
  64. Button *forward_button;
  65. EditorFileDialog *load_resource_dialog;
  66. CreateDialog *new_resource_dialog;
  67. Button *resource_new_button;
  68. Button *resource_load_button;
  69. MenuButton *resource_save_button;
  70. MenuButton *resource_extra_button;
  71. MenuButton *history_menu;
  72. LineEdit *search;
  73. Button *open_docs_button;
  74. MenuButton *object_menu;
  75. EditorPath *editor_path;
  76. Button *warning;
  77. AcceptDialog *warning_dialog;
  78. int current_option = -1;
  79. ConfirmationDialog *unique_resources_confirmation;
  80. Tree *unique_resources_list_tree;
  81. void _menu_option(int p_option);
  82. void _menu_confirm_current();
  83. void _menu_option_confirm(int p_option, bool p_confirmed);
  84. void _new_resource();
  85. void _load_resource(const String &p_type = "");
  86. void _open_resource_selector() { _load_resource(); }; // just used to call from arg-less signal
  87. void _resource_file_selected(String p_file);
  88. void _save_resource(bool save_as);
  89. void _unref_resource();
  90. void _copy_resource();
  91. void _paste_resource();
  92. void _prepare_resource_extra_popup();
  93. void _warning_pressed();
  94. void _resource_created();
  95. void _resource_selected(const RES &p_res, const String &p_property);
  96. void _edit_forward();
  97. void _edit_back();
  98. void _menu_collapseall();
  99. void _menu_expandall();
  100. void _select_history(int p_idx);
  101. void _prepare_history();
  102. void _property_keyed(const String &p_keyed, const Variant &p_value, bool p_advance);
  103. void _transform_keyed(Object *sp, const String &p_sub, const Transform3D &p_key);
  104. protected:
  105. static void _bind_methods();
  106. void _notification(int p_what);
  107. public:
  108. void go_back();
  109. void update_keying();
  110. void edit_resource(const Ref<Resource> &p_resource);
  111. void open_resource(const String &p_type);
  112. void clear();
  113. void set_warning(const String &p_message);
  114. void update(Object *p_object);
  115. Container *get_addon_area();
  116. EditorInspector *get_inspector() { return inspector; }
  117. InspectorDock(EditorNode *p_editor, EditorData &p_editor_data);
  118. ~InspectorDock();
  119. };
  120. #endif