mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Merge pull request #110189 from bjornmp/Fix-for-issue-#110178
Fix Clear option not visible when a Resource's @export-ed property is a Script
This commit is contained in:
commit
5365372b3d
1 changed files with 12 additions and 3 deletions
|
@ -778,11 +778,20 @@ bool EditorResourcePicker::_is_type_valid(const String &p_type_name, const HashS
|
|||
}
|
||||
|
||||
bool EditorResourcePicker::_is_custom_type_script() const {
|
||||
Ref<Script> resource_as_script = edited_resource;
|
||||
EditorProperty *editor_property = Object::cast_to<EditorProperty>(get_parent());
|
||||
if (!editor_property) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the property being edited is 'script'.
|
||||
if (editor_property->get_edited_property() == CoreStringName(script)) {
|
||||
// If there's currently a valid script assigned and the owning Node/Resource also has a custom type script assigned, then
|
||||
// the currently assigned script is either the custom type script itself or an extension of it.
|
||||
Ref<Script> resource_as_script = edited_resource;
|
||||
if (resource_as_script.is_valid() && resource_owner && resource_owner->has_meta(SceneStringName(_custom_type_script))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue