1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Fix BackBufferCopy rect property appearing when not relevant in inspector

The `rect` property is only effective if `copy_mode` is Rect.
This commit is contained in:
Hugo Locurcio
2022-12-08 19:50:59 +01:00
parent cf093f8e47
commit 080b6ac1ae
3 changed files with 14 additions and 6 deletions

View File

@@ -71,12 +71,19 @@ Rect2 BackBufferCopy::get_rect() const {
void BackBufferCopy::set_copy_mode(CopyMode p_mode) {
copy_mode = p_mode;
_update_copy_mode();
notify_property_list_changed();
}
BackBufferCopy::CopyMode BackBufferCopy::get_copy_mode() const {
return copy_mode;
}
void BackBufferCopy::_validate_property(PropertyInfo &p_property) const {
if (copy_mode != COPY_MODE_RECT && p_property.name == "rect") {
p_property.usage = PROPERTY_USAGE_NO_EDITOR;
}
}
void BackBufferCopy::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_rect", "rect"), &BackBufferCopy::set_rect);
ClassDB::bind_method(D_METHOD("get_rect"), &BackBufferCopy::get_rect);