当前位置: 首页>>代码示例>>C++>>正文


C++ id_us_plus函数代码示例

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


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

示例1: BKE_libblock_copy_ex

Mesh *BKE_mesh_copy_ex(Main *bmain, Mesh *me)
{
	Mesh *men;
	MTFace *tface;
	MTexPoly *txface;
	int a, i;
	const int do_tessface = ((me->totface != 0) && (me->totpoly == 0)); /* only do tessface if we have no polys */
	
	men = BKE_libblock_copy_ex(bmain, &me->id);
	
	men->mat = MEM_dupallocN(me->mat);
	for (a = 0; a < men->totcol; a++) {
		id_us_plus((ID *)men->mat[a]);
	}
	id_us_plus((ID *)men->texcomesh);

	CustomData_copy(&me->vdata, &men->vdata, CD_MASK_MESH, CD_DUPLICATE, men->totvert);
	CustomData_copy(&me->edata, &men->edata, CD_MASK_MESH, CD_DUPLICATE, men->totedge);
	CustomData_copy(&me->ldata, &men->ldata, CD_MASK_MESH, CD_DUPLICATE, men->totloop);
	CustomData_copy(&me->pdata, &men->pdata, CD_MASK_MESH, CD_DUPLICATE, men->totpoly);
	if (do_tessface) {
		CustomData_copy(&me->fdata, &men->fdata, CD_MASK_MESH, CD_DUPLICATE, men->totface);
	}
	else {
		mesh_tessface_clear_intern(men, FALSE);
	}

	BKE_mesh_update_customdata_pointers(men, do_tessface);

	/* ensure indirect linked data becomes lib-extern */
	for (i = 0; i < me->fdata.totlayer; i++) {
		if (me->fdata.layers[i].type == CD_MTFACE) {
			tface = (MTFace *)me->fdata.layers[i].data;

			for (a = 0; a < me->totface; a++, tface++)
				if (tface->tpage)
					id_lib_extern((ID *)tface->tpage);
		}
	}
	
	for (i = 0; i < me->pdata.totlayer; i++) {
		if (me->pdata.layers[i].type == CD_MTEXPOLY) {
			txface = (MTexPoly *)me->pdata.layers[i].data;

			for (a = 0; a < me->totpoly; a++, txface++)
				if (txface->tpage)
					id_lib_extern((ID *)txface->tpage);
		}
	}

	men->edit_btmesh = NULL;

	men->mselect = MEM_dupallocN(men->mselect);
	men->bb = MEM_dupallocN(men->bb);
	
	men->key = BKE_key_copy(me->key);
	if (men->key) men->key->from = (ID *)men;

	return men;
}
开发者ID:ideasman42,项目名称:blender-wayland,代码行数:60,代码来源:mesh.c

示例2: MEM_dupallocN

bActuator *copy_actuator(bActuator *act, const int flag)
{
	bActuator *actn;
	
	act->mynew=actn= MEM_dupallocN(act);
	actn->flag |= ACT_NEW;
	if (act->data) {
		actn->data= MEM_dupallocN(act->data);
	}
	
	switch (act->type) {
		case ACT_ACTION:
		case ACT_SHAPEACTION:
		{
			bActionActuator *aa = (bActionActuator *)act->data;
			if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) {
				id_us_plus((ID *)aa->act);
			}
			break;
		}
		case ACT_SOUND:
		{
			bSoundActuator *sa = (bSoundActuator *)act->data;
			if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) {
				id_us_plus((ID *)sa->sound);
			}
			break;
		}
	}
	return actn;
}
开发者ID:mgschwan,项目名称:blensor,代码行数:31,代码来源:sca.c

示例3: BKE_libblock_copy

