[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35788] branches/bmesh/blender/source: scon fixes

Joseph Eagar joeedh at gmail.com
Sat Mar 26 01:28:10 CET 2011


Revision: 35788
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35788
Author:   joeedh
Date:     2011-03-26 00:28:10 +0000 (Sat, 26 Mar 2011)
Log Message:
-----------
scon fixes

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_interp.c
    branches/bmesh/blender/source/blender/makesrna/intern/rna_mesh.c
    branches/bmesh/blender/source/blender/python/intern/bpy_rna.h
    branches/bmesh/blender/source/gameengine/Ketsji/KX_PythonInit.cpp
    branches/bmesh/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp

Removed Paths:
-------------
    branches/bmesh/blender/source/blender/python/intern/bpy_array.c
    branches/bmesh/blender/source/blender/render/intern/source/rayobject_blibvh.c
    branches/bmesh/blender/source/blender/render/intern/source/rayobject_instance.c
    branches/bmesh/blender/source/blender/render/intern/source/rayobject_octree.c
    branches/bmesh/blender/source/blender/render/intern/source/rayobject_raycounter.c

Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_interp.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_interp.c	2011-03-25 22:02:50 UTC (rev 35787)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_interp.c	2011-03-26 00:28:10 UTC (rev 35788)
@@ -175,8 +175,6 @@
 	}
 }
 
