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


C++ BLI_exists函数代码示例

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


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

示例1: movieclip_calc_length

static void movieclip_calc_length(MovieClip *clip)
{
    if (clip->source == MCLIP_SRC_MOVIE) {
        movieclip_open_anim_file(clip);

        if (clip->anim) {
            clip->len = IMB_anim_get_duration(clip->anim, clip->proxy.tc);
        }
    }
    else if (clip->source == MCLIP_SRC_SEQUENCE) {
        int framenr = 1;
        unsigned short numlen;
        char name[FILE_MAX], head[FILE_MAX], tail[FILE_MAX];

        BLI_stringdec(clip->name, head, tail, &numlen);

        if (numlen == 0) {
            /* there's no number group in file name, assume it's single framed sequence */
            clip->len = framenr + 1;
        }
        else {
            for (;; ) {
                get_sequence_fname(clip, framenr, name);

                if (!BLI_exists(name)) {
                    clip->len = framenr + 1;
                    break;
                }

                framenr++;
            }
        }
    }
}
开发者ID:nttputus,项目名称:blensor,代码行数:34,代码来源:movieclip.c

示例2: BLI_recurdir_fileops

void BLI_recurdir_fileops(char *dirname) {
	char *lslash;
	char tmp[MAXPATHLEN];
	
	// First remove possible slash at the end of the dirname.
	// This routine otherwise tries to create
	// blah1/blah2/ (with slash) after creating
	// blah1/blah2 (without slash)

	strcpy(tmp, dirname);
	lslash= BLI_last_slash(tmp);

	if (lslash == tmp + strlen(tmp) - 1) {
		*lslash = 0;
	}
	
	if (BLI_exists(tmp)) return;
		
	lslash= BLI_last_slash(tmp);
	if (lslash) {
			/* Split about the last slash and recurse */	
		*lslash = 0;
		BLI_recurdir_fileops(tmp);
	}
	
	if(dirname[0]) /* patch, this recursive loop tries to create a nameless directory */
		if (!CreateDirectory(dirname, NULL))
			callLocalErrorCallBack("Unable to create directory\n");
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:29,代码来源:fileops.c

示例3: BLI_dir_create_recursive

void BLI_dir_create_recursive(const char *dirname)
{
	char *lslash;
	size_t size;
#ifdef MAXPATHLEN
	char static_buf[MAXPATHLEN];
#endif
	char *tmp;

	if (BLI_exists(dirname)) return;

#ifdef MAXPATHLEN
	size = MAXPATHLEN;
	tmp = static_buf;
#else
	size = strlen(dirname) + 1;
	tmp = MEM_callocN(size, __func__);
#endif

	BLI_strncpy(tmp, dirname, size);
		
	lslash = (char *)BLI_last_slash(tmp);
	if (lslash) {
		/* Split about the last slash and recurse */
		*lslash = 0;
		BLI_dir_create_recursive(tmp);
	}

#ifndef MAXPATHLEN
	MEM_freeN(tmp);
#endif

	mkdir(dirname, 0777);
}
开发者ID:linkedinyou,项目名称:blender-git,代码行数:34,代码来源:fileops.c

示例4: wm_autosave_location

void wm_autosave_location(char *filepath)
{
	const int pid = abs(getpid());
	char path[1024];
#ifdef WIN32
	const char *savedir;
#endif

	if (G.main && G.relbase_valid) {
		const char *basename = BLI_path_basename(G.main->name);
		int len = strlen(basename) - 6;
		BLI_snprintf(path, sizeof(path), "%.*s.blend", len, basename);
	}
	else {
		BLI_snprintf(path, sizeof(path), "%d.blend", pid);
	}

#ifdef WIN32
	/* XXX Need to investigate how to handle default location of '/tmp/'
	 * This is a relative directory on Windows, and it may be
	 * found. Example:
	 * Blender installed on D:\ drive, D:\ drive has D:\tmp\
	 * Now, BLI_exists() will find '/tmp/' exists, but
	 * BLI_make_file_string will create string that has it most likely on C:\
	 * through get_default_root().
	 * If there is no C:\tmp autosave fails. */
	if (!BLI_exists(BKE_tempdir_base())) {
		savedir = BKE_appdir_folder_id_create(BLENDER_USER_AUTOSAVE, NULL);
		BLI_make_file_string("/", filepath, savedir, path);
		return;
	}
#endif

	BLI_make_file_string("/", filepath, BKE_tempdir_base(), path);
}
开发者ID:Moguri,项目名称:blender,代码行数:35,代码来源:wm_files.c

示例5: get_filename

static void get_filename(int argc, char **argv, char *filename)
{
#ifdef __APPLE__
    /* On Mac we park the game file (called game.blend) in the application bundle.
     * The executable is located in the bundle as well.
     * Therefore, we can locate the game relative to the executable.
     */
    int srclen = ::strlen(argv[0]);
    int len = 0;
    char *gamefile = NULL;

    filename[0] = '\0';

    if (argc > 1) {
        if (BLI_exists(argv[argc-1])) {
            BLI_strncpy(filename, argv[argc-1], FILE_MAX);
        }
        if (::strncmp(argv[argc-1], "-psn_", 5)==0) {
            static char firstfilebuf[512];
            if (GHOST_HACK_getFirstFile(firstfilebuf)) {
                BLI_strncpy(filename, firstfilebuf, FILE_MAX);
            }
        }
    }

    srclen -= ::strlen("MacOS/blenderplayer");
    if (srclen > 0) {
        len = srclen + ::strlen("Resources/game.blend");
        gamefile = new char [len + 1];
        ::strcpy(gamefile, argv[0]);
        ::strcpy(gamefile + srclen, "Resources/game.blend");
        //::printf("looking for file: %s\n", filename);

        if (BLI_exists(gamefile))
            BLI_strncpy(filename, gamefile, FILE_MAX);

        delete [] gamefile;
    }

#else
    filename[0] = '\0';

    if (argc > 1)
        BLI_strncpy(filename, argv[argc-1], FILE_MAX);
#endif // !_APPLE
}
开发者ID:akonneker,项目名称:blensor,代码行数:46,代码来源:GPG_ghost.cpp

示例6: WM_read_homefile

/* op can be NULL */
int WM_read_homefile(bContext *C, wmOperator *op)
{
	ListBase wmbase;
	char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR];
	char *home= BLI_gethome();
	int from_memory= op?RNA_boolean_get(op->ptr, "factory"):0;
	int success;
		
	BLI_clean(home);
	
	free_ttfont(); /* still weird... what does it here? */
		
	G.relbase_valid = 0;
	if (!from_memory) {
		BLI_make_file_string(G.sce, tstr, home, ".B25.blend");
	}
	strcpy(scestr, G.sce);	/* temporary store */
	
	/* prevent loading no UI */
	G.fileflags &= ~G_FILE_NO_UI;
	
	/* put aside screens to match with persistant windows later */
	wm_window_match_init(C, &wmbase); 
	
	if (!from_memory && BLI_exists(tstr)) {
		success = BKE_read_file(C, tstr, NULL, NULL);
	} else {
		success = BKE_read_file_from_memory(C, datatoc_B_blend, datatoc_B_blend_size, NULL, NULL);
		if (wmbase.first == NULL) wm_clear_default_size(C);
	}
	
	/* match the read WM with current WM */
	wm_window_match_do(C, &wmbase); 
	wm_check(C); /* opens window(s), checks keymaps */

	strcpy(G.sce, scestr); /* restore */
	
	wm_init_userdef();
	
	/* When loading factory settings, the reset solid OpenGL lights need to be applied. */
	GPU_default_lights();
	
	/* XXX */
	G.save_over = 0;	// start with save preference untitled.blend
	G.fileflags &= ~G_FILE_AUTOPLAY;	/*  disable autoplay in .B.blend... */
//	mainwindow_set_filename_to_title("");	// empty string re-initializes title to "Blender"
	
//	refresh_interface_font();
	
//	undo_editmode_clear();
	BKE_reset_undo();
	BKE_write_undo(C, "original");	/* save current state */
	
	WM_event_add_notifier(C, NC_WM|ND_FILEREAD, NULL);
	CTX_wm_window_set(C, NULL); /* exits queues */

	return OPERATOR_FINISHED;
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:59,代码来源:wm_files.c

示例7: file_directory_new_exec

int file_directory_new_exec(bContext *C, wmOperator *op)
{
	char name[FILE_MAXFILE];
	char path[FILE_MAX];
	int generate_name = 1;

	wmWindowManager *wm = CTX_wm_manager(C);
	SpaceFile *sfile = CTX_wm_space_file(C);
	
	if (!sfile->params) {
		BKE_report(op->reports, RPT_WARNING, "No parent directory given");
		return OPERATOR_CANCELLED;
	}
	
	path[0] = '\0';

	if (RNA_struct_find_property(op->ptr, "directory")) {
		RNA_string_get(op->ptr, "directory", path);
		if (path[0] != '\0') generate_name = 0;
	}

	if (generate_name) {
		/* create a new, non-existing folder name */
		if (!new_folder_path(sfile->params->dir, path, name)) {
			BKE_report(op->reports, RPT_ERROR, "Could not create new folder name");
			return OPERATOR_CANCELLED;
		}
	}

	/* create the file */
	BLI_dir_create_recursive(path);

	if (!BLI_exists(path)) {
		BKE_report(op->reports, RPT_ERROR, "Could not create new folder");
		return OPERATOR_CANCELLED;
	}

	/* now remember file to jump into editing */
	BLI_strncpy(sfile->params->renamefile, name, FILE_MAXFILE);

	/* set timer to smoothly view newly generated file */
	sfile->smoothscroll_timer = WM_event_add_timer(wm, CTX_wm_window(C), TIMER1, 1.0 / 1000.0);  /* max 30 frs/sec */
	sfile->scroll_offset = 0;

	/* reload dir to make sure we're seeing what's in the directory */
	ED_fileselect_clear(wm, sfile);

	if (RNA_boolean_get(op->ptr, "open")) {
		BLI_strncpy(sfile->params->dir, path, sizeof(sfile->params->dir));
		file_change_dir(C, 1);
	}

	WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);

	return OPERATOR_FINISHED;
}
开发者ID:manwapastorelli,项目名称:blender-git,代码行数:56,代码来源:file_ops.c

