• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ BLI_strdup函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: MEM_mallocN

static GHashKey *_ghashutil_keyalloc(const void *msgctxt, const void *msgid)
{
	GHashKey *key = MEM_mallocN(sizeof(GHashKey), "Py i18n GHashKey");
	key->msgctxt = BLI_strdup(BLT_is_default_context(msgctxt) ? BLT_I18NCONTEXT_DEFAULT_BPYRNA : msgctxt);
	key->msgid = BLI_strdup(msgid);
	return key;
}
开发者ID:diekev,项目名称:blender,代码行数:7,代码来源:bpy_app_translations.c


示例2: FT_New_Face

FontBLF *blf_font_new(const char *name, const char *filename)
{
	FontBLF *font;
	FT_Error err;
	char *mfile;

	font = (FontBLF *)MEM_callocN(sizeof(FontBLF), "blf_font_new");
	err = FT_New_Face(ft_lib, filename, 0, &font->face);
	if (err) {
		MEM_freeN(font);
		return NULL;
	}

	err = FT_Select_Charmap(font->face, ft_encoding_unicode);
	if (err) {
		printf("Can't set the unicode character map!\n");
		FT_Done_Face(font->face);
		MEM_freeN(font);
		return NULL;
	}

	mfile = blf_dir_metrics_search(filename);
	if (mfile) {
		err = FT_Attach_File(font->face, mfile);
		if (err) {
			fprintf(stderr, "FT_Attach_File failed to load '%s' with error %d\n", filename, (int)err);
		}
		MEM_freeN(mfile);
	}

	font->name = BLI_strdup(name);
	font->filename = BLI_strdup(filename);
	blf_font_fill(font);
	return font;
}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:35,代码来源:blf_font.c


示例3: IMB_metadata_add_field

int IMB_metadata_add_field(struct ImBuf* img, const char* key, const char* field)
{
	ImMetaData *info;
	ImMetaData *last;

	if (!img)
		return 0;

	if (!img->metadata) {
		img->metadata = MEM_callocN(sizeof(ImMetaData), "ImMetaData");
		info = img->metadata;
	} else {
		info = img->metadata;
		last = info;
		while (info) {
			last = info;
			info = info->next;
		}
		info = MEM_callocN(sizeof(ImMetaData), "ImMetaData");
		last->next = info;
	}
	info->key = BLI_strdup(key);
	info->value = BLI_strdup(field);
	return 1;
}
开发者ID:mik0001,项目名称:Blender,代码行数:25,代码来源:metadata.c


示例4: BLI_strdup

static char *rna_VertexPaint_path(PointerRNA *ptr)
{
	Scene *scene = (Scene *)ptr->id.data;
	ToolSettings *ts = scene->toolsettings;
	if (ptr->data == ts->vpaint) {
		return BLI_strdup("tool_settings.vertex_paint");
	}
	else {
		return BLI_strdup("tool_settings.weight_paint");
	}
}
开发者ID:244xiao,项目名称:blender,代码行数:11,代码来源:rna_sculpt_paint.c


示例5: BLI_strdup

static char *strip_last_slash(const char *dir)
{
	char *result = BLI_strdup(dir);
	BLI_del_slash(result);

	return result;
}
开发者ID:linkedinyou,项目名称:blender-git,代码行数:7,代码来源:fileops.c


示例6: BLI_strdup

/* Some font have additional file with metrics information,
 * in general, the extension of the file is: .afm or .pfm
 */
char *blf_dir_metrics_search(const char *filename)
{
	char *mfile;
	char *s;

	mfile = BLI_strdup(filename);
	s = strrchr(mfile, '.');
	if (s) {
		if (BLI_strnlen(s, 4) < 4) {
			MEM_freeN(mfile);
			return NULL;
		}
		s++;
		s[0] = 'a';
		s[1] = 'f';
		s[2] = 'm';

		/* first check .afm */
		if (BLI_exists(mfile))
			return mfile;

		/* and now check .pfm */
		s[0] = 'p';

		if (BLI_exists(mfile))
			return mfile;
	}
	MEM_freeN(mfile);
	return NULL;
}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:33,代码来源:blf_dir.c


示例7: FT_New_Memory_Face

FontBLF *blf_font_new_from_mem(const char *name, const unsigned char *mem, int mem_size)
{
	FontBLF *font;
	FT_Error err;

	font = (FontBLF *)MEM_callocN(sizeof(FontBLF), "blf_font_new_from_mem");
	err = FT_New_Memory_Face(ft_lib, mem, mem_size, 0, &font->face);
	if (err) {
		MEM_freeN(font);
		return NULL;
	}

	err = FT_Select_Charmap(font->face, ft_encoding_unicode);
	if (err) {
		printf("Can't set the unicode character map!\n");
		FT_Done_Face(font->face);
		MEM_freeN(font);
		return NULL;
	}

	font->name = BLI_strdup(name);
	font->filename = NULL;
	blf_font_fill(font);
	return font;
}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:25,代码来源:blf_font.c


