您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ BLI_ghash_lookup函数代码示例

51自学网 2021-06-01 19:51:09
  C++
这篇教程C++ BLI_ghash_lookup函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中BLI_ghash_lookup函数的典型用法代码示例。如果您正苦于以下问题:C++ BLI_ghash_lookup函数的具体用法?C++ BLI_ghash_lookup怎么用?C++ BLI_ghash_lookup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了BLI_ghash_lookup函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: strand_shade_get

static void strand_shade_get(Render *re, StrandShadeCache *cache, ShadeSample *ssamp, StrandSegment *sseg, StrandVert *svert){	StrandCacheEntry *entry;	StrandPoint p;	int *refcount;	GHashPair pair = strand_shade_hash_pair(sseg->obi, svert);	entry= BLI_ghash_lookup(cache->resulthash, &pair);	refcount= BLI_ghash_lookup(cache->refcounthash, &pair);	if (!entry) {		/* not shaded yet, shade and insert into hash */		p.t= (sseg->v[1] == svert)? 0.0f: 1.0f;		strand_eval_point(sseg, &p);		strand_shade_point(re, ssamp, sseg, svert, &p);		entry= MEM_callocN(sizeof(StrandCacheEntry), "StrandCacheEntry");		entry->pair = pair;		entry->shr = ssamp->shr[0];		BLI_ghash_insert(cache->resulthash, entry, entry);	}	else		/* already shaded, just copy previous result from hash */		ssamp->shr[0]= entry->shr;		/* lower reference count and remove if not needed anymore by any samples */	(*refcount)--;	if (*refcount == 0) {		BLI_ghash_remove(cache->resulthash, &pair, (GHashKeyFreeFP)MEM_freeN, NULL);		BLI_ghash_remove(cache->refcounthash, &pair, NULL, NULL);	}}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:32,


示例2: if

BME_TransData *BME_assign_transdata(BME_TransData_Head *td, BME_Mesh *bm, BME_Vert *v,		float *co, float *org, float *vec, float *loc,		float factor, float weight, float maxfactor, float *max) {	BME_TransData *vtd;	int is_new = 0;	if (v == NULL) return NULL;	if ((vtd = BLI_ghash_lookup(td->gh, v)) == NULL && bm != NULL) {		vtd = BLI_memarena_alloc(td->ma, sizeof(*vtd));		BLI_ghash_insert(td->gh, v, vtd);		td->len++;		is_new = 1;	}	vtd->bm = bm;	vtd->v = v;	if (co != NULL) VECCOPY(vtd->co,co);	if (org == NULL && is_new) { VECCOPY(vtd->org,v->co); } /* default */	else if (org != NULL) VECCOPY(vtd->org,org);	if (vec != NULL) {		VECCOPY(vtd->vec,vec);		normalize_v3(vtd->vec);	}	vtd->loc = loc;	vtd->factor = factor;	vtd->weight = weight;	vtd->maxfactor = maxfactor;	vtd->max = max;	return vtd;}
开发者ID:zakharov,项目名称:blenderColladaKinematics,代码行数:33,


示例3: ghash_insert_link

static bool ghash_insert_link(        GHash *gh, void *key, void *val, bool use_test,        MemArena *mem_arena){	struct LinkBase *ls_base;	LinkNode *ls;	ls_base = BLI_ghash_lookup(gh, key);	if (ls_base) {		if (use_test && (BLI_linklist_index(ls_base->list, key) != -1)) {			return false;		}	}	else {		ls_base = BLI_memarena_alloc(mem_arena, sizeof(*ls_base));		ls_base->list     = NULL;		ls_base->list_len = 0;		BLI_ghash_insert(gh, key, ls_base);	}	ls = BLI_memarena_alloc(mem_arena, sizeof(*ls));	ls->next = ls_base->list;	ls->link = val;	ls_base->list = ls;	ls_base->list_len += 1;	return true;}
开发者ID:pawkoz,项目名称:dyplom,代码行数:29,


示例4: BLI_ghash_str_new

