| 1 | /**************************************************************************/ |
| 2 | /* inspector_dock.cpp */ |
| 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 | |
| 31 | #include "inspector_dock.h" |
| 32 | |
| 33 | #include "editor/debugger/editor_debugger_inspector.h" |
| 34 | #include "editor/debugger/editor_debugger_node.h" |
| 35 | #include "editor/docks/filesystem_dock.h" |
| 36 | #include "editor/editor_main_screen.h" |
| 37 | #include "editor/editor_node.h" |
| 38 | #include "editor/editor_string_names.h" |
| 39 | #include "editor/editor_undo_redo_manager.h" |
| 40 | #include "editor/gui/editor_file_dialog.h" |
| 41 | #include "editor/gui/editor_object_selector.h" |
| 42 | #include "editor/script/script_editor_plugin.h" |
| 43 | #include "editor/settings/editor_command_palette.h" |
| 44 | #include "editor/settings/editor_settings.h" |
| 45 | #include "editor/themes/editor_scale.h" |
| 46 | #include "scene/gui/box_container.h" |
| 47 | |
| 48 | void InspectorDock::_prepare_menu() { |
| 49 | PopupMenu *menu = object_menu->get_popup(); |
| 50 | for (int i = EditorPropertyNameProcessor::STYLE_RAW; i <= EditorPropertyNameProcessor::STYLE_LOCALIZED; i++) { |
| 51 | menu->set_item_checked(menu->get_item_index(PROPERTY_NAME_STYLE_RAW + i), i == property_name_style); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | void InspectorDock::_menu_option(int p_option) { |
| 56 | _menu_option_confirm(p_option, false); |
| 57 | } |
| 58 | |
| 59 | void InspectorDock::_menu_confirm_current() { |
| 60 | _menu_option_confirm(current_option, true); |
| 61 | } |
| 62 | |
| 63 | void InspectorDock::_menu_option_confirm(int p_option, bool p_confirmed) { |
| 64 | if (!p_confirmed) { |
| 65 | current_option = p_option; |
| 66 | } |
| 67 | |
| 68 | switch (p_option) { |
| 69 | case EXPAND_ALL: { |
| 70 | _menu_expandall(); |
| 71 | } break; |
| 72 | case COLLAPSE_ALL: { |
| 73 | _menu_collapseall(); |
| 74 | } break; |
| 75 | case EXPAND_REVERTABLE: { |
| 76 | _menu_expand_revertable(); |
| 77 | } break; |
| 78 | |
| 79 | case RESOURCE_SAVE: { |
| 80 | _save_resource(false); |
| 81 | } break; |
| 82 | case RESOURCE_SAVE_AS: { |
| 83 | _save_resource(true); |
| 84 | } break; |
| 85 | |
| 86 | case RESOURCE_MAKE_BUILT_IN: { |
| 87 | _unref_resource(); |
| 88 | } break; |
| 89 | case RESOURCE_COPY: { |
| 90 | _copy_resource(); |
| 91 | } break; |
| 92 | case RESOURCE_EDIT_CLIPBOARD: { |
| 93 | _paste_resource(); |
| 94 | } break; |
| 95 | case RESOURCE_SHOW_IN_FILESYSTEM: { |
| 96 | Ref<Resource> current_res = _get_current_resource(); |
| 97 | ERR_FAIL_COND(current_res.is_null()); |
| 98 | FileSystemDock::get_singleton()->navigate_to_path(current_res->get_path()); |
| 99 | } break; |
| 100 | |
| 101 | case OBJECT_REQUEST_HELP: { |
| 102 | if (current) { |
| 103 | EditorNode::get_singleton()->get_editor_main_screen()->select(EditorMainScreen::EDITOR_SCRIPT); |
| 104 | emit_signal(SNAME("request_help"), current->get_class()); |
| 105 | } |
| 106 | } break; |
| 107 | |
| 108 | case OBJECT_COPY_PARAMS: { |
| 109 | editor_data->apply_changes_in_editors(); |
| 110 | if (current) { |
| 111 | editor_data->copy_object_params(current); |
| 112 | } |
| 113 | } break; |
| 114 | |
| 115 | case OBJECT_PASTE_PARAMS: { |
| 116 | editor_data->apply_changes_in_editors(); |
| 117 | if (current) { |
| 118 | editor_data->paste_object_params(current); |
| 119 | } |
| 120 | } break; |
| 121 | |
| 122 | case OBJECT_UNIQUE_RESOURCES: { |
| 123 | if (!p_confirmed) { |
| 124 | Vector<String> resource_propnames; |
| 125 | |
| 126 | if (current) { |
| 127 | List<PropertyInfo> props; |
| 128 | current->get_property_list(&props); |
| 129 | |
| 130 | for (const PropertyInfo &property : props) { |
| 131 | if (!(property.usage & PROPERTY_USAGE_STORAGE)) { |
| 132 | continue; |
| 133 | } |
| 134 | if (property.usage & PROPERTY_USAGE_NEVER_DUPLICATE) { |
| 135 | continue; |
| 136 | } |
| 137 | |
| 138 | Variant v = current->get(property.name); |
| 139 | Ref<RefCounted> ref = v; |
| 140 | Ref<Resource> res = ref; |
| 141 | if (v.is_ref_counted() && ref.is_valid() && res.is_valid()) { |
| 142 | // Valid resource which would be duplicated if action is confirmed. |
| 143 | resource_propnames.append(property.name); |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | unique_resources_list_tree->clear(); |
| 149 | if (resource_propnames.size()) { |
| 150 | const EditorPropertyNameProcessor::Style name_style = inspector->get_property_name_style(); |
| 151 | |
| 152 | TreeItem *root = unique_resources_list_tree->create_item(); |
| 153 | for (const String &E : resource_propnames) { |
| 154 | const String propname = EditorPropertyNameProcessor::get_singleton()->process_name(E, name_style); |
| 155 | |
| 156 | TreeItem *ti = unique_resources_list_tree->create_item(root); |
| 157 | ti->set_text(0, propname); |
| 158 | } |
| 159 | |
| 160 | unique_resources_label->set_text(TTRC("The following resources will be duplicated and embedded within this resource/object.")); |
| 161 | unique_resources_confirmation->popup_centered(); |
| 162 | } else { |
| 163 | current_option = -1; |
| 164 | EditorNode::get_singleton()->show_warning(TTR("This object has no resources to duplicate.")); |
| 165 | } |
| 166 | } else { |
| 167 | editor_data->apply_changes_in_editors(); |
| 168 | |
| 169 | if (current) { |
| 170 | List<PropertyInfo> props; |
| 171 | current->get_property_list(&props); |
| 172 | HashMap<Ref<Resource>, Ref<Resource>> duplicates; |
| 173 | for (const PropertyInfo &prop_info : props) { |
| 174 | if (!(prop_info.usage & PROPERTY_USAGE_STORAGE)) { |
| 175 | continue; |
| 176 | } |
| 177 | |
| 178 | Variant v = current->get(prop_info.name); |
| 179 | if (v.is_ref_counted()) { |
| 180 | Ref<RefCounted> ref = v; |
| 181 | if (ref.is_valid()) { |
| 182 | Ref<Resource> res = ref; |
| 183 | if (res.is_valid()) { |
| 184 | if (!duplicates.has(res)) { |
| 185 | duplicates[res] = res->duplicate(); |
| 186 | } |
| 187 | res = duplicates[res]; |
| 188 | |
| 189 | current->set(prop_info.name, res); |
| 190 | get_inspector_singleton()->update_property(prop_info.name); |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | int history_id = EditorUndoRedoManager::get_singleton()->get_history_id_for_object(current); |
| 198 | EditorUndoRedoManager::get_singleton()->clear_history(history_id); |
| 199 | |
| 200 | EditorNode::get_singleton()->edit_item(current, inspector); |
| 201 | } |
| 202 | |
| 203 | } break; |
| 204 | |
| 205 | case PROPERTY_NAME_STYLE_RAW: |
| 206 | case PROPERTY_NAME_STYLE_CAPITALIZED: |
| 207 | case PROPERTY_NAME_STYLE_LOCALIZED: { |
| 208 | property_name_style = (EditorPropertyNameProcessor::Style)(p_option - PROPERTY_NAME_STYLE_RAW); |
| 209 | inspector->set_property_name_style(property_name_style); |
| 210 | } break; |
| 211 | |
| 212 | default: { |
| 213 | if (p_option >= OBJECT_METHOD_BASE) { |
| 214 | ERR_FAIL_NULL(current); |
| 215 | |
| 216 | int idx = p_option - OBJECT_METHOD_BASE; |
| 217 | |
| 218 | List<MethodInfo> methods; |
| 219 | current->get_method_list(&methods); |
| 220 | |
| 221 | ERR_FAIL_INDEX(idx, methods.size()); |
| 222 | String name = methods.get(idx).name; |
| 223 | |
| 224 | current->call(name); |
| 225 | } |
| 226 | } |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | void InspectorDock::_new_resource() { |
| 231 | new_resource_dialog->popup_create(true); |
| 232 | } |
| 233 | |
| 234 | void InspectorDock::_load_resource(const String &p_type) { |
| 235 | load_resource_dialog->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); |
| 236 | |
| 237 | List<String> extensions; |
| 238 | ResourceLoader::get_recognized_extensions_for_type(p_type, &extensions); |
| 239 | |
| 240 | load_resource_dialog->clear_filters(); |
| 241 | for (const String &extension : extensions) { |
| 242 | load_resource_dialog->add_filter("*." + extension, extension.to_upper()); |
| 243 | } |
| 244 | |
| 245 | const Vector<String> textfile_ext = ((String)(EDITOR_GET("docks/filesystem/textfile_extensions"))).split(",", false); |
| 246 | for (int i = 0; i < textfile_ext.size(); i++) { |
| 247 | load_resource_dialog->add_filter("*." + textfile_ext[i], textfile_ext[i].to_upper()); |
| 248 | } |
| 249 | |
| 250 | load_resource_dialog->popup_file_dialog(); |
| 251 | } |
| 252 | |
| 253 | void InspectorDock::_resource_file_selected(const String &p_file) { |
| 254 | Ref<Resource> res; |
| 255 | if (ResourceLoader::exists(p_file, "")) { |
| 256 | res = ResourceLoader::load(p_file); |
| 257 | } else { |
| 258 | const Vector<String> textfile_ext = ((String)(EDITOR_GET("docks/filesystem/textfile_extensions"))).split(",", false); |
| 259 | if (textfile_ext.has(p_file.get_extension())) { |
| 260 | res = ScriptEditor::get_singleton()->open_file(p_file); |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | if (res.is_null()) { |
| 265 | info_dialog->set_text(TTRC("Failed to load resource.")); |
| 266 | return; |
| 267 | }; |
| 268 | |
| 269 | EditorNode::get_singleton()->push_item(res.operator->()); |
| 270 | } |
| 271 | |
| 272 | void InspectorDock::_save_resource(bool save_as) { |
| 273 | Ref<Resource> current_res = _get_current_resource(); |
| 274 | ERR_FAIL_COND(current_res.is_null()); |
| 275 | |
| 276 | if (save_as) { |
| 277 | EditorNode::get_singleton()->save_resource_as(current_res); |
| 278 | } else { |
| 279 | EditorNode::get_singleton()->save_resource(current_res); |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | void InspectorDock::_unref_resource() { |
| 284 | Ref<Resource> current_res = _get_current_resource(); |
| 285 | ERR_FAIL_COND(current_res.is_null()); |
| 286 | current_res->set_path(""); |
| 287 | EditorNode::get_singleton()->edit_current(); |
| 288 | } |
| 289 | |
| 290 | void InspectorDock::_copy_resource() { |
| 291 | Ref<Resource> current_res = _get_current_resource(); |
| 292 | ERR_FAIL_COND(current_res.is_null()); |
| 293 | EditorSettings::get_singleton()->set_resource_clipboard(current_res); |
| 294 | } |
| 295 | |
| 296 | void InspectorDock::_paste_resource() { |
| 297 | Ref<Resource> r = EditorSettings::get_singleton()->get_resource_clipboard(); |
| 298 | if (r.is_valid()) { |
| 299 | EditorNode::get_singleton()->push_item(EditorSettings::get_singleton()->get_resource_clipboard().ptr(), String()); |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | void InspectorDock::_prepare_resource_extra_popup() { |
| 304 | Ref<Resource> r = EditorSettings::get_singleton()->get_resource_clipboard(); |
| 305 | PopupMenu *popup = resource_extra_button->get_popup(); |
| 306 | popup->set_item_disabled(popup->get_item_index(RESOURCE_EDIT_CLIPBOARD), r.is_null()); |
| 307 | |
| 308 | Ref<Resource> current_res = _get_current_resource(); |
| 309 | popup->set_item_disabled(popup->get_item_index(RESOURCE_SHOW_IN_FILESYSTEM), current_res.is_null() || current_res->is_built_in()); |
| 310 | } |
| 311 | |
| 312 | Ref<Resource> InspectorDock::_get_current_resource() const { |
| 313 | ObjectID current_id = EditorNode::get_singleton()->get_editor_selection_history()->get_current(); |
| 314 | Object *current_obj = current_id.is_valid() ? ObjectDB::get_instance(current_id) : nullptr; |
| 315 | return Ref<Resource>(Object::cast_to<Resource>(current_obj)); |
| 316 | } |
| 317 | |
| 318 | void InspectorDock::_prepare_history() { |
| 319 | EditorSelectionHistory *editor_history = EditorNode::get_singleton()->get_editor_selection_history(); |
| 320 | editor_history->cleanup_history(); |
| 321 | |
| 322 | int history_to = MAX(0, editor_history->get_history_len() - 25); |
| 323 | |
| 324 | history_menu->get_popup()->clear(); |
| 325 | |
| 326 | HashSet<ObjectID> already; |
| 327 | for (int i = editor_history->get_history_len() - 1; i >= history_to; i--) { |
| 328 | ObjectID id = editor_history->get_history_obj(i); |
| 329 | Object *obj = ObjectDB::get_instance(id); |
| 330 | if (!obj || already.has(id)) { |
| 331 | if (history_to > 0) { |
| 332 | history_to--; |
| 333 | } |
| 334 | continue; |
| 335 | } |
| 336 | |
| 337 | already.insert(id); |
| 338 | |
| 339 | Ref<Texture2D> icon = EditorNode::get_singleton()->get_object_icon(obj); |
| 340 | |
| 341 | String text; |
| 342 | if (obj->has_method("_get_editor_name")) { |
| 343 | text = obj->call("_get_editor_name"); |
| 344 | } else if (Object::cast_to<Resource>(obj)) { |
| 345 | Resource *r = Object::cast_to<Resource>(obj); |
| 346 | if (r->get_path().is_resource_file()) { |
| 347 | text = r->get_path().get_file(); |
| 348 | } else if (!r->get_name().is_empty()) { |
| 349 | text = r->get_name(); |
| 350 | } else { |
| 351 | text = r->get_class(); |
| 352 | } |
| 353 | } else if (Object::cast_to<Node>(obj)) { |
| 354 | text = Object::cast_to<Node>(obj)->get_name(); |
| 355 | } else if (obj->is_class("EditorDebuggerRemoteObjects")) { |
| 356 | text = obj->call("get_title"); |
| 357 | } else { |
| 358 | text = obj->get_class(); |
| 359 | } |
| 360 | |
| 361 | if (i == editor_history->get_history_pos() && current) { |
| 362 | text += " " + TTR("(Current)"); |
| 363 | } |
| 364 | history_menu->get_popup()->add_icon_item(icon, text, i); |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | void InspectorDock::_select_history(int p_idx) { |
| 369 | // Push it to the top, it is not correct, but it's more useful. |
| 370 | ObjectID id = EditorNode::get_singleton()->get_editor_selection_history()->get_history_obj(p_idx); |
| 371 | Object *obj = ObjectDB::get_instance(id); |
| 372 | if (!obj) { |
| 373 | return; |
| 374 | } |
| 375 | EditorNode::get_singleton()->push_item(obj); |
| 376 | |
| 377 | if (const EditorDebuggerRemoteObjects *robjs = Object::cast_to<EditorDebuggerRemoteObjects>(obj)) { |
| 378 | EditorDebuggerNode::get_singleton()->set_remote_selection(robjs->remote_object_ids.duplicate()); |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | void InspectorDock::_resource_created() { |
| 383 | Variant c = new_resource_dialog->instantiate_selected(); |
| 384 | |
| 385 | ERR_FAIL_COND(!c); |
| 386 | Resource *r = Object::cast_to<Resource>(c); |
| 387 | ERR_FAIL_NULL(r); |
| 388 | |
| 389 | EditorNode::get_singleton()->push_item(r); |
| 390 | } |
| 391 | |
| 392 | void InspectorDock::_resource_selected(const Ref<Resource> &p_res, const String &p_property) { |
| 393 | if (p_res.is_null()) { |
| 394 | return; |
| 395 | } |
| 396 | |
| 397 | Ref<Resource> r = p_res; |
| 398 | EditorNode::get_singleton()->push_item(r.operator->(), p_property); |
| 399 | } |
| 400 | |
| 401 | void InspectorDock::_files_moved(const String &p_old_file, const String &p_new_file) { |
| 402 | // Because only the file name is shown, we care about changes on the file name. |
| 403 | if (p_old_file.get_file() == p_new_file.get_file()) { |
| 404 | return; |
| 405 | } |
| 406 | |
| 407 | ObjectID current_id = EditorNode::get_singleton()->get_editor_selection_history()->get_current(); |
| 408 | Ref<Resource> res(current_id.is_valid() ? ObjectDB::get_instance(current_id) : nullptr); |
| 409 | // We only care about updating the path if the current object is the one being renamed. |
| 410 | if (res.is_valid() && p_old_file == res->get_path()) { |
| 411 | res->set_path(p_new_file); |
| 412 | object_selector->update_path(); |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | void InspectorDock::_edit_forward() { |
| 417 | if (EditorNode::get_singleton()->get_editor_selection_history()->next()) { |
| 418 | EditorNode::get_singleton()->edit_current(); |
| 419 | |
| 420 | if (const EditorDebuggerRemoteObjects *robjs = Object::cast_to<EditorDebuggerRemoteObjects>(current)) { |
| 421 | EditorDebuggerNode::get_singleton()->set_remote_selection(robjs->remote_object_ids.duplicate()); |
| 422 | } |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | void InspectorDock::_edit_back() { |
| 427 | EditorSelectionHistory *editor_history = EditorNode::get_singleton()->get_editor_selection_history(); |
| 428 | if ((current && editor_history->previous()) || editor_history->get_path_size() == 1) { |
| 429 | EditorNode::get_singleton()->edit_current(); |
| 430 | |
| 431 | if (const EditorDebuggerRemoteObjects *robjs = Object::cast_to<EditorDebuggerRemoteObjects>(current)) { |
| 432 | EditorDebuggerNode::get_singleton()->set_remote_selection(robjs->remote_object_ids.duplicate()); |
| 433 | } |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | void InspectorDock::_menu_collapseall() { |
| 438 | inspector->collapse_all_folding(); |
| 439 | } |
| 440 | |
| 441 | void InspectorDock::_menu_expandall() { |
| 442 | inspector->expand_all_folding(); |
| 443 | } |
| 444 | |
| 445 | void InspectorDock::_menu_expand_revertable() { |
| 446 | inspector->expand_revertable(); |
| 447 | } |
| 448 | |
| 449 | void InspectorDock::_info_pressed() { |
| 450 | info_dialog->popup_centered(); |
| 451 | } |
| 452 | |
| 453 | Container *InspectorDock::get_addon_area() { |
| 454 | return this; |
| 455 | } |
| 456 | |
| 457 | void InspectorDock::_notification(int p_what) { |
| 458 | switch (p_what) { |
| 459 | case NOTIFICATION_TRANSLATION_CHANGED: { |
| 460 | update(current); |
| 461 | [[fallthrough]]; |
| 462 | } |
| 463 | case NOTIFICATION_THEME_CHANGED: |
| 464 | case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: { |
| 465 | resource_new_button->set_button_icon(get_editor_theme_icon(SNAME("New"))); |
| 466 | resource_load_button->set_button_icon(get_editor_theme_icon(SNAME("Load"))); |
| 467 | resource_save_button->set_button_icon(get_editor_theme_icon(SNAME("Save"))); |
| 468 | resource_extra_button->set_button_icon(get_editor_theme_icon(SNAME("GuiTabMenuHl"))); |
| 469 | open_docs_button->set_button_icon(get_editor_theme_icon(SNAME("HelpSearch"))); |
| 470 | |
| 471 | PopupMenu *resource_extra_popup = resource_extra_button->get_popup(); |
| 472 | resource_extra_popup->set_item_icon(resource_extra_popup->get_item_index(RESOURCE_EDIT_CLIPBOARD), get_editor_theme_icon(SNAME("ActionPaste"))); |
| 473 | resource_extra_popup->set_item_icon(resource_extra_popup->get_item_index(RESOURCE_COPY), get_editor_theme_icon(SNAME("ActionCopy"))); |
| 474 | resource_extra_popup->set_item_icon(resource_extra_popup->get_item_index(RESOURCE_SHOW_IN_FILESYSTEM), get_editor_theme_icon(SNAME("ShowInFileSystem"))); |
| 475 | |
| 476 | if (is_layout_rtl()) { |
| 477 | backward_button->set_button_icon(get_editor_theme_icon(SNAME("Forward"))); |
| 478 | forward_button->set_button_icon(get_editor_theme_icon(SNAME("Back"))); |
| 479 | } else { |
| 480 | backward_button->set_button_icon(get_editor_theme_icon(SNAME("Back"))); |
| 481 | forward_button->set_button_icon(get_editor_theme_icon(SNAME("Forward"))); |
| 482 | } |
| 483 | |
| 484 | const int icon_width = get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor)); |
| 485 | history_menu->get_popup()->add_theme_constant_override("icon_max_width", icon_width); |
| 486 | |
| 487 | history_menu->set_button_icon(get_editor_theme_icon(SNAME("History"))); |
| 488 | object_menu->set_button_icon(get_editor_theme_icon(SNAME("Tools"))); |
| 489 | search->set_right_icon(get_editor_theme_icon(SNAME("Search"))); |
| 490 | if (info_is_warning) { |
| 491 | info->set_button_icon(get_editor_theme_icon(SNAME("NodeWarning"))); |
| 492 | info->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("warning_color"), EditorStringName(Editor))); |
| 493 | } else { |
| 494 | info->set_button_icon(get_editor_theme_icon(SNAME("NodeInfo"))); |
| 495 | info->add_theme_color_override(SceneStringName(font_color), get_theme_color(SceneStringName(font_color), EditorStringName(Editor))); |
| 496 | } |
| 497 | } break; |
| 498 | |
| 499 | case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { |
| 500 | if (EditorSettings::get_singleton()->check_changed_settings_in_group("interface/inspector")) { |
| 501 | property_name_style = EditorPropertyNameProcessor::get_default_inspector_style(); |
| 502 | inspector->set_property_name_style(property_name_style); |
| 503 | |
| 504 | bool disable_folding = EDITOR_GET("interface/inspector/disable_folding"); |
| 505 | inspector->set_use_folding(!disable_folding); |
| 506 | } |
| 507 | } break; |
| 508 | } |
| 509 | } |
| 510 | |
| 511 | void InspectorDock::_bind_methods() { |
| 512 | ClassDB::bind_method("store_script_properties", &InspectorDock::store_script_properties); |
| 513 | ClassDB::bind_method("apply_script_properties", &InspectorDock::apply_script_properties); |
| 514 | |
| 515 | ADD_SIGNAL(MethodInfo("request_help")); |
| 516 | } |
| 517 | |
| 518 | void InspectorDock::edit_resource(const Ref<Resource> &p_resource) { |
| 519 | _resource_selected(p_resource, ""); |
| 520 | } |
| 521 | |
| 522 | void InspectorDock::open_resource(const String &p_type) { |
| 523 | _load_resource(p_type); |
| 524 | } |
| 525 | |
| 526 | void InspectorDock::set_info(const String &p_button_text, const String &p_message, bool p_is_warning) { |
| 527 | info->hide(); |
| 528 | info_is_warning = p_is_warning; |
| 529 | |
| 530 | if (info_is_warning) { |
| 531 | info->set_button_icon(get_editor_theme_icon(SNAME("NodeWarning"))); |
| 532 | info->add_theme_color_override(SceneStringName(font_color), get_theme_color(SNAME("warning_color"), EditorStringName(Editor))); |
| 533 | } else { |
| 534 | info->set_button_icon(get_editor_theme_icon(SNAME("NodeInfo"))); |
| 535 | info->add_theme_color_override(SceneStringName(font_color), get_theme_color(SceneStringName(font_color), EditorStringName(Editor))); |
| 536 | } |
| 537 | |
| 538 | if (!p_button_text.is_empty() && !p_message.is_empty()) { |
| 539 | info->show(); |
| 540 | info->set_text(p_button_text); |
| 541 | info_dialog->set_text(p_message); |
| 542 | } |
| 543 | } |
| 544 | |
| 545 | void InspectorDock::clear() { |
| 546 | } |
| 547 | |
| 548 | void InspectorDock::update(Object *p_object) { |
| 549 | EditorSelectionHistory *editor_history = EditorNode::get_singleton()->get_editor_selection_history(); |
| 550 | |
| 551 | backward_button->set_disabled(editor_history->is_at_beginning()); |
| 552 | forward_button->set_disabled(editor_history->is_at_end()); |
| 553 | |
| 554 | history_menu->set_disabled(true); |
| 555 | if (editor_history->get_history_len() > 0) { |
| 556 | history_menu->set_disabled(false); |
| 557 | } |
| 558 | object_selector->update_path(); |
| 559 | |
| 560 | current = p_object; |
| 561 | |
| 562 | const bool is_object = p_object != nullptr; |
| 563 | const bool is_resource = is_object && p_object->is_class("Resource"); |
| 564 | const bool is_text_file = is_object && p_object->is_class("TextFile"); |
| 565 | const bool is_node = is_object && p_object->is_class("Node"); |
| 566 | |
| 567 | object_menu->set_disabled(!is_object || is_text_file); |
| 568 | search->set_editable(is_object && !is_text_file); |
| 569 | resource_save_button->set_disabled(!is_resource || is_text_file); |
| 570 | open_docs_button->set_disabled(is_text_file || (!is_resource && !is_node)); |
| 571 | |
| 572 | PopupMenu *resource_extra_popup = resource_extra_button->get_popup(); |
| 573 | resource_extra_popup->set_item_disabled(resource_extra_popup->get_item_index(RESOURCE_COPY), !is_resource || is_text_file); |
| 574 | resource_extra_popup->set_item_disabled(resource_extra_popup->get_item_index(RESOURCE_MAKE_BUILT_IN), !is_resource || is_text_file); |
| 575 | |
| 576 | if (!is_object || is_text_file) { |
| 577 | info->hide(); |
| 578 | object_selector->clear_path(); |
| 579 | return; |
| 580 | } |
| 581 | |
| 582 | object_selector->enable_path(); |
| 583 | |
| 584 | PopupMenu *p = object_menu->get_popup(); |
| 585 | |
| 586 | p->clear(); |
| 587 | p->add_icon_shortcut(get_editor_theme_icon(SNAME("GuiTreeArrowDown")), ED_SHORTCUT("property_editor/expand_all", TTRC("Expand All")), EXPAND_ALL); |
| 588 | p->add_icon_shortcut(get_editor_theme_icon(SNAME("GuiTreeArrowRight")), ED_SHORTCUT("property_editor/collapse_all", TTRC("Collapse All")), COLLAPSE_ALL); |
| 589 | // Calling it 'revertable' internally, because that's what the implementation is based on, but labeling it as 'non-default' because that's more user friendly, even if not 100% accurate. |
| 590 | p->add_shortcut(ED_SHORTCUT("property_editor/expand_revertable", TTRC("Expand Non-Default")), EXPAND_REVERTABLE); |
| 591 | |
| 592 | p->add_separator(TTRC("Property Name Style")); |
| 593 | p->add_radio_check_item(vformat(TTR("Raw (e.g. \"%s\")"), "z_index"), PROPERTY_NAME_STYLE_RAW); |
| 594 | p->add_radio_check_item(vformat(TTR("Capitalized (e.g. \"%s\")"), "Z Index"), PROPERTY_NAME_STYLE_CAPITALIZED); |
| 595 | // TRANSLATORS: "Z Index" should match the existing translated CanvasItem property name in the current language you're working on. |
| 596 | p->add_radio_check_item(TTR("Localized (e.g. \"Z Index\")"), PROPERTY_NAME_STYLE_LOCALIZED); |
| 597 | |
| 598 | if (!EditorPropertyNameProcessor::is_localization_available()) { |
| 599 | const int index = p->get_item_index(PROPERTY_NAME_STYLE_LOCALIZED); |
| 600 | p->set_item_disabled(index, true); |
| 601 | p->set_item_tooltip(index, TTRC("Localization not available for current language.")); |
| 602 | } |
| 603 | |
| 604 | p->add_separator(); |
| 605 | p->add_shortcut(ED_SHORTCUT("property_editor/copy_params", TTRC("Copy Properties")), OBJECT_COPY_PARAMS); |
| 606 | p->add_shortcut(ED_SHORTCUT("property_editor/paste_params", TTRC("Paste Properties")), OBJECT_PASTE_PARAMS); |
| 607 | |
| 608 | if (is_resource || is_node) { |
| 609 | p->add_separator(); |
| 610 | p->add_shortcut(ED_SHORTCUT("property_editor/make_subresources_unique", TTRC("Make Sub-Resources Unique")), OBJECT_UNIQUE_RESOURCES); |
| 611 | } |
| 612 | |
| 613 | List<MethodInfo> methods; |
| 614 | p_object->get_method_list(&methods); |
| 615 | |
| 616 | if (!methods.is_empty()) { |
| 617 | bool found = false; |
| 618 | List<MethodInfo>::Element *I = methods.front(); |
| 619 | int i = 0; |
| 620 | while (I) { |
| 621 | if (I->get().flags & METHOD_FLAG_EDITOR) { |
| 622 | if (!found) { |
| 623 | p->add_separator(); |
| 624 | found = true; |
| 625 | } |
| 626 | p->add_item(I->get().name.capitalize(), OBJECT_METHOD_BASE + i); |
| 627 | } |
| 628 | i++; |
| 629 | I = I->next(); |
| 630 | } |
| 631 | } |
| 632 | } |
| 633 | |
| 634 | void InspectorDock::go_back() { |
| 635 | _edit_back(); |
| 636 | } |
| 637 | |
| 638 | EditorPropertyNameProcessor::Style InspectorDock::get_property_name_style() const { |
| 639 | return property_name_style; |
| 640 | } |
| 641 | |
| 642 | void InspectorDock::store_script_properties(Object *p_object) { |
| 643 | ERR_FAIL_NULL(p_object); |
| 644 | ScriptInstance *si = p_object->get_script_instance(); |
| 645 | if (!si) { |
| 646 | return; |
| 647 | } |
| 648 | si->get_property_state(stored_properties); |
| 649 | } |
| 650 | |
| 651 | void InspectorDock::apply_script_properties(Object *p_object) { |
| 652 | ERR_FAIL_NULL(p_object); |
| 653 | ScriptInstance *si = p_object->get_script_instance(); |
| 654 | if (!si) { |
| 655 | return; |
| 656 | } |
| 657 | |
| 658 | List<PropertyInfo> properties; |
| 659 | si->get_property_list(&properties); |
| 660 | |
| 661 | for (const Pair<StringName, Variant> &E : stored_properties) { |
| 662 | Variant current_prop; |
| 663 | if (si->get(E.first, current_prop) && current_prop.get_type() == E.second.get_type()) { |
| 664 | si->set(E.first, E.second); |
| 665 | } else if (E.second.get_type() == Variant::OBJECT) { |
| 666 | for (const PropertyInfo &pi : properties) { |
| 667 | if (E.first != pi.name) { |
| 668 | continue; |
| 669 | } |
| 670 | |
| 671 | if (pi.type != Variant::OBJECT) { |
| 672 | break; |
| 673 | } |
| 674 | |
| 675 | Object *p_property_object = E.second; |
| 676 | |
| 677 | if (p_property_object->is_class(pi.hint_string)) { |
| 678 | si->set(E.first, E.second); |
| 679 | break; |
| 680 | } |
| 681 | |
| 682 | Ref<Script> base_script = p_property_object->get_script(); |
| 683 | while (base_script.is_valid()) { |
| 684 | if (base_script->get_global_name() == pi.hint_string) { |
| 685 | si->set(E.first, E.second); |
| 686 | break; |
| 687 | } |
| 688 | base_script = base_script->get_base_script(); |
| 689 | } |
| 690 | break; |
| 691 | } |
| 692 | } |
| 693 | } |
| 694 | stored_properties.clear(); |
| 695 | } |
| 696 | |
| 697 | void InspectorDock::shortcut_input(const Ref<InputEvent> &p_event) { |
| 698 | ERR_FAIL_COND(p_event.is_null()); |
| 699 | |
| 700 | Ref<InputEventKey> key = p_event; |
| 701 | |
| 702 | if (key.is_null() || !key->is_pressed() || key->is_echo()) { |
| 703 | return; |
| 704 | } |
| 705 | |
| 706 | if (!is_visible() || !inspector->get_rect().has_point(inspector->get_local_mouse_position())) { |
| 707 | return; |
| 708 | } |
| 709 | |
| 710 | if (ED_IS_SHORTCUT("editor/open_search", p_event)) { |
| 711 | search->grab_focus(); |
| 712 | search->select_all(); |
| 713 | accept_event(); |
| 714 | } |
| 715 | } |
| 716 | |
| 717 | InspectorDock::InspectorDock(EditorData &p_editor_data) { |
| 718 | singleton = this; |
| 719 | set_name(TTRC("Inspector")); |
| 720 | set_icon_name("AnimationTrackList"); |
| 721 | set_dock_shortcut(ED_SHORTCUT_AND_COMMAND("docks/open_inspector", TTRC("Open Inspector Dock"))); |
| 722 | set_default_slot(EditorDock::DOCK_SLOT_RIGHT_UL); |
| 723 | |
| 724 | VBoxContainer *main_vb = memnew(VBoxContainer); |
| 725 | add_child(main_vb); |
| 726 | |
| 727 | editor_data = &p_editor_data; |
| 728 | |
| 729 | property_name_style = EditorPropertyNameProcessor::get_default_inspector_style(); |
| 730 | |
| 731 | HBoxContainer *general_options_hb = memnew(HBoxContainer); |
| 732 | main_vb->add_child(general_options_hb); |
| 733 | |
| 734 | resource_new_button = memnew(Button); |
| 735 | resource_new_button->set_theme_type_variation("FlatMenuButton"); |
| 736 | resource_new_button->set_tooltip_text(TTRC("Create a new resource in memory and edit it.")); |
| 737 | general_options_hb->add_child(resource_new_button); |
| 738 | resource_new_button->connect(SceneStringName(pressed), callable_mp(this, &InspectorDock::_new_resource)); |
| 739 | resource_new_button->set_focus_mode(Control::FOCUS_ACCESSIBILITY); |
| 740 | |
| 741 | resource_load_button = memnew(Button); |
| 742 | resource_load_button->set_theme_type_variation("FlatMenuButton"); |
| 743 | resource_load_button->set_tooltip_text(TTRC("Load an existing resource from disk and edit it.")); |
| 744 | general_options_hb->add_child(resource_load_button); |
| 745 | resource_load_button->connect(SceneStringName(pressed), callable_mp(this, &InspectorDock::_open_resource_selector)); |
| 746 | resource_load_button->set_focus_mode(Control::FOCUS_ACCESSIBILITY); |
| 747 | |
| 748 | resource_save_button = memnew(MenuButton); |
| 749 | resource_save_button->set_flat(false); |
| 750 | resource_save_button->set_theme_type_variation("FlatMenuButton"); |
| 751 | resource_save_button->set_tooltip_text(TTRC("Save the currently edited resource.")); |
| 752 | general_options_hb->add_child(resource_save_button); |
| 753 | resource_save_button->get_popup()->add_item(TTRC("Save"), RESOURCE_SAVE); |
| 754 | resource_save_button->get_popup()->add_item(TTRC("Save As..."), RESOURCE_SAVE_AS); |
| 755 | resource_save_button->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &InspectorDock::_menu_option)); |
| 756 | resource_save_button->set_focus_mode(Control::FOCUS_ACCESSIBILITY); |
| 757 | resource_save_button->set_disabled(true); |
| 758 | |
| 759 | resource_extra_button = memnew(MenuButton); |
| 760 | resource_extra_button->set_flat(false); |
| 761 | resource_extra_button->set_theme_type_variation("FlatMenuButton"); |
| 762 | resource_extra_button->set_tooltip_text(TTRC("Extra resource options.")); |
| 763 | general_options_hb->add_child(resource_extra_button); |
| 764 | resource_extra_button->connect("about_to_popup", callable_mp(this, &InspectorDock::_prepare_resource_extra_popup)); |
| 765 | resource_extra_button->get_popup()->add_shortcut(ED_SHORTCUT("property_editor/paste_resource", TTRC("Edit Resource from Clipboard")), RESOURCE_EDIT_CLIPBOARD); |
| 766 | resource_extra_button->get_popup()->add_shortcut(ED_SHORTCUT("property_editor/copy_resource", TTRC("Copy Resource")), RESOURCE_COPY); |
| 767 | resource_extra_button->get_popup()->set_item_disabled(1, true); |
| 768 | resource_extra_button->get_popup()->add_separator(); |
| 769 | resource_extra_button->get_popup()->add_shortcut(ED_SHORTCUT("property_editor/show_in_filesystem", TTRC("Show in FileSystem")), RESOURCE_SHOW_IN_FILESYSTEM); |
| 770 | resource_extra_button->get_popup()->add_shortcut(ED_SHORTCUT("property_editor/unref_resource", TTRC("Make Resource Built-In")), RESOURCE_MAKE_BUILT_IN); |
| 771 | resource_extra_button->get_popup()->set_item_disabled(3, true); |
| 772 | resource_extra_button->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &InspectorDock::_menu_option)); |
| 773 | |
| 774 | general_options_hb->add_spacer(); |
| 775 | |
| 776 | backward_button = memnew(Button); |
| 777 | backward_button->set_theme_type_variation(SceneStringName(FlatButton)); |
| 778 | general_options_hb->add_child(backward_button); |
| 779 | backward_button->set_tooltip_text(TTRC("Go to previous edited object in history.")); |
| 780 | backward_button->set_disabled(true); |
| 781 | backward_button->connect(SceneStringName(pressed), callable_mp(this, &InspectorDock::_edit_back)); |
| 782 | |
| 783 | forward_button = memnew(Button); |
| 784 | forward_button->set_theme_type_variation(SceneStringName(FlatButton)); |
| 785 | general_options_hb->add_child(forward_button); |
| 786 | forward_button->set_tooltip_text(TTRC("Go to next edited object in history.")); |
| 787 | forward_button->set_disabled(true); |
| 788 | forward_button->connect(SceneStringName(pressed), callable_mp(this, &InspectorDock::_edit_forward)); |
| 789 | |
| 790 | history_menu = memnew(MenuButton); |
| 791 | history_menu->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); |
| 792 | history_menu->set_flat(false); |
| 793 | history_menu->set_theme_type_variation("FlatMenuButton"); |
| 794 | history_menu->set_tooltip_text(TTRC("History of recently edited objects.")); |
| 795 | general_options_hb->add_child(history_menu); |
| 796 | history_menu->connect("about_to_popup", callable_mp(this, &InspectorDock::_prepare_history)); |
| 797 | history_menu->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &InspectorDock::_select_history)); |
| 798 | |
| 799 | HBoxContainer *subresource_hb = memnew(HBoxContainer); |
| 800 | main_vb->add_child(subresource_hb); |
| 801 | object_selector = memnew(EditorObjectSelector(EditorNode::get_singleton()->get_editor_selection_history())); |
| 802 | object_selector->set_h_size_flags(Control::SIZE_EXPAND_FILL); |
| 803 | subresource_hb->add_child(object_selector); |
| 804 | |
| 805 | open_docs_button = memnew(Button); |
| 806 | open_docs_button->set_theme_type_variation("FlatMenuButton"); |
| 807 | open_docs_button->set_disabled(true); |
| 808 | open_docs_button->set_tooltip_text(TTRC("Open documentation for this object.")); |
| 809 | open_docs_button->set_shortcut(ED_SHORTCUT("property_editor/open_help", TTRC("Open Documentation"))); |
| 810 | subresource_hb->add_child(open_docs_button); |
| 811 | open_docs_button->connect(SceneStringName(pressed), callable_mp(this, &InspectorDock::_menu_option).bind(OBJECT_REQUEST_HELP)); |
| 812 | |
| 813 | new_resource_dialog = memnew(CreateDialog); |
| 814 | EditorNode::get_singleton()->get_gui_base()->add_child(new_resource_dialog); |
| 815 | new_resource_dialog->set_base_type("Resource"); |
| 816 | new_resource_dialog->connect("create", callable_mp(this, &InspectorDock::_resource_created)); |
| 817 | |
| 818 | HBoxContainer *property_tools_hb = memnew(HBoxContainer); |
| 819 | main_vb->add_child(property_tools_hb); |
| 820 | |
| 821 | search = memnew(LineEdit); |
| 822 | search->set_h_size_flags(Control::SIZE_EXPAND_FILL); |
| 823 | search->set_placeholder(TTRC("Filter Properties")); |
| 824 | search->set_clear_button_enabled(true); |
| 825 | property_tools_hb->add_child(search); |
| 826 | |
| 827 | object_menu = memnew(MenuButton); |
| 828 | object_menu->set_flat(false); |
| 829 | object_menu->set_theme_type_variation("FlatMenuButton"); |
| 830 | property_tools_hb->add_child(object_menu); |
| 831 | object_menu->set_tooltip_text(TTRC("Manage object properties.")); |
| 832 | object_menu->get_popup()->connect("about_to_popup", callable_mp(this, &InspectorDock::_prepare_menu)); |
| 833 | object_menu->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &InspectorDock::_menu_option)); |
| 834 | |
| 835 | info = memnew(Button); |
| 836 | main_vb->add_child(info); |
| 837 | info->set_clip_text(true); |
| 838 | info->set_accessibility_name(TTRC("Information")); |
| 839 | info->hide(); |
| 840 | info->connect(SceneStringName(pressed), callable_mp(this, &InspectorDock::_info_pressed)); |
| 841 | |
| 842 | unique_resources_confirmation = memnew(ConfirmationDialog); |
| 843 | main_vb->add_child(unique_resources_confirmation); |
| 844 | |
| 845 | VBoxContainer *container = memnew(VBoxContainer); |
| 846 | unique_resources_confirmation->add_child(container); |
| 847 | |
| 848 | unique_resources_label = memnew(Label); |
| 849 | unique_resources_label->set_focus_mode(FOCUS_ACCESSIBILITY); |
| 850 | container->add_child(unique_resources_label); |
| 851 | |
| 852 | unique_resources_list_tree = memnew(Tree); |
| 853 | unique_resources_list_tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); |
| 854 | unique_resources_list_tree->set_hide_root(true); |
| 855 | unique_resources_list_tree->set_columns(1); |
| 856 | unique_resources_list_tree->set_custom_minimum_size(Size2(0, 200 * EDSCALE)); |
| 857 | container->add_child(unique_resources_list_tree); |
| 858 | |
| 859 | Label *bottom_label = memnew(Label); |
| 860 | bottom_label->set_focus_mode(FOCUS_ACCESSIBILITY); |
| 861 | bottom_label->set_text(TTRC("This cannot be undone. Are you sure?")); |
| 862 | container->add_child(bottom_label); |
| 863 | |
| 864 | unique_resources_confirmation->connect(SceneStringName(confirmed), callable_mp(this, &InspectorDock::_menu_confirm_current)); |
| 865 | |
| 866 | info_dialog = memnew(AcceptDialog); |
| 867 | EditorNode::get_singleton()->get_gui_base()->add_child(info_dialog); |
| 868 | |
| 869 | load_resource_dialog = memnew(EditorFileDialog); |
| 870 | main_vb->add_child(load_resource_dialog); |
| 871 | load_resource_dialog->set_current_dir("res://"); |
| 872 | load_resource_dialog->connect("file_selected", callable_mp(this, &InspectorDock::_resource_file_selected)); |
| 873 | |
| 874 | MarginContainer *mc = memnew(MarginContainer); |
| 875 | main_vb->add_child(mc); |
| 876 | mc->set_theme_type_variation("NoBorderHorizontalBottom"); |
| 877 | mc->set_v_size_flags(Control::SIZE_EXPAND_FILL); |
| 878 | |
| 879 | inspector = memnew(EditorInspector); |
| 880 | mc->add_child(inspector); |
| 881 | inspector->set_autoclear(true); |
| 882 | inspector->set_show_categories(true, true); |
| 883 | inspector->set_use_doc_hints(true); |
| 884 | inspector->set_hide_script(false); |
| 885 | inspector->set_hide_metadata(false); |
| 886 | inspector->set_use_settings_name_style(false); |
| 887 | inspector->set_property_name_style(property_name_style); |
| 888 | inspector->set_use_folding(!bool(EDITOR_GET("interface/inspector/disable_folding"))); |
| 889 | inspector->register_text_enter(search); |
| 890 | inspector->set_scroll_hint_mode(ScrollContainer::SCROLL_HINT_MODE_TOP_AND_LEFT); |
| 891 | |
| 892 | inspector->set_use_filter(true); |
| 893 | |
| 894 | inspector->connect("resource_selected", callable_mp(this, &InspectorDock::_resource_selected)); |
| 895 | |
| 896 | FileSystemDock::get_singleton()->connect("files_moved", callable_mp(this, &InspectorDock::_files_moved)); |
| 897 | |
| 898 | set_process_shortcut_input(true); |
| 899 | } |
| 900 | |
| 901 | InspectorDock::~InspectorDock() { |
| 902 | singleton = nullptr; |
| 903 | } |