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.
This commit is contained in:
2009-09-14 14:55:49 +00:00
parent 3b2ad838e8
commit c8af263e5d
7 changed files with 12 additions and 14 deletions

View File

@@ -118,8 +118,8 @@ def write_mtl(scene, filename, copy_images):
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 @@ def write_mtl(scene, filename, copy_images):
# 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

View File

@@ -770,7 +770,7 @@ class x3d_class:
for i in range(alltexture):
tex = alltextures[i]
if tex.type != 'IMAGE':
if tex.type != 'IMAGE' or tex.image == None:
continue
namemat = tex.name

View File

@@ -463,7 +463,8 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
'''
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)

View File

@@ -715,7 +715,7 @@ def create_mesh(scn, new_objects, has_ngons, CREATE_FGONS, CREATE_EDGES, verts_l
# 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']

View File

@@ -981,10 +981,13 @@ static void rna_def_mface(BlenderRNA *brna)
// 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);

View File

@@ -1,5 +1,5 @@
/**
*
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*

View File

@@ -545,9 +545,6 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *v
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 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *v
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;
}