本文整理汇总了C++中BLI_join_dirfile函数的典型用法代码示例。如果您正苦于以下问题:C++ BLI_join_dirfile函数的具体用法?C++ BLI_join_dirfile怎么用?C++ BLI_join_dirfile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BLI_join_dirfile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: fluidsim_delete_until_lastframe
/* copied from rna_fluidsim.c: fluidsim_find_lastframe() */
static void fluidsim_delete_until_lastframe(FluidsimSettings *fss, const char *relbase)
{
char targetDir[FILE_MAX], targetFile[FILE_MAX];
char targetDirVel[FILE_MAX], targetFileVel[FILE_MAX];
char previewDir[FILE_MAX], previewFile[FILE_MAX];
int curFrame = 1, exists = 0;
BLI_join_dirfile(targetDir, sizeof(targetDir), fss->surfdataPath, OB_FLUIDSIM_SURF_FINAL_OBJ_FNAME);
BLI_join_dirfile(targetDirVel, sizeof(targetDirVel), fss->surfdataPath, OB_FLUIDSIM_SURF_FINAL_VEL_FNAME);
BLI_join_dirfile(previewDir, sizeof(previewDir), fss->surfdataPath, OB_FLUIDSIM_SURF_PREVIEW_OBJ_FNAME);
BLI_path_abs(targetDir, relbase);
BLI_path_abs(targetDirVel, relbase);
BLI_path_abs(previewDir, relbase);
do {
BLI_strncpy(targetFile, targetDir, sizeof(targetFile));
BLI_strncpy(targetFileVel, targetDirVel, sizeof(targetFileVel));
BLI_strncpy(previewFile, previewDir, sizeof(previewFile));
BLI_path_frame(targetFile, curFrame, 0);
BLI_path_frame(targetFileVel, curFrame, 0);
BLI_path_frame(previewFile, curFrame, 0);
curFrame++;
if ((exists = BLI_exists(targetFile))) {
BLI_delete(targetFile, false, false);
BLI_delete(targetFileVel, false, false);
BLI_delete(previewFile, false, false);
}
} while (exists);
return;
}
开发者ID:Bforartists,项目名称:Bforartists,代码行数:36,代码来源:physics_fluid.c
示例2: file_expand_directory
static void file_expand_directory(bContext *C)
{
SpaceFile *sfile= CTX_wm_space_file(C);
if(sfile->params) {
if ( sfile->params->dir[0] == '~' ) {
char tmpstr[sizeof(sfile->params->dir)-1];
BLI_strncpy(tmpstr, sfile->params->dir+1, sizeof(tmpstr));
BLI_join_dirfile(sfile->params->dir, sizeof(sfile->params->dir), BLI_getDefaultDocumentFolder(), tmpstr);
}
#ifdef WIN32
if (sfile->params->dir[0] == '\0') {
get_default_root(sfile->params->dir);
}
/* change "C:" --> "C:\", [#28102] */
else if ( (isalpha(sfile->params->dir[0]) &&
(sfile->params->dir[1] == ':')) &&
(sfile->params->dir[2] == '\0')
) {
sfile->params->dir[2]= '\\';
sfile->params->dir[3]= '\0';
}
#endif
}
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:27,代码来源:file_ops.c
示例3: get_path_local
/**
* Constructs in \a targetpath the name of a directory relative to a version-specific
* subdirectory in the parent directory of the Blender executable.
*
* \param targetpath String to return path
* \param folder_name Optional folder name within version-specific directory
* \param subfolder_name Optional subfolder name within folder_name
* \param ver To construct name of version-specific directory within bprogdir
* \return true if such a directory exists.
*/
static bool get_path_local(char *targetpath, const char *folder_name, const char *subfolder_name, const int ver)
{
char relfolder[FILE_MAX];
#ifdef PATH_DEBUG
printf("%s...\n", __func__);
#endif
if (folder_name) {
if (subfolder_name) {
BLI_join_dirfile(relfolder, sizeof(relfolder), folder_name, subfolder_name);
}
else {
BLI_strncpy(relfolder, folder_name, sizeof(relfolder));
}
}
else {
relfolder[0] = '\0';
}
/* try EXECUTABLE_DIR/2.5x/folder_name - new default directory for local blender installed files */
#ifdef __APPLE__
static char osx_resourses[FILE_MAX]; /* due new codesign situation in OSX > 10.9.5 we must move the blender_version dir with contents to Resources */
sprintf(osx_resourses, "%s../Resources", bprogdir);
return test_path(targetpath, osx_resourses, blender_version_decimal(ver), relfolder);
#else
return test_path(targetpath, bprogdir, blender_version_decimal(ver), relfolder);
#endif
}
开发者ID:greg100795,项目名称:blender-git,代码行数:39,代码来源:appdir.c
示例4: test_path
/**
* Concatenates path_base, (optional) path_sep and (optional) folder_name into targetpath,
* returning true if result points to a directory.
*/
static bool test_path(char *targetpath, const char *path_base, const char *path_sep, const char *folder_name)
{
char tmppath[FILE_MAX];
if (path_sep) BLI_join_dirfile(tmppath, sizeof(tmppath), path_base, path_sep);
else BLI_strncpy(tmppath, path_base, sizeof(tmppath));
/* rare cases folder_name is omitted (when looking for ~/.blender/2.xx dir only) */
if (folder_name)
BLI_make_file_string("/", targetpath, tmppath, folder_name);
else
BLI_strncpy(targetpath, tmppath, sizeof(tmppath));
/* FIXME: why is "//" on front of tmppath expanded to "/" (by BLI_join_dirfile)
* if folder_name is specified but not otherwise? */
if (BLI_is_dir(targetpath)) {
#ifdef PATH_DEBUG
printf("\t%s found: %s\n", __func__, targetpath);
#endif
return true;
}
else {
#ifdef PATH_DEBUG
printf("\t%s missing: %s\n", __func__, targetpath);
#endif
//targetpath[0] = '\0';
return false;
}
}
开发者ID:greg100795,项目名称:blender-git,代码行数:33,代码来源:appdir.c
示例5: strip_last_slash
static char *check_destination(const char *file, const char *to)
{
struct stat st;
if (!stat(to, &st)) {
if (S_ISDIR(st.st_mode)) {
char *str, *path;
const char *filename;
size_t len = 0;
str = strip_last_slash(file);
filename = BLI_last_slash(str);
if (!filename) {
MEM_freeN(str);
return (char *)to;
}
/* skip slash */
filename += 1;
len = strlen(to) + strlen(filename) + 1;
path = MEM_callocN(len + 1, "check_destination path");
BLI_join_dirfile(path, len + 1, to, filename);
MEM_freeN(str);
return path;
}
}
return (char *)to;
}
开发者ID:linkedinyou,项目名称:blender-git,代码行数:33,代码来源:fileops.c
示例6: test_path
static int test_path(char *targetpath, const char *path_base, const char *path_sep, const char *folder_name)
{
char tmppath[FILE_MAX];
if (path_sep) BLI_join_dirfile(tmppath, sizeof(tmppath), path_base, path_sep);
else BLI_strncpy(tmppath, path_base, sizeof(tmppath));
/* rare cases folder_name is omitted (when looking for ~/.blender/2.xx dir only) */
if (folder_name)
BLI_make_file_string("/", targetpath, tmppath, folder_name);
else
BLI_strncpy(targetpath, tmppath, sizeof(tmppath));
if (BLI_is_dir(targetpath)) {
#ifdef PATH_DEBUG2
printf("\tpath found: %s\n", targetpath);
#endif
return 1;
}
else {
#ifdef PATH_DEBUG2
printf("\tpath missing: %s\n", targetpath);
#endif
//targetpath[0] = '\0';
return 0;
}
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:27,代码来源:path_util.c
示例7: gpu_dump_shaders
/**
* Dump GLSL shaders to disk
*
* This is used for profiling shader performance externally and debug if shader code is correct.
* If called with no code, it simply bumps the shader index, so different shaders for the same
* program share the same index.
*/
static void gpu_dump_shaders(const char **code, const int num_shaders, const char *extension)
{
if ((G.debug & G_DEBUG_GPU_SHADERS) == 0) {
return;
}
/* We use the same shader index for shaders in the same program.
* So we call this function once before calling for the individual shaders. */
static int shader_index = 0;
if (code == NULL) {
shader_index++;
BLI_assert(STREQ(DEBUG_SHADER_NONE, extension));
return;
}
/* Determine the full path of the new shader. */
char shader_path[FILE_MAX];
char file_name[512] = {'\0'};
sprintf(file_name, "%04d.%s", shader_index, extension);
BLI_join_dirfile(shader_path, sizeof(shader_path), BKE_tempdir_session(), file_name);
/* Write shader to disk. */
FILE *f = fopen(shader_path, "w");
if (f == NULL) {
printf("Error writing to file: %s\n", shader_path);
}
for (int j = 0; j < num_shaders; j++) {
fprintf(f, "%s", code[j]);
}
fclose(f);
printf("Shader file written to disk: %s\n", shader_path);
}
开发者ID:Ichthyostega,项目名称:blender,代码行数:41,代码来源:gpu_shader.c
示例8: BLI_split_dir_part
/** When this method is called, the writer must write the image.
* \return The writer should return true, if writing succeeded, false otherwise.*/
bool DocumentImporter::writeImage(const COLLADAFW::Image *image)
{
if (mImportStage != General)
return true;
const std::string& imagepath = image->getImageURI().toNativePath();
char dir[FILE_MAX];
char absolute_path[FILE_MAX];
const char *workpath;
BLI_split_dir_part(this->import_settings->filepath, dir, sizeof(dir));
BLI_join_dirfile(absolute_path, sizeof(absolute_path), dir, imagepath.c_str());
if (BLI_exists(absolute_path)) {
workpath = absolute_path;
}
else {
// Maybe imagepath was already absolute ?
if (!BLI_exists(imagepath.c_str())) {
fprintf(stderr, "Image not found: %s.\n", imagepath.c_str() );
return true;
}
workpath = imagepath.c_str();
}
Image *ima = BKE_image_load_exists(workpath);
if (!ima) {
fprintf(stderr, "Cannot create image: %s\n", workpath);
return true;
}
this->uid_image_map[image->getUniqueId()] = ima;
return true;
}
开发者ID:DrangPo,项目名称:blender,代码行数:36,代码来源:DocumentImporter.cpp
示例9: autocomplete_directory
void autocomplete_directory(struct bContext *C, char *str, void *arg_v)
{
char tmp[FILE_MAX];
SpaceFile *sfile= CTX_wm_space_file(C);
/* search if str matches the beginning of name */
if(str[0] && sfile->files) {
AutoComplete *autocpl= autocomplete_begin(str, FILE_MAX);
int nentries = filelist_numfiles(sfile->files);
int i;
for(i= 0; i<nentries; ++i) {
struct direntry* file = filelist_file(sfile->files, i);
const char* dir = filelist_dir(sfile->files);
if (file && S_ISDIR(file->type)) {
// BLI_make_file_string(G.sce, tmp, dir, file->relname);
BLI_join_dirfile(tmp, dir, file->relname);
autocomplete_do_name(autocpl,tmp);
}
}
autocomplete_end(autocpl, str);
if (BLI_exists(str)) {
BLI_add_slash(str);
} else {
BLI_make_exist(str);
}
}
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:28,代码来源:filesel.c
示例10: get_path_local
static int get_path_local(char *targetpath, const char *folder_name, const char *subfolder_name, const int ver)
{
char relfolder[FILE_MAX];
#ifdef PATH_DEBUG2
printf("get_path_local...\n");
#endif
if (folder_name) {
if (subfolder_name) {
BLI_join_dirfile(relfolder, sizeof(relfolder), folder_name, subfolder_name);
}
else {
BLI_strncpy(relfolder, folder_name, sizeof(relfolder));
}
}
else {
relfolder[0] = '\0';
}
/* try EXECUTABLE_DIR/2.5x/folder_name - new default directory for local blender installed files */
if (test_path(targetpath, bprogdir, blender_version_decimal(ver), relfolder))
return 1;
return 0;
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:26,代码来源:path_util.c
示例11: 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 protected] */
tc = strchr(uilng, '@');
if (tc) {
BLI_strncpy(tstr + szt, tc, sizeof(tstr) - szt);
}
BLI_join_dirfile(path, maxlen, root, tstr);
strcat(tstr, ".po");
BLI_path_append(path, maxlen, tstr);
if (BLI_is_file(path)) {
return;
}
}
}
/* Else no po file! */
path[0] = '\0';
}
开发者ID:dfelinto,项目名称:blender,代码行数:52,代码来源:interface_ops.c
示例12: modifier_path_init
/* initializes the path with either */
void modifier_path_init(char *path, int path_maxlen, const char *name)
{
/* elubie: changed this to default to the same dir as the render output
* to prevent saving to C:\ on Windows */
BLI_join_dirfile(path, path_maxlen,
G.relbase_valid ? "//" : BLI_temporary_dir(),
name);
}
开发者ID:nttputus,项目名称:blensor,代码行数:9,代码来源:modifier.c
示例13: new_folder_path
/* create a new, non-existing folder name, returns 1 if successful, 0 if name couldn't be created.
* The actual name is returned in 'name', 'folder' contains the complete path, including the new folder name.
*/
static int new_folder_path(const char *parent, char *folder, char *name)
{
int i = 1;
int len = 0;
BLI_strncpy(name, "New Folder", FILE_MAXFILE);
BLI_join_dirfile(folder, FILE_MAX, parent, name); /* XXX, not real length */
/* check whether folder with the name already exists, in this case
* add number to the name. Check length of generated name to avoid
* crazy case of huge number of folders each named 'New Folder (x)' */
while (BLI_exists(folder) && (len < FILE_MAXFILE)) {
len = BLI_snprintf(name, FILE_MAXFILE, "New Folder(%d)", i);
BLI_join_dirfile(folder, FILE_MAX, parent, name); /* XXX, not real length */
i++;
}
return (len < FILE_MAXFILE);
}
开发者ID:manwapastorelli,项目名称:blender-git,代码行数:21,代码来源:file_ops.c
示例14: file_sfile_to_operator
void file_sfile_to_operator(wmOperator *op, SpaceFile *sfile, char *filepath)
{
BLI_join_dirfile(filepath, FILE_MAX, sfile->params->dir, sfile->params->file); /* XXX, not real length */
if(RNA_struct_find_property(op->ptr, "relative_path")) {
if(RNA_boolean_get(op->ptr, "relative_path")) {
BLI_path_rel(filepath, G.main->name);
}
}
if(RNA_struct_find_property(op->ptr, "filename")) {
RNA_string_set(op->ptr, "filename", sfile->params->file);
}
if(RNA_struct_find_property(op->ptr, "directory")) {
RNA_string_set(op->ptr, "directory", sfile->params->dir);
}
if(RNA_struct_find_property(op->ptr, "filepath")) {
RNA_string_set(op->ptr, "filepath", filepath);
}
/* some ops have multiple files to select */
/* this is called on operators check() so clear collections first since
* they may be already set. */
{
PointerRNA itemptr;
PropertyRNA *prop_files= RNA_struct_find_property(op->ptr, "files");
PropertyRNA *prop_dirs= RNA_struct_find_property(op->ptr, "dirs");
int i, numfiles = filelist_numfiles(sfile->files);
if(prop_files) {
RNA_property_collection_clear(op->ptr, prop_files);
for (i=0; i<numfiles; i++) {
if (filelist_is_selected(sfile->files, i, CHECK_FILES)) {
struct direntry *file= filelist_file(sfile->files, i);
RNA_property_collection_add(op->ptr, prop_files, &itemptr);
RNA_string_set(&itemptr, "name", file->relname);
}
}
}
if(prop_dirs) {
RNA_property_collection_clear(op->ptr, prop_dirs);
for (i=0; i<numfiles; i++) {
if (filelist_is_selected(sfile->files, i, CHECK_DIRS)) {
struct direntry *file= filelist_file(sfile->files, i);
RNA_property_collection_add(op->ptr, prop_dirs, &itemptr);
RNA_string_set(&itemptr, "name", file->relname);
}
}
}
}
}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:53,代码来源:file_ops.c
示例15: 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
示例16: autocomplete_directory
int autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
{
SpaceFile *sfile = CTX_wm_space_file(C);
int match = AUTOCOMPLETE_NO_MATCH;
/* search if str matches the beginning of name */
if (str[0] && sfile->files) {
char dirname[FILE_MAX];
DIR *dir;
struct dirent *de;
BLI_split_dir_part(str, dirname, sizeof(dirname));
dir = opendir(dirname);
if (dir) {
AutoComplete *autocpl = autocomplete_begin(str, FILE_MAX);
while ((de = readdir(dir)) != NULL) {
if (strcmp(".", de->d_name) == 0 || strcmp("..", de->d_name) == 0) {
/* pass */
}
else {
char path[FILE_MAX];
BLI_stat_t status;
BLI_join_dirfile(path, sizeof(path), dirname, de->d_name);
if (BLI_stat(path, &status) == 0) {
if (S_ISDIR(status.st_mode)) { /* is subdir */
autocomplete_do_name(autocpl, path);
}
}
}
}
closedir(dir);
match = autocomplete_end(autocpl, str);
if (match) {
if (match == AUTOCOMPLETE_FULL_MATCH) {
BLI_add_slash(str);
}
else {
BLI_strncpy(sfile->params->dir, str, sizeof(sfile->params->dir));
}
}
}
}
return match;
}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:52,代码来源:filesel.c
示例17: join_dirfile_alloc
/* appending of filename to dir (ensures for buffer size before appending) */
static void join_dirfile_alloc(char **dst, size_t *alloc_len, const char *dir, const char *file)
{
size_t len = strlen(dir) + strlen(file) + 1;
if (*dst == NULL)
*dst = MEM_mallocN(len + 1, "join_dirfile_alloc path");
else if (*alloc_len < len)
*dst = MEM_reallocN(*dst, len + 1);
*alloc_len = len;
BLI_join_dirfile(*dst, len + 1, dir, file);
}
开发者ID:linkedinyou,项目名称:blender-git,代码行数:14,代码来源:fileops.c
示例18: file_draw_check_exists
bool file_draw_check_exists(SpaceFile *sfile)
{
if (sfile->op) { /* fails on reload */
if (RNA_struct_find_property(sfile->op->ptr, "check_existing")) {
if (RNA_boolean_get(sfile->op->ptr, "check_existing")) {
char filepath[FILE_MAX];
BLI_join_dirfile(filepath, sizeof(filepath), sfile->params->dir, sfile->params->file);
if (BLI_is_file(filepath)) {
return true;
}
}
}
}
return false;
}
开发者ID:manwapastorelli,项目名称:blender-git,代码行数:16,代码来源:file_ops.c
示例19: BKE_blendfile_workspace_config_read
static WorkspaceConfigFileData *workspace_system_file_read(const char *app_template)
{
if (app_template == NULL) {
return BKE_blendfile_workspace_config_read(
NULL, datatoc_startup_blend, datatoc_startup_blend_size, NULL);
}
char template_dir[FILE_MAX];
if (!BKE_appdir_app_template_id_search(app_template, template_dir, sizeof(template_dir))) {
return NULL;
}
char startup_file_path[FILE_MAX];
BLI_join_dirfile(
startup_file_path, sizeof(startup_file_path), template_dir, 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,代码行数:19,代码来源:workspace_edit.c
示例20: cache_filename
static void cache_filename(char *string, const char *path, const char *relbase, int frame, int type)
{
char cachepath[FILE_MAX];
const char *fname;
switch (type) {
case CACHE_TYPE_FOAM:
fname = "foam_";
break;
case CACHE_TYPE_NORMAL:
fname = "normal_";
break;
case CACHE_TYPE_DISPLACE:
default:
fname = "disp_";
break;
}
BLI_join_dirfile(cachepath, sizeof(cachepath), path, fname);
BKE_makepicstring_from_type(string, cachepath, relbase, frame, R_IMF_IMTYPE_OPENEXR, 1, TRUE);
}
开发者ID:danielmarg,项目名称:blender-main,代码行数:22,代码来源:ocean.c
注:本文中的BLI_join_dirfile函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论