Merged changes in the trunk up to revision 42902.
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Tue, 27 Dec 2011 22:12:46 +0000 (22:12 +0000)
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Tue, 27 Dec 2011 22:12:46 +0000 (22:12 +0000)
Conflicts resolved:
source/blender/editors/space_view3d/drawobject.c
source/blender/makesdna/DNA_mesh_types.h
source/blender/python/intern/bpy.c

310 files changed:
CMakeLists.txt
SConstruct
build_files/scons/config/linuxcross-config.py
build_files/scons/config/win32-mingw-config.py
build_files/scons/config/win32-vc-config.py
build_files/scons/config/win64-vc-config.py
build_files/scons/tools/btools.py
doc/python_api/rst/change_log.rst
intern/audaspace/intern/AUD_SoftwareDevice.cpp
intern/cycles/app/cycles_test.cpp
intern/cycles/app/cycles_xml.cpp
intern/cycles/app/io_export_cycles_xml.py [new file with mode: 0644]
intern/cycles/blender/addon/engine.py
intern/cycles/blender/addon/ui.py
intern/cycles/blender/blender_camera.cpp
intern/cycles/blender/blender_mesh.cpp
intern/cycles/blender/blender_object.cpp
intern/cycles/blender/blender_python.cpp
intern/cycles/blender/blender_session.cpp
intern/cycles/blender/blender_session.h
intern/cycles/blender/blender_shader.cpp
intern/cycles/blender/blender_sync.cpp
intern/cycles/blender/blender_sync.h
intern/cycles/device/device.cpp
intern/cycles/device/device.h
intern/cycles/device/device_cpu.cpp
intern/cycles/device/device_cuda.cpp
intern/cycles/device/device_opencl.cpp
intern/cycles/kernel/CMakeLists.txt
intern/cycles/kernel/kernel.cl
intern/cycles/kernel/kernel.cpp
intern/cycles/kernel/kernel.cu
intern/cycles/kernel/kernel.h
intern/cycles/kernel/kernel_camera.h
intern/cycles/kernel/kernel_compat_opencl.h
intern/cycles/kernel/kernel_film.h
intern/cycles/kernel/kernel_optimized.cpp
intern/cycles/kernel/kernel_path.h
intern/cycles/kernel/kernel_random.h
intern/cycles/kernel/kernel_types.h
intern/cycles/render/buffers.cpp
intern/cycles/render/buffers.h
intern/cycles/render/camera.cpp
intern/cycles/render/graph.cpp
intern/cycles/render/graph.h
intern/cycles/render/integrator.cpp
intern/cycles/render/integrator.h
intern/cycles/render/nodes.cpp
intern/cycles/render/nodes.h
intern/cycles/render/session.cpp
intern/cycles/render/session.h
intern/cycles/render/tile.cpp
intern/cycles/render/tile.h
intern/cycles/util/util_math.h
intern/cycles/util/util_transform.h
intern/ghost/GHOST_C-api.h
intern/ghost/GHOST_ISystem.h
intern/ghost/GHOST_IWindow.h
intern/ghost/intern/GHOST_C-api.cpp
intern/ghost/intern/GHOST_CallbackEventConsumer.cpp
intern/ghost/intern/GHOST_Debug.h
intern/ghost/intern/GHOST_DisplayManager.h
intern/ghost/intern/GHOST_EventDragnDrop.h
intern/ghost/intern/GHOST_EventKey.h
intern/ghost/intern/GHOST_EventNDOF.h
intern/ghost/intern/GHOST_EventTrackpad.h
intern/ghost/intern/GHOST_System.cpp
intern/ghost/intern/GHOST_System.h
intern/ghost/intern/GHOST_SystemCocoa.h
intern/ghost/intern/GHOST_SystemX11.cpp
intern/ghost/intern/GHOST_TimerTask.h
intern/ghost/intern/GHOST_Window.cpp
intern/ghost/intern/GHOST_Window.h
intern/ghost/intern/GHOST_WindowCocoa.mm
intern/ghost/intern/GHOST_WindowWin32.cpp
intern/ghost/intern/GHOST_WindowWin32.h
intern/ghost/intern/GHOST_WindowX11.cpp
intern/guardedalloc/MEM_sys_types.h
intern/iksolver/intern/IK_Solver.cpp
intern/mikktspace/mikktspace.c
intern/opennl/intern/opennl.c
intern/opennl/superlu/get_perm_c.c
intern/opennl/superlu/scolumn_bmod.c
intern/opennl/superlu/strsv.c
intern/opennl/superlu/sutil.c
intern/opennl/superlu/util.h
release/scripts/modules/bpy_extras/io_utils.py
release/scripts/modules/bpy_extras/keyconfig_utils.py
release/scripts/modules/bpy_extras/view3d_utils.py
release/scripts/startup/bl_operators/clip.py
release/scripts/startup/bl_operators/sequencer.py
release/scripts/startup/bl_operators/uvcalc_smart_project.py
release/scripts/startup/bl_operators/wm.py
release/scripts/startup/bl_ui/properties_game.py
release/scripts/startup/bl_ui/properties_particle.py
release/scripts/startup/bl_ui/properties_render.py
release/scripts/startup/bl_ui/properties_scene.py
release/scripts/startup/bl_ui/space_logic.py
release/scripts/startup/bl_ui/space_node.py
release/scripts/startup/bl_ui/space_text.py
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenfont/BLF_translation.h
source/blender/blenfont/intern/blf_lang.c
source/blender/blenfont/intern/blf_translation.c
source/blender/blenkernel/BKE_customdata.h
source/blender/blenkernel/BKE_global.h
source/blender/blenkernel/BKE_modifier.h
source/blender/blenkernel/BKE_movieclip.h
source/blender/blenkernel/BKE_node.h
source/blender/blenkernel/BKE_texture.h
source/blender/blenkernel/BKE_writeffmpeg.h
source/blender/blenkernel/depsgraph_private.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/fcurve.c
source/blender/blenkernel/intern/idprop.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/ipo.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/mesh_validate.c
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/movieclip.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenkernel/intern/texture.c
source/blender/blenkernel/intern/tracking.c
source/blender/blenkernel/intern/unit.c
source/blender/blenkernel/intern/writeavi.c
source/blender/blenkernel/intern/writeffmpeg.c
source/blender/blenlib/BLI_dynstr.h
source/blender/blenlib/BLI_math_vector.h
source/blender/blenlib/BLI_md5.h [new file with mode: 0644]
source/blender/blenlib/BLI_utildefines.h
source/blender/blenlib/CMakeLists.txt
source/blender/blenlib/intern/BLI_dynstr.c
source/blender/blenlib/intern/bpath.c
source/blender/blenlib/intern/math_vector.c
source/blender/blenlib/intern/md5.c [moved from source/blender/imbuf/intern/md5.c with 80% similarity]
source/blender/blenlib/intern/path_util.c
source/blender/blenlib/intern/storage.c
source/blender/blenloader/BLO_sys_types.h
source/blender/blenloader/CMakeLists.txt
source/blender/blenloader/SConscript
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/animation/anim_channels_edit.c
source/blender/editors/animation/anim_filter.c
source/blender/editors/include/ED_mesh.h
source/blender/editors/include/ED_view3d.h
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_panel.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/interface/view2d.c
source/blender/editors/mesh/editface.c
source/blender/editors/mesh/editmesh.c
source/blender/editors/mesh/meshtools.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_intern.h
source/blender/editors/object/object_modifier.c
source/blender/editors/object/object_ops.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_intern.h
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/editors/sculpt_paint/paint_stroke.c
source/blender/editors/sculpt_paint/paint_utils.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/space_clip/clip_ops.c
source/blender/editors/space_clip/tracking_ops.c
source/blender/editors/space_node/node_buttons.c
source/blender/editors/space_node/node_draw.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_node/node_intern.h
source/blender/editors/space_node/node_ops.c
source/blender/editors/space_node/node_select.c
source/blender/editors/space_node/node_state.c
source/blender/editors/space_outliner/outliner_edit.c
source/blender/editors/space_outliner/outliner_select.c
source/blender/editors/space_text/text_ops.c
source/blender/editors/space_view3d/drawmesh.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/space_view3d/view3d_view.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform.h
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_snap.c
source/blender/gpu/intern/gpu_codegen.c
source/blender/gpu/intern/gpu_codegen.h
source/blender/gpu/intern/gpu_draw.c
source/blender/gpu/intern/gpu_extensions.c
source/blender/gpu/intern/gpu_material.c
source/blender/imbuf/CMakeLists.txt
source/blender/imbuf/intern/md5.h [deleted file]
source/blender/imbuf/intern/thumbs.c
source/blender/makesdna/DNA_defs.h
source/blender/makesdna/DNA_genfile.h
source/blender/makesdna/DNA_mesh_types.h
source/blender/makesdna/DNA_movieclip_types.h
source/blender/makesdna/DNA_object_types.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_world_types.h
source/blender/makesdna/intern/dna_genfile.c
source/blender/makesdna/intern/makesdna.c
source/blender/makesrna/RNA_define.h
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_internal_types.h
source/blender/makesrna/intern/rna_material.c
source/blender/makesrna/intern/rna_mesh.c
source/blender/makesrna/intern/rna_movieclip.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_object_api.c
source/blender/makesrna/intern/rna_rna.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/makesrna/intern/rna_world.c
source/blender/modifiers/intern/MOD_decimate.c
source/blender/modifiers/intern/MOD_edgesplit.c
source/blender/modifiers/intern/MOD_mirror.c
source/blender/modifiers/intern/MOD_multires.c
source/blender/modifiers/intern/MOD_screw.c
source/blender/modifiers/intern/MOD_shrinkwrap.c
source/blender/modifiers/intern/MOD_smooth.c
source/blender/modifiers/intern/MOD_solidify.c
source/blender/modifiers/intern/MOD_uvproject.c
source/blender/modifiers/intern/MOD_weightvgedit.c
source/blender/modifiers/intern/MOD_weightvgmix.c
source/blender/modifiers/intern/MOD_weightvgproximity.c
source/blender/nodes/composite/nodes/node_composite_alphaOver.c
source/blender/nodes/shader/node_shader_util.c
source/blender/python/generic/bgl.c
source/blender/python/generic/bpy_internal_import.c
source/blender/python/generic/idprop_py_api.c
source/blender/python/generic/py_capi_utils.c
source/blender/python/intern/bpy.c
source/blender/python/intern/bpy_app.c
source/blender/python/intern/bpy_app_handlers.c
source/blender/python/intern/bpy_driver.c
source/blender/python/intern/bpy_interface.c
source/blender/python/intern/bpy_interface_atexit.c
source/blender/python/intern/bpy_intern_string.c
source/blender/python/intern/bpy_library.c
source/blender/python/intern/bpy_operator.c
source/blender/python/intern/bpy_operator_wrap.c
source/blender/python/intern/bpy_props.c
source/blender/python/intern/bpy_rna.c
source/blender/python/intern/bpy_rna_anim.c
source/blender/python/intern/bpy_rna_array.c
source/blender/python/intern/bpy_rna_callback.c
source/blender/python/intern/bpy_traceback.c
source/blender/python/intern/bpy_util.c
source/blender/python/intern/gpu.c
source/blender/python/mathutils/mathutils.c
source/blender/python/mathutils/mathutils.h
source/blender/python/mathutils/mathutils_Color.c
source/blender/python/mathutils/mathutils_Euler.c
source/blender/python/mathutils/mathutils_Euler.h
source/blender/python/mathutils/mathutils_Matrix.c
source/blender/python/mathutils/mathutils_Matrix.h
source/blender/python/mathutils/mathutils_Quaternion.c
source/blender/python/mathutils/mathutils_Vector.c
source/blender/python/mathutils/mathutils_Vector.h
source/blender/python/mathutils/mathutils_geometry.c
source/blender/python/mathutils/mathutils_noise.c
source/blender/quicktime/apple/qtkit_export.m
source/blender/quicktime/apple/quicktime_export.c
source/blender/quicktime/quicktime_export.h
source/blender/render/intern/raytrace/rayobject_octree.cpp
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/external_engine.c
source/blender/render/intern/source/pixelshading.c
source/blender/render/intern/source/rayshade.c
source/blender/render/intern/source/render_texture.c
source/blender/render/intern/source/renderdatabase.c
source/blender/render/intern/source/shadeoutput.c
source/blender/render/intern/source/strand.c
source/blender/render/intern/source/volumetric.c
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_operators.c
source/creator/CMakeLists.txt
source/creator/creator.c
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h
source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.cpp
source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Converter/BL_BlenderDataConversion.h
source/gameengine/Converter/KX_ConvertSensors.cpp
source/gameengine/GamePlayer/common/GPC_KeyboardDevice.h
source/gameengine/GamePlayer/ghost/GPG_Application.cpp
source/gameengine/GamePlayer/ghost/GPG_Application.h
source/gameengine/Ketsji/KX_IPO_SGController.cpp
source/gameengine/Ketsji/KX_KetsjiEngine.cpp
source/gameengine/Ketsji/KX_KetsjiEngine.h
source/gameengine/Ketsji/KX_PyMath.h
source/gameengine/Ketsji/KX_PythonInit.cpp
source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
source/tests/CMakeLists.txt
source/tests/bl_pyapi_mathutils.py [new file with mode: 0644]

index eaa75ddb1f9089a7291f4437e310af44effb020f..a7e9de026e48e7f25fcf203f771e2587c0b18832 100644 (file)
@@ -281,10 +281,12 @@ if(WITH_PYTHON_MODULE AND WITH_PYTHON_INSTALL)
        message(FATAL_ERROR "WITH_PYTHON_MODULE requires WITH_PYTHON_INSTALL to be OFF")
 endif()
 
-if(WITH_CODEC_QUICKTIME AND MINGW)
-       message(FATAL_ERROR "MINGW requires WITH_CODEC_QUICKTIME to be OFF "
-                                               "because it is currently unsupported, remove this "
-                                               "line if youre a developer who wants to add support.")
+if(MINGW)
+       if(WITH_CODEC_QUICKTIME)
+               message(FATAL_ERROR "MINGW requires WITH_CODEC_QUICKTIME to be OFF "
+                                                       "because it is currently unsupported, remove this "
+                                                       "line if youre a developer who wants to add support.")
+       endif()
 endif()
 
 if(NOT WITH_FFTW3 AND WITH_MOD_OCEANSIM)
@@ -649,10 +651,6 @@ elseif(WIN32)
                set(ICONV_LIBPATH ${ICONV}/lib)
        endif()
 
-       set(PNG "${LIBDIR}/png")
-       set(PNG_INCLUDE_DIR "${PNG}/include")
-       set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
-
        set(JPEG "${LIBDIR}/jpeg")
        set(JPEG_INCLUDE_DIR "${JPEG}/include")
        set(JPEG_LIBPATH ${JPEG}/lib) # not cmake defined
@@ -662,7 +660,7 @@ elseif(WIN32)
        if(WITH_OPENAL)
                set(OPENAL ${LIBDIR}/openal)
                set(OPENAL_INCLUDE_DIR ${OPENAL}/include)
-               set(OPENAL_LIBRARY wrap_oal)
+               set(OPENAL_LIBRARY OpenAL32)
                set(OPENAL_LIBPATH ${OPENAL}/lib)
        endif()
 
@@ -727,12 +725,12 @@ elseif(WIN32)
                        set(GETTEXT_LIBRARIES gnu_gettext)
                endif()
 
-               if(CMAKE_CL_64)
-                       set(PNG_LIBRARIES libpng)
-               else()
-                       set(PNG_LIBRARIES libpng_st)
-               endif()
+               set(PNG_LIBRARIES libpng)
                set(JPEG_LIBRARIES libjpeg)
+               
+               set(PNG "${LIBDIR}/png")
+               set(PNG_INCLUDE_DIR "${PNG}/include")
+               set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
 
                set(ZLIB_INCLUDE_DIRS ${LIBDIR}/zlib/include)
                if(CMAKE_CL_64)
@@ -913,6 +911,10 @@ elseif(WIN32)
                        set(GETTEXT_LIBPATH ${GETTEXT}/lib)
                        set(GETTEXT_LIBRARIES intl)
                endif()
+               
+               set(PNG "${LIBDIR}/gcc/png")
+               set(PNG_INCLUDE_DIR "${PNG}/include")
+               set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
 
                set(JPEG_LIBRARIES libjpeg)
                set(PNG_LIBRARIES png)
index d8db597d1c6d956081cb913c5c985816e61a3b43..88444c6131485020679b5db7182bc6e8ae7b6953 100644 (file)
@@ -726,10 +726,6 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
         # For MinGW and linuxcross static linking will be used
         dllsources += ['${LCGDIR}/gettext/lib/gnu_gettext.dll']
 
-    #currently win64-vc doesn't appear to have libpng.dll
-    if env['OURPLATFORM'] != 'win64-vc':
-        dllsources += ['${BF_PNG_LIBPATH}/libpng.dll']
-
     dllsources += ['${BF_ZLIB_LIBPATH}/zlib.dll']
     # Used when linking to libtiff was dynamic
     # keep it here until compilation on all platform would be ok
@@ -760,7 +756,6 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'):
 
     if env['WITH_BF_OPENAL']:
         dllsources.append('${LCGDIR}/openal/lib/OpenAL32.dll')
-        dllsources.append('${LCGDIR}/openal/lib/wrap_oal.dll')
 
     if env['WITH_BF_SNDFILE']:
         dllsources.append('${LCGDIR}/sndfile/lib/libsndfile-1.dll')
index 5e2c1d67d1ff777079764eb23d72c804690d281d..7ec27af9ea82a1fa099766853ce51d04262086b4 100644 (file)
@@ -13,7 +13,7 @@ WITH_BF_OPENAL = True
 WITH_BF_STATICOPENAL = False
 BF_OPENAL = LIBDIR + '/openal'
 BF_OPENAL_INC = '${BF_OPENAL}/include'
-BF_OPENAL_LIB = 'OpenAL32 wrap_oal'
+BF_OPENAL_LIB = 'OpenAL32'
 BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
 # Warning, this static lib configuration is untested! users of this OS please confirm.
 BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
index 51f438e0a4d0a45f19f452d1f017f21411601b0f..d9fafbda5b04d3e9cc0c9894683402a4a3392a80 100644 (file)
@@ -14,7 +14,7 @@ BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/libpython${BF_PYTHON_VERSION[0]}${BF_PY
 WITH_BF_OPENAL = True
 BF_OPENAL = LIBDIR + '/openal'
 BF_OPENAL_INC = '${BF_OPENAL}/include'
-BF_OPENAL_LIB = 'wrap_oal'
+BF_OPENAL_LIB = 'OpenAL32'
 BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
 
 WITH_BF_FFMPEG = True
@@ -64,7 +64,7 @@ BF_JPEG_LIB = 'liblibjpeg'
 BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
 
 WITH_BF_PNG = True
-BF_PNG = LIBDIR + '/png'
+BF_PNG = LIBDIR + '/gcc/png'
 BF_PNG_INC = '${BF_PNG}/include'
 BF_PNG_LIB = 'png'
 BF_PNG_LIBPATH = '${BF_PNG}/lib'
index a2e3d11c244a09b2a1597b0eae8686faf6dc77a5..097740c4b858df7338f8b6a106d258cfadb5e78d 100644 (file)
@@ -20,7 +20,7 @@ BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
 WITH_BF_OPENAL = True
 BF_OPENAL = LIBDIR + '/openal'
 BF_OPENAL_INC = '${BF_OPENAL}/include '
-BF_OPENAL_LIB = 'wrap_oal'
+BF_OPENAL_LIB = 'OpenAL32'
 BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
 
 WITH_BF_ICONV = True
@@ -72,7 +72,7 @@ BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
 WITH_BF_PNG = True
 BF_PNG = LIBDIR + '/png'
 BF_PNG_INC = '${BF_PNG}/include'
-BF_PNG_LIB = 'libpng_st'
+BF_PNG_LIB = 'libpng'
 BF_PNG_LIBPATH = '${BF_PNG}/lib'
 
 WITH_BF_TIFF = True
index 74a526a59f71966c8314b1e073d76c8d8182af07..f502d3ac360a263e07c558c176f0bdfdf7c0027e 100644 (file)
@@ -20,7 +20,7 @@ BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
 WITH_BF_OPENAL = True
 BF_OPENAL = LIBDIR + '/openal'
 BF_OPENAL_INC = '${BF_OPENAL}/include '
-BF_OPENAL_LIB = 'wrap_oal'
+BF_OPENAL_LIB = 'OpenAL32'
 BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
 
 WITH_BF_SNDFILE = True
index 05e28ab1813f281066908a5dc9710b955e423707..adeca5668eb68c047f4d3375ddc4c1816ccabbeb 100644 (file)
@@ -159,7 +159,8 @@ def validate_arguments(args, bc):
             'WITH_BF_3DMOUSE', 'WITH_BF_STATIC3DMOUSE', 'BF_3DMOUSE', 'BF_3DMOUSE_INC', 'BF_3DMOUSE_LIB', 'BF_3DMOUSE_LIBPATH', 'BF_3DMOUSE_LIB_STATIC',
             'WITH_BF_CYCLES', 'WITH_BF_CYCLES_CUDA_BINARIES' 'BF_CYCLES_CUDA_NVCC', 'BF_CYCLES_CUDA_NVCC', 'WITH_BF_CYCLES_CUDA_THREADED_COMPILE',
             'WITH_BF_OIIO', 'WITH_BF_STATICOIIO', 'BF_OIIO', 'BF_OIIO_INC', 'BF_OIIO_LIB', 'BF_OIIO_LIB_STATIC', 'BF_OIIO_LIBPATH',
-            'WITH_BF_BOOST', 'WITH_BF_STATICBOOST', 'BF_BOOST', 'BF_BOOST_INC', 'BF_BOOST_LIB', 'BF_BOOST_LIB_STATIC', 'BF_BOOST_LIBPATH'
+            'WITH_BF_BOOST', 'WITH_BF_STATICBOOST', 'BF_BOOST', 'BF_BOOST_INC', 'BF_BOOST_LIB', 'BF_BOOST_LIB_STATIC', 'BF_BOOST_LIBPATH',
+            'WITH_BF_LIBMV'
             ]
     
     # Have options here that scons expects to be lists
index d332c4faff4ba09ef7bf1b0604eed2ad213d208a..5de7bb49e1cfc5fa4b017d08e0697dd6fe5b46dd 100644 (file)
@@ -1480,3 +1480,640 @@ Added
 * :class:`bpy.types.SceneGameData.restrict_animation_updates`
 * :class:`bpy.types.SceneGameData.show_obstacle_simulation`
 
