[Bf-committers] a litle improve 2
Ton Roosendaal
bf-committers@blender.org
Tue, 2 Mar 2004 21:04:29 +0100
Hi,
I've reviewed this with you already on IRC, so I can be short about
it...
Here you replace simple and readable code with a complex system that
even puts constants in the code (numbers) to make it work. Half of the
previous code there is also obsolete, part of an old experiment with
Imagemagick, which was rejected.
Let's leave this code as it is. There are much better things to improve
in Blender!
-Ton-
On Thursday, Feb 26, 2004, at 13:20 Europe/Amsterdam, Joilnen Batista
Leite wrote:
> excuse me i don't have cvs write permissions...
>
> please see attach I think that it changed for better
> code
> very tanks :) !
>
>
>
> sorry if is a dumb question and thanks for atention
> pub 1024D/5139533E Joilnen Batista Leite
> F565 BD0B 1A39 390D 827E 03E5 0CD4 0F20 5139 533E
>
>
> __________________________________
> Do you Yahoo!?
> Get better spam protection with Yahoo! Mail.
> http://antispam.yahoo.com/tools---
> blender/source/blender/src/filesel.c 2004-01-22 04:35:03.000000000
> -0300
> +++ tuhopuu2/source/blender/src/filesel.c 2004-02-25
> 17:13:40.000000000 -0300
> @@ -1,5 +1,5 @@
> /**
> - * $Id: filesel.c,v 1.31 2004/01/21 04:42:14 ianwill Exp $
> + * $Id: filesel.c,v 1.7 2004/02/15 05:53:36 hos Exp $
> *
> * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
> *
> @@ -491,14 +491,35 @@
> {
> struct direntry *file;
> int num;
> + int *index;
>
> + char *extension[]={
> + ".mv",".py",
> +
> + ".avi",".bmp",".cut",".flc",".gif",".ico",".iff",".jng",
> + ".jpg",".lbm",".mng",".mov",".otc",".otf",".pbm",".pcd",
> + ".pct",".pcx",".pfb",".pgm",".png",".ppm",".psd",".psx",
> + ".ras",".rgb",".sgi",".tga",".tif",".ttc",".ttf",".wav",
> +
> + ".jpeg",".pict",".pntg",".qtif",".tiff",".wbmp",
> +
> + ".koala",".movie"
> + };
> + int index_ext[]={
> + 32,31,20,15,14,10,34,29,27, 3,22, 8,11, 6,24,30,
> + 38,18,35,22,37,28, 9,12,16,21,23,39, 4, 7,40,17,
> + 19,26, 2,13,41, 0,10,29,27, 3,22, 8,11,28, 9,12,
> + 16,23,39, 4, 7,40,17,19,26, 6,24,30,38
> + };
> +
> +
> file= sfile->filelist;
>
> for(num=0; num<sfile->totfile; num++, file++) {
> file->flags= 0;
> file->type= file->s.st_mode; /* restore the mess below */
>
> - /* Don't check extensions for directories */
> + /* Don't check extensions for directories */
> if (file->type&S_IFDIR)
> continue;
>
> @@ -516,83 +537,50 @@
> } else if (sfile->type==FILE_SPECIAL){
> if(BLI_testextensie(file->relname, ".py")) {
> file->flags |= PYSCRIPTFILE;
> - } else if( BLI_testextensie(file->relname, ".ttf")
> - || BLI_testextensie(file->relname, ".ttc")
> - || BLI_testextensie(file->relname, ".pfb")
> - || BLI_testextensie(file->relname, ".otf")
> - || BLI_testextensie(file->relname, ".otc")) {
> - file->flags |= FTFONTFILE;
> - } else if (G.have_quicktime){
> - if( BLI_testextensie(file->relname, ".jpg")
> - || BLI_testextensie(file->relname, ".jpeg")
> - || BLI_testextensie(file->relname, ".tga")
> - || BLI_testextensie(file->relname, ".rgb")
> - || BLI_testextensie(file->relname, ".bmp")
> - || BLI_testextensie(file->relname, ".png")
> - || BLI_testextensie(file->relname, ".iff")
> - || BLI_testextensie(file->relname, ".lbm")
> - || BLI_testextensie(file->relname, ".gif")
> - || BLI_testextensie(file->relname, ".psd")
> - || BLI_testextensie(file->relname, ".tif")
> - || BLI_testextensie(file->relname, ".tiff")
> - || BLI_testextensie(file->relname, ".pct")
> - || BLI_testextensie(file->relname, ".pict")
> - || BLI_testextensie(file->relname, ".pntg") //macpaint
> - || BLI_testextensie(file->relname, ".qtif")
> + } else {
> + int b=0;
> +
> for(index=index_ext;*index!=10;index++){
> + if(b|=BLI_testextensie(file->relname,extension[*index])){
> + file->flags |= FTFONTFILE;
> + break;
> + }
> + }
> + }
> + if (G.have_quicktime){
> + int b=0;
> #ifdef WITH_FREEIMAGE
> - || BLI_testextensie(file->relname, ".jng")
> - || BLI_testextensie(file->relname, ".mng")
> - || BLI_testextensie(file->relname, ".pbm")
> - || BLI_testextensie(file->relname, ".pgm")
> - || BLI_testextensie(file->relname, ".ppm")
> - || BLI_testextensie(file->relname, ".wbmp")
> - || BLI_testextensie(file->relname, ".cut")
> - || BLI_testextensie(file->relname, ".ico")
> - || BLI_testextensie(file->relname, ".koala")
> - || BLI_testextensie(file->relname, ".pcd")
> - || BLI_testextensie(file->relname, ".pcx")
> - || BLI_testextensie(file->relname, ".ras")
> +
> for(index=index_ext+4;*index!=6;index++){
> +#else
> +
> for(index=index_ext+4;*index!=9;index++){
> #endif
> - || BLI_testextensie(file->relname, ".sgi")) {
> - file->flags |= IMAGEFILE;
> - }
> - else if(BLI_testextensie(file->relname, ".avi")
> - || BLI_testextensie(file->relname, ".flc")
> - || BLI_testextensie(file->relname, ".mov")
> - || BLI_testextensie(file->relname, ".movie")
> - || BLI_testextensie(file->relname, ".mv")) {
> - file->flags |= MOVIEFILE;
> + if(b|=BLI_testextensie(file->relname,extension[*index])){
> + file->flags |= IMAGEFILE;
> + break;
> + }
> + }
> + if(b)continue;
> + for(index=index_ext+34;*index!=0;index++){
> + if(b|=BLI_testextensie(file->relname,extension[*index])){
> + file->flags |= MOVIEFILE;
> + break;
> + }
> }
> +
> } else { // no quicktime
> - if(BLI_testextensie(file->relname, ".jpg")
> - || BLI_testextensie(file->relname, ".tga")
> - || BLI_testextensie(file->relname, ".rgb")
> - || BLI_testextensie(file->relname, ".bmp")
> - || BLI_testextensie(file->relname, ".png")
> - || BLI_testextensie(file->relname, ".iff")
> - || BLI_testextensie(file->relname, ".lbm")
> + int b=0;
> +
> #ifdef WITH_FREEIMAGE
> - || BLI_testextensie(file->relname, ".jng")
> - || BLI_testextensie(file->relname, ".mng")
> - || BLI_testextensie(file->relname, ".pbm")
> - || BLI_testextensie(file->relname, ".pgm")
> - || BLI_testextensie(file->relname, ".ppm")
> - || BLI_testextensie(file->relname, ".wbmp")
> - || BLI_testextensie(file->relname, ".cut")
> - || BLI_testextensie(file->relname, ".ico")
> - || BLI_testextensie(file->relname, ".koala")
> - || BLI_testextensie(file->relname, ".pcd")
> - || BLI_testextensie(file->relname, ".pcx")
> - || BLI_testextensie(file->relname, ".ras")
> - || BLI_testextensie(file->relname, ".gif")
> - || BLI_testextensie(file->relname, ".psd")
> - || BLI_testextensie(file->relname, ".tif")
> - || BLI_testextensie(file->relname, ".tiff")
> -#endif
> - || BLI_testextensie(file->relname, ".sgi")) {
> - file->flags |= IMAGEFILE;
> + for(index=index_ext+38;*index!=0;index++){
> +#else
> + for(index=index_ext+38;*index!=9;index++){
> +#endif
> + if(b|=BLI_testextensie(file->relname,extension[*index])){
> + file->flags |= IMAGEFILE;
> + break;
> + }
> }
> - else if(BLI_testextensie(file->relname, ".avi")
> + if(b)continue;
> + if(BLI_testextensie(file->relname, ".avi")
> || BLI_testextensie(file->relname, ".mv")) {
> file->flags |= MOVIEFILE;
> }
>
------------------------------------------------------------------------
--
Ton Roosendaal Blender Foundation ton@blender.org
http://www.blender.org