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

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

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

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

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

示例1: nla_draw_strip_frames_text

/* add frame extents to cache of text-strings to draw in pixelspace * for now, only used when transforming strips */static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, View2D *v2d, float UNUSED(yminc), float ymaxc){	const float ytol = 1.0f; /* small offset to vertical positioning of text, for legibility */	const char col[4] = {220, 220, 220, 255}; /* light gray */	char numstr[32] = "";			/* Always draw times above the strip, whereas sequencer drew below + above.	 * However, we should be fine having everything on top, since these tend to be 	 * quite spaced out. 	 *	- 1 dp is compromise between lack of precision (ints only, as per sequencer)	 *	  while also preserving some accuracy, since we do use floats	 */	/* start frame */	BLI_snprintf(numstr, sizeof(numstr), "%.1f", strip->start);	UI_view2d_text_cache_add(v2d, strip->start - 1.0f, ymaxc + ytol, numstr, col);		/* end frame */	BLI_snprintf(numstr, sizeof(numstr), "%.1f", strip->end);	UI_view2d_text_cache_add(v2d, strip->end, ymaxc + ytol, numstr, col);}
开发者ID:YasirArafath,项目名称:blender-git,代码行数:24,


示例2: initglobals

void initglobals(void){	memset(&G, 0, sizeof(Global));		U.savetime = 1;	G.main = BKE_main_new();	strcpy(G.ima, "//");	if (BLENDER_SUBVERSION)		BLI_snprintf(versionstr, sizeof(versionstr), "v%d.%02d.%d", BLENDER_VERSION / 100, BLENDER_VERSION % 100, BLENDER_SUBVERSION);	else		BLI_snprintf(versionstr, sizeof(versionstr), "v%d.%02d", BLENDER_VERSION / 100, BLENDER_VERSION % 100);#ifndef WITH_PYTHON_SECURITY /* default */	G.f |= G_SCRIPT_AUTOEXEC;#else	G.f &= ~G_SCRIPT_AUTOEXEC;#endif}
开发者ID:akonneker,项目名称:blensor,代码行数:21,


示例3: unpack_generate_paths

static void unpack_generate_paths(        const char *name, ID *id, char *r_abspath, char *r_relpath, size_t abspathlen, size_t relpathlen){	char tempname[FILE_MAX];	char tempdir[FILE_MAXDIR];	BLI_split_dirfile(name, tempdir, tempname, sizeof(tempdir), sizeof(tempname));	if (tempname[0] == '/0') {		/* Note: we do not have any real way to re-create extension out of data... */		BLI_strncpy(tempname, id->name + 2, sizeof(tempname));		printf("%s/n", tempname);		BLI_filename_make_safe(tempname);		printf("%s/n", tempname);	}	if (tempdir[0] == '/0') {		/* Fallback to relative dir. */		BLI_strncpy(tempdir, "//", sizeof(tempdir));	}	switch (GS(id->name)) {		case ID_VF:			BLI_snprintf(r_relpath, relpathlen, "//fonts/%s", tempname);			break;		case ID_SO:			BLI_snprintf(r_relpath, relpathlen, "//sounds/%s", tempname);			break;		case ID_IM:			BLI_snprintf(r_relpath, relpathlen, "//textures/%s", tempname);			break;		default:			break;	}	{		size_t len = BLI_strncpy_rlen(r_abspath, tempdir, abspathlen);		BLI_strncpy(r_abspath + len, tempname, abspathlen - len);	}}
开发者ID:wchargin,项目名称:blender,代码行数:40,


示例4: handle_subversion_warning

static int handle_subversion_warning(Main *main){    if(main->minversionfile > BLENDER_VERSION ||            (main->minversionfile == BLENDER_VERSION &&             main->minsubversionfile > BLENDER_SUBVERSION)) {        char str[128];        BLI_snprintf(str, sizeof(str), "File written by newer Blender binary: %d.%d , expect loss of data!", main->minversionfile, main->minsubversionfile);// XXX		error(str);    }    return 1;}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:13,


示例5: get_proxy_filename

static void get_proxy_filename(struct anim *anim, IMB_Proxy_Size preview_size,                               char *fname, bool temp){	char index_dir[FILE_MAXDIR];	int i = IMB_proxy_size_to_array_index(preview_size);	char proxy_name[256];	char stream_suffix[20];	const char *name = (temp) ? "proxy_%d%s_part.avi" : "proxy_%d%s.avi";		stream_suffix[0] = 0;	if (anim->streamindex > 0) {		BLI_snprintf(stream_suffix, sizeof(stream_suffix), "_st%d", anim->streamindex);	}	BLI_snprintf(proxy_name, sizeof(proxy_name), name,	             (int) (proxy_fac[i] * 100), stream_suffix, anim->suffix);	get_index_dir(anim, index_dir, sizeof(index_dir));	BLI_join_dirfile(fname, FILE_MAXFILE + FILE_MAXDIR, index_dir, proxy_name);}
开发者ID:mgschwan,项目名称:blensor,代码行数:23,


示例6: edbm_bevel_update_header

static void edbm_bevel_update_header(wmOperator *op, bContext *C){	const char *str = IFACE_("Confirm: (Enter/LMB), Cancel: (Esc/RMB), Offset: %s, Segments: %d");	char msg[HEADER_LENGTH];	ScrArea *sa = CTX_wm_area(C);	if (sa) {		BevelData *opdata = op->customdata;		char offset_str[NUM_STR_REP_LEN];		if (hasNumInput(&opdata->num_input)) {			outputNumInput(&opdata->num_input, offset_str);		}		else {			BLI_snprintf(offset_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "offset"));		}		BLI_snprintf(msg, HEADER_LENGTH, str, offset_str, RNA_int_get(op->ptr, "segments"));		ED_area_headerprint(sa, msg);	}}
开发者ID:silkentrance,项目名称:blender,代码行数:23,


示例7: set_pass_name

static void set_pass_name(char *passname, int passtype, int channel, const char *view){	const char delims[] = {'.', '/0'};	const char *sep;	const char *token;	size_t len;	const char *passtype_name = name_from_passtype(passtype, channel);	if (view == NULL || view[0] == '/0') {		BLI_strncpy(passname, passtype_name, EXR_PASS_MAXNAME);		return;	}	len = BLI_str_rpartition(passtype_name, delims, &sep, &token);	if (sep) {		BLI_snprintf(passname, EXR_PASS_MAXNAME, "%.*s.%s.%s", (int)len, passtype_name, view, token);	}	else {		BLI_snprintf(passname, EXR_PASS_MAXNAME, "%s.%s", passtype_name, view);	}}
开发者ID:sntulix,项目名称:blender-api-javascript,代码行数:23,


示例8: do_node_add

static void do_node_add(bContext *C, bNodeTemplate *ntemp){	Main *bmain = CTX_data_main(C);	Scene *scene = CTX_data_scene(C);	SpaceNode *snode = CTX_wm_space_node(C);	ScrArea *sa = CTX_wm_area(C);	ARegion *ar;	bNode *node, *node_new;		/* get location to add node at mouse */	for (ar = sa->regionbase.first; ar; ar = ar->next) {		if (ar->regiontype == RGN_TYPE_WINDOW) {			wmWindow *win = CTX_wm_window(C);			int x = win->eventstate->x - ar->winrct.xmin;			int y = win->eventstate->y - ar->winrct.ymin;						if (y < 60) y += 60;			UI_view2d_region_to_view(&ar->v2d, x, y, &snode->cursor[0], &snode->cursor[1]);		}	}		/* store selection in temp test flag */	for (node = snode->edittree->nodes.first; node; node = node->next) {		if (node->flag & NODE_SELECT) node->flag |= NODE_TEST;		else node->flag &= ~NODE_TEST;	}		node_new = node_add_node(snode, bmain, scene, ntemp, snode->cursor[0], snode->cursor[1]);		/* select previous selection before autoconnect */	for (node = snode->edittree->nodes.first; node; node = node->next) {		if (node->flag & NODE_TEST) node->flag |= NODE_SELECT;	}		/* deselect after autoconnection */	for (node = snode->edittree->nodes.first; node; node = node->next) {		if (node->flag & NODE_TEST) node->flag &= ~NODE_SELECT;	}	/* once this is called from an operator, this should be removed */	if (node_new) {		char undostr[BKE_UNDO_STR_MAX];		BLI_snprintf(undostr, sizeof(undostr), "Add Node %s", nodeLabel(node_new));		BKE_write_undo(C, undostr);	}	snode_notify(C, snode);	snode_dag_update(C, snode);}
开发者ID:danielmarg,项目名称:blender-main,代码行数:49,


示例9: get_proxy_fname

/* supposed to work with sequences only */static void get_proxy_fname(MovieClip *clip, int proxy_render_size, int undistorted, int framenr, char *name){    int size = rendersize_to_number(proxy_render_size);    char dir[FILE_MAX], clipdir[FILE_MAX], clipfile[FILE_MAX];    BLI_split_dirfile(clip->name, clipdir, clipfile, FILE_MAX, FILE_MAX);    if (clip->flag & MCLIP_USE_PROXY_CUSTOM_DIR) {        BLI_strncpy(dir, clip->proxy.dir, sizeof(dir));    }    else {        BLI_snprintf(dir, FILE_MAX, "%s/BL_proxy", clipdir);    }    if (undistorted)        BLI_snprintf(name, FILE_MAX, "%s/%s/proxy_%d_undistorted/%08d", dir, clipfile, size, framenr);    else        BLI_snprintf(name, FILE_MAX, "%s/%s/proxy_%d/%08d", dir, clipfile, size, framenr);    BLI_path_abs(name, G.main->name);    BLI_path_frame(name, 1, 0);    strcat(name, ".jpg");}
开发者ID:nttputus,项目名称:blensor,代码行数:25,


示例10: pose_slide_draw_status

/* draw percentage indicator in header */static void pose_slide_draw_status(tPoseSlideOp *pso){	char status_str[UI_MAX_DRAW_STR];	char mode_str[32];		switch (pso->mode) {		case POSESLIDE_PUSH:			strcpy(mode_str, "Push Pose");			break;		case POSESLIDE_RELAX:			strcpy(mode_str, "Relax Pose");			break;		case POSESLIDE_BREAKDOWN:			strcpy(mode_str, "Breakdown");			break;				default:			/* unknown */			strcpy(mode_str, "Sliding-Tool");			break;	}		if (hasNumInput(&pso->num)) {		Scene *scene = pso->scene;		char str_offs[NUM_STR_REP_LEN];				outputNumInput(&pso->num, str_offs, &scene->unit);				BLI_snprintf(status_str, sizeof(status_str), "%s: %s", mode_str, str_offs);	}	else {		BLI_snprintf(status_str, sizeof(status_str), "%s: %d %%", mode_str, (int)(pso->percentage * 100.0f));	}		ED_area_headerprint(pso->sa, status_str);}
开发者ID:UPBGE,项目名称:blender,代码行数:37,


示例11: fluidsim_find_lastframe

static int fluidsim_find_lastframe(FluidsimSettings *fss){	char targetDir[FILE_MAXFILE+FILE_MAXDIR], targetFile[FILE_MAXFILE+FILE_MAXDIR];	int curFrame = 1;	BLI_snprintf(targetDir, sizeof(targetDir), "%sfluidsurface_final_####.bobj.gz", fss->surfdataPath);	BLI_path_abs(targetDir, G.main->name);	do {		BLI_strncpy(targetFile, targetDir, sizeof(targetFile));		BLI_path_frame(targetFile, curFrame++, 0);	} while(BLI_exist(targetFile));	return curFrame - 1;}
开发者ID:BHCLL,项目名称:blendocv,代码行数:15,


示例12: unit_scale_str

static int unit_scale_str(char *str, int len_max, char *str_tmp, double scale_pref, bUnitDef *unit,                          const char *replace_str){	char *str_found;	if ((len_max > 0) && (str_found = (char *)unit_find_str(str, replace_str))) {		/* XXX - investigate, does not respect len_max properly  */		int len, len_num, len_name, len_move, found_ofs;		found_ofs = (int)(str_found - str);		len = strlen(str);		len_name = strlen(replace_str);		len_move = (len - (found_ofs + len_name)) + 1; /* 1+ to copy the string terminator */		len_num = BLI_snprintf(str_tmp, TEMP_STR_SIZE, "*%g"SEP_STR, unit->scalar / scale_pref); /* # removed later */		if (len_num > len_max)			len_num = len_max;		if (found_ofs + len_num + len_move > len_max) {			/* can't move the whole string, move just as much as will fit */			len_move -= (found_ofs + len_num + len_move) - len_max;		}		if (len_move > 0) {			/* resize the last part of the string */			memmove(str_found + len_num, str_found + len_name, len_move); /* may grow or shrink the string */		}		if (found_ofs + len_num > len_max) {			/* not even the number will fit into the string, only copy part of it */			len_num -= (found_ofs + len_num) - len_max;		}		if (len_num > 0) {			/* its possible none of the number could be copied in */			memcpy(str_found, str_tmp, len_num); /* without the string terminator */		}		/* since the null terminator wont be moved if the stringlen_max		 * was not long enough to fit everything in it */		str[len_max - 1] = '/0';		return found_ofs + len_num;	}	return 0;}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:48,


示例13: ui_imageuser_slot_menu

static void ui_imageuser_slot_menu(bContext *UNUSED(C), uiLayout *layout, void *image_p){  uiBlock *block = uiLayoutGetBlock(layout);  Image *image = image_p;  int slot_id;  uiDefBut(block,           UI_BTYPE_LABEL,           0,           IFACE_("Slot"),           0,           0,           UI_UNIT_X * 5,           UI_UNIT_Y,           NULL,           0.0,           0.0,           0,           0,           "");  uiItemS(layout);  slot_id = BLI_listbase_count(&image->renderslots) - 1;  for (RenderSlot *slot = image->renderslots.last; slot; slot = slot->prev) {    char str[64];    if (slot->name[0] != '/0') {      BLI_strncpy(str, slot->name, sizeof(str));    }    else {      BLI_snprintf(str, sizeof(str), IFACE_("Slot %d"), slot_id + 1);    }    uiDefButS(block,              UI_BTYPE_BUT_MENU,              B_NOP,              str,              0,              0,              UI_UNIT_X * 5,              UI_UNIT_X,              &image->render_slot,              (float)slot_id,              0.0,              0,              -1,              "");    slot_id--;  }}
开发者ID:dfelinto,项目名称:blender,代码行数:48,


示例14: BPY_modules_load_user

void BPY_modules_load_user(bContext *C){	PyGILState_STATE gilstate;	Main *bmain = CTX_data_main(C);	Text *text;	/* can happen on file load */	if (bmain == NULL)		return;	/* update pointers since this can run from a nested script	 * on file load */	if (py_call_level) {		BPY_context_update(C);	}	bpy_context_set(C, &gilstate);	for (text = bmain->text.first; text; text = text->id.next) {		if (text->flags & TXT_ISSCRIPT && BLI_testextensie(text->id.name + 2, ".py")) {			if (!(G.f & G_SCRIPT_AUTOEXEC)) {				if (!(G.f & G_SCRIPT_AUTOEXEC_FAIL_QUIET)) {					G.f |= G_SCRIPT_AUTOEXEC_FAIL;					BLI_snprintf(G.autoexec_fail, sizeof(G.autoexec_fail), "Text '%s'", text->id.name + 2);					printf("scripts disabled for /"%s/", skipping '%s'/n", bmain->name, text->id.name + 2);				}			}			else {				PyObject *module = bpy_text_import(text);				if (module == NULL) {					PyErr_Print();					PyErr_Clear();				}				else {					Py_DECREF(module);				}				/* check if the script loaded a new file */				if (bmain != CTX_data_main(C)) {					break;				}			}		}	}	bpy_context_clear(C, &gilstate);}
开发者ID:UPBGE,项目名称:blender,代码行数:48,


示例15: MEM_callocN

BoidState *boid_new_state(BoidSettings *boids){	BoidState *state = MEM_callocN(sizeof(BoidState), "BoidState");	state->id = boids->last_state_id++;	if (state->id)		BLI_snprintf(state->name, sizeof(state->name), "State %i", state->id);	else		strcpy(state->name, "State");	state->rule_fuzziness = 0.5;	state->volume = 1.0f;	state->channels |= ~0;	return state;}
开发者ID:Andrewson3D,项目名称:blender-for-vray,代码行数:16,


示例16: edittranslation_find_po_file

/** * EditTranslation utility funcs and operator, * /note: this includes utility functions and button matching checks. * this only works in conjunction with a py operator! */static void edittranslation_find_po_file(const char *root,                                         const char *uilng,                                         char *path,                                         const size_t maxlen){  char tstr[32]; /* Should be more than enough! */  /* First, full lang code. */  BLI_snprintf(tstr, sizeof(tstr), "%s.po", uilng);  BLI_join_dirfile(path, maxlen, root, uilng);  BLI_path_append(path, maxlen, tstr);  if (BLI_is_file(path)) {    return;  }  /* Now try without the second iso code part (_ES in es_ES). */  {    const char *tc = NULL;    size_t szt = 0;    tstr[0] = '/0';    tc = strchr(uilng, '_');    if (tc) {      szt = tc - uilng;      if (szt < sizeof(tstr)) {            /* Paranoid, should always be true! */        BLI_strncpy(tstr, uilng, szt + 1); /* +1 for '/0' char! */      }    }    if (tstr[0]) {      /* Because of some codes like [email
C++ BLI_sprintfN函数代码示例
C++ BLI_remlink函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。