+
+2.60 to 2.61
+============
+
+bpy.types.BlendDataGroups
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataGroups.is_updated`
+
+bpy.types.BlendDataBrushes
+--------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataBrushes.is_updated`
+
+bpy.types.Theme
+---------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Theme.clip_editor`
+
+bpy.types.BlendData
+-------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendData.movieclips`
+
+bpy.types.BlendDataGreasePencils
+--------------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataGreasePencils.is_updated`
+
+bpy.types.BlendDataImages
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataImages.is_updated`
+
+bpy.types.CompositorNodes
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.CompositorNodes.clear`
+
+bpy.types.BlendDataScenes
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataScenes.is_updated`
+
+bpy.types.RenderEngine
+----------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.RenderEngine.bl_use_shading_nodes`
+* :class:`bpy.types.RenderEngine.is_animation`
+* :class:`bpy.types.RenderEngine.is_preview`
+* :class:`bpy.types.RenderEngine.tag_redraw`
+* :class:`bpy.types.RenderEngine.tag_update`
+* :class:`bpy.types.RenderEngine.update`
+* :class:`bpy.types.RenderEngine.update_progress`
+* :class:`bpy.types.RenderEngine.view_draw`
+* :class:`bpy.types.RenderEngine.view_update`
+
+bpy.types.BackgroundImage
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BackgroundImage.clip`
+* :class:`bpy.types.BackgroundImage.clip_user`
+* :class:`bpy.types.BackgroundImage.show_background_image`
+* :class:`bpy.types.BackgroundImage.source`
+* :class:`bpy.types.BackgroundImage.use_camera_clip`
+
+bpy.types.BlendDataMetaBalls
+----------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataMetaBalls.is_updated`
+
+bpy.types.SpaceTimeline
+-----------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.SpaceTimeline.cache_dynamicpaint`
+
+bpy.types.BlendDataMeshes
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataMeshes.is_updated`
+
+bpy.types.BlendDataNodeTrees
+----------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataNodeTrees.is_updated`
+
+bpy.types.RenderSettings
+------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.RenderSettings.image_settings`
+* :class:`bpy.types.RenderSettings.use_shading_nodes`
+
+Removed
+^^^^^^^
+
+* **cineon_black**
+* **cineon_gamma**
+* **cineon_white**
+* **color_mode**
+* **exr_codec**
+* **exr_preview**
+* **exr_zbuf**
+* **file_format**
+* **file_quality**
+* **jpeg2k_depth**
+* **jpeg2k_preset**
+* **jpeg2k_ycc**
+* **use_cineon_log**
+* **use_exr_half**
+* **use_tiff_16bit**
+
+bpy.types.Curve
+---------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Curve.cycles`
+
+bpy.types.RegionView3D
+----------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.RegionView3D.view_camera_offset`
+* :class:`bpy.types.RegionView3D.view_camera_zoom`
+
+bpy.types.Scene
+---------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Scene.active_clip`
+* :class:`bpy.types.Scene.cycles`
+
+bpy.types.NodeLinks
+-------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.NodeLinks.clear`
+
+bpy.types.BlendDataLattices
+---------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataLattices.is_updated`
+
+bpy.types.BlendDataParticles
+----------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataParticles.is_updated`
+
+bpy.types.BlendDataWorlds
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataWorlds.is_updated`
+
+bpy.types.ObjectConstraints
+---------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.ObjectConstraints.clear`
+
+bpy.types.RenderLayers
+----------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.RenderLayers.new`
+* :class:`bpy.types.RenderLayers.remove`
+
+bpy.types.Menu
+--------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Menu.bl_description`
+
+bpy.types.Lamp
+--------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Lamp.cycles`
+* :class:`bpy.types.Lamp.node_tree`
+* :class:`bpy.types.Lamp.use_nodes`
+
+bpy.types.CurveSplines
+----------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.CurveSplines.clear`
+
+bpy.types.Screen
+----------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Screen.use_play_clip_editors`
+
+bpy.types.BlendDataActions
+--------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataActions.is_updated`
+
+bpy.types.BlendDataSounds
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataSounds.is_updated`
+
+bpy.types.Object
+----------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Object.cycles_visibility`
+* :class:`bpy.types.Object.slow_parent_offset`
+
+Removed
+^^^^^^^
+
+* **time_offset**
+* **use_time_offset_add_parent**
+* **use_time_offset_edit**
+* **use_time_offset_parent**
+* **use_time_offset_particle**
+
+bpy.types.ObjectModifiers
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.ObjectModifiers.clear`
+
+bpy.types.BlendDataMaterials
+----------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataMaterials.is_updated`
+
+bpy.types.MetaBallElements
+--------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.MetaBallElements.clear`
+
+bpy.types.NodeSocket
+--------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.NodeSocket.group_socket`
+* :class:`bpy.types.NodeSocket.show_expanded`
+
+bpy.types.Node
+--------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Node.show_texture`
+
+bpy.types.CompositorNodeOutputFile
+----------------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.CompositorNodeOutputFile.image_settings`
+
+Removed
+^^^^^^^
+
+* **exr_codec**
+* **image_type**
+* **quality**
+* **use_exr_half**
+
+bpy.types.BlendDataTexts
+------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataTexts.is_updated`
+
+bpy.types.ThemeView3D
+---------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.ThemeView3D.bundle_solid`
+* :class:`bpy.types.ThemeView3D.camera_path`
+
+bpy.types.Event
+---------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Event.unicode`
+
+bpy.types.VertexGroups
+----------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.VertexGroups.clear`
+
+bpy.types.TexMapping
+--------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.TexMapping.mapping`
+* :class:`bpy.types.TexMapping.mapping_x`
+* :class:`bpy.types.TexMapping.mapping_y`
+* :class:`bpy.types.TexMapping.mapping_z`
+
+bpy.types.BlendDataObjects
+--------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataObjects.is_updated`
+
+bpy.types.BlendDataCurves
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataCurves.is_updated`
+
+bpy.types.BlendDataLibraries
+----------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataLibraries.is_updated`
+
+bpy.types.ThemeUserInterface
+----------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.ThemeUserInterface.icon_alpha`
+* :class:`bpy.types.ThemeUserInterface.panel`
+
+bpy.types.SpaceNodeEditor
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.SpaceNodeEditor.shader_type`
+
+bpy.types.SpaceView3D
+---------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.SpaceView3D.show_bundle_names`
+* :class:`bpy.types.SpaceView3D.show_camera_path`
+* :class:`bpy.types.SpaceView3D.show_reconstruction`
+* :class:`bpy.types.SpaceView3D.tracks_draw_size`
+* :class:`bpy.types.SpaceView3D.tracks_draw_type`
+
+bpy.types.BlendDataWindowManagers
+---------------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataWindowManagers.is_updated`
+
+bpy.types.BlendDataScreens
+--------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataScreens.is_updated`
+
+bpy.types.BlendDataArmatures
+----------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataArmatures.is_updated`
+
+bpy.types.UserPreferencesInput
+------------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.UserPreferencesInput.tweak_threshold`
+
+Removed
+^^^^^^^
+
+* **ndof_orbit_invert_axes**
+
+bpy.types.Mesh
+--------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Mesh.cycles`
+
+bpy.types.BlendDataCameras
+--------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataCameras.is_updated`
+
+bpy.types.MetaBall
+------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.MetaBall.cycles`
+
+bpy.types.UILayout
+------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.UILayout.template_image_settings`
+* :class:`bpy.types.UILayout.template_marker`
+* :class:`bpy.types.UILayout.template_movieclip`
+* :class:`bpy.types.UILayout.template_node_link`
+* :class:`bpy.types.UILayout.template_node_view`
+* :class:`bpy.types.UILayout.template_texture_user`
+* :class:`bpy.types.UILayout.template_track`
+
+Function Arguments
+^^^^^^^^^^^^^^^^^^
+
+* :class:`bpy.types.UILayout.template_list` (data, property, active_data, active_property, prop_list, rows, maxrows, type), *was (data, property, active_data, active_property, rows, maxrows, type)*
+
+bpy.types.ID
+------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.ID.is_updated`
+* :class:`bpy.types.ID.is_updated_data`
+
+bpy.types.World
+---------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.World.cycles`
+* :class:`bpy.types.World.node_tree`
+* :class:`bpy.types.World.use_nodes`
+
+bpy.types.BlendDataTextures
+---------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataTextures.is_updated`
+
+bpy.types.ShaderNodes
+---------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.ShaderNodes.clear`
+
+bpy.types.TimelineMarkers
+-------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.TimelineMarkers.clear`
+
+bpy.types.SpaceFileBrowser
+--------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.SpaceFileBrowser.active_operator`
+
+bpy.types.Material
+------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Material.cycles`
+
+bpy.types.BlendDataSpeakers
+---------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataSpeakers.is_updated`
+
+bpy.types.Camera
+----------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.Camera.angle_x`
+* :class:`bpy.types.Camera.angle_y`
+* :class:`bpy.types.Camera.cycles`
+* :class:`bpy.types.Camera.sensor_fit`
+* :class:`bpy.types.Camera.sensor_height`
+* :class:`bpy.types.Camera.sensor_width`
+* :class:`bpy.types.Camera.show_sensor`
+
+bpy.types.BlendDataLamps
+------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataLamps.is_updated`
+
+bpy.types.TextureNodes
+----------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.TextureNodes.clear`
+
+bpy.types.BlendDataFonts
+------------------------
+
+Added
+^^^^^
+
+* :class:`bpy.types.BlendDataFonts.is_updated`
index b1e5d8ccd758f49ec9eb385f58e18d23714d7d6a..1d993abab73e9f1939d47d0b23760b046184ddda 100644 (file)
@@ -121,7 +121,9 @@ void AUD_SoftwareDevice::AUD_SoftwareHandle::update()
 
                if(flags & AUD_RENDER_DISTANCE)
                {
-                       if(m_device->m_distance_model == AUD_DISTANCE_MODEL_INVERSE_CLAMPED || m_device->m_distance_model == AUD_DISTANCE_MODEL_LINEAR_CLAMPED || m_device->m_distance_model == AUD_DISTANCE_MODEL_EXPONENT_CLAMPED)
+                       if(m_device->m_distance_model == AUD_DISTANCE_MODEL_INVERSE_CLAMPED ||
+                          m_device->m_distance_model == AUD_DISTANCE_MODEL_LINEAR_CLAMPED ||
+                          m_device->m_distance_model == AUD_DISTANCE_MODEL_EXPONENT_CLAMPED)
                        {
                                distance = AUD_MAX(AUD_MIN(m_distance_max, distance), m_distance_reference);
                        }
index 27e53ded6db18775f89b5db3ef241994ebc0afa3..d9386f7514190822966ddef49378fd16f44baac5 100644 (file)
@@ -82,10 +82,21 @@ static void session_print_status()
        session_print(status);
 }
 
+static BufferParams& session_buffer_params()
+{
+       static BufferParams buffer_params;
+       buffer_params.width = options.width;
+       buffer_params.height = options.height;
+       buffer_params.full_width = options.width;
+       buffer_params.full_height = options.height;
+
+       return buffer_params;
+}
+
 static void session_init()
 {
        options.session = new Session(options.session_params);
-       options.session->reset(options.width, options.height, options.session_params.samples);
+       options.session->reset(session_buffer_params(), options.session_params.samples);
        options.session->scene = options.scene;
        
        if(options.session_params.background && !options.quiet)
@@ -98,12 +109,15 @@ static void session_init()
        options.scene = NULL;
 }
 
-static void scene_init()
+static void scene_init(int width, int height)
 {
        options.scene = new Scene(options.scene_params);
        xml_read_file(options.scene, options.filepath.c_str());
-       options.width = options.scene->camera->width;
-       options.height = options.scene->camera->height;
+       
+       if (width == 0 || height == 0) {
+               options.width = options.scene->camera->width;
+               options.height = options.scene->camera->height;
+       }
 }
 
 static void session_exit()
@@ -151,7 +165,7 @@ static void display_info(Progress& progress)
 
 static void display()
 {
-       options.session->draw(options.width, options.height);
+       options.session->draw(session_buffer_params());
 
        display_info(options.session->progress);
 }
@@ -162,13 +176,13 @@ static void resize(int width, int height)
        options.height= height;
 
        if(options.session)
-               options.session->reset(options.width, options.height, options.session_params.samples);
+               options.session->reset(session_buffer_params(), options.session_params.samples);
 }
 
 void keyboard(unsigned char key)
 {
        if(key == 'r')
-               options.session->reset(options.width, options.height, options.session_params.samples);
+               options.session->reset(session_buffer_params(), options.session_params.samples);
        else if(key == 27) // escape
                options.session->progress.set_cancel("Cancelled");
 }
@@ -183,8 +197,8 @@ static int files_parse(int argc, const char *argv[])
 
 static void options_parse(int argc, const char **argv)
 {
-       options.width= 1024;
-       options.height= 512;
+       options.width= 0;
+       options.height= 0;
        options.filepath = "";
        options.session = NULL;
        options.quiet = false;
@@ -223,6 +237,8 @@ static void options_parse(int argc, const char **argv)
                "--samples %d", &options.session_params.samples, "Number of samples to render",
                "--output %s", &options.session_params.output_path, "File path to write output image",
                "--threads %d", &options.session_params.threads, "CPU Rendering Threads",
+               "--width  %d", &options.width, "Window width in pixel",
+               "--height %d", &options.height, "Window height in pixel",
                "--help", &help, "Print help message",
                NULL);
        
@@ -276,7 +292,7 @@ static void options_parse(int argc, const char **argv)
        }
 
        /* load scene */
-       scene_init();
+       scene_init(options.width, options.height);
 }
 
 CCL_NAMESPACE_END
index f5cc01cd0626528419e8dfaf73263adc3d1091e4..e29a73ec9e865cce427dac8690b452eb943eb139 100644 (file)
@@ -257,8 +257,18 @@ static void xml_read_integrator(const XMLReadState& state, pugi::xml_node node)
 
        xml_read_int(&integrator->min_bounce, node, "min_bounce");
        xml_read_int(&integrator->max_bounce, node, "max_bounce");
+       
+       xml_read_int(&integrator->max_diffuse_bounce, node, "max_diffuse_bounce");
+       xml_read_int(&integrator->max_glossy_bounce, node, "max_glossy_bounce");
+       xml_read_int(&integrator->max_transmission_bounce, node, "max_transmission_bounce");
+       
+       xml_read_int(&integrator->transparent_min_bounce, node, "transparent_min_bounce");
+       xml_read_int(&integrator->transparent_max_bounce, node, "transparent_max_bounce");
+       
+       xml_read_bool(&integrator->transparent_shadows, node, "transparent_shadows");
        xml_read_bool(&integrator->no_caustics, node, "no_caustics");
-       xml_read_float(&integrator->blur_caustics, node, "blur_caustics");
+       
+       xml_read_int(&integrator->seed, node, "seed");
 }
 
 /* Camera */
diff --git a/intern/cycles/app/io_export_cycles_xml.py b/intern/cycles/app/io_export_cycles_xml.py
new file mode 100644 (file)
index 0000000..2314d93
--- /dev/null
@@ -0,0 +1,143 @@
+#
+# Copyright 2011, Blender Foundation.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+# XML exporter for generating test files, not intended for end users
+
+import os
+import xml.etree.ElementTree as etree
+import xml.dom.minidom as dom
+
+import bpy
+from bpy_extras.io_utils import ExportHelper
+from bpy.props import PointerProperty, StringProperty
+
+def strip(root):
+    root.text = None
+    root.tail = None
+
+    for elem in root:
+        strip(elem)
+
+def write(node, fname):
+    strip(node)
+
+    s = etree.tostring(node)
+    s = dom.parseString(s).toprettyxml()
+
+    f = open(fname, "w")
+    f.write(s)
+    
+class CyclesXMLSettings(bpy.types.PropertyGroup):
+    @classmethod
+    def register(cls):
+        bpy.types.Scene.cycles_xml = PointerProperty(
+                                        type=cls,
+                                        name="Cycles XML export Settings",
+                                        description="Cycles XML export settings")
+        cls.filepath = StringProperty(
+                        name='Filepath',
+                        description='Filepath for the .xml file',
+                        maxlen=256,
+                        default='',
+                        subtype='FILE_PATH')
+                        
+    @classmethod
+    def unregister(cls):
+        del bpy.types.Scene.cycles_xml
+        
+# User Interface Drawing Code
+class RenderButtonsPanel():
+    bl_space_type = 'PROPERTIES'
+    bl_region_type = 'WINDOW'
+    bl_context = "render"
+
+    @classmethod
+    def poll(self, context):
+        rd = context.scene.render
+        return rd.engine == 'CYCLES'
+
+
+class PHYSICS_PT_fluid_export(RenderButtonsPanel, bpy.types.Panel):
+    bl_label = "Cycles XML Exporter"
+
+    def draw(self, context):
+        layout = self.layout
+        
+        cycles = context.scene.cycles_xml
+        
+        #layout.prop(cycles, "filepath")
+        layout.operator("export_mesh.cycles_xml")
+
+        
+# Export Operator
+class ExportCyclesXML(bpy.types.Operator, ExportHelper):
+    bl_idname = "export_mesh.cycles_xml"
+    bl_label = "Export Cycles XML"
+
+    filename_ext = ".xml"
+
+    @classmethod
+    def poll(cls, context):
+        return context.active_object != None
+
+    def execute(self, context):
+        filepath = bpy.path.ensure_ext(self.filepath, ".xml")
+
+        # get mesh
+        scene = context.scene
+        object = context.active_object
+
+        if not object:
+            raise Exception("No active object")
+
+        mesh = object.to_mesh(scene, True, 'PREVIEW')
+
+        if not mesh:
+            raise Exception("No mesh data in active object")
+
+        # generate mesh node
+        nverts = ""
+        verts = ""
+        P = ""
+
+        for v in mesh.vertices:
+            P += "%f %f %f  " % (v.co[0], v.co[1], v.co[2])
+
+        for i, f in enumerate(mesh.faces):
+            nverts += str(len(f.vertices)) + " "
+
+            for v in f.vertices:
+                verts += str(v) + " "
+            verts += " "
+
+        node = etree.Element('mesh', attrib={'nverts': nverts, 'verts': verts, 'P': P})
+        
+        # write to file
+        write(node, filepath)
+
+        return {'FINISHED'}
+
+def register():
+    bpy.utils.register_module(__name__)
+
+def unregister():
+    bpy.utils.unregister_module(__name__)
+
+if __name__ == "__main__":
+    register()
+
index 2fedd2c0afa060675fa73e928d1dcd046e783016..3d71c25d7ade46c9fcad252a73e6aae1ec378195 100644 (file)
@@ -22,17 +22,17 @@ import bpy
 
 
 def init():
-    import bcycles
+    import _cycles
     import os.path
 
     path = os.path.dirname(__file__)
     user_path = os.path.dirname(os.path.abspath(bpy.utils.user_resource('CONFIG', '')))
 
-    bcycles.init(path, user_path)
+    _cycles.init(path, user_path)
 
 
 def create(engine, data, scene, region=0, v3d=0, rv3d=0):
-    import bcycles
+    import _cycles
 
     data = data.as_pointer()
     scene = scene.as_pointer()
@@ -43,46 +43,42 @@ def create(engine, data, scene, region=0, v3d=0, rv3d=0):
     if rv3d:
         rv3d = rv3d.as_pointer()
 
-    engine.session = bcycles.create(engine.as_pointer(), data, scene, region, v3d, rv3d)
+    engine.session = _cycles.create(engine.as_pointer(), data, scene, region, v3d, rv3d)
 
 
 def free(engine):
     if hasattr(engine, "session"):
         if engine.session:
-            import bcycles
-            bcycles.free(engine.session)
+            import _cycles
+            _cycles.free(engine.session)
         del engine.session
 
 
 def render(engine):
-    import bcycles
+    import _cycles
     if hasattr(engine, "session"):
-        bcycles.render(engine.session)
+        _cycles.render(engine.session)
 
 
 def update(engine, data, scene):
-    import bcycles
-    if scene.render.use_border:
-        engine.report({'ERROR'}, "Border rendering not supported yet")
-        free(engine)
-    else:
-        bcycles.sync(engine.session)
+    import _cycles
+    _cycles.sync(engine.session)
 
 
 def draw(engine, region, v3d, rv3d):
-    import bcycles
+    import _cycles
     v3d = v3d.as_pointer()
     rv3d = rv3d.as_pointer()
 
     # draw render image
-    bcycles.draw(engine.session, v3d, rv3d)
+    _cycles.draw(engine.session, v3d, rv3d)
 
 
 def available_devices():
-    import bcycles
-    return bcycles.available_devices()
+    import _cycles
+    return _cycles.available_devices()
 
 
 def with_osl():
-    import bcycles
-    return bcycles.with_osl()
+    import _cycles
+    return _cycles.with_osl
index d631158f5eba29c1aa15f9b9615b4cf6ae6c4ecc..6e73795666e9952e4ac376b85e5f10bb4a8e639b 100644 (file)
@@ -160,18 +160,17 @@ class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
         scene = context.scene
         rd = scene.render
 
-        row = layout.row()
-        row.template_list(rd, "layers", rd.layers, "active_index", rows=2)
+        row = layout.row()
+        row.template_list(rd, "layers", rd.layers, "active_index", rows=2)
 
-        col = row.column(align=True)
-        col.operator("scene.render_layer_add", icon='ZOOMIN', text="")
-        col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="")
+        col = row.column(align=True)
+        col.operator("scene.render_layer_add", icon='ZOOMIN', text="")
+        col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="")
 
         row = layout.row()
-        # rl = rd.layers.active
-        rl = rd.layers[0]
+        rl = rd.layers.active
         row.prop(rl, "name")
-        #row.prop(rd, "use_single_layer", text="", icon_only=True)
+        row.prop(rd, "use_single_layer", text="", icon_only=True)
 
         split = layout.split()
 
@@ -183,6 +182,7 @@ class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
 
         layout.separator()
 
+        rl = rd.layers[0]
         layout.prop(rl, "material_override", text="Material")
 
 
@@ -745,6 +745,12 @@ def get_panels():
         bpy.types.RENDER_PT_encoding,
         bpy.types.RENDER_PT_dimensions,
         bpy.types.RENDER_PT_stamp,
+        bpy.types.SCENE_PT_scene,
+        bpy.types.SCENE_PT_audio,
+        bpy.types.SCENE_PT_unit,
+        bpy.types.SCENE_PT_keying_sets,
+        bpy.types.SCENE_PT_keying_set_paths,
+        bpy.types.SCENE_PT_physics,
         bpy.types.WORLD_PT_context_world,
         bpy.types.DATA_PT_context_mesh,
         bpy.types.DATA_PT_context_camera,
index 2a2c2a7c643b18f18841528ae11cadf104e73a40..9777de14b1e98801c8572fa7cc596277bd3ef41a 100644 (file)
@@ -207,6 +207,7 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
 
        /* transform, note the blender camera points along the negative z-axis */
        cam->matrix = bcam->matrix * transform_scale(1.0f, 1.0f, -1.0f);
+       cam->matrix = transform_clear_scale(cam->matrix);
 
        /* set update flag */
        if(cam->modified(prevcam))
@@ -286,5 +287,29 @@ void BlenderSync::sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int
        blender_camera_sync(scene->camera, &bcam, width, height);
 }
 
+BufferParams BlenderSync::get_buffer_params(BL::Scene b_scene, BL::RegionView3D b_rv3d, int width, int height)
+{
+       BufferParams params;
+
+       params.full_width = width;
+       params.full_height = height;
+
+       /* border render */
+       BL::RenderSettings r = b_scene.render();
+
+       if(!b_rv3d && r.use_border()) {
+               params.full_x = r.border_min_x()*width;
+               params.full_y = r.border_min_y()*height;
+               params.width = (int)(r.border_max_x()*width) - params.full_x;
+               params.height = (int)(r.border_max_y()*height) - params.full_y;
+       }
+       else {
+               params.width = width;
+               params.height = height;
+       }
+
+       return params;
+}
+
 CCL_NAMESPACE_END
 
index 4b7651dba4c62690bc00768c98eeff4b50a1fade..72b8cfa23552ca6a208bb0128e2ab18e581d843a 100644 (file)
@@ -232,8 +232,10 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated)
 
        BL::Object::material_slots_iterator slot;
        for(b_ob.material_slots.begin(slot); slot != b_ob.material_slots.end(); ++slot) {
-               if(render_layer.material_override)
-                       find_shader(render_layer.material_override, used_shaders, scene->default_surface);
+               BL::Material material_override = render_layers.front().material_override;
+
+               if(material_override)
+                       find_shader(material_override, used_shaders, scene->default_surface);
                else
                        find_shader(slot->material(), used_shaders, scene->default_surface);
        }
index ec22d3db6f71c197ef79495cd59ee19b2c39f63c..608c5fda5ac356cc15dfba80e053fda4f2e3f815 100644 (file)
@@ -154,7 +154,7 @@ void BlenderSync::sync_light(BL::Object b_parent, int b_index, BL::Object b_ob,
 
 /* Object */
 
-void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm, uint visibility)
+void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm, uint layer_flag)
 {
        /* light is handled separately */
        if(object_is_light(b_ob)) {
@@ -181,11 +181,19 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob,
        if(object_updated || (object->mesh && object->mesh->need_update)) {
                object->name = b_ob.name().c_str();
                object->tfm = tfm;
-               
-               object->visibility = object_ray_visibility(b_ob) & visibility;
+
+               /* visibility flags for both parent */
+               object->visibility = object_ray_visibility(b_ob) & PATH_RAY_ALL;
                if(b_parent.ptr.data != b_ob.ptr.data)
                        object->visibility &= object_ray_visibility(b_parent);
 
+               /* camera flag is not actually used, instead is tested
+                  against render layer flags */
+               if(object->visibility & PATH_RAY_CAMERA) {
+                       object->visibility |= layer_flag << PATH_RAY_LAYER_SHIFT;
+                       object->visibility &= ~PATH_RAY_CAMERA;
+               }
+
                object->tag_update(scene);
        }
 }
@@ -195,8 +203,7 @@ void BlenderSync::sync_object(BL::Object b_parent, int b_index, BL::Object b_ob,
 void BlenderSync::sync_objects(BL::SpaceView3D b_v3d)
 {
        /* layer data */
-       uint scene_layer = render_layer.scene_layer;
-       uint layer = render_layer.layer;
+       uint scene_layer = render_layers.front().scene_layer;
        
        /* prepare for sync */
        light_map.pre_sync();
@@ -212,11 +219,6 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d)
                uint ob_layer = get_layer(b_ob->layers());
 
                if(!hide && (ob_layer & scene_layer)) {
-                       uint visibility = PATH_RAY_ALL;
-                       
-                       if(!(ob_layer & layer))
-                               visibility &= ~PATH_RAY_CAMERA;
-
                        if(b_ob->is_duplicator()) {
                                /* dupli objects */
                                object_create_duplilist(*b_ob, b_scene);
@@ -226,7 +228,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d)
 
                                for(b_ob->dupli_list.begin(b_dup); b_dup != b_ob->dupli_list.end(); ++b_dup) {
                                        Transform tfm = get_transform(b_dup->matrix());
-                                       sync_object(*b_ob, b_index, b_dup->object(), tfm, visibility);
+                                       sync_object(*b_ob, b_index, b_dup->object(), tfm, ob_layer);
                                        b_index++;
                                }
 
@@ -244,7 +246,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d)
                        if(!hide) {
                                /* object itself */
                                Transform tfm = get_transform(b_ob->matrix_world());
-                               sync_object(*b_ob, 0, *b_ob, tfm, visibility);
+                               sync_object(*b_ob, 0, *b_ob, tfm, ob_layer);
                        }
                }
        }
index 58049bb8cbe9809a5aa3b559b27464458b981353..90dab298dc303bc998ce78b348ae15ec691dab96 100644 (file)
@@ -35,8 +35,7 @@ static PyObject *init_func(PyObject *self, PyObject *args)
        
        path_init(path, user_path);
 
-       Py_INCREF(Py_None);
-       return Py_None;
+       Py_RETURN_NONE;
 }
 
 static PyObject *create_func(PyObject *self, PyObject *args)
@@ -89,35 +88,23 @@ static PyObject *create_func(PyObject *self, PyObject *args)
        return PyLong_FromVoidPtr(session);
 }
 
-static PyObject *free_func(PyObject *self, PyObject *args)
+static PyObject *free_func(PyObject *self, PyObject *value)
 {
-       PyObject *pysession;
+       delete (BlenderSession*)PyLong_AsVoidPtr(value);
 
-       if(!PyArg_ParseTuple(args, "O", &pysession))
-               return NULL;
-
-       delete (BlenderSession*)PyLong_AsVoidPtr(pysession);
-
-       Py_INCREF(Py_None);
-       return Py_None;
+       Py_RETURN_NONE;
 }
 
-static PyObject *render_func(PyObject *self, PyObject *args)
+static PyObject *render_func(PyObject *self, PyObject *value)
 {
-       PyObject *pysession;
-
-       if(!PyArg_ParseTuple(args, "O", &pysession))
-               return NULL;
-       
        Py_BEGIN_ALLOW_THREADS
 
-       BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
+       BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(value);
        session->render();
 
        Py_END_ALLOW_THREADS
 
-       Py_INCREF(Py_None);
-       return Py_None;
+       Py_RETURN_NONE;
 }
 
 static PyObject *draw_func(PyObject *self, PyObject *args)
@@ -137,22 +124,15 @@ static PyObject *draw_func(PyObject *self, PyObject *args)
                session->draw(viewport[2], viewport[3]);
        }
 
-       Py_INCREF(Py_None);
-       return Py_None;
+       Py_RETURN_NONE;
 }
 
-static PyObject *sync_func(PyObject *self, PyObject *args)
+static PyObject *sync_func(PyObject *self, PyObject *value)
 {
-       PyObject *pysession;
-
-       if(!PyArg_ParseTuple(args, "O", &pysession))
-               return NULL;
-
-       BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
+       BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(value);
        session->synchronize();
 
-       Py_INCREF(Py_None);
-       return Py_None;
+       Py_RETURN_NONE;
 }
 
 static PyObject *available_devices_func(PyObject *self, PyObject *args)
@@ -163,38 +143,26 @@ static PyObject *available_devices_func(PyObject *self, PyObject *args)
 
        for(size_t i = 0; i < types.size(); i++) {
                string name = Device::string_from_type(types[i]);
-               PyTuple_SetItem(ret, i, PyUnicode_FromString(name.c_str()));
+               PyTuple_SET_ITEM(ret, i, PyUnicode_FromString(name.c_str()));
        }
 
        return ret;
 }
 
-static PyObject *with_osl_func(PyObject *self, PyObject *args)
-{
-#ifdef WITH_OSL
-       PyObject *ret = Py_True;
-#else
-       PyObject *ret = Py_False;
-#endif
-
-       return Py_INCREF(ret), ret;
-}
-
 static PyMethodDef methods[] = {
        {"init", init_func, METH_VARARGS, ""},
        {"create", create_func, METH_VARARGS, ""},
-       {"free", free_func, METH_VARARGS, ""},
-       {"render", render_func, METH_VARARGS, ""},
+       {"free", free_func, METH_O, ""},
+       {"render", render_func, METH_O, ""},
        {"draw", draw_func, METH_VARARGS, ""},
-       {"sync", sync_func, METH_VARARGS, ""},
+       {"sync", sync_func, METH_O, ""},
        {"available_devices", available_devices_func, METH_NOARGS, ""},
-       {"with_osl", with_osl_func, METH_NOARGS, ""},
        {NULL, NULL, 0, NULL},
 };
 
 static struct PyModuleDef module = {
        PyModuleDef_HEAD_INIT,
-       "bcycles",
+       "_cycles",
        "Blender cycles render integration",
        -1,
        methods,
@@ -207,6 +175,16 @@ extern "C" PyObject *CYCLES_initPython();
 
 PyObject *CYCLES_initPython()
 {
-       return PyModule_Create(&ccl::module);
+       PyObject *mod= PyModule_Create(&ccl::module);
+
+#ifdef WITH_OSL
+       PyModule_AddObject(mod, "with_osl", Py_True);
+       Py_INCREF(Py_True);
+#else
+       PyModule_AddObject(mod, "with_osl", Py_False);
+       Py_INCREF(Py_False);
+#endif
+
+       return mod;
 }
 
index 4433b1e24f9149f65e6a0cdc5a1ce6bddb74d376..d8c65c7a607d0020e4e1ca5257de5b7e7c558c39 100644 (file)
@@ -40,7 +40,8 @@
 CCL_NAMESPACE_BEGIN
 
 BlenderSession::BlenderSession(BL::RenderEngine b_engine_, BL::BlendData b_data_, BL::Scene b_scene_)
-: b_engine(b_engine_), b_data(b_data_), b_scene(b_scene_), b_v3d(PointerRNA_NULL), b_rv3d(PointerRNA_NULL)
+: b_engine(b_engine_), b_data(b_data_), b_scene(b_scene_), b_v3d(PointerRNA_NULL), b_rv3d(PointerRNA_NULL),
+  b_rr(PointerRNA_NULL), b_rlay(PointerRNA_NULL)
 {
        /* offline render */
        BL::RenderSettings r = b_scene.render();
@@ -55,7 +56,8 @@ BlenderSession::BlenderSession(BL::RenderEngine b_engine_, BL::BlendData b_data_
 
 BlenderSession::BlenderSession(BL::RenderEngine b_engine_, BL::BlendData b_data_, BL::Scene b_scene_,
        BL::SpaceView3D b_v3d_, BL::RegionView3D b_rv3d_, int width_, int height_)
-: b_engine(b_engine_), b_data(b_data_), b_scene(b_scene_), b_v3d(b_v3d_), b_rv3d(b_rv3d_)
+: b_engine(b_engine_), b_data(b_data_), b_scene(b_scene_), b_v3d(b_v3d_), b_rv3d(b_rv3d_),
+  b_rr(PointerRNA_NULL), b_rlay(PointerRNA_NULL)
 {
        /* 3d view render */
        width = width_;
@@ -64,6 +66,7 @@ BlenderSession::BlenderSession(BL::RenderEngine b_engine_, BL::BlendData b_data_
        last_redraw_time = 0.0f;
 
        create_session();
+       session->start();
 }
 
 BlenderSession::~BlenderSession()
@@ -99,9 +102,9 @@ void BlenderSession::create_session()
        session->progress.set_cancel_callback(function_bind(&BlenderSession::test_cancel, this));
        session->set_pause(BlenderSync::get_session_pause(b_scene, background));
 
-       /* start rendering */
-       session->reset(width, height, session_params.samples);
-       session->start();
+       /* set buffer parameters */
+       BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_rv3d, width, height);
+       session->reset(buffer_params, session_params.samples);
 }
 
 void BlenderSession::free_session()
@@ -112,39 +115,67 @@ void BlenderSession::free_session()
 
 void BlenderSession::render()
 {
-       session->wait();
+       /* get buffer parameters */
+       BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_rv3d, width, height);
+       int w = buffer_params.width, h = buffer_params.height;
 
-       if(session->progress.get_cancel())
-               return;
+       /* create render result */
+       RenderResult *rrp = RE_engine_begin_result((RenderEngine*)b_engine.ptr.data, 0, 0, w, h);
+       PointerRNA rrptr;
+       RNA_pointer_create(NULL, &RNA_RenderResult, rrp, &rrptr);
+       b_rr = BL::RenderResult(rrptr);
+
+       BL::RenderSettings r = b_scene.render();
+       BL::RenderResult::layers_iterator b_iter;
+       BL::RenderLayers b_rr_layers(r.ptr);
+       
+       int active = 0;
+
+       /* render each layer */
+       for(b_rr.layers.begin(b_iter); b_iter != b_rr.layers.end(); ++b_iter, ++active) {
+               /* single layer render */
+               if(r.use_single_layer())
+                       active = b_rr_layers.active_index();
+
+               /* set layer */
+               b_rlay = *b_iter;
+
+               /* update scene */
+               sync->sync_data(b_v3d, active);
+
+               /* render */
+               session->start();
+               session->wait();
 
-       /* write result */
-       write_render_result();
+               if(session->progress.get_cancel())
+                       break;
+
+               /* write result */
+               write_render_result();
+       }
+
+       /* delete render result */
+       RE_engine_end_result((RenderEngine*)b_engine.ptr.data, (RenderResult*)b_rr.ptr.data);
 }
 
 void BlenderSession::write_render_result()
 {
-       /* get result */
+       /* get state */
        RenderBuffers *buffers = session->buffers;
        float exposure = scene->film->exposure;
        double total_time, sample_time;
        int sample;
        session->progress.get_sample(sample, total_time, sample_time);
 
+       /* get pixels */
        float4 *pixels = buffers->copy_from_device(exposure, sample);
 
        if(!pixels)
                return;
 
-       struct RenderResult *rrp = RE_engine_begin_result((RenderEngine*)b_engine.ptr.data, 0, 0, width, height);
-       PointerRNA rrptr;
-       RNA_pointer_create(NULL, &RNA_RenderResult, rrp, &rrptr);
-       BL::RenderResult rr(rrptr);
-
-       BL::RenderResult::layers_iterator layer;
-       rr.layers.begin(layer);
-       rna_RenderLayer_rect_set(&layer->ptr, (float*)pixels);
-
-       RE_engine_end_result((RenderEngine*)b_engine.ptr.data, rrp);
+       /* write pixels */
+       rna_RenderLayer_rect_set(&b_rlay.ptr, (float*)pixels);
+       RE_engine_update_result((RenderEngine*)b_engine.ptr.data, (RenderResult*)b_rr.ptr.data);
 
        delete [] pixels;
 }
@@ -159,6 +190,7 @@ void BlenderSession::synchronize()
           scene->params.modified(scene_params)) {
                free_session();
                create_session();
+               session->start();
                return;
        }
 
@@ -188,8 +220,10 @@ void BlenderSession::synchronize()
        session->scene->mutex.unlock();
 
        /* reset if needed */
-       if(scene->need_reset())
-               session->reset(width, height, session_params.samples);
+       if(scene->need_reset()) {
+               BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_rv3d, width, height);
+               session->reset(buffer_params, session_params.samples);
+       }
 }
 
 bool BlenderSession::draw(int w, int h)
@@ -225,7 +259,9 @@ bool BlenderSession::draw(int w, int h)
                /* reset if requested */
                if(reset) {
                        SessionParams session_params = BlenderSync::get_session_params(b_scene, background);
-                       session->reset(width, height, session_params.samples);
+                       BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_rv3d, width, height);
+
+                       session->reset(buffer_params, session_params.samples);
                }
        }
 
@@ -233,7 +269,9 @@ bool BlenderSession::draw(int w, int h)
        update_status_progress();
 
        /* draw */
-       return !session->draw(width, height);
+       BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_rv3d, width, height);
+
+       return !session->draw(buffer_params);
 }
 
 void BlenderSession::get_status(string& status, string& substatus)
index e30b60c3d637bedf5d95dc39c90b7ad4343bfbb3..26fffcf3aff9a20603fdd3f8dffe2a212b8f43fb 100644 (file)
@@ -69,6 +69,8 @@ public:
        BL::Scene b_scene;
        BL::SpaceView3D b_v3d;
        BL::RegionView3D b_rv3d;
+       BL::RenderResult b_rr;
+       BL::RenderLayer b_rlay;
 
        string last_status;
        float last_progress;
index ecc85a92ae03a5e10de0cc75c81eeaf2dfcc1801..5c39a3f169d132677f97a0b3df59672510b0beac 100644 (file)
@@ -50,28 +50,6 @@ void BlenderSync::find_shader(BL::ID id, vector<uint>& used_shaders, int default
 
 /* Graph */
 
-static BL::NodeSocket get_node_input(BL::Node *b_group_node, BL::NodeSocket b_in)
-{
-       if(b_group_node) {
-
-               BL::NodeTree b_ntree = BL::NodeGroup(*b_group_node).node_tree();
-               BL::NodeTree::links_iterator b_link;
-
-               for(b_ntree.links.begin(b_link); b_link != b_ntree.links.end(); ++b_link) {
-                       if(b_link->to_socket().ptr.data == b_in.ptr.data) {
-                               BL::Node::inputs_iterator b_gin;
-
-                               for(b_group_node->inputs.begin(b_gin); b_gin != b_group_node->inputs.end(); ++b_gin)
-                                       if(b_gin->group_socket().ptr.data == b_link->from_socket().ptr.data)
-                                               return *b_gin;
-
-                       }
-               }
-       }
-
-       return b_in;
-}
-
 static BL::NodeSocket get_node_output(BL::Node b_node, const string& name)
 {
        BL::Node::outputs_iterator b_out;
@@ -121,7 +99,7 @@ static void get_tex_mapping(TextureMapping *mapping, BL::ShaderNodeMapping b_map
        mapping->scale = get_float3(b_mapping.scale());
 }
 
-static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Node *b_group_node, BL::ShaderNode b_node)
+static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::ShaderNode b_node)
 {
        ShaderNode *node = NULL;
 
@@ -470,59 +448,115 @@ static SocketPair node_socket_map_pair(PtrNodeMap& node_map, BL::Node b_node, BL
        return SocketPair(node_map[b_node.ptr.data], name);
 }
 
-static void add_nodes(BL::BlendData b_data, ShaderGraph *graph, BL::ShaderNodeTree b_ntree, BL::Node *b_group_node, PtrSockMap& sockets_map)
+static ShaderSocketType convert_socket_type(BL::NodeSocket::type_enum b_type)
+{
+       switch (b_type) {
+       case BL::NodeSocket::type_VALUE:
+               return SHADER_SOCKET_FLOAT;
+       case BL::NodeSocket::type_VECTOR:
+               return SHADER_SOCKET_VECTOR;
+       case BL::NodeSocket::type_RGBA:
+               return SHADER_SOCKET_COLOR;
+       case BL::NodeSocket::type_SHADER:
+               return SHADER_SOCKET_CLOSURE;
+       
+       case BL::NodeSocket::type_BOOLEAN:
+       case BL::NodeSocket::type_MESH:
+       case BL::NodeSocket::type_INT:
+       default:
+               return SHADER_SOCKET_FLOAT;
+       }
+}
+
+static void set_default_value(ShaderInput *input, BL::NodeSocket sock)
+{
+       /* copy values for non linked inputs */
+       switch(input->type) {
+       case SHADER_SOCKET_FLOAT: {
+               BL::NodeSocketFloatNone value_sock(sock);
+               input->set(value_sock.default_value());
+               break;
+       }
+       case SHADER_SOCKET_COLOR: {
+               BL::NodeSocketRGBA rgba_sock(sock);
+               input->set(get_float3(rgba_sock.default_value()));
+               break;
+       }
+       case SHADER_SOCKET_NORMAL:
+       case SHADER_SOCKET_POINT:
+       case SHADER_SOCKET_VECTOR: {
+               BL::NodeSocketVectorNone vec_sock(sock);
+               input->set(get_float3(vec_sock.default_value()));
+               break;
+       }
+       case SHADER_SOCKET_CLOSURE:
+               break;
+       }
+}
+
+static void add_nodes(BL::BlendData b_data, ShaderGraph *graph, BL::ShaderNodeTree b_ntree, PtrSockMap& sockets_map)
 {
        /* add nodes */
        BL::ShaderNodeTree::nodes_iterator b_node;
        PtrNodeMap node_map;
-       map<void*, PtrSockMap> node_groups;
+       PtrSockMap proxy_map;
 
        for(b_ntree.nodes.begin(b_node); b_node != b_ntree.nodes.end(); ++b_node) {
                if(b_node->is_a(&RNA_NodeGroup)) {
+                       /* add proxy converter nodes for inputs and outputs */
                        BL::NodeGroup b_gnode(*b_node);
                        BL::ShaderNodeTree b_group_ntree(b_gnode.node_tree());
-
-                       node_groups[b_node->ptr.data] = PtrSockMap();
-                       add_nodes(b_data, graph, b_group_ntree, &b_gnode, node_groups[b_node->ptr.data]);
+                       BL::Node::inputs_iterator b_input;
+                       BL::Node::outputs_iterator b_output;
+                       
+                       PtrSockMap group_sockmap;
+                       
+                       for(b_node->inputs.begin(b_input); b_input != b_node->inputs.end(); ++b_input) {
+                               ShaderSocketType extern_type = convert_socket_type(b_input->type());
+                               ShaderSocketType intern_type = convert_socket_type(b_input->group_socket().type());
+                               ShaderNode *proxy = graph->add(new ProxyNode(extern_type, intern_type));
+                               
+                               /* map the external node socket to the proxy node socket */
+                               proxy_map[b_input->ptr.data] = SocketPair(proxy, proxy->inputs[0]->name);
+                               /* map the internal group socket to the proxy node socket */
+                               group_sockmap[b_input->group_socket().ptr.data] = SocketPair(proxy, proxy->outputs[0]->name);
+                               
+                               /* default input values of the group node */
+                               set_default_value(proxy->inputs[0], *b_input);
+                       }
+                       
+                       for(b_node->outputs.begin(b_output); b_output != b_node->outputs.end(); ++b_output) {
+                               ShaderSocketType extern_type = convert_socket_type(b_output->type());
+                               ShaderSocketType intern_type = convert_socket_type(b_output->group_socket().type());
+                               ShaderNode *proxy = graph->add(new ProxyNode(intern_type, extern_type));
+                               
+                               /* map the external node socket to the proxy node socket */
+                               proxy_map[b_output->ptr.data] = SocketPair(proxy, proxy->outputs[0]->name);
+                               /* map the internal group socket to the proxy node socket */
+                               group_sockmap[b_output->group_socket().ptr.data] = SocketPair(proxy, proxy->inputs[0]->name);
+                               
+                               /* default input values of internal, unlinked group outputs */
+                               set_default_value(proxy->inputs[0], b_output->group_socket());
+                       }
+                       
+                       add_nodes(b_data, graph, b_group_ntree, group_sockmap);
                }
                else {
-                       ShaderNode *node = add_node(b_data, graph, b_group_node, BL::ShaderNode(*b_node));
-
+                       ShaderNode *node = add_node(b_data, graph, BL::ShaderNode(*b_node));
+                       
                        if(node) {
                                BL::Node::inputs_iterator b_input;
-                               BL::Node::outputs_iterator b_output;
-
+                               
                                node_map[b_node->ptr.data] = node;
-
+                               
                                for(b_node->inputs.begin(b_input); b_input != b_node->inputs.end(); ++b_input) {
                                        SocketPair pair = node_socket_map_pair(node_map, *b_node, *b_input);
                                        ShaderInput *input = pair.first->input(pair.second.c_str());
-                                       BL::NodeSocket sock(get_node_input(b_group_node, *b_input));
-
+                                       
                                        assert(input);
-
+                                       
                                        /* copy values for non linked inputs */
-                                       switch(input->type) {
-                                               case SHADER_SOCKET_FLOAT: {
-                                                       BL::NodeSocketFloatNone value_sock(sock);
-                                                       input->set(value_sock.default_value());
-                                                       break;
-                                               }
-                                               case SHADER_SOCKET_COLOR: {
-                                                       BL::NodeSocketRGBA rgba_sock(sock);
-                                                       input->set(get_float3(rgba_sock.default_value()));
-                                                       break;
-                                               }
-                                               case SHADER_SOCKET_NORMAL:
-                                               case SHADER_SOCKET_POINT:
-                                               case SHADER_SOCKET_VECTOR: {
-                                                       BL::NodeSocketVectorNone vec_sock(sock);
-                                                       input->set(get_float3(vec_sock.default_value()));
-                                                       break;
-                                               }
-                                               case SHADER_SOCKET_CLOSURE:
-                                                       break;
-                                       }
+                                       set_default_value(input, *b_input);
                                }
                        }
                }
@@ -539,54 +573,34 @@ static void add_nodes(BL::BlendData b_data, ShaderGraph *graph, BL::ShaderNodeTr
                BL::NodeSocket b_from_sock = b_link->from_socket();
                BL::NodeSocket b_to_sock = b_link->to_socket();
 
-               /* if link with group socket, add to map so we can connect it later */
-               if(b_group_node) {
-                       if(!b_from_node) {
-                               sockets_map[b_from_sock.ptr.data] =
-                                       node_socket_map_pair(node_map, b_to_node, b_to_sock);
-
-                               continue;
-                       }
-                       else if(!b_to_node) {
-                               sockets_map[b_to_sock.ptr.data] =
-                                       node_socket_map_pair(node_map, b_from_node, b_from_sock);
-
-                               continue;
-                       }
-               }
-
                SocketPair from_pair, to_pair;
 
+               /* links without a node pointer are connections to group inputs/outputs */
+
                /* from sock */
-               if(b_from_node.is_a(&RNA_NodeGroup)) {
-                       /* group node */
-                       BL::NodeSocket group_sock = b_from_sock.group_socket();
-                       from_pair = node_groups[b_from_node.ptr.data][group_sock.ptr.data];
-               }
-               else {
-                       /* regular node */
-                       from_pair = node_socket_map_pair(node_map, b_from_node, b_from_sock);
+               if(b_from_node) {
+                       if (b_from_node.is_a(&RNA_NodeGroup))
+                               from_pair = proxy_map[b_from_sock.ptr.data];
+                       else
+                               from_pair = node_socket_map_pair(node_map, b_from_node, b_from_sock);
                }
+               else
+                       from_pair = sockets_map[b_from_sock.ptr.data];
 
                /* to sock */
-               if(b_to_node.is_a(&RNA_NodeGroup)) {
-                       /* group node */
-                       BL::NodeSocket group_sock = b_to_sock.group_socket();
-                       to_pair = node_groups[b_to_node.ptr.data][group_sock.ptr.data];
-               }
-               else {
-                       /* regular node */
-                       to_pair = node_socket_map_pair(node_map, b_to_node, b_to_sock);
+               if(b_to_node) {
+                       if (b_to_node.is_a(&RNA_NodeGroup))
+                               to_pair = proxy_map[b_to_sock.ptr.data];
+                       else
+                               to_pair = node_socket_map_pair(node_map, b_to_node, b_to_sock);
                }
+               else
+                       to_pair = sockets_map[b_to_sock.ptr.data];
 
-               /* in case of groups there may not actually be a node inside the group
-                  that the group socket connects to, so from_node or to_node may be NULL */
-               if(from_pair.first && to_pair.first) {
-                       ShaderOutput *output = from_pair.first->output(from_pair.second.c_str());
-                       ShaderInput *input = to_pair.first->input(to_pair.second.c_str());
+               ShaderOutput *output = from_pair.first->output(from_pair.second.c_str());
+               ShaderInput *input = to_pair.first->input(to_pair.second.c_str());
 
-                       graph->connect(output, input);
-               }
+               graph->connect(output, input);
        }
 }
 
@@ -613,7 +627,7 @@ void BlenderSync::sync_materials()
                                PtrSockMap sock_to_node;
                                BL::ShaderNodeTree b_ntree(b_mat->node_tree());
 
-                               add_nodes(b_data, graph, b_ntree, NULL, sock_to_node);
+                               add_nodes(b_data, graph, b_ntree, sock_to_node);
                        }
                        else {
                                ShaderNode *closure, *out;
@@ -654,7 +668,7 @@ void BlenderSync::sync_world()
                        PtrSockMap sock_to_node;
                        BL::ShaderNodeTree b_ntree(b_world.node_tree());
 
-                       add_nodes(b_data, graph, b_ntree, NULL, sock_to_node);
+                       add_nodes(b_data, graph, b_ntree, sock_to_node);
                }
                else if(b_world) {
                        ShaderNode *closure, *out;
@@ -703,7 +717,7 @@ void BlenderSync::sync_lamps()
                                PtrSockMap sock_to_node;
                                BL::ShaderNodeTree b_ntree(b_lamp->node_tree());
 
-                               add_nodes(b_data, graph, b_ntree, NULL, sock_to_node);
+                               add_nodes(b_data, graph, b_ntree, sock_to_node);
                        }
                        else {
                                ShaderNode *closure, *out;
index 4c8fe350b88209a3b0f771ca8f8a7cfc53c61205..3443f76b1ce58cd846de66093cb8382fa41135b0 100644 (file)
@@ -48,7 +48,8 @@ BlenderSync::BlenderSync(BL::BlendData b_data_, BL::Scene b_scene_, Scene *scene
   light_map(&scene_->lights),
   world_map(NULL),
   world_recalc(false),
-  experimental(false)
+  experimental(false),
+  active_layer(0)
 {
        scene = scene_;
        preview = preview_;
@@ -120,18 +121,18 @@ bool BlenderSync::sync_recalc()
        return recalc;
 }
 
-void BlenderSync::sync_data(BL::SpaceView3D b_v3d)
+void BlenderSync::sync_data(BL::SpaceView3D b_v3d, int layer)
 {
-       sync_integrator();
+       sync_render_layers(b_v3d);
+       sync_integrator(layer);
        sync_film();
-       sync_render_layer(b_v3d);
        sync_shaders();
        sync_objects(b_v3d);
 }
 
 /* Integrator */
 
-void BlenderSync::sync_integrator()
+void BlenderSync::sync_integrator(int layer)
 {
        PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
 
@@ -152,9 +153,8 @@ void BlenderSync::sync_integrator()
        integrator->transparent_shadows = get_boolean(cscene, "use_transparent_shadows");
 
        integrator->no_caustics = get_boolean(cscene, "no_caustics");
-       integrator->blur_caustics = get_float(cscene, "blur_caustics");
-
        integrator->seed = get_int(cscene, "seed");
+       integrator->layer_flag = render_layers[layer].layer;
 
        if(integrator->modified(previntegrator))
                integrator->tag_update(scene);
@@ -186,27 +186,32 @@ void BlenderSync::sync_film()
 
 /* Render Layer */
 
-void BlenderSync::sync_render_layer(BL::SpaceView3D b_v3d)
+void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d)
 {
+       render_layers.clear();
+
        if(b_v3d) {
-               render_layer.scene_layer = get_layer(b_v3d.layers());
-               render_layer.layer = render_layer.scene_layer;
-               render_layer.material_override = PointerRNA_NULL;
+               RenderLayerInfo rlay;
+
+               rlay.scene_layer = get_layer(b_v3d.layers());
+               rlay.layer = rlay.scene_layer;
+               rlay.material_override = PointerRNA_NULL;
+
+               render_layers.push_back(rlay);
        }
        else {
                BL::RenderSettings r = b_scene.render();
                BL::RenderSettings::layers_iterator b_rlay;
-               bool first = true;
 
                for(r.layers.begin(b_rlay); b_rlay != r.layers.end(); ++b_rlay) {
                        /* single layer for now */
-                       if(first) {
-                               render_layer.scene_layer = get_layer(b_scene.layers());
-                               render_layer.layer = get_layer(b_rlay->layers());
-                               render_layer.material_override = b_rlay->material_override();
+                       RenderLayerInfo rlay;
 
-                               first = false;
-                       }
+                       rlay.scene_layer = get_layer(b_scene.layers());
+                       rlay.layer = get_layer(b_rlay->layers());
+                       rlay.material_override = b_rlay->material_override();
+
+                       render_layers.push_back(rlay);
                }
        }
 }
index 83c7f70fd596876f07af39426189e9d312e0ac9b..60fdd7c386b143c48afabc9e43fce40dd392c5d2 100644 (file)
@@ -54,7 +54,7 @@ public:
 
        /* sync */
        bool sync_recalc();
-       void sync_data(BL::SpaceView3D b_v3d);
+       void sync_data(BL::SpaceView3D b_v3d, int layer = 0);
        void sync_camera(int width, int height);
        void sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height);
 
@@ -62,6 +62,7 @@ public:
        static SceneParams get_scene_params(BL::Scene b_scene, bool background);
        static SessionParams get_session_params(BL::Scene b_scene, bool background);
        static bool get_session_pause(BL::Scene b_scene, bool background);
+       static BufferParams get_buffer_params(BL::Scene b_scene, BL::RegionView3D b_rv3d, int width, int height);
 
 private:
        /* sync */
@@ -69,15 +70,15 @@ private:
        void sync_materials();
        void sync_objects(BL::SpaceView3D b_v3d);
        void sync_film();
-       void sync_integrator();
+       void sync_integrator(int layer);
        void sync_view();
        void sync_world();
-       void sync_render_layer(BL::SpaceView3D b_v3d);
+       void sync_render_layers(BL::SpaceView3D b_v3d);
        void sync_shaders();
 
        void sync_nodes(Shader *shader, BL::ShaderNodeTree b_ntree);
        Mesh *sync_mesh(BL::Object b_ob, bool object_updated);
-       void sync_object(BL::Object b_parent, int b_index, BL::Object b_object, Transform& tfm, uint visibility);
+       void sync_object(BL::Object b_parent, int b_index, BL::Object b_object, Transform& tfm, uint layer_flag);
        void sync_light(BL::Object b_parent, int b_index, BL::Object b_ob, Transform& tfm);
 
        /* util */
@@ -111,7 +112,10 @@ private:
                uint scene_layer;
                uint layer;
                BL::Material material_override;
-       } render_layer;
+       };
+
+       vector<RenderLayerInfo> render_layers;
+       int active_layer;
 };
 
 CCL_NAMESPACE_END
index f43ccffe4614afb420fbda639b99c090d530f269..6ebc359fdb3ae2be4bd33298667fdd44699884e3 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "util_cuda.h"
 #include "util_debug.h"
+#include "util_foreach.h"
 #include "util_math.h"
 #include "util_opencl.h"
 #include "util_opengl.h"
@@ -41,7 +42,31 @@ DeviceTask::DeviceTask(Type type_)
 {
 }
 
-void DeviceTask::split(ThreadQueue<DeviceTask>& tasks, int num)
+void DeviceTask::split_max_size(list<DeviceTask>& tasks, int max_size)
+{
+       int num;
+
+       if(type == DISPLACE) {
+               num = (displace_w + max_size - 1)/max_size;
+       }
+       else {
+               max_size = max(1, max_size/w);
+               num = (h + max_size - 1)/max_size;
+       }
+
+       split(tasks, num);
+}
+
+void DeviceTask::split(ThreadQueue<DeviceTask>& queue, int num)
+{
+       list<DeviceTask> tasks;
+       split(tasks, num);
+
+       foreach(DeviceTask& task, tasks)
+               queue.push(task);
+}
+
+void DeviceTask::split(list<DeviceTask>& tasks, int num)
 {
        if(type == DISPLACE) {
                num = min(displace_w, num);
@@ -55,7 +80,7 @@ void DeviceTask::split(ThreadQueue<DeviceTask>& tasks, int num)
                        task.displace_x = tx;
                        task.displace_w = tw;
 
-                       tasks.push(task);
+                       tasks.push_back(task);
                }
        }
        else {
@@ -70,7 +95,7 @@ void DeviceTask::split(ThreadQueue<DeviceTask>& tasks, int num)
                        task.y = ty;
                        task.h = th;
 
-                       tasks.push(task);
+                       tasks.push_back(task);
                }
        }
 }
index 5b87b11b6b87602b4167533432ab8ab018d20107..a6a81e7b3268d10359f4e1d8e321f41873c5036c 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "device_memory.h"
 
+#include "util_list.h"
 #include "util_string.h"
 #include "util_thread.h"
 #include "util_types.h"
@@ -60,13 +61,17 @@ public:
        device_ptr buffer;
        int sample;
        int resolution;
+       int offset, stride;
 
        device_ptr displace_input;
        device_ptr displace_offset;
        int displace_x, displace_w;
 
        DeviceTask(Type type = PATH_TRACE);
+
+       void split(list<DeviceTask>& tasks, int num);
        void split(ThreadQueue<DeviceTask>& tasks, int num);
+       void split_max_size(list<DeviceTask>& tasks, int max_size);
 };
 
 /* Device */
index 990b7cb94b0a64d2909c73d89b3c3c7bb3a40fbb..a45a4fb69f627edd05900e355436715d39bccfb7 100644 (file)
@@ -162,7 +162,8 @@ public:
                if(system_cpu_support_optimized()) {
                        for(int y = task.y; y < task.y + task.h; y++) {
                                for(int x = task.x; x < task.x + task.w; x++)
-                                       kernel_cpu_optimized_path_trace(kg, (float4*)task.buffer, (unsigned int*)task.rng_state, task.sample, x, y);
+                                       kernel_cpu_optimized_path_trace(kg, (float4*)task.buffer, (unsigned int*)task.rng_state,
+                                               task.sample, x, y, task.offset, task.stride);
 
                                if(tasks.worker_cancel())
                                        break;
@@ -173,7 +174,8 @@ public:
                {
                        for(int y = task.y; y < task.y + task.h; y++) {
                                for(int x = task.x; x < task.x + task.w; x++)
-                                       kernel_cpu_path_trace(kg, (float4*)task.buffer, (unsigned int*)task.rng_state, task.sample, x, y);
+                                       kernel_cpu_path_trace(kg, (float4*)task.buffer, (unsigned int*)task.rng_state,
+                                               task.sample, x, y, task.offset, task.stride);
 
                                if(tasks.worker_cancel())
                                        break;
@@ -192,14 +194,16 @@ public:
                if(system_cpu_support_optimized()) {
                        for(int y = task.y; y < task.y + task.h; y++)
                                for(int x = task.x; x < task.x + task.w; x++)
-                                       kernel_cpu_optimized_tonemap(kg, (uchar4*)task.rgba, (float4*)task.buffer, task.sample, task.resolution, x, y);
+                                       kernel_cpu_optimized_tonemap(kg, (uchar4*)task.rgba, (float4*)task.buffer,
+                                               task.sample, task.resolution, x, y, task.offset, task.stride);
                }
                else
 #endif
                {
                        for(int y = task.y; y < task.y + task.h; y++)
                                for(int x = task.x; x < task.x + task.w; x++)
-                                       kernel_cpu_tonemap(kg, (uchar4*)task.rgba, (float4*)task.buffer, task.sample, task.resolution, x, y);
+                                       kernel_cpu_tonemap(kg, (uchar4*)task.rgba, (float4*)task.buffer,
+                                               task.sample, task.resolution, x, y, task.offset, task.stride);
                }
        }
 
index 177c90ba2dff3e4d72299bc99685c61d3150f2eb..2a49d4fae4cd11685394126668b7c88fc9df56fa 100644 (file)
@@ -221,7 +221,7 @@ public:
                        cuDeviceComputeCapability(&major, &minor, cuDevId);
 
                        if(major <= 1 && minor <= 2) {
-                               cuda_error(string_printf("CUDA device supported only with shader model 1.3 or up, found %d.%d.", major, minor));
+                               cuda_error(string_printf("CUDA device supported only with compute capability 1.3 or up, found %d.%d.", major, minor));
                                return false;
                        }
                }
@@ -253,9 +253,9 @@ public:
 
 #if defined(WITH_CUDA_BINARIES) && defined(_WIN32)
                if(major <= 1 && minor <= 2)
-                       cuda_error(string_printf("CUDA device supported only with shader model 1.3 or up, found %d.%d.", major, minor));
+                       cuda_error(string_printf("CUDA device supported only compute capability 1.3 or up, found %d.%d.", major, minor));
                else
-                       cuda_error(string_printf("CUDA binary kernel for this graphics card shader model (%d.%d) not found.", major, minor));
+                       cuda_error(string_printf("CUDA binary kernel for this graphics card compute capability (%d.%d) not found.", major, minor));
                return "";
 #else
                /* if not, find CUDA compiler */
@@ -520,6 +520,12 @@ public:
                cuda_assert(cuParamSeti(cuPathTrace, offset, task.h))
                offset += sizeof(task.h);
 
+               cuda_assert(cuParamSeti(cuPathTrace, offset, task.offset))
+               offset += sizeof(task.offset);
+
+               cuda_assert(cuParamSeti(cuPathTrace, offset, task.stride))
+               offset += sizeof(task.stride);
+
                cuda_assert(cuParamSetSize(cuPathTrace, offset))
 
                /* launch kernel: todo find optimal size, cache config for fermi */
@@ -581,6 +587,12 @@ public:
                cuda_assert(cuParamSeti(cuFilmConvert, offset, task.h))
                offset += sizeof(task.h);
 
+               cuda_assert(cuParamSeti(cuFilmConvert, offset, task.offset))
+               offset += sizeof(task.offset);
+
+               cuda_assert(cuParamSeti(cuFilmConvert, offset, task.stride))
+               offset += sizeof(task.stride);
+
                cuda_assert(cuParamSetSize(cuFilmConvert, offset))
 
                /* launch kernel: todo find optimal size, cache config for fermi */
index 8eaaebc6629c30f8c6e4f44cd5fc481e572ae9c6..6014dd0fdb7bf9d98a5592490d20969cd1f913c8 100644 (file)
@@ -25,6 +25,7 @@
 #include "device.h"
 #include "device_intern.h"
 
+#include "util_foreach.h"
 #include "util_map.h"
 #include "util_math.h"
 #include "util_md5.h"
@@ -52,6 +53,7 @@ public:
        map<string, device_memory*> mem_map;
        device_ptr null_mem;
        bool device_initialized;
+       string platform_name;
 
        const char *opencl_error_string(cl_int err)
        {
@@ -175,6 +177,10 @@ public:
                if(opencl_error(ciErr))
                        return;
 
+               char name[256];
+               clGetPlatformInfo(cpPlatform, CL_PLATFORM_NAME, sizeof(name), &name, NULL);
+               platform_name = name;
+
                cxContext = clCreateContext(0, 1, &cdDevice, NULL, NULL, &ciErr);
                if(opencl_error(ciErr))
                        return;
@@ -277,14 +283,11 @@ public:
        {
                string build_options = " -cl-fast-relaxed-math ";
                
-               /* Full Shading only on NVIDIA cards at the moment */
-               char vendor[256];
-
-               clGetPlatformInfo(cpPlatform, CL_PLATFORM_NAME, sizeof(vendor), &vendor, NULL);
-               string name = vendor;
-               
-               if(name == "NVIDIA CUDA")
-                       build_options += "-D__KERNEL_SHADING__ -D__MULTI_CLOSURE__ ";
+               /* full shading only on NVIDIA cards at the moment */
+               if(platform_name == "NVIDIA CUDA")
+                       build_options += "-D__KERNEL_SHADING__ -D__MULTI_CLOSURE__ -cl-nv-maxrregcount=24 -cl-nv-verbose ";
+               if(platform_name == "Apple")
+                       build_options += " -D__CL_NO_FLOAT3__ ";
 
                return build_options;
        }
@@ -541,6 +544,8 @@ public:
                cl_int d_w = task.w;
                cl_int d_h = task.h;
                cl_int d_sample = task.sample;
+               cl_int d_offset = task.offset;
+               cl_int d_stride = task.stride;
 
                /* sample arguments */
                int narg = 0;
@@ -559,6 +564,8 @@ public:
                ciErr |= clSetKernelArg(ckPathTraceKernel, narg++, sizeof(d_y), (void*)&d_y);
                ciErr |= clSetKernelArg(ckPathTraceKernel, narg++, sizeof(d_w), (void*)&d_w);
                ciErr |= clSetKernelArg(ckPathTraceKernel, narg++, sizeof(d_h), (void*)&d_h);
+               ciErr |= clSetKernelArg(ckPathTraceKernel, narg++, sizeof(d_offset), (void*)&d_offset);
+               ciErr |= clSetKernelArg(ckPathTraceKernel, narg++, sizeof(d_stride), (void*)&d_stride);
 
                opencl_assert(ciErr);
 
@@ -611,6 +618,8 @@ public:
                cl_int d_h = task.h;
                cl_int d_sample = task.sample;
                cl_int d_resolution = task.resolution;
+               cl_int d_offset = task.offset;
+               cl_int d_stride = task.stride;
 
                /* sample arguments */
                int narg = 0;
@@ -630,6 +639,8 @@ public:
                ciErr |= clSetKernelArg(ckFilmConvertKernel, narg++, sizeof(d_y), (void*)&d_y);
                ciErr |= clSetKernelArg(ckFilmConvertKernel, narg++, sizeof(d_w), (void*)&d_w);
                ciErr |= clSetKernelArg(ckFilmConvertKernel, narg++, sizeof(d_h), (void*)&d_h);
+               ciErr |= clSetKernelArg(ckFilmConvertKernel, narg++, sizeof(d_offset), (void*)&d_offset);
+               ciErr |= clSetKernelArg(ckFilmConvertKernel, narg++, sizeof(d_stride), (void*)&d_stride);
 
                opencl_assert(ciErr);
 
@@ -649,12 +660,24 @@ public:
                opencl_assert(clFinish(cqCommandQueue));
        }
 
-       void task_add(DeviceTask& task)
+       void task_add(DeviceTask& maintask)
        {
-               if(task.type == DeviceTask::TONEMAP)
-                       tonemap(task);
-               else if(task.type == DeviceTask::PATH_TRACE)
-                       path_trace(task);
+               list<DeviceTask> tasks;
+
+               /* arbitrary limit to work around apple ATI opencl issue */
+               if(platform_name == "Apple")
+                       maintask.split_max_size(tasks, 76800);
+               else
+                       tasks.push_back(maintask);
+
+               DeviceTask task;
+
+               foreach(DeviceTask& task, tasks) {
+                       if(task.type == DeviceTask::TONEMAP)
+                               tonemap(task);
+                       else if(task.type == DeviceTask::PATH_TRACE)
+                               path_trace(task);
+               }
        }
 
        void task_wait()
index e17544bf7afbcd1b2b2adc80df9aa09de0fcb573..939a74660a1c807df9a5872b57fc19f5ea16d39d 100644 (file)
@@ -143,7 +143,7 @@ endif()
 #set(KERNEL_PREPROCESSED ${CMAKE_CURRENT_BINARY_DIR}/kernel_preprocessed.cl)
 #add_custom_command(
 #      OUTPUT ${KERNEL_PREPROCESSED}
-#      COMMAND gcc -x c++ -E ${CMAKE_CURRENT_SOURCE_DIR}/kernel.cl -I ${CMAKE_CURRENT_SOURCE_DIR}/../util/ -DCCL_NAMESPACE_BEGIN= -DCCL_NAMESPACE_END= -DWITH_OPENCL -o ${KERNEL_PREPROCESSED}
+#      COMMAND gcc -x c++ -E ${CMAKE_CURRENT_SOURCE_DIR}/kernel.cl -I ${CMAKE_CURRENT_SOURCE_DIR}/../util/ -DCCL_NAMESPACE_BEGIN= -DCCL_NAMESPACE_END= -o ${KERNEL_PREPROCESSED}
 #      DEPENDS ${SRC_KERNEL} ${SRC_UTIL_HEADERS})
 #add_custom_target(cycles_kernel_preprocess ALL DEPENDS ${KERNEL_PREPROCESSED})
 #delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${KERNEL_PREPROCESSED}" ${CYCLES_INSTALL_PATH}/kernel)
index c00bc3fe9579317130eaf0db0da164ba771864cf..90eb7a2513f2c34b30c48106bdb5a36498cb5dc8 100644 (file)
@@ -36,7 +36,7 @@ __kernel void kernel_ocl_path_trace(
 #include "kernel_textures.h"
 
        int sample,
-       int sx, int sy, int sw, int sh)
+       int sx, int sy, int sw, int sh, int offset, int stride)
 {
        KernelGlobals kglobals, *kg = &kglobals;
 
@@ -50,7 +50,7 @@ __kernel void kernel_ocl_path_trace(
        int y = sy + get_global_id(1);
 
        if(x < sx + sw && y < sy + sh)
-               kernel_path_trace(kg, buffer, rng_state, sample, x, y);
+               kernel_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
 }
 
 __kernel void kernel_ocl_tonemap(
@@ -63,7 +63,7 @@ __kernel void kernel_ocl_tonemap(
 #include "kernel_textures.h"
 
        int sample, int resolution,
-       int sx, int sy, int sw, int sh)
+       int sx, int sy, int sw, int sh, int offset, int stride)
 {
        KernelGlobals kglobals, *kg = &kglobals;
 
@@ -77,7 +77,7 @@ __kernel void kernel_ocl_tonemap(
        int y = sy + get_global_id(1);
 
        if(x < sx + sw && y < sy + sh)
-               kernel_film_tonemap(kg, rgba, buffer, sample, resolution, x, y);
+               kernel_film_tonemap(kg, rgba, buffer, sample, resolution, x, y, offset, stride);
 }
 
 /*__kernel void kernel_ocl_displace(__global uint4 *input, __global float3 *offset, int sx)
index 52a3852aa01793fb46f51b3871917e0ccadaf21c..b4c3839dbd09824bb96327236ee4efa741d0ffef 100644 (file)
@@ -204,16 +204,16 @@ void kernel_tex_copy(KernelGlobals *kg, const char *name, device_ptr mem, size_t
 
 /* Path Tracing */
 
-void kernel_cpu_path_trace(KernelGlobals *kg, float4 *buffer, unsigned int *rng_state, int sample, int x, int y)
+void kernel_cpu_path_trace(KernelGlobals *kg, float4 *buffer, unsigned int *rng_state, int sample, int x, int y, int offset, int stride)
 {
-       kernel_path_trace(kg, buffer, rng_state, sample, x, y);
+       kernel_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
 }
 
 /* Tonemapping */
 
-void kernel_cpu_tonemap(KernelGlobals *kg, uchar4 *rgba, float4 *buffer, int sample, int resolution, int x, int y)
+void kernel_cpu_tonemap(KernelGlobals *kg, uchar4 *rgba, float4 *buffer, int sample, int resolution, int x, int y, int offset, int stride)
 {
-       kernel_film_tonemap(kg, rgba, buffer, sample, resolution, x, y);
+       kernel_film_tonemap(kg, rgba, buffer, sample, resolution, x, y, offset, stride);
 }
 
 /* Displacement */
index 75415a00b000065111c6b61cac9e5c02ce5d5986..71fc7ac31971f9ea5c3d3bf4e1ef72efd674ac46 100644 (file)
 #include "kernel_path.h"
 #include "kernel_displace.h"
 
-extern "C" __global__ void kernel_cuda_path_trace(float4 *buffer, uint *rng_state, int sample, int sx, int sy, int sw, int sh)
+extern "C" __global__ void kernel_cuda_path_trace(float4 *buffer, uint *rng_state, int sample, int sx, int sy, int sw, int sh, int offset, int stride)
 {
        int x = sx + blockDim.x*blockIdx.x + threadIdx.x;
        int y = sy + blockDim.y*blockIdx.y + threadIdx.y;
 
        if(x < sx + sw && y < sy + sh)
-               kernel_path_trace(NULL, buffer, rng_state, sample, x, y);
+               kernel_path_trace(NULL, buffer, rng_state, sample, x, y, offset, stride);
 }
 
-extern "C" __global__ void kernel_cuda_tonemap(uchar4 *rgba, float4 *buffer, int sample, int resolution, int sx, int sy, int sw, int sh)
+extern "C" __global__ void kernel_cuda_tonemap(uchar4 *rgba, float4 *buffer, int sample, int resolution, int sx, int sy, int sw, int sh, int offset, int stride)
 {
        int x = sx + blockDim.x*blockIdx.x + threadIdx.x;
        int y = sy + blockDim.y*blockIdx.y + threadIdx.y;
 
        if(x < sx + sw && y < sy + sh)
-               kernel_film_tonemap(NULL, rgba, buffer, sample, resolution, x, y);
+               kernel_film_tonemap(NULL, rgba, buffer, sample, resolution, x, y, offset, stride);
 }
 
 extern "C" __global__ void kernel_cuda_displace(uint4 *input, float3 *offset, int sx)
index 700ee49c5f2f98cc33dccf3683dd00a57bf4c585..78247504b39b36b791e3edbf88417a907ca8ce11 100644 (file)
@@ -36,13 +36,17 @@ bool kernel_osl_use(KernelGlobals *kg);
 void kernel_const_copy(KernelGlobals *kg, const char *name, void *host, size_t size);
 void kernel_tex_copy(KernelGlobals *kg, const char *name, device_ptr mem, size_t width, size_t height);
 
-void kernel_cpu_path_trace(KernelGlobals *kg, float4 *buffer, unsigned int *rng_state, int sample, int x, int y);
-void kernel_cpu_tonemap(KernelGlobals *kg, uchar4 *rgba, float4 *buffer, int sample, int resolution, int x, int y);
+void kernel_cpu_path_trace(KernelGlobals *kg, float4 *buffer, unsigned int *rng_state,
+       int sample, int x, int y, int offset, int stride);
+void kernel_cpu_tonemap(KernelGlobals *kg, uchar4 *rgba, float4 *buffer,
+       int sample, int resolution, int x, int y, int offset, int stride);
 void kernel_cpu_displace(KernelGlobals *kg, uint4 *input, float3 *offset, int i);
 
 #ifdef WITH_OPTIMIZED_KERNEL
-void kernel_cpu_optimized_path_trace(KernelGlobals *kg, float4 *buffer, unsigned int *rng_state, int sample, int x, int y);
-void kernel_cpu_optimized_tonemap(KernelGlobals *kg, uchar4 *rgba, float4 *buffer, int sample, int resolution, int x, int y);
+void kernel_cpu_optimized_path_trace(KernelGlobals *kg, float4 *buffer, unsigned int *rng_state,
+       int sample, int x, int y, int offset, int stride);
+void kernel_cpu_optimized_tonemap(KernelGlobals *kg, uchar4 *rgba, float4 *buffer,
+       int sample, int resolution, int x, int y, int offset, int stride);
 void kernel_cpu_optimized_displace(KernelGlobals *kg, uint4 *input, float3 *offset, int i);
 #endif
 
index 9cdc2f1f8659f56cb6396175b531fafcca99847c..2dbdd07689190cea7262e065f6169369497a3580 100644 (file)
@@ -74,8 +74,8 @@ __device void camera_sample_perspective(KernelGlobals *kg, float raster_x, float
        ray->dP.dx = make_float3(0.0f, 0.0f, 0.0f);
        ray->dP.dy = make_float3(0.0f, 0.0f, 0.0f);
 
-       ray->dD.dx = normalize(Ddiff + kernel_data.cam.dx) - normalize(Ddiff);
-       ray->dD.dy = normalize(Ddiff + kernel_data.cam.dy) - normalize(Ddiff);
+       ray->dD.dx = normalize(Ddiff + float4_to_float3(kernel_data.cam.dx)) - normalize(Ddiff);
+       ray->dD.dy = normalize(Ddiff + float4_to_float3(kernel_data.cam.dy)) - normalize(Ddiff);
 #endif
 
 #ifdef __CAMERA_CLIPPING__
@@ -107,8 +107,8 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa
 
 #ifdef __RAY_DIFFERENTIALS__
        /* ray differential */
-       ray->dP.dx = kernel_data.cam.dx;
-       ray->dP.dy = kernel_data.cam.dy;
+       ray->dP.dx = float4_to_float3(kernel_data.cam.dx);
+       ray->dP.dy = float4_to_float3(kernel_data.cam.dy);
 
        ray->dD.dx = make_float3(0.0f, 0.0f, 0.0f);
        ray->dD.dy = make_float3(0.0f, 0.0f, 0.0f);
index 5515966807b399059a7a7f9b13efb54ac7d6479f..9fbd8566ecda2ae82c8282d11c06c56e8d76937c 100644 (file)
 /* no namespaces in opencl */
 #define CCL_NAMESPACE_BEGIN
 #define CCL_NAMESPACE_END
-#define WITH_OPENCL
+
+#ifdef __CL_NO_FLOAT3__
+#define float3 float4
+#endif
+
+#ifdef __CL_NOINLINE__
+#define __noinline __attribute__((noinline))
+#else
+#define __noinline
+#endif
 
 /* in opencl all functions are device functions, so leave this empty */
 #define __device
-#define __device_inline
-#define __device_noinline
+#define __device_inline __device
+#define __device_noinline  __device __noinline
 
 /* no assert in opencl */
 #define kernel_assert(cond)
@@ -68,7 +77,11 @@ __device float kernel_tex_interp_(__global float *data, int width, float x)
 #endif
 
 #define make_float2(x, y) ((float2)(x, y))
+#ifdef __CL_NO_FLOAT3__
+#define make_float3(x, y, z) ((float4)(x, y, z, 0.0))
+#else
 #define make_float3(x, y, z) ((float3)(x, y, z))
+#endif
 #define make_float4(x, y, z, w) ((float4)(x, y, z, w))
 #define make_int2(x, y) ((int2)(x, y))
 #define make_int3(x, y, z) ((int3)(x, y, z))
index 4373701452ee080a4e85f666f526c9af8880b848..cd8acc9647abf76b5ef38b0586940b82b66f876a 100644 (file)
@@ -48,10 +48,9 @@ __device uchar4 film_float_to_byte(float4 color)
        return result;
 }
 
-__device void kernel_film_tonemap(KernelGlobals *kg, __global uchar4 *rgba, __global float4 *buffer, int sample, int resolution, int x, int y)
+__device void kernel_film_tonemap(KernelGlobals *kg, __global uchar4 *rgba, __global float4 *buffer, int sample, int resolution, int x, int y, int offset, int stride)
 {
-       int w = kernel_data.cam.width;
-       int index = x + y*w;
+       int index = offset + x + y*stride;
        float4 irradiance = buffer[index];
 
        float4 float_result = film_map(kg, irradiance, sample);
index 85a2b798a628cc4beb7d162286bce3508eea4540..ea43e01ab58a65e9893c8920028b34ecbdb37f64 100644 (file)
@@ -35,16 +35,16 @@ CCL_NAMESPACE_BEGIN
 
 /* Path Tracing */
 
-void kernel_cpu_optimized_path_trace(KernelGlobals *kg, float4 *buffer, unsigned int *rng_state, int sample, int x, int y)
+void kernel_cpu_optimized_path_trace(KernelGlobals *kg, float4 *buffer, unsigned int *rng_state, int sample, int x, int y, int offset, int stride)
 {
-       kernel_path_trace(kg, buffer, rng_state, sample, x, y);
+       kernel_path_trace(kg, buffer, rng_state, sample, x, y, offset, stride);
 }
 
 /* Tonemapping */
 
-void kernel_cpu_optimized_tonemap(KernelGlobals *kg, uchar4 *rgba, float4 *buffer, int sample, int resolution, int x, int y)
+void kernel_cpu_optimized_tonemap(KernelGlobals *kg, uchar4 *rgba, float4 *buffer, int sample, int resolution, int x, int y, int offset, int stride)
 {
-       kernel_film_tonemap(kg, rgba, buffer, sample, resolution, x, y);
+       kernel_film_tonemap(kg, rgba, buffer, sample, resolution, x, y, offset, stride);
 }
 
 /* Displacement */
index c609f6f13fe3722b13beebeb1f631243f3b83747..d27ad861c6add93c300574dfaeaa925eaddc6e2a 100644 (file)
@@ -34,7 +34,7 @@
 CCL_NAMESPACE_BEGIN
 
 #ifdef __MODIFY_TP__
-__device float3 path_terminate_modified_throughput(KernelGlobals *kg, __global float3 *buffer, int x, int y, int sample)
+__device float3 path_terminate_modified_throughput(KernelGlobals *kg, __global float3 *buffer, int x, int y, int offset, int stride, int sample)
 {
        /* modify throughput to influence path termination probability, to avoid
           darker regions receiving fewer samples than lighter regions. also RGB
@@ -45,7 +45,7 @@ __device float3 path_terminate_modified_throughput(KernelGlobals *kg, __global f
        const float minL = 0.1f;
 
        if(sample >= minsample) {
-               float3 L = buffer[x + y*kernel_data.cam.width];
+               float3 L = buffer[offset + x + y*stride];
                float3 Lmin = make_float3(minL, minL, minL);
                float correct = (float)(sample+1)/(float)sample;
 
@@ -130,13 +130,16 @@ __device_inline void path_state_next(KernelGlobals *kg, PathState *state, int la
        }
 }
 
-__device_inline uint path_state_ray_visibility(PathState *state)
+__device_inline uint path_state_ray_visibility(KernelGlobals *kg, PathState *state)
 {
        uint flag = state->flag;
 
        /* for visibility, diffuse/glossy are for reflection only */
        if(flag & PATH_RAY_TRANSMIT)
                flag &= ~(PATH_RAY_DIFFUSE|PATH_RAY_GLOSSY);
+       /* for camera visibility, use render layer flags */
+       if(flag & PATH_RAY_CAMERA)
+               flag |= kernel_data.integrator.layer_flag;
 
        return flag;
 }
@@ -249,7 +252,7 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R
        for(;; rng_offset += PRNG_BOUNCE_NUM) {
                /* intersect scene */
                Intersection isect;
-               uint visibility = path_state_ray_visibility(&state);
+               uint visibility = path_state_ray_visibility(kg, &state);
 
                if(!scene_intersect(kg, &ray, visibility, &isect)) {
                        /* eval background shader if nothing hit */
@@ -379,7 +382,7 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R
        return make_float4(L.x, L.y, L.z, 1.0f - Ltransparent);
 }
 
-__device void kernel_path_trace(KernelGlobals *kg, __global float4 *buffer, __global uint *rng_state, int sample, int x, int y)
+__device void kernel_path_trace(KernelGlobals *kg, __global float4 *buffer, __global uint *rng_state, int sample, int x, int y, int offset, int stride)
 {
        /* initialize random numbers */
        RNG rng;
@@ -387,7 +390,7 @@ __device void kernel_path_trace(KernelGlobals *kg, __global float4 *buffer, __gl
        float filter_u;
        float filter_v;
 
-       path_rng_init(kg, rng_state, sample, &rng, x, y, &filter_u, &filter_v);
+       path_rng_init(kg, rng_state, sample, &rng, x, y, offset, stride, &filter_u, &filter_v);
 
        /* sample camera ray */
        Ray ray;
@@ -399,7 +402,7 @@ __device void kernel_path_trace(KernelGlobals *kg, __global float4 *buffer, __gl
 
        /* integrate */
 #ifdef __MODIFY_TP__
-       float3 throughput = path_terminate_modified_throughput(kg, buffer, x, y, sample);
+       float3 throughput = path_terminate_modified_throughput(kg, buffer, x, y, offset, stride, sample);
        float4 L = kernel_path_integrate(kg, &rng, sample, ray, throughput)/throughput;
 #else
        float3 throughput = make_float3(1.0f, 1.0f, 1.0f);
@@ -407,14 +410,14 @@ __device void kernel_path_trace(KernelGlobals *kg, __global float4 *buffer, __gl
 #endif
 
        /* accumulate result in output buffer */
-       int index = x + y*kernel_data.cam.width;
+       int index = offset + x + y*stride;
 
        if(sample == 0)
                buffer[index] = L;
        else
                buffer[index] += L;
 
-       path_rng_end(kg, rng_state, rng, x, y);
+       path_rng_end(kg, rng_state, rng, x, y, offset, stride);
 }
 
 CCL_NAMESPACE_END
index ba97ab3e3b65a8b50382c4b8ffaeacc6fc8b9a02..41301ebd3dcee79ad4238005cad39a5616c48537 100644 (file)
@@ -123,7 +123,7 @@ __device_inline float path_rng(KernelGlobals *kg, RNG *rng, int sample, int dime
 #endif
 }
 
-__device_inline void path_rng_init(KernelGlobals *kg, __global uint *rng_state, int sample, RNG *rng, int x, int y, float *fx, float *fy)
+__device_inline void path_rng_init(KernelGlobals *kg, __global uint *rng_state, int sample, RNG *rng, int x, int y, int offset, int stride, float *fx, float *fy)
 {
 #ifdef __SOBOL_FULL_SCREEN__
        uint px, py;
@@ -138,7 +138,7 @@ __device_inline void path_rng_init(KernelGlobals *kg, __global uint *rng_state,
        *fx = size * (float)px * (1.0f/(float)0xFFFFFFFF) - x;
        *fy = size * (float)py * (1.0f/(float)0xFFFFFFFF) - y;
 #else
-       *rng = rng_state[x + y*kernel_data.cam.width];
+       *rng = rng_state[offset + x + y*stride];
 
        *rng ^= kernel_data.integrator.seed;
 
@@ -147,7 +147,7 @@ __device_inline void path_rng_init(KernelGlobals *kg, __global uint *rng_state,
 #endif
 }
 
-__device void path_rng_end(KernelGlobals *kg, __global uint *rng_state, RNG rng, int x, int y)
+__device void path_rng_end(KernelGlobals *kg, __global uint *rng_state, RNG rng, int x, int y, int offset, int stride)
 {
        /* nothing to do */
 }
@@ -163,10 +163,10 @@ __device float path_rng(KernelGlobals *kg, RNG *rng, int sample, int dimension)
        return (float)*rng * (1.0f/(float)0xFFFFFFFF);
 }
 
-__device void path_rng_init(KernelGlobals *kg, __global uint *rng_state, int sample, RNG *rng, int x, int y, float *fx, float *fy)
+__device void path_rng_init(KernelGlobals *kg, __global uint *rng_state, int sample, RNG *rng, int x, int y, int offset, int stride, float *fx, float *fy)
 {
        /* load state */
-       *rng = rng_state[x + y*kernel_data.cam.width];
+       *rng = rng_state[offset + x + y*stride];
 
        *rng ^= kernel_data.integrator.seed;
 
@@ -174,10 +174,10 @@ __device void path_rng_init(KernelGlobals *kg, __global uint *rng_state, int sam
        *fy = path_rng(kg, rng, sample, PRNG_FILTER_V);
 }
 
-__device void path_rng_end(KernelGlobals *kg, __global uint *rng_state, RNG rng, int x, int y)
+__device void path_rng_end(KernelGlobals *kg, __global uint *rng_state, RNG rng, int x, int y, int offset, int stride)
 {
        /* store state for next sample */
-       rng_state[x + y*kernel_data.cam.width] = rng;
+       rng_state[offset + x + y*stride] = rng;
 }
 
 #endif
index d9bd645b16d35320f5b0841be4d29e6e3be7497f..56db4d2b78a46c5e5c7aded2472965a31b31291e 100644 (file)
@@ -100,7 +100,10 @@ enum PathTraceDimension {
 
 /* these flag values correspond exactly to OSL defaults, so be careful not to
  * change this, or if you do, set the "raytypes" shading system attribute with
- * your own new ray types and bitflag values */
+ * your own new ray types and bitflag values.
+ *
+ * for ray visibility tests in BVH traversal, the upper 20 bits are used for
+ * layer visibility tests. */
 
 enum PathRayFlag {
        PATH_RAY_CAMERA = 1,
@@ -117,7 +120,9 @@ enum PathRayFlag {
 
        PATH_RAY_MIS_SKIP = 512,
 
-       PATH_RAY_ALL = (1|2|4|8|16|32|64|128|256|512)
+       PATH_RAY_ALL = (1|2|4|8|16|32|64|128|256|512),
+
+       PATH_RAY_LAYER_SHIFT = (32-20)
 };
 
 /* Closure Label */
@@ -295,29 +300,24 @@ typedef struct ShaderData {
 #endif
 } ShaderData;
 
-/* Constrant Kernel Data */
+/* Constrant Kernel Data
+ *
+ * These structs are passed from CPU to various devices, and the struct layout
+ * must match exactly. Structs are padded to ensure 16 byte alignment, and we
+ * do not use float3 because its size may not be the same on all devices. */
 
 typedef struct KernelCamera {
        /* type */
        int ortho;
-       int pad;
-
-       /* size */
-       int width, height;
+       int pad1, pad2, pad3;
 
        /* matrices */
        Transform cameratoworld;
        Transform rastertocamera;
 
        /* differentials */
-       float3 dx;
-#ifndef WITH_OPENCL
-       float pad1;
-#endif
-       float3 dy;
-#ifndef WITH_OPENCL
-       float pad2;
-#endif
+       float4 dx;
+       float4 dy;
 
        /* depth of field */
        float aperturesize;
@@ -358,10 +358,6 @@ typedef struct KernelBackground {
 typedef struct KernelSunSky {
        /* sun direction in spherical and cartesian */
        float theta, phi, pad3, pad4;
-       float3 dir;
-#ifndef WITH_OPENCL
-       float pad;
-#endif
 
        /* perez function parameters */
        float zenith_Y, zenith_x, zenith_y, pad2;
@@ -392,10 +388,12 @@ typedef struct KernelIntegrator {
 
        /* caustics */
        int no_caustics;
-       float blur_caustics;
 
        /* seed */
        int seed;
+
+       /* render layer */
+       int layer_flag;
 } KernelIntegrator;
 
 typedef struct KernelBVH {
index acdddb475d0dbab492d162d9c1a07f2520a2302b..29141b25b59f5d70117089201b8eafdf797772d7 100644 (file)
@@ -36,8 +36,6 @@ CCL_NAMESPACE_BEGIN
 RenderBuffers::RenderBuffers(Device *device_)
 {
        device = device_;
-       width = 0;
-       height = 0;
 }
 
 RenderBuffers::~RenderBuffers()
@@ -58,24 +56,23 @@ void RenderBuffers::device_free()
        }
 }
 
-void RenderBuffers::reset(Device *device, int width_, int height_)
+void RenderBuffers::reset(Device *device, BufferParams& params_)
 {
-       width = width_;
-       height = height_;
+       params = params_;
 
        /* free existing buffers */
        device_free();
        
        /* allocate buffer */
-       buffer.resize(width, height);
+       buffer.resize(params.width, params.height);
        device->mem_alloc(buffer, MEM_READ_WRITE);
        device->mem_zero(buffer);
 
        /* allocate rng state */
-       rng_state.resize(width, height);
+       rng_state.resize(params.width, params.height);
 
-       uint *init_state = rng_state.resize(width, height);
-       int x, y;
+       uint *init_state = rng_state.resize(params.width, params.height);
+       int x, y, width = params.width, height = params.height;
        
        for(x=0; x<width; x++)
                for(y=0; y<height; y++)
@@ -92,11 +89,11 @@ float4 *RenderBuffers::copy_from_device(float exposure, int sample)
 
        device->mem_copy_from(buffer, 0, buffer.memory_size());
 
-       float4 *out = new float4[width*height];
+       float4 *out = new float4[params.width*params.height];
        float4 *in = (float4*)buffer.data_pointer;
        float scale = 1.0f/(float)sample;
        
-       for(int i = width*height - 1; i >= 0; i--) {
+       for(int i = params.width*params.height - 1; i >= 0; i--) {
                float4 rgba = in[i]*scale;
 
                rgba.x = rgba.x*exposure;
@@ -117,8 +114,6 @@ float4 *RenderBuffers::copy_from_device(float exposure, int sample)
 DisplayBuffer::DisplayBuffer(Device *device_)
 {
        device = device_;
-       width = 0;
-       height = 0;
        draw_width = 0;
        draw_height = 0;
        transparent = true; /* todo: determine from background */
@@ -137,28 +132,27 @@ void DisplayBuffer::device_free()
        }
 }
 
-void DisplayBuffer::reset(Device *device, int width_, int height_)
+void DisplayBuffer::reset(Device *device, BufferParams& params_)
 {
        draw_width = 0;
        draw_height = 0;
 
-       width = width_;
-       height = height_;
+       params = params_;
 
        /* free existing buffers */
        device_free();
 
        /* allocate display pixels */
-       rgba.resize(width, height);
+       rgba.resize(params.width, params.height);
        device->pixels_alloc(rgba);
 }
 
-void DisplayBuffer::draw_set(int width_, int height_)
+void DisplayBuffer::draw_set(int width, int height)
 {
-       assert(width_ <= width && height_ <= height);
+       assert(width <= params.width && height <= params.height);
 
-       draw_width = width_;
-       draw_height = height_;
+       draw_width = width;
+       draw_height = height;
 }
 
 void DisplayBuffer::draw_transparency_grid()
@@ -175,11 +169,11 @@ void DisplayBuffer::draw_transparency_grid()
        };
 
        glColor4ub(50, 50, 50, 255);
-       glRectf(0, 0, width, height);
+       glRectf(0, 0, params.width, params.height);
        glEnable(GL_POLYGON_STIPPLE);
        glColor4ub(55, 55, 55, 255);
        glPolygonStipple(checker_stipple_sml);
-       glRectf(0, 0, width, height);
+       glRectf(0, 0, params.width, params.height);
        glDisable(GL_POLYGON_STIPPLE);
 }
 
@@ -189,7 +183,7 @@ void DisplayBuffer::draw(Device *device)
                if(transparent)
                        draw_transparency_grid();
 
-               device->draw_pixels(rgba, 0, draw_width, draw_height, width, height, transparent);
+               device->draw_pixels(rgba, 0, draw_width, draw_height, params.width, params.height, transparent);
        }
 }
 
index d5eb8d7fa2feb92419d888463bc6acd488f614db..f4a9b37c09ba4f1133bb1604fce79b657470c4ba 100644 (file)
@@ -30,12 +30,55 @@ CCL_NAMESPACE_BEGIN
 class Device;
 struct float4;
 
+/* Buffer Parameters
+   Size of render buffer and how it fits in the full image (border render). */
+
+class BufferParams {
+public:
+       /* width/height of the physical buffer */
+       int width;
+       int height;
+
+       /* offset into and width/height of the full buffer */
+       int full_x;
+       int full_y;
+       int full_width;
+       int full_height;
+
+       BufferParams()
+       {
+               width = 0;
+               height = 0;
+
+               full_x = 0;
+               full_y = 0;
+               full_width = 0;
+               full_height = 0;
+       }
+
+       void get_offset_stride(int& offset, int& stride)
+       {
+               offset = -(full_x + full_y*width);
+               stride = width;
+       }
+
+       bool modified(const BufferParams& params)
+       {
+               return !(full_x == params.full_x
+                       && full_y == params.full_y
+                       && width == params.width
+                       && height == params.height
+                       && full_width == params.full_width
+                       && full_height == params.full_height);
+       }
+};
+
 /* Render Buffers */
 
 class RenderBuffers {
 public:
-       /* buffer dimensions */
-       int width, height;
+       /* buffer parameters */
+       BufferParams params;
        /* float buffer */
        device_vector<float4> buffer;
        /* random number generator state */
@@ -46,7 +89,7 @@ public:
        RenderBuffers(Device *device);
        ~RenderBuffers();
 
-       void reset(Device *device, int width, int height);
+       void reset(Device *device, BufferParams& params);
        float4 *copy_from_device(float exposure, int sample);
 
 protected:
@@ -62,8 +105,8 @@ protected:
 
 class DisplayBuffer {
 public:
-       /* buffer dimensions */
-       int width, height;
+       /* buffer parameters */
+       BufferParams params;
        /* dimensions for how much of the buffer is actually ready for display.
           with progressive render we can be using only a subset of the buffer.
           if these are zero, it means nothing can be drawn yet */
@@ -78,7 +121,7 @@ public:
        DisplayBuffer(Device *device);
        ~DisplayBuffer();
 
-       void reset(Device *device, int width, int height);
+       void reset(Device *device, BufferParams& params);
        void write(Device *device, const string& filename);
 
        void draw_set(int width, int height);
index e88c0a388bc05e65b17d3bdcebee0313478ffb01..a83ae81844cbcb805cc734a0c289897671e13080 100644 (file)
@@ -72,8 +72,9 @@ void Camera::update()
        if(!need_update)
                return;
        
+       /* ndc to raster */
        Transform screentocamera;
-       Transform ndctoraster = transform_scale((float)width, (float)height, 1.0f);
+       Transform ndctoraster = transform_scale(width, height, 1.0f);
 
        /* raster to screen */
        Transform screentoraster = ndctoraster *
@@ -148,13 +149,9 @@ void Camera::device_update(Device *device, DeviceScene *dscene)
        /* type */
        kcam->ortho = ortho;
 
-       /* size */
-       kcam->width = width;
-       kcam->height = height;
-
        /* store differentials */
-       kcam->dx = dx;
-       kcam->dy = dy;
+       kcam->dx = float3_to_float4(dx);
+       kcam->dy = float3_to_float4(dy);
 
        /* clipping */
        kcam->nearclip = nearclip;
index cdded403cbe0d72bd5db91d10e04c1fd78220c1c..cc29047f0487cad59dd33afe311e0cea216383bb 100644 (file)
@@ -292,6 +292,42 @@ void ShaderGraph::copy_nodes(set<ShaderNode*>& nodes, map<ShaderNode*, ShaderNod
        }
 }
 
+void ShaderGraph::remove_proxy_nodes(vector<bool>& removed)
+{
+       foreach(ShaderNode *node, nodes) {
+               ProxyNode *proxy = dynamic_cast<ProxyNode*>(node);
+               if (proxy) {
+                       ShaderInput *input = proxy->inputs[0];
+                       ShaderOutput *output = proxy->outputs[0];
+                       
+                       /* temp. copy of the output links list.
+                        * output->links is modified when we disconnect!
+                        */
+                       vector<ShaderInput*> links(output->links);
+                       ShaderOutput *from = input->link;
+                       
+                       /* bypass the proxy node */
+                       if (from) {
+                               disconnect(input);
+                               foreach(ShaderInput *to, links) {
+                                       disconnect(to);
+                                       connect(from, to);
+                               }
+                       }
+                       else {
+                               foreach(ShaderInput *to, links) {
+                                       disconnect(to);
+                                       
+                                       /* transfer the default input value to the target socket */
+                                       to->set(input->value);
+                               }
+                       }
+                       
+                       removed[proxy->id] = true;
+               }
+       }
+}
+
 void ShaderGraph::break_cycles(ShaderNode *node, vector<bool>& visited, vector<bool>& on_stack)
 {
        visited[node->id] = true;
@@ -322,15 +358,28 @@ void ShaderGraph::clean()
           nodes that don't feed into the output. how cycles are broken is
           undefined, they are invalid input, the important thing is to not crash */
 
+       vector<bool> removed(nodes.size(), false);
        vector<bool> visited(nodes.size(), false);
        vector<bool> on_stack(nodes.size(), false);
+       
+       list<ShaderNode*> newnodes;
+       
+       /* remove proxy nodes */
+       remove_proxy_nodes(removed);
+       
+       foreach(ShaderNode *node, nodes) {
+               if(!removed[node->id])
+                       newnodes.push_back(node);
+               else
+                       delete node;
+       }
+       nodes = newnodes;
+       newnodes.clear();
 
        /* break cycles */
        break_cycles(output(), visited, on_stack);
 
        /* remove unused nodes */
-       list<ShaderNode*> newnodes;
-       
        foreach(ShaderNode *node, nodes) {
                if(visited[node->id])
                        newnodes.push_back(node);
index 2a2df5e1377c5e8c1b43d64f0c4456d6905ee1fe..91ec83aba210728b0a553656d572c95553516092 100644 (file)
@@ -217,6 +217,7 @@ protected:
        void find_dependencies(set<ShaderNode*>& dependencies, ShaderInput *input);
        void copy_nodes(set<ShaderNode*>& nodes, map<ShaderNode*, ShaderNode*>& nnodemap);
 
+       void remove_proxy_nodes(vector<bool>& removed);
        void break_cycles(ShaderNode *node, vector<bool>& visited, vector<bool>& on_stack);
        void clean();
        void bump_from_displacement();
index 9d129d8e8db07f1c48076845fbe7fa8f5b73e12e..47059a0a009207f8e326e3290ebc4b1492532956 100644 (file)
@@ -41,9 +41,8 @@ Integrator::Integrator()
        transparent_shadows = false;
 
        no_caustics = false;
-       blur_caustics = 0.0f;
-
        seed = 0;
+       layer_flag = ~0;
 
        need_update = true;
 }
@@ -81,9 +80,8 @@ void Integrator::device_update(Device *device, DeviceScene *dscene)
        kintegrator->transparent_shadows = transparent_shadows;
 
        kintegrator->no_caustics = no_caustics;
-       kintegrator->blur_caustics = blur_caustics;
-
        kintegrator->seed = hash_int(seed);
+       kintegrator->layer_flag = layer_flag << PATH_RAY_LAYER_SHIFT;
 
        /* sobol directions table */
        int dimensions = PRNG_BASE_NUM + (max_bounce + transparent_max_bounce + 2)*PRNG_BOUNCE_NUM;
@@ -115,7 +113,7 @@ bool Integrator::modified(const Integrator& integrator)
                transparent_probalistic == integrator.transparent_probalistic &&
                transparent_shadows == integrator.transparent_shadows &&
                no_caustics == integrator.no_caustics &&
-               blur_caustics == integrator.blur_caustics &&
+               layer_flag == integrator.layer_flag &&
                seed == integrator.seed);
 }
 
index 52032fa1a261714c582ca17ab796942ac10ea2ec..e610d670142fda087a154c2589226d13e602cd5e 100644 (file)
@@ -41,9 +41,9 @@ public:
        bool transparent_shadows;
 
        bool no_caustics;
-       float blur_caustics;
 
        int seed;
+       int layer_flag;
 
        bool need_update;
 
index 5cabb2487095400dc3dc0c7688939b08703de432..81d156a079dad1f8eb4e08cde493921f4a0264d5 100644 (file)
@@ -273,7 +273,6 @@ static void sky_texture_precompute(KernelSunSky *ksunsky, float3 dir, float turb
 
        ksunsky->theta = theta;
        ksunsky->phi = phi;
-       ksunsky->dir = dir;
 
        float theta2 = theta*theta;
        float theta3 = theta*theta*theta;
@@ -869,6 +868,26 @@ void ConvertNode::compile(OSLCompiler& compiler)
                assert(0);
 }
 
+/* Proxy */
+
+ProxyNode::ProxyNode(ShaderSocketType from_, ShaderSocketType to_)
+: ShaderNode("proxy")
+{
+       from = from_;
+       to = to_;
+
+       add_input("Input", from);
+       add_output("Output", to);
+}
+
+void ProxyNode::compile(SVMCompiler& compiler)
+{
+}
+
+void ProxyNode::compile(OSLCompiler& compiler)
+{
+}
+
 /* BSDF Closure */
 
 BsdfNode::BsdfNode()
index 28fff22fc342e2dc7c8ccf17bb494192d54fa8aa..f0a669f3f8761f74f44abeb90ddf963dbde35e63 100644 (file)
@@ -158,6 +158,14 @@ public:
        ShaderSocketType from, to;
 };
 
+class ProxyNode : public ShaderNode {
+public:
+       ProxyNode(ShaderSocketType from, ShaderSocketType to);
+       SHADER_NODE_BASE_CLASS(ProxyNode)
+
+       ShaderSocketType from, to;
+};
+
 class BsdfNode : public ShaderNode {
 public:
        SHADER_NODE_CLASS(BsdfNode)
index 42b4a2bb7e480de4ec35928aebc579f94dac46f2..be2e493dc7f405860d59c94b3a8a8620e2a2e4c4 100644 (file)
@@ -51,8 +51,6 @@ Session::Session(const SessionParams& params_)
        sample = 0;
 
        delayed_reset.do_reset = false;
-       delayed_reset.w = 0;
-       delayed_reset.h = 0;
        delayed_reset.samples = 0;
 
        display_outdated = false;
@@ -108,7 +106,7 @@ bool Session::ready_to_reset()
 
 /* GPU Session */
 
-void Session::reset_gpu(int w, int h, int samples)
+void Session::reset_gpu(BufferParams& buffer_params, int samples)
 {
        /* block for buffer acces and reset immediately. we can't do this
           in the thread, because we need to allocate an OpenGL buffer, and
@@ -119,7 +117,7 @@ void Session::reset_gpu(int w, int h, int samples)
        display_outdated = true;
        reset_time = time_dt();
 
-       reset_(w, h, samples);
+       reset_(buffer_params, samples);
 
        gpu_need_tonemap = false;
        gpu_need_tonemap_cond.notify_all();
@@ -127,7 +125,7 @@ void Session::reset_gpu(int w, int h, int samples)
        pause_cond.notify_all();
 }
 
-bool Session::draw_gpu(int w, int h)
+bool Session::draw_gpu(BufferParams& buffer_params)
 {
        /* block for buffer access */
        thread_scoped_lock display_lock(display->mutex);
@@ -136,7 +134,7 @@ bool Session::draw_gpu(int w, int h)
        if(gpu_draw_ready) {
                /* then verify the buffers have the expected size, so we don't
                   draw previous results in a resized window */
-               if(w == display->width && h == display->height) {
+               if(!buffer_params.modified(display->params)) {
                        /* for CUDA we need to do tonemapping still, since we can
                           only access GL buffers from the main thread */
                        if(gpu_need_tonemap) {
@@ -261,15 +259,14 @@ void Session::run_gpu()
 
 /* CPU Session */
 
-void Session::reset_cpu(int w, int h, int samples)
+void Session::reset_cpu(BufferParams& buffer_params, int samples)
 {
        thread_scoped_lock reset_lock(delayed_reset.mutex);
 
        display_outdated = true;
        reset_time = time_dt();
 
-       delayed_reset.w = w;
-       delayed_reset.h = h;
+       delayed_reset.params = buffer_params;
        delayed_reset.samples = samples;
        delayed_reset.do_reset = true;
        device->task_cancel();
@@ -277,7 +274,7 @@ void Session::reset_cpu(int w, int h, int samples)
        pause_cond.notify_all();
 }
 
-bool Session::draw_cpu(int w, int h)
+bool Session::draw_cpu(BufferParams& buffer_params)
 {
        thread_scoped_lock display_lock(display->mutex);
 
@@ -285,7 +282,7 @@ bool Session::draw_cpu(int w, int h)
        if(display->draw_ready()) {
                /* then verify the buffers have the expected size, so we don't
                   draw previous results in a resized window */
-               if(w == display->width && h == display->height) {
+               if(!buffer_params.modified(display->params)) {
                        display->draw(device);
 
                        if(display_outdated && (time_dt() - reset_time) > params.text_timeout)
@@ -306,7 +303,7 @@ void Session::run_cpu()
                thread_scoped_lock buffers_lock(buffers->mutex);
                thread_scoped_lock display_lock(display->mutex);
 
-               reset_(delayed_reset.w, delayed_reset.h, delayed_reset.samples);
+               reset_(delayed_reset.params, delayed_reset.samples);
                delayed_reset.do_reset = false;
        }
 
@@ -389,7 +386,7 @@ void Session::run_cpu()
                        if(delayed_reset.do_reset) {
                                /* reset rendering if request from main thread */
                                delayed_reset.do_reset = false;
-                               reset_(delayed_reset.w, delayed_reset.h, delayed_reset.samples);
+                               reset_(delayed_reset.params, delayed_reset.samples);
                        }
                        else if(need_tonemap) {
                                /* tonemap only if we do not reset, we don't we don't
@@ -438,23 +435,23 @@ void Session::run()
                progress.set_update();
 }
 
-bool Session::draw(int w, int h)
+bool Session::draw(BufferParams& buffer_params)
 {
        if(device_use_gl)
-               return draw_gpu(w, h);
+               return draw_gpu(buffer_params);
        else
-               return draw_cpu(w, h);
+               return draw_cpu(buffer_params);
 }
 
-void Session::reset_(int w, int h, int samples)
+void Session::reset_(BufferParams& buffer_params, int samples)
 {
-       if(w != buffers->width || h != buffers->height) {
+       if(buffer_params.modified(buffers->params)) {
                gpu_draw_ready = false;
-               buffers->reset(device, w, h);
-               display->reset(device, w, h);
+               buffers->reset(device, buffer_params);
+               display->reset(device, buffer_params);
        }
 
-       tile_manager.reset(w, h, samples);
+       tile_manager.reset(buffer_params, samples);
 
        start_time = time_dt();
        preview_time = 0.0;
@@ -462,12 +459,12 @@ void Session::reset_(int w, int h, int samples)
        sample = 0;
 }
 
-void Session::reset(int w, int h, int samples)
+void Session::reset(BufferParams& buffer_params, int samples)
 {
        if(device_use_gl)
-               reset_gpu(w, h, samples);
+               reset_gpu(buffer_params, samples);
        else
-               reset_cpu(w, h, samples);
+               reset_cpu(buffer_params, samples);
 }
 
 void Session::set_samples(int samples)
@@ -514,14 +511,16 @@ void Session::update_scene()
 
        progress.set_status("Updating Scene");
 
-       /* update camera if dimensions changed for progressive render */
+       /* update camera if dimensions changed for progressive render. the camera
+          knows nothing about progressive or cropped rendering, it just gets the
+          image dimensions passed in */
        Camera *cam = scene->camera;
-       int w = tile_manager.state.width;
-       int h = tile_manager.state.height;
+       int width = tile_manager.state.buffer.full_width;
+       int height = tile_manager.state.buffer.full_height;
 
-       if(cam->width != w || cam->height != h) {
-               cam->width = w;
-               cam->height = h;
+       if(width != cam->width || height != cam->height) {
+               cam->width = width;
+               cam->height = height;
                cam->tag_update();
        }
 
@@ -573,14 +572,15 @@ void Session::path_trace(Tile& tile)
        /* add path trace task */
        DeviceTask task(DeviceTask::PATH_TRACE);
 
-       task.x = tile.x;
-       task.y = tile.y;
+       task.x = tile_manager.state.buffer.full_x + tile.x;
+       task.y = tile_manager.state.buffer.full_y + tile.y;
        task.w = tile.w;
        task.h = tile.h;
        task.buffer = buffers->buffer.device_pointer;
        task.rng_state = buffers->rng_state.device_pointer;
        task.sample = tile_manager.state.sample;
        task.resolution = tile_manager.state.resolution;
+       tile_manager.state.buffer.get_offset_stride(task.offset, task.stride);
 
        device->task_add(task);
 }
@@ -590,14 +590,15 @@ void Session::tonemap()
        /* add tonemap task */
        DeviceTask task(DeviceTask::TONEMAP);
 
-       task.x = 0;
-       task.y = 0;
-       task.w = tile_manager.state.width;
-       task.h = tile_manager.state.height;
+       task.x = tile_manager.state.buffer.full_x;
+       task.y = tile_manager.state.buffer.full_y;
+       task.w = tile_manager.state.buffer.width;
+       task.h = tile_manager.state.buffer.height;
        task.rgba = display->rgba.device_pointer;
        task.buffer = buffers->buffer.device_pointer;
        task.sample = tile_manager.state.sample;
        task.resolution = tile_manager.state.resolution;
+       tile_manager.state.buffer.get_offset_stride(task.offset, task.stride);
 
        if(task.w > 0 && task.h > 0) {
                device->task_add(task);
index ce7f420096ae9e7637a65208afed73080ef29b5e..89979b8c451068adb5cd0569b8ab6d242ddf2633 100644 (file)
@@ -19,6 +19,7 @@
 #ifndef __SESSION_H__
 #define __SESSION_H__
 
+#include "buffers.h"
 #include "device.h"
 #include "tile.h"
 
@@ -27,6 +28,7 @@
 
 CCL_NAMESPACE_BEGIN
 
+class BufferParams;
 class Device;
 class DeviceScene;
 class DisplayBuffer;
@@ -106,11 +108,11 @@ public:
        ~Session();
 
        void start();
-       bool draw(int w, int h);
+       bool draw(BufferParams& params);
        void wait();
 
        bool ready_to_reset();
-       void reset(int w, int h, int samples);
+       void reset(BufferParams& params, int samples);
        void set_samples(int samples);
        void set_pause(bool pause);
 
@@ -118,7 +120,7 @@ protected:
        struct DelayedReset {
                thread_mutex mutex;
                bool do_reset;
-               int w, h;
+               BufferParams params;
                int samples;
        } delayed_reset;
 
@@ -129,15 +131,15 @@ protected:
 
        void tonemap();
        void path_trace(Tile& tile);
-       void reset_(int w, int h, int samples);
+       void reset_(BufferParams& params, int samples);
 
        void run_cpu();
-       bool draw_cpu(int w, int h);
-       void reset_cpu(int w, int h, int samples);
+       bool draw_cpu(BufferParams& params);
+       void reset_cpu(BufferParams& params, int samples);
 
        void run_gpu();
-       bool draw_gpu(int w, int h);
-       void reset_gpu(int w, int h, int samples);
+       bool draw_gpu(BufferParams& params);
+       void reset_gpu(BufferParams& params, int samples);
 
        TileManager tile_manager;
        bool device_use_gl;
index ba437e7487414d176e6144f76333c32717b2ff82..40833e5b08bb4dcc0c5185f4770c4e76084002e8 100644 (file)
@@ -28,21 +28,21 @@ TileManager::TileManager(bool progressive_, int samples_, int tile_size_, int mi
        tile_size = tile_size_;
        min_size = min_size_;
 
-       reset(0, 0, 0);
+       BufferParams buffer_params;
+       reset(buffer_params, 0);
 }
 
 TileManager::~TileManager()
 {
 }
 
-void TileManager::reset(int width_, int height_, int samples_)
+void TileManager::reset(BufferParams& params_, int samples_)
 {
-       full_width = width_;
-       full_height = height_;
+       params = params_;
 
        start_resolution = 1;
 
-       int w = width_, h = height_;
+       int w = params.width, h = params.height;
 
        if(min_size != INT_MAX) {
                while(w*h > min_size*min_size) {
@@ -55,8 +55,7 @@ void TileManager::reset(int width_, int height_, int samples_)
 
        samples = samples_;
 
-       state.width = 0;
-       state.height = 0;
+       state.buffer = BufferParams();
        state.sample = -1;
        state.resolution = start_resolution;
        state.tiles.clear();
@@ -70,8 +69,8 @@ void TileManager::set_samples(int samples_)
 void TileManager::set_tiles()
 {
        int resolution = state.resolution;
-       int image_w = max(1, full_width/resolution);
-       int image_h = max(1, full_height/resolution);
+       int image_w = max(1, params.width/resolution);
+       int image_h = max(1, params.height/resolution);
        int tile_w = (image_w + tile_size - 1)/tile_size;
        int tile_h = (image_h + tile_size - 1)/tile_size;
        int sub_w = image_w/tile_w;
@@ -90,8 +89,13 @@ void TileManager::set_tiles()
                }
        }
 
-       state.width = image_w;
-       state.height = image_h;
+       state.buffer.width = image_w;
+       state.buffer.height = image_h;
+
+       state.buffer.full_x = params.full_x/resolution;
+       state.buffer.full_y = params.full_y/resolution;
+       state.buffer.full_width = max(1, params.full_width/resolution);
+       state.buffer.full_height = max(1, params.full_height/resolution);
 }
 
 bool TileManager::done()
index 5cd16eb8afa9bed547a34277c1ea3e196d50fc15..b6e610c8d90247976fa658b7a33aff2cee18bd55 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <limits.h>
 
+#include "buffers.h"
 #include "util_list.h"
 
 CCL_NAMESPACE_BEGIN
@@ -39,9 +40,10 @@ public:
 
 class TileManager {
 public:
+       BufferParams params;
+
        struct State {
-               int width;
-               int height;
+               BufferParams buffer;
                int sample;
                int resolution;
                list<Tile> tiles;
@@ -50,7 +52,7 @@ public:
        TileManager(bool progressive, int samples, int tile_size, int min_size);
        ~TileManager();
 
-       void reset(int width, int height, int samples);
+       void reset(BufferParams& params, int samples);
        void set_samples(int samples);
        bool next();
        bool done();
@@ -63,8 +65,6 @@ protected:
        int tile_size;
        int min_size;
 
-       int full_width;
-       int full_height;
        int start_resolution;
 };
 
index 7c56f0fbb124fcc10eb435766998044fe07842d7..0a1d8ff4555c48b5454b97c7b4eab719870c76b4 100644 (file)
@@ -536,6 +536,11 @@ __device_inline float3 float4_to_float3(const float4 a)
        return make_float3(a.x, a.y, a.z);
 }
 
+__device_inline float4 float3_to_float4(const float3 a)
+{
+       return make_float4(a.x, a.y, a.z, 1.0f);
+}
+
 #ifndef __KERNEL_GPU__
 
 __device_inline void print_float3(const char *label, const float3& a)
index 4bf3759dd75c71a82694c9b1a4e2b09a3ad9d8d2..07db52f6392b6b5a29ec96b34b880e61de4cc851 100644 (file)
@@ -209,6 +209,13 @@ __device_inline float3 transform_get_column(const Transform *t, int column)
        return make_float3(t->x[column], t->y[column], t->z[column]);
 }
 
+__device_inline void transform_set_column(Transform *t, int column, float3 value)
+{
+       t->x[column] = value.x;
+       t->y[column] = value.y;
+       t->z[column] = value.z;
+}
+
 Transform transform_inverse(const Transform& a);
 
 __device_inline bool transform_uniform_scale(const Transform& tfm, float& scale)
@@ -244,6 +251,17 @@ __device_inline bool transform_negative_scale(const Transform& tfm)
        return (dot(cross(c0, c1), c2) < 0.0f);
 }
 
+__device_inline Transform transform_clear_scale(const Transform& tfm)
+{
+       Transform ntfm = tfm;
+
+       transform_set_column(&ntfm, 0, normalize(transform_get_column(&ntfm, 0)));
+       transform_set_column(&ntfm, 1, normalize(transform_get_column(&ntfm, 1)));
+       transform_set_column(&ntfm, 2, normalize(transform_get_column(&ntfm, 2)));
+
+       return ntfm;
+}
+
 #endif
 
 CCL_NAMESPACE_END
index 8d06bdbba65f4760ebbc1409f294624413cb7bf6..db66a68799e5c40c735a9ff999cada28c7d96aa9 100644 (file)
@@ -81,7 +81,8 @@ extern GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle);
  * @param eventCallback The event callback routine.
  * @param userdata             Pointer to user data returned to the callback routine.
  */
-extern GHOST_EventConsumerHandle GHOST_CreateEventConsumer(GHOST_EventCallbackProcPtr eventCallback, GHOST_TUserDataPtr userdata);
+extern GHOST_EventConsumerHandle GHOST_CreateEventConsumer(GHOST_EventCallbackProcPtr eventCallback,
+                                                           GHOST_TUserDataPtr userdata);
 
 /**
  * Disposes an event consumer object
index 04dc8717637babed4c60540bfe51ee6bac8e75a1..d451cb16df65d7dfed6dd57749c2f445511f2729 100644 (file)
@@ -181,7 +181,10 @@ public:
         * @param userData      Placeholder for user data.
         * @return A timer task (0 if timer task installation failed).
         */
-       virtual GHOST_ITimerTask* installTimer(GHOST_TUns64 delay, GHOST_TUns64 interval, GHOST_TimerProcPtr timerProc, GHOST_TUserDataPtr userData = 0) = 0;
+       virtual GHOST_ITimerTask* installTimer(GHOST_TUns64 delay,
+                                              GHOST_TUns64 interval,
+                                              GHOST_TimerProcPtr timerProc,
+                                              GHOST_TUserDataPtr userData = 0) = 0;
 
        /**
         * Removes a timer.
index 12a11d838dc0d46c37c0f6af9bdaf7d89e21c5ad..6438059287dec94b2df89c8b34e6cfdf90bc9ac5 100644 (file)
@@ -303,7 +303,7 @@ public:
         * @param       grab The new grab state of the cursor.
         * @return      Indication of success.
         */
-       virtual GHOST_TSuccess setCursorGrab(GHOST_TGrabCursorMode mode, GHOST_Rect *bounds) { return GHOST_kSuccess; };
+       virtual GHOST_TSuccess setCursorGrab(GHOST_TGrabCursorMode mode, GHOST_Rect *bounds) { return GHOST_kSuccess; }
 
 #ifdef WITH_CXX_GUARDEDALLOC
 public:
index 35a97b6d41698ff7a91523917f0a4dcf01000c43..6edfc4287aebd7142073b01b03ba987966e9de2f 100644 (file)
@@ -65,7 +65,8 @@ GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle)
 }
 
 
-GHOST_EventConsumerHandle GHOST_CreateEventConsumer(GHOST_EventCallbackProcPtr eventCallback, GHOST_TUserDataPtr userdata)
+GHOST_EventConsumerHandle GHOST_CreateEventConsumer(GHOST_EventCallbackProcPtr eventCallback,
+                                                    GHOST_TUserDataPtr userdata)
 {
        return (GHOST_EventConsumerHandle) new GHOST_CallbackEventConsumer (eventCallback, userdata);
 }
index 50000421bfdd7d55501d2c7f279fbab4c46dd8ca..49590c77eaa88a3123005637217924790b55f98c 100644 (file)
@@ -42,7 +42,7 @@
 #include "GHOST_CallbackEventConsumer.h"
 
 GHOST_CallbackEventConsumer::GHOST_CallbackEventConsumer(GHOST_EventCallbackProcPtr eventCallback,
-                                                                                                               GHOST_TUserDataPtr userData)
+                                                         GHOST_TUserDataPtr userData)
 {
        m_eventCallback = eventCallback;
        m_userData = userData;
index f2e16259c57bbc8f2891bb63047ee1e36e6ebbd8..38512f6ce2b7ce63b7cd8273039cb4cacc366b7e 100644 (file)
 #define _GHOST_DEBUG_H_
 
 #if defined(WIN32) && !defined(FREE_WINDOWS)
-       #ifdef DEBUG
-               #pragma warning (disable:4786) // suppress stl-MSVC debug info warning
-               // #define GHOST_DEBUG
-       #endif // DEBUG
+#  ifdef DEBUG
+#    pragma warning (disable:4786) // suppress stl-MSVC debug info warning
+     // #define GHOST_DEBUG
+#  endif // DEBUG
 #endif // WIN32
 
 #ifdef WITH_GHOST_DEBUG 
-       #define GHOST_DEBUG // spit ghost events to stdout
+#  define GHOST_DEBUG // spit ghost events to stdout
 #endif // WITH_GHOST_DEBUG 
 
 #ifdef GHOST_DEBUG
-       #include <iostream>
-       #include <stdio.h> //for printf()
+#  include <iostream>
+#  include <stdio.h> //for printf()
 #endif // GHOST_DEBUG
 
 
 #ifdef GHOST_DEBUG
-       #define GHOST_PRINT(x) { std::cout << x; }
-       #define GHOST_PRINTF(x, ...) { printf(x, __VA_ARGS__); }
+#  define GHOST_PRINT(x) { std::cout << x; }
+#  define GHOST_PRINTF(x, ...) { printf(x, __VA_ARGS__); }
 #else  // GHOST_DEBUG
-       #define GHOST_PRINT(x)
-       #define GHOST_PRINTF(x, ...)
+#  define GHOST_PRINT(x)
+#  define GHOST_PRINTF(x, ...)
 #endif // GHOST_DEBUG
 
 
 #ifdef GHOST_DEBUG
-       #define GHOST_ASSERT(x, info) { if (!(x)) {GHOST_PRINT("assertion failed: "); GHOST_PRINT(info); GHOST_PRINT("\n"); } }
+#  define GHOST_ASSERT(x, info)                                               \
+       {                                                                         \
+           if (!(x)) {                                                           \
+               GHOST_PRINT("assertion failed: ");                                \
+               GHOST_PRINT(info);                                                \
+               GHOST_PRINT("\n");                                                \
+           }                                                                     \
+       }
 #else  // GHOST_DEBUG
-       #define GHOST_ASSERT(x, info)
+#  define GHOST_ASSERT(x, info)
 #endif // GHOST_DEBUG
 
 #endif // _GHOST_DEBUG_H_
index d7a9b151d14f455fc2ca1c35f4dffa81200a979b..b89f303c73487097fe706204d46cef2c8cd40099 100644 (file)
@@ -75,7 +75,8 @@ public:
         * @param numSettings The number of settings of the display device with this index.
         * @return Indication of success.
         */
-       virtual GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32& numSettings) const;
+       virtual GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display,
+                                                    GHOST_TInt32& numSettings) const;
 
        /**
         * Returns the current setting for this display device. 
@@ -84,7 +85,9 @@ public:
         * @param setting The setting of the display device with this index.
         * @return Indication of success.
         */
-       virtual GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display, GHOST_TInt32 index, GHOST_DisplaySetting& setting) const;
+       virtual GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display,
+                                                GHOST_TInt32 index,
+                                                GHOST_DisplaySetting& setting) const;
 
        /**
         * Returns the current setting for this display device. 
@@ -92,7 +95,8 @@ public:
         * @param setting The current setting of the display device with this index.
         * @return Indication of success.
         */
-       virtual GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display, GHOST_DisplaySetting& setting) const;
+       virtual GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display,
+                                                       GHOST_DisplaySetting& setting) const;
 
        /**
         * Changes the current setting for this display device.
@@ -102,7 +106,8 @@ public:
         * @param setting The setting of the display device to be matched and activated.
         * @return Indication of success.
         */
-       virtual GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display, const GHOST_DisplaySetting& setting);
+       virtual GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display,
+                                                       const GHOST_DisplaySetting& setting);
 
 protected:
        typedef std::vector<GHOST_DisplaySetting> GHOST_DisplaySettings;
@@ -114,7 +119,9 @@ protected:
         * @param match         The optimal display setting.
         * @return Indication of success.
         */
-       GHOST_TSuccess findMatch(GHOST_TUns8 display, const GHOST_DisplaySetting& setting, GHOST_DisplaySetting& match) const;
+       GHOST_TSuccess findMatch(GHOST_TUns8 display,
+                                const GHOST_DisplaySetting& setting,
+                                GHOST_DisplaySetting& match) const;
 
        /**
         * Retrieves settings for each display device and stores them.
index 650a109a668a14495d48dc236bee6d160f4d5d04..330635de50afebac5fcf9aa377394133051ef7e2 100644 (file)
@@ -44,19 +44,21 @@ extern "C" {
  * 
  * The dragging sequence is performed in four phases:
  * 
- * <li> Start sequence (GHOST_kEventDraggingEntered) that tells a drag'n'drop operation has started. Already gives the object data type,
- * and the entering mouse location
+ * <li> Start sequence (GHOST_kEventDraggingEntered) that tells a drag'n'drop operation has started.
+ * Already gives the object data type, and the entering mouse location
  *
- * <li> Update mouse position (GHOST_kEventDraggingUpdated) sent upon each mouse move until the drag'n'drop operation stops, to give the updated mouse position.
- * Useful to highlight a potential destination, and update the status (through GHOST_setAcceptDragOperation) telling if the object can be dropped at
+ * <li> Update mouse position (GHOST_kEventDraggingUpdated) sent upon each mouse move until the drag'n'drop operation
+ * stops, to give the updated mouse position. Useful to highlight a potential destination, and update the status
+ * (through GHOST_setAcceptDragOperation) telling if the object can be dropped at
  * the current cursor position.
  *
  * <li> Abort drag'n'drop sequence (GHOST_kEventDraggingExited) sent when the user moved the mouse outside the window.
  *
  * <li> Send the dropped data (GHOST_kEventDraggingDropDone)
  *
- * <li> Outside of the normal sequence, dropped data can be sent (GHOST_kEventDraggingDropOnIcon). This can happen when the user drops an object
- * on the application icon. (Also used in OSX to pass the filename of the document the user doubled-clicked in the finder)
+ * <li> Outside of the normal sequence, dropped data can be sent (GHOST_kEventDraggingDropOnIcon).
+ * This can happen when the user drops an object on the application icon.
+ * (Also used in OSX to pass the filename of the document the user doubled-clicked in the finder)
  *
  * <br><br>Note that the mouse positions are given in Blender coordinates (y=0 at bottom)
  *
@@ -78,7 +80,10 @@ public:
         * @param y                     The y-coordinate of the location the cursor was at at the time of the event.
         * @param data          The "content" dropped in the window
         */
-       GHOST_EventDragnDrop(GHOST_TUns64 time, GHOST_TEventType type, GHOST_TDragnDropTypes dataType, GHOST_IWindow* window,
+       GHOST_EventDragnDrop(GHOST_TUns64 time,
+                            GHOST_TEventType type,
+                            GHOST_TDragnDropTypes dataType,
+                            GHOST_IWindow* window,
                                                 int x, int y, GHOST_TEventDataPtr data)
                : GHOST_Event(time, type, window)
        {
index 5410b1eda16675d95ebeb79c70f28f3c2f3235f5..a602bd65e5a0e31804ea6863f0cadbcd31f1f4c7 100644 (file)
@@ -49,7 +49,10 @@ public:
         * @param type  The type of key event.
         * @param key   The key code of the key.
         */
-       GHOST_EventKey(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow* window, GHOST_TKey key)
+       GHOST_EventKey(GHOST_TUns64 msec,
+                      GHOST_TEventType type,
+                      GHOST_IWindow* window,
+                      GHOST_TKey key)
                : GHOST_Event(msec, type, window)
        {
                m_keyEventData.key = key;
@@ -65,7 +68,12 @@ public:
         * @param key   The key code of the key.
         * @param ascii The ascii code for the key event.
         */
-       GHOST_EventKey(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow* window, GHOST_TKey key, char ascii, const char utf8_buf[6])
+       GHOST_EventKey(GHOST_TUns64 msec,
+                      GHOST_TEventType type,
+                      GHOST_IWindow* window,
+                      GHOST_TKey key,
+                      char ascii,
+                      const char utf8_buf[6])
                : GHOST_Event(msec, type, window)
        {
                m_keyEventData.key = key;
index 394aff0493fc4edc17deeb5abc0d7ee7609df284..fceacce08058d25ba8bba73a291a9a5646fd9e2b 100644 (file)
  *
  * ***** END GPL LICENSE BLOCK *****
  */
+
+/** \file ghost/intern/GHOST_EventNDOF.h
+ *  \ingroup GHOST
+ * Declaration of GHOST_EventManager class.
+ */
 
 #ifndef _GHOST_EVENT_NDOF_H_
 #define _GHOST_EVENT_NDOF_H_
index 06706ea5ff3e611560167e3e02012ff4eaa480f8..55517f0a76c3cad79d42168a90ca5db509f8702d 100644 (file)
@@ -50,7 +50,11 @@ public:
         * @param x                     The x-delta of the pan event.
         * @param y                     The y-delta of the pan event.
         */
-       GHOST_EventTrackpad(GHOST_TUns64 msec, GHOST_IWindow* window, GHOST_TTrackpadEventSubTypes subtype, GHOST_TInt32 x, GHOST_TInt32 y, GHOST_TInt32 deltaX, GHOST_TInt32 deltaY)
+       GHOST_EventTrackpad(GHOST_TUns64 msec,
+                           GHOST_IWindow* window,
+                           GHOST_TTrackpadEventSubTypes subtype,
+                           GHOST_TInt32 x, GHOST_TInt32 y,
+                           GHOST_TInt32 deltaX, GHOST_TInt32 deltaY)
                : GHOST_Event(msec, GHOST_kEventTrackpad, window)
        {
                m_trackpadEventData.subtype = subtype;
index afc54d3c6a025139d33653365a29cf116decf3be..b0b693e2f8f574301f38bb883b769e4c25ed934f 100644 (file)
@@ -73,7 +73,10 @@ GHOST_TUns64 GHOST_System::getMilliSeconds() const
 }
 
 
-GHOST_ITimerTask* GHOST_System::installTimer(GHOST_TUns64 delay, GHOST_TUns64 interval, GHOST_TimerProcPtr timerProc, GHOST_TUserDataPtr userData)
+GHOST_ITimerTask* GHOST_System::installTimer(GHOST_TUns64 delay,
+                                             GHOST_TUns64 interval,
+                                             GHOST_TimerProcPtr timerProc,
+                                             GHOST_TUserDataPtr userData)
 {
        GHOST_TUns64 millis = getMilliSeconds();
        GHOST_TimerTask* timer = new GHOST_TimerTask(millis+delay, interval, timerProc, userData);
index afd2a8cbae30a11e52a9ec63a379a03312b7b62d..300826431184b0609ac5890d9972841cbf306b0a 100644 (file)
@@ -97,7 +97,10 @@ public:
         * @param userData      Placeholder for user data.
         * @return A timer task (0 if timer task installation failed).
         */
-       virtual GHOST_ITimerTask* installTimer(GHOST_TUns64 delay, GHOST_TUns64 interval, GHOST_TimerProcPtr timerProc, GHOST_TUserDataPtr userData = 0);
+       virtual GHOST_ITimerTask* installTimer(GHOST_TUns64 delay,
+                                              GHOST_TUns64 interval,
+                                              GHOST_TimerProcPtr timerProc,
+                                              GHOST_TUserDataPtr userData = 0);
 
        /**
         * Removes a timer.
index 470fea7969caa3f704ce11738de8ae8d0a0ab4ea..581535e82b8f90ab1d4b199f0aa57624c296a617 100644 (file)
@@ -241,7 +241,9 @@ protected:
        /**
         * Handles a tablet event.
         * @param eventPtr      An NSEvent pointer (casted to void* to enable compilation in standard C++)
-        * @param eventType The type of the event. It needs to be passed separately as it can be either directly in the event type, or as a subtype if combined with a mouse button event
+        * @param eventType The type of the event.
+        * It needs to be passed separately as it can be either directly in the event type,
+        * or as a subtype if combined with a mouse button event.
         * @return Indication whether the event was handled.
         */
        GHOST_TSuccess handleTabletEvent(void *eventPtr, short eventType);
index 2547006ef287271aa1b68777904161338e779f2b..61c65384d2db6ddb5e78763281aedbcba8f82ae7 100644 (file)
@@ -790,9 +790,11 @@ GHOST_SystemX11::processEvent(XEvent *xe)
                        /*Check to see if the requestor is asking for String*/
                        if(xse->target == string || xse->target == compound_text || xse->target == c_string) {
                                if (xse->selection == XInternAtom(m_display, "PRIMARY", False)) {
-                                       XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 8, PropModeReplace, (unsigned char*)txt_select_buffer, strlen(txt_select_buffer));
+                                       XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 8, PropModeReplace,
+                                                       (unsigned char*)txt_select_buffer, strlen(txt_select_buffer));
                                } else if (xse->selection == XInternAtom(m_display, "CLIPBOARD", False)) {
-                                       XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 8, PropModeReplace, (unsigned char*)txt_cut_buffer, strlen(txt_cut_buffer));
+                                       XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 8, PropModeReplace,
+                                                       (unsigned char*)txt_cut_buffer, strlen(txt_cut_buffer));
                                }
                        } else if (xse->target == target) {
                                Atom alist[4];
@@ -800,7 +802,8 @@ GHOST_SystemX11::processEvent(XEvent *xe)
                                alist[1] = string;
                                alist[2] = compound_text;
                                alist[3] = c_string;
-                               XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 32, PropModeReplace, (unsigned char*)alist, 4);
+                               XChangeProperty(m_display, xse->requestor, xse->property, xse->target, 32, PropModeReplace,
+                                               (unsigned char*)alist, 4);
                                XFlush(m_display);
                        } else  {
                                //Change property to None because we do not support anything but STRING
index 01bf0053343c972314b9821808dec45b36b72f6e..ac86d6c1ce689624853a895036022d073f75270b 100644 (file)
@@ -51,8 +51,16 @@ public:
         * @param timerProc     The callbak invoked when the interval expires.
         * @param data          The timer user data.
         */
-       GHOST_TimerTask(GHOST_TUns64 start, GHOST_TUns64 interval, GHOST_TimerProcPtr timerProc, GHOST_TUserDataPtr userData = 0)
-               : m_start(start), m_interval(interval), m_next(start), m_timerProc(timerProc), m_userData(userData), m_auxData(0)
+       GHOST_TimerTask(GHOST_TUns64 start,
+                       GHOST_TUns64 interval,
+                       GHOST_TimerProcPtr timerProc,
+                       GHOST_TUserDataPtr userData = 0)
+               : m_start(start),
+             m_interval(interval),
+             m_next(start),
+             m_timerProc(timerProc),
+             m_userData(userData),
+             m_auxData(0)
        {
        }
 
index 0545b309f4bcb64b5abc663e86995acb8ad626b7..b560b04b5df39eee757279b455191896672170a4 100644 (file)
@@ -145,15 +145,15 @@ GHOST_TSuccess GHOST_Window::setCursorShape(GHOST_TStandardCursor cursorShape)
 }
 
 GHOST_TSuccess GHOST_Window::setCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2],
-                                                                                                        int hotX, int hotY)
+                                                  int hotX, int hotY)
 {
-       return setCustomCursorShape( (GHOST_TUns8 *)bitmap, (GHOST_TUns8 *)mask, 
-                                                                       16, 16, hotX, hotY, 0, 1 );
+       return setCustomCursorShape((GHOST_TUns8 *)bitmap, (GHOST_TUns8 *)mask,
+                                   16, 16, hotX, hotY, 0, 1 );
 }
 
 GHOST_TSuccess GHOST_Window::setCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, 
-                                                                                                       int sizex, int sizey, int hotX, int hotY,
-                                                                                                       int fg_color, int bg_color )
+                                                  int sizex, int sizey, int hotX, int hotY,
+                                                  int fg_color, int bg_color)
 {
        if (setWindowCustomCursorShape(bitmap, mask, sizex, sizey,hotX, hotY, fg_color, bg_color)) {
                m_cursorShape = GHOST_kStandardCursorCustom;
index a9f070b89514ca51a1b1741fdec245e856de8c25..646097d42c4f79763abb6a8ba33ec32ea06f1df0 100644 (file)
@@ -289,8 +289,9 @@ protected:
         * Sets the cursor shape on the window using
         * native window system calls.
         */
-       virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2],
-                                                        int hotX, int hotY) = 0;
+       virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
+                                                         GHOST_TUns8 mask[16][2],
+                                                         int hotX, int hotY) = 0;
        
        virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, 
                                                int szx, int szy, int hotX, int hotY, int fg, int bg) = 0;
index 01217dfd17a799da4b3533b6bcfbfa7b47d7cf09..fbb474cb20abacc7b845625f046a4f07f4eba54d 100644 (file)
@@ -34,6 +34,7 @@
 #endif
 
 #include <OpenGL/gl.h>
+#include <OpenGL/CGLRenderers.h>
 /***** Multithreaded opengl code : uncomment for enabling
 #include <OpenGL/OpenGL.h>
 */
@@ -485,7 +486,14 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
        // needed for 'Draw Overlap' drawing method
        pixelFormatAttrsWindow[i++] = NSOpenGLPFABackingStore; 
        
-       pixelFormatAttrsWindow[i++] = NSOpenGLPFAAccelerated;
+       // Force software OpenGL, for debugging
+       if(getenv("BLENDER_SOFTWAREGL")) {
+               pixelFormatAttrsWindow[i++] = NSOpenGLPFARendererID;
+               pixelFormatAttrsWindow[i++] = kCGLRendererGenericID;
+       }
+       else
+               pixelFormatAttrsWindow[i++] = NSOpenGLPFAAccelerated;
+
        //pixelFormatAttrsWindow[i++] = NSOpenGLPFAAllowOfflineRenderers,;   // Removed to allow 10.4 builds, and 2 GPUs rendering is not used anyway
 
        pixelFormatAttrsWindow[i++] = NSOpenGLPFADepthSize;
@@ -521,7 +529,14 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
                // needed for 'Draw Overlap' drawing method
                pixelFormatAttrsWindow[i++] = NSOpenGLPFABackingStore;
                
-               pixelFormatAttrsWindow[i++] = NSOpenGLPFAAccelerated;
+               // Force software OpenGL, for debugging
+               if(getenv("BLENDER_SOFTWAREGL")) {
+                       pixelFormatAttrsWindow[i++] = NSOpenGLPFARendererID;
+                       pixelFormatAttrsWindow[i++] = kCGLRendererGenericID;
+               }
+               else
+                       pixelFormatAttrsWindow[i++] = NSOpenGLPFAAccelerated;
+
                //pixelFormatAttrsWindow[i++] = NSOpenGLPFAAllowOfflineRenderers,;   // Removed to allow 10.4 builds, and 2 GPUs rendering is not used anyway
                
                pixelFormatAttrsWindow[i++] = NSOpenGLPFADepthSize;
index a363130c8976b1e8dbfa71d792751e480e224819..cb4d3f87e837b335c704717066545e7a6cfe43ce 100644 (file)
@@ -1196,10 +1196,11 @@ static GHOST_TUns16 uns16ReverseBits(GHOST_TUns16 shrt)
        return shrt;
 }
 GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
-                                       GHOST_TUns8 mask[16][2], int hotX, int hotY)
+                                                             GHOST_TUns8 mask[16][2],
+                                                             int hotX, int hotY)
 {
        return setWindowCustomCursorShape((GHOST_TUns8*)bitmap, (GHOST_TUns8*)mask,
-                                                                       16, 16, hotX, hotY, 0, 1);
+                                         16, 16, hotX, hotY, 0, 1);
 }
 
 GHOST_TSuccess GHOST_WindowWin32::setWindowCustomCursorShape(GHOST_TUns8 *bitmap,
index b24f37aa2648fd4f9e87d986b741c1bdf8855eb3..190966ee48587eb5da1e0ecdec8374d343d6cfb8 100644 (file)
@@ -309,7 +309,9 @@ protected:
         * Sets the cursor shape on the window using
         * native window system calls.
         */
-       virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY);
+       virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2],
+                                                         GHOST_TUns8 mask[16][2],
+                                                         int hotX, int hotY);
 
        virtual GHOST_TSuccess setWindowCustomCursorShape(
                GHOST_TUns8 *bitmap, 
index c379e4c7e485eb530397d3531fe87aa06fb582c4..5611644f8f2e8da193746fa3b73a3d911dcc4c06 100644 (file)
@@ -239,7 +239,8 @@ GHOST_WindowX11(
                        }
                } else {
                        if (m_numOfAASamples && (m_numOfAASamples > samples)) {
-                               printf("%s:%d: oversampling requested %i but using %i samples\n", __FILE__, __LINE__, m_numOfAASamples, samples);
+                               printf("%s:%d: oversampling requested %i but using %i samples\n",
+                                      __FILE__, __LINE__, m_numOfAASamples, samples);
                        }
                        break;
                }
@@ -1343,7 +1344,9 @@ installDrawingContext(
                        if (!s_firstContext) {
                                s_firstContext = m_context;
                        }
-                       glXMakeCurrent(m_display, m_window,m_context);                                          
+                       glXMakeCurrent(m_display, m_window,m_context);
+                       glClearColor(0.447, 0.447, 0.447, 0);
+                       glClear(GL_COLOR_BUFFER_BIT);
                        success = GHOST_kSuccess;
                } else {
                        success = GHOST_kFailure;
@@ -1491,7 +1494,8 @@ setWindowCursorGrab(
 
                }
 #ifdef GHOST_X11_GRAB
-               XGrabPointer(m_display, m_window, False, ButtonPressMask| ButtonReleaseMask|PointerMotionMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
+               XGrabPointer(m_display, m_window, False, ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
+                            GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
 #endif
        }
        else {
index 345df5b16cfeb7164bf3aa11f405d41f5e5ba2c8..01ddddb73a04bed7168a7a249514a481c5ef334e 100644 (file)
@@ -93,6 +93,14 @@ typedef unsigned long uintptr_t;
        /* Linux-i386, Linux-Alpha, Linux-ppc */
 #include <stdint.h>
 
+/* XXX */
+#ifndef uint64_t
+typedef uint8_t   u_int8_t;
+typedef uint16_t  u_int16_t;
+typedef uint32_t  u_int32_t;
+typedef uint64_t  u_int64_t;
+#endif
+
 #elif defined (__APPLE__)
 
 #include <inttypes.h>
index af49b07d064032711c36b5b0f885aae3a0ba593f..3876f26362c7c98d7efa0a2b75aa92fb52449237 100644 (file)
@@ -225,11 +225,12 @@ void IK_SetStiffness(IK_Segment *seg, IK_SegmentAxis axis, float stiffness)
 void IK_GetBasisChange(IK_Segment *seg, float basis_change[][3])
 {
        IK_QSegment *qseg = (IK_QSegment*)seg;
-       const MT_Matrix3x3& change = qseg->BasisChange();
 
        if (qseg->Translational() && qseg->Composite())
                qseg = qseg->Composite();
 
+       const MT_Matrix3x3& change = qseg->BasisChange();
+
        // convert from moto row major to blender column major
        basis_change[0][0] = (float)change[0][0];
        basis_change[1][0] = (float)change[0][1];
index ff857e82d8f7d3f2099b34cc8c925499998d1c2c..2036e601bcbb9b8274ae7d28410243c6ed38a47d 100644 (file)
@@ -1350,7 +1350,6 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con
                for(s=0; s<iUniqueSubGroups; s++)
                        free(pUniSubGroups[s].pTriMembers);
                iUniqueTspaces += iUniqueSubGroups;
-               iUniqueSubGroups = 0;
        }
 
        // clean up
index c3fb7135fcbf3159c0a39ac42eeaad1200a740c7..20b4c0a66811083cf3d316cfa3961ddcccd4e4d6 100644 (file)
@@ -1137,7 +1137,7 @@ static NLboolean __nlInvert_SUPERLU(__NLContext *context) {
 
        /* SuperLU variables */
        SuperMatrix B;
-       NLint info;
+       NLint info = 0;
 
        for(j=0; j<context->nb_rhs; j++, b+=n, x+=n) {
                /* Create superlu array for B */
index 2eb0aea678e91dfa2ca7087277cabb24512f257f..320fe3471f44e75a976940da35a122a245af8169 100644 (file)
@@ -368,7 +368,7 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
     int m, n, bnz, *b_colptr, i;
     int delta, maxint, nofsub, *invp;
     int *b_rowind, *dhead, *qsize, *llist, *marker;
-    double t, SuperLU_timer_();
+    /* double t, SuperLU_timer_(); */
     
     /* make gcc happy */
     b_rowind=NULL;
@@ -377,7 +377,7 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
     m = A->nrow;
     n = A->ncol;
 
-    t = SuperLU_timer_();
+    /* t = SuperLU_timer_(); */
     switch ( ispec ) {
         case 0: /* Natural ordering */
              for (i = 0; i < n; ++i) perm_c[i] = i;
@@ -391,8 +391,8 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
 #if ( PRNTlevel>=1 )
              printf("Use minimum degree ordering on A'*A.\n");
 #endif
-             t = SuperLU_timer_() - t;
-             /*printf("Form A'*A time = %8.3f\n", t);*/
+             /*t = SuperLU_timer_() - t;
+             printf("Form A'*A time = %8.3f\n", t);*/
              break;
         case 2: /* Minimum degree ordering on A'+A */
              if ( m != n ) ABORT("Matrix is not square");
@@ -401,8 +401,8 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
 #if ( PRNTlevel>=1 )
              printf("Use minimum degree ordering on A'+A.\n");
 #endif
-             t = SuperLU_timer_() - t;
-             /*printf("Form A'+A time = %8.3f\n", t);*/
+             /*t = SuperLU_timer_() - t;
+             printf("Form A'+A time = %8.3f\n", t);*/
              break;
         case 3: /* Approximate minimum degree column ordering. */
              get_colamd(m, n, Astore->nnz, Astore->colptr, Astore->rowind,
@@ -417,7 +417,7 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
     }
 
     if ( bnz != 0 ) {
-       t = SuperLU_timer_();
+       /* t = SuperLU_timer_(); */
 
        /* Initialize and allocate storage for GENMMD. */
        delta = 1; /* DELTA is a parameter to allow the choice of nodes
@@ -452,8 +452,8 @@ get_perm_c(int ispec, SuperMatrix *A, int *perm_c)
        SUPERLU_FREE(llist);
        SUPERLU_FREE(marker);
 
-       t = SuperLU_timer_() - t;
-       /*  printf("call GENMMD time = %8.3f\n", t);*/
+       /* t = SuperLU_timer_() - t;
+       printf("call GENMMD time = %8.3f\n", t);*/
 
     } else { /* Empty adjacency structure */
        for (i = 0; i < n; ++i) perm_c[i] = i;
index cb8d83686becbd7eaede3b223eef61b957db7c01..3d4f5968778c905e7af34561c733aac49d47b1e0 100644 (file)
@@ -303,7 +303,6 @@ scolumn_bmod (
           d_fsupc=0 if fsupc >= fpanelc. */
        d_fsupc = fst_col - fsupc;
 
-       lptr = xlsub[fsupc] + d_fsupc;
        luptr = xlusup[fst_col] + d_fsupc;
        nsupr = xlsub[fsupc+1] - xlsub[fsupc];  /* Leading dimension */
        nsupc = jcol - fst_col; /* Excluding jcol */
index a1d66ed734195b1dccc5ca3b4cb083a1d01e213f..da904ba3e9d806306429ff9dfdf75e960b3e4083 100644 (file)
@@ -9,9 +9,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
 {
 
 
-    /* System generated locals */
-    int i__1, i__2;
-
     /* Local variables */
     static int info;
     static float temp;
@@ -213,14 +210,12 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
            }
        } else {
            if (*incx == 1) {
-               i__1 = *n;
                for (j = 1; j <= *n; ++j) {
                    if (X(j) != 0.f) {
                        if (nounit) {
                            X(j) /= A(j,j);
                        }
                        temp = X(j);
-                       i__2 = *n;
                        for (i = j + 1; i <= *n; ++i) {
                            X(i) -= temp * A(i,j);
 /* L50: */
@@ -230,7 +225,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
                }
            } else {
                jx = kx;
-               i__1 = *n;
                for (j = 1; j <= *n; ++j) {
                    if (X(jx) != 0.f) {
                        if (nounit) {
@@ -238,7 +232,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
                        }
                        temp = X(jx);
                        ix = jx;
-                       i__2 = *n;
                        for (i = j + 1; i <= *n; ++i) {
                            ix += *incx;
                            X(ix) -= temp * A(i,j);
@@ -256,10 +249,8 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
 
        if (lsame_(uplo, "U")) {
            if (*incx == 1) {
-               i__1 = *n;
                for (j = 1; j <= *n; ++j) {
                    temp = X(j);
-                   i__2 = j - 1;
                    for (i = 1; i <= j-1; ++i) {
                        temp -= A(i,j) * X(i);
 /* L90: */
@@ -272,11 +263,9 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
                }
            } else {
                jx = kx;
-               i__1 = *n;
                for (j = 1; j <= *n; ++j) {
                    temp = X(jx);
                    ix = kx;
-                   i__2 = j - 1;
                    for (i = 1; i <= j-1; ++i) {
                        temp -= A(i,j) * X(ix);
                        ix += *incx;
@@ -294,7 +283,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
            if (*incx == 1) {
                for (j = *n; j >= 1; --j) {
                    temp = X(j);
-                   i__1 = j + 1;
                    for (i = *n; i >= j+1; --i) {
                        temp -= A(i,j) * X(i);
 /* L130: */
@@ -311,7 +299,6 @@ int strsv_(char *, char *, char *, int *, float *, int *, float *, int *);
                for (j = *n; j >= 1; --j) {
                    temp = X(jx);
                    ix = kx;
-                   i__1 = j + 1;
                    for (i = *n; i >= j+1; --i) {
                        temp -= A(i,j) * X(ix);
                        ix -= *incx;
index 510ade8233cf02db3d12a5a4e31672d7b0815204..a77e87b9c65d5b8205ef72c5e7b92f447472d5dc 100644 (file)
@@ -370,8 +370,6 @@ void
 sFillRHS(trans_t trans, int nrhs, float *x, int ldx,
          SuperMatrix *A, SuperMatrix *B)
 {
-    NCformat *Astore;
-    float   *Aval;
     DNformat *Bstore;
     float   *rhs;
     float one = 1.0;
@@ -379,8 +377,6 @@ sFillRHS(trans_t trans, int nrhs, float *x, int ldx,
     int      ldc;
     char transc[1];
 
-    Astore = A->Store;
-    Aval   = (float *) Astore->nzval;
     Bstore = B->Store;
     rhs    = Bstore->nzval;
     ldc    = Bstore->lda;
index f13108b22563d3e141a7600d3eef16b9c681b927..c4c478cec2bc2e8dea195a026d36a87b8831eba4 100644 (file)
@@ -24,7 +24,8 @@
 #define NUM_TEMPV(m,w,t,b)  ( SUPERLU_MAX(m, (t + b)*w) )
 
 #ifndef USER_ABORT
-#define USER_ABORT(msg) superlu_abort_and_exit(msg)
+#define USER_ABORT(msg) \
+ {  fprintf(stderr, "%s", msg); exit (-1); }
 #endif
 
 #define ABORT(err_msg) \
index 90f0d3f1c1daa4540c349191d82f28dda5468a86..38fdb8f5fec9cc400a8b827b763139664f5bce25 100644 (file)
@@ -121,24 +121,24 @@ _axis_convert_matrix = (
     ((-1.0, 0.0, 0.0), (0.0, 0.0, 1.0), (0.0, 1.0, 0.0)),
     ((-1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, -1.0)),
     ((0.0, -1.0, 0.0), (-1.0, 0.0, 0.0), (0.0, 0.0, -1.0)),
-    ((0.0, -1.0, 0.0), (0.0, 0.0, -1.0), (1.0, 0.0, 0.0)),
-    ((0.0, -1.0, 0.0), (0.0, 0.0, 1.0), (-1.0, 0.0, 0.0)),
-    ((0.0, -1.0, 0.0), (1.0, 0.0, 0.0), (0.0, 0.0, 1.0)),
+    ((0.0, 0.0, 1.0), (-1.0, 0.0, 0.0), (0.0, -1.0, 0.0)),
     ((0.0, 0.0, -1.0), (-1.0, 0.0, 0.0), (0.0, 1.0, 0.0)),
+    ((0.0, 1.0, 0.0), (-1.0, 0.0, 0.0), (0.0, 0.0, 1.0)),
+    ((0.0, -1.0, 0.0), (0.0, 0.0, 1.0), (-1.0, 0.0, 0.0)),
     ((0.0, 0.0, -1.0), (0.0, -1.0, 0.0), (-1.0, 0.0, 0.0)),
-    ((0.0, 0.0, -1.0), (0.0, 1.0, 0.0), (1.0, 0.0, 0.0)),
-    ((0.0, 0.0, -1.0), (1.0, 0.0, 0.0), (0.0, -1.0, 0.0)),
-    ((0.0, 0.0, 1.0), (-1.0, 0.0, 0.0), (0.0, -1.0, 0.0)),
-    ((0.0, 0.0, 1.0), (0.0, -1.0, 0.0), (1.0, 0.0, 0.0)),
     ((0.0, 0.0, 1.0), (0.0, 1.0, 0.0), (-1.0, 0.0, 0.0)),
-    ((0.0, 0.0, 1.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0)),
-    ((0.0, 1.0, 0.0), (-1.0, 0.0, 0.0), (0.0, 0.0, 1.0)),
     ((0.0, 1.0, 0.0), (0.0, 0.0, -1.0), (-1.0, 0.0, 0.0)),
+    ((0.0, -1.0, 0.0), (0.0, 0.0, -1.0), (1.0, 0.0, 0.0)),
+    ((0.0, 0.0, 1.0), (0.0, -1.0, 0.0), (1.0, 0.0, 0.0)),
+    ((0.0, 0.0, -1.0), (0.0, 1.0, 0.0), (1.0, 0.0, 0.0)),
     ((0.0, 1.0, 0.0), (0.0, 0.0, 1.0), (1.0, 0.0, 0.0)),
+    ((0.0, -1.0, 0.0), (1.0, 0.0, 0.0), (0.0, 0.0, 1.0)),
+    ((0.0, 0.0, -1.0), (1.0, 0.0, 0.0), (0.0, -1.0, 0.0)),
+    ((0.0, 0.0, 1.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0)),
     ((0.0, 1.0, 0.0), (1.0, 0.0, 0.0), (0.0, 0.0, -1.0)),
     ((1.0, 0.0, 0.0), (0.0, -1.0, 0.0), (0.0, 0.0, -1.0)),
-    ((1.0, 0.0, 0.0), (0.0, 0.0, -1.0), (0.0, 1.0, 0.0)),
     ((1.0, 0.0, 0.0), (0.0, 0.0, 1.0), (0.0, -1.0, 0.0)),
+    ((1.0, 0.0, 0.0), (0.0, 0.0, -1.0), (0.0, 1.0, 0.0)),
     )
 
 # store args as a single int
index fab6886b3145420809c7563a0f5af49846d84e46..a9eb86aaf79a74eeeac5a7e5e6c09a7075378d17 100644 (file)
@@ -89,7 +89,6 @@ KM_HIERARCHY = [
 
     ('Property Editor', 'PROPERTIES', 'WINDOW', []),  # align context menu
 
-    ('Script', 'SCRIPTS_WINDOW', 'WINDOW', []),
     ('Text', 'TEXT_EDITOR', 'WINDOW', []),
     ('Console', 'CONSOLE', 'WINDOW', []),
     ('Clip', 'CLIP_EDITOR', 'WINDOW', [
index 32f7b654690d0d68522c811192dc384962d67015..edc17c36c36af3416c24f492137611a643c629fc 100644 (file)
@@ -42,6 +42,7 @@ def region_2d_to_vector_3d(region, rv3d, coord):
     """
     from mathutils import Vector
 
+    viewinv = rv3d.view_matrix.inverted()
     if rv3d.is_perspective:
         persinv = rv3d.perspective_matrix.inverted()
 
@@ -50,13 +51,11 @@ def region_2d_to_vector_3d(region, rv3d, coord):
                       -0.5
                     ))
 
-        w = ((out[0] * persinv[0][3]) +
-             (out[1] * persinv[1][3]) +
-             (out[2] * persinv[2][3]) + persinv[3][3])
+        w = out.dot(persinv[3].xyz) + persinv[3][3]
 
-        return ((persinv * out) / w) - rv3d.view_matrix.inverted()[3].xyz
+        return ((persinv * out) / w) - viewinv.translation
     else:
-        return rv3d.view_matrix.inverted()[2].xyz.normalized()
+        return viewinv.col[2].xyz.normalized()
 
 
 def region_2d_to_location_3d(region, rv3d, coord, depth_location):
@@ -81,15 +80,16 @@ def region_2d_to_location_3d(region, rv3d, coord, depth_location):
     from mathutils.geometry import intersect_point_line
 
     persmat = rv3d.perspective_matrix.copy()
+    viewinv = rv3d.view_matrix.inverted()
     coord_vec = region_2d_to_vector_3d(region, rv3d, coord)
     depth_location = Vector(depth_location)
 
     if rv3d.is_perspective:
         from mathutils.geometry import intersect_line_plane
 
-        origin_start = rv3d.view_matrix.inverted()[3].to_3d()
+        origin_start = viewinv.translation.copy()
         origin_end = origin_start + coord_vec
-        view_vec = rv3d.view_matrix.inverted()[2]
+        view_vec = viewinv.col[2].copy()
         return intersect_line_plane(origin_start,
                                     origin_end,
                                     depth_location,
@@ -100,8 +100,9 @@ def region_2d_to_location_3d(region, rv3d, coord, depth_location):
         dy = (2.0 * coord[1] / region.height) - 1.0
         persinv = persmat.inverted()
         viewinv = rv3d.view_matrix.inverted()
-        origin_start = ((persinv[0].xyz * dx) +
-                        (persinv[1].xyz * dy) + viewinv[3].xyz)
+        origin_start = ((persinv.col[0].xyz * dx) +
+                        (persinv.col[1].xyz * dy) +
+                         viewinv.translation)
         origin_end = origin_start + coord_vec
         return intersect_point_line(depth_location,
                                     origin_start,
index 061c66dc1fa23ab0a738e2172ace70cb5f7fd492..cb21f17cff5cb677a9ff7fe80813619b54b16553 100644 (file)
@@ -188,7 +188,7 @@ class CLIP_OT_delete_proxy(Operator):
             proxydir = clip.proxy.directory
         else:
             clipdir = os.path.dirname(clip.filepath)
-            proxydir = os.path.join(clipdir, 'BL_proxy')
+            proxydir = os.path.join(clipdir, "BL_proxy")
 
         clipfile = os.path.basename(clip.filepath)
         proxy = os.path.join(proxydir, clipfile)
@@ -196,15 +196,15 @@ class CLIP_OT_delete_proxy(Operator):
 
         # proxy_<quality>[_undostorted]
         for x in (25, 50, 75, 100):
-            d = os.path.join(absproxy, 'proxy_' + str(x))
+            d = os.path.join(absproxy, "proxy_%d" % x)
 
             self._rmproxy(d)
-            self._rmproxy(d + '_undistorted')
-            self._rmproxy(os.path.join(absproxy, 'proxy_' + str(x) + '.avi'))
+            self._rmproxy(d + "_undistorted")
+            self._rmproxy(os.path.join(absproxy, "proxy_%d.avi" % x))
 
-        tc = ('free_run.blen_tc',
-              'interp_free_run.blen_tc',
-              'record_run.blen_tc')
+        tc = ("free_run.blen_tc",
+              "interp_free_run.blen_tc",
+              "record_run.blen_tc")
 
         for x in tc:
             self._rmproxy(os.path.join(absproxy, x))
@@ -269,7 +269,7 @@ object's movement caused by this constraint"""
         # TODO: several camera solvers and track followers would fail,
         #       but can't think about eal workflow where it'll be useful
         for x in ob.constraints:
-            if x.type in ('CAMERA_SOLVER', 'FOLLOW_TRACK'):
+            if x.type in {'CAMERA_SOLVER', 'FOLLOW_TRACK'}:
                 con = x
 
         if not con:
@@ -340,7 +340,8 @@ object's movement caused by this constraint"""
 
     def execute(self, context):
         scene = context.scene
-
+        # XXX, should probably use context.selected_editable_objects
+        # since selected objects can be from a lib or in hidden layer!
         for ob in scene.objects:
             if ob.select:
                 self._bake_object(scene, ob)
index 67b9be59f2a0461eb3d86221573a75a538857dc3..39c73f206642d305188d59e7b06823cf8853b7d5 100644 (file)
@@ -60,14 +60,14 @@ class SequencerCrossfadeSounds(Operator):
         if seq1.frame_final_end > seq2.frame_final_start:
             tempcfra = context.scene.frame_current
             context.scene.frame_current = seq2.frame_final_start
-            seq1.keyframe_insert('volume')
+            seq1.keyframe_insert("volume")
             context.scene.frame_current = seq1.frame_final_end
             seq1.volume = 0
-            seq1.keyframe_insert('volume')
-            seq2.keyframe_insert('volume')
+            seq1.keyframe_insert("volume")
+            seq2.keyframe_insert("volume")
             context.scene.frame_current = seq2.frame_final_start
             seq2.volume = 0
-            seq2.keyframe_insert('volume')
+            seq2.keyframe_insert("volume")
             context.scene.frame_current = tempcfra
             return {'FINISHED'}
         else:
index 17e353ff238165a01c27890277001ad7613ae129..b79fc0c01b322722fdc3a31e5b97c483045bab54 100644 (file)
@@ -756,7 +756,7 @@ def VectoQuat(vec):
 
 
 class thickface(object):
-    __slost__= 'v', 'uv', 'no', 'area', 'edge_keys'
+    __slost__= "v", "uv", "no", "area", "edge_keys"
     def __init__(self, face, uvface, mesh_verts):
         self.v = [mesh_verts[i] for i in face.vertices]
         if len(self.v)==4:
index 1da5e2ca381867435b91d427475d8ba66e620040..4f498e72f4b4b40ce288d8799d7e1dc8ec017697 100644 (file)
@@ -29,6 +29,8 @@ from bpy.props import (StringProperty,
 
 from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear
 
+import subprocess
+import os
 
 class MESH_OT_delete_edgeloop(Operator):
     '''Delete an edge loop by merging the faces on each side to a single face loop'''
@@ -764,12 +766,12 @@ class WM_OT_path_open(Operator):
             return {'CANCELLED'}
 
         if sys.platform[:3] == "win":
-            subprocess.Popen(['start', filepath], shell=True)
-        elif sys.platform == 'darwin':
-            subprocess.Popen(['open', filepath])
+            subprocess.Popen(["start", filepath], shell=True)
+        elif sys.platform == "darwin":
+            subprocess.Popen(["open", filepath])
         else:
             try:
-                subprocess.Popen(['xdg-open', filepath])
+                subprocess.Popen(["xdg-open", filepath])
             except OSError:
                 # xdg-open *should* be supported by recent Gnome, KDE, Xfce
                 pass
@@ -845,8 +847,8 @@ class WM_OT_doc_edit(Operator):
         print("sending data:", data_dict)
 
         import xmlrpc.client
-        user = 'blenderuser'
-        pwd = 'blender>user'
+        user = "blenderuser"
+        pwd = "blender>user"
 
         docblog = xmlrpc.client.ServerProxy(self._url)
         docblog.metaWeblog.newPost(1, user, pwd, data_dict, 1)
@@ -984,9 +986,8 @@ class WM_OT_properties_edit(Operator):
         prop_ui = rna_idprop_ui_prop_get(item, prop)
 
         if prop_type in {float, int}:
-
-            prop_ui['soft_min'] = prop_ui['min'] = prop_type(self.min)
-            prop_ui['soft_max'] = prop_ui['max'] = prop_type(self.max)
+            prop_ui["soft_min"] = prop_ui["min"] = prop_type(self.min)
+            prop_ui["soft_max"] = prop_ui["max"] = prop_type(self.max)
 
         prop_ui['description'] = self.description
 
@@ -1033,7 +1034,7 @@ class WM_OT_properties_add(Operator):
         item = eval("context.%s" % data_path)
 
         def unique_name(names):
-            prop = 'prop'
+            prop = "prop"
             prop_new = prop
             i = 1
             while prop_new in names:
@@ -1161,10 +1162,10 @@ class WM_OT_copy_prev_settings(Operator):
 
             # in 2.57 and earlier windows installers, system scripts were copied
             # into the configuration directory, don't want to copy those
-            system_script = os.path.join(path_dst, 'scripts/modules/bpy_types.py')
+            system_script = os.path.join(path_dst, "scripts/modules/bpy_types.py")
             if os.path.isfile(system_script):
-                shutil.rmtree(os.path.join(path_dst, 'scripts'))
-                shutil.rmtree(os.path.join(path_dst, 'plugins'))
+                shutil.rmtree(os.path.join(path_dst, "scripts"))
+                shutil.rmtree(os.path.join(path_dst, "plugins"))
 
             # don't loose users work if they open the splash later.
             if bpy.data.is_saved is bpy.data.is_dirty is False:
@@ -1175,6 +1176,26 @@ class WM_OT_copy_prev_settings(Operator):
 
         return {'CANCELLED'}
 
+class WM_OT_blenderplayer_start(bpy.types.Operator):
+    '''Launch the Blenderplayer with the current blendfile'''
+    bl_idname = "wm.blenderplayer_start"
+    bl_label = "Start"
+    
+    blender_bin_path = bpy.app.binary_path
+    blender_bin_dir = os.path.dirname(blender_bin_path)
+    ext = os.path.splitext(blender_bin_path)[-1]
+    player_path = os.path.join(blender_bin_dir, "blenderplayer" + ext)
+    
+    def execute(self, context):
+        import sys
+
+        if sys.platform == "darwin":
+            self.player_path = os.path.join(self.blender_bin_dir, "../../../blenderplayer.app/Contents/MacOS/blenderplayer")
+       
+        filepath = bpy.app.tempdir + "game.blend"
+        bpy.ops.wm.save_as_mainfile(filepath=filepath, check_existing=False, copy=True)
+        subprocess.call([self.player_path, filepath])
+        return {'FINISHED'}
 
 class WM_OT_keyconfig_test(Operator):
     "Test keyconfig for conflicts"
@@ -1429,7 +1450,7 @@ class WM_OT_operator_cheat_sheet(Operator):
             for op_submodule_name in dir(op_module):
                 op = getattr(op_module, op_submodule_name)
                 text = repr(op)
-                if text.split("\n")[-1].startswith('bpy.ops.'):
+                if text.split("\n")[-1].startswith("bpy.ops."):
                     op_strings.append(text)
                     tot += 1
 
index db65b0ff669cb800dced57aeddae3e386a0ac81a..66b8cca786671484255e306a24a3acaa94083ea9 100644 (file)
@@ -244,16 +244,22 @@ class RenderButtonsPanel():
         return (rd.engine in cls.COMPAT_ENGINES)
 
 
-class RENDER_PT_game(RenderButtonsPanel, Panel):
-    bl_label = "Game"
+class RENDER_PT_embedded(RenderButtonsPanel, bpy.types.Panel):
+    bl_label = "Embedded Player"
     COMPAT_ENGINES = {'BLENDER_GAME'}
-
     def draw(self, context):
         layout = self.layout
 
+        rd = context.scene.render
+
         row = layout.row()
         row.operator("view3d.game_start", text="Start")
         row.label()
+        row = layout.row()
+        row.label(text="Resolution:")
+        row = layout.row(align=True)
+        row.prop(rd, "resolution_x", slider=False, text="X")
+        row.prop(rd, "resolution_y", slider=False, text="Y")
 
 
 class RENDER_PT_game_player(RenderButtonsPanel, Panel):
@@ -264,29 +270,23 @@ class RENDER_PT_game_player(RenderButtonsPanel, Panel):
         layout = self.layout
 
         gs = context.scene.game_settings
-
-        layout.prop(gs, "show_fullscreen")
-
-        split = layout.split()
-
-        col = split.column()
-        col.label(text="Resolution:")
-        sub = col.column(align=True)
-        sub.prop(gs, "resolution_x", slider=False, text="X")
-        sub.prop(gs, "resolution_y", slider=False, text="Y")
-
-        col = split.column()
+        
+        row = layout.row()
+        row.operator("wm.blenderplayer_start", text="Start")
+        row.prop(gs, "show_fullscreen")
+        
+        row = layout.row()
+        row.label(text="Resolution:")
+        row = layout.row(align=True)
+        row.prop(gs, "resolution_x", slider=False, text="X")
+        row.prop(gs, "resolution_y", slider=False, text="Y")
+        
+        col = layout.column()
         col.label(text="Quality:")
-        sub = col.column(align=True)
-        sub.prop(gs, "depth", text="Bit Depth", slider=False)
-        sub.prop(gs, "frequency", text="FPS", slider=False)
+        col = layout.column(align=True)
+        col.prop(gs, "depth", text="Bit Depth", slider=False)
+        col.prop(gs, "frequency", text="Refresh Rate", slider=False)
 
-        # framing:
-        col = layout.column()
-        col.label(text="Framing:")
-        col.row().prop(gs, "frame_type", expand=True)
-        if gs.frame_type == 'LETTERBOX':
-            col.prop(gs, "frame_color", text="")
 
 
 class RENDER_PT_game_stereo(RenderButtonsPanel, Panel):
@@ -368,20 +368,24 @@ class RENDER_PT_game_shading(RenderButtonsPanel, Panel):
             col.prop(gs, "use_glsl_extra_textures", text="Extra Textures")
 
 
-class RENDER_PT_game_performance(RenderButtonsPanel, Panel):
-    bl_label = "Performance"
+class RENDER_PT_game_system(RenderButtonsPanel, Panel):
+    bl_label = "System"
     COMPAT_ENGINES = {'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
 
         gs = context.scene.game_settings
-        col = layout.column()
-        row = col.row()
+        row = layout.row()
         row.prop(gs, "use_frame_rate")
+        row.prop(gs, "restrict_animation_updates")
+
+        row = layout.row()
         row.prop(gs, "use_display_lists")
 
-        col.prop(gs, "restrict_animation_updates")
+        row = layout.row()
+        row.label("Exit Key")
+        row.prop(gs, "exit_key", text="", event=True)
 
 
 class RENDER_PT_game_display(RenderButtonsPanel, Panel):
@@ -391,6 +395,9 @@ class RENDER_PT_game_display(RenderButtonsPanel, Panel):
     def draw(self, context):
         layout = self.layout
 
+        row = layout.row()
+        row.prop(context.scene.render, "fps", text="Animation Frame Rate", slider=False)
+
         gs = context.scene.game_settings
         flow = layout.column_flow()
         flow.prop(gs, "show_debug_properties", text="Debug Properties")
@@ -399,6 +406,12 @@ class RENDER_PT_game_display(RenderButtonsPanel, Panel):
         flow.prop(gs, "use_deprecation_warnings")
         flow.prop(gs, "show_mouse", text="Mouse Cursor")
 
+        col = layout.column()
+        col.label(text="Framing:")
+        col.row().prop(gs, "frame_type", expand=True)
+        if gs.frame_type == 'LETTERBOX':
+            col.prop(gs, "frame_color", text="")
+
 
 class SceneButtonsPanel():
     bl_space_type = 'PROPERTIES'
@@ -463,6 +476,20 @@ class SCENE_PT_game_navmesh(SceneButtonsPanel, Panel):
         row.prop(rd, "sample_dist")
         row.prop(rd, "sample_max_error")
 
+class RENDER_PT_game_sound(RenderButtonsPanel, Panel):
+    bl_label = "Sound"
+    COMPAT_ENGINES = {'BLENDER_GAME'}
+
+    def draw(self, context):
+        layout = self.layout
+
+        scene = context.scene
+
+        layout.prop(scene, "audio_distance_model")
+
+        col = layout.column(align=True)
+        col.prop(scene, "audio_doppler_speed", text="Speed")
+        col.prop(scene, "audio_doppler_factor")
 
 class WorldButtonsPanel():
     bl_space_type = 'PROPERTIES'
index f7f67527b639f5030bd7c52a1d03233c0c93b38d..b19cf0032afdd8d8d66ff9098fbefb3a937233d3 100644 (file)
@@ -76,7 +76,7 @@ class ParticleButtonsPanel():
 class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel):
     bl_label = ""
     bl_options = {'HIDE_HEADER'}
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     @classmethod
     def poll(cls, context):
@@ -85,6 +85,10 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, Panel):
 
     def draw(self, context):
         layout = self.layout
+        
+        if context.scene.render.engine == "BLENDER_GAME":
+            layout.label("Not available in the Game Engine")
+            return
 
         ob = context.object
         psys = context.particle_system
index 94c5c5c9b40a4ad98e92432f489e5d87d52b5aaf..f77d3f6fbe4f4bc220e2a54af63f2690b7538189 100644 (file)
@@ -51,7 +51,7 @@ class RenderButtonsPanel():
     @classmethod
     def poll(cls, context):
         rd = context.scene.render
-        return (context.scene and rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES)
+        return context.scene and (rd.engine in cls.COMPAT_ENGINES)
 
 
 class RENDER_PT_render(RenderButtonsPanel, Panel):
@@ -1077,7 +1077,7 @@ class RENDER_PT_encoding(RenderButtonsPanel, Panel):
 class RENDER_PT_bake(RenderButtonsPanel, Panel):
     bl_label = "Bake"
     bl_options = {'DEFAULT_CLOSED'}
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
index 05f4887a5424403a45fde839c0b9acce401b5d47..b7218e4ba47ccde8cf6af7461b12a9ec840c47c6 100644 (file)
@@ -29,12 +29,13 @@ class SceneButtonsPanel():
 
     @classmethod
     def poll(cls, context):
-        return context.scene
+        rd = context.scene.render
+        return context.scene and (rd.engine in cls.COMPAT_ENGINES)
 
 
 class SCENE_PT_scene(SceneButtonsPanel, Panel):
     bl_label = "Scene"
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -75,7 +76,7 @@ class SCENE_PT_audio(SceneButtonsPanel, Panel):
 
 class SCENE_PT_unit(SceneButtonsPanel, Panel):
     bl_label = "Units"
-    COMPAT_ENGINES = {'BLENDER_RENDER'}
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -93,6 +94,7 @@ class SCENE_PT_unit(SceneButtonsPanel, Panel):
 
 class SCENE_PT_keying_sets(SceneButtonsPanel, Panel):
     bl_label = "Keying Sets"
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     def draw(self, context):
         layout = self.layout
@@ -125,6 +127,7 @@ class SCENE_PT_keying_sets(SceneButtonsPanel, Panel):
 
 class SCENE_PT_keying_set_paths(SceneButtonsPanel, Panel):
     bl_label = "Active Keying Set"
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
 
     @classmethod
     def poll(cls, context):
index 1ae8095fab3475e49978c4cde32a7e382a748610..1fc58475ace5773f42e2738c0333abcd94a7acc0 100644 (file)
@@ -70,7 +70,9 @@ class LOGIC_HT_header(Header):
         layout.template_header()
 
         if context.area.show_menus:
-            layout.menu("LOGIC_MT_view")
+            row = layout.row(align=True)
+            row.menu("LOGIC_MT_view")
+            row.menu("LOGIC_MT_logicbricks_add")
 
 
 class LOGIC_MT_view(Menu):
index 69766b54e9755c54db9943fc9ee5da98f1bf4570..318ba8eab8ad7f21be8f036be94eecd88754d811 100644 (file)
@@ -156,6 +156,7 @@ class NODE_MT_node(Menu):
         layout.operator("node.mute_toggle")
         layout.operator("node.preview_toggle")
         layout.operator("node.hide_socket_toggle")
+        layout.operator("node.options_toggle")
 
         layout.separator()
 
index c3b2e30cb1250a0221ee4b454bf930668cd6b0f6..7249e9522fff6023c27341edffcba18e27123a9e 100644 (file)
@@ -174,9 +174,7 @@ class TEXT_MT_text(Menu):
         st = context.space_data
         text = st.text
 
-        layout.operator_context = 'EXEC_AREA'
         layout.operator("text.new")
-        layout.operator_context = 'INVOKE_AREA'
         layout.operator("text.open")
 
         if text:
index 0d118c7b93f7500e6453c62e58182be93e333575..f018e6fc86fabe954fc21c749bb6e6bb99ed5020 100644 (file)
@@ -993,6 +993,7 @@ class VIEW3D_MT_object_game(Menu):
         layout = self.layout
 
         layout.operator("object.logic_bricks_copy", text="Copy Logic Bricks")
+        layout.operator("object.game_physics_copy", text="Copy Physics Properties")
 
         layout.separator()
 
@@ -2258,6 +2259,8 @@ class VIEW3D_PT_view3d_meshdisplay(Panel):
         col.prop(mesh, "show_extra_edge_length")
         col.prop(mesh, "show_extra_face_angle")
         col.prop(mesh, "show_extra_face_area")
+        if bpy.app.debug:
+          col.prop(mesh, "show_extra_indices")
 
 
 class VIEW3D_PT_view3d_curvedisplay(Panel):
index ddbc9a6a76064dd3372557e91a3cd0f67c4079af..ce53b76da01fcabf8ad56de47e41fb77227fd619 100644 (file)
@@ -33,6 +33,8 @@
 #ifndef BLF_TRANSLATION_H
 #define BLF_TRANSLATION_H
 
+#define TEXT_DOMAIN_NAME "blender"
+
 /* blf_translation.c  */
 
 #ifdef WITH_INTERNATIONAL
@@ -40,7 +42,8 @@ unsigned char *BLF_get_unifont(int *unifont_size);
 void BLF_free_unifont(void);
 #endif
 
-const char* BLF_gettext(const char *msgid);
+const char *BLF_gettext(const char *msgid);
+const char *BLF_pgettext(const char *context, const char *message);
 
 /* blf_lang.c */
 
index 2ba23e501b4fa68eeb818e49eb5ef58353abb576..6c27beb14a7149aa155b74aefce85562c8f6d1b8 100644 (file)
@@ -32,6 +32,8 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "BKE_global.h"
+
 #include "BLF_api.h"
 
 #include "BLF_translation.h" /* own include */
@@ -58,7 +60,6 @@
 #include "BLI_utildefines.h"
 #include "BLI_path_util.h"
 
-#define DOMAIN_NAME "blender"
 #define SYSTEM_ENCODING_DEFAULT "UTF-8"
 #define FONT_SIZE_DEFAULT 12
 
@@ -82,8 +83,13 @@ static const char *locales[] = {
        "catalan", "ca_AD",
        "czech", "cs_CZ",
        "ptb", "pt_BR",
+#if defined (_WIN32) && !defined(FREE_WINDOWS)
        "Chinese (Simplified)_China.1252", "zh_CN",
        "Chinese (Traditional)_China.1252", "zh_TW",
+#else
+       "chs", "zh_CN",
+       "cht", "zh_TW",
+#endif
        "russian", "ru_RU",
        "croatian", "hr_HR",
        "serbian", "sr_RS",
@@ -96,7 +102,8 @@ static const char *locales[] = {
        "korean", "ko_KR",
        "nepali", "ne_NP",
        "persian", "fa_PE",
-       "indonesian", "id_ID"
+       "indonesian", "id_ID",
+       "serbian (latin)", "sr_RS@latin",
 };
 
 void BLF_lang_init(void)
@@ -115,15 +122,50 @@ void BLF_lang_init(void)
        
 }
 
+/* get LANG/LANGUAGE environment variable */
+static void get_language_variable(const char *varname, char *var, int maxlen)
+{
+       char *env= getenv(varname);
+
+       if(env) {
+               char *s;
+
+               /* store defaul locale */
+               BLI_strncpy(var, env, maxlen);
+
+               /* use first language as default */
+               s= strchr(var, ':');
+               if(s)
+                       s[0]= 0;
+       }
+}
+
+/* get language to be used based on locale(which might be empty when using default language)&nb