bool *BKE_objdef_validmap_get(Object *ob, const int defbase_tot){	bDeformGroup *dg;	ModifierData *md;	bool *vgroup_validmap;	GHash *gh;	int i, step1 = 1;	//int defbase_tot = BLI_countlist(&ob->defbase);	if (ob->defbase.first == NULL) {		return NULL;	}	gh = BLI_ghash_str_new("BKE_objdef_validmap_get gh");	/* add all names to a hash table */	for (dg = ob->defbase.first; dg; dg = dg->next) {		BLI_ghash_insert(gh, dg->name, NULL);	}	BLI_assert(BLI_ghash_size(gh) == defbase_tot);	/* now loop through the armature modifiers and identify deform bones */	for (md = ob->modifiers.first; md; md = !md->next && step1 ? (step1 = 0), modifiers_getVirtualModifierList(ob) : md->next) {		if (!(md->mode & (eModifierMode_Realtime | eModifierMode_Virtual)))			continue;		if (md->type == eModifierType_Armature) {			ArmatureModifierData *amd = (ArmatureModifierData *) md;			if (amd->object && amd->object->pose) {				bPose *pose = amd->object->pose;				bPoseChannel *chan;				for (chan = pose->chanbase.first; chan; chan = chan->next) {					if (chan->bone->flag & BONE_NO_DEFORM)						continue;					if (BLI_ghash_remove(gh, chan->name, NULL, NULL)) {						BLI_ghash_insert(gh, chan->name, SET_INT_IN_POINTER(1));					}				}			}		}	}	vgroup_validmap = MEM_mallocN(sizeof(*vgroup_validmap) * defbase_tot, "wpaint valid map");	/* add all names to a hash table */	for (dg = ob->defbase.first, i = 0; dg; dg = dg->next, i++) {		vgroup_validmap[i] = (BLI_ghash_lookup(gh, dg->name) != NULL);	}	BLI_assert(i == BLI_ghash_size(gh));	BLI_ghash_free(gh, NULL, NULL);	return vgroup_validmap;}
开发者ID:244xiao,项目名称:blender,代码行数:59,


示例5: view_layer_bases_hash_create

Base *BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob){  if (!view_layer->object_bases_hash) {    view_layer_bases_hash_create(view_layer);  }  return BLI_ghash_lookup(view_layer->object_bases_hash, ob);}
开发者ID:dfelinto,项目名称:blender,代码行数:8,


示例6: BLI_ghash_str_new

GPUFunction *GPU_lookup_function(const char *name){	if (!FUNCTION_HASH) {		FUNCTION_HASH = BLI_ghash_str_new("GPU_lookup_function gh");		gpu_parse_functions_string(FUNCTION_HASH, glsl_material_library);	}	return (GPUFunction*)BLI_ghash_lookup(FUNCTION_HASH, (void *)name);}
开发者ID:ilent2,项目名称:Blender-Billboard-Modifier,代码行数:9,


示例7: BLI_ghash_lookup

static bArgument *lookUp(struct bArgs *ba, const char *arg, int pass, int case_str){	bAKey key;	key.case_str = case_str;	key.pass = pass;	key.arg = arg;	return BLI_ghash_lookup(ba->items, &key);}
开发者ID:danielmarg,项目名称:blender-main,代码行数:10,


示例8: debug_data_insert

static void debug_data_insert(SimDebugData *debug_data, SimDebugElement *elem){	SimDebugElement *old_elem = BLI_ghash_lookup(debug_data->gh, elem);	if (old_elem) {		*old_elem = *elem;		MEM_freeN(elem);	}	else		BLI_ghash_insert(debug_data->gh, elem, elem);}
开发者ID:Rojuinex,项目名称:Blender,代码行数:10,


示例9: BLI_ghash_lookup

/** * Return a pointer to the pose channel of the given name * from this pose. */bPoseChannel *BKE_pose_channel_find_name(const bPose *pose, const char *name){	if (ELEM(NULL, pose, name) || (name[0] == '/0'))		return NULL;		if (pose->chanhash)		return BLI_ghash_lookup(pose->chanhash, (const void *)name);		return BLI_findstring(&((const bPose *)pose)->chanbase, name, offsetof(bPoseChannel, name));}
开发者ID:UPBGE,项目名称:blender,代码行数:14,


示例10: BLI_ghash_lookup

static ListBase *edge_isect_ls_ensure(GHash *isect_hash, ScanFillEdge *eed){	ListBase *e_ls;	e_ls = BLI_ghash_lookup(isect_hash, eed);	if (e_ls == NULL) {		e_ls = MEM_callocN(sizeof(ListBase), __func__);		BLI_ghash_insert(isect_hash, eed, e_ls);	}	return e_ls;}
开发者ID:YasirArafath,项目名称:blender-git,代码行数:10,


示例11: BLI_ghash_str_new

GPUFunction *GPU_lookup_function(const char *name){	if (!FUNCTION_HASH) {		FUNCTION_HASH = BLI_ghash_str_new("GPU_lookup_function gh");		gpu_parse_functions_string(FUNCTION_HASH, glsl_material_library);		/*FUNCTION_PROTOTYPES = gpu_generate_function_prototyps(FUNCTION_HASH);		FUNCTION_LIB = GPU_shader_create_lib(datatoc_gpu_shader_material_glsl);*/	}	return (GPUFunction*)BLI_ghash_lookup(FUNCTION_HASH, (void *)name);}
开发者ID:danielmarg,项目名称:blender-main,代码行数:11,


