[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23222] branches/soc-2009-kazanbas: Reverted Mesh. verts from dynamic array since it breaks foreach_set used by import scripts .

Arystanbek Dyussenov arystan.d at gmail.com
Mon Sep 14 16:55:50 CEST 2009


Revision: 23222
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23222
Author:   kazanbas
Date:     2009-09-14 16:55:49 +0200 (Mon, 14 Sep 2009)

Log Message:
-----------
Reverted Mesh.verts from dynamic array since it breaks foreach_set used by import scripts.
Did a few fixes in scripts to reflect recent RNA changes.

Modified Paths:
--------------
    branches/soc-2009-kazanbas/release/io/export_obj.py
    branches/soc-2009-kazanbas/release/io/export_x3d.py
    branches/soc-2009-kazanbas/release/io/import_3ds.py
    branches/soc-2009-kazanbas/release/io/import_obj.py
    branches/soc-2009-kazanbas/source/blender/makesrna/intern/rna_mesh.c
    branches/soc-2009-kazanbas/source/blender/python/intern/bpy_array.c
    branches/soc-2009-kazanbas/source/blender/python/intern/bpy_rna.c

Modified: branches/soc-2009-kazanbas/release/io/export_obj.py
===================================================================
--- branches/soc-2009-kazanbas/release/io/export_obj.py	2009-09-14 14:45:32 UTC (rev 23221)
+++ branches/soc-2009-kazanbas/release/io/export_obj.py	2009-09-14 14:55:49 UTC (rev 23222)
@@ -118,8 +118,8 @@
 		if mat:
 			file.write('Ns %.6f\n' % ((mat.specular_hardness-1) * 1.9607843137254901) ) # Hardness, convert blenders 1-511 to MTL's
 			file.write('Ka %.6f %.6f %.6f\n' %	tuple([c*mat.ambient for c in worldAmb])  ) # Ambient, uses mirror colour,
-			file.write('Kd %.6f %.6f %.6f\n' % tuple([c*mat.diffuse_reflection for c in mat.diffuse_color]) ) # Diffuse
-			file.write('Ks %.6f %.6f %.6f\n' % tuple([c*mat.specular_reflection for c in mat.specular_color]) ) # Specular
+			file.write('Kd %.6f %.6f %.6f\n' % tuple([c*mat.diffuse_intensity for c in mat.diffuse_color]) ) # Diffuse
+			file.write('Ks %.6f %.6f %.6f\n' % tuple([c*mat.specular_intensity for c in mat.specular_color]) ) # Specular
 			if hasattr(mat, "ior"):
 				file.write('Ni %.6f\n' % mat.ior) # Refraction index
 			else:
@@ -129,7 +129,7 @@
 			# 0 to disable lighting, 1 for ambient & diffuse only (specular color set to black), 2 for full lighting.
 			if mat.shadeless:
 				file.write('illum 0\n') # ignore lighting
-			elif mat.specular_reflection == 0:
+			elif mat.specular_intensity == 0:
 				file.write('illum 1\n') # no specular.
 			else:
 				file.write('illum 2\n') # light normaly	

Modified: branches/soc-2009-kazanbas/release/io/export_x3d.py
===================================================================
--- branches/soc-2009-kazanbas/release/io/export_x3d.py	2009-09-14 14:45:32 UTC (rev 23221)
+++ branches/soc-2009-kazanbas/release/io/export_x3d.py	2009-09-14 14:55:49 UTC (rev 23222)
@@ -770,7 +770,7 @@
 		for i in range(alltexture):
 			tex = alltextures[i]
 
-			if tex.type != 'IMAGE':
+			if tex.type != 'IMAGE' or tex.image == None:
 				continue
 
 			namemat = tex.name

