Skip to content

Commit 16aaa0a

Browse files
committed
Merge pull request #103944 from KoBeWi/more_red_info
Improve error messages for `add_property_info()`
2 parents 182be69 + 6028061 commit 16aaa0a

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

core/config/project_settings.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,8 +1221,12 @@ Variant _GLOBAL_DEF(const PropertyInfo &p_info, const Variant &p_default, bool p
12211221
}
12221222

12231223
void ProjectSettings::_add_property_info_bind(const Dictionary &p_info) {
1224-
ERR_FAIL_COND(!p_info.has("name"));
1225-
ERR_FAIL_COND(!p_info.has("type"));
1224+
ERR_FAIL_COND_MSG(!p_info.has("name"), "Property info is missing \"name\" field.");
1225+
ERR_FAIL_COND_MSG(!p_info.has("type"), "Property info is missing \"type\" field.");
1226+
1227+
if (p_info.has("usage")) {
1228+
WARN_PRINT("\"usage\" is not supported in add_property_info().");
1229+
}
12261230

12271231
PropertyInfo pinfo;
12281232
pinfo.name = p_info["name"];

doc/classes/ProjectSettings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
ProjectSettings.AddPropertyInfo(propertyInfo);
5252
[/csharp]
5353
[/codeblocks]
54+
[b]Note:[/b] Setting [code]"usage"[/code] for the property is not supported. Use [method set_as_basic], [method set_restart_if_changed], and [method set_as_internal] to modify usage flags.
5455
</description>
5556
</method>
5657
<method name="clear">

editor/editor_settings.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,12 @@ void EditorSettings::_get_property_list(List<PropertyInfo> *p_list) const {
324324
}
325325

326326
void EditorSettings::_add_property_info_bind(const Dictionary &p_info) {
327-
ERR_FAIL_COND(!p_info.has("name"));
328-
ERR_FAIL_COND(!p_info.has("type"));
327+
ERR_FAIL_COND_MSG(!p_info.has("name"), "Property info is missing \"name\" field.");
328+
ERR_FAIL_COND_MSG(!p_info.has("type"), "Property info is missing \"type\" field.");
329+
330+
if (p_info.has("usage")) {
331+
WARN_PRINT("\"usage\" is not supported in add_property_info().");
332+
}
329333

330334
PropertyInfo pinfo;
331335
pinfo.name = p_info["name"];

0 commit comments

Comments
 (0)