示例12: BLI_assert

static TseGroup *BKE_outliner_treehash_lookup_group(GHash *th, short type, short nr, struct ID *id){	TreeStoreElem tse_template;	tse_template.type = type;	tse_template.nr = type ? nr : 0;  // we're picky! :)	tse_template.id = id;	BLI_assert(th);	return BLI_ghash_lookup(th, &tse_template);}
开发者ID:Ichthyostega,项目名称:blender,代码行数:11,


示例13: BLI_ghash_lookup

Icon *BKE_icon_get(int icon_id){	Icon *icon = NULL;	icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(icon_id));		if (!icon) {		printf("%s: Internal error, no icon for icon ID: %d/n", __func__, icon_id);		return NULL;	}	return icon;}
开发者ID:khanhha,项目名称:blender,代码行数:13,


示例14: BKE_pose_channels_is_valid

bool BKE_pose_channels_is_valid(const bPose *pose){	if (pose->chanhash) {		bPoseChannel *pchan;		for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {			if (BLI_ghash_lookup(pose->chanhash, pchan->name) != pchan) {				return false;			}		}	}	return true;}
开发者ID:UPBGE,项目名称:blender,代码行数:13,


示例15:

static unsigned int *imb_thread_cache_get_tile(ImThreadTileCache *cache, ImBuf *ibuf, int tx, int ty){	ImThreadTile *ttile, lookuptile;	ImGlobalTile *gtile, *replacetile;	int toffs= ibuf->xtiles*ty + tx;	/* test if it is already in our thread local cache */	if((ttile=cache->tiles.first)) {		/* check last used tile before going to hash */		if(ttile->ibuf == ibuf && ttile->tx == tx && ttile->ty == ty)			return ibuf->tiles[toffs];		/* find tile in hash */		lookuptile.ibuf = ibuf;		lookuptile.tx = tx;		lookuptile.ty = ty;		if((ttile=BLI_ghash_lookup(cache->tilehash, &lookuptile))) {			BLI_remlink(&cache->tiles, ttile);			BLI_addhead(&cache->tiles, ttile);			return ibuf->tiles[toffs];		}	}	/* not found, have to do slow lookup in global cache */	if(cache->unused.first == NULL) {		ttile= cache->tiles.last;		replacetile= ttile->global;		BLI_remlink(&cache->tiles, ttile);		BLI_ghash_remove(cache->tilehash, ttile, NULL, NULL);	}	else {		ttile= cache->unused.first;		replacetile= NULL;		BLI_remlink(&cache->unused, ttile);	}	BLI_addhead(&cache->tiles, ttile);	BLI_ghash_insert(cache->tilehash, ttile, ttile);	gtile= imb_global_cache_get_tile(ibuf, tx, ty, replacetile);	ttile->ibuf= gtile->ibuf;	ttile->tx= gtile->tx;	ttile->ty= gtile->ty;	ttile->global= gtile;	return ibuf->tiles[toffs];}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:50,


示例16: strand_shade_unref

void strand_shade_unref(StrandShadeCache *cache, ObjectInstanceRen *obi, StrandVert *svert){	GHashPair pair = strand_shade_hash_pair(obi, svert);	int *refcount;	/* lower reference count and remove if not needed anymore by any samples */	refcount= BLI_ghash_lookup(cache->refcounthash, &pair);	(*refcount)--;	if (*refcount == 0) {		BLI_ghash_remove(cache->resulthash, &pair, (GHashKeyFreeFP)MEM_freeN, NULL);		BLI_ghash_remove(cache->refcounthash, &pair, NULL, NULL);	}}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:14,


示例17: codegen_set_texid

/* assign only one texid per buffer to avoid sampling the same texture twice */static void codegen_set_texid(GHash *bindhash, GPUInput *input, int *texid, void *key){	if (BLI_ghash_haskey(bindhash, key)) {		/* Reuse existing texid */		input->texid = GET_INT_FROM_POINTER(BLI_ghash_lookup(bindhash, key));	}	else {		/* Allocate new texid */		input->texid = *texid;		(*texid)++;		input->bindtex = true;		BLI_ghash_insert(bindhash, key, SET_INT_IN_POINTER(input->texid));	}}
开发者ID:mcgrathd,项目名称:blender,代码行数:15,


示例18: BLI_ghash_lookup

MenuType *WM_menutype_find(const char *idname, int quiet){	MenuType* mt;	if (idname[0]) {		mt= BLI_ghash_lookup(menutypes_hash, idname);		if(mt)			return mt;	}	if(!quiet)		printf("search for unknown menutype %s/n", idname);	return NULL;}
开发者ID:mik0001,项目名称:Blender,代码行数:15,