-
-
 /**
  *			BM_data_interp_from_face
  *
@@ -218,6 +216,94 @@
 	BLI_array_free(blocks);
 }
 
+#if 0
+static int compute_mdisp_quad(BMLoop *l, float v1[3], float v2[3], float v3[3], float v4[3], float e1[3], float e2[3])
+{
+	float cent[3];
+	BMLoop *l2;
+	
+	/*computer center*/
+	l2 = bm_firstfaceloop(l->f);
+	do {
+		add_v3_v3(v4, l2->v->co);
+		l2 = l2->next;
+	} whlie (l2 != bm_firstfaceloop(l->f));
+	
+	mul_v3_fl(v4, 1.0/(float)l->f->len);
+	
+	copy_v3_v3(v1, l->prev->v->co);
+	copy_v3_v3(v2, l->v->co);
+	copy_v3_v3(v3, l->next->v->co);
+	
+	sub_v3_v3v3(e1, v1, v4);
+	sub_v3_v3v3(e2, v2, v3);
+}
+
+/*tl is loop to project onto, sl is loop whose internal displacement, co, is being
+  projected.  x and y are location in loop's mdisps grid of co.*/
+static int mdisp_in_mdispquad(BMLoop *l, BMLoop *tl, float co, int *x, int *y)
+{
+	float v1[3], v2[3], v3[3], v4[3], e1[3], e2[3];
+	float dir[3], uv[3], hit[3];
+	float eps = FLT_EPSILON*7;
+	
+	computer_mdisp_quad(tl, v1, v2, v3, v4, e1, e2);
+	copy_v3_v3(dir, l->f->no);
+	
+	/*four tests, two per triangle, once again normal, once along -normal*/
+	ret = isect_ray_tri_epsilon_v3(co, dir, v1, v2, v3, &l, uv, eps);
+	ret = ret || isect_ray_tri_epsilon_v3(co, dir, v1, v3, v4, &l, uv, eps);
+	if (!ret) {
+		negate_v3(dir);
+		ret = ret || isect_ray_tri_epsilon_v3(co, dir, v1, v2, v3, &l, uv, eps);
+		ret = ret || isect_ray_tri_epsilon_v3(co, dir, v1, v3, v4, &l, uv, eps);
+	}	
+	if (!ret)
+		return 0;
+	
+	mul_v3_fl(dir, l);
+	add_v3_v3v3(hit, co, dir);
+	
+}
+
+static void bmesh_loop_interp_mdisps(BMesh *bm, BMLoop *target, BMFace *source)
+{
+	MDisps *mdisps;
+	BMLoop *l2;
+	float x, y, d, v1[3], v2[3], v3[3], v4[3] = {0.0f, 0.0f, 0.0f}, e1[3], e2[3], e3[3], e4[3];
+	int i;
+	
+	if (!CustomData_has_layer(&bm->ldata, CD_MDISPS))
+		return;
+	
+	mdisps = CustomData_bmesh_get(&bm->ldata, CD_MDISPS);
+	
+	computer_mdisp_quad(target, v1, v2, v3, v4, e1, e2);
+	
+	d = 1.0f/sqrt(mdisps->totdisp);
+	for (x=0.0f; x<1.0f; x += d) {
+		for (y=0.0f; y<1.0f; y+= d) {
+			float co1[3], co2[3], co[3];
+			
+			copy_v3_v3v3(co1, e1);
+			mul_v3_fl(co1, y);
+			copy_v3_v3v3(co1, e2);
+			mul_v3_fl(co1, y);
+			
+			sub_v3_v3v3(co, co2, co1);
+			mul_v3_fl(co, x);
+			add_v3_v3v3(co, co1);
+			
+			l2 = bm_firstfaceloop(target->f);
+			do {
+				l2 = l2->next;
+			} while (l2 != bm_firstfaceloop(target->f));
+		}
+	}
+	//for (i=0; i<CustomData_number_of_layers(&bm->ldata, CD_MDISPS); i++) {
+	//}
+}
+#endif
 void BM_loop_interp_from_face(BMesh *bm, BMLoop *target, BMFace *source)
 {
 	BMLoop *l;

Modified: branches/bmesh/blender/source/blender/makesrna/intern/rna_mesh.c
===================================================================
--- branches/bmesh/blender/source/blender/makesrna/intern/rna_mesh.c	2011-03-25 22:02:50 UTC (rev 35787)
+++ branches/bmesh/blender/source/blender/makesrna/intern/rna_mesh.c	2011-03-26 00:28:10 UTC (rev 35788)
@@ -55,6 +55,8 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
+#include "ED_mesh.h"
+
 static void rna_Mesh_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
 	ID *id= ptr->id.data;
@@ -1013,7 +1015,7 @@
 	CustomDataLayer *cdl= NULL;
 	int index;
 
-	if(ED_mesh_uv_texture_add(C, NULL, NULL, me, name, FALSE)) {
+	if(ED_mesh_uv_texture_add(C, me, name, FALSE)) {
 		pdata= rna_mesh_pdata(me);
 		index= CustomData_get_named_layer_index(pdata, CD_MTEXPOLY, name);
 		cdl= (index == -1)? NULL: &pdata->layers[index];

Deleted: branches/bmesh/blender/source/blender/python/intern/bpy_array.c
===================================================================
--- branches/bmesh/blender/source/blender/python/intern/bpy_array.c	2011-03-25 22:02:50 UTC (rev 35787)
+++ branches/bmesh/blender/source/blender/python/intern/bpy_array.c	2011-03-26 00:28:10 UTC (rev 35788)
@@ -1,606 +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.
- *
- * Contributor(s): Arystanbek Dyussenov
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include "bpy_rna.h"
-#include "BKE_global.h"
-#include "MEM_guardedalloc.h"
-
-#define MAX_ARRAY_DIMENSION 10
-
-typedef void (*ItemConvertFunc)(PyObject *, char *);
-typedef int  (*ItemTypeCheckFunc)(PyObject *);
-typedef void (*RNA_SetArrayFunc)(PointerRNA *, PropertyRNA *, const char *);
-typedef void (*RNA_SetIndexFunc)(PointerRNA *, PropertyRNA *, int index, void *);
-
-/*
-  arr[3][4][5]
-	  0  1  2  <- dimension index
-*/
-
-/*
-  arr[2] = x
-
-  py_to_array_index(arraydim=0, arrayoffset=0, index=2)
-	validate_array(lvalue_dim=0)
-	... make real index ...
-*/
-
-/* arr[3]=x, self->arraydim is 0, lvalue_dim is 1 */
-/* Ensures that a python sequence has expected number of items/sub-items and items are of desired type. */
-static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[],
-							   ItemTypeCheckFunc check_item_type, const char *item_type_str, const char *error_prefix)
-{
-	int i;
-
-	/* not the last dimension */
-	if (dim + 1 < totdim) {
-		/* check that a sequence contains dimsize[dim] items */
-
-		for (i= 0; i < PySequence_Length(seq); i++) {
-			PyObject *item;
-			int ok= 1;
-			item= PySequence_GetItem(seq, i);
-
-			if (!PySequence_Check(item)) {
-				/* BLI_snprintf(error_str, error_str_size, "expected a sequence of %s", item_type_str); */
-				PyErr_Format(PyExc_TypeError, "%s expected a sequence of %s", error_prefix, item_type_str);
-				ok= 0;
-			}
-			/* arr[3][4][5]
-			   dimsize[1]=4
-			   dimsize[2]=5
-		   
-			   dim=0 */
-			else if (PySequence_Length(item) != dimsize[dim + 1]) {
-				/* BLI_snprintf(error_str, error_str_size, "sequences of dimension %d should contain %d items", (int)dim + 1, (int)dimsize[dim + 1]); */
-				PyErr_Format(PyExc_ValueError, "%s sequences of dimension %d should contain %d items", error_prefix, (int)dim + 1, (int)dimsize[dim + 1]);
-				ok= 0;
-			}
-			else if (!validate_array_type(item, dim + 1, totdim, dimsize, check_item_type, item_type_str, error_prefix)) {
-				ok= 0;
-			}
-
-			Py_DECREF(item);
-
-			if (!ok)
-				return 0;
-		}
-	}
-	else {
-		/* check that items are of correct type */
-		for (i= 0; i < PySequence_Length(seq); i++) {
-			PyObject *item= PySequence_GetItem(seq, i);
-
-			if (!check_item_type(item)) {
-				Py_DECREF(item);
-
-				/* BLI_snprintf(error_str, error_str_size, "sequence items should be of type %s", item_type_str); */
-				PyErr_Format(PyExc_TypeError, "sequence items should be of type %s", item_type_str);
-				return 0;
-			}
-
-			Py_DECREF(item);
-		}
-	}
-
-	return 1;
-}
-
-/* Returns the number of items in a single- or multi-dimensional sequence. */
-static int count_items(PyObject *seq)
-{
-	int totitem= 0;
-
-	if (PySequence_Check(seq)) {
-		int i;
-		for (i= 0; i < PySequence_Length(seq); i++) {
-			PyObject *item= PySequence_GetItem(seq, i);
-			totitem += count_items(item);
-			Py_DECREF(item);
-		}
-	}
-	else
-		totitem= 1;
-
-	return totitem;
-}
-
-/* Modifies property array length if needed and PROP_DYNAMIC flag is set. */
-static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA *prop, int lvalue_dim, int *totitem, const char *error_prefix)
-{
-	int dimsize[MAX_ARRAY_DIMENSION];
-	int tot, totdim, len;
-
-	tot= count_items(rvalue);
-	totdim= RNA_property_array_dimension(ptr, prop, dimsize);
-
-	if ((RNA_property_flag(prop) & PROP_DYNAMIC) && lvalue_dim == 0) {
-		if (RNA_property_array_length(ptr, prop) != tot) {
-#if 0
-			/* length is flexible */
-			if (!RNA_property_dynamic_array_set_length(ptr, prop, tot)) {
-				/* BLI_snprintf(error_str, error_str_size, "%s.%s: array length cannot be changed to %d", RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot); */
-				PyErr_Format(PyExc_ValueError, "%s %s.%s: array length cannot be changed to %d", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot);
-				return 0;
-			}
-#else
-			*totitem= tot;
-			return 1;
-
-#endif
-		}
-
-		len= tot;
-	}
-	else {
-		/* length is a constraint */
-		if (!lvalue_dim) {
-			len= RNA_property_array_length(ptr, prop);
-		}
-		/* array item assignment */
-		else {
-			int i;
-
-			len= 1;
-
-			/* arr[3][4][5]
-
-			   arr[2] = x
-			   dimsize={4, 5}
-			   dimsize[1] = 4
-			   dimsize[2] = 5
-			   lvalue_dim=0, totdim=3
-
-			   arr[2][3] = x
-			   lvalue_dim=1
-
-			   arr[2][3][4] = x
-			   lvalue_dim=2 */
-			for (i= lvalue_dim; i < totdim; i++)
-				len *= dimsize[i];
-		}
-
-		if (tot != len) {
-			/* BLI_snprintf(error_str, error_str_size, "sequence must have length of %d", len); */
-			PyErr_Format(PyExc_ValueError, "%s sequence must have %d items total", error_prefix, len);
-			return 0;
-		}
-	}
-
-	*totitem= len;
-
-	return 1;
-}
-
-static int validate_array(PyObject *rvalue, PointerRNA *ptr, PropertyRNA *prop, int lvalue_dim, ItemTypeCheckFunc check_item_type, const char *item_type_str, int *totitem, const char *error_prefix)
-{
-	int dimsize[MAX_ARRAY_DIMENSION];
-	int totdim= RNA_property_array_dimension(ptr, prop, dimsize);
-
-	/* validate type first because length validation may modify property array length */
-
-	if (!validate_array_type(rvalue, lvalue_dim, totdim, dimsize, check_item_type, item_type_str, error_prefix))
-		return 0;
-
-	return validate_array_length(rvalue, ptr, prop, lvalue_dim, totitem, error_prefix);
-}
-

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list