Fix ambiguous type deduction

This commit is contained in:
Marc Gilleron 2021-01-18 22:45:41 +00:00
parent fc51984f7f
commit 8bdd862262
2 changed files with 9 additions and 2 deletions

View File

@ -35,7 +35,10 @@ void VoxelGeneratorImage::set_image(Ref<Image> im) {
return;
}
_image = im;
Ref<Image> copy = im.is_valid() ? im->duplicate() : Ref<Image>();
Ref<Image> copy;
if (im.is_valid()) {
copy = im->duplicate();
}
RWLockWrite wlock(_parameters_lock);
// lock() prevents us from reading the same image from multiple threads, so we lock it up-front.
// This might no longer be needed in Godot 4.

View File

@ -22,8 +22,12 @@ void VoxelGeneratorNoise2D::set_noise(Ref<OpenSimplexNoise> noise) {
return;
}
_noise = noise;
Ref<OpenSimplexNoise> copy;
if (noise.is_valid()) {
copy = noise->duplicate();
}
RWLockWrite wlock(_parameters_lock);
_parameters.noise = _noise.is_valid() ? _noise->duplicate() : Ref<OpenSimplexNoise>();
_parameters.noise = copy;
}
Ref<OpenSimplexNoise> VoxelGeneratorNoise2D::get_noise() const {