示例8: wm_history_file_read

void wm_history_file_read(void)
{
	char name[FILE_MAX];
	LinkNode *l, *lines;
	struct RecentFile *recent;
	const char *line;
	int num;
	const char * const cfgdir = BKE_appdir_folder_id(BLENDER_USER_CONFIG, NULL);

	if (!cfgdir) return;

	BLI_make_file_string("/", name, cfgdir, BLENDER_HISTORY_FILE);

	lines = BLI_file_read_as_lines(name);

	BLI_listbase_clear(&G.recent_files);

	/* read list of recent opened files from recent-files.txt to memory */
	for (l = lines, num = 0; l && (num < U.recent_files); l = l->next) {
		line = l->link;
		/* don't check if files exist, causes slow startup for remote/external drives */
		if (line[0]) {
			recent = (RecentFile *)MEM_mallocN(sizeof(RecentFile), "RecentFile");
			BLI_addtail(&(G.recent_files), recent);
			recent->filepath = BLI_strdup(line);
			num++;
		}
	}
	
	BLI_file_free_lines(lines);
}
开发者ID:ChunHungLiu,项目名称:blender,代码行数:31,代码来源:wm_files.c


示例9: BKE_animdata_from_id

static char *rna_NlaStrip_path(PointerRNA *ptr)
{
	NlaStrip *strip = (NlaStrip *)ptr->data;
	AnimData *adt = BKE_animdata_from_id(ptr->id.data);
	
	/* if we're attached to AnimData, try to resolve path back to AnimData */
	if (adt) {
		NlaTrack *nlt;
		NlaStrip *nls;
		
		for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
			for (nls = nlt->strips.first; nls; nls = nls->next) {
				if (nls == strip) {
					/* XXX but if we animate like this, the control will never work... */
					char name_esc_nlt[sizeof(nlt->name) * 2];
					char name_esc_strip[sizeof(strip->name) * 2];

					BLI_strescape(name_esc_nlt, nlt->name, sizeof(name_esc_nlt));
					BLI_strescape(name_esc_strip, strip->name, sizeof(name_esc_strip));
					return BLI_sprintfN("animation_data.nla_tracks[\"%s\"].strips[\"%s\"]",
					                    name_esc_nlt, name_esc_strip);
				}
			}
		}
	}
	
	/* no path */
	return BLI_strdup("");
}
开发者ID:mgschwan,项目名称:blensor,代码行数:29,代码来源:rna_nla.c


示例10: BLT_lang_locale_explode

/* Get locale's elements (if relevant pointer is not NULL and element actually exists, e.g. if there is no variant,
 * *variant and *language_variant will always be NULL).
 * Non-null elements are always MEM_mallocN'ed, it's the caller's responsibility to free them.
 * NOTE: Keep that one always available, you never know, may become useful even in no-WITH_INTERNATIONAL context...
 */
void BLT_lang_locale_explode(
        const char *locale, char **language, char **country, char **variant,
        char **language_country, char **language_variant)
{
	char *m1, *m2, *_t = NULL;

	m1 = strchr(locale, '_');
	m2 = strchr(locale, '@');

	if (language || language_variant) {
		if (m1 || m2) {
			_t = m1 ? BLI_strdupn(locale, m1 - locale) : BLI_strdupn(locale, m2 - locale);
			if (language)
				*language = _t;
		}
		else if (language) {
			*language = BLI_strdup(locale);
		}
	}
	if (country) {
		if (m1)
			*country = m2 ? BLI_strdupn(m1 + 1, m2 - (m1 + 1)) : BLI_strdup(m1 + 1);
		else
			*country = NULL;
	}
	if (variant) {
		if (m2)
			*variant = BLI_strdup(m2 + 1);
		else
			*variant = NULL;
	}
	if (language_country) {
		if (m1)
			*language_country = m2 ? BLI_strdupn(locale, m2 - locale) : BLI_strdup(locale);
		else
			*language_country = NULL;
	}
	if (language_variant) {
		if (m2)
			*language_variant = m1 ? BLI_strdupcat(_t, m2) : BLI_strdup(locale);
		else
			*language_variant = NULL;
	}
	if (_t && !language) {
		MEM_freeN(_t);
	}
}
开发者ID:wchargin,项目名称:blender,代码行数:52,代码来源:blt_lang.c


示例11: switch

static char *rna_ImageUser_path(PointerRNA *ptr)
{
	if (ptr->id.data) {
		/* ImageUser *iuser = ptr->data; */
		
		switch (GS(((ID *)ptr->id.data)->name)) {
			case ID_TE:
			{
				return BLI_strdup("image_user");
			}
			case ID_NT:
			{
				return rna_Node_ImageUser_path(ptr);
			}
		}
	}
	
	return BLI_strdup("");
}
开发者ID:silkentrance,项目名称:blender,代码行数:19,代码来源:rna_image.c