Modified: branches/soc-2009-kazanbas/release/io/import_3ds.py
===================================================================
--- branches/soc-2009-kazanbas/release/io/import_3ds.py	2009-09-14 14:45:32 UTC (rev 23221)
+++ branches/soc-2009-kazanbas/release/io/import_3ds.py	2009-09-14 14:55:49 UTC (rev 23222)
@@ -463,7 +463,8 @@
 			'''
 			
 			if contextMatrix_rot:
-				ob.matrix = [x for row in contextMatrix_rot for x in row]
+				# ob.matrix = [x for row in contextMatrix_rot for x in row]
+				ob.matrix = contextMatrix_rot
 # 				ob.setMatrix(contextMatrix_rot)
 			
 			importedObjects.append(ob)

Modified: branches/soc-2009-kazanbas/release/io/import_obj.py
===================================================================
--- branches/soc-2009-kazanbas/release/io/import_obj.py	2009-09-14 14:45:32 UTC (rev 23221)
+++ branches/soc-2009-kazanbas/release/io/import_obj.py	2009-09-14 14:55:49 UTC (rev 23222)
@@ -715,7 +715,7 @@
 # 	face_mapping= me.faces.extend([f[0] for f in faces], indexList=True)
 	
 	if verts_tex and me.faces:
-		me.add_uv_layer()
+		me.add_uv_texture()
 # 		me.faceUV= 1
 		# TEXMODE= Mesh.FaceModes['TEX']
 	

Modified: branches/soc-2009-kazanbas/source/blender/makesrna/intern/rna_mesh.c
===================================================================
--- branches/soc-2009-kazanbas/source/blender/makesrna/intern/rna_mesh.c	2009-09-14 14:45:32 UTC (rev 23221)
+++ branches/soc-2009-kazanbas/source/blender/makesrna/intern/rna_mesh.c	2009-09-14 14:55:49 UTC (rev 23222)
@@ -981,10 +981,13 @@
 
 	// XXX allows creating invalid meshes
 	prop= RNA_def_property(srna, "verts", PROP_INT, PROP_UNSIGNED);
+	RNA_def_property_int_sdna(prop, NULL, "v1");
 	RNA_def_property_array(prop, 4);
+	/*
 	RNA_def_property_flag(prop, PROP_DYNAMIC);
 	RNA_def_property_dynamic_array_funcs(prop, "rna_MeshFace_verts_get_length");
 	RNA_def_property_int_funcs(prop, "rna_MeshFace_verts_get", "rna_MeshFace_verts_set", NULL);
+	*/
 	RNA_def_property_ui_text(prop, "Vertices", "Vertex indices");
 
 	prop= RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);

Modified: branches/soc-2009-kazanbas/source/blender/python/intern/bpy_array.c
===================================================================
--- branches/soc-2009-kazanbas/source/blender/python/intern/bpy_array.c	2009-09-14 14:45:32 UTC (rev 23221)
+++ branches/soc-2009-kazanbas/source/blender/python/intern/bpy_array.c	2009-09-14 14:55:49 UTC (rev 23222)
@@ -1,5 +1,5 @@
 /**
- * 
+ * $Id$
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *

Modified: branches/soc-2009-kazanbas/source/blender/python/intern/bpy_rna.c
===================================================================
--- branches/soc-2009-kazanbas/source/blender/python/intern/bpy_rna.c	2009-09-14 14:45:32 UTC (rev 23221)
+++ branches/soc-2009-kazanbas/source/blender/python/intern/bpy_rna.c	2009-09-14 14:55:49 UTC (rev 23222)
@@ -545,9 +545,6 @@
 	int len = RNA_property_array_length(ptr, prop);
 	
 	if (len > 0) {
-		/* char error_str[512]; */
-		int ok= 1;
-
 #ifdef USE_MATHUTILS
 		if(MatrixObject_Check(value)) {
 			MatrixObject *mat = (MatrixObject*)value;
@@ -559,10 +556,7 @@
 			PyErr_Format(PyExc_TypeError, "%.200s RNA array assignment expected a sequence instead of %.200s instance.", error_prefix, Py_TYPE(value)->tp_name);
 			return -1;
 		}
-		/* done getting the length */
-		ok= pyrna_py_to_array(ptr, prop, data, value, error_prefix);
-
-		if (!ok) {
+		else if (!pyrna_py_to_array(ptr, prop, data, value, error_prefix)) {
 			/* PyErr_Format(PyExc_AttributeError, "%.200s %s", error_prefix, error_str); */
 			return -1;
 		}





More information about the Bf-blender-cvs mailing list