[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36501] trunk/blender/source/blender: remove exotic.c, there was no operators to access these formats and they were not well maintained .

Campbell Barton ideasman42 at gmail.com
Thu May 5 16:21:32 CEST 2011


Revision: 36501
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36501
Author:   campbellbarton
Date:     2011-05-05 14:21:31 +0000 (Thu, 05 May 2011)
Log Message:
-----------
remove exotic.c, there was no operators to access these formats and they were not well maintained.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/CMakeLists.txt
    trunk/blender/source/blender/windowmanager/intern/wm_files.c

Removed Paths:
-------------
    trunk/blender/source/blender/blenkernel/BKE_exotic.h
    trunk/blender/source/blender/blenkernel/intern/exotic.c

Deleted: trunk/blender/source/blender/blenkernel/BKE_exotic.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_exotic.h	2011-05-05 13:51:33 UTC (rev 36500)
+++ trunk/blender/source/blender/blenkernel/BKE_exotic.h	2011-05-05 14:21:31 UTC (rev 36501)
@@ -1,60 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#ifndef BKE_EXOTIC_H
-#define BKE_EXOTIC_H
-
-/** \file BKE_exotic.h
- *  \ingroup bke
- *  \brief dxf/vrml/stl external file io function prototypes.
- *  \attention is this used still? Candidate for removal?
- */
-struct Mesh;
-struct Scene;
-
-/**
- * Reads all 3D fileformats other than Blender fileformat
- * @retval 0 The file could not be read.
- * @retval 1 The file was read succesfully.
- * @attention Used in filesel.c
- */
-int BKE_read_exotic(struct Scene *scene, const char *name);
-
-/* return codes */
-#define BKE_READ_EXOTIC_FAIL_PATH		-3 /* file format is not supported */
-#define BKE_READ_EXOTIC_FAIL_FORMAT		-2 /* file format is not supported */
-#define BKE_READ_EXOTIC_FAIL_OPEN		-1 /* Can't open the file */
-#define BKE_READ_EXOTIC_OK_BLEND		 0 /* .blend file */
-#define BKE_READ_EXOTIC_OK_OTHER		 1 /* other supported formats */
-
-void write_dxf(struct Scene *scene, char *str);
-void write_stl(struct Scene *scene, char *str);
-
-#endif
-

Modified: trunk/blender/source/blender/blenkernel/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/blenkernel/CMakeLists.txt	2011-05-05 13:51:33 UTC (rev 36500)
+++ trunk/blender/source/blender/blenkernel/CMakeLists.txt	2011-05-05 14:21:31 UTC (rev 36501)
@@ -91,7 +91,6 @@
 	intern/depsgraph.c
 	intern/displist.c
 	intern/effect.c
-	intern/exotic.c
 	intern/fcurve.c
 	intern/fluidsim.c
 	intern/fmodifier.c
@@ -176,7 +175,6 @@
 	BKE_displist.h
 	BKE_effect.h
 	BKE_endian.h
-	BKE_exotic.h
 	BKE_fcurve.h
 	BKE_fluidsim.h
 	BKE_font.h

