inspector_dock.h 4.8 KB

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