diff --git a/release/scripts/op/io_scene_x3d/export_x3d.py b/release/scripts/op/io_scene_x3d/export_x3d.py
index 6bc667e242b..4d6e8181203 100644
--- a/release/scripts/op/io_scene_x3d/export_x3d.py
+++ b/release/scripts/op/io_scene_x3d/export_x3d.py
@@ -44,6 +44,9 @@ from io_utils import create_derived_objects, free_derived_objects
DEG2RAD=0.017453292519943295
MATWORLD= mathutils.Matrix.Rotation(-90, 4, 'X')
+def round_color(col, cp):
+ return tuple([round(max(min(c, 1.0), 0.0), cp) for c in col])
+
####################################
# Global Variables
####################################
@@ -218,15 +221,13 @@ class x3d_class:
if world:
mtype = world.mist_settings.falloff
mparam = world.mist_settings
- grd = world.horizon_color
- grd0, grd1, grd2 = grd[0], grd[1], grd[2]
else:
return
if (mtype == 'LINEAR' or mtype == 'INVERSE_QUADRATIC'):
mtype = 1 if mtype == 'LINEAR' else 2
# if (mtype == 1 or mtype == 2):
self.file.write("\n\n" % round(mparam[2],self.cp))
else:
return
@@ -238,11 +239,10 @@ class x3d_class:
safeName = self.cleanStr(ob.name)
if world:
ambi = world.ambient_color
- # ambi = world.amb
- ambientIntensity = ((float(ambi[0] + ambi[1] + ambi[2]))/3)/2.5
+ ambientIntensity = ((ambi[0] + ambi[1] + ambi[2]) / 3.0) / 2.5
+ del ambi
else:
- ambi = 0
- ambientIntensity = 0
+ ambientIntensity = 0.0
# compute cutoff and beamwidth
intensity=min(lamp.energy/1.75,1.0)
@@ -264,8 +264,7 @@ class x3d_class:
self.file.write("radius=\"%s\" " % (round(radius,self.cp)))
self.file.write("ambientIntensity=\"%s\" " % (round(ambientIntensity,self.cp)))
self.file.write("intensity=\"%s\" " % (round(intensity,self.cp)))
- self.file.write("color=\"%s %s %s\" " % (round(lamp.color[0],self.cp), round(lamp.color[1],self.cp), round(lamp.color[2],self.cp)))
- # self.file.write("color=\"%s %s %s\" " % (round(lamp.col[0],self.cp), round(lamp.col[1],self.cp), round(lamp.col[2],self.cp)))
+ self.file.write("color=\"%s %s %s\" " % round_color(lamp.color, self.cp))
self.file.write("beamWidth=\"%s\" " % (round(beamWidth,self.cp)))
self.file.write("cutOffAngle=\"%s\" " % (round(cutOffAngle,self.cp)))
self.file.write("direction=\"%s %s %s\" " % (round(dx,3),round(dy,3),round(dz,3)))
@@ -618,51 +617,31 @@ class x3d_class:
self.matNames[matName] = 1
+ emit = mat.emit
ambient = mat.ambient / 3.0
- diffuseR, diffuseG, diffuseB = mat.diffuse_color
+ diffuseColor = tuple(mat.diffuse_color)
if world:
- ambi = world.ambient_color
- ambi0, ambi1, ambi2 = (ambi[0] * mat.ambient) * 2.0, (ambi[1] * mat.ambient) * 2.0, (ambi[2] * mat.ambient) * 2.0
+ ambiColor = tuple(((c * mat.ambient) * 2.0) for c in world.ambient_color)
else:
- ambi0, ambi1, ambi2 = 0.0, 0.0, 0.0
-
- emisR, emisG, emisB = (diffuseR*mat.emit+ambi0) / 2.0, (diffuseG*mat.emit+ambi1) / 2.0, (diffuseB*mat.emit+ambi2) / 2.0
- del ambi0, ambi1, ambi2
-
- shininess = mat.specular_hardness/512.0
- specR = (mat.specular_color[0]+0.001)/(1.25/(mat.specular_intensity+0.001))
- specG = (mat.specular_color[1]+0.001)/(1.25/(mat.specular_intensity+0.001))
- specB = (mat.specular_color[2]+0.001)/(1.25/(mat.specular_intensity+0.001))
+ ambiColor = 0.0, 0.0, 0.0
+ emitColor = tuple(((c * emit) + ambiColor[i]) / 2.0 for i, c in enumerate(diffuseColor))
+ shininess = mat.specular_hardness / 512.0
+ specColor = tuple((c + 0.001) / (1.25 / (mat.specular_intensity + 0.001)) for c in mat.specular_color)
transp = 1.0 - mat.alpha
if mat.use_shadeless:
- ambient = 1
- shine = 1
- specR = emitR = diffuseR
- specG = emitG = diffuseG
- specB = emitB = diffuseB
-
- # Clamp to be safe
- specR= max(min(specR, 1.0), 0.0)
- specG= max(min(specG, 1.0), 0.0)
- specB= max(min(specB, 1.0), 0.0)
-
- diffuseR= max(min(diffuseR, 1.0), 0.0)
- diffuseG= max(min(diffuseG, 1.0), 0.0)
- diffuseB= max(min(diffuseB, 1.0), 0.0)
-
- emitR= max(min(emitR, 1.0), 0.0)
- emitG= max(min(emitG, 1.0), 0.0)
- emitB= max(min(emitB, 1.0), 0.0)
+ ambient = 1.0
+ shininess = 0.0
+ specColor = emitColor = diffuseColor
self.writeIndented("" % (round(transp,self.cp)))
+ self.file.write("diffuseColor=\"%s %s %s\" " % round_color(diffuseColor, self.cp))
+ self.file.write("specularColor=\"%s %s %s\" " % round_color(specColor, self.cp))
+ self.file.write("emissiveColor=\"%s %s %s\" \n" % round_color(emitColor, self.cp))
+ self.writeIndented("ambientIntensity=\"%s\" " % (round(ambient, self.cp)))
+ self.file.write("shininess=\"%s\" " % (round(shininess, self.cp)))
+ self.file.write("transparency=\"%s\" />" % (round(transp, self.cp)))
self.writeIndented("\n",-1)
def writeImageTexture(self, image):
@@ -680,54 +659,45 @@ class x3d_class:
def writeBackground(self, world, alltextures):
if world: worldname = world.name
else: return
- blending = (world.use_sky_blend, world.use_sky_paper, world.use_sky_real)
- # blending = world.getSkytype()
- grd = world.horizon_color
- # grd = world.getHor()
- grd0, grd1, grd2 = grd[0], grd[1], grd[2]
- sky = world.zenith_color
- # sky = world.getZen()
- sky0, sky1, sky2 = sky[0], sky[1], sky[2]
- mix0, mix1, mix2 = grd[0]+sky[0], grd[1]+sky[1], grd[2]+sky[2]
- mix0, mix1, mix2 = mix0/2, mix1/2, mix2/2
+ blending = world.use_sky_blend, world.use_sky_paper, world.use_sky_real
+
+ grd_triple = round_color(world.horizon_color, self.cp)
+ sky_triple = round_color(world.zenith_color, self.cp)
+ mix_triple = round_color(((grd_triple[i] + sky_triple[i]) / 2.0 for i in range(3)), self.cp)
+
self.file.write("\n\n")
##########################################################
@@ -812,18 +775,13 @@ class x3d_class:
# for ob, ob_mat in BPyObject.getDerivedObjects(ob_main):
objType=ob.type
objName=ob.name
- if objType == "CAMERA":
- # if objType == "Camera":
+ if objType == 'CAMERA':
self.writeViewpoint(ob, ob_mat, scene)
- elif objType in ("MESH", "CURVE", "SURF", "TEXT") :
- # elif objType in ("Mesh", "Curve", "Surf", "Text") :
+ elif objType in ('MESH', 'CURVE', 'SURF', 'FONT') :
if EXPORT_APPLY_MODIFIERS or objType != 'MESH':
- # if EXPORT_APPLY_MODIFIERS or objType != 'Mesh':
me = ob.create_mesh(scene, EXPORT_APPLY_MODIFIERS, 'PREVIEW')
- # me= BPyMesh.getMeshFromObject(ob, containerMesh, EXPORT_APPLY_MODIFIERS, False, scene)
else:
me = ob.data
- # me = ob.getData(mesh=1)
self.writeIndexedFaceSet(ob, me, ob_mat, world, EXPORT_TRI = EXPORT_TRI)
@@ -831,24 +789,17 @@ class x3d_class:
if me != ob.data:
bpy.data.meshes.remove(me)
- elif objType == "LAMP":
- # elif objType == "Lamp":
+ elif objType == 'LAMP':
data= ob.data
datatype=data.type
if datatype == 'POINT':
- # if datatype == Lamp.Types.Lamp:
self.writePointLight(ob, ob_mat, data, world)
elif datatype == 'SPOT':
- # elif datatype == Lamp.Types.Spot:
self.writeSpotLight(ob, ob_mat, data, world)
elif datatype == 'SUN':
- # elif datatype == Lamp.Types.Sun:
self.writeDirectionalLight(ob, ob_mat, data, world)
else:
self.writeDirectionalLight(ob, ob_mat, data, world)
- # do you think x3d could document what to do with dummy objects?
- #elif objType == "Empty" and objName != "Empty":
- # self.writeNode(ob, ob_mat)
else:
#print "Info: Ignoring [%s], object type [%s] not handle yet" % (object.name,object.getType)
pass
diff --git a/release/scripts/templates/background_job.py b/release/scripts/templates/background_job.py
index f887e6feaef..5705e8ef53e 100644
--- a/release/scripts/templates/background_job.py
+++ b/release/scripts/templates/background_job.py
@@ -18,7 +18,7 @@ def example_function(body_text, save_path, render_path):
for obj in scene.objects:
scene.objects.unlink(obj)
- txt_data = bpy.data.curves.new(name="MyText", type='TEXT')
+ txt_data = bpy.data.curves.new(name="MyText", type='FONT')
# Text Object
txt_ob = bpy.data.objects.new(name="MyText", object_data=txt_data)
diff --git a/release/scripts/ui/properties_data_metaball.py b/release/scripts/ui/properties_data_metaball.py
index b4bf8dc5d70..051841562e0 100644
--- a/release/scripts/ui/properties_data_metaball.py
+++ b/release/scripts/ui/properties_data_metaball.py
@@ -115,7 +115,7 @@ class DATA_PT_metaball_element(DataButtonsPanel, bpy.types.Panel):
col.prop(metaelem, "size_y", text="Y")
-class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
+class DATA_PT_custom_props_metaball(PropertyPanel, DataButtonsPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py
index 22ae16bf041..3a3a526dab5 100644
--- a/release/scripts/ui/space_view3d.py
+++ b/release/scripts/ui/space_view3d.py
@@ -755,7 +755,7 @@ class VIEW3D_MT_object_specials(bpy.types.Menu):
props.data_path_item = "data.dof_distance"
props.input_scale = 0.02
- if obj.type in ('CURVE', 'TEXT'):
+ if obj.type in ('CURVE', 'FONT'):
layout.operator_context = 'INVOKE_REGION_WIN'
props = layout.operator("wm.context_modal_mouse", text="Extrude Size")