示例8: add_win32_extension

static int add_win32_extension(char *name)
{
	int retval = 0;
	int type;

	type = BLI_exists(name);
	if ((type == 0) || S_ISDIR(type)) {
#ifdef _WIN32
		char filename[FILE_MAX];
		char ext[FILE_MAX];
		const char *extensions = getenv("PATHEXT");
		if (extensions) {
			char *temp;
			do {
				strcpy(filename, name);
				temp = strstr(extensions, ";");
				if (temp) {
					strncpy(ext, extensions, temp - extensions);
					ext[temp - extensions] = 0;
					extensions = temp + 1;
					strcat(filename, ext);
				}
				else {
					strcat(filename, extensions);
				}

				type = BLI_exists(filename);
				if (type && (!S_ISDIR(type))) {
					retval = 1;
					strcpy(name, filename);
					break;
				}
			} while (temp);
		}
#endif
	}
	else {
		retval = 1;
	}

	return (retval);
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:42,代码来源:path_util.c

示例9: BKE_appdir_folder_id

static WorkspaceConfigFileData *workspace_config_file_read(const char *app_template)
{
  const char *cfgdir = BKE_appdir_folder_id(BLENDER_USER_CONFIG, app_template);
  char startup_file_path[FILE_MAX] = {0};

  if (cfgdir) {
    BLI_join_dirfile(startup_file_path, sizeof(startup_file_path), cfgdir, BLENDER_STARTUP_FILE);
  }

  bool has_path = BLI_exists(startup_file_path);
  return (has_path) ? BKE_blendfile_workspace_config_read(startup_file_path, NULL, 0, NULL) : NULL;
}
开发者ID:dfelinto,项目名称:blender,代码行数:12,代码来源:workspace_edit.c

示例10: BLI_make_existing_file

void BLI_make_existing_file(const char *name)
{
	char di[FILE_MAX], fi[FILE_MAXFILE];

	BLI_strncpy(di, name, sizeof(di));
	BLI_splitdirstring(di, fi);
	
	/* test exist */
	if (BLI_exists(di) == 0) {
		BLI_dir_create_recursive(di);
	}
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:12,代码来源:path_util.c

示例11: 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

示例12: wm_autosave_delete

void wm_autosave_delete(void)
{
	char filename[FILE_MAX];
	
	wm_autosave_location(filename);

	if (BLI_exists(filename)) {
		char str[FILE_MAX];
		BLI_make_file_string("/", str, BKE_tempdir_base(), BLENDER_QUIT_FILE);

		/* if global undo; remove tempsave, otherwise rename */
		if (U.uiflag & USER_GLOBALUNDO) BLI_delete(filename, false, false);
		else BLI_rename(filename, str);
	}
}
开发者ID:ChunHungLiu,项目名称:blender,代码行数:15,代码来源:wm_files.c

示例13: wm_autosave_delete

void wm_autosave_delete(void)
{
	char filename[FILE_MAX];
	
	wm_autosave_location(filename);

	if(BLI_exists(filename)) {
		char str[FILE_MAXDIR+FILE_MAXFILE];
		BLI_make_file_string("/", str, U.tempdir, "quit.blend");

		/* if global undo; remove tempsave, otherwise rename */
		if(U.uiflag & USER_GLOBALUNDO) BLI_delete(filename, 0, 0);
		else BLI_rename(filename, str);
	}
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:15,代码来源:wm_files.c

示例14: IMB_anim_proxy_get_existing

IMB_Proxy_Size IMB_anim_proxy_get_existing(struct anim *anim)
{
	const int num_proxy_sizes = IMB_PROXY_MAX_SLOT;
	IMB_Proxy_Size existing = 0;
	int i;
	for (i = 0; i < num_proxy_sizes; ++i) {
		IMB_Proxy_Size proxy_size = proxy_sizes[i];
		char filename[FILE_MAX];
		get_proxy_filename(anim, proxy_size, filename, false);
		if (BLI_exists(filename)) {
			existing |= proxy_size;
		}
	}
	return existing;
}
开发者ID:mgschwan,项目名称:blensor,代码行数:15,代码来源:indexer.c

示例15: file_directory_invoke

static int file_directory_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
{
	SpaceFile *sfile= CTX_wm_space_file(C);

	if(sfile->params) {
		file_expand_directory(C);
		
		if (!BLI_exists(sfile->params->dir)) {
			return WM_operator_confirm_message(C, op, "Create new directory?");
		} 

		return file_directory_exec(C, op);
	}

	return OPERATOR_CANCELLED;
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:16,代码来源:file_ops.c


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