void AnimationPlayer::_notification(int p_what) {

    switch(p_what) {

    case NOTIFICATION_ENTER_SCENE: {

        if (!processing) {
            //make sure that a previous process state was not saved
            //only process if "processing" is set
            set_fixed_process(false);
            set_process(false);
        }
        //_set_process(false);
        clear_caches();
    }
    break;
    case NOTIFICATION_READY: {

        if (!get_scene()->is_editor_hint() && animation_set.has(autoplay)) {
            play(autoplay);
        }
    }
    break;
    case NOTIFICATION_PROCESS: {
        if (animation_process_mode==ANIMATION_PROCESS_FIXED)
            break;

        if (processing)
            _animation_process( get_process_delta_time() );
    }
    break;
    case NOTIFICATION_FIXED_PROCESS: {

        if (animation_process_mode==ANIMATION_PROCESS_IDLE)
            break;

        if (processing)
            _animation_process( get_fixed_process_delta_time() );
    }
    break;
    case NOTIFICATION_EXIT_SCENE: {

        stop_all();
        clear_caches();
    }
    break;
    }
}
Beispiel #2
0
Error AnimationPlayer::add_animation(const StringName &p_name, const Ref<Animation> &p_animation) {

#ifdef DEBUG_ENABLED
	ERR_EXPLAIN("Invalid animation name: " + String(p_name));
	ERR_FAIL_COND_V(String(p_name).find("/") != -1 || String(p_name).find(":") != -1 || String(p_name).find(",") != -1 || String(p_name).find("[") != -1, ERR_INVALID_PARAMETER);
#endif

	ERR_FAIL_COND_V(p_animation.is_null(), ERR_INVALID_PARAMETER);

	//print_line("Add anim: "+String(p_name)+" name: "+p_animation->get_name());

	if (animation_set.has(p_name)) {

		_unref_anim(animation_set[p_name].animation);
		animation_set[p_name].animation = p_animation;
		clear_caches();
	} else {

		AnimationData ad;
		ad.animation = p_animation;
		ad.name = p_name;
		animation_set[p_name] = ad;
	}

	_ref_anim(p_animation);
	_change_notify();
	return OK;
}
Beispiel #3
0
void NeighborSearch::reset_neighb_info()
{  
  // Reset information about the neighborhood's active state.
  active_segment = -1;
  active_edge = -1;
  neighb_el = NULL;
  neighbor_edge = -1;  
  
  // Clear vectors with neighbor elements and their edge info for the active edge.
  neighbor_edges.clear();
  neighbors.clear();
  n_neighbors = 0;
  
  // Reset transformations.
  for(int i = 0; i < NeighborSearch::max_neighbors; i++)
  {
    n_trans[i] = 0;
    for(int j = 0; j < max_n_trans; j++)
      transformations[i][j] = -1;
  }
  neighborhood_type = H2D_DG_NOT_INITIALIZED;
  
  // Clear geometry and jac*wt caches.
  clear_caches();
}
Beispiel #4
0
void AnimationPlayer::_notification(int p_what) {

	switch (p_what) {

		case NOTIFICATION_ENTER_TREE: {

			if (!processing) {
				//make sure that a previous process state was not saved
				//only process if "processing" is set
				set_physics_process(false);
				set_process(false);
			}
			//_set_process(false);
			clear_caches();
		} break;
		case NOTIFICATION_READY: {

			if (!Engine::get_singleton()->is_editor_hint() && animation_set.has(autoplay)) {
				play(autoplay);
				_animation_process(0);
			}
		} break;
		case NOTIFICATION_INTERNAL_PROCESS: {
			if (animation_process_mode == ANIMATION_PROCESS_PHYSICS)
				break;

			if (processing)
				_animation_process(get_process_delta_time());
		} break;
		case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {

			if (animation_process_mode == ANIMATION_PROCESS_IDLE)
				break;

			if (processing)
				_animation_process(get_physics_process_delta_time());
		} break;
		case NOTIFICATION_EXIT_TREE: {

			//stop_all();
			clear_caches();
		} break;
	}
}
Beispiel #5
0
void AnimationPlayer::remove_animation(const StringName &p_name) {

	ERR_FAIL_COND(!animation_set.has(p_name));

	stop_all();
	_unref_anim(animation_set[p_name].animation);
	animation_set.erase(p_name);

	clear_caches();
	_change_notify();
}
void AnimationPlayer::rename_animation(const StringName& p_name,const StringName& p_new_name) {


	ERR_FAIL_COND(!animation_set.has(p_name) );
	ERR_FAIL_COND( String(p_new_name).find("/")!=-1 || String(p_new_name).find(":")!=-1 );
	ERR_FAIL_COND( animation_set.has(p_new_name) );

	//print_line("Rename anim: "+String(p_name)+" name: "+String(p_new_name));

	stop_all();
	AnimationData ad = animation_set[p_name];
	ad.name=p_new_name;
	animation_set.erase(p_name);
	animation_set[p_new_name]=ad;

	List<BlendKey> to_erase;
	Map<BlendKey,float> to_insert;
	for(Map<BlendKey, float >::Element *E=blend_times.front();E;E=E->next()) {

		BlendKey bk=E->key();
		BlendKey new_bk=bk;
		bool erase=false;
		if (bk.from==p_name) {
			new_bk.from=p_new_name;
			erase=true;
		}
		if (bk.to==p_name) {
			new_bk.to=p_new_name;
			erase=true;
		}

		if (erase) {
			to_erase.push_back(bk);
			to_insert[new_bk]=E->get();
		}
	}

	while(to_erase.size()) {

		blend_times.erase(to_erase.front()->get());
		to_erase.pop_front();;
	}

	while(to_insert.size()) {
		blend_times[to_insert.front()->key()]=to_insert.front()->get();
		to_insert.erase(to_insert.front());
	}

	if (autoplay==p_name)
		autoplay=p_new_name;

	clear_caches();
	_change_notify();
}
Beispiel #7
0
void ModelObject::set_has_required_score_states(bool tf) {
  IMP_UNUSED(tf);
  IMP_USAGE_CHECK(tf, "Can only set them this way.");
  IMP_USAGE_CHECK(get_model(), "Must set model first");
  if (!tf) {
    // they almost certainly depend on upstream things
    clear_caches();
  }
  get_model()->do_set_has_required_score_states(this, true);
  // if (get_model()) get_model()->check_dependency_invariants(this);
}
Beispiel #8
0
void team::change_team(const std::string& name, const t_string& user_name)
{
	info_.team_name = name;

	if(!user_name.empty()) {
		info_.user_team_name = user_name;
	} else {
		info_.user_team_name = name;
	}

	clear_caches();
}
Beispiel #9
0
NeighborSearch::~NeighborSearch()
{
	neighbor_edges.clear();
	neighbors.clear();
  clear_caches();
  clear_supported_shapes();
  clear_neighbor_pss();
  detach_pss();
  for(unsigned int i = 0; i < transformations.size(); i++)
    delete [] transformations.at(i);
  transformations.clear();
  n_trans.clear();
}
Beispiel #10
0
void AnimationPlayer::set_root(const NodePath &p_root) {

	root = p_root;
	clear_caches();
}
Beispiel #11
0
void AnimationPlayer::_node_removed(Node *p_node) {

	clear_caches(); // nodes contained here ar being removed, clear the caches
}
Beispiel #12
0
void AnimationPlayer::_animation_changed() {

	clear_caches();
}
Beispiel #13
0
// init GATT (could be used for both PCI and AGP)
static status_t initGATT( GART_info *gart )
{
	area_id map_area;
	uint32 map_area_size;
	physical_entry *map;
	physical_entry PTB_map[1];
	size_t map_count;
	uint32 i;
	uint32 *gatt_entry;
	size_t num_pages;

	SHOW_FLOW0( 3, "" );

	num_pages = (gart->buffer.size + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1);

	// GART must be contiguous
	gart->GATT.area = create_area("Radeon GATT", (void **)&gart->GATT.ptr,
		B_ANY_KERNEL_ADDRESS,
		(num_pages * sizeof( uint32 ) + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1),
		B_32_BIT_CONTIGUOUS,
			// TODO: Physical address is cast to 32 bit below! Use B_CONTIGUOUS,
			// when that is (/can be) fixed!
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
		// TODO: really user read/write?
		B_READ_AREA | B_WRITE_AREA | B_USER_CLONEABLE_AREA
#else
		0
#endif
		);

	if (gart->GATT.area < 0) {
		SHOW_ERROR(1, "cannot create GATT table (%s)",
			strerror(gart->GATT.area));
		return gart->GATT.area;
	}

	get_memory_map(gart->GATT.ptr, B_PAGE_SIZE, PTB_map, 1);
	gart->GATT.phys = PTB_map[0].address;

	SHOW_INFO(3, "GATT_ptr=%p, GATT_phys=%p", gart->GATT.ptr,
		(void *)gart->GATT.phys);

	// get address mapping
	memset(gart->GATT.ptr, 0, num_pages * sizeof(uint32));

	map_count = num_pages + 1;

	// align size to B_PAGE_SIZE
	map_area_size = map_count * sizeof(physical_entry);
	if ((map_area_size / B_PAGE_SIZE) * B_PAGE_SIZE != map_area_size)
		map_area_size = ((map_area_size / B_PAGE_SIZE) + 1) * B_PAGE_SIZE;

	// temporary area where we fill in the memory map (deleted below)
	map_area = create_area("pci_gart_map_area", (void **)&map, B_ANY_ADDRESS,
		map_area_size, B_FULL_LOCK, B_READ_AREA | B_WRITE_AREA);
		// TODO: We actually have a working malloc() in the kernel. Why create
		// an area?
	dprintf("pci_gart_map_area: %ld\n", map_area);

	get_memory_map( gart->buffer.ptr, gart->buffer.size, map, map_count );

	// the following looks a bit strange as the kernel
	// combines successive entries
	gatt_entry = gart->GATT.ptr;

	for( i = 0; i < map_count; ++i ) {
		phys_addr_t addr = map[i].address;
		size_t size = map[i].size;

		if( size == 0 )
			break;

		while( size > 0 ) {
			*gatt_entry++ = addr;
			//SHOW_FLOW( 3, "%lx", *(gart_entry-1) );
			addr += ATI_PCIGART_PAGE_SIZE;
			size -= ATI_PCIGART_PAGE_SIZE;
		}
	}

	delete_area(map_area);

	if( i == map_count ) {
		// this case should never happen
		SHOW_ERROR0( 0, "memory map of GART buffer too large!" );
		delete_area( gart->GATT.area );
		gart->GATT.area = -1;
		return B_ERROR;
	}

	// this might be a bit more than needed, as
	// 1. Intel CPUs have "processor order", i.e. writes appear to external
	//    devices in program order, so a simple final write should be sufficient
	// 2. if it is a PCI GART, bus snooping should provide cache coherence
	// 3. this function is a no-op :(
	clear_caches( gart->GATT.ptr, num_pages * sizeof( uint32 ),
		B_FLUSH_DCACHE );

	// back to real live - some chipsets have write buffers that
	// proove all previous assumptions wrong
	// (don't know whether this really helps though)
	asm volatile ( "wbinvd" ::: "memory" );
	return B_OK;
}
Beispiel #14
0
void
_user_clear_caches(void *address, size_t length, uint32 flags)
{
	clear_caches(address, length, flags);
}