Brush *BKE_brush_copy(Brush *brush)
{
	Brush *brushn;
	
	brushn = BKE_libblock_copy(&brush->id);

	if (brush->mtex.tex)
		id_us_plus((ID *)brush->mtex.tex);

	if (brush->mask_mtex.tex)
		id_us_plus((ID *)brush->mask_mtex.tex);

	if (brush->icon_imbuf)
		brushn->icon_imbuf = IMB_dupImBuf(brush->icon_imbuf);

	brushn->preview = NULL;

	brushn->curve = curvemapping_copy(brush->curve);

	/* enable fake user by default */
	if (!(brushn->id.flag & LIB_FAKEUSER)) {
		brushn->id.flag |= LIB_FAKEUSER;
		brushn->id.us++;
	}
	
	return brushn;
}
开发者ID:BlueLabelStudio,项目名称:blender,代码行数:27,代码来源:brush.c

示例4: MEM_dupallocN

bActuator *copy_actuator(bActuator *act)
{
	bActuator *actn;
	
	act->mynew=actn= MEM_dupallocN(act);
	actn->flag |= ACT_NEW;
	if (act->data) {
		actn->data= MEM_dupallocN(act->data);
	}
	
	switch (act->type) {
		case ACT_ACTION:
		case ACT_SHAPEACTION:
		{
			bActionActuator *aa = (bActionActuator *)act->data;
			if (aa->act)
				id_us_plus((ID *)aa->act);
			break;
		}
		case ACT_SOUND:
		{
			bSoundActuator *sa = (bSoundActuator *)act->data;
			if (sa->sound)
				id_us_plus((ID *)sa->sound);
			break;
		}
	}
	return actn;
}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:29,代码来源:sca.c

示例5: BKE_libblock_copy

Brush *BKE_brush_copy(Main *bmain, Brush *brush)
{
	Brush *brushn;
	
	brushn = BKE_libblock_copy(bmain, &brush->id);

	if (brush->mtex.tex)
		id_us_plus((ID *)brush->mtex.tex);

	if (brush->mask_mtex.tex)
		id_us_plus((ID *)brush->mask_mtex.tex);

	if (brush->paint_curve)
		id_us_plus((ID *)brush->paint_curve);

	if (brush->icon_imbuf)
		brushn->icon_imbuf = IMB_dupImBuf(brush->icon_imbuf);

	brushn->preview = NULL;

	brushn->curve = curvemapping_copy(brush->curve);

	/* enable fake user by default */
	id_fake_user_set(&brush->id);

	BKE_id_copy_ensure_local(bmain, &brush->id, &brushn->id);

	return brushn;
}
开发者ID:UPBGE,项目名称:blender,代码行数:29,代码来源:brush.c

示例6: BKE_libblock_copy_nolib

World *localize_world(World *wrld)
{
	World *wrldn;
	int a;
	
	wrldn = BKE_libblock_copy_nolib(&wrld->id, false);
	
	for (a = 0; a < MAX_MTEX; a++) {
		if (wrld->mtex[a]) {
			wrldn->mtex[a] = MEM_mallocN(sizeof(MTex), "localize_world");
			memcpy(wrldn->mtex[a], wrld->mtex[a], sizeof(MTex));
			/* free world decrements */
			id_us_plus((ID *)wrldn->mtex[a]->tex);
		}
	}

	if (wrld->nodetree)
		wrldn->nodetree = ntreeLocalize(wrld->nodetree);
	
	wrldn->preview = NULL;
	
	BLI_listbase_clear(&wrldn->gpumaterial);
	
	return wrldn;
}
开发者ID:mcgrathd,项目名称:blender,代码行数:25,代码来源:world.c

示例7: BKE_libblock_copy

World *BKE_world_copy(World *wrld)
{
	World *wrldn;
	int a;
	
	wrldn = BKE_libblock_copy(&wrld->id);
	
	for (a = 0; a < MAX_MTEX; a++) {
		if (wrld->mtex[a]) {
			wrldn->mtex[a] = MEM_mallocN(sizeof(MTex), "BKE_world_copy");
			memcpy(wrldn->mtex[a], wrld->mtex[a], sizeof(MTex));
			id_us_plus((ID *)wrldn->mtex[a]->tex);
		}
	}

	if (wrld->nodetree) {
		wrldn->nodetree = ntreeCopyTree(wrld->nodetree);
	}
	
	if (wrld->preview)
		wrldn->preview = BKE_previewimg_copy(wrld->preview);

	BLI_listbase_clear(&wrldn->gpumaterial);

	if (wrld->id.lib) {
		BKE_id_lib_local_paths(G.main, wrld->id.lib, &wrldn->id);
	}

	return wrldn;
}
开发者ID:mcgrathd,项目名称:blender,代码行数:30,代码来源:world.c

