editor_inspector.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  1. /**************************************************************************/
  2. /* editor_inspector.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 EDITOR_INSPECTOR_H
  31. #define EDITOR_INSPECTOR_H
  32. #include "editor/add_metadata_dialog.h"
  33. #include "editor_property_name_processor.h"
  34. #include "scene/gui/box_container.h"
  35. #include "scene/gui/scroll_container.h"
  36. class AcceptDialog;
  37. class Button;
  38. class ConfirmationDialog;
  39. class EditorInspector;
  40. class EditorValidationPanel;
  41. class HSeparator;
  42. class LineEdit;
  43. class MarginContainer;
  44. class OptionButton;
  45. class PanelContainer;
  46. class PopupMenu;
  47. class SpinBox;
  48. class StyleBoxFlat;
  49. class TextureRect;
  50. class EditorPropertyRevert {
  51. public:
  52. static Variant get_property_revert_value(Object *p_object, const StringName &p_property, bool *r_is_valid);
  53. static bool can_property_revert(Object *p_object, const StringName &p_property, const Variant *p_custom_current_value = nullptr);
  54. };
  55. class EditorProperty : public Container {
  56. GDCLASS(EditorProperty, Container);
  57. public:
  58. enum MenuItems {
  59. MENU_COPY_VALUE,
  60. MENU_PASTE_VALUE,
  61. MENU_COPY_PROPERTY_PATH,
  62. MENU_FAVORITE_PROPERTY,
  63. MENU_PIN_VALUE,
  64. MENU_OPEN_DOCUMENTATION,
  65. };
  66. enum ColorationMode {
  67. COLORATION_CONTAINER_RESOURCE,
  68. COLORATION_RESOURCE,
  69. COLORATION_EXTERNAL,
  70. };
  71. private:
  72. String label;
  73. int text_size;
  74. friend class EditorInspector;
  75. Object *object = nullptr;
  76. StringName property;
  77. String property_path;
  78. String doc_path;
  79. bool internal = false;
  80. bool has_doc_tooltip = false;
  81. int property_usage;
  82. bool draw_label = true;
  83. bool draw_background = true;
  84. bool read_only = false;
  85. bool checkable = false;
  86. bool checked = false;
  87. bool draw_warning = false;
  88. bool draw_prop_warning = false;
  89. bool keying = false;
  90. bool deletable = false;
  91. Rect2 right_child_rect;
  92. Rect2 bottom_child_rect;
  93. Rect2 keying_rect;
  94. bool keying_hover = false;
  95. Rect2 revert_rect;
  96. bool revert_hover = false;
  97. Rect2 check_rect;
  98. bool check_hover = false;
  99. Rect2 delete_rect;
  100. bool delete_hover = false;
  101. bool can_revert = false;
  102. bool can_pin = false;
  103. bool pin_hidden = false;
  104. bool pinned = false;
  105. bool can_favorite = false;
  106. bool favorited = false;
  107. bool use_folding = false;
  108. bool draw_top_bg = true;
  109. void _update_popup();
  110. void _focusable_focused(int p_index);
  111. bool selectable = true;
  112. bool selected = false;
  113. int selected_focusable;
  114. float split_ratio;
  115. Vector<Control *> focusables;
  116. Control *label_reference = nullptr;
  117. Control *bottom_editor = nullptr;
  118. PopupMenu *menu = nullptr;
  119. HashMap<StringName, Variant> cache;
  120. GDVIRTUAL0(_update_property)
  121. GDVIRTUAL1(_set_read_only, bool)
  122. void _update_flags();
  123. protected:
  124. bool has_borders = false;
  125. void _notification(int p_what);
  126. static void _bind_methods();
  127. virtual void _set_read_only(bool p_read_only);
  128. virtual void gui_input(const Ref<InputEvent> &p_event) override;
  129. virtual void shortcut_input(const Ref<InputEvent> &p_event) override;
  130. const Color *_get_property_colors();
  131. virtual Variant _get_cache_value(const StringName &p_prop, bool &r_valid) const;
  132. virtual StringName _get_revert_property() const;
  133. void _update_property_bg();
  134. public:
  135. void emit_changed(const StringName &p_property, const Variant &p_value, const StringName &p_field = StringName(), bool p_changing = false);
  136. String get_tooltip_string(const String &p_string) const;
  137. virtual Size2 get_minimum_size() const override;
  138. void set_label(const String &p_label);
  139. String get_label() const;
  140. void set_read_only(bool p_read_only);
  141. bool is_read_only() const;
  142. void set_draw_label(bool p_draw_label);
  143. bool is_draw_label() const;
  144. void set_draw_background(bool p_draw_background);
  145. bool is_draw_background() const;
  146. Object *get_edited_object();
  147. StringName get_edited_property() const;
  148. inline Variant get_edited_property_value() const {
  149. ERR_FAIL_NULL_V(object, Variant());
  150. return object->get(property);
  151. }
  152. EditorInspector *get_parent_inspector() const;
  153. void set_doc_path(const String &p_doc_path);
  154. void set_internal(bool p_internal);
  155. virtual void update_property();
  156. void update_editor_property_status();
  157. virtual bool use_keying_next() const;
  158. void set_checkable(bool p_checkable);
  159. bool is_checkable() const;
  160. void set_checked(bool p_checked);
  161. bool is_checked() const;
  162. void set_draw_warning(bool p_draw_warning);
  163. bool is_draw_warning() const;
  164. void set_keying(bool p_keying);
  165. bool is_keying() const;
  166. virtual bool is_colored(ColorationMode p_mode) { return false; }
  167. void set_deletable(bool p_enable);
  168. bool is_deletable() const;
  169. void add_focusable(Control *p_control);
  170. void grab_focus(int p_focusable = -1);
  171. void select(int p_focusable = -1);
  172. void deselect();
  173. bool is_selected() const;
  174. void set_label_reference(Control *p_control);
  175. void set_bottom_editor(Control *p_control);
  176. void set_use_folding(bool p_use_folding);
  177. bool is_using_folding() const;
  178. virtual void expand_all_folding();
  179. virtual void collapse_all_folding();
  180. virtual void expand_revertable();
  181. virtual Variant get_drag_data(const Point2 &p_point) override;
  182. virtual void update_cache();
  183. virtual bool is_cache_valid() const;
  184. void set_selectable(bool p_selectable);
  185. bool is_selectable() const;
  186. void set_name_split_ratio(float p_ratio);
  187. float get_name_split_ratio() const;
  188. void set_favoritable(bool p_favoritable);
  189. bool is_favoritable() const;
  190. void set_object_and_property(Object *p_object, const StringName &p_property);
  191. virtual Control *make_custom_tooltip(const String &p_text) const override;
  192. void set_draw_top_bg(bool p_draw) { draw_top_bg = p_draw; }
  193. bool can_revert_to_default() const { return can_revert; }
  194. void menu_option(int p_option);
  195. EditorProperty();
  196. };
  197. class EditorInspectorPlugin : public RefCounted {
  198. GDCLASS(EditorInspectorPlugin, RefCounted);
  199. public:
  200. friend class EditorInspector;
  201. struct AddedEditor {
  202. Control *property_editor = nullptr;
  203. Vector<String> properties;
  204. String label;
  205. bool add_to_end = false;
  206. };
  207. List<AddedEditor> added_editors;
  208. protected:
  209. static void _bind_methods();
  210. GDVIRTUAL1RC(bool, _can_handle, Object *)
  211. GDVIRTUAL1(_parse_begin, Object *)
  212. GDVIRTUAL2(_parse_category, Object *, String)
  213. GDVIRTUAL2(_parse_group, Object *, String)
  214. GDVIRTUAL7R(bool, _parse_property, Object *, Variant::Type, String, PropertyHint, String, BitField<PropertyUsageFlags>, bool)
  215. GDVIRTUAL1(_parse_end, Object *)
  216. #ifndef DISABLE_DEPRECATED
  217. void _add_property_editor_bind_compat_92322(const String &p_for_property, Control *p_prop, bool p_add_to_end);
  218. static void _bind_compatibility_methods();
  219. #endif // DISABLE_DEPRECATED
  220. public:
  221. void add_custom_control(Control *control);
  222. void add_property_editor(const String &p_for_property, Control *p_prop, bool p_add_to_end = false, const String &p_label = String());
  223. void add_property_editor_for_multiple_properties(const String &p_label, const Vector<String> &p_properties, Control *p_prop);
  224. virtual bool can_handle(Object *p_object);
  225. virtual void parse_begin(Object *p_object);
  226. virtual void parse_category(Object *p_object, const String &p_category);
  227. virtual void parse_group(Object *p_object, const String &p_group);
  228. virtual bool parse_property(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const BitField<PropertyUsageFlags> p_usage, const bool p_wide = false);
  229. virtual void parse_end(Object *p_object);
  230. };
  231. class EditorInspectorCategory : public Control {
  232. GDCLASS(EditorInspectorCategory, Control);
  233. friend class EditorInspector;
  234. // Right-click context menu options.
  235. enum ClassMenuOption {
  236. MENU_OPEN_DOCS,
  237. };
  238. Ref<Texture2D> icon;
  239. String label;
  240. String doc_class_name;
  241. PopupMenu *menu = nullptr;
  242. bool is_favorite = false;
  243. void _handle_menu_option(int p_option);
  244. protected:
  245. void _notification(int p_what);
  246. virtual void gui_input(const Ref<InputEvent> &p_event) override;
  247. public:
  248. void set_as_favorite(EditorInspector *p_for_inspector);
  249. virtual Size2 get_minimum_size() const override;
  250. virtual Control *make_custom_tooltip(const String &p_text) const override;
  251. };
  252. class EditorInspectorSection : public Container {
  253. GDCLASS(EditorInspectorSection, Container);
  254. String label;
  255. String section;
  256. bool vbox_added = false; // Optimization.
  257. Color bg_color;
  258. bool foldable = false;
  259. int indent_depth = 0;
  260. int level = 1;
  261. Timer *dropping_unfold_timer = nullptr;
  262. bool dropping_for_unfold = false;
  263. HashSet<StringName> revertable_properties;
  264. void _test_unfold();
  265. int _get_header_height();
  266. Ref<Texture2D> _get_arrow();
  267. protected:
  268. Object *object = nullptr;
  269. VBoxContainer *vbox = nullptr;
  270. void _notification(int p_what);
  271. static void _bind_methods();
  272. virtual void gui_input(const Ref<InputEvent> &p_event) override;
  273. public:
  274. virtual Size2 get_minimum_size() const override;
  275. void setup(const String &p_section, const String &p_label, Object *p_object, const Color &p_bg_color, bool p_foldable, int p_indent_depth = 0, int p_level = 1);
  276. String get_section() const;
  277. VBoxContainer *get_vbox();
  278. void unfold();
  279. void fold();
  280. void set_bg_color(const Color &p_bg_color);
  281. bool has_revertable_properties() const;
  282. void property_can_revert_changed(const String &p_path, bool p_can_revert);
  283. EditorInspectorSection();
  284. ~EditorInspectorSection();
  285. };
  286. class EditorInspectorArray : public EditorInspectorSection {
  287. GDCLASS(EditorInspectorArray, EditorInspectorSection);
  288. enum Mode {
  289. MODE_NONE,
  290. MODE_USE_COUNT_PROPERTY,
  291. MODE_USE_MOVE_ARRAY_ELEMENT_FUNCTION,
  292. } mode = MODE_NONE;
  293. StringName count_property;
  294. StringName array_element_prefix;
  295. String swap_method;
  296. int count = 0;
  297. VBoxContainer *elements_vbox = nullptr;
  298. Control *control_dropping = nullptr;
  299. bool dropping = false;
  300. Button *add_button = nullptr;
  301. AcceptDialog *resize_dialog = nullptr;
  302. SpinBox *new_size_spin_box = nullptr;
  303. // Pagination.
  304. int page_length = 5;
  305. int page = 0;
  306. int max_page = 0;
  307. int begin_array_index = 0;
  308. int end_array_index = 0;
  309. bool read_only = false;
  310. bool movable = true;
  311. bool is_const = false;
  312. bool numbered = false;
  313. enum MenuOptions {
  314. OPTION_MOVE_UP = 0,
  315. OPTION_MOVE_DOWN,
  316. OPTION_NEW_BEFORE,
  317. OPTION_NEW_AFTER,
  318. OPTION_REMOVE,
  319. OPTION_CLEAR_ARRAY,
  320. OPTION_RESIZE_ARRAY,
  321. };
  322. int popup_array_index_pressed = -1;
  323. PopupMenu *rmb_popup = nullptr;
  324. struct ArrayElement {
  325. PanelContainer *panel = nullptr;
  326. MarginContainer *margin = nullptr;
  327. HBoxContainer *hbox = nullptr;
  328. Button *move_up = nullptr;
  329. TextureRect *move_texture_rect = nullptr;
  330. Button *move_down = nullptr;
  331. Label *number = nullptr;
  332. VBoxContainer *vbox = nullptr;
  333. Button *erase = nullptr;
  334. };
  335. LocalVector<ArrayElement> array_elements;
  336. Ref<StyleBoxFlat> odd_style;
  337. Ref<StyleBoxFlat> even_style;
  338. int _get_array_count();
  339. void _add_button_pressed();
  340. void _paginator_page_changed(int p_page);
  341. void _rmb_popup_id_pressed(int p_id);
  342. void _control_dropping_draw();
  343. void _vbox_visibility_changed();
  344. void _panel_draw(int p_index);
  345. void _panel_gui_input(Ref<InputEvent> p_event, int p_index);
  346. void _move_element(int p_element_index, int p_to_pos);
  347. void _clear_array();
  348. void _resize_array(int p_size);
  349. Array _extract_properties_as_array(const List<PropertyInfo> &p_list);
  350. int _drop_position() const;
  351. void _new_size_spin_box_value_changed(float p_value);
  352. void _new_size_spin_box_text_submitted(const String &p_text);
  353. void _resize_dialog_confirmed();
  354. void _update_elements_visibility();
  355. void _setup();
  356. Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
  357. void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
  358. bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
  359. void _remove_item(int p_index);
  360. protected:
  361. void _notification(int p_what);
  362. static void _bind_methods();
  363. public:
  364. void setup_with_move_element_function(Object *p_object, const String &p_label, const StringName &p_array_element_prefix, int p_page, const Color &p_bg_color, bool p_foldable, bool p_movable = true, bool p_is_const = false, bool p_numbered = false, int p_page_length = 5, const String &p_add_item_text = "");
  365. void setup_with_count_property(Object *p_object, const String &p_label, const StringName &p_count_property, const StringName &p_array_element_prefix, int p_page, const Color &p_bg_color, bool p_foldable, bool p_movable = true, bool p_is_const = false, bool p_numbered = false, int p_page_length = 5, const String &p_add_item_text = "", const String &p_swap_method = "");
  366. VBoxContainer *get_vbox(int p_index);
  367. EditorInspectorArray(bool p_read_only);
  368. };
  369. class EditorPaginator : public HBoxContainer {
  370. GDCLASS(EditorPaginator, HBoxContainer);
  371. int page = 0;
  372. int max_page = 0;
  373. Button *first_page_button = nullptr;
  374. Button *prev_page_button = nullptr;
  375. LineEdit *page_line_edit = nullptr;
  376. Label *page_count_label = nullptr;
  377. Button *next_page_button = nullptr;
  378. Button *last_page_button = nullptr;
  379. void _first_page_button_pressed();
  380. void _prev_page_button_pressed();
  381. void _page_line_edit_text_submitted(const String &p_text);
  382. void _next_page_button_pressed();
  383. void _last_page_button_pressed();
  384. protected:
  385. void _notification(int p_what);
  386. static void _bind_methods();
  387. public:
  388. void update(int p_page, int p_max_page);
  389. EditorPaginator();
  390. };
  391. class EditorInspector : public ScrollContainer {
  392. GDCLASS(EditorInspector, ScrollContainer);
  393. friend class EditorInspectorCategory;
  394. friend class EditorPropertyResource;
  395. enum {
  396. MAX_PLUGINS = 1024
  397. };
  398. static Ref<EditorInspectorPlugin> inspector_plugins[MAX_PLUGINS];
  399. static int inspector_plugin_count;
  400. // Right-click context menu options.
  401. enum ClassMenuOption {
  402. MENU_UNFAVORITE_ALL,
  403. };
  404. bool can_favorite = false;
  405. PackedStringArray current_favorites;
  406. VBoxContainer *favorites_section = nullptr;
  407. EditorInspectorCategory *favorites_category = nullptr;
  408. VBoxContainer *favorites_vbox = nullptr;
  409. VBoxContainer *favorites_groups_vbox = nullptr;
  410. HSeparator *favorites_separator = nullptr;
  411. EditorInspector *root_inspector = nullptr;
  412. VBoxContainer *base_vbox = nullptr;
  413. VBoxContainer *begin_vbox = nullptr;
  414. VBoxContainer *main_vbox = nullptr;
  415. // Map used to cache the instantiated editors.
  416. HashMap<StringName, List<EditorProperty *>> editor_property_map;
  417. List<EditorInspectorSection *> sections;
  418. HashSet<StringName> pending;
  419. void _clear(bool p_hide_plugins = true);
  420. Object *object = nullptr;
  421. Object *next_object = nullptr;
  422. //
  423. LineEdit *search_box = nullptr;
  424. bool show_standard_categories = false;
  425. bool show_custom_categories = false;
  426. bool hide_script = true;
  427. bool hide_metadata = true;
  428. bool use_doc_hints = false;
  429. EditorPropertyNameProcessor::Style property_name_style = EditorPropertyNameProcessor::STYLE_CAPITALIZED;
  430. bool use_settings_name_style = true;
  431. bool use_filter = false;
  432. bool autoclear = false;
  433. bool use_folding = false;
  434. int changing;
  435. bool update_all_pending = false;
  436. bool read_only = false;
  437. bool keying = false;
  438. bool wide_editors = false;
  439. bool deletable_properties = false;
  440. float refresh_countdown;
  441. bool update_tree_pending = false;
  442. StringName _prop_edited;
  443. StringName property_selected;
  444. int property_focusable;
  445. int update_scroll_request;
  446. struct DocCacheInfo {
  447. String doc_path;
  448. String theme_item_name;
  449. };
  450. HashMap<StringName, HashMap<StringName, DocCacheInfo>> doc_cache;
  451. HashSet<StringName> restart_request_props;
  452. HashMap<String, String> custom_property_descriptions;
  453. HashMap<ObjectID, int> scroll_cache;
  454. String property_prefix; // Used for sectioned inspector.
  455. String object_class;
  456. Variant property_clipboard;
  457. bool restrict_to_basic = false;
  458. void _edit_set(const String &p_name, const Variant &p_value, bool p_refresh_all, const String &p_changed_field);
  459. void _property_changed(const String &p_path, const Variant &p_value, const String &p_name = "", bool p_changing = false, bool p_update_all = false);
  460. void _multiple_properties_changed(const Vector<String> &p_paths, const Array &p_values, bool p_changing = false);
  461. void _property_keyed(const String &p_path, bool p_advance);
  462. void _property_keyed_with_value(const String &p_path, const Variant &p_value, bool p_advance);
  463. void _property_deleted(const String &p_path);
  464. void _property_checked(const String &p_path, bool p_checked);
  465. void _property_pinned(const String &p_path, bool p_pinned);
  466. bool _property_path_matches(const String &p_property_path, const String &p_filter, EditorPropertyNameProcessor::Style p_style);
  467. bool _resource_properties_matches(const Ref<Resource> &p_resource, const String &p_filter);
  468. void _resource_selected(const String &p_path, Ref<Resource> p_resource);
  469. void _property_selected(const String &p_path, int p_focusable);
  470. void _object_id_selected(const String &p_path, ObjectID p_id);
  471. void _update_current_favorites();
  472. void _set_property_favorited(const String &p_path, bool p_favorited);
  473. void _clear_current_favorites();
  474. void _node_removed(Node *p_node);
  475. void _gui_focus_changed(Control *p_control);
  476. HashMap<StringName, int> per_array_page;
  477. void _page_change_request(int p_new_page, const StringName &p_array_prefix);
  478. void _changed_callback();
  479. void _edit_request_change(Object *p_object, const String &p_prop);
  480. void _keying_changed();
  481. void _parse_added_editors(VBoxContainer *current_vbox, EditorInspectorSection *p_section, Ref<EditorInspectorPlugin> ped);
  482. void _vscroll_changed(double);
  483. void _feature_profile_changed();
  484. bool _is_property_disabled_by_feature_profile(const StringName &p_property);
  485. AddMetadataDialog *add_meta_dialog = nullptr;
  486. LineEdit *add_meta_name = nullptr;
  487. OptionButton *add_meta_type = nullptr;
  488. EditorValidationPanel *validation_panel = nullptr;
  489. void _add_meta_confirm();
  490. void _show_add_meta_dialog();
  491. void _handle_menu_option(int p_option);
  492. protected:
  493. static void _bind_methods();
  494. void _notification(int p_what);
  495. public:
  496. static void add_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin);
  497. static void remove_inspector_plugin(const Ref<EditorInspectorPlugin> &p_plugin);
  498. static void cleanup_plugins();
  499. static Button *create_inspector_action_button(const String &p_text);
  500. static EditorProperty *instantiate_property_editor(Object *p_object, const Variant::Type p_type, const String &p_path, const PropertyHint p_hint, const String &p_hint_text, const uint32_t p_usage, const bool p_wide = false);
  501. bool is_main_editor_inspector() const;
  502. String get_selected_path() const;
  503. void update_tree();
  504. void update_property(const String &p_prop);
  505. void edit(Object *p_object);
  506. Object *get_edited_object();
  507. Object *get_next_edited_object();
  508. void set_keying(bool p_active);
  509. void set_read_only(bool p_read_only);
  510. EditorPropertyNameProcessor::Style get_property_name_style() const;
  511. void set_property_name_style(EditorPropertyNameProcessor::Style p_style);
  512. // If true, the inspector will update its property name style according to the current editor settings.
  513. void set_use_settings_name_style(bool p_enable);
  514. void set_autoclear(bool p_enable);
  515. void set_show_categories(bool p_show_standard, bool p_show_custom);
  516. void set_use_doc_hints(bool p_enable);
  517. void set_hide_script(bool p_hide);
  518. void set_hide_metadata(bool p_hide);
  519. void set_use_filter(bool p_use);
  520. void register_text_enter(Node *p_line_edit);
  521. void set_use_folding(bool p_use_folding, bool p_update_tree = true);
  522. bool is_using_folding();
  523. void collapse_all_folding();
  524. void expand_all_folding();
  525. void expand_revertable();
  526. void set_scroll_offset(int p_offset);
  527. int get_scroll_offset() const;
  528. void set_property_prefix(const String &p_prefix);
  529. String get_property_prefix() const;
  530. void add_custom_property_description(const String &p_class, const String &p_property, const String &p_description);
  531. String get_custom_property_description(const String &p_property) const;
  532. void set_object_class(const String &p_class);
  533. String get_object_class() const;
  534. void set_use_wide_editors(bool p_enable);
  535. void set_root_inspector(EditorInspector *p_root_inspector);
  536. EditorInspector *get_root_inspector() { return is_sub_inspector() ? root_inspector : this; }
  537. bool is_sub_inspector() const { return root_inspector != nullptr; }
  538. void set_use_deletable_properties(bool p_enabled);
  539. void set_restrict_to_basic_settings(bool p_restrict);
  540. void set_property_clipboard(const Variant &p_value);
  541. Variant get_property_clipboard() const;
  542. EditorInspector();
  543. };
  544. #endif // EDITOR_INSPECTOR_H