fix: pinned photos reset texture on finding a mesh
This commit is contained in:
parent
f952452b2e
commit
032408e7b2
1 changed files with 3 additions and 1 deletions
|
|
@ -5,6 +5,7 @@
|
|||
#include "scene/2d/mesh_instance_2d.h"
|
||||
#include "you_done_it/clue_db.h"
|
||||
#include "you_done_it/conclusion_field.h"
|
||||
#include "you_done_it/ydi_networking.h"
|
||||
|
||||
void PinnedPhoto::_bind_methods() {
|
||||
BIND_PROPERTY(Variant::BOOL, can_drop);
|
||||
|
|
@ -19,6 +20,7 @@ void PinnedPhoto::enter_tree() {
|
|||
void PinnedPhoto::on_child_entered_tree(Node *node) {
|
||||
if (MeshInstance2D * meshinst{ cast_to<MeshInstance2D>(node) }) {
|
||||
this->photo_mesh = meshinst;
|
||||
set_clue(get_clue()); // force reset clue to update image
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -95,7 +97,7 @@ bool PinnedPhoto::get_can_drop() const {
|
|||
|
||||
void PinnedPhoto::set_clue(NetworkData::ClueID id) {
|
||||
this->clue = id;
|
||||
if (photo_mesh) {
|
||||
if (photo_mesh && this->clue != NetworkData::CLUE_MAX) {
|
||||
Ref<Texture2D> texture{ ClueDB::get_singleton()->get_clue(id)->get_image() };
|
||||
if (texture.is_valid()) {
|
||||
photo_mesh->set_texture(texture);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue