[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21981] branches/soc-2009-yukishiro: merge till 21980
Jingyuan Huang
jingyuan.huang at gmail.com
Tue Jul 28 19:53:01 CEST 2009
Revision: 21981
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21981
Author: yukishiro
Date: 2009-07-28 19:53:01 +0200 (Tue, 28 Jul 2009)
Log Message:
-----------
merge till 21980
Modified Paths:
--------------
branches/soc-2009-yukishiro/config/darwin-config.py
branches/soc-2009-yukishiro/release/io/export_ply.py
branches/soc-2009-yukishiro/release/ui/buttons_data_armature.py
branches/soc-2009-yukishiro/release/ui/buttons_data_bone.py
branches/soc-2009-yukishiro/release/ui/buttons_data_camera.py
branches/soc-2009-yukishiro/release/ui/buttons_data_curve.py
branches/soc-2009-yukishiro/release/ui/buttons_data_empty.py
branches/soc-2009-yukishiro/release/ui/buttons_data_lamp.py
branches/soc-2009-yukishiro/release/ui/buttons_data_lattice.py
branches/soc-2009-yukishiro/release/ui/buttons_data_mesh.py
branches/soc-2009-yukishiro/release/ui/buttons_data_modifier.py
branches/soc-2009-yukishiro/release/ui/buttons_data_text.py
branches/soc-2009-yukishiro/release/ui/space_view3d_toolbar.py
branches/soc-2009-yukishiro/source/blender/blenkernel/BKE_context.h
branches/soc-2009-yukishiro/source/blender/blenkernel/intern/context.c
branches/soc-2009-yukishiro/source/blender/blenlib/intern/storage.c
branches/soc-2009-yukishiro/source/blender/editors/animation/anim_channels.c
branches/soc-2009-yukishiro/source/blender/editors/animation/anim_draw.c
branches/soc-2009-yukishiro/source/blender/editors/animation/anim_filter.c
branches/soc-2009-yukishiro/source/blender/editors/animation/anim_ops.c
branches/soc-2009-yukishiro/source/blender/editors/animation/keyframing.c
branches/soc-2009-yukishiro/source/blender/editors/armature/editarmature.c
branches/soc-2009-yukishiro/source/blender/editors/curve/editfont.c
branches/soc-2009-yukishiro/source/blender/editors/include/ED_anim_api.h
branches/soc-2009-yukishiro/source/blender/editors/include/ED_fileselect.h
branches/soc-2009-yukishiro/source/blender/editors/include/UI_interface.h
branches/soc-2009-yukishiro/source/blender/editors/interface/interface.c
branches/soc-2009-yukishiro/source/blender/editors/interface/interface_handlers.c
branches/soc-2009-yukishiro/source/blender/editors/object/object_edit.c
branches/soc-2009-yukishiro/source/blender/editors/object/object_intern.h
branches/soc-2009-yukishiro/source/blender/editors/object/object_ops.c
branches/soc-2009-yukishiro/source/blender/editors/screen/screen_ops.c
branches/soc-2009-yukishiro/source/blender/editors/screen/screendump.c
branches/soc-2009-yukishiro/source/blender/editors/sculpt_paint/paint_image.c
branches/soc-2009-yukishiro/source/blender/editors/space_action/action_header.c
branches/soc-2009-yukishiro/source/blender/editors/space_action/space_action.c
branches/soc-2009-yukishiro/source/blender/editors/space_buttons/buttons_context.c
branches/soc-2009-yukishiro/source/blender/editors/space_buttons/buttons_header.c
branches/soc-2009-yukishiro/source/blender/editors/space_buttons/buttons_ops.c
branches/soc-2009-yukishiro/source/blender/editors/space_buttons/space_buttons.c
branches/soc-2009-yukishiro/source/blender/editors/space_console/console_draw.c
branches/soc-2009-yukishiro/source/blender/editors/space_console/console_intern.h
branches/soc-2009-yukishiro/source/blender/editors/space_console/console_ops.c
branches/soc-2009-yukishiro/source/blender/editors/space_console/space_console.c
branches/soc-2009-yukishiro/source/blender/editors/space_file/file_draw.c
branches/soc-2009-yukishiro/source/blender/editors/space_file/file_ops.c
branches/soc-2009-yukishiro/source/blender/editors/space_file/file_panels.c
branches/soc-2009-yukishiro/source/blender/editors/space_file/filelist.c
branches/soc-2009-yukishiro/source/blender/editors/space_file/filelist.h
branches/soc-2009-yukishiro/source/blender/editors/space_file/filesel.c
branches/soc-2009-yukishiro/source/blender/editors/space_file/fsmenu.c
branches/soc-2009-yukishiro/source/blender/editors/space_file/space_file.c
branches/soc-2009-yukishiro/source/blender/editors/space_graph/graph_buttons.c
branches/soc-2009-yukishiro/source/blender/editors/space_graph/graph_draw.c
branches/soc-2009-yukishiro/source/blender/editors/space_graph/graph_edit.c
branches/soc-2009-yukishiro/source/blender/editors/space_graph/graph_header.c
branches/soc-2009-yukishiro/source/blender/editors/space_graph/graph_ops.c
branches/soc-2009-yukishiro/source/blender/editors/space_graph/graph_select.c
branches/soc-2009-yukishiro/source/blender/editors/space_graph/space_graph.c
branches/soc-2009-yukishiro/source/blender/editors/space_image/image_buttons.c
branches/soc-2009-yukishiro/source/blender/editors/space_image/image_header.c
branches/soc-2009-yukishiro/source/blender/editors/space_image/image_ops.c
branches/soc-2009-yukishiro/source/blender/editors/space_image/space_image.c
branches/soc-2009-yukishiro/source/blender/editors/space_info/info_ops.c
branches/soc-2009-yukishiro/source/blender/editors/space_logic/logic_buttons.c
branches/soc-2009-yukishiro/source/blender/editors/space_logic/logic_header.c
branches/soc-2009-yukishiro/source/blender/editors/space_logic/logic_window.c
branches/soc-2009-yukishiro/source/blender/editors/space_logic/space_logic.c
branches/soc-2009-yukishiro/source/blender/editors/space_nla/nla_channels.c
branches/soc-2009-yukishiro/source/blender/editors/space_nla/nla_draw.c
branches/soc-2009-yukishiro/source/blender/editors/space_nla/nla_edit.c
branches/soc-2009-yukishiro/source/blender/editors/space_nla/nla_header.c
branches/soc-2009-yukishiro/source/blender/editors/space_nla/space_nla.c
branches/soc-2009-yukishiro/source/blender/editors/space_node/node_draw.c
branches/soc-2009-yukishiro/source/blender/editors/space_node/node_edit.c
branches/soc-2009-yukishiro/source/blender/editors/space_node/node_header.c
branches/soc-2009-yukishiro/source/blender/editors/space_node/node_select.c
branches/soc-2009-yukishiro/source/blender/editors/space_node/node_state.c
branches/soc-2009-yukishiro/source/blender/editors/space_node/space_node.c
branches/soc-2009-yukishiro/source/blender/editors/space_outliner/outliner.c
branches/soc-2009-yukishiro/source/blender/editors/space_outliner/outliner_header.c
branches/soc-2009-yukishiro/source/blender/editors/space_sequencer/sequencer_add.c
branches/soc-2009-yukishiro/source/blender/editors/space_text/text_ops.c
branches/soc-2009-yukishiro/source/blender/editors/space_time/space_time.c
branches/soc-2009-yukishiro/source/blender/editors/space_time/time_header.c
branches/soc-2009-yukishiro/source/blender/editors/space_view3d/view3d_header.c
branches/soc-2009-yukishiro/source/blender/editors/transform/transform_conversions.c
branches/soc-2009-yukishiro/source/blender/editors/uvedit/uvedit_ops.c
branches/soc-2009-yukishiro/source/blender/imbuf/intern/IMB_targa.h
branches/soc-2009-yukishiro/source/blender/imbuf/intern/readimage.c
branches/soc-2009-yukishiro/source/blender/imbuf/intern/targa.c
branches/soc-2009-yukishiro/source/blender/makesdna/DNA_action_types.h
branches/soc-2009-yukishiro/source/blender/makesdna/DNA_space_types.h
branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_mesh.c
branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_modifier.c
branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_object_api.c
branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_render.c
branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_space.c
branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_ui.c
branches/soc-2009-yukishiro/source/blender/makesrna/intern/rna_userdef.c
branches/soc-2009-yukishiro/source/blender/python/intern/bpy_rna.c
branches/soc-2009-yukishiro/source/blender/render/extern/include/RE_pipeline.h
branches/soc-2009-yukishiro/source/blender/render/intern/source/pipeline.c
branches/soc-2009-yukishiro/source/blender/windowmanager/WM_api.h
branches/soc-2009-yukishiro/source/blender/windowmanager/intern/wm_event_system.c
branches/soc-2009-yukishiro/source/blender/windowmanager/intern/wm_keymap.c
branches/soc-2009-yukishiro/source/blender/windowmanager/intern/wm_operators.c
branches/soc-2009-yukishiro/source/blender/windowmanager/wm_event_types.h
branches/soc-2009-yukishiro/source/creator/CMakeLists.txt
branches/soc-2009-yukishiro/tools/Blender.py
Added Paths:
-----------
branches/soc-2009-yukishiro/release/io/engine_render_pov.py
Modified: branches/soc-2009-yukishiro/config/darwin-config.py
===================================================================
--- branches/soc-2009-yukishiro/config/darwin-config.py 2009-07-28 17:46:59 UTC (rev 21980)
+++ branches/soc-2009-yukishiro/config/darwin-config.py 2009-07-28 17:53:01 UTC (rev 21981)
@@ -10,8 +10,6 @@
# IMPORTANT NOTE : OFFICIAL BUILDS SHOULD BE DONE WITH SDKs
USE_SDK=True
-BF_PYTHON_VERSION = '2.3'
-
cmd = 'uname -p'
MAC_PROC=commands.getoutput(cmd)
cmd = 'uname -r'
@@ -32,9 +30,12 @@
if MAC_PROC== 'powerpc' and BF_PYTHON_VERSION == '2.3':
MAC_MIN_VERS = '10.3'
MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
-else:
+elif MAC_CUR_VER=='10.4':
MAC_MIN_VERS = '10.4'
MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
+else:
+ MAC_MIN_VERS = '10.5'
+ MACOSX_SDK='/Developer/SDKs/MacOSX10.5.sdk'
# enable ffmpeg support
@@ -46,24 +47,35 @@
#BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
#BF_FFMPEG_LIB = 'avformat.a avcodec.a avutil.a'
-# python.org libs install in /library we want to use that for 2.5
-#
-# if you want py2.5 on leopard without installing
-# change value to BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
-# BEWARE: in that case it will work only on leopard
+BF_PYTHON_VERSION = '3.1'
-if BF_PYTHON_VERSION=='2.3':
- BF_PYTHON = '/System/Library/Frameworks/Python.framework/Versions/'
+if BF_PYTHON_VERSION=='3.1':
+ # python 3.1 uses precompiled libraries in bf svn /lib by default
+
+ BF_PYTHON = LIBDIR + '/python'
+ BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
+ # BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
+ BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
+ BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
+ # BF_PYTHON_LINKFLAGS = '-u _PyMac_Error -framework System'
else:
- BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
+ # python 2.5 etc. uses built-in framework
-BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}'
-BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
-BF_PYTHON_LIB = ''
-BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config'
-BF_PYTHON_LINKFLAGS = '-u _PyMac_Error -framework System -framework Python'
-if MAC_CUR_VER=='10.3' or MAC_CUR_VER=='10.4':
- BF_PYTHON_LINKFLAGS ='-u __dummy '+BF_PYTHON_LINKFLAGS
+ # python.org libs install in /library we want to use that for 2.5
+ #
+ # if you want py2.5 on leopard without installing
+ # change value to BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
+ # BEWARE: in that case it will work only on leopard
+
+ BF_PYTHON = '/System/Library/Frameworks/Python.framework/Versions/'
+
+ BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}'
+ BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
+ BF_PYTHON_LIB = ''
+ BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config'
+ BF_PYTHON_LINKFLAGS = '-u _PyMac_Error -framework System -framework Python'
+ if MAC_CUR_VER=='10.3' or MAC_CUR_VER=='10.4':
+ BF_PYTHON_LINKFLAGS ='-u __dummy '+BF_PYTHON_LINKFLAGS
BF_QUIET = '1'
WITH_BF_OPENMP = '0'
Copied: branches/soc-2009-yukishiro/release/io/engine_render_pov.py (from rev 21980, branches/blender2.5/blender/release/io/engine_render_pov.py)
===================================================================
--- branches/soc-2009-yukishiro/release/io/engine_render_pov.py (rev 0)
+++ branches/soc-2009-yukishiro/release/io/engine_render_pov.py 2009-07-28 17:53:01 UTC (rev 21981)
@@ -0,0 +1,580 @@
+import bpy
+
+from math import atan, pi, degrees
+import subprocess
+import os
+import sys
+import time
+
+import platform as pltfrm
+
+if pltfrm.architecture()[0] == '64bit':
+ bitness = 64
+else:
+ bitness = 32
+
+def write_pov(filename, scene=None, info_callback = None):
+ file = open(filename, 'w')
+
+ # Only for testing
+ if not scene:
+ scene = bpy.data.scenes[0]
+
+ render = scene.render_data
+ materialTable = {}
+
+ def saneName(name):
+ name = name.lower()
+ for ch in ' /\\+=-[]{}().,<>\'":;~!@#$%^&*|?':
+ name = name.replace(ch, '_')
+ return name
+
+ def writeMatrix(matrix):
+ file.write('\tmatrix <%.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f>\n' %\
+ (matrix[0][0], matrix[0][1], matrix[0][2], matrix[1][0], matrix[1][1], matrix[1][2], matrix[2][0], matrix[2][1], matrix[2][2], matrix[3][0], matrix[3][1], matrix[3][2]) )
+
+ def exportCamera():
+ camera = scene.camera
+ matrix = camera.matrix
+
+ # compute resolution
+ Qsize=float(render.resolution_x)/float(render.resolution_y)
+
+ file.write('camera {\n')
+ file.write('\tlocation <0, 0, 0>\n')
+ file.write('\tlook_at <0, 0, -1>\n')
+ file.write('\tright <%s, 0, 0>\n' % -Qsize)
+ file.write('\tup <0, 1, 0>\n')
+ file.write('\tangle %f \n' % (360.0*atan(16.0/camera.data.lens)/pi))
+
+ file.write('\trotate <%.6f, %.6f, %.6f>\n' % tuple([degrees(e) for e in matrix.rotationPart().toEuler()]))
+ file.write('\ttranslate <%.6f, %.6f, %.6f>\n' % (matrix[3][0], matrix[3][1], matrix[3][2]))
+ file.write('}\n')
+
+
+
+ def exportLamps(lamps):
+ # Get all lamps
+ for ob in lamps:
+ lamp = ob.data
+
+ matrix = ob.matrix
+
+ color = tuple([c * lamp.energy for c in lamp.color]) # Colour is modified by energy
+
+ file.write('light_source')
+ file.write('{\n')
+ file.write('\t< 0,0,0 >\n')
+ file.write('\tcolor red %.6f green %.6f blue %.6f\n' % color)
+
+ if lamp.type == 'POINT': # Point Lamp
+ pass
+ elif lamp.type == 'SPOT': # Spot
+ file.write('\tspotlight\n')
+
+ # Falloff is the main radius from the centre line
+ file.write('\tfalloff %.2f\n' % (lamp.spot_size/2.0) ) # 1 TO 179 FOR BOTH
+ file.write('\tradius %.6f\n' % ((lamp.spot_size/2.0) * (1-lamp.spot_blend)) )
+
+ # Blender does not have a tightness equivilent, 0 is most like blender default.
+ file.write('\ttightness 0\n') # 0:10f
+
+ file.write('\tpoint_at <0, 0, -1>\n')
+ elif lamp.type == 'AREA':
+
+ size_x = lamp.size
+ samples_x = lamp.shadow_ray_samples_x
+ if lamp.shape == 'SQUARE':
+ size_y = size_x
+ samples_y = samples_x
+ else:
+ size_y = lamp.size_y
+ samples_y = lamp.shadow_ray_samples_y
+
+
+
+ file.write('\tarea_light <%d,0,0>,<0,0,%d> %d, %d\n' % (size_x, size_y, samples_x, samples_y))
+ if lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED':
+ if lamp.jitter:
+ file.write('\tjitter\n')
+ else:
+ file.write('\tadaptive 1\n')
+ file.write('\tjitter\n')
+
+ if lamp.shadow_method == 'NOSHADOW':
+ file.write('\tshadowless\n')
+
+ file.write('\tfade_distance %.6f\n' % lamp.distance)
+ file.write('\tfade_power %d\n' % 1) # Could use blenders lamp quad?
+ writeMatrix(matrix)
+
+ file.write('}\n')
+
+ def exportMeshs(sel):
+ def bMat2PovString(material):
+ povstring = 'finish {'
+ if world != None:
+ povstring += 'ambient <%.6f, %.6f, %.6f> ' % tuple([c*material.ambient for c in world.ambient_color])
+
+ povstring += 'diffuse %.6f ' % material.diffuse_reflection
+ povstring += 'specular %.6f ' % material.specular_reflection
+
+
+ if material.raytrace_mirror.enabled:
+ #povstring += 'interior { ior %.6f } ' % material.IOR
+ raytrace_mirror= material.raytrace_mirror
+ if raytrace_mirror.reflect:
+ povstring += 'reflection {'
+ povstring += '<%.6f, %.6f, %.6f>' % tuple(material.mirror_color) # Should ask for ray mirror flag
+ povstring += 'fresnel 1 falloff %.6f exponent %.6f metallic %.6f} ' % (raytrace_mirror.fresnel, raytrace_mirror.fresnel_fac, raytrace_mirror.reflect)
+
+
+
+ if material.raytrace_transparency.enabled:
+ #povstring += 'interior { ior %.6f } ' % material.IOR
+ pass
+
+ #file.write('\t\troughness %.6f\n' % (material.hard*0.5))
+ #file.write('\t\t\tcrand 0.0\n') # Sand granyness
+ #file.write('\t\t\tmetallic %.6f\n' % material.spec)
+ #file.write('\t\t\tphong %.6f\n' % material.spec)
+ #file.write('\t\t\tphong_size %.6f\n' % material.spec)
+ povstring += 'brilliance %.6f ' % (material.specular_hardness/256.0) # Like hardness
+ povstring += '}'
+ #file.write('\t}\n')
+ return povstring
+
+
+ world = scene.world
+
+ # Convert all materials to strings we can access directly per vertex.
+ for material in bpy.data.materials:
+ materialTable[material.name] = bMat2PovString(material)
+
+
+ ob_num = 0
+
+ for ob in sel:
+ ob_num+= 1
+
+ if ob.type in ('LAMP', 'CAMERA', 'EMPTY'):
+ continue
+
+ me = ob.data
+ me_materials= me.materials
+
+ me = ob.create_render_mesh(scene)
+
+ if not me:
+ continue
+
+ if info_callback:
+ info_callback('Object %2.d of %2.d (%s)' % (ob_num, len(sel), ob.name))
+
+ #if ob.type!='MESH':
+ # continue
+ # me = ob.data
+
+ matrix = ob.matrix
+ try: uv_layer = me.active_uv_texture.data
+ except:uv_layer = 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_normals = [tuple(f.normal) for f in me.faces]
+ verts_normals = [tuple(v.normal) for v in me.verts]
+
+ # quads incur an extra face
+ quadCount = len([f for f in faces_verts if len(f)==4])
+
+ file.write('mesh2 {\n')
+ file.write('\tvertex_vectors {\n')
+ file.write('\t\t%s' % (len(me.verts))) # vert count
+ for v in me.verts:
+ file.write(',\n\t\t<%.6f, %.6f, %.6f>' % tuple(v.co)) # vert count
+ file.write('\n }\n')
+
+
+ # Build unique Normal list
+ uniqueNormals = {}
+ for fi, f in enumerate(me.faces):
+ fv = faces_verts[fi]
+ # [-1] is a dummy index, use a list so we can modify in place
+ if f.smooth: # Use vertex normals
+ for v in fv:
+ key = verts_normals[v]
+ uniqueNormals[key] = [-1]
+ else: # Use face normal
+ key = faces_normals[fi]
+ uniqueNormals[key] = [-1]
+
+ file.write('\tnormal_vectors {\n')
+ file.write('\t\t%d' % len(uniqueNormals)) # vert count
+ idx = 0
+ for no, index in uniqueNormals.items():
+ file.write(',\n\t\t<%.6f, %.6f, %.6f>' % no) # vert count
+ index[0] = idx
+ idx +=1
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list