Example #1
0
void AnimationNode::blend_animation(const StringName &p_animation, float p_time, float p_delta, bool p_seeked, float p_blend) {

	ERR_FAIL_COND(!state);
	ERR_FAIL_COND(!state->player->has_animation(p_animation));

	Ref<Animation> animation = state->player->get_animation(p_animation);

	if (animation.is_null()) {

		AnimationNodeBlendTree *btree = Object::cast_to<AnimationNodeBlendTree>(parent);
		if (btree) {
			String name = btree->get_node_name(Ref<AnimationNodeAnimation>(this));
			make_invalid(vformat(RTR("In node '%s', invalid animation: '%s'."), name, p_animation));
		} else {
			make_invalid(vformat(RTR("Invalid animation: '%s'."), p_animation));
		}
		return;
	}

	ERR_FAIL_COND(!animation.is_valid());

	AnimationState anim_state;
	anim_state.blend = p_blend;
	anim_state.track_blends = &blends;
	anim_state.delta = p_delta;
	anim_state.time = p_time;
	anim_state.animation = animation;
	anim_state.seeked = p_seeked;

	state->animation_states.push_back(anim_state);
}
Example #2
0
float AnimationNode::blend_input(int p_input, float p_time, bool p_seek, float p_blend, FilterAction p_filter, bool p_optimize) {
	ERR_FAIL_INDEX_V(p_input, inputs.size(), 0);
	ERR_FAIL_COND_V(!state, 0);

	AnimationNodeBlendTree *blend_tree = Object::cast_to<AnimationNodeBlendTree>(parent);
	ERR_FAIL_COND_V(!blend_tree, 0);

	StringName node_name = connections[p_input];

	if (!blend_tree->has_node(node_name)) {
		String name = blend_tree->get_node_name(Ref<AnimationNode>(this));
		make_invalid(vformat(RTR("Nothing connected to input '%s' of node '%s'."), get_input_name(p_input), name));
		return 0;
	}

	Ref<AnimationNode> node = blend_tree->get_node(node_name);

	//inputs.write[p_input].last_pass = state->last_pass;
	float activity = 0;
	float ret = _blend_node(node_name, blend_tree->get_node_connection_array(node_name), NULL, node, p_time, p_seek, p_blend, p_filter, p_optimize, &activity);

	Vector<AnimationTree::Activity> *activity_ptr = state->tree->input_activity_map.getptr(base_path);

	if (activity_ptr && p_input < activity_ptr->size()) {
		activity_ptr->write[p_input].last_pass = state->last_pass;
		activity_ptr->write[p_input].activity = activity;
	}
	return ret;
}
inline void osmium::util::MemoryMapping::unmap() {
    if (is_valid()) {
        if (::munmap(m_addr, m_size) != 0) {
            throw std::system_error(errno, std::system_category(), "munmap failed");
        }
        make_invalid();
    }
}
inline void osmium::util::MemoryMapping::unmap() {
    if (is_valid()) {
        if (! UnmapViewOfFile(m_addr)) {
            throw std::system_error(GetLastError(), std::system_category(), "UnmapViewOfFile failed");
        }
        make_invalid();
    }

    if (m_handle) {
        if (! CloseHandle(m_handle)) {
            throw std::system_error(GetLastError(), std::system_category(), "CloseHandle failed");
        }
        m_handle = nullptr;
    }
}
Example #5
0
int BF_DisposeBlock(int fileDesc,int *blockNum)
{
    int j;

    if(of_table[fileDesc].isfree==0){
       BF_errno=-14;
       return BF_errno;//Error -> Lathos fileDesc 
    }
    if(is_valid(of_table[fileDesc].header_ptr->ofhead->bitmaptable,(*blockNum))==0){
       BF_errno=-11;
       return BF_errno;//Error -> To block me arithmo blockNum den einai valid 
    }
    //Koitaw an to dosmeno block yparxei sth mnhmh
    for(j=0;j<BF_BUFFER_SIZE;j++){
       if((strcmp(buffer[j].fname,of_table[fileDesc].header_ptr->fname)==0)&& buffer[j].blockNum==(*blockNum+1) && buffer[j].isfree==1){
              if(buffer[j].ispinned!=0){
              BF_errno=-3;
              return BF_errno;//To block einai karfwmeno sthn endiamesh mnhmh
           }
           buffer[j].isfree=0;//Alliws adeiazw th thesh sth mnhmh
	       break;
       }
    }
    //Kanw 0 th thesh tou block sto bitmap kai enhmerwnw to header tou arxeiou
    make_invalid(of_table[fileDesc].header_ptr->ofhead->bitmaptable,*blockNum);
    if((fseek(of_table[fileDesc].fp,0,SEEK_SET))!=0){
            BF_errno=-6;
            return BF_errno;//Error stin fseek
    }
    fwrite(of_table[fileDesc].header_ptr->ofhead,BF_BLOCK_SIZE,1,of_table[fileDesc].fp);
    if((fseek(of_table[fileDesc].fp,0,SEEK_SET))!=0){
       BF_errno=-6;
       return BF_errno;//Error stin fseek
    }
    BF_errno=0;
    return BF_errno;//Epityxia
}
Example #6
0
    void close()
    {
        CLOSE(sock);

        make_invalid();
    }