Creating basic editor settings for my plugin

Godot Version

4.4.1 and 4.7.1

Question

I’ve got a plugin that makes use of it’s own editor settings, however they only appear when “advanced” is checked, and I don’t believe these settings warrant being “advanced” I would like them to appear in the basic view too.

Here is my flow for creating editor settings. I see that there is a PROPERTY_USAGE_EDITOR_BASIC_SETTING flag, but I have no idea where it would go.

var ed_settings := EditorInterface.get_editor_settings()
# A Dictionary stores default values for every setting
for key: String in default_editor_settings.keys():
	var default: Variant = default_editor_settings[key]

	# If they don't have these settings, such as on first launch, create them
	# careful not to overwrite the user's previous value
	if !ed_settings.has_setting(EDITOR_SETTINGS_PREFIX + key):
		ed_settings.set_setting(EDITOR_SETTINGS_PREFIX + key, default)

	# Allow reverting changes
	ed_settings.set_initial_value(EDITOR_SETTINGS_PREFIX + key, default, false)

# Every setting uses an add_property_info call
ed_settings.add_property_info({
	"name": EDITOR_SETTINGS_PREFIX + "enable_2d",
	"type": TYPE_BOOL,
	#"usage": PROPERTY_USAGE_EDITOR_BASIC_SETTING # I have tried this to no avail
})

I haven’t tested it but by looking at the C++ code you still need to keep the PROPERTY_USAGE_EDITOR and PROPERTY_USAGE_STORAGE (or use PROPERTY_USAGE_DEFAULT)

So try "usage": PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_EDITOR_BASIC_SETTING

	ed_settings.add_property_info({
		"name": editor_settings_preface + "enable_2d",
		"type": TYPE_BOOL,
		"usage": PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_EDITOR_BASIC_SETTING,
	})

The editor settings still only appear in the advanced view.

I am restarting the project when changing this plugin script, I don’t see anything inside the editor settings tres config file that would affect this advanced view so I believe restarting the editor should be a clean test.


I see ProjectSettings has .set_as_basic, but this does not exist for EditorSettings. The source code for this method seems impossible to replicate from GDScript, as it’s .basic is a regular old unexposed bool.

void ProjectSettings::set_as_basic(const String &p_name, bool p_basic) {
	ERR_FAIL_COND_MSG(!props.has(p_name), vformat("Request for nonexistent project setting: '%s'.", p_name));
	props[p_name].basic = p_basic;
}

Uhm, yeah. EditorSettings.add_property_info() doesn’t use the usage field :confused:

You should open an issue.

Here’s an open issue on the subject, and looks like there is one or two PRs addressing the issue. Hopefully soon :crossed_fingers: