[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22842] branches/blender2.5/blender: - povray and ply work now.

Campbell Barton ideasman42 at gmail.com
Fri Aug 28 16:25:18 CEST 2009


Revision: 22842
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22842
Author:   campbellbarton
Date:     2009-08-28 16:25:17 +0200 (Fri, 28 Aug 2009)

Log Message:
-----------
- 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
 

Modified Paths:
--------------
    branches/blender2.5/blender/release/io/engine_render_pov.py
    branches/blender2.5/blender/release/io/export_ply.py
    branches/blender2.5/blender/release/ui/buttons_material.py
    branches/blender2.5/blender/release/ui/space_sequencer.py
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c

Modified: branches/blender2.5/blender/release/io/engine_render_pov.py
===================================================================
--- branches/blender2.5/blender/release/io/engine_render_pov.py	2009-08-28 14:15:43 UTC (rev 22841)
+++ branches/blender2.5/blender/release/io/engine_render_pov.py	2009-08-28 14:25:17 UTC (rev 22842)
@@ -82,8 +82,8 @@
 		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 @@
 			
 			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 @@
 			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]
 			

Modified: branches/blender2.5/blender/release/io/export_ply.py
===================================================================
--- branches/blender2.5/blender/release/io/export_ply.py	2009-08-28 14:15:43 UTC (rev 22841)
+++ branches/blender2.5/blender/release/io/export_ply.py	2009-08-28 14:25:17 UTC (rev 22842)
@@ -64,7 +64,7 @@
 		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 @@
 	
 	# 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 @@
 		
 	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 @@
 	
 	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 @@
 	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 @@
 			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):

Modified: branches/blender2.5/blender/release/ui/buttons_material.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_material.py	2009-08-28 14:15:43 UTC (rev 22841)
+++ branches/blender2.5/blender/release/ui/buttons_material.py	2009-08-28 14:25:17 UTC (rev 22842)
@@ -426,7 +426,7 @@
 		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 @@
 		
 		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 @@
 			
 			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")
 

Modified: branches/blender2.5/blender/release/ui/space_sequencer.py
===================================================================
--- branches/blender2.5/blender/release/ui/space_sequencer.py	2009-08-28 14:15:43 UTC (rev 22841)
+++ branches/blender2.5/blender/release/ui/space_sequencer.py	2009-08-28 14:25:17 UTC (rev 22842)
@@ -466,7 +466,7 @@
 		if not strip:
 			return False
 		
-		return strip.type in ('SOUND')
+		return strip.type in ('SOUND', )
 	
 	def draw(self, context):
 		layout = self.layout

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c	2009-08-28 14:15:43 UTC (rev 22841)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c	2009-08-28 14:25:17 UTC (rev 22842)
@@ -746,7 +746,7 @@
 	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 @@
 	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 @@
 	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.");





More information about the Bf-blender-cvs mailing list