mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Merge pull request #107692 from timothyqiu/editor-overrides-doc
Show description for editor setting overrides
This commit is contained in:
commit
8d27c00038
4 changed files with 21 additions and 5 deletions
|
@ -49,7 +49,7 @@ class ProjectSettings : public Object {
|
||||||
public:
|
public:
|
||||||
typedef HashMap<String, Variant> CustomMap;
|
typedef HashMap<String, Variant> CustomMap;
|
||||||
static inline const String PROJECT_DATA_DIR_NAME_SUFFIX = "godot";
|
static inline const String PROJECT_DATA_DIR_NAME_SUFFIX = "godot";
|
||||||
static inline const String EDITOR_SETTING_OVERRIDE_PREFIX = "editor_overrides/";
|
static inline const String EDITOR_SETTING_OVERRIDE_PREFIX = PNAME("editor_overrides") + String("/");
|
||||||
|
|
||||||
// Properties that are not for built in values begin from this value, so builtin ones are displayed first.
|
// Properties that are not for built in values begin from this value, so builtin ones are displayed first.
|
||||||
constexpr static const int32_t NO_BUILTIN_ORDER_BASE = 1 << 16;
|
constexpr static const int32_t NO_BUILTIN_ORDER_BASE = 1 << 16;
|
||||||
|
|
|
@ -4227,10 +4227,10 @@ void EditorInspector::update_tree() {
|
||||||
String doc_path;
|
String doc_path;
|
||||||
String theme_item_name;
|
String theme_item_name;
|
||||||
String doc_tooltip_text;
|
String doc_tooltip_text;
|
||||||
StringName classname = doc_name;
|
|
||||||
|
|
||||||
// Build the doc hint, to use as tooltip.
|
// Build the doc hint, to use as tooltip.
|
||||||
if (use_doc_hints) {
|
if (use_doc_hints) {
|
||||||
|
StringName classname = doc_name;
|
||||||
if (!object_class.is_empty()) {
|
if (!object_class.is_empty()) {
|
||||||
classname = object_class;
|
classname = object_class;
|
||||||
} else if (Object::cast_to<MultiNodeEdit>(object)) {
|
} else if (Object::cast_to<MultiNodeEdit>(object)) {
|
||||||
|
@ -4253,6 +4253,14 @@ void EditorInspector::update_tree() {
|
||||||
}
|
}
|
||||||
|
|
||||||
StringName propname = property_prefix + p.name;
|
StringName propname = property_prefix + p.name;
|
||||||
|
for (const KeyValue<String, String> &E : doc_property_class_remaps) {
|
||||||
|
if (property_prefix.begins_with(E.key)) {
|
||||||
|
propname = property_prefix.trim_prefix(E.key) + p.name;
|
||||||
|
classname = E.value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
// Small hack for theme_overrides. They are listed under Control, but come from another class.
|
// Small hack for theme_overrides. They are listed under Control, but come from another class.
|
||||||
|
@ -4317,12 +4325,12 @@ void EditorInspector::update_tree() {
|
||||||
if (p.name.contains("shader_parameter/")) {
|
if (p.name.contains("shader_parameter/")) {
|
||||||
ShaderMaterial *shader_material = Object::cast_to<ShaderMaterial>(object);
|
ShaderMaterial *shader_material = Object::cast_to<ShaderMaterial>(object);
|
||||||
if (shader_material) {
|
if (shader_material) {
|
||||||
doc_tooltip_text = "property|" + shader_material->get_shader()->get_path() + "|" + property_prefix + p.name;
|
doc_tooltip_text = "property|" + shader_material->get_shader()->get_path() + "|" + propname;
|
||||||
}
|
}
|
||||||
} else if (p.usage & PROPERTY_USAGE_INTERNAL) {
|
} else if (p.usage & PROPERTY_USAGE_INTERNAL) {
|
||||||
doc_tooltip_text = "internal_property|" + classname + "|" + property_prefix + p.name;
|
doc_tooltip_text = "internal_property|" + classname + "|" + propname;
|
||||||
} else {
|
} else {
|
||||||
doc_tooltip_text = "property|" + classname + "|" + property_prefix + p.name;
|
doc_tooltip_text = "property|" + classname + "|" + propname;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
doc_tooltip_text = "theme_item|" + classname + "|" + theme_item_name;
|
doc_tooltip_text = "theme_item|" + classname + "|" + theme_item_name;
|
||||||
|
@ -5609,6 +5617,10 @@ String EditorInspector::get_custom_property_description(const String &p_property
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditorInspector::remap_doc_property_class(const String &p_property_prefix, const String &p_class) {
|
||||||
|
doc_property_class_remaps[p_property_prefix] = p_class;
|
||||||
|
}
|
||||||
|
|
||||||
void EditorInspector::set_object_class(const String &p_class) {
|
void EditorInspector::set_object_class(const String &p_class) {
|
||||||
object_class = p_class;
|
object_class = p_class;
|
||||||
}
|
}
|
||||||
|
|
|
@ -711,6 +711,7 @@ class EditorInspector : public ScrollContainer {
|
||||||
HashMap<StringName, HashMap<StringName, DocCacheInfo>> doc_cache;
|
HashMap<StringName, HashMap<StringName, DocCacheInfo>> doc_cache;
|
||||||
HashSet<StringName> restart_request_props;
|
HashSet<StringName> restart_request_props;
|
||||||
HashMap<String, String> custom_property_descriptions;
|
HashMap<String, String> custom_property_descriptions;
|
||||||
|
HashMap<String, String> doc_property_class_remaps;
|
||||||
|
|
||||||
HashMap<ObjectID, int> scroll_cache;
|
HashMap<ObjectID, int> scroll_cache;
|
||||||
|
|
||||||
|
@ -829,6 +830,8 @@ public:
|
||||||
void add_custom_property_description(const String &p_class, const String &p_property, const String &p_description);
|
void add_custom_property_description(const String &p_class, const String &p_property, const String &p_description);
|
||||||
String get_custom_property_description(const String &p_property) const;
|
String get_custom_property_description(const String &p_property) const;
|
||||||
|
|
||||||
|
void remap_doc_property_class(const String &p_property_prefix, const String &p_class);
|
||||||
|
|
||||||
void set_object_class(const String &p_class);
|
void set_object_class(const String &p_class);
|
||||||
String get_object_class() const;
|
String get_object_class() const;
|
||||||
|
|
||||||
|
|
|
@ -758,6 +758,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
||||||
general_settings_inspector->connect("category_changed", callable_mp(this, &ProjectSettingsEditor::_on_category_changed));
|
general_settings_inspector->connect("category_changed", callable_mp(this, &ProjectSettingsEditor::_on_category_changed));
|
||||||
general_settings_inspector->get_inspector()->set_use_filter(true);
|
general_settings_inspector->get_inspector()->set_use_filter(true);
|
||||||
general_settings_inspector->get_inspector()->set_mark_unsaved(false);
|
general_settings_inspector->get_inspector()->set_mark_unsaved(false);
|
||||||
|
general_settings_inspector->get_inspector()->remap_doc_property_class(ProjectSettings::EDITOR_SETTING_OVERRIDE_PREFIX, "EditorSettings");
|
||||||
general_settings_inspector->get_inspector()->connect("property_selected", callable_mp(this, &ProjectSettingsEditor::_setting_selected));
|
general_settings_inspector->get_inspector()->connect("property_selected", callable_mp(this, &ProjectSettingsEditor::_setting_selected));
|
||||||
general_settings_inspector->get_inspector()->connect("property_edited", callable_mp(this, &ProjectSettingsEditor::_setting_edited));
|
general_settings_inspector->get_inspector()->connect("property_edited", callable_mp(this, &ProjectSettingsEditor::_setting_edited));
|
||||||
general_settings_inspector->get_inspector()->connect("property_deleted", callable_mp(this, &ProjectSettingsEditor::_on_editor_override_deleted));
|
general_settings_inspector->get_inspector()->connect("property_deleted", callable_mp(this, &ProjectSettingsEditor::_on_editor_override_deleted));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue