コード例 #1
0
ファイル: filelist.c プロジェクト: OldBrunet/BGERTPS
static int file_extension_type(char *relname)
{
	if(BLO_has_bfile_extension(relname)) {
		return BLENDERFILE;
	} else if(file_is_blend_backup(relname)) {
		return BLENDERFILE_BACKUP;
	} else if(BLI_testextensie(relname, ".py")) {
		return PYSCRIPTFILE;
	} else if(BLI_testextensie(relname, ".txt")
			  || BLI_testextensie(relname, ".glsl")
			  || BLI_testextensie(relname, ".data")) {
		return TEXTFILE;
	} else if( BLI_testextensie(relname, ".ttf")
			  || BLI_testextensie(relname, ".ttc")
			  || BLI_testextensie(relname, ".pfb")
			  || BLI_testextensie(relname, ".otf")
			  || BLI_testextensie(relname, ".otc")) {
		return FTFONTFILE;			
	} else if(BLI_testextensie(relname, ".btx")) {
		return BTXFILE;
	} else if(BLI_testextensie(relname, ".dae")) {
		return COLLADAFILE;
	} else if(BLI_testextensie_array(relname, imb_ext_image)
			  || (G.have_quicktime && BLI_testextensie_array(relname, imb_ext_image_qt))) {
		return IMAGEFILE;			
	} else if(BLI_testextensie_array(relname, imb_ext_movie)) {
		return MOVIEFILE;			
	} else if(BLI_testextensie_array(relname, imb_ext_audio)) {
		return SOUNDFILE;
	} 
	return 0;
}
コード例 #2
0
int IMB_isanim(const char *filename)
{
	int type;
	
	if (U.uiflag & USER_FILTERFILEEXTS) {
		if (G.have_quicktime) {
			if (BLI_testextensie_array(filename, imb_ext_movie_qt)) {	
				type = imb_get_anim_type(filename);
			}
			else {
				return(FALSE);
			}
		}
		else { /* no quicktime */
			if (BLI_testextensie_array(filename, imb_ext_movie)) {
				type = imb_get_anim_type(filename);
			}
			else {
				return(FALSE);
			}
		}
	}
	else { /* no FILTERFILEEXTS */
		type = imb_get_anim_type(filename);
	}
	
	return (type && type != ANIM_SEQUENCE);
}
コード例 #3
0
int IMB_ispic(const char *filename)
{
	if(U.uiflag & USER_FILTERFILEEXTS) {
		if(	(BLI_testextensie_array(filename, imb_ext_image)) ||
			(G.have_quicktime && BLI_testextensie_array(filename, imb_ext_image_qt))
		) {
			return IMB_ispic_name(filename);
		}
		else  {
			return FALSE;
		}
	}
	else { /* no FILTERFILEEXTS */
		return IMB_ispic_name(filename);
	}
}
コード例 #4
0
ファイル: movieclip.c プロジェクト: nttputus/blensor
/* checks if image was already loaded, then returns same image
 * otherwise creates new.
 * does not load ibuf itself
 * pass on optional frame for #name images */
MovieClip *BKE_movieclip_file_add(const char *name)
{
    MovieClip *clip;
    MovieClipUser user = {0};
    int file, len, width, height;
    const char *libname;
    char str[FILE_MAX], strtest[FILE_MAX];

    BLI_strncpy(str, name, sizeof(str));
    BLI_path_abs(str, G.main->name);

    /* exists? */
    file = BLI_open(str, O_BINARY | O_RDONLY, 0);
    if (file == -1)
        return NULL;
    close(file);

    /* ** first search an identical clip ** */
    for (clip = G.main->movieclip.first; clip; clip = clip->id.next) {
        BLI_strncpy(strtest, clip->name, sizeof(clip->name));
        BLI_path_abs(strtest, G.main->name);

        if (strcmp(strtest, str) == 0) {
            BLI_strncpy(clip->name, name, sizeof(clip->name));  /* for stringcode */
            clip->id.us++;  /* officially should not, it doesn't link here! */

            return clip;
        }
    }

    /* ** add new movieclip ** */

    /* create a short library name */
    len = strlen(name);

    while (len > 0 && name[len - 1] != '/' && name[len - 1] != '\\')
        len--;
    libname = name + len;

    clip = movieclip_alloc(libname);
    BLI_strncpy(clip->name, name, sizeof(clip->name));

    if (BLI_testextensie_array(name, imb_ext_movie))
        clip->source = MCLIP_SRC_MOVIE;
    else
        clip->source = MCLIP_SRC_SEQUENCE;

    user.framenr = 1;
    BKE_movieclip_get_size(clip, &user, &width, &height);
    if (width && height) {
        clip->tracking.camera.principal[0] = ((float)width) / 2.0f;
        clip->tracking.camera.principal[1] = ((float)height) / 2.0f;

        clip->tracking.camera.focal = 24.0f * width / clip->tracking.camera.sensor_width;
    }

    movieclip_calc_length(clip);

    return clip;
}
コード例 #5
0
ファイル: filelist.c プロジェクト: bitfusionio/blender
static int path_extension_type(const char *path)
{
	if (BLO_has_bfile_extension(path)) {
		return FILE_TYPE_BLENDER;
	}
	else if (file_is_blend_backup(path)) {
		return FILE_TYPE_BLENDER_BACKUP;
	}
	else if (BLI_testextensie(path, ".app")) {
		return FILE_TYPE_APPLICATIONBUNDLE;
	}
	else if (BLI_testextensie(path, ".py")) {
		return FILE_TYPE_PYSCRIPT;
	}
	else if (BLI_testextensie_n(path, ".txt", ".glsl", ".osl", ".data", NULL)) {
		return FILE_TYPE_TEXT;
	}
	else if (BLI_testextensie_n(path, ".ttf", ".ttc", ".pfb", ".otf", ".otc", NULL)) {
		return FILE_TYPE_FTFONT;
	}
	else if (BLI_testextensie(path, ".btx")) {
		return FILE_TYPE_BTX;
	}
	else if (BLI_testextensie(path, ".dae")) {
		return FILE_TYPE_COLLADA;
	}
	else if (BLI_testextensie_array(path, imb_ext_image) ||
	         (G.have_quicktime && BLI_testextensie_array(path, imb_ext_image_qt)))
	{
		return FILE_TYPE_IMAGE;
	}
	else if (BLI_testextensie(path, ".ogg")) {
		if (IMB_isanim(path)) {
			return FILE_TYPE_MOVIE;
		}
		else {
			return FILE_TYPE_SOUND;
		}
	}
	else if (BLI_testextensie_array(path, imb_ext_movie)) {
		return FILE_TYPE_MOVIE;
	}
	else if (BLI_testextensie_array(path, imb_ext_audio)) {
		return FILE_TYPE_SOUND;
	}
	return 0;
}
コード例 #6
0
ファイル: movieclip.c プロジェクト: nttputus/blensor
void BKE_movieclip_reload(MovieClip *clip)
{
    /* clear cache */
    free_buffers(clip);

    clip->tracking.stabilization.ok = FALSE;

    /* update clip source */
    if (BLI_testextensie_array(clip->name, imb_ext_movie))
        clip->source = MCLIP_SRC_MOVIE;
    else
        clip->source = MCLIP_SRC_SEQUENCE;

    movieclip_calc_length(clip);
}
コード例 #7
0
static bool imb_is_filepath_format(const char *filepath)
{
	/* return true if this is one of the formats that can't be loaded from memory */
	return BLI_testextensie_array(filepath, imb_ext_image_filepath_only);
}