void TileMap::_notification(int p_what) { switch(p_what) { case NOTIFICATION_ENTER_SCENE: { pending_update=true; _update_dirty_quadrants(); RID space = get_world_2d()->get_space(); _update_quadrant_transform(); _update_quadrant_space(space); } break; case NOTIFICATION_EXIT_SCENE: { _update_quadrant_space(RID()); } break; case NOTIFICATION_TRANSFORM_CHANGED: { //move stuff _update_quadrant_transform(); } break; } }
void TileMap::_notification(int p_what) { switch(p_what) { case NOTIFICATION_ENTER_TREE: { Node2D *c=this; while(c) { navigation=c->cast_to<Navigation2D>(); if (navigation) { break; } c=c->get_parent()->cast_to<Node2D>(); } pending_update=true; _update_dirty_quadrants(); RID space = get_world_2d()->get_space(); _update_quadrant_transform(); _update_quadrant_space(space); } break; case NOTIFICATION_EXIT_TREE: { _update_quadrant_space(RID()); for (Map<PosKey,Quadrant>::Element *E=quadrant_map.front();E;E=E->next()) { Quadrant &q=E->get(); if (navigation) { for(Map<PosKey,Quadrant::NavPoly>::Element *E=q.navpoly_ids.front();E;E=E->next()) { navigation->navpoly_remove(E->get().id); } q.navpoly_ids.clear(); } for(Map<PosKey,Quadrant::Occluder>::Element *E=q.occluder_instances.front();E;E=E->next()) { VS::get_singleton()->free(E->get().id); } q.occluder_instances.clear(); } navigation=NULL; } break; case NOTIFICATION_TRANSFORM_CHANGED: { //move stuff _update_quadrant_transform(); } break; } }