コード例 #1
0
void ShaderEditor::_node_add_callback() {

	TreeItem * item = add_types->get_selected();
	ERR_FAIL_COND(!item);
	_node_add((VisualServer::ShaderNodeType)(int)item->get_metadata(0));
	add_popup->hide() ;
}
コード例 #2
0
void ShaderEditor::_add_node_from_text(const String& p_text) {

	ERR_FAIL_COND( p_text.get_slice_count(" ") != 3 );
	bool input = p_text.get_slice(" ",0)=="In:";
	String name = p_text.get_slice(" ",1);
	bool vec = p_text.get_slice(" ",2)=="(vec3)";

	_node_add( input?
		( vec? VisualServer::NODE_VEC_IN : VisualServer::NODE_IN ) :
		( vec? VisualServer::NODE_VEC_OUT : VisualServer::NODE_OUT ) );

	shader_graph.node_set_param( last_id-1,name );
	_write_shader_graph();
}
コード例 #3
0
ファイル: mleak_check.c プロジェクト: wlshiu/mav_gateway
//=============================================================================
//                Public Function Definition
//=============================================================================
void*
mleak_malloc(
    unsigned int        length,
    const char          *pPath,
    const unsigned int  line_num)
{
    unsigned int        total_size;
    mleak_mem_node_t    *pNode = 0;
    unsigned char       *pMem = 0;

    /*    node header   4 bytes protect     request mem     PROTECT_SIZE (n * 4 bytes)
     *  |-------------|-----------------|-----------------|----------------------------|
     */
    total_size = sizeof(mleak_mem_node_t) + 4 + length + (MLEAK_PROTECT_SIZE << 2) + 4;
    if( !(pMem = malloc(total_size)) )
    {
        _err("allocate fail !\n");
        return NULL;
    }
    memset(pMem, MLEAK_PROTECT_PATTERN, total_size);

    pNode = (mleak_mem_node_t*)(((unsigned long)(void*)pMem + 3) & ~0x3);

    pNode->verify_tag = MLEAK_VERIFY_TAG;
    pNode->prev = pNode->next = 0;

    pNode->pBase    = pMem;
    pNode->pPtr     = (unsigned char*)pNode + sizeof(mleak_mem_node_t) + 4;
    pNode->length   = length;
    pNode->line_num = line_num;
    snprintf(pNode->path, 256, "%s", pPath);

    memset(pNode->pPtr, 0x0, pNode->length);

    pthread_mutex_lock(&g_mleak_mutex);
    _node_add(pNode);
    pthread_mutex_unlock(&g_mleak_mutex);
    return pNode->pPtr;

}