diff --git a/editor/animation/animation_track_editor.cpp b/editor/animation/animation_track_editor.cpp index 7e90fffb96db..bfba9d312cec 100644 --- a/editor/animation/animation_track_editor.cpp +++ b/editor/animation/animation_track_editor.cpp @@ -4892,7 +4892,16 @@ PropertyInfo AnimationTrackEditor::_find_hint_for_track(int p_idx, NodePath &r_b for (const PropertyInfo &E : pinfo) { if (E.name == leftover_path[leftover_path.size() - 1]) { - return E; + PropertyInfo pi = E; + + // See `PropertySelector::_update_search()`. `PropertySelector` makes an exception for script variables, + // displaying them even if `PROPERTY_USAGE_EDITOR` is not set. So, we need to compensate for this here + // to ensure the property is visible in the Inspector. + if (pi.usage & PROPERTY_USAGE_SCRIPT_VARIABLE) { + pi.usage |= PROPERTY_USAGE_EDITOR; + } + + return pi; } } diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index c75a70d3beaa..35aa82c27d15 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -556,12 +556,26 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderSc switch (member.type) { case GDScriptParser::ClassNode::Member::VARIABLE: { - if (!member.variable->exported) { - continue; + // See `GDScriptCompiler::_prepare_compilation()`. The `PROPERTY_USAGE_SCRIPT_VARIABLE` flag + // isn't stored in `export_info`, but is set separately in the compiler. We need to replicate + // the same logic for placeholders. + PropertyInfo prop_info = member.variable->get_datatype().to_property_info(member.variable->identifier->name); + PropertyInfo export_info = member.variable->export_info; + + if (member.variable->exported) { + if (member.variable->get_datatype().is_variant()) { + prop_info.type = export_info.type; + prop_info.class_name = export_info.class_name; + } + prop_info.hint = export_info.hint; + prop_info.hint_string = export_info.hint_string; + prop_info.usage = export_info.usage; } + prop_info.usage |= PROPERTY_USAGE_SCRIPT_VARIABLE; - members_cache.push_back(member.variable->export_info); Variant default_value = analyzer.make_variable_default_value(member.variable); + + members_cache.push_back(prop_info); member_default_values_cache[member.variable->identifier->name] = default_value; } break; case GDScriptParser::ClassNode::Member::SIGNAL: {