From 9ea58be54ef62f79017678c20e04590bb5cbdaa1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 28 Aug 2009 14:25:17 +0000 Subject: [PATCH] - povray and ply work now. Again, please try not to break scripts - at least grep the release dir for the names you change. - rna material property rename gloss_amount -> gloss_factor, since its from 0.0 to 1.0, prefix factor is used on other material settings. reflectivity -> reflect_factor --- release/io/engine_render_pov.py | 17 +++++------------ release/io/export_ply.py | 17 ++++++++--------- release/ui/buttons_material.py | 10 +++++----- release/ui/space_sequencer.py | 2 +- source/blender/makesrna/intern/rna_material.c | 6 +++--- 5 files changed, 22 insertions(+), 30 deletions(-) diff --git a/release/io/engine_render_pov.py b/release/io/engine_render_pov.py index f064add505b..c3165d22540 100644 --- a/release/io/engine_render_pov.py +++ b/release/io/engine_render_pov.py @@ -82,8 +82,8 @@ def write_pov(filename, scene=None, info_callback = None): file.write('#declare %s = finish {\n' % name) if material: - file.write('\tdiffuse %.3g\n' % material.diffuse_reflection) - file.write('\tspecular %.3g\n' % material.specular_reflection) + file.write('\tdiffuse %.3g\n' % material.diffuse_intensity) + file.write('\tspecular %.3g\n' % material.specular_intensity) file.write('\tambient %.3g\n' % material.ambient) #file.write('\tambient rgb <%.3g, %.3g, %.3g>\n' % tuple([c*material.ambient for c in world.ambient_color])) # povray blends the global value @@ -101,10 +101,10 @@ def write_pov(filename, scene=None, info_callback = None): if material.raytrace_mirror.enabled: raytrace_mirror= material.raytrace_mirror - if raytrace_mirror.reflect: + if raytrace_mirror.reflect_factor: file.write('\treflection {\n') file.write('\t\trgb <%.3g, %.3g, %.3g>' % tuple(material.mirror_color)) - file.write('\t\tfresnel 1 falloff %.3g exponent %.3g metallic %.3g} ' % (raytrace_mirror.fresnel, raytrace_mirror.fresnel_fac, raytrace_mirror.reflect)) + file.write('\t\tfresnel 1 falloff %.3g exponent %.3g metallic %.3g} ' % (raytrace_mirror.fresnel, raytrace_mirror.fresnel_factor, raytrace_mirror.reflect_factor)) else: file.write('\tdiffuse 0.8\n') @@ -300,14 +300,7 @@ def write_pov(filename, scene=None, info_callback = None): try: vcol_layer = me.active_vertex_color.data except:vcol_layer = None - - def regular_face(f): - fv = f.verts - if fv[3]== 0: - return fv[0], fv[1], fv[2] - return fv[0], fv[1], fv[2], fv[3] - - faces_verts = [regular_face(f) for f in me.faces] + faces_verts = [f.verts for f in me.faces] faces_normals = [tuple(f.normal) for f in me.faces] verts_normals = [tuple(v.normal) for v in me.verts] diff --git a/release/io/export_ply.py b/release/io/export_ply.py index 3668693db16..c293119d3c8 100644 --- a/release/io/export_ply.py +++ b/release/io/export_ply.py @@ -64,7 +64,7 @@ def write(filename, scene, ob, \ raise Exception("Error, Select 1 active object") return - file = open(filename, 'wb') + file = open(filename, 'w') #EXPORT_EDGES = Draw.Create(0) @@ -88,9 +88,9 @@ def write(filename, scene, ob, \ # mesh.transform(ob.matrixWorld) # XXX - faceUV = len(mesh.uv_layers) > 0 + faceUV = len(mesh.uv_textures) > 0 vertexUV = len(mesh.sticky) > 0 - vertexColors = len(mesh.vcol_layers) > 0 + vertexColors = len(mesh.vertex_colors) > 0 if (not faceUV) and (not vertexUV): EXPORT_UV = False if not vertexColors: EXPORT_COLORS = False @@ -100,7 +100,7 @@ def write(filename, scene, ob, \ if faceUV: active_uv_layer = None - for lay in mesh.uv_layers: + for lay in mesh.uv_textures: if lay.active: active_uv_layer= lay.data break @@ -110,7 +110,7 @@ def write(filename, scene, ob, \ if vertexColors: active_col_layer = None - for lay in mesh.vcol_layers: + for lay in mesh.vertex_colors: if lay.active: active_col_layer= lay.data if not active_col_layer: @@ -123,8 +123,8 @@ def write(filename, scene, ob, \ mesh_verts = mesh.verts # save a lookup ply_verts = [] # list of dictionaries # vdict = {} # (index, normal, uv) -> new index - vdict = [{} for i in xrange(len(mesh_verts))] - ply_faces = [[] for f in xrange(len(mesh.faces))] + vdict = [{} for i in range(len(mesh_verts))] + ply_faces = [[] for f in range(len(mesh.faces))] vert_count = 0 for i, f in enumerate(mesh.faces): @@ -141,8 +141,7 @@ def write(filename, scene, ob, \ col = active_col_layer[i] col = col.color1, col.color2, col.color3, col.color4 - f_verts= list(f.verts) - if not f_verts[3]: f_verts.pop() # XXX face length should be 3/4, not always 4 + f_verts= f.verts pf= ply_faces[i] for j, vidx in enumerate(f_verts): diff --git a/release/ui/buttons_material.py b/release/ui/buttons_material.py index e7add9c59f3..e317d990c39 100644 --- a/release/ui/buttons_material.py +++ b/release/ui/buttons_material.py @@ -426,7 +426,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel): split = layout.split() col = split.column() - col.itemR(raym, "reflectivity") + col.itemR(raym, "reflect_factor") col.itemR(mat, "mirror_color", text="") col = split.column() @@ -448,9 +448,9 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel): col = split.column() col.itemL(text="Gloss:") - col.itemR(raym, "gloss_amount", text="Amount") + col.itemR(raym, "gloss_factor", text="Amount") sub = col.column() - sub.active = raym.gloss_amount < 1 + sub.active = raym.gloss_factor < 1.0 sub.itemR(raym, "gloss_threshold", text="Threshold") sub.itemR(raym, "gloss_samples", text="Samples") sub.itemR(raym, "gloss_anisotropic", text="Anisotropic") @@ -511,9 +511,9 @@ class MATERIAL_PT_transp(MaterialButtonsPanel): col = split.column() col.itemL(text="Gloss:") - col.itemR(rayt, "gloss_amount", text="Amount") + col.itemR(rayt, "gloss_factor", text="Amount") sub = col.column() - sub.active = rayt.gloss_amount < 1 + sub.active = rayt.gloss_factor < 1.0 sub.itemR(rayt, "gloss_threshold", text="Threshold") sub.itemR(rayt, "gloss_samples", text="Samples") diff --git a/release/ui/space_sequencer.py b/release/ui/space_sequencer.py index 6b86ea5dabe..de3cfa17987 100644 --- a/release/ui/space_sequencer.py +++ b/release/ui/space_sequencer.py @@ -466,7 +466,7 @@ class SEQUENCER_PT_sound(SequencerButtonsPanel): if not strip: return False - return strip.type in ('SOUND') + return strip.type in ('SOUND', ) def draw(self, context): layout = self.layout diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index e9970e4391e..db573f0a666 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -746,7 +746,7 @@ static void rna_def_material_raymirror(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Enabled", "Enable raytraced reflections."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "reflectivity", PROP_FLOAT, PROP_PERCENTAGE); + prop= RNA_def_property(srna, "reflect_factor", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "ray_mirror"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Reflectivity", "Sets the amount mirror reflection for raytrace."); @@ -764,7 +764,7 @@ static void rna_def_material_raymirror(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Fresnel Factor", "Blending factor for Fresnel."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "gloss_amount", PROP_FLOAT, PROP_PERCENTAGE); + prop= RNA_def_property(srna, "gloss_factor", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "gloss_mir"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Gloss Amount", "The shininess of the reflection. Values < 1.0 give diffuse, blurry reflections."); @@ -835,7 +835,7 @@ static void rna_def_material_raytra(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Fresnel Factor", "Blending factor for Fresnel."); RNA_def_property_update(prop, NC_MATERIAL|ND_SHADING, NULL); - prop= RNA_def_property(srna, "gloss_amount", PROP_FLOAT, PROP_PERCENTAGE); + prop= RNA_def_property(srna, "gloss_factor", PROP_FLOAT, PROP_PERCENTAGE); RNA_def_property_float_sdna(prop, NULL, "gloss_tra"); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Gloss Amount", "The clarity of the refraction. Values < 1.0 give diffuse, blurry refractions.");