示例8: BLI_strncpy

bSound *BKE_sound_new_file_exists_ex(struct Main *bmain, const char *filepath, bool *r_exists)
{
	bSound *sound;
	char str[FILE_MAX], strtest[FILE_MAX];

	BLI_strncpy(str, filepath, sizeof(str));
	BLI_path_abs(str, bmain->name);

	/* first search an identical filepath */
	for (sound = bmain->sound.first; sound; sound = sound->id.next) {
		BLI_strncpy(strtest, sound->name, sizeof(sound->name));
		BLI_path_abs(strtest, ID_BLEND_PATH(bmain, &sound->id));

		if (BLI_path_cmp(strtest, str) == 0) {
			id_us_plus(&sound->id);  /* officially should not, it doesn't link here! */
			if (r_exists)
				*r_exists = true;
			return sound;
		}
	}

	if (r_exists)
		*r_exists = false;
	return BKE_sound_new_file(bmain, filepath);
}
开发者ID:DarkDefender,项目名称:blender-npr-tess2,代码行数:25,代码来源:sound.c

示例9: copy_libblock

/* XXX keep synced with next function */
Material *copy_material(Material *ma)
{
	Material *man;
	int a;
	
	man= copy_libblock(ma);
	
	id_lib_extern((ID *)man->group);
	
	for(a=0; a<MAX_MTEX; a++) {
		if(ma->mtex[a]) {
			man->mtex[a]= MEM_mallocN(sizeof(MTex), "copymaterial");
			memcpy(man->mtex[a], ma->mtex[a], sizeof(MTex));
			id_us_plus((ID *)man->mtex[a]->tex);
		}
	}
	
	if(ma->ramp_col) man->ramp_col= MEM_dupallocN(ma->ramp_col);
	if(ma->ramp_spec) man->ramp_spec= MEM_dupallocN(ma->ramp_spec);
	
	if (ma->preview) man->preview = BKE_previewimg_copy(ma->preview);

	if(ma->nodetree) {
		man->nodetree= ntreeCopyTree(ma->nodetree);	/* 0 == full new tree */
	}

	man->gpumaterial.first= man->gpumaterial.last= NULL;
	
	return man;
}
开发者ID:BHCLL,项目名称:blendocv,代码行数:31,代码来源:material.c

示例10: copyData

static void copyData(ModifierData *md, ModifierData *target)
{
	WeightVGEditModifierData *wmd  = (WeightVGEditModifierData *) md;
	WeightVGEditModifierData *twmd = (WeightVGEditModifierData *) target;

	BLI_strncpy(twmd->defgrp_name, wmd->defgrp_name, sizeof(twmd->defgrp_name));

	twmd->edit_flags             = wmd->edit_flags;
	twmd->falloff_type           = wmd->falloff_type;
	twmd->default_weight         = wmd->default_weight;

	twmd->cmap_curve             = curvemapping_copy(wmd->cmap_curve);

	twmd->add_threshold          = wmd->add_threshold;
	twmd->rem_threshold          = wmd->rem_threshold;

	twmd->mask_constant          = wmd->mask_constant;
	BLI_strncpy(twmd->mask_defgrp_name, wmd->mask_defgrp_name, sizeof(twmd->mask_defgrp_name));
	twmd->mask_texture           = wmd->mask_texture;
	twmd->mask_tex_use_channel   = wmd->mask_tex_use_channel;
	twmd->mask_tex_mapping       = wmd->mask_tex_mapping;
	twmd->mask_tex_map_obj       = wmd->mask_tex_map_obj;
	BLI_strncpy(twmd->mask_tex_uvlayer_name, wmd->mask_tex_uvlayer_name, sizeof(twmd->mask_tex_uvlayer_name));

	if (twmd->mask_texture) {
		id_us_plus(&twmd->mask_texture->id);
	}
}
开发者ID:Eibriel,项目名称:kiriblender,代码行数:28,代码来源:MOD_weightvgedit.c

