void GeometryInstance::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_WORLD) { if (flags[FLAG_USE_BAKED_LIGHT]) { _find_baked_light(); } _update_visibility(); } else if (p_what==NOTIFICATION_EXIT_WORLD) { if (flags[FLAG_USE_BAKED_LIGHT]) { if (baked_light_instance) { baked_light_instance->disconnect(SceneStringNames::get_singleton()->baked_light_changed,this,SceneStringNames::get_singleton()->_baked_light_changed); baked_light_instance=NULL; } _baked_light_changed(); } } if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { _update_visibility(); } }
void GeometryInstance::set_flag(Flags p_flag,bool p_value) { ERR_FAIL_INDEX(p_flag,FLAG_MAX); if (flags[p_flag]==p_value) return; flags[p_flag]=p_value; VS::get_singleton()->instance_geometry_set_flag(get_instance(),(VS::InstanceFlags)p_flag,p_value); if (p_flag==FLAG_VISIBLE) { _update_visibility(); } if (p_flag==FLAG_USE_BAKED_LIGHT) { if (is_inside_world()) { if (!p_value) { if (baked_light_instance) { baked_light_instance->disconnect(SceneStringNames::get_singleton()->baked_light_changed,this,SceneStringNames::get_singleton()->_baked_light_changed); baked_light_instance=NULL; } _baked_light_changed(); } else { _find_baked_light(); } } } }
void GridMap::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_WORLD: { Spatial *c = this; while (c) { navigation = Object::cast_to<Navigation>(c); if (navigation) { break; } c = Object::cast_to<Spatial>(c->get_parent()); } last_transform = get_global_transform(); for (Map<OctantKey, Octant *>::Element *E = octant_map.front(); E; E = E->next()) { _octant_enter_world(E->key()); } } break; case NOTIFICATION_TRANSFORM_CHANGED: { Transform new_xform = get_global_transform(); if (new_xform == last_transform) break; //update run for (Map<OctantKey, Octant *>::Element *E = octant_map.front(); E; E = E->next()) { _octant_transform(E->key()); } last_transform = new_xform; } break; case NOTIFICATION_EXIT_WORLD: { for (Map<OctantKey, Octant *>::Element *E = octant_map.front(); E; E = E->next()) { _octant_exit_world(E->key()); } navigation = NULL; //_queue_octants_dirty(MAP_DIRTY_INSTANCES|MAP_DIRTY_TRANSFORMS); //_update_octants_callback(); //_update_area_instances(); } break; case NOTIFICATION_VISIBILITY_CHANGED: { _update_visibility(); } break; } }
void GridMap::_update_octants_callback() { if (!awaiting_update) return; List<OctantKey> to_delete; for (Map<OctantKey, Octant *>::Element *E = octant_map.front(); E; E = E->next()) { if (_octant_update(E->key())) { to_delete.push_back(E->key()); } } while (to_delete.front()) { memdelete(octant_map[to_delete.front()->get()]); octant_map.erase(to_delete.front()->get()); to_delete.pop_back(); } _update_visibility(); awaiting_update = false; }
void Light::set_editor_only(bool p_editor_only) { editor_only=p_editor_only; _update_visibility(); }
void Light::set_enabled(bool p_enabled) { enabled=p_enabled; _update_visibility(); }
void Light::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_SCENE || p_what==NOTIFICATION_VISIBILITY_CHANGED) { _update_visibility(); } }