#include "pinboard.h" #include "core/config/engine.h" #include "pinned_photo.h" #include "scene/2d/mesh_instance_2d.h" void Pinboard::_bind_methods() { } void Pinboard::enter_tree() { connect("body_entered", callable_mp(this, &self_type::on_body_entered)); connect("body_exited", callable_mp(this, &self_type::on_body_exited)); } void Pinboard::on_body_entered(Node2D *node) { if (PinnedPhoto * photo{ cast_to(node) }) { photo->set_can_drop(true); } } void Pinboard::on_body_exited(Node2D *node) { if (PinnedPhoto * photo{ cast_to(node) }) { photo->set_can_drop(false); } } void Pinboard::_notification(int what) { if (Engine::get_singleton()->is_editor_hint()) { return; } switch (what) { default: return; case NOTIFICATION_ENTER_TREE: enter_tree(); return; } }