示例11: paint_brush_set

void paint_brush_set(Paint *p, Brush *br)
{
	if (p) {
		id_us_min((ID *)p->brush);
		id_us_plus((ID *)br);
		p->brush = br;
	}
}
开发者ID:vanangamudi,项目名称:blender-main,代码行数:8,代码来源:paint.c

示例12: set_current_material_texture

void set_current_material_texture(Material *ma, Tex *newtex)
{
	Tex *tex = NULL;
	bNode *node;

	if ((ma->use_nodes && ma->nodetree) &&
	    (node = nodeGetActiveID(ma->nodetree, ID_TE)))
	{
		tex = (Tex *)node->id;
		id_us_min(&tex->id);
		if (newtex) {
			node->id = &newtex->id;
			id_us_plus(&newtex->id);
		}
		else {
			node->id = NULL;
		}
	}
	else {
		int act = (int)ma->texact;

		tex = (ma->mtex[act]) ? ma->mtex[act]->tex : NULL;
		id_us_min(&tex->id);

		if (newtex) {
			if (!ma->mtex[act]) {
				ma->mtex[act] = BKE_texture_mtex_add();
				/* Reset this slot's ON/OFF toggle, for materials, when slot was empty. */
				ma->septex &= ~(1 << act);
				/* For volumes the default UV texture coordinates are not available. */
				if (ma->material_type == MA_TYPE_VOLUME) {
					ma->mtex[act]->texco = TEXCO_ORCO;
				}
			}
			
			ma->mtex[act]->tex = newtex;
			id_us_plus(&newtex->id);
		}
		else if (ma->mtex[act]) {
			MEM_freeN(ma->mtex[act]);
			ma->mtex[act] = NULL;
		}
	}
}
开发者ID:mgschwan,项目名称:blensor,代码行数:44,代码来源:texture.c

示例13: MEM_dupallocN

RigidBodyWorld *BKE_rigidbody_world_copy(RigidBodyWorld *rbw)
{
	RigidBodyWorld *rbwn = MEM_dupallocN(rbw);

	if (rbw->effector_weights)
		rbwn->effector_weights = MEM_dupallocN(rbw->effector_weights);
	if (rbwn->group)
		id_us_plus(&rbwn->group->id);
	if (rbwn->constraints)
		id_us_plus(&rbwn->constraints->id);

	rbwn->pointcache = BKE_ptcache_copy_list(&rbwn->ptcaches, &rbw->ptcaches, FALSE);

	rbwn->objects = NULL;
	rbwn->physics_world = NULL;
	rbwn->numbodies = 0;

	return rbwn;
}
开发者ID:benkahle,项目名称:blendertests,代码行数:19,代码来源:rigidbody.c

示例14: copyData

static void copyData(ModifierData *md, ModifierData *target)
{
#if 0
	UVProjectModifierData *umd = (UVProjectModifierData *) md;
#endif
	UVProjectModifierData *tumd = (UVProjectModifierData *) target;

	modifier_copyData_generic(md, target);

	id_us_plus((ID *)tumd->image);
}
开发者ID:mgschwan,项目名称:blensor,代码行数:11,代码来源:MOD_uvproject.c

示例15: MovieClip_grease_pencil_set

void MovieClip_grease_pencil_set(PointerRNA *ptr, PointerRNA value)
{
	MovieClip *data = (MovieClip *)(ptr->data);

	if (data->gpd)
		id_us_min((ID *)data->gpd);
	if (value.data)
		id_us_plus((ID *)value.data);

	data->gpd = value.data;
}
开发者ID:akashmanna,项目名称:MyBlenderBuild,代码行数:11,代码来源:rna_movieclip_gen.c


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