Skip to content

Commit c052d64

Browse files
committed
GDScript: Fix PROPERTY_USAGE_SCRIPT_VARIABLE is not set for placeholder instance properties
1 parent 63227bb commit c052d64

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

editor/animation/animation_track_editor.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4892,7 +4892,16 @@ PropertyInfo AnimationTrackEditor::_find_hint_for_track(int p_idx, NodePath &r_b
48924892

48934893
for (const PropertyInfo &E : pinfo) {
48944894
if (E.name == leftover_path[leftover_path.size() - 1]) {
4895-
return E;
4895+
PropertyInfo pi = E;
4896+
4897+
// See `PropertySelector::_update_search()`. `PropertySelector` makes an exception for script variables,
4898+
// displaying them even if `PROPERTY_USAGE_EDITOR` is not set. So, we need to compensate for this here
4899+
// to ensure the property is visible in the Inspector.
4900+
if (pi.usage & PROPERTY_USAGE_SCRIPT_VARIABLE) {
4901+
pi.usage |= PROPERTY_USAGE_EDITOR;
4902+
}
4903+
4904+
return pi;
48964905
}
48974906
}
48984907

modules/gdscript/gdscript.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,15 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderSc
560560
continue;
561561
}
562562

563-
members_cache.push_back(member.variable->export_info);
563+
// See `GDScriptCompiler::_prepare_compilation()`. The `PROPERTY_USAGE_SCRIPT_VARIABLE` flag
564+
// isn't stored in `export_info`, but is set separately in the compiler. We need to replicate
565+
// the same logic for placeholders.
566+
PropertyInfo property_info = member.variable->export_info;
567+
property_info.usage |= PROPERTY_USAGE_SCRIPT_VARIABLE;
568+
564569
Variant default_value = analyzer.make_variable_default_value(member.variable);
570+
571+
members_cache.push_back(property_info);
565572
member_default_values_cache[member.variable->identifier->name] = default_value;
566573
} break;
567574
case GDScriptParser::ClassNode::Member::SIGNAL: {

0 commit comments

Comments
 (0)