示例12: node_dynamic_register_type

static void node_dynamic_register_type(bNode *node)
{
	nodeRegisterType(&node_all_shaders, node->typeinfo);
	/* nodeRegisterType copied it to a new one, so we
	 * free the typeinfo itself, but not what it
	 * points to: */
	MEM_freeN(node->typeinfo);
	node->typeinfo = node_dynamic_find_typeinfo(&node_all_shaders, node->id);
	MEM_freeN(node->typeinfo->name);
	node->typeinfo->name = BLI_strdup(node->name);
}
开发者ID:mik0001,项目名称:Blender,代码行数:11,代码来源:node_shader_dynamic.c


示例13: MEM_callocN

static ConsoleLine *console_lb_add_str__internal(ListBase *lb, char *str, bool own)
{
	ConsoleLine *ci = MEM_callocN(sizeof(ConsoleLine), "ConsoleLine Add");
	if (own) ci->line = str;
	else ci->line = BLI_strdup(str);
	
	ci->len = ci->len_alloc = strlen(str);
	
	BLI_addtail(lb, ci);
	return ci;
}
开发者ID:mistajuliax,项目名称:OctaneBlender,代码行数:11,代码来源:console_ops.c


示例14: rna_ksPath_RnaPath_set

static void rna_ksPath_RnaPath_set(PointerRNA *ptr, const char *value)
{
	KS_Path *ksp = (KS_Path *)ptr->data;

	if (ksp->rna_path)
		MEM_freeN(ksp->rna_path);
	
	if (value[0])
		ksp->rna_path = BLI_strdup(value);
	else
		ksp->rna_path = NULL;
}
开发者ID:244xiao,项目名称:blender,代码行数:12,代码来源:rna_animation.c


示例15: RE_engine_set_error_message

void RE_engine_set_error_message(RenderEngine *engine, const char *msg)
{
	Render *re = engine->re;
	if (re != NULL) {
		RenderResult *rr = RE_AcquireResultRead(re);
		if (rr->error != NULL) {
			MEM_freeN(rr->error);
		}
		rr->error = BLI_strdup(msg);
		RE_ReleaseResult(re);
	}
}
开发者ID:akonneker,项目名称:blensor,代码行数:12,代码来源:external_engine.c


示例16: rna_FCurve_RnaPath_set

static void rna_FCurve_RnaPath_set(PointerRNA *ptr, const char *value)
{
	FCurve *fcu= (FCurve *)ptr->data;

	if (fcu->rna_path)
		MEM_freeN(fcu->rna_path);
	
	if (strlen(value))
		fcu->rna_path= BLI_strdup(value);
	else 
		fcu->rna_path= NULL;
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:12,代码来源:rna_fcurve.c


示例17: rna_Text_filename_set

static void rna_Text_filename_set(PointerRNA *ptr, const char *value)
{
	Text *text= (Text*)ptr->data;

	if(text->name)
		MEM_freeN(text->name);

	if(value[0])
		text->name= BLI_strdup(value);
	else
		text->name= NULL;
}
开发者ID:mik0001,项目名称:Blender,代码行数:12,代码来源:rna_text.c


示例18: BLF_dir_add

void BLF_dir_add(const char *path)
{
	DirBLF *dir;
	
	dir = blf_dir_find(path);
	if (dir) /* already in the list ? just return. */
		return;
	
	dir = (DirBLF *)MEM_callocN(sizeof(DirBLF), "BLF_dir_add");
	dir->path = BLI_strdup(path);
	BLI_addhead(&global_font_dir, dir);
}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:12,代码来源:blf_dir.c


示例19: rna_DriverTarget_RnaPath_set

static void rna_DriverTarget_RnaPath_set(PointerRNA *ptr, const char *value)
{
	DriverTarget *dtar= (DriverTarget *)ptr->data;
	
	// XXX in this case we need to be very careful, as this will require some new dependencies to be added!
	if (dtar->rna_path)
		MEM_freeN(dtar->rna_path);
	
	if (strlen(value))
		dtar->rna_path= BLI_strdup(value);
	else 
		dtar->rna_path= NULL;
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:13,代码来源:rna_fcurve.c


示例20: BLI_join_dirfile

char *blf_dir_search(const char *file)
{
	DirBLF *dir;
	char full_path[FILE_MAX];
	char *s = NULL;

	for (dir = global_font_dir.first; dir; dir = dir->next) {
		BLI_join_dirfile(full_path, sizeof(full_path), dir->path, file);
		if (BLI_exists(full_path)) {
			s = BLI_strdup(full_path);
			break;
		}
	}

	if (!s) {
		/* check the current directory, why not ? */
		if (BLI_exists(file))
			s = BLI_strdup(file);
	}

	return s;
}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:22,代码来源:blf_dir.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BLK_SKIP函数代码示例发布时间:2022-05-30
下一篇:
C++ BLI_sprintfN函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap