Validate Resource type when pasting property#112386
Merged
Repiteo merged 1 commit intogodotengine:masterfrom Jan 5, 2026
Merged
Validate Resource type when pasting property#112386Repiteo merged 1 commit intogodotengine:masterfrom
Repiteo merged 1 commit intogodotengine:masterfrom
Conversation
akien-mga
reviewed
Nov 4, 2025
| custom_class = EditorNode::get_singleton()->get_object_custom_type_name(p_resource->get_script()); | ||
| } | ||
| const String class_str = (custom_class.is_empty() ? p_resource->get_class() : vformat("%s (%s)", custom_class, p_resource->get_class())); | ||
| ERR_FAIL_MSG(vformat("Failed to set a resource of the type '%s' because this EditorResourcePicker only accepts '%s' and its derivatives.", class_str, base_type)); |
Member
There was a problem hiding this comment.
Should this be ERR_FAIL_EDMSG to show in the toaster?
Member
Author
There was a problem hiding this comment.
tbh I'm not sure when this error can appear normally. The paste operation does not trigger it, and I don't think you can assign wrong resource any other way using the inspector.
akien-mga
approved these changes
Dec 17, 2025
Member
|
Needs rebase. |
4fdc5b3 to
c23a224
Compare
Contributor
|
Thanks! |
rivie13
pushed a commit
to rivie13/Phoenix-Agentic-Engine
that referenced
this pull request
Feb 16, 2026
Validate Resource type when pasting property
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #112347
When you paste a property value, the inspector will just emit that property has changed with the new value, without doing any validation. It works with built-in properties, because when you try to e.g. assign Object to float or Texture2D to Image, the engine will cast it to the new value and assign whatever remains after casting (so e.g. you can paste Resource as bool and it will assign true).
It's a bit different for script properties. If the script isn't
@tool, they are assigned to PlaceholderScriptInstance, which has no information about the properties. Whatever you set just goes in. After the value is pasted, the EditorProperty will update itself based on the value. In most cases the value will correct itself, e.g. you can't assign Node to EditorPropertyInt, because it just can't accept/display that value.Then there is EditorPropertyResource. After #84446 the validation of the value assigned to the object does not happen, so as long as it's any Resource, the property will accept it. This, coupled with what I explained above, is the source of the bug. I opted to fix it at pasting operation.