示例19: BLI_ghash_lookup

/** * Helper function for #postEditBoneDuplicate, * return the destination pchan from the original. */static bPoseChannel *pchan_duplicate_map(const bPose *pose, GHash *name_map, bPoseChannel *pchan_src){	bPoseChannel *pchan_dst = NULL;	const char *name_src = pchan_src->name;	const char *name_dst = BLI_ghash_lookup(name_map, name_src);	if (name_dst) {		pchan_dst = BKE_pose_channel_find_name(pose, name_dst);	}	if (pchan_dst == NULL) {		pchan_dst = pchan_src;	}	return pchan_dst;}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:19,


示例20: strand_shade_refcount

static void strand_shade_refcount(StrandShadeCache *cache, StrandSegment *sseg, StrandVert *svert){	GHashPair pair = strand_shade_hash_pair(sseg->obi, svert);	GHashPair *key;	int *refcount= BLI_ghash_lookup(cache->refcounthash, &pair);	if (!refcount) {		key= BLI_memarena_alloc(cache->memarena, sizeof(GHashPair));		*key = pair;		refcount= BLI_memarena_alloc(cache->memarena, sizeof(int));		*refcount= 1;		BLI_ghash_insert(cache->refcounthash, key, refcount);	}	else		(*refcount)++;}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:16,


示例21: setMPolyMaterial

static void setMPolyMaterial(ExportMeshData *export_data,                             MPoly *mpoly,                             int which_orig_mesh){	Object *orig_object;	GHash *material_hash;	Material *orig_mat;	if (which_orig_mesh == CARVE_MESH_LEFT) {		/* No need to change materian index for faces from left operand */		return;	}	material_hash = export_data->material_hash;	orig_object = which_object(export_data, which_orig_mesh);	/* Set material, based on lookup in hash table. */	orig_mat = give_current_material(orig_object, mpoly->mat_nr + 1);	if (orig_mat) {		/* For faces from right operand check if there's requested material		 * in the left operand. And if it is, use index of that material,		 * otherwise fallback to first material (material with index=0).		 */		if (!BLI_ghash_haskey(material_hash, orig_mat)) {			int a, mat_nr;			mat_nr = 0;			for (a = 0; a < export_data->ob_left->totcol; a++) {				if (give_current_material(export_data->ob_left, a + 1) == orig_mat) {					mat_nr = a;					break;				}			}			BLI_ghash_insert(material_hash, orig_mat, SET_INT_IN_POINTER(mat_nr));			mpoly->mat_nr = mat_nr;		}		else			mpoly->mat_nr = GET_INT_FROM_POINTER(BLI_ghash_lookup(material_hash, orig_mat));	}	else {		mpoly->mat_nr = 0;	}}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:46,


示例22: BLI_ghash_lookup

uiListType *WM_uilisttype_find(const char *idname, bool quiet){	uiListType *ult;	if (idname[0]) {		ult = BLI_ghash_lookup(uilisttypes_hash, idname);		if (ult) {			return ult;		}	}	if (!quiet) {		printf("search for unknown uilisttype %s/n", idname);	}	return NULL;}
开发者ID:GeniaPenksik,项目名称:blender,代码行数:17,


示例23: get_next_free_id

/* create an id for a new icon and make sure that ids from deleted icons get reused * after the integer number range is used up */static int get_next_free_id(void){	int startId = gFirstIconId;	/* if we haven't used up the int number range, we just return the next int */	if (gNextIconId >= gFirstIconId)		return gNextIconId++;		/* now we try to find the smallest icon id not stored in the gIcons hash */	while (BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(startId)) && startId >= gFirstIconId)		startId++;	/* if we found a suitable one that isn't used yet, return it */	if (startId >= gFirstIconId)		return startId;	/* fail */	return 0;}
开发者ID:khanhha,项目名称:blender,代码行数:21,


示例24: BKE_icon_changed

void BKE_icon_changed(int id){	Icon *icon = NULL;		if (!id || G.background) return;	icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(id));		if (icon) {		PreviewImage *prv = BKE_previewimg_id_ensure((ID *)icon->obj);		/* all previews changed */		if (prv) {			int i;			for (i = 0; i < NUM_ICON_SIZES; ++i) {				prv->flag[i] |= PRV_CHANGED;				prv->changed_timestamp[i]++;			}		}	}}
开发者ID:khanhha,项目名称:blender,代码行数:21,



注:本文中的BLI_ghash_lookup函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ BLI_insertlinkbefore函数代码示例
C++ BLI_ghash_insert函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。