Deleted: trunk/blender/source/blender/blenkernel/intern/exotic.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/exotic.c	2011-05-05 13:51:33 UTC (rev 36500)
+++ trunk/blender/source/blender/blenkernel/intern/exotic.c	2011-05-05 14:21:31 UTC (rev 36501)
@@ -1,2485 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- *
- * Contributor(s):
- * - Martin DeMello
- *   Added dxf_read_arc, dxf_read_ellipse and dxf_read_lwpolyline
- *   Copyright (C) 2004 by Etheract Software Labs
- *
- * - Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK ****
- */
-
-/** \file blender/blenkernel/intern/exotic.c
- *  \ingroup bke
- */
-
-
-#include <stddef.h>
-#include "BLI_storage.h"
-
-#include <stdlib.h>
-#include <ctype.h> /* isdigit, isspace */
-#include <math.h>
-#include <stdio.h>
-
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-
-#ifndef _WIN32 
-#include <unistd.h>
-#else
-#include <io.h>
-#define open _open
-#define read _read
-#define close _close
-#define write _write
-#endif
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_object_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_material_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_scene_types.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-#include "BLI_storage.h"
-#include "BLI_utildefines.h"
-
-
-#include "BKE_blender.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_mesh.h"
-#include "BKE_library.h"
-#include "BKE_object.h"
-#include "BKE_material.h"
-#include "BKE_report.h"
-#include "BKE_exotic.h"
-#include "BKE_displist.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_curve.h"
-
-#ifdef WITH_PYTHON
-#include "BPY_extern.h"
-#endif
-
-#include "zlib.h"
-
-static int is_dxf(const char *str);
-static void dxf_read(Scene *scene, const char *filename);
-static int is_stl(const char *str);
-
-static int is_stl_ascii(const char *str)
-{	
-	FILE *fpSTL;
-	char buffer[1000];
-	int  numread, i;
-
-	fpSTL = fopen(str, "rb");
-	if ( (numread = fread( (void *) buffer, sizeof(char), 1000, fpSTL)) <= 0 )
-	  { fclose(fpSTL); return 0; }
-
-	for (i=0; i < numread; ++i) {
-	  /* if bit 8 is set we assume binary */
-	  if (buffer[i] & 0x80)
-		{ fclose(fpSTL); return 0; }
-	}
-
-	buffer[5] = '\0';
-	if ( !(strstr(buffer, "solid")) && !(strstr(buffer, "SOLID")) ) 
-	  { fclose(fpSTL); return 0; }
-
-	fclose(fpSTL);
-	
-	return 1;
-}
-
-static int is_stl(const char *str)
-{
-	int i;
-	i = strlen(str) - 3;
-	if ( (str[i] !='s') && (str[i] !='S'))
-		return 0;
-	i++;
-	if ( (str[i] !='t') && (str[i] !='T'))
-		return 0;
-	i++;
-	if ( (str[i] !='l') && (str[i] !='L'))
-		return 0;
-
-	return 1;
-}
-
-#define READSTLVERT {                                             \
-	if (fread(mvert->co, sizeof(float), 3, fpSTL) != 3) {      \
-		char error_msg[255];                                \
-		MEM_freeN(vertdata);                                \
-		MEM_freeN(facedata);                                \
-		fclose(fpSTL);                                      \
-		sprintf(error_msg, "Problems reading face %d!", i); \
-		return;                                             \
-	}                                                          \
-	else {                                                     \
-		if (ENDIAN_ORDER==B_ENDIAN) {                       \
-			SWITCH_INT(mvert->co[0]);                    \
-			SWITCH_INT(mvert->co[1]);                    \
-			SWITCH_INT(mvert->co[2]);                    \
-		}                                                   \
-	}                                                          \
-}
-
-static void simple_vertex_normal_blend(short *no, short *ble)
-{
-	if(no[0]==0 && no[1]==0 && no[2]==0) {
-		VECCOPY(no, ble);
-	}
-	else {
-		no[0]= (2*no[0] + ble[0])/3;
-		no[1]= (2*no[1] + ble[1])/3;
-		no[2]= (2*no[2] + ble[2])/3;
-	}
-}
-
-static void mesh_add_normals_flags(Mesh *me)
-{
-	MVert *v1, *v2, *v3, *v4;
-	MFace *mface;
-	float nor[3];
-	int a;
-	short sno[3];
-	
-	mface= me->mface;
-	for(a=0; a<me->totface; a++, mface++) {
-		v1= me->mvert+mface->v1;
-		v2= me->mvert+mface->v2;
-		v3= me->mvert+mface->v3;
-		v4= me->mvert+mface->v4;
-
-		normal_tri_v3( nor,v1->co, v2->co, v3->co);
-		normal_float_to_short_v3(sno, nor);
-
-		simple_vertex_normal_blend(v1->no, sno);
-		simple_vertex_normal_blend(v2->no, sno);
-		simple_vertex_normal_blend(v3->no, sno);
-		if(mface->v4) {
-			simple_vertex_normal_blend(v4->no, sno);
-		}
-		mface->edcode= ME_V1V2|ME_V2V3;
-	}	
-}
-
-static void read_stl_mesh_binary(Scene *scene, const char *str)
-{
-	FILE   *fpSTL;
-	Object *ob;
-	Mesh   *me;
-	MVert  *mvert, *vertdata;
-	MFace  *mface, *facedata;
-	unsigned int numfacets = 0, i, j, vertnum;
-	unsigned int maxmeshsize, nummesh, lastmeshsize;
-	unsigned int totvert, totface;
-	ReportList *reports= NULL; /* XXX */
-
-	fpSTL= fopen(str, "rb");
-	if(fpSTL==NULL) {
-		BKE_reportf(reports, RPT_ERROR, "Can't read file: %s.", strerror(errno));
-		return;
-	}
-
-	if(fseek(fpSTL, 80, SEEK_SET) != 0) {
-		BKE_reportf(reports, RPT_ERROR, "Failed reading file: %s.", strerror(errno));
-		fclose(fpSTL);
-		return;
-	}
-
-	if(fread(&numfacets, 4*sizeof(char), 1, fpSTL) != 1) {
-		if(feof(fpSTL))
-			BKE_reportf(reports, RPT_ERROR, "Failed reading file: premature end of file.");
-		else
-			BKE_reportf(reports, RPT_ERROR, "Failed reading file: %s.", strerror(errno));
-		fclose(fpSTL);
-		return;
-	}
-	if (ENDIAN_ORDER==B_ENDIAN) {
-		SWITCH_INT(numfacets);
-	}
-
-	maxmeshsize = MESH_MAX_VERTS/3;
-
-	nummesh      = (numfacets / maxmeshsize) + 1;
-	lastmeshsize = numfacets % maxmeshsize;
-
-	if (numfacets) {
-		for (j=0; j < nummesh; ++j) {
-			/* new object */
-			if (j == nummesh-1) {
-				totface = lastmeshsize;
-			}
-			else {
-				totface = maxmeshsize;
-			}
-			totvert = 3 * totface;
-	
-			vertdata = MEM_callocN(totvert*sizeof(MVert), "mverts");
-			facedata = MEM_callocN(totface*sizeof(MFace), "mface");
-
-			vertnum = 0;
-			mvert= vertdata;
-			mface = facedata;
-			for (i=0; i < totface; i++) {
-				fseek(fpSTL, 12, SEEK_CUR); /* skip the face normal */
-				READSTLVERT;
-				mvert++;
-				READSTLVERT;
-				mvert++;
-				READSTLVERT;
-				mvert++;
-
-				mface->v1 = vertnum++;
-				mface->v2 = vertnum++;
-				mface->v3 = vertnum++;
-				mface++;
-
-				fseek(fpSTL, 2, SEEK_CUR);
-			}
-
-			ob= add_object(scene, OB_MESH);
-			me= ob->data;
-			me->totvert = totvert;
-			me->totface = totface;
-			me->mvert = CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN,
-											 vertdata, totvert);
-			me->mface = CustomData_add_layer(&me->fdata, CD_MFACE, CD_ASSIGN,
-											 facedata, totface);
-
-			mesh_add_normals_flags(me);
-			make_edges(me, 0);
-		}
-		//XXX waitcursor(1);
-	}

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list