Merge pull request #53287 from Chaosus/sprite3d_fix

This commit is contained in:
Rémi Verschelde 2021-12-02 16:23:33 +01:00 committed by GitHub
commit ced07100d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -36,5 +36,10 @@
Emitted when the [member frame] changes. Emitted when the [member frame] changes.
</description> </description>
</signal> </signal>
<signal name="texture_changed">
<description>
Emitted when the [member texture] changes.
</description>
</signal>
</signals> </signals>
</class> </class>

View File

@ -625,6 +625,7 @@ void Sprite3D::set_texture(const Ref<Texture2D> &p_texture) {
texture->connect(CoreStringNames::get_singleton()->changed, Callable(this, "_queue_update")); texture->connect(CoreStringNames::get_singleton()->changed, Callable(this, "_queue_update"));
} }
_queue_update(); _queue_update();
emit_signal(SceneStringNames::get_singleton()->texture_changed);
} }
Ref<Texture2D> Sprite3D::get_texture() const { Ref<Texture2D> Sprite3D::get_texture() const {
@ -780,6 +781,7 @@ void Sprite3D::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::RECT2, "region_rect"), "set_region_rect", "get_region_rect"); ADD_PROPERTY(PropertyInfo(Variant::RECT2, "region_rect"), "set_region_rect", "get_region_rect");
ADD_SIGNAL(MethodInfo("frame_changed")); ADD_SIGNAL(MethodInfo("frame_changed"));
ADD_SIGNAL(MethodInfo("texture_changed"));
} }
Sprite3D::Sprite3D() { Sprite3D::Sprite3D() {