inspector_dock.h 5.4 KB

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