Merged changes in the trunk up to revision 51853.
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Sun, 4 Nov 2012 02:22:56 +0000 (02:22 +0000)
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>
Sun, 4 Nov 2012 02:22:56 +0000 (02:22 +0000)
Conflicts resolved:
source/blender/blenloader/intern/readfile.c
source/blender/bmesh/operators/bmo_utils.c

This commit also includes a fix of a bug identified during the merge and committed in revision 51853.
Thanks Thomas (dingto) for the timely fix!

401 files changed:
CMakeLists.txt
build_files/buildbot/config/user-config-glibc211-i686.py
build_files/buildbot/config/user-config-glibc211-x86_64.py
build_files/buildbot/config/user-config-player-glibc211-i686.py
build_files/buildbot/config/user-config-player-glibc211-x86_64.py
build_files/buildbot/slave_compile.py
build_files/buildbot/slave_pack.py
build_files/scons/tools/btools.py
doc/python_api/sphinx_doc_gen.py
intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
intern/audaspace/intern/AUD_SoftwareDevice.cpp
intern/bsp/extern/CSG_BooleanOps.h
intern/bsp/intern/BOP_CarveInterface.cpp
intern/container/CMakeLists.txt
intern/cycles/SConscript
intern/cycles/blender/CMakeLists.txt
intern/cycles/blender/addon/__init__.py
intern/cycles/blender/addon/engine.py
intern/cycles/blender/addon/enums.py
intern/cycles/blender/addon/osl.py [new file with mode: 0644]
intern/cycles/blender/blender_mesh.cpp
intern/cycles/blender/blender_object.cpp
intern/cycles/blender/blender_python.cpp
intern/cycles/blender/blender_shader.cpp
intern/cycles/blender/blender_util.h
intern/cycles/kernel/CMakeLists.txt
intern/cycles/kernel/closure/bsdf_microfacet.h
intern/cycles/kernel/kernel_triangle.h
intern/cycles/kernel/osl/CMakeLists.txt
intern/cycles/kernel/osl/osl_services.cpp
intern/cycles/kernel/shaders/CMakeLists.txt [moved from intern/cycles/kernel/osl/nodes/CMakeLists.txt with 89% similarity]
intern/cycles/kernel/shaders/node_add_closure.osl [moved from intern/cycles/kernel/osl/nodes/node_add_closure.osl with 100% similarity]
intern/cycles/kernel/shaders/node_attribute.osl [moved from intern/cycles/kernel/osl/nodes/node_attribute.osl with 100% similarity]
intern/cycles/kernel/shaders/node_background.osl [moved from intern/cycles/kernel/osl/nodes/node_background.osl with 100% similarity]
intern/cycles/kernel/shaders/node_brick_texture.osl [moved from intern/cycles/kernel/osl/nodes/node_brick_texture.osl with 100% similarity]
intern/cycles/kernel/shaders/node_brightness.osl [moved from intern/cycles/kernel/osl/nodes/node_brightness.osl with 100% similarity]
intern/cycles/kernel/shaders/node_bump.osl [moved from intern/cycles/kernel/osl/nodes/node_bump.osl with 100% similarity]
intern/cycles/kernel/shaders/node_camera.osl [moved from intern/cycles/kernel/osl/nodes/node_camera.osl with 100% similarity]
intern/cycles/kernel/shaders/node_checker_texture.osl [moved from intern/cycles/kernel/osl/nodes/node_checker_texture.osl with 100% similarity]
intern/cycles/kernel/shaders/node_color.h [moved from intern/cycles/kernel/osl/nodes/node_color.h with 100% similarity]
intern/cycles/kernel/shaders/node_combine_rgb.osl [moved from intern/cycles/kernel/osl/nodes/node_combine_rgb.osl with 100% similarity]
intern/cycles/kernel/shaders/node_convert_from_color.osl [moved from intern/cycles/kernel/osl/nodes/node_convert_from_color.osl with 100% similarity]
intern/cycles/kernel/shaders/node_convert_from_float.osl [moved from intern/cycles/kernel/osl/nodes/node_convert_from_float.osl with 100% similarity]
intern/cycles/kernel/shaders/node_convert_from_int.osl [moved from intern/cycles/kernel/osl/nodes/node_convert_from_int.osl with 100% similarity]
intern/cycles/kernel/shaders/node_convert_from_normal.osl [moved from intern/cycles/kernel/osl/nodes/node_convert_from_normal.osl with 100% similarity]
intern/cycles/kernel/shaders/node_convert_from_point.osl [moved from intern/cycles/kernel/osl/nodes/node_convert_from_point.osl with 100% similarity]
intern/cycles/kernel/shaders/node_convert_from_vector.osl [moved from intern/cycles/kernel/osl/nodes/node_convert_from_vector.osl with 100% similarity]
intern/cycles/kernel/shaders/node_diffuse_bsdf.osl [moved from intern/cycles/kernel/osl/nodes/node_diffuse_bsdf.osl with 100% similarity]
intern/cycles/kernel/shaders/node_emission.osl [moved from intern/cycles/kernel/osl/nodes/node_emission.osl with 100% similarity]
intern/cycles/kernel/shaders/node_environment_texture.osl [moved from intern/cycles/kernel/osl/nodes/node_environment_texture.osl with 100% similarity]
intern/cycles/kernel/shaders/node_fresnel.h [moved from intern/cycles/kernel/osl/nodes/node_fresnel.h with 100% similarity]
intern/cycles/kernel/shaders/node_fresnel.osl [moved from intern/cycles/kernel/osl/nodes/node_fresnel.osl with 100% similarity]
intern/cycles/kernel/shaders/node_gamma.osl [moved from intern/cycles/kernel/osl/nodes/node_gamma.osl with 100% similarity]
intern/cycles/kernel/shaders/node_geometry.osl [moved from intern/cycles/kernel/osl/nodes/node_geometry.osl with 100% similarity]
intern/cycles/kernel/shaders/node_glass_bsdf.osl [moved from intern/cycles/kernel/osl/nodes/node_glass_bsdf.osl with 91% similarity]
intern/cycles/kernel/shaders/node_glossy_bsdf.osl [moved from intern/cycles/kernel/osl/nodes/node_glossy_bsdf.osl with 90% similarity]
intern/cycles/kernel/shaders/node_gradient_texture.osl [moved from intern/cycles/kernel/osl/nodes/node_gradient_texture.osl with 100% similarity]
intern/cycles/kernel/shaders/node_holdout.osl [moved from intern/cycles/kernel/osl/nodes/node_holdout.osl with 100% similarity]
intern/cycles/kernel/shaders/node_hsv.osl [moved from intern/cycles/kernel/osl/nodes/node_hsv.osl with 100% similarity]
intern/cycles/kernel/shaders/node_image_texture.osl [moved from intern/cycles/kernel/osl/nodes/node_image_texture.osl with 100% similarity]
intern/cycles/kernel/shaders/node_invert.osl [moved from intern/cycles/kernel/osl/nodes/node_invert.osl with 100% similarity]
intern/cycles/kernel/shaders/node_layer_weight.osl [moved from intern/cycles/kernel/osl/nodes/node_layer_weight.osl with 100% similarity]
intern/cycles/kernel/shaders/node_light_falloff.osl [moved from intern/cycles/kernel/osl/nodes/node_light_falloff.osl with 96% similarity]
intern/cycles/kernel/shaders/node_light_path.osl [moved from intern/cycles/kernel/osl/nodes/node_light_path.osl with 96% similarity]
intern/cycles/kernel/shaders/node_magic_texture.osl [moved from intern/cycles/kernel/osl/nodes/node_magic_texture.osl with 100% similarity]
intern/cycles/kernel/shaders/node_mapping.osl [moved from intern/cycles/kernel/osl/nodes/node_mapping.osl with 100% similarity]
intern/cycles/kernel/shaders/node_math.osl [moved from intern/cycles/kernel/osl/nodes/node_math.osl with 100% similarity]
intern/cycles/kernel/shaders/node_mix.osl [moved from intern/cycles/kernel/osl/nodes/node_mix.osl with 100% similarity]
intern/cycles/kernel/shaders/node_mix_closure.osl [moved from intern/cycles/kernel/osl/nodes/node_mix_closure.osl with 100% similarity]
intern/cycles/kernel/shaders/node_musgrave_texture.osl [moved from intern/cycles/kernel/osl/nodes/node_musgrave_texture.osl with 100% similarity]
intern/cycles/kernel/shaders/node_noise_texture.osl [moved from intern/cycles/kernel/osl/nodes/node_noise_texture.osl with 100% similarity]
intern/cycles/kernel/shaders/node_normal.osl [moved from intern/cycles/kernel/osl/nodes/node_normal.osl with 100% similarity]
intern/cycles/kernel/shaders/node_object_info.osl [moved from intern/cycles/kernel/osl/nodes/node_object_info.osl with 83% similarity]
intern/cycles/kernel/shaders/node_output_displacement.osl [moved from intern/cycles/kernel/osl/nodes/node_output_displacement.osl with 100% similarity]
intern/cycles/kernel/shaders/node_output_surface.osl [moved from intern/cycles/kernel/osl/nodes/node_output_surface.osl with 100% similarity]
intern/cycles/kernel/shaders/node_output_volume.osl [moved from intern/cycles/kernel/osl/nodes/node_output_volume.osl with 100% similarity]
intern/cycles/kernel/shaders/node_particle_info.osl [moved from intern/cycles/kernel/osl/nodes/node_particle_info.osl with 75% similarity]
intern/cycles/kernel/shaders/node_rgb_ramp.osl [moved from intern/cycles/kernel/osl/nodes/node_rgb_ramp.osl with 100% similarity]
intern/cycles/kernel/shaders/node_separate_rgb.osl [moved from intern/cycles/kernel/osl/nodes/node_separate_rgb.osl with 100% similarity]
intern/cycles/kernel/shaders/node_set_normal.osl [moved from intern/cycles/kernel/osl/nodes/node_set_normal.osl with 100% similarity]
intern/cycles/kernel/shaders/node_sky_texture.osl [moved from intern/cycles/kernel/osl/nodes/node_sky_texture.osl with 100% similarity]
intern/cycles/kernel/shaders/node_texture.h [moved from intern/cycles/kernel/osl/nodes/node_texture.h with 100% similarity]
intern/cycles/kernel/shaders/node_texture_coordinate.osl [moved from intern/cycles/kernel/osl/nodes/node_texture_coordinate.osl with 92% similarity]
intern/cycles/kernel/shaders/node_translucent_bsdf.osl [moved from intern/cycles/kernel/osl/nodes/node_translucent_bsdf.osl with 100% similarity]
intern/cycles/kernel/shaders/node_transparent_bsdf.osl [moved from intern/cycles/kernel/osl/nodes/node_transparent_bsdf.osl with 100% similarity]
intern/cycles/kernel/shaders/node_value.osl [moved from intern/cycles/kernel/osl/nodes/node_value.osl with 100% similarity]
intern/cycles/kernel/shaders/node_vector_math.osl [moved from intern/cycles/kernel/osl/nodes/node_vector_math.osl with 100% similarity]
intern/cycles/kernel/shaders/node_velvet_bsdf.osl [moved from intern/cycles/kernel/osl/nodes/node_velvet_bsdf.osl with 94% similarity]
intern/cycles/kernel/shaders/node_voronoi_texture.osl [moved from intern/cycles/kernel/osl/nodes/node_voronoi_texture.osl with 100% similarity]
intern/cycles/kernel/shaders/node_ward_bsdf.osl [moved from intern/cycles/kernel/osl/nodes/node_ward_bsdf.osl with 100% similarity]
intern/cycles/kernel/shaders/node_wave_texture.osl [moved from intern/cycles/kernel/osl/nodes/node_wave_texture.osl with 100% similarity]
intern/cycles/kernel/shaders/oslutil.h [moved from intern/cycles/kernel/osl/nodes/oslutil.h with 100% similarity]
intern/cycles/kernel/shaders/stdosl.h [moved from intern/cycles/kernel/osl/nodes/stdosl.h with 78% similarity]
intern/cycles/kernel/svm/svm_geometry.h
intern/cycles/render/attribute.cpp
intern/cycles/render/mesh.cpp
intern/cycles/render/nodes.cpp
intern/cycles/render/nodes.h
intern/cycles/render/osl.cpp
intern/cycles/render/osl.h
intern/cycles/render/shader.cpp
intern/cycles/render/shader.h
intern/cycles/render/svm.cpp
intern/cycles/util/util_md5.h
intern/cycles/util/util_path.cpp
intern/cycles/util/util_path.h
intern/ffmpeg/ffmpeg_compat.h
intern/ghost/intern/GHOST_SystemCocoa.mm
intern/itasc/CMakeLists.txt
intern/smoke/intern/smoke_API.cpp
intern/utfconv/utfconv.h
release/scripts/modules/bl_i18n_utils/settings.py
release/scripts/modules/bl_i18n_utils/update_languages_menu.py
release/scripts/startup/bl_operators/presets.py
release/scripts/startup/bl_operators/wm.py
release/scripts/startup/bl_ui/properties_data_lamp.py
release/scripts/startup/bl_ui/properties_game.py
release/scripts/startup/bl_ui/properties_render.py
release/scripts/startup/bl_ui/space_info.py
release/scripts/startup/bl_ui/space_node.py
release/scripts/startup/bl_ui/space_text.py
release/scripts/startup/bl_ui/space_userpref_keymap.py
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenfont/intern/blf_lang.c
source/blender/blenkernel/BKE_DerivedMesh.h
source/blender/blenkernel/BKE_colortools.h
source/blender/blenkernel/BKE_customdata.h
source/blender/blenkernel/BKE_deform.h
source/blender/blenkernel/BKE_idprop.h
source/blender/blenkernel/BKE_node.h
source/blender/blenkernel/BKE_subsurf.h
source/blender/blenkernel/BKE_tracking.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/blender.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/colortools.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/deform.c
source/blender/blenkernel/intern/idprop.c
source/blender/blenkernel/intern/implicit.c
source/blender/blenkernel/intern/mask.c
source/blender/blenkernel/intern/mask_rasterize.c
source/blender/blenkernel/intern/mball.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/mesh_validate.c
source/blender/blenkernel/intern/multires.c
source/blender/blenkernel/intern/navmesh_conversion.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/paint.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenkernel/intern/text.c
source/blender/blenkernel/intern/texture.c
source/blender/blenkernel/intern/tracking.c
source/blender/blenkernel/intern/unit.c
source/blender/blenlib/BLI_math_matrix.h
source/blender/blenlib/BLI_string.h
source/blender/blenlib/intern/BLI_kdopbvh.c
source/blender/blenlib/intern/math_matrix.c
source/blender/blenlib/intern/math_rotation.c
source/blender/blenlib/intern/noise.c
source/blender/blenlib/intern/string.c
source/blender/blenlib/intern/string_utf8.c
source/blender/blenlib/intern/voronoi.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/bmesh/CMakeLists.txt
source/blender/bmesh/intern/bmesh_decimate_collapse.c
source/blender/bmesh/intern/bmesh_decimate_dissolve.c
source/blender/bmesh/intern/bmesh_interp.c
source/blender/bmesh/intern/bmesh_marking.c
source/blender/bmesh/intern/bmesh_mesh.c
source/blender/bmesh/intern/bmesh_mesh_conv.c
source/blender/bmesh/intern/bmesh_opdefines.c
source/blender/bmesh/intern/bmesh_operators.c
source/blender/bmesh/intern/bmesh_operators.h
source/blender/bmesh/intern/bmesh_polygon.c
source/blender/bmesh/intern/bmesh_queries.c
source/blender/bmesh/intern/bmesh_walkers_impl.c
source/blender/bmesh/operators/bmo_primitive.c
source/blender/bmesh/operators/bmo_removedoubles.c
source/blender/bmesh/operators/bmo_similar.c [new file with mode: 0644]
source/blender/bmesh/operators/bmo_smooth_laplacian.c
source/blender/bmesh/operators/bmo_subdivide.c
source/blender/bmesh/operators/bmo_utils.c
source/blender/collada/AnimationExporter.h
source/blender/collada/ArmatureImporter.h
source/blender/collada/DocumentExporter.cpp
source/blender/collada/GeometryExporter.cpp
source/blender/collada/SceneExporter.cpp
source/blender/collada/collada_internal.h
source/blender/collada/collada_utils.cpp
source/blender/collada/collada_utils.h
source/blender/compositor/intern/COM_ExecutionSystem.cpp
source/blender/compositor/intern/COM_ExecutionSystem.h
source/blender/compositor/intern/COM_InputSocket.cpp
source/blender/compositor/intern/COM_InputSocket.h
source/blender/compositor/intern/COM_MemoryBuffer.cpp
source/blender/compositor/intern/COM_NodeOperation.h
source/blender/compositor/intern/COM_OutputSocket.cpp
source/blender/compositor/intern/COM_OutputSocket.h
source/blender/compositor/intern/COM_WorkScheduler.cpp
source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp
source/blender/compositor/nodes/COM_SeparateRGBANode.cpp
source/blender/compositor/nodes/COM_ViewerNode.cpp
source/blender/compositor/operations/COM_BokehBlurOperation.h
source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
source/blender/compositor/operations/COM_MovieDistortionOperation.cpp
source/blender/compositor/operations/COM_OutputFileOperation.cpp
source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp
source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
source/blender/compositor/operations/COM_WriteBufferOperation.cpp
source/blender/datatoc/datatoc.c
source/blender/editors/animation/anim_channels_defines.c
source/blender/editors/animation/fmodifier_ui.c
source/blender/editors/animation/keyframing.c
source/blender/editors/armature/meshlaplacian.c
source/blender/editors/curve/editcurve.c
source/blender/editors/curve/editfont.c
source/blender/editors/gpencil/gpencil_paint.c
source/blender/editors/include/ED_mask.h
source/blender/editors/include/ED_mesh.h
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_intern.h
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/interface/view2d.c
source/blender/editors/mask/mask_draw.c
source/blender/editors/mesh/CMakeLists.txt
source/blender/editors/mesh/editface.c
source/blender/editors/mesh/editmesh_bvh.c
source/blender/editors/mesh/editmesh_select.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/mesh_data.c
source/blender/editors/mesh/mesh_intern.h
source/blender/editors/mesh/mesh_ops.c
source/blender/editors/mesh/meshtools.c
source/blender/editors/object/object_bake.c
source/blender/editors/object/object_vgroup.c
source/blender/editors/physics/physics_fluid.c
source/blender/editors/render/render_internal.c
source/blender/editors/render/render_opengl.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_utils.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/space_console/console_ops.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_file/fsmenu.c
source/blender/editors/space_logic/logic_window.c
source/blender/editors/space_logic/space_logic.c
source/blender/editors/space_node/drawnode.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_templates.c
source/blender/editors/space_outliner/outliner_tools.c
source/blender/editors/space_sequencer/sequencer_select.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_project.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_snap.c
source/blender/editors/util/crazyspace.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/editors/uvedit/uvedit_unwrap_ops.c
source/blender/gpu/GPU_buffers.h
source/blender/gpu/intern/gpu_buffers.c
source/blender/gpu/intern/gpu_codegen.c
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/cineon/CMakeLists.txt
source/blender/imbuf/intern/cineon/logImageLib.c [deleted file]
source/blender/imbuf/intern/colormanagement.c
source/blender/imbuf/intern/dds/CMakeLists.txt
source/blender/imbuf/intern/dds/Common.h
source/blender/imbuf/intern/dds/DirectDrawSurface.cpp
source/blender/imbuf/intern/dds/DirectDrawSurface.h
source/blender/imbuf/intern/dds/FlipDXT.cpp
source/blender/imbuf/intern/indexer.c
source/blender/imbuf/intern/openexr/CMakeLists.txt
source/blender/imbuf/intern/openexr/openexr_api.cpp
source/blender/makesdna/DNA_customdata_types.h
source/blender/makesdna/DNA_node_types.h
source/blender/makesdna/DNA_object_types.h
source/blender/makesrna/RNA_access.h
source/blender/makesrna/RNA_types.h
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_action.c
source/blender/makesrna/intern/rna_animation.c
source/blender/makesrna/intern/rna_armature.c
source/blender/makesrna/intern/rna_color.c
source/blender/makesrna/intern/rna_curve.c
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_fcurve.c
source/blender/makesrna/intern/rna_gpencil.c
source/blender/makesrna/intern/rna_main.c
source/blender/makesrna/intern/rna_main_api.c
source/blender/makesrna/intern/rna_mask.c
source/blender/makesrna/intern/rna_material.c
source/blender/makesrna/intern/rna_mesh.c
source/blender/makesrna/intern/rna_mesh_api.c
source/blender/makesrna/intern/rna_meta.c
source/blender/makesrna/intern/rna_nla.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_nodetree_types.h
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_object_api.c
source/blender/makesrna/intern/rna_pose.c
source/blender/makesrna/intern/rna_render.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_scene_api.c
source/blender/makesrna/intern/rna_sequencer.c
source/blender/makesrna/intern/rna_sequencer_api.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_tracking.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/makesrna/intern/rna_wm.c
source/blender/makesrna/intern/rna_wm_api.c
source/blender/modifiers/intern/MOD_array.c
source/blender/modifiers/intern/MOD_boolean_util.c
source/blender/modifiers/intern/MOD_explode.c
source/blender/modifiers/intern/MOD_laplaciansmooth.c
source/blender/modifiers/intern/MOD_mask.c
source/blender/modifiers/intern/MOD_ocean.c
source/blender/modifiers/intern/MOD_skin.c
source/blender/nodes/CMakeLists.txt
source/blender/nodes/NOD_shader.h
source/blender/nodes/shader/node_shader_tree.c
source/blender/nodes/shader/nodes/node_shader_script.c [new file with mode: 0644]
source/blender/nodes/shader/nodes/node_shader_tex_environment.c
source/blender/python/generic/idprop_py_api.c
source/blender/python/generic/idprop_py_api.h
source/blender/python/intern/bpy_props.c
source/blender/python/intern/bpy_rna.c
source/blender/python/mathutils/mathutils_Matrix.c
source/blender/quicktime/apple/qtkit_export.m
source/blender/quicktime/apple/qtkit_import.m
source/blender/render/extern/include/RE_engine.h
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/external_engine.c
source/blender/render/intern/source/imagetexture.c
source/blender/render/intern/source/rendercore.c
source/blender/render/intern/source/strand.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/WM_keymap.h
source/blender/windowmanager/WM_types.h
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_files.c
source/blender/windowmanager/intern/wm_init_exit.c
source/blender/windowmanager/intern/wm_jobs.c
source/blender/windowmanager/intern/wm_keymap.c
source/blender/windowmanager/intern/wm_operators.c
source/blender/windowmanager/intern/wm_playanim.c
source/blender/windowmanager/intern/wm_subwindow.c
source/blender/windowmanager/intern/wm_window.c
source/blender/windowmanager/wm_event_types.h
source/blenderplayer/bad_level_call_stubs/stubs.c
source/creator/CMakeLists.txt
source/gameengine/BlenderRoutines/KX_BlenderInputDevice.h
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Converter/KX_ConvertSensors.cpp
source/gameengine/GameLogic/SCA_RandomActuator.cpp
source/gameengine/GamePlayer/CMakeLists.txt
source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
source/gameengine/Ketsji/BL_BlenderShader.cpp
source/gameengine/Ketsji/KX_BlenderMaterial.cpp
source/gameengine/Ketsji/KX_Camera.cpp
source/gameengine/Ketsji/KX_Camera.h
source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_GameObject.h
source/gameengine/Ketsji/KX_IPOTransform.h
source/gameengine/Ketsji/KX_IPO_SGController.cpp
source/gameengine/Ketsji/KX_KetsjiEngine.cpp
source/gameengine/Ketsji/KX_MouseFocusSensor.h
source/gameengine/Ketsji/KX_ObjectActuator.cpp
source/gameengine/Ketsji/KX_PythonInit.cpp
source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
source/gameengine/Rasterizer/RAS_OpenGLFilters/RAS_Erosion2DFilter.h
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
source/gameengine/VideoTexture/FilterSource.h
source/gameengine/VideoTexture/ImageViewport.cpp
source/tests/CMakeLists.txt
source/tests/bl_test.py

index 5a06011246fc747b77ee1493b9cfd5796fbfd913..b53c6f6b71ff9d062e0ea08dc7477b139e28ccee 100644 (file)
@@ -186,11 +186,11 @@ unset(PLATFORM_DEFAULT)
 
 
 # Modifiers
-option(WITH_MOD_FLUID          "Enable Elbeem Modifier (Fluid Simulation)" ON)
-option(WITH_MOD_SMOKE          "Enable Smoke Modifier (Smoke Simulation)" ON)
-option(WITH_MOD_BOOLEAN                "Enable Boolean Modifier" ON)
-option(WITH_MOD_REMESH         "Enable Remesh Modifier" ON)
-option(WITH_MOD_CLOTH_ELTOPO           "Enable Experimental cloth solver" OFF)
+option(WITH_MOD_FLUID           "Enable Elbeem Modifier (Fluid Simulation)" ON)
+option(WITH_MOD_SMOKE           "Enable Smoke Modifier (Smoke Simulation)" ON)
+option(WITH_MOD_BOOLEAN         "Enable Boolean Modifier" ON)
+option(WITH_MOD_REMESH          "Enable Remesh Modifier" ON)
+option(WITH_MOD_CLOTH_ELTOPO    "Enable Experimental cloth solver" OFF)
 mark_as_advanced(WITH_MOD_CLOTH_ELTOPO)
 option(WITH_MOD_OCEANSIM        "Enable Ocean Modifier" OFF)
 
@@ -658,11 +658,7 @@ if(UNIX AND NOT APPLE)
                        else()
                                set(Boost_USE_MULTITHREADED ON)
                        endif()
-                       if(WITH_CYCLES_OSL)
-                               find_package(Boost 1.34 COMPONENTS filesystem python3 regex system thread) # osl_nodes uses boost_python
-                       else()
-                               find_package(Boost 1.34 COMPONENTS filesystem regex system thread)
-                       endif()
+                       find_package(Boost 1.34 COMPONENTS filesystem regex system thread)
                        mark_as_advanced(Boost_DIR)  # why doesnt boost do this?
                endif()
 
@@ -828,7 +824,7 @@ if(UNIX AND NOT APPLE)
        elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
                set(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
        # Solaris CC
-       elseif(CMAKE_CXX_COMPILER_ID MATCHES "SunPro") 
+       elseif(CMAKE_CXX_COMPILER_ID MATCHES "SunPro")
                set(PLATFORM_CFLAGS "-pipe -features=extensions -fPIC -D__FUNCTION__=__func__")
                
        # Intel C++ Compiler
@@ -1137,12 +1133,6 @@ elseif(WIN32)
                                debug libboost_date_time-${BOOST_DEBUG_POSTFIX} debug libboost_filesystem-${BOOST_DEBUG_POSTFIX}
                                debug libboost_regex-${BOOST_DEBUG_POSTFIX}
                                debug libboost_system-${BOOST_DEBUG_POSTFIX} debug libboost_thread-${BOOST_DEBUG_POSTFIX})
-                               if(WITH_CYCLES_OSL)
-                                       set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
-                                               optimized libboost_python3-${BOOST_POSTFIX}
-                                               debug libboost_python3-${BOOST_DEBUG_POSTFIX})
-                               endif(WITH_CYCLES_OSL)
-                               
                        set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
                endif()
                        
@@ -1323,12 +1313,6 @@ elseif(WIN32)
                                debug boost_date_time-${BOOST_DEBUG_POSTFIX} boost_filesystem-${BOOST_DEBUG_POSTFIX}
                                boost_regex-${BOOST_DEBUG_POSTFIX}
                                boost_system-${BOOST_DEBUG_POSTFIX} boost_thread-${BOOST_DEBUG_POSTFIX})
-                               if(WITH_CYCLES_OSL)
-                                       set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
-                                               optimized libboost_python3-${BOOST_POSTFIX}
-                                               debug libboost_python3-${BOOST_DEBUG_POSTFIX}) 
-                               endif(WITH_CYCLES_OSL)
-                                       
                        set(BOOST_LIBPATH ${BOOST}/lib)
                        set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB -DBOOST_THREAD_USE_LIB ")
                endif()
@@ -1583,11 +1567,7 @@ elseif(APPLE)
        if(WITH_BOOST)
                set(BOOST ${LIBDIR}/boost)
                set(BOOST_INCLUDE_DIR ${BOOST}/include)
-               if(WITH_CYCLES_OSL)
-                       set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_python3-mt boost_regex-mt boost_system-mt boost_thread-mt)
-               else(WITH_CYCLES_OSL)
-                       set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt)
-               endif(WITH_CYCLES_OSL)
+               set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt)
                set(BOOST_LIBPATH ${BOOST}/lib)
                set(BOOST_DEFINITIONS)
        endif()
index d608c6c2e4a802577c425de3425fcdf7ff928a7e..23ab87a6ba3e15b950e419ed3b157d241b54b826 100644 (file)
@@ -37,7 +37,7 @@ BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/
     '${BF_FFMPEG_LIBPATH}/libswscale.a ${BF_FFMPEG_LIBPATH}/libswresample.a ' + \
     '/usr/lib/libxvidcore.a /usr/lib/libx264.a /usr/lib/libmp3lame.a /usr/lib/libvpx.a /usr/lib/libvorbis.a ' + \
     '/usr/lib/libogg.a /usr/lib/libvorbisenc.a /usr/lib/libtheora.a /usr/lib/libschroedinger-1.0.a ' + \
-    '/usr/lib/liborc-0.4.a /usr/lib/libasound.a'
+    '/usr/lib/liborc-0.4.a'
 
 # Don't depend on system's libstdc++
 WITH_BF_STATICCXX = True
index 62da39f37573a7f3a179aa1eb1398faeff8e6dea..84899cc38483c5ed5bb16cfed4a1776b1b10c1ca 100644 (file)
@@ -37,7 +37,7 @@ BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/
     '${BF_FFMPEG_LIBPATH}/libswscale.a ${BF_FFMPEG_LIBPATH}/libswresample.a ' + \
     '/usr/lib/libxvidcore.a /usr/lib/libx264.a /usr/lib/libmp3lame.a /usr/lib/libvpx.a /usr/lib/libvorbis.a ' + \
     '/usr/lib/libogg.a /usr/lib/libvorbisenc.a /usr/lib/libtheora.a /usr/lib/libschroedinger-1.0.a ' + \
-    '/usr/lib/liborc-0.4.a /usr/lib/libasound.a'
+    '/usr/lib/liborc-0.4.a'
 
 # Don't depend on system's libstdc++
 WITH_BF_STATICCXX = True
index d02e527ee9fa6e4a03e162cec960ba664ac86711..3ac061d934f865257930c3be00b3fa3352be6eec 100644 (file)
@@ -23,7 +23,7 @@ BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/
     '${BF_FFMPEG_LIBPATH}/libswscale.a ${BF_FFMPEG_LIBPATH}/libswresample.a ' + \
     '/usr/lib/libxvidcore.a /usr/lib/libx264.a /usr/lib/libmp3lame.a /usr/lib/libvpx.a /usr/lib/libvorbis.a ' + \
     '/usr/lib/libogg.a /usr/lib/libvorbisenc.a /usr/lib/libtheora.a /usr/lib/libschroedinger-1.0.a ' + \
-    '/usr/lib/liborc-0.4.a /usr/lib/libasound.a'
+    '/usr/lib/liborc-0.4.a'
 
 # Don't depend on system's libstdc++
 WITH_BF_STATICCXX = True
index ba7dae2f6d62cb6f8b79a5cdf739c30812d37380..08d277edb7b94145524c3a9290b363b2d8a1956d 100644 (file)
@@ -23,7 +23,7 @@ BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/
     '${BF_FFMPEG_LIBPATH}/libswscale.a ${BF_FFMPEG_LIBPATH}/libswresample.a ' + \
     '/usr/lib/libxvidcore.a /usr/lib/libx264.a /usr/lib/libmp3lame.a /usr/lib/libvpx.a /usr/lib/libvorbis.a ' + \
     '/usr/lib/libogg.a /usr/lib/libvorbisenc.a /usr/lib/libtheora.a /usr/lib/libschroedinger-1.0.a ' + \
-    '/usr/lib/liborc-0.4.a /usr/lib/libasound.a'
+    '/usr/lib/liborc-0.4.a'
 
 # Don't depend on system's libstdc++
 WITH_BF_STATICCXX = True
index 3d8679d6f74539f79d8b67785ac07de0d368f8d5..bedada93a5a801270e8f60fba3eae6dcbf9bce19 100644 (file)
@@ -81,6 +81,12 @@ else:
         elif builder.endswith('linux_glibc27_i386_scons'):
             configs = ['user-config-player-glibc27-i686.py',
                        'user-config-glibc27-i686.py']
+        if builder.endswith('linux_glibc211_x86_64_scons'):
+            configs = ['user-config-player-glibc211-x86_64.py',
+                       'user-config-glibc211-x86_64.py']
+        elif builder.endswith('linux_glibc211_i386_scons'):
+            configs = ['user-config-player-glibc211-i686.py',
+                       'user-config-glibc211-i686.py']
 
         for config in configs:
             config_fpath = os.path.join(config_dir, config)
index f8d59b5a609d68c917a0abe6aa31175f85afbfc9..b7775ef872f8465e89cceaadad2ff5c46e1e66a6 100644 (file)
@@ -63,6 +63,12 @@ if builder.find('scons') != -1:
         elif builder.endswith('linux_glibc27_i386_scons'):
             config = 'user-config-glibc27-i686.py'
             bits = 32
+        if builder.endswith('linux_glibc211_x86_64_scons'):
+            config = 'user-config-glibc211-x86_64.py'
+            bits = 64
+        elif builder.endswith('linux_glibc211_i386_scons'):
+            config = 'user-config-glibc211-i686.py'
+            bits = 32
 
         if config is not None:
             config_fpath = os.path.join(config_dir, config)
index df9c908441eb492a53e7755dc658b44e1cb09411..19652bb7851fb4feb4d8343ae7bf83fad4a18d05 100644 (file)
@@ -662,11 +662,16 @@ def buildslave(target=None, source=None, env=None):
     if platform == 'linux':
         import platform
 
+        if env['BF_INSTALLDIR'].find('glibc27') != -1:
+            glibc="glibc27"
+        elif env['BF_INSTALLDIR'].find('glibc211') != -1:
+            glibc="glibc211"
+
         bitness = platform.architecture()[0]
         if bitness == '64bit':
-            platform = 'linux-glibc27-x86_64'
+            platform = 'linux-' + glibc + '-x86_64'
         elif bitness == '32bit':
-            platform = 'linux-glibc27-i686'
+            platform = 'linux-' + glibc + '-i686'
     if platform == 'darwin':
         platform = 'OSX-' + env['MACOSX_ARCHITECTURE']
 
index bd2f3e8e3bf7327a7fa0f20168d572ba5abc777e..a8e2275e1ae202c097a0ed919d28c5ef3a38ae54 100644 (file)
@@ -918,6 +918,72 @@ def pymodule2sphinx(basepath, module_name, module, title):
 
     file.close()
 
+# Changes in blender will force errors here
+context_type_map = {
+    "active_base": ("ObjectBase", False),
+    "active_bone": ("EditBone", False),
+    "active_object": ("Object", False),
+    "active_operator": ("Operator", False),
+    "active_pose_bone": ("PoseBone", False),
+    "active_node": ("Node", False),
+    "armature": ("Armature", False),
+    "bone": ("Bone", False),
+    "brush": ("Brush", False),
+    "camera": ("Camera", False),
+    "cloth": ("ClothModifier", False),
+    "collision": ("CollisionModifier", False),
+    "curve": ("Curve", False),
+    "dynamic_paint": ("DynamicPaintModifier", False),
+    "edit_bone": ("EditBone", False),
+    "edit_image": ("Image", False),
+    "edit_mask": ("Mask", False),
+    "edit_movieclip": ("MovieClip", False),
+    "edit_object": ("Object", False),
+    "edit_text": ("Text", False),
+    "editable_bones": ("EditBone", True),
+    "fluid": ("FluidSimulationModifier", False),
+    "image_paint_object": ("Object", False),
+    "lamp": ("Lamp", False),
+    "lattice": ("Lattice", False),
+    "material": ("Material", False),
+    "material_slot": ("MaterialSlot", False),
+    "mesh": ("Mesh", False),
+    "meta_ball": ("MetaBall", False),
+    "object": ("Object", False),
+    "particle_edit_object": ("Object", False),
+    "particle_settings": ("ParticleSettings", False),
+    "particle_system": ("ParticleSystem", False),
+    "particle_system_editable": ("ParticleSystem", False),
+    "pose_bone": ("PoseBone", False),
+    "scene": ("Scene", False),
+    "sculpt_object": ("Object", False),
+    "selectable_bases": ("ObjectBase", True),
+    "selectable_objects": ("Object", True),
+    "selected_bases": ("ObjectBase", True),
+    "selected_bones": ("EditBone", True),
+    "selected_editable_bases": ("ObjectBase", True),
+    "selected_editable_bones": ("EditBone", True),
+    "selected_editable_objects": ("Object", True),
+    "selected_editable_sequences": ("Sequence", True),
+    "selected_nodes": ("Node", True),
+    "selected_objects": ("Object", True),
+    "selected_pose_bones": ("PoseBone", True),
+    "selected_sequences": ("Sequence", True),
+    "sequences": ("Sequence", True),
+    "smoke": ("SmokeModifier", False),
+    "soft_body": ("SoftBodyModifier", False),
+    "speaker": ("Speaker", False),
+    "texture": ("Texture", False),
+    "texture_slot": ("MaterialTextureSlot", False),
+    "texture_user": ("ID", False),
+    "vertex_paint_object": ("Object", False),
+    "visible_bases": ("ObjectBase", True),
+    "visible_bones": ("EditBone", True),
+    "visible_objects": ("Object", True),
+    "visible_pose_bones": ("PoseBone", True),
+    "weight_paint_object": ("Object", False),
+    "world": ("World", False),
+}
 
 def pycontext2sphinx(basepath):
     # Only use once. very irregular
@@ -946,72 +1012,6 @@ def pycontext2sphinx(basepath):
         "sequencer_context_dir",
     )
 
-    # Changes in blender will force errors here
-    type_map = {
-        "active_base": ("ObjectBase", False),
-        "active_bone": ("Bone", False),
-        "active_object": ("Object", False),
-        "active_operator": ("Operator", False),
-        "active_pose_bone": ("PoseBone", False),
-        "active_node": ("Node", False),
-        "armature": ("Armature", False),
-        "bone": ("Bone", False),
-        "brush": ("Brush", False),
-        "camera": ("Camera", False),
-        "cloth": ("ClothModifier", False),
-        "collision": ("CollisionModifier", False),
-        "curve": ("Curve", False),
-        "dynamic_paint": ("DynamicPaintModifier", False),
-        "edit_bone": ("EditBone", False),
-        "edit_image": ("Image", False),
-        "edit_mask": ("Mask", False),
-        "edit_movieclip": ("MovieClip", False),
-        "edit_object": ("Object", False),
-        "edit_text": ("Text", False),
-        "editable_bones": ("EditBone", True),
-        "fluid": ("FluidSimulationModifier", False),
-        "image_paint_object": ("Object", False),
-        "lamp": ("Lamp", False),
-        "lattice": ("Lattice", False),
-        "material": ("Material", False),
-        "material_slot": ("MaterialSlot", False),
-        "mesh": ("Mesh", False),
-        "meta_ball": ("MetaBall", False),
-        "object": ("Object", False),
-        "particle_edit_object": ("Object", False),
-        "particle_settings": ("ParticleSettings", False),
-        "particle_system": ("ParticleSystem", False),
-        "particle_system_editable": ("ParticleSystem", False),
-        "pose_bone": ("PoseBone", False),
-        "scene": ("Scene", False),
-        "sculpt_object": ("Object", False),
-        "selectable_bases": ("ObjectBase", True),
-        "selectable_objects": ("Object", True),
-        "selected_bases": ("ObjectBase", True),
-        "selected_bones": ("Bone", True),
-        "selected_editable_bases": ("ObjectBase", True),
-        "selected_editable_bones": ("Bone", True),
-        "selected_editable_objects": ("Object", True),
-        "selected_editable_sequences": ("Sequence", True),
-        "selected_nodes": ("Node", True),
-        "selected_objects": ("Object", True),
-        "selected_pose_bones": ("PoseBone", True),
-        "selected_sequences": ("Sequence", True),
-        "sequences": ("Sequence", True),
-        "smoke": ("SmokeModifier", False),
-        "soft_body": ("SoftBodyModifier", False),
-        "speaker": ("Speaker", False),
-        "texture": ("Texture", False),
-        "texture_slot": ("MaterialTextureSlot", False),
-        "texture_user": ("ID", False),
-        "vertex_paint_object": ("Object", False),
-        "visible_bases": ("ObjectBase", True),
-        "visible_bones": ("Object", True),
-        "visible_objects": ("Object", True),
-        "visible_pose_bones": ("PoseBone", True),
-        "weight_paint_object": ("Object", False),
-        "world": ("World", False),
-    }
 
     unique = set()
     blend_cdll = ctypes.CDLL("")
@@ -1026,7 +1026,7 @@ def pycontext2sphinx(basepath):
         while char_array[i] is not None:
             member = ctypes.string_at(char_array[i]).decode(encoding="ascii")
             fw(".. data:: %s\n\n" % member)
-            member_type, is_seq = type_map[member]
+            member_type, is_seq = context_type_map[member]
             fw("   :type: %s :class:`bpy.types.%s`\n\n" % ("sequence of " if is_seq else "", member_type))
             unique.add(member)
             i += 1
@@ -1034,8 +1034,8 @@ def pycontext2sphinx(basepath):
     # generate typemap...
     # for member in sorted(unique):
     #     print('        "%s": ("", False),' % member)
-    if len(type_map) > len(unique):
-        raise Exception("Some types are not used: %s" % str([member for member in type_map if member not in unique]))
+    if len(context_type_map) > len(unique):
+        raise Exception("Some types are not used: %s" % str([member for member in context_type_map if member not in unique]))
     else:
         pass  # will have raised an error above
 
@@ -1322,6 +1322,13 @@ def pyrna2sphinx(basepath):
             fw(".. hlist::\n")
             fw("   :columns: 2\n\n")
 
+            # context does its own thing
+            # "active_base": ("ObjectBase", False),
+            for ref_attr, (ref_type, ref_is_seq) in sorted(context_type_map.items()):
+                if ref_type == struct_id:
+                    fw("   * :mod:`bpy.context.%s`\n" % ref_attr)
+            del ref_attr, ref_type, ref_is_seq
+
             for ref in struct.references:
                 ref_split = ref.split(".")
                 if len(ref_split) > 2:
index 12b6d2e4f38d051631e7671750b083d660ef311d..a114d8b8a876f4433f4eeb0315892daaa461e92c 100644 (file)
@@ -174,21 +174,34 @@ bool AUD_OpenALDevice::AUD_OpenALHandle::stop()
        if(!m_status)
                return false;
 
-       // AUD_XXX Create a reference of our own object so that it doesn't get
-       // deleted before the end of this function
-       AUD_Reference<AUD_OpenALHandle> This = this;
-
-       if(m_status == AUD_STATUS_PLAYING)
-               m_device->m_playingSounds.remove(This);
-       else
-               m_device->m_pausedSounds.remove(This);
+       m_status = AUD_STATUS_INVALID;
 
        alDeleteSources(1, &m_source);
        if(!m_isBuffered)
                alDeleteBuffers(CYCLE_BUFFERS, m_buffers);
 
-       m_status = AUD_STATUS_INVALID;
-       return true;
+       for(AUD_HandleIterator it = m_device->m_playingSounds.begin(); it != m_device->m_playingSounds.end(); it++)
+       {
+               if(it->get() == this)
+               {
+                       AUD_Reference<AUD_OpenALHandle> This = *it;
+
+                       m_device->m_playingSounds.erase(it);
+
+                       return true;
+               }
+       }
+
+       for(AUD_HandleIterator it = m_device->m_pausedSounds.begin(); it != m_device->m_pausedSounds.end(); it++)
+       {
+               if(it->get() == this)
+               {
+                       m_device->m_pausedSounds.erase(it);
+                       return true;
+               }
+       }
+
+       return false;
 }
 
 bool AUD_OpenALDevice::AUD_OpenALHandle::getKeep()
index 14f0c6429e9496ad603a019a0c46f4b473370e72..1fbd0ad82d2f8b24a36dec07fc868171bd7b21b7 100644 (file)
@@ -277,22 +277,33 @@ bool AUD_SoftwareDevice::AUD_SoftwareHandle::stop()
        if(!m_status)
                return false;
 
-       // AUD_XXX Create a reference of our own object so that it doesn't get
-       // deleted before the end of this function
-       AUD_Reference<AUD_SoftwareHandle> This = this;
+       m_status = AUD_STATUS_INVALID;
 
-       if(m_status == AUD_STATUS_PLAYING)
+       for(AUD_HandleIterator it = m_device->m_playingSounds.begin(); it != m_device->m_playingSounds.end(); it++)
        {
-               m_device->m_playingSounds.remove(This);
+               if(it->get() == this)
+               {
+                       AUD_Reference<AUD_SoftwareHandle> This = *it;
+
+                       m_device->m_playingSounds.erase(it);
 
-               if(m_device->m_playingSounds.empty())
-                       m_device->playing(m_device->m_playback = false);
+                       if(m_device->m_playingSounds.empty())
+                               m_device->playing(m_device->m_playback = false);
+
+                       return true;
+               }
        }
-       else
-               m_device->m_pausedSounds.remove(This);
 
-       m_status = AUD_STATUS_INVALID;
-       return true;
+       for(AUD_HandleIterator it = m_device->m_pausedSounds.begin(); it != m_device->m_pausedSounds.end(); it++)
+       {
+               if(it->get() == this)
+               {
+                       m_device->m_pausedSounds.erase(it);
+                       return true;
+               }
+       }
+
+       return false;
 }
 
 bool AUD_SoftwareDevice::AUD_SoftwareHandle::getKeep()
index 94a74c30536ab380524735963c91e3dbc8a4ec7c..5ba6e0d76a1faa840e715c93498b3a8c81d9b1e5 100644 (file)
@@ -61,9 +61,9 @@ extern "C" {
 #endif
 
 typedef struct  {
-  int vertex_index[4];
-  int vertex_number;
-  int orig_face;
+       int vertex_index[4];
+       int vertex_number;
+       int orig_face;
 } CSG_IFace;
 
 /**
@@ -72,7 +72,7 @@ typedef struct  {
  */
 
 typedef struct  {
-  float position[3];
+       float position[3];
 } CSG_IVertex;
 
 /**
index 1f9c989cbc8e665277beb47c107cd8a5b5abff20..93d15e6d5e6a4f4a39991b5ce246890a8d52221b 100644 (file)
@@ -135,10 +135,10 @@ static bool Carve_checkEdgeFaceIntersections(carve::csg::Intersections &intersec
 
 static inline bool Carve_facesAreCoplanar(const MeshSet<3>::face_t *a, const MeshSet<3>::face_t *b)
 {
-  carve::geom3d::Ray temp;
-  // XXX: Find a better definition. This may be a source of problems
-  // if floating point inaccuracies cause an incorrect answer.
-  return !carve::geom3d::planeIntersection(a->plane, b->plane, temp);
+       carve::geom3d::Ray temp;
+       // XXX: Find a better definition. This may be a source of problems
+       // if floating point inaccuracies cause an incorrect answer.
+       return !carve::geom3d::planeIntersection(a->plane, b->plane, temp);
 }
 
 static bool Carve_checkMeshSetInterseciton_do(carve::csg::Intersections &intersections,
index 4743247af26bd6cf9142389638c258a437620444..8adc46a59dedc30573dff758c2b81cb7c08983a8 100644 (file)
@@ -35,6 +35,8 @@ set(INC_SYS
 set(SRC
        CTR_HashedPtr.h
        CTR_Map.h
+       CTR_TaggedIndex.h
+       CTR_TaggedSetOps.h
 )
 
 # infact nothing to compile!
index a7b8637e3adb0856daf1dee964de54ab3497335e..c0e0353d37d5926655c981690009d2816ccad8bd 100644 (file)
@@ -29,7 +29,7 @@ if env['WITH_BF_CYCLES_CUDA_BINARIES']:
 incs.extend('. bvh render device kernel kernel/osl kernel/svm util subd'.split())
 incs.extend('#intern/guardedalloc #source/blender/makesrna #source/blender/makesdna'.split())
 incs.extend('#source/blender/blenloader ../../source/blender/makesrna/intern'.split())
-incs.extend('#extern/glew/include'.split())
+incs.extend('#extern/glew/include #intern/mikktspace'.split())
 incs.append(cycles['BF_OIIO_INC'])
 incs.append(cycles['BF_BOOST_INC'])
 incs.append(cycles['BF_PYTHON_INC'])
index a8c7eef89fa5f095213ada83731cdd3e47270a10..292c37d6b6174f180c8c0033a2564163a9b97831 100644 (file)
@@ -7,6 +7,7 @@ set(INC
        ../util
        ../subd
        ../../guardedalloc
+       ../../mikktspace
        ../../../source/blender/makesdna
        ../../../source/blender/makesrna
        ../../../source/blender/blenloader
@@ -38,6 +39,7 @@ set(ADDON_FILES
        addon/__init__.py
        addon/engine.py 
        addon/enums.py
+       addon/osl.py
        addon/presets.py
        addon/properties.py
        addon/ui.py
index 6292c09fbb1caff0763453a70199aa1a3382b05c..16697c08b2bd6e546c57e869a6ae243725e8590d 100644 (file)
@@ -71,6 +71,13 @@ class CyclesRender(bpy.types.RenderEngine):
     def view_draw(self, context):
         engine.draw(self, context.region, context.space_data, context.region_data)
 
+    def update_script_node(self, node):
+        if engine.with_osl():
+            from . import osl
+            osl.update_script_node(node, self.report)
+        else:
+            self.report({'ERROR'}, "OSL support disabled in this build.")
+
 
 def register():
     properties.register()
@@ -84,3 +91,4 @@ def unregister():
     properties.unregister()
     presets.unregister()
     bpy.utils.unregister_module(__name__)
+
index 05b1f88359433f761b919106524e670c5623d873..e4f80cb4d5d12bb8edf6560103c1b0182f2387ee 100644 (file)
@@ -83,3 +83,4 @@ def available_devices():
 def with_osl():
     import _cycles
     return _cycles.with_osl
+
index 6cc3010eb0ebb2b65f926d0df2b4fd693dd8b063..e63e1e84245de72991e54802e109039adfa390aa 100644 (file)
@@ -60,3 +60,4 @@ panorama_types = (
     ('FISHEYE_EQUIDISTANT', "Fisheye Equidistant", "Ideal for fulldomes, ignore the sensor dimensions"),
     ('FISHEYE_EQUISOLID', "Fisheye Equisolid", "Similar to most fisheye modern lens, take sensor dimensions into consideration"),
     )
+
diff --git a/intern/cycles/blender/addon/osl.py b/intern/cycles/blender/addon/osl.py
new file mode 100644 (file)
index 0000000..aac1e24
--- /dev/null
@@ -0,0 +1,127 @@
+#
+# 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.
+#
+
+# <pep8 compliant>
+
+import bpy, _cycles, os, tempfile
+
+# compile .osl file with given filepath to temporary .oso file
+def osl_compile(input_path, report):
+    output_file = tempfile.NamedTemporaryFile(mode='w', suffix=".oso", delete=False)
+    output_path = output_file.name
+    output_file.close()
+
+    ok = _cycles.osl_compile(input_path, output_path)
+
+    if ok:
+        report({'INFO'}, "OSL shader compilation succeeded")
+
+    return ok, output_path
+
+# compile and update shader script node
+def update_script_node(node, report):
+    import os, shutil
+
+    if node.mode == 'EXTERNAL':
+        # compile external script file
+        script_path = bpy.path.abspath(node.filepath, library=node.id_data.library)
+        script_path_noext, script_ext = os.path.splitext(script_path)
+
+        if script_ext == ".oso":
+            # it's a .oso file, no need to compile
+            ok, oso_path = True, script_path
+            oso_file_remove = False
+        elif script_ext == ".osl":
+            # compile .osl file
+            ok, oso_path = osl_compile(script_path, report)
+            oso_file_remove = True
+
+            if ok:
+                # copy .oso from temporary path to .osl directory
+                dst_path = script_path_noext + ".oso"
+                try:
+                    shutil.copy2(oso_path, dst_path)
+                except:
+                    report({'ERROR'}, "Failed to write .oso file next to external .osl file at " + dst_path)
+        elif os.path.dirname(node.filepath) == "":
+            # module in search path
+            oso_path = node.filepath
+            oso_file_remove = False
+            ok = True
+        else:
+            # unknown
+            report({'ERROR'}, "External shader script must have .osl or .oso extension, or be a module name")
+            ok = False
+
+        if ok:
+            node.bytecode = ""
+            node.bytecode_hash = ""
+
+    elif node.mode == 'INTERNAL' and node.script:
+        # internal script, we will store bytecode in the node
+        script = node.script
+        osl_path = bpy.path.abspath(script.filepath, library=script.library)
+
+        if script.is_in_memory or script.is_dirty or script.is_modified or not os.path.exists(osl_path):
+            # write text datablock contents to temporary file
+            osl_file = tempfile.NamedTemporaryFile(mode='w', suffix=".osl", delete=True)
+            osl_file.write(script.as_string())
+            osl_file.flush()
+            ok, oso_path = osl_compile(osl_file.name, report)
+            oso_file_remove = False
+            osl_file.close()
+        else:
+            # compile text datablock from disk directly
+            ok, oso_path = osl_compile(osl_path, report)
+            oso_file_remove = False
+
+        if ok:
+            # read bytecode
+            try:
+                oso = open(oso_path, 'r')
+                node.bytecode = oso.read()
+                oso.close()
+            except:
+                import traceback
+                traceback.print_exc()
+
+                report({'ERROR'}, "Can't read OSO bytecode to store in node at %r" % oso_path)
+                ok = False
+    
+    else:
+        report({'WARNING'}, "No text or file specified in node, nothing to compile")
+        return
+
+    if ok:
+        # now update node with new sockets
+        ok = _cycles.osl_update_node(node.id_data.as_pointer(), node.as_pointer(), oso_path)
+
+        if not ok:
+            report({'ERROR'}, "OSL query failed to open " + oso_path)
+    else:
+        report({'ERROR'}, "OSL script compilation failed, see console for errors")
+
+    # remove temporary oso file
+    if oso_file_remove:
+        try:
+            os.remove(oso_path)
+        except:
+            pass
+
+    return ok
+
index 7055cf981c7074b09e9413e00533c08b8efe1a5a..b1b1a638219a5b52a3b1e0aad2c6b8ca348889bc 100644 (file)
 
 #include "util_foreach.h"
 
+#include "mikktspace.h"
+
 CCL_NAMESPACE_BEGIN
 
-/* Find/Add */
+/* Tangent Space */
 
-static float3 tangent_from_triangle(float3 v0, float3 v1, float3 v2, float3 tx0, float3 tx1, float3 tx2)
-{
-       float3 duv1 = tx2 - tx0;
-       float3 duv2 = tx2 - tx1;
-       float3 dp1 = v2 - v0;
-       float3 dp2 = v2 - v1;
-       float det = duv1[0] * duv2[1] - duv1[1] * duv2[0];
-
-       if(det != 0.0f) {
-               return normalize(dp1 * duv2[1] - dp2 * duv1[1]);
+struct MikkUserData {
+       MikkUserData(const BL::Mesh mesh_, const BL::MeshTextureFaceLayer layer_, int num_faces_)
+       : mesh(mesh_), layer(layer_), num_faces(num_faces_)
+       {
+               tangent.resize(num_faces*4);
        }
-       else {
-               /* give back a sane default, using a valid edge as a fallback */
-               float3 edge = v1 - v0;
 
-               if(len(edge) == 0.0f)
-                       edge = v2 - v0;
+       BL::Mesh mesh;
+       BL::MeshTextureFaceLayer layer;
+       int num_faces;
+       vector<float4> tangent;
+};
+
+static int mikk_get_num_faces(const SMikkTSpaceContext *context)
+{
+       MikkUserData *userdata = (MikkUserData*)context->m_pUserData;
+       return userdata->num_faces;
+}
+
+static int mikk_get_num_verts_of_face(const SMikkTSpaceContext *context, const int face_num)
+{
+       MikkUserData *userdata = (MikkUserData*)context->m_pUserData;
+       BL::MeshTessFace f = userdata->mesh.tessfaces[face_num];
+       int4 vi = get_int4(f.vertices_raw());
+
+       return (vi[3] == 0)? 3: 4;
+}
 
-               return normalize(edge);
+static void mikk_get_position(const SMikkTSpaceContext *context, float P[3], const int face_num, const int vert_num)
+{
+       MikkUserData *userdata = (MikkUserData*)context->m_pUserData;
+       BL::MeshTessFace f = userdata->mesh.tessfaces[face_num];
+       int4 vi = get_int4(f.vertices_raw());
+       BL::MeshVertex v = userdata->mesh.vertices[vi[vert_num]];
+       float3 vP = get_float3(v.co());
+
+       P[0] = vP.x;
+       P[1] = vP.y;
+       P[2] = vP.z;
+}
+
+static void mikk_get_texture_coordinate(const SMikkTSpaceContext *context, float uv[2], const int face_num, const int vert_num)
+{
+       MikkUserData *userdata = (MikkUserData*)context->m_pUserData;
+       BL::MeshTextureFace tf = userdata->layer.data[face_num];
+       float3 tfuv;
+
+       if(vert_num == 0)
+               tfuv = get_float3(tf.uv1());
+       else if(vert_num == 1)
+               tfuv = get_float3(tf.uv2());
+       else if(vert_num == 2)
+               tfuv = get_float3(tf.uv3());
+       else
+               tfuv = get_float3(tf.uv4());
+       
+       uv[0] = tfuv.x;
+       uv[1] = tfuv.y;
+}
+
+static void mikk_get_normal(const SMikkTSpaceContext *context, float N[3], const int face_num, const int vert_num)
+{
+       MikkUserData *userdata = (MikkUserData*)context->m_pUserData;
+       BL::MeshTessFace f = userdata->mesh.tessfaces[face_num];
+       int4 vi = get_int4(f.vertices_raw());
+       BL::MeshVertex v = userdata->mesh.vertices[vi[vert_num]];
+       float3 vN = get_float3(v.normal());
+
+       N[0] = vN.x;
+       N[1] = vN.y;
+       N[2] = vN.z;
+}
+
+static void mikk_set_tangent_space(const SMikkTSpaceContext *context, const float T[], const float sign, const int face, const int vert)
+{
+       MikkUserData *userdata = (MikkUserData*)context->m_pUserData;
+
+       userdata->tangent[face*4 + vert] = make_float4(T[0], T[1], T[2], sign);
+}
+
+static void mikk_compute_tangents(BL::Mesh b_mesh, BL::MeshTextureFaceLayer b_layer, Mesh *mesh, vector<int>& nverts)
+{
+       /* setup userdata */
+       MikkUserData userdata(b_mesh, b_layer, nverts.size());
+
+       /* setup interface */
+       SMikkTSpaceInterface interface;
+       memset(&interface, 0, sizeof(interface));
+       interface.m_getNumFaces = mikk_get_num_faces;
+       interface.m_getNumVerticesOfFace = mikk_get_num_verts_of_face;
+       interface.m_getPosition = mikk_get_position;
+       interface.m_getTexCoord = mikk_get_texture_coordinate;
+       interface.m_getNormal = mikk_get_normal;
+       interface.m_setTSpaceBasic = mikk_set_tangent_space;
+
+       /* setup context */
+       SMikkTSpaceContext context;
+       memset(&context, 0, sizeof(context));
+       context.m_pUserData = &userdata;
+       context.m_pInterface = &interface;
+
+       /* compute tangents */
+       genTangSpaceDefault(&context);
+
+       /* create attribute */
+       /* todo: create float4 attribute for sign */
+       Attribute *attr = mesh->attributes.add(ATTR_STD_TANGENT, ustring("Tangent"));
+       float3 *tangent = attr->data_float3();
+
+       for (int i = 0; i < nverts.size(); i++) {
+               tangent[0] = float4_to_float3(userdata.tangent[i*4 + 0]);
+               tangent[1] = float4_to_float3(userdata.tangent[i*4 + 1]);
+               tangent[2] = float4_to_float3(userdata.tangent[i*4 + 2]);
+               tangent += 3;
+
+               if(nverts[i] == 4) {
+                       tangent[0] = float4_to_float3(userdata.tangent[i*4 + 0]);
+                       tangent[1] = float4_to_float3(userdata.tangent[i*4 + 2]);
+                       tangent[2] = float4_to_float3(userdata.tangent[i*4 + 3]);
+                       tangent += 3;
+               }
        }
 }
 
+/* Create Mesh */
+
 static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<uint>& used_shaders)
 {
        /* create vertices */
@@ -167,54 +273,7 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
                        if(!l->active_render())
                                continue;
 
-                       Attribute *attr = mesh->attributes.add(ATTR_STD_TANGENT, ustring("Tangent"));
-
-                       /* compute average tangents per vertex */
-                       float3 *tangents = attr->data_float3();
-                       memset(tangents, 0, sizeof(float3)*mesh->verts.size());
-
-                       BL::MeshTextureFaceLayer::data_iterator t;
-
-                       size_t fi = 0; /* face index */
-                       b_mesh.tessfaces.begin(f);
-                       for(l->data.begin(t); t != l->data.end() && f != b_mesh.tessfaces.end(); ++t, ++fi, ++f) {
-                               int4 vi = get_int4(f->vertices_raw());
-
-                               float3 tx0 = get_float3(t->uv1());
-                               float3 tx1 = get_float3(t->uv2());
-                               float3 tx2 = get_float3(t->uv3());
-
-                               float3 v0 = mesh->verts[vi[0]];
-                               float3 v1 = mesh->verts[vi[1]];
-                               float3 v2 = mesh->verts[vi[2]];
-
-                               /* calculate tangent for the triangle;
-                                * get vertex positions, and find change in position with respect
-                                * to the texture coords in the first texture coord dimension */
-                               float3 tangent0 = tangent_from_triangle(v0, v1, v2, tx0, tx1, tx2);
-
-                               if(nverts[fi] == 4) {
-                                       /* quad tangent */
-                                       float3 tx3 = get_float3(t->uv4());
-                                       float3 v3 = mesh->verts[vi[3]];
-                                       float3 tangent1 = tangent_from_triangle(v0, v2, v3, tx0, tx2, tx3);
-
-                                       tangents[vi[0]] += 0.5f*(tangent0 + tangent1);
-                                       tangents[vi[1]] += tangent0;
-                                       tangents[vi[2]] += 0.5f*(tangent0 + tangent1);
-                                       tangents[vi[3]] += tangent1;
-                               }
-                               else {
-                                       /* triangle tangent */
-                                       tangents[vi[0]] += tangent0;
-                                       tangents[vi[1]] += tangent0;
-                                       tangents[vi[2]] += tangent0;
-                               }
-                       }
-
-                       /* normalize tangent vectors */
-                       for(int i = 0; i < mesh->verts.size(); i++)
-                               tangents[i] = normalize(tangents[i]);
+                       mikk_compute_tangents(b_mesh, *l, mesh, nverts);
                }
        }
 
@@ -351,7 +410,7 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated)
                        create_mesh(scene, mesh, b_mesh, used_shaders);
 
                /* free derived mesh */
-               object_remove_mesh(b_data, b_mesh);
+               b_data.meshes.remove(b_mesh);
        }
 
        /* displacement method */
@@ -409,7 +468,7 @@ void BlenderSync::sync_mesh_motion(BL::Object b_ob, Mesh *mesh, int motion)
                        mesh->attributes.remove(std);
 
                /* free derived mesh */
-               object_remove_mesh(b_data, b_mesh);
+               b_data.meshes.remove(b_mesh);
        }
 }
 
index 6de2b0f08fa07ae2b6c1b5a3f857cfaa0de1dea7..1b9202497332585ca9245e1dad8bf9af77511daa 100644 (file)
@@ -330,10 +330,10 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
                                int num_particles = object_count_particles(*b_ob);
 
                                if(b_ob->is_duplicator()) {
-                                       hide = true;    /* duplicators hidden by default */
+                                       hide = true; /* duplicators hidden by default */
 
                                        /* dupli objects */
-                                       object_create_duplilist(*b_ob, b_scene);
+                                       b_ob->dupli_list_create(b_scene, 2);
 
                                        BL::Object::dupli_list_iterator b_dup;
                                        int b_index = 0;
@@ -361,10 +361,9 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion)
                                                ++b_index;
                                        }
 
-                                       object_free_duplilist(*b_ob);
+                                       b_ob->dupli_list_clear();
                                }
 
-
                                /* sync particles and check if we should render or hide particle emitter */
                                BL::Object::particle_systems_iterator b_psys;
                                for(b_ob->particle_systems.begin(b_psys); b_psys != b_ob->particle_systems.end(); ++b_psys) {
@@ -422,7 +421,7 @@ void BlenderSync::sync_motion(BL::SpaceView3D b_v3d, BL::Object b_override)
        int frame = b_scene.frame_current();
 
        for(int motion = -1; motion <= 1; motion += 2) {
-               scene_frame_set(b_scene, frame + motion);
+               b_scene.frame_set(frame + motion, 0.0f);
 
                /* camera object */
                if(b_cam)
@@ -432,7 +431,7 @@ void BlenderSync::sync_motion(BL::SpaceView3D b_v3d, BL::Object b_override)
                sync_objects(b_v3d, motion);
        }
 
-       scene_frame_set(b_scene, frame);
+       b_scene.frame_set(frame, 0.0f);
 
        /* tag camera for motion update */
        if(scene->camera->motion_modified(prevcam))
index d9220b76835e77bdc1df5bdcb81956b0ca1c2d20..c047805c6aea1f0f7779861c3452c377699c794e 100644 (file)
 #include "blender_session.h"
 
 #include "util_foreach.h"
+#include "util_md5.h"
 #include "util_opengl.h"
 #include "util_path.h"
 
+#ifdef WITH_OSL
+#include "osl.h"
+
+#include <OSL/oslquery.h>
+#include <OSL/oslconfig.h>
+#endif
+
 CCL_NAMESPACE_BEGIN
 
 static PyObject *init_func(PyObject *self, PyObject *args)
@@ -163,6 +171,170 @@ static PyObject *available_devices_func(PyObject *self, PyObject *args)
        return ret;
 }
 
+#ifdef WITH_OSL
+static PyObject *osl_update_node_func(PyObject *self, PyObject *args)
+{
+       PyObject *pynodegroup, *pynode;
+       const char *filepath = NULL;
+
+       if(!PyArg_ParseTuple(args, "OOs", &pynodegroup, &pynode, &filepath))
+               return NULL;
+
+       /* RNA */
+       PointerRNA nodeptr;
+       RNA_pointer_create((ID*)PyLong_AsVoidPtr(pynodegroup), &RNA_ShaderNodeScript, (void*)PyLong_AsVoidPtr(pynode), &nodeptr);
+       BL::ShaderNodeScript b_node(nodeptr);
+
+       /* update bytecode hash */
+       string bytecode = b_node.bytecode();
+
+       if(!bytecode.empty()) {
+               MD5Hash md5;
+               md5.append((const uint8_t*)bytecode.c_str(), bytecode.size());
+               b_node.bytecode_hash(md5.get_hex().c_str());
+       }
+       else
+               b_node.bytecode_hash("");
+
+       /* query from file path */
+       OSL::OSLQuery query;
+
+       if(!OSLShaderManager::osl_query(query, filepath))
+               Py_RETURN_FALSE;
+
+       /* add new sockets from parameters */
+       set<void*> used_sockets;
+
+       for(int i = 0; i < query.nparams(); i++) {
+               const OSL::OSLQuery::Parameter *param = query.getparam(i);
+
+               /* skip unsupported types */
+               if(param->varlenarray || param->isstruct || param->type.arraylen > 1)
+                       continue;
+
+               /* determine socket type */
+               BL::NodeSocket::type_enum socket_type;
+               float default_float4[4] = {0.0f, 0.0f, 0.0f, 1.0f};
+               float default_float = 0.0f;
+               int default_int = 0;
+               
+               if(param->isclosure) {
+                       socket_type = BL::NodeSocket::type_SHADER;
+               }
+               else if(param->type.vecsemantics == TypeDesc::COLOR) {
+                       socket_type = BL::NodeSocket::type_RGBA;
+
+                       if(param->validdefault) {
+                               default_float4[0] = param->fdefault[0];
+                               default_float4[1] = param->fdefault[1];
+                               default_float4[2] = param->fdefault[2];
+                       }
+               }
+               else if(param->type.vecsemantics == TypeDesc::POINT ||
+                       param->type.vecsemantics == TypeDesc::VECTOR ||
+                       param->type.vecsemantics == TypeDesc::NORMAL) {
+                       socket_type = BL::NodeSocket::type_VECTOR;
+
+                       if(param->validdefault) {
+                               default_float4[0] = param->fdefault[0];
+                               default_float4[1] = param->fdefault[1];
+                               default_float4[2] = param->fdefault[2];
+                       }
+               }
+               else if(param->type.aggregate == TypeDesc::SCALAR) {
+                       if(param->type.basetype == TypeDesc::INT) {
+                               socket_type = BL::NodeSocket::type_INT;
+                               if(param->validdefault)
+                                       default_int = param->idefault[0];
+                       }
+                       else if(param->type.basetype == TypeDesc::FLOAT) {
+                               socket_type = BL::NodeSocket::type_VALUE;
+                               if(param->validdefault)
+                                       default_float = param->fdefault[0];
+                       }
+               }
+               else
+                       continue;
+
+               /* find socket socket */
+               BL::NodeSocket b_sock = b_node.find_socket(param->name.c_str(), param->isoutput);
+
+               /* remove if type no longer matches */
+               if(b_sock && b_sock.type() != socket_type) {
+                       b_node.remove_socket(b_sock);
+                       b_sock = BL::NodeSocket(PointerRNA_NULL);
+               }
+
+               /* create new socket */
+               if(!b_sock) {
+                       b_sock = b_node.add_socket(param->name.c_str(), socket_type, param->isoutput);
+
+                       /* set default value */
+                       if(socket_type == BL::NodeSocket::type_VALUE) {
+                               BL::NodeSocketFloatNone b_float_sock(b_sock.ptr);
+                               b_float_sock.default_value(default_float);
+                       }
+                       else if(socket_type == BL::NodeSocket::type_INT) {
+                               BL::NodeSocketIntNone b_int_sock(b_sock.ptr);
+                               b_int_sock.default_value(default_int);
+                       }
+                       else if(socket_type == BL::NodeSocket::type_RGBA) {
+                               BL::NodeSocketRGBA b_rgba_sock(b_sock.ptr);
+                               b_rgba_sock.default_value(default_float4);
+                       }
+                       else if(socket_type == BL::NodeSocket::type_VECTOR) {
+                               BL::NodeSocketVectorNone b_vector_sock(b_sock.ptr);
+                               b_vector_sock.default_value(default_float4);
+                       }
+               }
+
+               used_sockets.insert(b_sock.ptr.data);
+       }
+
+       /* remove unused parameters */
+       bool removed;
+
+       do {
+               BL::Node::inputs_iterator b_input;
+               BL::Node::outputs_iterator b_output;
+
+               removed = false;
+
+               for (b_node.inputs.begin(b_input); b_input != b_node.inputs.end(); ++b_input) {
+                       if(used_sockets.find(b_input->ptr.data) == used_sockets.end()) {
+                               b_node.remove_socket(*b_input);
+                               removed = true;
+                               break;
+                       }
+               }
+
+               for (b_node.outputs.begin(b_output); b_output != b_node.outputs.end(); ++b_output) {
+                       if(used_sockets.find(b_output->ptr.data) == used_sockets.end()) {
+                               b_node.remove_socket(*b_output);
+                               removed = true;
+                               break;
+                       }
+               }
+       } while(removed);
+
+       Py_RETURN_TRUE;
+}
+
+static PyObject *osl_compile_func(PyObject *self, PyObject *args)
+{
+       const char *inputfile = NULL, *outputfile = NULL;
+
+       if(!PyArg_ParseTuple(args, "ss", &inputfile, &outputfile))
+               return NULL;
+       
+       /* return */
+       if(!OSLShaderManager::osl_compile(inputfile, outputfile))
+               Py_RETURN_FALSE;
+
+       Py_RETURN_TRUE;
+}
+#endif
+
 static PyMethodDef methods[] = {
        {"init", init_func, METH_VARARGS, ""},
        {"create", create_func, METH_VARARGS, ""},
@@ -170,6 +342,10 @@ static PyMethodDef methods[] = {
        {"render", render_func, METH_O, ""},
        {"draw", draw_func, METH_VARARGS, ""},
        {"sync", sync_func, METH_O, ""},
+#ifdef WITH_OSL
+       {"osl_update_node", osl_update_node_func, METH_VARARGS, ""},
+       {"osl_compile", osl_compile_func, METH_VARARGS, ""},
+#endif
        {"available_devices", available_devices_func, METH_NOARGS, ""},
        {NULL, NULL, 0, NULL},
 };
index 0ce1a7dcf286747df0a9eb25a111cdc3cefa3cf9..9e3380c6f8e9b98ef9e4a6d4b32c17914cb566f9 100644 (file)
@@ -20,6 +20,7 @@
 #include "graph.h"
 #include "light.h"
 #include "nodes.h"
+#include "osl.h"
 #include "scene.h"
 #include "shader.h"
 
@@ -43,6 +44,7 @@ void BlenderSync::find_shader(BL::ID id, vector<uint>& used_shaders, int default
        for(size_t i = 0; i < scene->shaders.size(); i++) {
                if(scene->shaders[i] == shader) {
                        used_shaders.push_back(i);
+                       scene->shaders[i]->tag_used(scene);
                        break;
                }
        }
@@ -158,7 +160,7 @@ static void get_tex_mapping(TextureMapping *mapping, BL::ShaderNodeMapping b_map
                mapping->max = get_float3(b_mapping.max());
 }
 
-static ShaderNode *add_node(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *graph, BL::ShaderNode b_node)
+static ShaderNode *add_node(Scene *scene, BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *graph, BL::ShaderNodeTree b_ntree, BL::ShaderNode b_node)
 {
        ShaderNode *node = NULL;
 
@@ -412,6 +414,58 @@ static ShaderNode *add_node(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph
                        node = new BumpNode();
                        break;
                }
+               case BL::ShaderNode::type_SCRIPT: {
+#ifdef WITH_OSL
+                       if(scene->params.shadingsystem != SceneParams::OSL)
+                               break;
+
+                       /* create script node */
+                       BL::ShaderNodeScript b_script_node(b_node);
+                       OSLScriptNode *script_node = new OSLScriptNode();
+                       
+                       /* Generate inputs/outputs from node sockets
+                        *
+                        * Note: the node sockets are generated from OSL parameters,
+                        * so the names match those of the corresponding parameters exactly.
+                        *
+                        * Note 2: ShaderInput/ShaderOutput store shallow string copies only!
+                        * Socket names must be stored in the extra lists instead. */
+                       BL::Node::inputs_iterator b_input;
+
+                       for (b_script_node.inputs.begin(b_input); b_input != b_script_node.inputs.end(); ++b_input) {
+                               script_node->input_names.push_back(ustring(b_input->name()));
+                               ShaderInput *input = script_node->add_input(script_node->input_names.back().c_str(), convert_socket_type(b_input->type()));
+                               set_default_value(input, *b_input);
+                       }
+
+                       BL::Node::outputs_iterator b_output;
+
+                       for (b_script_node.outputs.begin(b_output); b_output != b_script_node.outputs.end(); ++b_output) {
+                               script_node->output_names.push_back(ustring(b_output->name()));
+                               script_node->add_output(script_node->output_names.back().c_str(), convert_socket_type(b_output->type()));
+                       }
+
+                       /* load bytecode or filepath */
+                       OSLShaderManager *manager = (OSLShaderManager*)scene->shader_manager;
+                       string bytecode_hash = b_script_node.bytecode_hash();
+
+                       if(!bytecode_hash.empty()) {
+                               /* loaded bytecode if not already done */
+                               if(!manager->shader_test_loaded(bytecode_hash))
+                                       manager->shader_load_bytecode(bytecode_hash, b_script_node.bytecode());
+
+                               script_node->bytecode_hash = bytecode_hash;
+                       }
+                       else {
+                               /* set filepath */
+                               script_node->filepath = blender_absolute_path(b_data, b_ntree, b_script_node.filepath());
+                       }
+                       
+                       node = script_node;
+#endif
+
+                       break;
+               }
                case BL::ShaderNode::type_TEX_IMAGE: {
                        BL::ShaderNodeTexImage b_image_node(b_node);
                        BL::Image b_image(b_image_node.image());
@@ -575,7 +629,7 @@ 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, BL::Scene b_scene, ShaderGraph *graph, BL::ShaderNodeTree b_ntree, PtrSockMap& sockets_map)
+static void add_nodes(Scene *scene, BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *graph, BL::ShaderNodeTree b_ntree, PtrSockMap& sockets_map)
 {
        /* add nodes */
        BL::ShaderNodeTree::nodes_iterator b_node;
@@ -650,10 +704,10 @@ static void add_nodes(BL::BlendData b_data, BL::Scene b_scene, ShaderGraph *grap
                                set_default_value(proxy->inputs[0], b_output->group_socket());
                        }
                        
-                       add_nodes(b_data, b_scene, graph, b_group_ntree, group_sockmap);
+                       add_nodes(scene, b_data, b_scene, graph, b_group_ntree, group_sockmap);
                }
                else {
-                       ShaderNode *node = add_node(b_data, b_scene, graph, BL::ShaderNode(*b_node));
+                       ShaderNode *node = add_node(scene, b_data, b_scene, graph, b_ntree, BL::ShaderNode(*b_node));
                        
                        if(node) {
                                BL::Node::inputs_iterator b_input;
@@ -743,7 +797,7 @@ void BlenderSync::sync_materials()
                                PtrSockMap sock_to_node;
                                BL::ShaderNodeTree b_ntree(b_mat->node_tree());
 
-                               add_nodes(b_data, b_scene, graph, b_ntree, sock_to_node);
+                               add_nodes(scene, b_data, b_scene, graph, b_ntree, sock_to_node);
                        }
                        else {
                                ShaderNode *closure, *out;
@@ -784,7 +838,7 @@ void BlenderSync::sync_world()
                        PtrSockMap sock_to_node;
                        BL::ShaderNodeTree b_ntree(b_world.node_tree());
 
-                       add_nodes(b_data, b_scene, graph, b_ntree, sock_to_node);
+                       add_nodes(scene, b_data, b_scene, graph, b_ntree, sock_to_node);
                }
                else if(b_world) {
                        ShaderNode *closure, *out;
@@ -843,7 +897,7 @@ void BlenderSync::sync_lamps()
                                PtrSockMap sock_to_node;
                                BL::ShaderNodeTree b_ntree(b_lamp->node_tree());
 
-                               add_nodes(b_data, b_scene, graph, b_ntree, sock_to_node);
+                               add_nodes(scene, b_data, b_scene, graph, b_ntree, sock_to_node);
                        }
                        else {
                                ShaderNode *closure, *out;
index 079320e909ca5be7513610c99243c8663e919f9f..df1e99882b89effbe37990d2deaeba24a50f4fac 100644 (file)
@@ -39,7 +39,7 @@ CCL_NAMESPACE_BEGIN
 
 static inline BL::Mesh object_to_mesh(BL::Object self, BL::Scene scene, bool apply_modifiers, bool render)
 {
-       return self.to_mesh(NULL, scene, apply_modifiers, (render)? 2: 1);
+       return self.to_mesh(scene, apply_modifiers, (render)? 2: 1);
 }
 
 static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size)
@@ -52,24 +52,6 @@ static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size
        }
 }
 
-static inline void object_remove_mesh(BL::BlendData data, BL::Mesh mesh)
-{
-       /* TODO: BlendData.meshes ideally should be also a subclass of BlendDataMeshes */
-       BL::BlendDataMeshes mesh_data(data.ptr);
-
-       mesh_data.remove(NULL, mesh);
-}
-
-static inline void object_create_duplilist(BL::Object self, BL::Scene scene)
-{
-       self.dupli_list_create(NULL, scene, 2);
-}
-
-static inline void object_free_duplilist(BL::Object self)
-{
-       self.dupli_list_clear();
-}
-
 static inline bool BKE_object_is_modified(BL::Object self, BL::Scene scene, bool preview)
 {
        return self.is_modified(scene, (preview)? (1<<0): (1<<1))? true: false;
@@ -88,11 +70,6 @@ static inline string image_user_file_path(BL::ImageUser iuser, BL::Image ima, in
        return string(filepath);
 }
 
-static inline void scene_frame_set(BL::Scene scene, int frame)
-{
-       scene.frame_set(frame, 0.0f);
-}
-
 /* Utilities */
 
 static inline Transform get_transform(BL::Array<float, 16> array)
index d24c7d4128c2a8486092e8d80caea453e4fd78d7..82b0605ab6b499e77b49a2fb2ea2a57dad541a5a 100644 (file)
@@ -134,6 +134,7 @@ endif()
 
 if(WITH_CYCLES_OSL)
        add_subdirectory(osl)
+       add_subdirectory(shaders)
 endif()
 
 # CPU module
index f671e858481a62151d4e8717cc27eec742039cda..a564b99e759794123177de873a7a64668c343fe6 100644 (file)
@@ -45,13 +45,10 @@ __device_inline float safe_sqrtf(float f)
 __device int bsdf_microfacet_ggx_setup(ShaderClosure *sc)
 {
        float ag = sc->data0;
-       float eta = sc->data1;
 
        float m_ag = clamp(ag, 1e-4f, 1.0f);
-       float m_eta = eta;
 
        sc->data0 = m_ag;
-       sc->data1 = m_eta;
        sc->type = CLOSURE_BSDF_MICROFACET_GGX_ID;
 
        return SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_GLOSSY;
@@ -82,7 +79,6 @@ __device void bsdf_microfacet_ggx_blur(ShaderClosure *sc, float roughness)
 __device float3 bsdf_microfacet_ggx_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
 {
        float m_ag = sc->data0;
-       //float m_eta = sc->data1;
        int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
        float3 N = sc->N;
 
@@ -155,7 +151,6 @@ __device float3 bsdf_microfacet_ggx_eval_transmit(const ShaderClosure *sc, const
 __device int bsdf_microfacet_ggx_sample(const ShaderClosure *sc, float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
 {
        float m_ag = sc->data0;
-       float m_eta = sc->data1;
        int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
        float3 N = sc->N;
 
@@ -221,6 +216,7 @@ __device int bsdf_microfacet_ggx_sample(const ShaderClosure *sc, float3 Ng, floa
 #ifdef __RAY_DIFFERENTIALS__
                        float3 dRdx, dRdy, dTdx, dTdy;
 #endif
+                       float m_eta = sc->data1;
                        bool inside;
                        fresnel_dielectric(m_eta, m, I, &R, &T,
 #ifdef __RAY_DIFFERENTIALS__
@@ -274,12 +270,9 @@ __device int bsdf_microfacet_ggx_sample(const ShaderClosure *sc, float3 Ng, floa
 __device int bsdf_microfacet_beckmann_setup(ShaderClosure *sc)
 {
        float ab = sc->data0;
-       float eta = sc->data1;
        float m_ab = clamp(ab, 1e-4f, 1.0f);
-       float m_eta = eta;
 
        sc->data0 = m_ab;
-       sc->data1 = m_eta;
 
        sc->type = CLOSURE_BSDF_MICROFACET_BECKMANN_ID;
        return SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_GLOSSY;
@@ -309,7 +302,6 @@ __device void bsdf_microfacet_beckmann_blur(ShaderClosure *sc, float roughness)
 __device float3 bsdf_microfacet_beckmann_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
 {
        float m_ab = sc->data0;
-       //float m_eta = sc->data1;
        int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID;
        float3 N = sc->N;
 
@@ -386,7 +378,6 @@ __device float3 bsdf_microfacet_beckmann_eval_transmit(const ShaderClosure *sc,
 __device int bsdf_microfacet_beckmann_sample(const ShaderClosure *sc, float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv, float3 *eval, float3 *omega_in, float3 *domega_in_dx, float3 *domega_in_dy, float *pdf)
 {
        float m_ab = sc->data0;
-       float m_eta = sc->data1;
        int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID;
        float3 N = sc->N;
 
@@ -456,6 +447,7 @@ __device int bsdf_microfacet_beckmann_sample(const ShaderClosure *sc, float3 Ng,
 #ifdef __RAY_DIFFERENTIALS__
                        float3 dRdx, dRdy, dTdx, dTdy;
 #endif
+                       float m_eta = sc->data1;
                        bool inside;
                        fresnel_dielectric(m_eta, m, I, &R, &T,
 #ifdef __RAY_DIFFERENTIALS__
index 43cfa3307242d23db7e1b28b04dae28432f49773..e39ae1d4fbcbb6dfeda729acb50a6a755507454f 100644 (file)
@@ -68,6 +68,17 @@ __device_inline float3 triangle_normal_MT(KernelGlobals *kg, int tri_index, int
 #endif
 }
 
+/* Return 3 triangle vertex locations */
+__device_inline void triangle_vertices(KernelGlobals *kg, int tri_index, float3 P[3])
+{
+       /* load triangle vertices */
+       float3 tri_vindex = float4_to_float3(kernel_tex_fetch(__tri_vindex, tri_index));
+
+       P[0] = float4_to_float3(kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.x)));
+       P[1] = float4_to_float3(kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.y)));
+       P[2] = float4_to_float3(kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.z)));
+}
+
 __device_inline float3 triangle_smooth_normal(KernelGlobals *kg, int tri_index, float u, float v)
 {
        /* load triangle vertices */
index d6449b4349bc0368b0a813a66a8e09bf67ef6c78..8938b16a48ff181f7ccd5ffb8c5c858cef4e23fb 100644 (file)
@@ -34,4 +34,3 @@ include_directories(SYSTEM ${INC_SYS})
 
 add_library(cycles_kernel_osl ${SRC} ${HEADER_SRC})
 
-add_subdirectory(nodes)
index 7c415e22012d2b7507cc17f624f5cb669df3f41c..ade085c795d61bffbe6ef42efd4ca41d04768437 100644 (file)
@@ -345,6 +345,51 @@ static void set_attribute_float(float f[3], TypeDesc type, bool derivatives, voi
        }
 }
 
+static bool set_attribute_int(int i, TypeDesc type, bool derivatives, void *val)
+{
+       if(type.basetype == TypeDesc::INT && type.aggregate == TypeDesc::SCALAR && type.arraylen == 0) {
+               int *ival = (int *)val;
+               ival[0] = i;
+
+               if (derivatives) {
+                       ival[1] = 0;
+                       ival[2] = 0;
+               }
+
+               return true;
+       }
+
+       return false;
+}
+
+static bool set_attribute_float3_3(float3 P[3], TypeDesc type, bool derivatives, void *val)
+{
+       if(type.vecsemantics == TypeDesc::POINT && type.arraylen >= 3) {
+               float *fval = (float *)val;
+
+               fval[0] = P[0].x;
+               fval[1] = P[0].y;
+               fval[2] = P[0].z;
+
+               fval[3] = P[1].x;
+               fval[4] = P[1].y;
+               fval[5] = P[1].z;
+
+               fval[6] = P[2].x;
+               fval[7] = P[2].y;
+               fval[8] = P[2].z;
+
+               if(type.arraylen > 3)
+                       memset(fval + 3*3, 0, sizeof(float)*3*(type.arraylen - 3));
+               if (derivatives)
+                       memset(fval + type.arraylen*3, 0, sizeof(float)*2*3*type.arraylen);
+
+               return true;
+       }
+
+       return false;
+}
+
 static bool get_mesh_attribute(KernelGlobals *kg, const ShaderData *sd, const OSLGlobals::Attribute& attr,
                                const TypeDesc& type, bool derivatives, void *val)
 {
@@ -381,43 +426,45 @@ static void get_object_attribute(const OSLGlobals::Attribute& attr, bool derivat
 static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ustring name,
                                           TypeDesc type, bool derivatives, void *val)
 {
+       /* todo: turn this into hash table + callback once */
+
        /* Object Attributes */
-       if (name == "std::object_location") {
+       if (name == "object:location") {
                float3 fval[3];
                fval[0] = object_location(kg, sd);
                fval[1] = fval[2] = make_float3(0.0, 0.0, 0.0); /* derivates set to 0 */
                set_attribute_float3(fval, type, derivatives, val);
                return true;
        }
-       else if (name == "std::object_index") {
+       else if (name == "object:index") {
                float fval[3];
                fval[0] = object_pass_id(kg, sd->object);
                fval[1] = fval[2] = 0.0;        /* derivates set to 0 */
                set_attribute_float(fval, type, derivatives, val);
                return true;
        }
-       else if (name == "std::dupli_generated") {
+       else if (name == "geom:dupli_generated") {
                float3 fval[3];
                fval[0] = object_dupli_generated(kg, sd->object);
                fval[1] = fval[2] = make_float3(0.0, 0.0, 0.0); /* derivates set to 0 */
                set_attribute_float3(fval, type, derivatives, val);
                return true;
        }
-       else if (name == "std::dupli_uv") {
+       else if (name == "geom:dupli_uv") {
                float3 fval[3];
                fval[0] = object_dupli_uv(kg, sd->object);
                fval[1] = fval[2] = make_float3(0.0, 0.0, 0.0); /* derivates set to 0 */
                set_attribute_float3(fval, type, derivatives, val);
                return true;
        }
-       else if (name == "std::material_index") {
+       else if (name == "material:index") {
                float fval[3];
                fval[0] = shader_pass_id(kg, sd);
                fval[1] = fval[2] = 0.0;        /* derivates set to 0 */
                set_attribute_float(fval, type, derivatives, val);
                return true;
        }
-       else if (name == "std::object_random") {
+       else if (name == "object:random") {
                float fval[3];
                fval[0] = object_random_number(kg, sd->object);
                fval[1] = fval[2] = 0.0;        /* derivates set to 0 */
@@ -426,7 +473,7 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
        }
 
        /* Particle Attributes */
-       else if (name == "std::particle_index") {
+       else if (name == "particle:index") {
                float fval[3];
                uint particle_id = object_particle_id(kg, sd->object);
                fval[0] = particle_index(kg, particle_id);
@@ -434,7 +481,7 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
                set_attribute_float(fval, type, derivatives, val);
                return true;
        }
-       else if (name == "std::particle_age") {
+       else if (name == "particle:age") {
                float fval[3];
                uint particle_id = object_particle_id(kg, sd->object);
                fval[0] = particle_age(kg, particle_id);
@@ -442,7 +489,7 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
                set_attribute_float(fval, type, derivatives, val);
                return true;
        }
-       else if (name == "std::particle_lifetime") {
+       else if (name == "particle:lifetime") {
                float fval[3];
                uint particle_id = object_particle_id(kg, sd->object);
                fval[0] = particle_lifetime(kg, particle_id);
@@ -450,7 +497,7 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
                set_attribute_float(fval, type, derivatives, val);
                return true;
        }
-       else if (name == "std::particle_location") {
+       else if (name == "particle:location") {
                float3 fval[3];
                uint particle_id = object_particle_id(kg, sd->object);
                fval[0] = particle_location(kg, particle_id);
@@ -459,7 +506,7 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
                return true;
        }
 #if 0  /* unsupported */
-       else if (name == "std::particle_rotation") {
+       else if (name == "particle:rotation") {
                float4 fval[3];
                uint particle_id = object_particle_id(kg, sd->object);
                fval[0] = particle_rotation(kg, particle_id);
@@ -468,7 +515,7 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
                return true;
        }
 #endif
-       else if (name == "std::particle_size") {
+       else if (name == "particle:size") {
                float fval[3];
                uint particle_id = object_particle_id(kg, sd->object);
                fval[0] = particle_size(kg, particle_id);
@@ -476,7 +523,7 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
                set_attribute_float(fval, type, derivatives, val);
                return true;
        }
-       else if (name == "std::particle_velocity") {
+       else if (name == "particle:velocity") {
                float3 fval[3];
                uint particle_id = object_particle_id(kg, sd->object);
                fval[0] = particle_velocity(kg, particle_id);
@@ -484,7 +531,7 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
                set_attribute_float3(fval, type, derivatives, val);
                return true;
        }
-       else if (name == "std::particle_angular_velocity") {
+       else if (name == "particle:angular_velocity") {
                float3 fval[3];
                uint particle_id = object_particle_id(kg, sd->object);
                fval[0] = particle_angular_velocity(kg, particle_id);
@@ -492,7 +539,17 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
                set_attribute_float3(fval, type, derivatives, val);
                return true;
        }
-       
+       else if (name == "geom:numpolyvertices") {
+               return set_attribute_int(3, type, derivatives, val);
+       }
+       else if (name == "geom:trianglevertices" || name == "geom:polyvertices") {
+               float3 P[3];
+               triangle_vertices(kg, sd->prim, P);
+               object_position_transform(kg, sd, &P[0]);
+               object_position_transform(kg, sd, &P[1]);
+               object_position_transform(kg, sd, &P[2]);
+               return set_attribute_float3_3(P, type, derivatives, val);
+       }
        else
                return false;
 }
@@ -501,7 +558,7 @@ static bool get_background_attribute(KernelGlobals *kg, ShaderData *sd, ustring
                                      TypeDesc type, bool derivatives, void *val)
 {
        /* Ray Length */
-       if (name == "std::ray_length") {
+       if (name == "path:ray_length") {
                float fval[3];
                fval[0] = sd->ray_length;
                fval[1] = fval[2] = 0.0;        /* derivates set to 0 */
similarity index 89%
rename from intern/cycles/kernel/osl/nodes/CMakeLists.txt
rename to intern/cycles/kernel/shaders/CMakeLists.txt
index da5441f11e07fac646b16131b16f4a4b55316b99..00ab52a1d133c2205bb5148210769a041daef813 100644 (file)
@@ -76,11 +76,11 @@ set(SRC_OSO
 # TODO, add a module to compile OSL
 foreach(_file ${SRC_OSL})
        set(_OSL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
-       string(REPLACE ".osl" ".oso" _OSO_FILE ${_OSL_FILE})  # TODO, replace extension only
+       string(REPLACE ".osl" ".oso" _OSO_FILE ${_OSL_FILE})
        string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} _OSO_FILE ${_OSO_FILE})
        add_custom_command(
                OUTPUT ${_OSO_FILE} 
-               COMMAND ${OSL_COMPILER} -O2 ${_OSL_FILE}
+               COMMAND ${OSL_COMPILER} -O2  -I"${CMAKE_CURRENT_SOURCE_DIR}" ${_OSL_FILE}
                DEPENDS ${_OSL_FILE} ${SRC_OSL_HEADERS})
        list(APPEND SRC_OSO
                ${_OSO_FILE}
@@ -94,3 +94,5 @@ add_custom_target(cycles_osl_shaders ALL DEPENDS ${SRC_OSO} ${SRC_OSL_HEADERS})
 
 # CMAKE_CURRENT_SOURCE_DIR is already included in OSO paths
 delayed_install("" "${SRC_OSO}" ${CYCLES_INSTALL_PATH}/shader)
+delayed_install("${CMAKE_CURRENT_SOURCE_DIR}" "${SRC_OSL_HEADERS}" ${CYCLES_INSTALL_PATH}/shader)
+
similarity index 91%
rename from intern/cycles/kernel/osl/nodes/node_glass_bsdf.osl
rename to intern/cycles/kernel/shaders/node_glass_bsdf.osl
index f3fcce572cfc2f68945865b35eb4dfb100d2c462..30b9d301f3297ae62b2c44f1b33ac44f8e2a5dc1 100644 (file)
@@ -34,10 +34,10 @@ shader node_glass_bsdf(
        if (distribution == "Sharp")
                BSDF = Color * (Fr * reflection(Normal) + (1.0 - Fr) * refraction(Normal, eta));
        else if (distribution == "Beckmann")
-               BSDF = Color * (Fr * microfacet_beckmann(Normal, Roughness, eta) +
+               BSDF = Color * (Fr * microfacet_beckmann(Normal, Roughness) +
                                (1.0 - Fr) * microfacet_beckmann_refraction(Normal, Roughness, eta));
        else if (distribution == "GGX")
-               BSDF = Color * (Fr * microfacet_ggx(Normal, Roughness, eta) +
+               BSDF = Color * (Fr * microfacet_ggx(Normal, Roughness) +
                                (1.0 - Fr) * microfacet_ggx_refraction(Normal, Roughness, eta));
 }
 
similarity index 90%
rename from intern/cycles/kernel/osl/nodes/node_glossy_bsdf.osl
rename to intern/cycles/kernel/shaders/node_glossy_bsdf.osl
index 48d61ea0ab59fa80400b823fe9f306742e258640..03340c74af553cfb071864693ff64a7a65036f69 100644 (file)
@@ -29,9 +29,9 @@ shader node_glossy_bsdf(
        if (distribution == "Sharp")
                BSDF = Color * reflection(Normal);
        else if (distribution == "Beckmann")
-               BSDF = Color * microfacet_beckmann(Normal, Roughness, 1.0);
+               BSDF = Color * microfacet_beckmann(Normal, Roughness);
        else if (distribution == "GGX")
-               BSDF = Color * microfacet_ggx(Normal, Roughness, 1.0);
+               BSDF = Color * microfacet_ggx(Normal, Roughness);
 
 }
 
similarity index 96%
rename from intern/cycles/kernel/osl/nodes/node_light_falloff.osl
rename to intern/cycles/kernel/shaders/node_light_falloff.osl
index 3877b6d5bdc2167451685418c44ccbe67f6f1817..7ffa6fe0ffb4273193090e330ea384c76efe4a9b 100644 (file)
@@ -27,7 +27,7 @@ shader node_light_falloff(
 {
        float ray_length = 0.0;
        float strength = Strength;
-       getattribute("std::ray_length", ray_length);
+       getattribute("path:ray_length", ray_length);
 
        if (Smooth > 0.0) {
                float squared = ray_length*ray_length;
similarity index 96%
rename from intern/cycles/kernel/osl/nodes/node_light_path.osl
rename to intern/cycles/kernel/shaders/node_light_path.osl
index ca92a5e6553a76cf6e9c4f4c02510fcb18d5a881..9e3f6c7b4a985c6dd14d41e367c1260046c658f9 100644 (file)
@@ -36,6 +36,6 @@ shader node_light_path(
        IsReflectionRay = raytype("reflection");
        IsTransmissionRay = raytype("refraction");
 
-       getattribute("std::ray_length", RayLength);
+       getattribute("path:ray_length", RayLength);
 }
 
similarity index 83%
rename from intern/cycles/kernel/osl/nodes/node_object_info.osl
rename to intern/cycles/kernel/shaders/node_object_info.osl
index 0d503258179ac769fbb89b80a273396454ad5198..c3b1ff29f097a35860035f39346bdfc2a4b88057 100644 (file)
@@ -24,9 +24,9 @@ shader node_object_info(
        output float MaterialIndex = 0.0,
        output float Random = 0.0)
 {
-       getattribute("std::object_location", Location);
-       getattribute("std::object_index", ObjectIndex);
-       getattribute("std::material_index", MaterialIndex);
-       getattribute("std::object_random", Random);
+       getattribute("object:location", Location);
+       getattribute("object:index", ObjectIndex);
+       getattribute("material:index", MaterialIndex);
+       getattribute("object:random", Random);
 }
 
similarity index 75%
rename from intern/cycles/kernel/osl/nodes/node_particle_info.osl
rename to intern/cycles/kernel/shaders/node_particle_info.osl
index ba51ccbd953c32a0e8979f2d0c331f9724418cfe..5e59ad1a990a65632c58c8d520002ed4047d357d 100644 (file)
@@ -27,12 +27,12 @@ shader node_particle_info(
     output vector Velocity = point(0.0, 0.0, 0.0),
     output vector AngularVelocity = point(0.0, 0.0, 0.0))
 {
-       getattribute("std::particle_index", Index);
-       getattribute("std::particle_age", Age);
-       getattribute("std::particle_lifetime", Lifetime);
-       getattribute("std::particle_location", Location);
-       getattribute("std::particle_size", Size);
-       getattribute("std::particle_velocity", Velocity);
-       getattribute("std::particle_angular_velocity", AngularVelocity);
+       getattribute("particle:index", Index);
+       getattribute("particle:age", Age);
+       getattribute("particle:lifetime", Lifetime);
+       getattribute("particle:location", Location);
+       getattribute("particle:size", Size);
+       getattribute("particle:velocity", Velocity);
+       getattribute("particle:angular_velocity", AngularVelocity);
 }
 
similarity index 92%
rename from intern/cycles/kernel/osl/nodes/node_texture_coordinate.osl
rename to intern/cycles/kernel/shaders/node_texture_coordinate.osl
index 405ed118c2b8b9fe6c572684e2657096e7aaac43..791838dfffec9d8224799f705d95f61478cf08e8 100644 (file)
@@ -44,12 +44,12 @@ shader node_texture_coordinate(
        }
        else {
                if (from_dupli) {
-                       getattribute("std::dupli_generated", Generated); 
-                       getattribute("std::dupli_uv", UV);
+                       getattribute("geom:dupli_generated", Generated); 
+                       getattribute("geom:dupli_uv", UV);
                }
                else {
-                       getattribute("std::generated", Generated); 
-                       getattribute("std::uv", UV);
+                       getattribute("geom:generated", Generated); 
+                       getattribute("geom:uv", UV);
                }
 
                Object = transform("object", P);
similarity index 94%
rename from intern/cycles/kernel/osl/nodes/node_velvet_bsdf.osl
rename to intern/cycles/kernel/shaders/node_velvet_bsdf.osl
index 4bb4e39a1ba99235b439a3ff7474cd34edbfd257..3aa662bdd08f8fc238342b34f38d5a1595ca3d37 100644 (file)
@@ -27,6 +27,6 @@ shader node_velvet_bsdf(
 {
        float sigma = clamp(Sigma, 0.0, 1.0);
 
-       BSDF = Color * ashikhmin_velvet(Normal, sigma, 1.0);
+       BSDF = Color * ashikhmin_velvet(Normal, sigma);
 }
 
similarity index 78%
rename from intern/cycles/kernel/osl/nodes/stdosl.h
rename to intern/cycles/kernel/shaders/stdosl.h
index e5accf4eb547d22579e567b80a69bb001275560d..4237291c7a46fa00e91ffcd60c4d207a3f39b0a8 100644 (file)
@@ -434,81 +434,18 @@ string concat (string a, string b, string c, string d, string e, string f) {
 closure color diffuse(normal N) BUILTIN;
 closure color oren_nayar(normal N, float sigma) BUILTIN;
 closure color translucent(normal N) BUILTIN;
-closure color reflection(normal N, float eta) BUILTIN;
-closure color reflection(normal N) { return reflection (N, 0.0); }
+closure color reflection(normal N) BUILTIN;
 closure color refraction(normal N, float eta) BUILTIN;
-closure color dielectric(normal N, float eta) BUILTIN;
 closure color transparent() BUILTIN;
-closure color microfacet_ggx(normal N, float ag, float eta) BUILTIN;
+closure color microfacet_ggx(normal N, float ag) BUILTIN;
 closure color microfacet_ggx_refraction(normal N, float ag, float eta) BUILTIN;
-closure color microfacet_beckmann(normal N, float ab, float eta) BUILTIN;
+closure color microfacet_beckmann(normal N, float ab) BUILTIN;
 closure color microfacet_beckmann_refraction(normal N, float ab, float eta) BUILTIN;
 closure color ward(normal N, vector T,float ax, float ay) BUILTIN;
-closure color phong(normal N, float exponent) BUILTIN;
-closure color phong_ramp(normal N, float exponent, color colors[8]) BUILTIN;
-closure color hair_diffuse(vector T) BUILTIN;
-closure color hair_specular(vector T, float offset, float exponent) BUILTIN;
-closure color ashikhmin_velvet(normal N, float sigma, float eta) BUILTIN;
-closure color westin_backscatter(normal N, float roughness) BUILTIN;
-closure color westin_sheen(normal N, float edginess) BUILTIN;
-closure color bssrdf_cubic(color radius) BUILTIN;
-closure color emission(float inner_angle, float outer_angle) BUILTIN;
-closure color emission(float outer_angle) BUILTIN;
+closure color ashikhmin_velvet(normal N, float sigma) BUILTIN;
 closure color emission() BUILTIN;
-closure color debug(string tag) BUILTIN;
 closure color background() BUILTIN;
 closure color holdout() BUILTIN;
-closure color subsurface(float eta, float g, color mfp, color albedo) BUILTIN;
-
-closure color cloth(normal N, float s, float t, float dsdx, float dtdx, float dsdy, float dtdy,
-                    float area_scaled, vector dPdu, color diff_warp_col, color diff_weft_col,
-                    color spec_warp_col, color spec_weft_col, float fresnel_warp, float fresnel_weft,
-                    float spread_x_mult, float spread_y_mult, int pattern, float pattern_angle,
-                    float warp_width_scale, float weft_width_scale, float thread_count_mult_u,
-                    float thread_count_mult_v) BUILTIN;
-closure color cloth_specular(normal N, color spec_col[4], float eta[4], int thread_pattern[4],
-                             float pattern_weight[4], int   current_thread, float brdf_interp,
-                             float btf_interp, float uux, float vvx, float area_scaled, vector dPdu,
-                             float eccentricity[4], float angle[4], float Kx[4], float Ky[4],
-                             float Sx[4], float Sy[4]) BUILTIN;
-closure color fakefur_diffuse(normal N, vector T, float fur_reflectivity, float fur_transmission,
-                              float shadow_start, float shadow_end, float fur_attenuation, float fur_density,
-                              float fur_avg_radius, float fur_length, float fur_shadow_fraction) BUILTIN;
-closure color fakefur_specular(normal N, vector T, float offset, float exp, float fur_reflectivity,
-                               float fur_transmission, float shadow_start, float shadow_end,
-                               float fur_attenuation, float fur_density, float fur_avg_radius,
-                               float fur_length, float fur_shadow_fraction) BUILTIN;
-
-closure color fakefur_skin(vector N, vector T, float fur_reflectivity, float fur_transmission,
-                           float shadow_start, float shadow_end, float fur_attenuation, float fur_density,
-                           float fur_avg_radius, float fur_length) BUILTIN;
-
-
-closure color cloth(normal N, float s, float t, color diff_warp, color diff_weft, 
-                    color spec_warp, color spec_weft, float fresnel_warp, float fresnel_weft,
-                    float spread_x_mult, float spread_y_mult, int pattern, float pattern_angle,
-                    float warp_width_scale, float weft_width_scale, float thread_count_mult_u,
-                    float thread_count_mult_v)
-{
-
-    return cloth(N, s, t, Dx(s), Dx(t), Dy(s), Dy(t), area(P), dPdu, diff_warp, diff_weft, spec_warp, spec_weft,
-                 fresnel_warp, fresnel_weft, spread_x_mult, spread_y_mult, pattern, pattern_angle, 
-                 warp_width_scale, weft_width_scale, thread_count_mult_u, thread_count_mult_v);
-}
-
-closure color cloth(normal N, float s, float t, color diff_warp, color diff_weft, 
-                    color spec_warp, color spec_weft, float fresnel_warp, float fresnel_weft,
-                    float spread_x_mult, float spread_y_mult, int pattern, float pattern_angle,
-                    float warp_width_scale, float weft_width_scale, float thread_count_mult_u,
-                    float thread_count_mult_v, string tok, string val)
-{
-
-    return cloth(N, s, t, Dx(s), Dx(t), Dy(s), Dy(t), area(P), dPdu, diff_warp, diff_weft, spec_warp, spec_weft,
-                 fresnel_warp, fresnel_weft, spread_x_mult, spread_y_mult, pattern, pattern_angle, 
-                 warp_width_scale, weft_width_scale, thread_count_mult_u, thread_count_mult_v, tok, val);
-}
-
-
 
 // Renderer state
 int raytype (string typename) BUILTIN;
index e0f9e3376521757d55dd978dfe86964318699f51..501fed9500268a146de95f4bc4300dbbc03df3db 100644 (file)
@@ -49,7 +49,7 @@ __device void svm_node_geometry(KernelGlobals *kg, ShaderData *sd, float *stack,
                                int attr_offset = find_attribute(kg, sd, ATTR_STD_TANGENT);
 
                                if(attr_offset != ATTR_STD_NOT_FOUND) {
-                                       data = triangle_attribute_float3(kg, sd, ATTR_ELEMENT_VERTEX, attr_offset, NULL, NULL);
+                                       data = triangle_attribute_float3(kg, sd, ATTR_ELEMENT_CORNER, attr_offset, NULL, NULL);
                                        object_normal_transform(kg, sd, &data);
                                }
                                else {
index 4bcaef0fb176d1575aeb2ba247ae4d790f759a55..c7a9ab3e51a70406b9fdd4ec11ddc0f784b13625 100644 (file)
@@ -163,7 +163,7 @@ Attribute *AttributeSet::add(AttributeStandard std, ustring name)
        else if(std == ATTR_STD_UV)
                attr = add(name, TypeDesc::TypePoint, Attribute::CORNER);
        else if(std == ATTR_STD_TANGENT)
-               attr = add(name, TypeDesc::TypeVector, Attribute::VERTEX);
+               attr = add(name, TypeDesc::TypeVector, Attribute::CORNER);
        else if(std == ATTR_STD_GENERATED)
                attr = add(name, TypeDesc::TypePoint, Attribute::VERTEX);
        else if(std == ATTR_STD_POSITION_UNDEFORMED)
index 3c41b4f1ad3865ae5df50bbbdfa2e5a1a59c4693..13c06a922cc13eeb9738d114e59df596960dfbc2 100644 (file)
@@ -366,8 +366,8 @@ void MeshManager::update_osl_attributes(Device *device, Scene *scene, vector<Att
                                osl_attr.type = TypeDesc::TypeColor;
 
                        if(req.std != ATTR_STD_NONE) {
-                               /* if standard attribute, add lookup by std:: name convention */
-                               ustring stdname(std::string("std::") + std::string(attribute_standard_name(req.std)));
+                               /* if standard attribute, add lookup by geom: name convention */
+                               ustring stdname(string("geom:") + string(attribute_standard_name(req.std)));
                                og->attribute_map[i][stdname] = osl_attr;
                        }
                        else if(req.name != ustring()) {
index 2cdab3a6560abc15fa8960b88a424a81d80eee18..42ab3fe17aa98c32b39bf000cc105b6e0d2fb983 100644 (file)
@@ -2922,5 +2922,25 @@ void SetNormalNode::compile(OSLCompiler& compiler)
        compiler.add(this, "node_set_normal"); 
 }
 
+/* OSLScriptNode */
+
+OSLScriptNode::OSLScriptNode()
+: ShaderNode("osl_script")
+{
+}
+
+void OSLScriptNode::compile(SVMCompiler& compiler)
+{
+       /* doesn't work for SVM, obviously ... */
+}
+
+void OSLScriptNode::compile(OSLCompiler& compiler)
+{
+       if(!filepath.empty())
+               compiler.add(this, filepath.c_str(), true);
+       else
+               compiler.add(this, bytecode_hash.c_str(), false);
+}
+
 CCL_NAMESPACE_END
 
index fbc61e12fd4e26d677157a0a509900be3c57717b..0508bf6b266651411341110c5359e09cd1b80dee 100644 (file)
@@ -445,6 +445,18 @@ public:
        SHADER_NODE_CLASS(SetNormalNode)
 };
 
+class OSLScriptNode : public ShaderNode {
+public:
+       SHADER_NODE_CLASS(OSLScriptNode)
+       string filepath;
+       string bytecode_hash;
+       
+       /* ShaderInput/ShaderOutput only stores a shallow string copy (const char *)!
+        * The actual socket names have to be stored externally to avoid memory errors. */
+       vector<ustring> input_names;
+       vector<ustring> output_names;
+};
+
 CCL_NAMESPACE_END
 
 #endif /* __NODES_H__ */
index 638bfa8634eb4b463251929a16a8e288d137a636..a8a40a4e5966912929122458a63accc67fe26807 100644 (file)
@@ -31,6 +31,7 @@
 #include "osl_shader.h"
 
 #include "util_foreach.h"
+#include "util_md5.h"
 #include "util_path.h"
 #include "util_progress.h"
 
@@ -46,36 +47,8 @@ OSLShaderManager::OSLShaderManager()
 {
        services = new OSLRenderServices();
 
-       /* if we let OSL create it, it leaks */
-       ts = TextureSystem::create(true);
-       ts->attribute("automip",  1);
-       ts->attribute("autotile", 64);
-
-       ss = OSL::ShadingSystem::create(services, ts, &errhandler);
-       ss->attribute("lockgeom", 1);
-       ss->attribute("commonspace", "world");
-       ss->attribute("optimize", 2);
-       //ss->attribute("debug", 1);
-       //ss->attribute("statistics:level", 1);
-       ss->attribute("searchpath:shader", path_get("shader").c_str());
-
-       /* our own ray types */
-       static const char *raytypes[] = {
-               "camera",               /* PATH_RAY_CAMERA */
-               "reflection",   /* PATH_RAY_REFLECT */
-               "refraction",   /* PATH_RAY_TRANSMIT */
-               "diffuse",              /* PATH_RAY_DIFFUSE */
-               "glossy",               /* PATH_RAY_GLOSSY */
-               "singular",             /* PATH_RAY_SINGULAR */
-               "transparent",  /* PATH_RAY_TRANSPARENT */
-               "shadow",               /* PATH_RAY_SHADOW_OPAQUE */
-               "shadow",               /* PATH_RAY_SHADOW_TRANSPARENT */
-       };
-
-       const int nraytypes = sizeof(raytypes)/sizeof(raytypes[0]);
-       ss->attribute("raytypes", TypeDesc(TypeDesc::STRING, nraytypes), raytypes);
-
-       OSLShader::register_closures(ss);
+       shading_system_init();
+       texture_system_init();
 }
 
 OSLShaderManager::~OSLShaderManager()
@@ -87,18 +60,14 @@ OSLShaderManager::~OSLShaderManager()
 
 void OSLShaderManager::device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress)
 {
-       /* test if we need to update */
-       bool need_update = false;
-
-       foreach(Shader *shader, scene->shaders)
-               if(shader->need_update)
-                       need_update = true;
-       
        if(!need_update)
                return;
 
        device_free(device, dscene);
 
+       /* determine which shaders are in use */
+       device_update_shaders_used(scene);
+
        /* create shaders */
        OSLGlobals *og = (OSLGlobals*)device->osl_memory();
 
@@ -110,7 +79,7 @@ void OSLShaderManager::device_update(Device *device, DeviceScene *dscene, Scene
                if(shader->sample_as_light && shader->has_surface_emission)
                        scene->light_manager->need_update = true;
 
-               OSLCompiler compiler((void*)ss);
+               OSLCompiler compiler((void*)this, (void*)ss);
                compiler.background = (shader == scene->shaders[scene->default_background]);
                compiler.compile(og, shader);
        }
@@ -126,6 +95,8 @@ void OSLShaderManager::device_update(Device *device, DeviceScene *dscene, Scene
 
        foreach(Shader *shader, scene->shaders)
                shader->need_update = false;
+
+       need_update = false;
        
        /* set texture system */
        scene->image_manager->set_osl_texture_system((void*)ts);
@@ -151,10 +122,165 @@ void OSLShaderManager::device_free(Device *device, DeviceScene *dscene)
        og->background_state.reset();
 }
 
+void OSLShaderManager::texture_system_init()
+{
+       /* if we let OSL create it, it leaks */
+       ts = TextureSystem::create(true);
+       ts->attribute("automip",  1);
+       ts->attribute("autotile", 64);
+
+       /* effectively unlimited for now, until we support proper mipmap lookups */
+       ts->attribute("max_memory_MB", 16384);
+}
+
+void OSLShaderManager::shading_system_init()
+{
+       ss = OSL::ShadingSystem::create(services, ts, &errhandler);
+       ss->attribute("lockgeom", 1);
+       ss->attribute("commonspace", "world");
+       ss->attribute("optimize", 2);
+       //ss->attribute("debug", 1);
+       //ss->attribute("statistics:level", 1);
+       ss->attribute("searchpath:shader", path_get("shader"));
+
+       /* our own ray types */
+       static const char *raytypes[] = {
+               "camera",               /* PATH_RAY_CAMERA */
+               "reflection",   /* PATH_RAY_REFLECT */
+               "refraction",   /* PATH_RAY_TRANSMIT */
+               "diffuse",              /* PATH_RAY_DIFFUSE */
+               "glossy",               /* PATH_RAY_GLOSSY */
+               "singular",             /* PATH_RAY_SINGULAR */
+               "transparent",  /* PATH_RAY_TRANSPARENT */
+               "shadow",               /* PATH_RAY_SHADOW_OPAQUE */
+               "shadow",               /* PATH_RAY_SHADOW_TRANSPARENT */
+       };
+
+       const int nraytypes = sizeof(raytypes)/sizeof(raytypes[0]);
+       ss->attribute("raytypes", TypeDesc(TypeDesc::STRING, nraytypes), raytypes);
+
+       OSLShader::register_closures(ss);
+
+       loaded_shaders.clear();
+}
+
+bool OSLShaderManager::osl_compile(const string& inputfile, const string& outputfile)
+{
+       vector<string> options;
+       string stdosl_path;
+
+       /* specify output file name */
+       options.push_back("-o");
+       options.push_back(outputfile);
+
+       /* specify standard include path */
+       options.push_back("-I" + path_get("shader"));
+       stdosl_path = path_get("shader/stdosl.h");
+
+       /* compile */
+       OSL::OSLCompiler *compiler = OSL::OSLCompiler::create();
+       bool ok = compiler->compile(inputfile, options, stdosl_path);
+       delete compiler;
+
+       return ok;
+}
+
+bool OSLShaderManager::osl_query(OSL::OSLQuery& query, const string& filepath)
+{
+       string searchpath = path_user_get("shaders");
+       return query.open(filepath, searchpath);
+}
+
+static string shader_filepath_hash(const string& filepath, uint64_t modified_time)
+{
+       /* compute a hash from filepath and modified time to detect changes */
+       MD5Hash md5;
+       md5.append((const uint8_t*)filepath.c_str(), filepath.size());
+       md5.append((const uint8_t*)&modified_time, sizeof(modified_time));
+
+       return md5.get_hex();
+}
+
+const char *OSLShaderManager::shader_test_loaded(const string& hash)
+{
+       set<string>::iterator it = loaded_shaders.find(hash);
+       return (it == loaded_shaders.end())? NULL: it->c_str();
+}
+
+const char *OSLShaderManager::shader_load_filepath(string filepath)
+{
+       size_t len = filepath.size();
+       string extension = filepath.substr(len - 4);
+       uint64_t modified_time = path_modified_time(filepath);
+
+       if(extension == ".osl") {
+               /* .OSL File */
+               string osopath = filepath.substr(0, len - 4) + ".oso";
+               uint64_t oso_modified_time = path_modified_time(osopath);
+
+               /* test if we have loaded the corresponding .OSO already */
+               if(oso_modified_time != 0) {
+                       const char *hash = shader_test_loaded(shader_filepath_hash(osopath, oso_modified_time));
+
+                       if(hash)
+                               return hash;
+               }
+
+               /* autocompile .OSL to .OSO if needed */
+               if(oso_modified_time == 0 || (oso_modified_time < modified_time)) {
+                       OSLShaderManager::osl_compile(filepath, osopath);
+                       modified_time = path_modified_time(osopath);
+               }
+               else
+                       modified_time = oso_modified_time;
+
+               filepath = osopath;
+       }
+       else {
+               if(extension == ".oso") {
+                       /* .OSO File, nothing to do */
+               }
+               else if(path_dirname(filepath) == "") {
+                       /* .OSO File in search path */
+                       filepath = path_join(path_user_get("shaders"), filepath + ".oso");
+               }
+               else {
+                       /* unknown file */
+                       return NULL;
+               }
+
+               /* test if we have loaded this .OSO already */
+               const char *hash = shader_test_loaded(shader_filepath_hash(filepath, modified_time));
+
+               if(hash)
+                       return hash;
+       }
+
+       /* read oso bytecode from file */
+       string bytecode_hash = shader_filepath_hash(filepath, modified_time);
+       string bytecode;
+
+       if(!path_read_text(filepath, bytecode)) {
+               fprintf(stderr, "Cycles shader graph: failed to read file %s\n", filepath.c_str());
+               loaded_shaders.insert(bytecode_hash); /* to avoid repeat tries */
+               return NULL;
+       }
+
+       return shader_load_bytecode(bytecode_hash, bytecode);
+}
+
+const char *OSLShaderManager::shader_load_bytecode(const string& hash, const string& bytecode)
+{
+       ss->LoadMemoryShader(hash.c_str(), bytecode.c_str());
+
+       return loaded_shaders.insert(hash).first->c_str();
+}
+
 /* Graph Compiler */
 
-OSLCompiler::OSLCompiler(void *shadingsys_)
+OSLCompiler::OSLCompiler(void *manager_, void *shadingsys_)
 {
+       manager = manager_;
        shadingsys = shadingsys_;
        current_type = SHADER_TYPE_SURFACE;
        current_shader = NULL;
@@ -235,10 +361,18 @@ bool OSLCompiler::node_skip_input(ShaderNode *node, ShaderInput *input)
        return false;
 }
 
-void OSLCompiler::add(ShaderNode *node, const char *name)
+void OSLCompiler::add(ShaderNode *node, const char *name, bool isfilepath)
 {
        OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
 
+       /* load filepath */
+       if(isfilepath) {
+               name = ((OSLShaderManager*)manager)->shader_load_filepath(name);
+
+               if(name == NULL)
+                       return;
+       }
+
        /* pass in fixed parameter values */
        foreach(ShaderInput *input, node->inputs) {
                if(!input->link) {
@@ -507,82 +641,85 @@ void OSLCompiler::compile_type(Shader *shader, ShaderGraph *graph, ShaderType ty
 
 void OSLCompiler::compile(OSLGlobals *og, Shader *shader)
 {
-       OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
-       ShaderGraph *graph = shader->graph;
-       ShaderNode *output = (graph)? graph->output(): NULL;
+       if(shader->need_update) {
+               OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys;
+               ShaderGraph *graph = shader->graph;
+               ShaderNode *output = (graph)? graph->output(): NULL;
 
-       /* copy graph for shader with bump mapping */
-       if(output->input("Surface")->link && output->input("Displacement")->link)
-               if(!shader->graph_bump)
-                       shader->graph_bump = shader->graph->copy();
+               /* copy graph for shader with bump mapping */
+               if(output->input("Surface")->link && output->input("Displacement")->link)
+                       if(!shader->graph_bump)
+                               shader->graph_bump = shader->graph->copy();
 
-       /* finalize */
-       shader->graph->finalize(false, true);
-       if(shader->graph_bump)
-               shader->graph_bump->finalize(true, true);
+               /* finalize */
+               shader->graph->finalize(false, true);
+               if(shader->graph_bump)
+                       shader->graph_bump->finalize(true, true);
 
-       current_shader = shader;
+               current_shader = shader;
 
-       shader->has_surface = false;
-       shader->has_surface_emission = false;
-       shader->has_surface_transparent = false;
-       shader->has_volume = false;
-       shader->has_displacement = false;
+               shader->has_surface = false;
+               shader->has_surface_emission = false;
+               shader->has_surface_transparent = false;
+               shader->has_volume = false;
+               shader->has_displacement = false;
 
-       /* generate surface shader */
-       if(graph && output->input("Surface")->link) {
-               compile_type(shader, shader->graph, SHADER_TYPE_SURFACE);
-               og->surface_state.push_back(ss->state());
+               /* generate surface shader */
+               if(shader->used && graph && output->input("Surface")->link) {
+                       compile_type(shader, shader->graph, SHADER_TYPE_SURFACE);
+                       shader->osl_surface_ref = ss->state();
+
+                       if(shader->graph_bump) {
+                               ss->clear_state();
+                               compile_type(shader, shader->graph_bump, SHADER_TYPE_SURFACE);
+                       }
 
-               if(shader->graph_bump) {
+                       shader->osl_surface_bump_ref = ss->state();
                        ss->clear_state();
-                       compile_type(shader, shader->graph_bump, SHADER_TYPE_SURFACE);
-                       og->surface_state.push_back(ss->state());
-               }
-               else
-                       og->surface_state.push_back(ss->state());
 
-               ss->clear_state();
+                       shader->has_surface = true;
+               }
+               else {
+                       shader->osl_surface_ref = OSL::ShadingAttribStateRef();
+                       shader->osl_surface_bump_ref = OSL::ShadingAttribStateRef();
+               }
 
-               shader->has_surface = true;
-       }
-       else {
-               og->surface_state.push_back(OSL::ShadingAttribStateRef());
-               og->surface_state.push_back(OSL::ShadingAttribStateRef());
-       }
+               /* generate volume shader */
+               if(shader->used && graph && output->input("Volume")->link) {
+                       compile_type(shader, shader->graph, SHADER_TYPE_VOLUME);
+                       shader->has_volume = true;
 
-       /* generate volume shader */
-       if(graph && output->input("Volume")->link) {
-               compile_type(shader, shader->graph, SHADER_TYPE_VOLUME);
-               shader->has_volume = true;
+                       shader->osl_volume_ref = ss->state();
+                       ss->clear_state();
+               }
+               else
+                       shader->osl_volume_ref = OSL::ShadingAttribStateRef();
 
-               og->volume_state.push_back(ss->state());
-               og->volume_state.push_back(ss->state());
-               ss->clear_state();
-       }
-       else {
-               og->volume_state.push_back(OSL::ShadingAttribStateRef());
-               og->volume_state.push_back(OSL::ShadingAttribStateRef());
+               /* generate displacement shader */
+               if(shader->used && graph && output->input("Displacement")->link) {
+                       compile_type(shader, shader->graph, SHADER_TYPE_DISPLACEMENT);
+                       shader->has_displacement = true;
+                       shader->osl_displacement_ref = ss->state();
+                       ss->clear_state();
+               }
+               else
+                       shader->osl_displacement_ref = OSL::ShadingAttribStateRef();
        }
 
-       /* generate displacement shader */
-       if(graph && output->input("Displacement")->link) {
-               compile_type(shader, shader->graph, SHADER_TYPE_DISPLACEMENT);
-               shader->has_displacement = true;
+       /* push state to array for lookup */
+       og->surface_state.push_back(shader->osl_surface_ref);
+       og->surface_state.push_back(shader->osl_surface_bump_ref);
 
-               og->displacement_state.push_back(ss->state());
-               og->displacement_state.push_back(ss->state());
-               ss->clear_state();
-       }
-       else {
-               og->displacement_state.push_back(OSL::ShadingAttribStateRef());
-               og->displacement_state.push_back(OSL::ShadingAttribStateRef());
-       }
+       og->volume_state.push_back(shader->osl_volume_ref);
+       og->volume_state.push_back(shader->osl_volume_ref);
+
+       og->displacement_state.push_back(shader->osl_displacement_ref);
+       og->displacement_state.push_back(shader->osl_displacement_ref);
 }
 
 #else
 
-void OSLCompiler::add(ShaderNode *node, const char *name)
+void OSLCompiler::add(ShaderNode *node, const char *name, bool isfilepath)
 {
 }
 
index 90107a34a98e07c415c4becda3bbb44be910d16e..cee37c58d740d1a1046ea996d9061d7151006117 100644 (file)
 #define __OSL_H__
 
 #include "util_set.h"
+#include "util_string.h"
 
 #include "shader.h"
 
 #ifdef WITH_OSL
+#include <OSL/oslcomp.h>
 #include <OSL/oslexec.h>
+#include <OSL/oslquery.h>
 #endif
 
 CCL_NAMESPACE_BEGIN
@@ -52,11 +55,24 @@ public:
        void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress);
        void device_free(Device *device, DeviceScene *dscene);
 
-private:
+       /* osl compile and query */
+       static bool osl_compile(const string& inputfile, const string& outputfile);
+       static bool osl_query(OSL::OSLQuery& query, const string& filepath);
+
+       /* shader file loading, all functions return pointer to hash string if found */
+       const char *shader_test_loaded(const string& hash);
+       const char *shader_load_bytecode(const string& hash, const string& bytecode);
+       const char *shader_load_filepath(string filepath);
+
+protected:
+       void texture_system_init();
+       void shading_system_init();
+
        OSL::ShadingSystem *ss;
        OSL::TextureSystem *ts;
        OSLRenderServices *services;
        OSL::ErrorHandler errhandler;
+       set<string> loaded_shaders;
 };
 
 #endif
@@ -65,10 +81,10 @@ private:
 
 class OSLCompiler {
 public:
-       OSLCompiler(void *shadingsys);
+       OSLCompiler(void *manager, void *shadingsys);
        void compile(OSLGlobals *og, Shader *shader);
 
-       void add(ShaderNode *node, const char *name);
+       void add(ShaderNode *node, const char *name, bool isfilepath = false);
 
        void parameter(const char *name, float f);
        void parameter_color(const char *name, float3 f);
@@ -104,6 +120,7 @@ private:
        void generate_nodes(const set<ShaderNode*>& nodes);
 
        void *shadingsys;
+       void *manager;
        ShaderType current_type;
        Shader *current_shader;
 };
index fae1d6bd81ca32265d1b3461d9186dce4b9ebcfb..17f7fbd43d656fa69c289c700782f3a71f26ed0b 100644 (file)
@@ -49,6 +49,8 @@ Shader::Shader()
        has_volume = false;
        has_displacement = false;
 
+       used = false;
+
        need_update = true;
        need_update_attributes = true;
 }
@@ -98,6 +100,16 @@ void Shader::tag_update(Scene *scene)
        }
 }
 
+void Shader::tag_used(Scene *scene)
+{
+       /* if an unused shader suddenly gets used somewhere, it needs to be
+        * recompiled because it was skipped for compilation before */
+       if(!used) {
+               need_update = true;
+               scene->shader_manager->need_update = true;
+       }
+}
+
 /* Shader Manager */
 
 ShaderManager::ShaderManager()
@@ -161,6 +173,27 @@ int ShaderManager::get_shader_id(uint shader, Mesh *mesh, bool smooth)
        return id;
 }
 
+void ShaderManager::device_update_shaders_used(Scene *scene)
+{
+       /* figure out which shaders are in use, so SVM/OSL can skip compiling them
+        * for speed and avoid loading image textures into memory */
+       foreach(Shader *shader, scene->shaders)
+               shader->used = false;
+
+       scene->shaders[scene->default_surface]->used = true;
+       scene->shaders[scene->default_light]->used = true;
+       scene->shaders[scene->default_background]->used = true;
+       scene->shaders[scene->default_holdout]->used = true;
+       scene->shaders[scene->default_empty]->used = true;
+
+       foreach(Mesh *mesh, scene->meshes)
+               foreach(uint shader, mesh->used_shaders)
+                       scene->shaders[shader]->used = true;
+
+       foreach(Light *light, scene->lights)
+               scene->shaders[light->shader]->used = true;
+}
+
 void ShaderManager::device_update_common(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress)
 {
        device_free_common(device, dscene);
index 02788008060200066c7ba77929e4b90dce74c3bc..373b3356f51dc88653f88aa8b71d3a6907ee8d1f 100644 (file)
 #include "util_string.h"
 #include "util_types.h"
 
+#ifdef WITH_OSL
+#include <OSL/oslexec.h>
+#endif
+
 CCL_NAMESPACE_BEGIN
 
 class Device;
@@ -75,11 +79,23 @@ public:
        /* requested mesh attributes */
        AttributeRequestSet attributes;
 
+       /* determined before compiling */
+       bool used;
+
+#ifdef WITH_OSL
+       /* osl shading state references */
+       OSL::ShadingAttribStateRef osl_surface_ref;
+       OSL::ShadingAttribStateRef osl_surface_bump_ref;
+       OSL::ShadingAttribStateRef osl_volume_ref;
+       OSL::ShadingAttribStateRef osl_displacement_ref;
+#endif
+
        Shader();
        ~Shader();
 
        void set_graph(ShaderGraph *graph);
        void tag_update(Scene *scene);
+       void tag_used(Scene *scene);
 };
 
 /* Shader Manager virtual base class
@@ -98,6 +114,7 @@ public:
        virtual void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress) = 0;
        virtual void device_free(Device *device, DeviceScene *dscene) = 0;
 
+       void device_update_shaders_used(Scene *scene);
        void device_update_common(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress);
        void device_free_common(Device *device, DeviceScene *dscene);
 
index c41d503b21748660ea7bac8c3b5d63aeb5c9439c..dc249984499238ae76bee0b23f0809fe9782dc90 100644 (file)
@@ -48,6 +48,9 @@ void SVMShaderManager::device_update(Device *device, DeviceScene *dscene, Scene
        /* test if we need to update */
        device_free(device, dscene);
 
+       /* determine which shaders are in use */
+       device_update_shaders_used(scene);
+
        /* svm_nodes */
        vector<int4> svm_nodes;
        size_t i;
@@ -609,36 +612,38 @@ void SVMCompiler::compile_type(Shader *shader, ShaderGraph *graph, ShaderType ty
                        output->stack_offset = SVM_STACK_INVALID;
        }
 
-       if(clin->link) {
-               bool generate = false;
-               if(type == SHADER_TYPE_SURFACE) {
-                       /* generate surface shader */
-                       generate = true;
-                       shader->has_surface = true;
-               }
-               else if(type == SHADER_TYPE_VOLUME) {
-                       /* generate volume shader */
-                       generate = true;
-                       shader->has_volume = true;
-               }
-               else if(type == SHADER_TYPE_DISPLACEMENT) {
-                       /* generate displacement shader */
-                       generate = true;
-                       shader->has_displacement = true;
-               }
+       if(shader->used) {
+               if(clin->link) {
+                       bool generate = false;
+                       if(type == SHADER_TYPE_SURFACE) {
+                               /* generate surface shader */
+                               generate = true;
+                               shader->has_surface = true;
+                       }
+                       else if(type == SHADER_TYPE_VOLUME) {
+                               /* generate volume shader */
+                               generate = true;
+                               shader->has_volume = true;
+                       }
+                       else if(type == SHADER_TYPE_DISPLACEMENT) {
+                               /* generate displacement shader */
+                               generate = true;
+                               shader->has_displacement = true;
+                       }
 
-               if(generate) {
-                       set<ShaderNode*> done;
+                       if(generate) {
+                               set<ShaderNode*> done;
 
-                       if(use_multi_closure)
-                               generate_multi_closure(clin->link->parent, done, SVM_STACK_INVALID);
-                       else
-                               generate_closure(clin->link->parent, done);
+                               if(use_multi_closure)
+                                       generate_multi_closure(clin->link->parent, done, SVM_STACK_INVALID);
+                               else
+                                       generate_closure(clin->link->parent, done);
+                       }
                }
-       }
 
-       /* compile output node */
-       node->compile(*this);
+               /* compile output node */
+               node->compile(*this);
+       }
 
        add_node(NODE_END, 0, 0, 0);
 }
index 43e08e64f39fc7d03fef77b6346bd10549ea5a20..aab177d9fe677be8c2fffd4f580173d712bbcf6f 100644 (file)
@@ -44,7 +44,7 @@ public:
        bool append_file(const string& filepath);
        string get_hex();
 
-       protected:
+protected:
        void process(const uint8_t *data);
        void finish(uint8_t digest[16]);
 
index a571fe8111855e544be82b07ba13f0743430a235..8cf23bc6a764f5fa1d89a8ca272992b711f8d0de 100644 (file)
@@ -170,7 +170,7 @@ bool path_read_binary(const string& path, vector<uint8_t>& binary)
        return true;
 }
 
-static bool path_read_text(const string& path, string& text)
+bool path_read_text(const string& path, string& text)
 {
        vector<uint8_t> binary;
 
@@ -184,6 +184,14 @@ static bool path_read_text(const string& path, string& text)
        return true;
 }
 
+uint64_t path_modified_time(const string& path)
+{
+       if(boost::filesystem::exists(path))
+               return (uint64_t)boost::filesystem::last_write_time(path);
+       
+       return 0;
+}
+
 string path_source_replace_includes(const string& source_, const string& path)
 {
        /* our own little c preprocessor that replaces #includes with the file
index 6cba6a3158f0f2d5c75f9b018f7f4b8b3743b27c..89e4452ecd91950e7b437ddc70fc4dd67c49c30b 100644 (file)
@@ -45,6 +45,9 @@ string path_files_md5_hash(const string& dir);
 void path_create_directories(const string& path);
 bool path_write_binary(const string& path, const vector<uint8_t>& binary);
 bool path_read_binary(const string& path, vector<uint8_t>& binary);
+bool path_read_text(const string& path, string& text);
+
+uint64_t path_modified_time(const string& path);
 
 string path_source_replace_includes(const string& source, const string& path);
 
index 2fd615700111bc9897dca182f0d92eba46d18826..37cde2c2837774b3cb89916a9bfff53e7c6ba924 100644 (file)
@@ -110,7 +110,7 @@ void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
 #endif
 
 /* there are some version inbetween, which have avio_... functions but no
  AVIO_FLAG_... */
* AVIO_FLAG_... */
 #ifndef AVIO_FLAG_WRITE
 #define AVIO_FLAG_WRITE URL_WRONLY
 #endif
index 7c3e2f35ac958bca6bf7e81b399bdbbdadf48363..27720a01a3fec2191f5d49b0937e0c1605c5205a 100644 (file)
@@ -1159,7 +1159,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
                                        NSEnumerator *enumerator;
                                        NSImageRep *representation;
                                        
-                                       ibuf = IMB_allocImBuf (imgSize.width , imgSize.height, 32, IB_rect);
+                                       ibuf = IMB_allocImBuf (imgSize.width, imgSize.height, 32, IB_rect);
                                        if (!ibuf) {
                                                [droppedImg release];
                                                return GHOST_kFailure;
index 55879e85cdfea2549bfd8cda9b725e152b7f4336..99c64d956cb3412422d251ad9be6f22c3ba135f2 100644 (file)
@@ -125,7 +125,6 @@ set(SRC
        ../../extern/Eigen3/Eigen/src/Cholesky/LLT.h
        ../../extern/Eigen3/Eigen/src/Cholesky/LLT_MKL.h
        ../../extern/Eigen3/Eigen/src/CholmodSupport/CholmodSupport.h
-       ../../extern/Eigen3/Eigen/src/Core/arch
        ../../extern/Eigen3/Eigen/src/Core/Array.h
        ../../extern/Eigen3/Eigen/src/Core/ArrayBase.h
        ../../extern/Eigen3/Eigen/src/Core/ArrayWrapper.h
@@ -167,7 +166,6 @@ set(SRC
        ../../extern/Eigen3/Eigen/src/Core/PlainObjectBase.h
        ../../extern/Eigen3/Eigen/src/Core/Product.h
        ../../extern/Eigen3/Eigen/src/Core/ProductBase.h
-       ../../extern/Eigen3/Eigen/src/Core/products
        ../../extern/Eigen3/Eigen/src/Core/Random.h
        ../../extern/Eigen3/Eigen/src/Core/Redux.h
        ../../extern/Eigen3/Eigen/src/Core/Replicate.h
@@ -183,14 +181,9 @@ set(SRC
        ../../extern/Eigen3/Eigen/src/Core/Transpose.h
        ../../extern/Eigen3/Eigen/src/Core/Transpositions.h
        ../../extern/Eigen3/Eigen/src/Core/TriangularMatrix.h
-       ../../extern/Eigen3/Eigen/src/Core/util
        ../../extern/Eigen3/Eigen/src/Core/VectorBlock.h
        ../../extern/Eigen3/Eigen/src/Core/VectorwiseOp.h
        ../../extern/Eigen3/Eigen/src/Core/Visitor.h
-       ../../extern/Eigen3/Eigen/src/Core/arch/AltiVec
-       ../../extern/Eigen3/Eigen/src/Core/arch/Default
-       ../../extern/Eigen3/Eigen/src/Core/arch/NEON
-       ../../extern/Eigen3/Eigen/src/Core/arch/SSE
        ../../extern/Eigen3/Eigen/src/Core/arch/AltiVec/Complex.h
        ../../extern/Eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h
        ../../extern/Eigen3/Eigen/src/Core/arch/Default/Settings.h
@@ -236,7 +229,6 @@ set(SRC
        ../../extern/Eigen3/Eigen/src/Eigen2Support/Block.h
        ../../extern/Eigen3/Eigen/src/Eigen2Support/Cwise.h
        ../../extern/Eigen3/Eigen/src/Eigen2Support/CwiseOperators.h
-       ../../extern/Eigen3/Eigen/src/Eigen2Support/Geometry
        ../../extern/Eigen3/Eigen/src/Eigen2Support/Lazy.h
        ../../extern/Eigen3/Eigen/src/Eigen2Support/LeastSquares.h
        ../../extern/Eigen3/Eigen/src/Eigen2Support/LU.h
@@ -274,7 +266,6 @@ set(SRC
        ../../extern/Eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h
        ../../extern/Eigen3/Eigen/src/Geometry/AlignedBox.h
        ../../extern/Eigen3/Eigen/src/Geometry/AngleAxis.h
-       ../../extern/Eigen3/Eigen/src/Geometry/arch
        ../../extern/Eigen3/Eigen/src/Geometry/EulerAngles.h
        ../../extern/Eigen3/Eigen/src/Geometry/Homogeneous.h
        ../../extern/Eigen3/Eigen/src/Geometry/Hyperplane.h
@@ -297,7 +288,6 @@ set(SRC
        ../../extern/Eigen3/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h
        ../../extern/Eigen3/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h
        ../../extern/Eigen3/Eigen/src/Jacobi/Jacobi.h
-       ../../extern/Eigen3/Eigen/src/LU/arch
        ../../extern/Eigen3/Eigen/src/LU/Determinant.h
        ../../extern/Eigen3/Eigen/src/LU/FullPivLU.h
        ../../extern/Eigen3/Eigen/src/LU/Inverse.h
index 3dce804c543e63c7979e2e37be8f05aecbc71605..6011de0bddb32a3b1fa75baef22054b7d6d7bfbd 100644 (file)
@@ -386,7 +386,7 @@ extern "C" float *smoke_turbulence_get_flame(WTURBULENCE *wt)
 
 extern "C" void smoke_turbulence_get_res(WTURBULENCE *wt, int *res)
 {
-       if(wt) {
+       if (wt) {
                Vec3Int r = wt->getResBig();
                res[0] = r[0];
                res[1] = r[1];
@@ -396,9 +396,9 @@ extern "C" void smoke_turbulence_get_res(WTURBULENCE *wt, int *res)
 
 extern "C" int smoke_turbulence_get_cells(WTURBULENCE *wt)
 {
-       if(wt) {
+       if (wt) {
                Vec3Int r = wt->getResBig();
-               return r[0]*r[1]*r[2];
+               return r[0] * r[1] * r[2];
        }
        return 0;
 }
index 3bfd2772991286de15a8c10472816bad20e0882f..cf0e69170a27d1cc67e508433c23b324bc651813 100644 (file)
@@ -95,7 +95,7 @@ wchar_t *alloc_utf16_from_8(const char *in8, size_t add);
                wchar_t *in8str ## _16 = alloc_utf16_from_8((char *)in8str, 0)
 
 #define UTF16_UN_ENCODE(in8str) \
-    free(in8str ## _16); } (void)0
+       free(in8str ## _16); } (void)0
 
 #ifdef __cplusplus 
 }
index 4bfcee9c583a8ad131cee7a670edda206fa0b4e6..0db3f85f1ff38c539bab0228f9d4830705f091ae 100644 (file)
@@ -40,46 +40,46 @@ LANGUAGES_CATEGORIES = (
 )
 LANGUAGES = (
     # ID, UI english label, ISO code.
-    ( 0, "Default (Default)", "DEFAULT"),
-    ( 1, "English (English)", "en_US"),
-    ( 2, "Japanese (日本語)", "ja_JP"),
-    ( 3, "Dutch (Nederlandse taal)", "nl_NL"),
-    ( 4, "Italian (Italiano)", "it_IT"),
-    ( 5, "German (Deutsch)", "de_DE"),
-    ( 6, "Finnish (Suomi)", "fi_FI"),
-    ( 7, "Swedish (Svenska)", "sv_SE"),
-    ( 8, "French (Français)", "fr_FR"),
-    ( 9, "Spanish (Español)", "es"),
-    (10, "Catalan (Català)", "ca_AD"),
-    (11, "Czech (Český)", "cs_CZ"),
-    (12, "Portuguese (Português)", "pt_PT"),
-    (13, "Simplified Chinese (简体中文)", "zh_CN"),
-    (14, "Traditional Chinese (繁體中文)", "zh_TW"),
-    (15, "Russian (Русский)", "ru_RU"),
-    (16, "Croatian (Hrvatski)", "hr_HR"),
-    (17, "Serbian (Српски)", "sr_RS"),
-    (18, "Ukrainian (Український)", "uk_UA"),
-    (19, "Polish (Polski)", "pl_PL"),
-    (20, "Romanian (Român)", "ro_RO"), # XXX No po's yet.
+    ( 0, "Default (Default)", "DEFAULT", ""),
+    ( 1, "English (English)", "en_US", "english"),
+    ( 2, "Japanese (日本語)", "ja_JP", "japanese"),
+    ( 3, "Dutch (Nederlandse taal)", "nl_NL", "dutch"),
+    ( 4, "Italian (Italiano)", "it_IT", "italian"),
+    ( 5, "German (Deutsch)", "de_DE", "german"),
+    ( 6, "Finnish (Suomi)", "fi_FI", "finnish"),
+    ( 7, "Swedish (Svenska)", "sv_SE", "swedish"),
+    ( 8, "French (Français)", "fr_FR", "french"),
+    ( 9, "Spanish (Español)", "es", "spanish"),
+    (10, "Catalan (Català)", "ca_AD", "catalan"),
+    (11, "Czech (Český)", "cs_CZ", "czech"),
+    (12, "Portuguese (Português)", "pt_PT", "portuguese_portugal"),
+    (13, "Simplified Chinese (简体中文)", "zh_CN", "Chinese (Simplified)_China.1252"),
+    (14, "Traditional Chinese (繁體中文)", "zh_TW", "Chinese (Traditional)_China.1252"),
+    (15, "Russian (Русский)", "ru_RU", "russian"),
+    (16, "Croatian (Hrvatski)", "hr_HR", "croatian"),
+    (17, "Serbian (Српски)", "sr_RS", "serbian"),
+    (18, "Ukrainian (Український)", "uk_UA", "ukrainian"),
+    (19, "Polish (Polski)", "pl_PL", "polish"),
+    (20, "Romanian (Român)", "ro_RO", "romanian"),
     # Using the utf8 flipped form of Arabic (العربية).
-    (21, "Arabic (ﺔﻴﺑﺮﻌﻟﺍ)", "ar_EG"),
-    (22, "Bulgarian (Български)", "bg_BG"),
-    (23, "Greek (Ελληνικά)", "el_GR"),
-    (24, "Korean (한국 언어)", "ko_KR"), # XXX No po's yet.
-    (25, "Nepali (नेपाली)", "ne_NP"),
+    (21, "Arabic (ﺔﻴﺑﺮﻌﻟﺍ)", "ar_EG", "arabic"),
+    (22, "Bulgarian (Български)", "bg_BG", "bulgarian"),
+    (23, "Greek (Ελληνικά)", "el_GR", "greek"),
+    (24, "Korean (한국 언어)", "ko_KR", "korean"),
+    (25, "Nepali (नेपाली)", "ne_NP", "nepali"),
     # Using the utf8 flipped form of Persian (فارسی).
-    (26, "Persian (ﯽﺳﺭﺎﻓ)", "fa_IR"),
-    (27, "Indonesian (Bahasa indonesia)", "id_ID"),
-    (28, "Serbian Latin (Srpski latinica)", "sr_RS@latin"),
-    (29, "Kyrgyz (Кыргыз тили)", "ky_KG"),
-    (30, "Turkish (Türkçe)", "tr_TR"),
-    (31, "Hungarian (Magyar)", "hu_HU"),
-    (32, "Brazilian Portuguese (Português do Brasil)", "pt_BR"),
+    (26, "Persian (ﯽﺳﺭﺎﻓ)", "fa_IR", "farsi"),
+    (27, "Indonesian (Bahasa indonesia)", "id_ID", "indonesian"),
+    (28, "Serbian Latin (Srpski latinica)", "sr_RS@latin", "serbian (latin)"),
+    (29, "Kyrgyz (Кыргыз тили)", "ky_KG", "kyrgyz"),
+    (30, "Turkish (Türkçe)", "tr_TR", "turkish"),
+    (31, "Hungarian (Magyar)", "hu_HU", "hungarian"),
+    (32, "Brazilian Portuguese (Português do Brasil)", "pt_BR", "protuguese_brazil"),
     # Using the utf8 flipped form of Hebrew (עִבְרִית)).
-    (33, "Hebrew (תירִבְעִ)", "he_IL"),
-    (34, "Estonian (Eestlane)", "et_EE"),
-    (35, "Esperanto (Esperanto)", "eo"),
-    (36, "Spanish from Spain (Español de España)", "es_ES"),
+    (33, "Hebrew (תירִבְעִ)", "he_IL", "hebrew"),
+    (34, "Estonian (Eestlane)", "et_EE", "estonian"),
+    (35, "Esperanto (Esperanto)", "eo", "esperanto"),
+    (36, "Spanish from Spain (Español de España)", "es_ES", "spanish_spain"),
 )
 
 # Name of language file used by Blender to generate translations' menu.
index 5eeeb152af7665429ccc7527dc9f95ef9a14437c..d45a55432207fdc141b46643bca1410fb9858ce9 100755 (executable)
@@ -53,7 +53,7 @@ FLAG_MESSAGES = {
 def find_matching_po(languages, stats, forbidden):
     """Match languages defined in LANGUAGES setting to relevant po, if possible!"""
     ret = []
-    for uid, label, org_key in languages:
+    for uid, label, org_key, long_loc in languages:
         key = org_key
         if key not in stats:
             # Try to simplify the key (eg from es_ES to es).
@@ -64,11 +64,11 @@ def find_matching_po(languages, stats, forbidden):
                 key = key + org_key[org_key.index('@'):]
         if key in stats:
             if key in forbidden:
-                ret.append((stats[key], uid, label, org_key, FORBIDDEN))
+                ret.append((stats[key], uid, label, org_key, long_loc, FORBIDDEN))
             else:
-                ret.append((stats[key], uid, label, org_key, OK))
+                ret.append((stats[key], uid, label, org_key, long_loc, OK))
         else:
-            ret.append((0.0, uid, label, org_key, MISSING))
+            ret.append((0.0, uid, label, org_key, long_loc, MISSING))
     return ret
 
 def main():
@@ -103,14 +103,14 @@ def main():
     stats = sorted(stats, key=lambda it: it[0], reverse=True)
     langs_cats = [[] for i in range(len(limits))]
     highest_uid = 0
-    for prop, uid, label, key, flag in stats:
+    for prop, uid, label, key, long_loc, flag in stats:
         if prop < limits[idx][0]:
             # Sub-sort languages by iso-codes.
             langs_cats[idx].sort(key=lambda it: it[2])
             idx += 1
         if prop < min_trans and flag == OK:
             flag = TOOLOW
-        langs_cats[idx].append((uid, label, key, flag))
+        langs_cats[idx].append((uid, label, key, long_loc, flag))
         if abs(uid) > highest_uid:
             highest_uid = abs(uid)
     # Sub-sort last group of languages by iso-codes!
@@ -120,7 +120,7 @@ def main():
         f.write("# and to generate translation menu.\n")
         f.write("#\n")
         f.write("# File format:\n")
-        f.write("# ID:MENULABEL:ISOCODE\n")
+        f.write("# ID:MENULABEL:ISOCODE:WINCODE\n")
         f.write("# ID must be unique, except for 0 value (marks categories for menu).\n")
         f.write("# Line starting with a # are comments!\n")
         f.write("#\n")
@@ -130,17 +130,17 @@ def main():
             f.write("#\n")
             # Write "category menu label"...
             if langs_cat:
-                f.write("0:{}:\n".format(cat[1]))
+                f.write("0:{}::\n".format(cat[1]))
             else:
                 # Do not write the category if it has no language!
                 f.write("# Void category! #0:{}:\n".format(cat[1]))
             # ...and all matching language entries!
-            for uid, label, key, flag in langs_cat:
+            for uid, label, key, long_loc, flag in langs_cat:
                 if flag == OK:
-                    f.write("{}:{}:{}\n".format(uid, label, key))
+                    f.write("{}:{}:{}:{}\n".format(uid, label, key, long_loc))
                 else:
                     # Non-existing, commented entry!
-                    f.write("# {} #{}:{}:{}\n".format(FLAG_MESSAGES[flag], uid, label, key))
+                    f.write("# {} #{}:{}:{}:{}\n".format(FLAG_MESSAGES[flag], uid, label, key, long_loc))
 
 
 if __name__ == "__main__":
index 5482912345de0b00552adb7d3fa55ad1ff70eff2..b7adf53dbf181af845f7592f86fa48dc8be54be9 100644 (file)
@@ -185,10 +185,12 @@ class ExecutePreset(Operator):
 
     filepath = StringProperty(
             subtype='FILE_PATH',
+            options={'SKIP_SAVE'},
             )
     menu_idname = StringProperty(
             name="Menu ID Name",
             description="ID name of the menu this was called from",
+            options={'SKIP_SAVE'},
             )
 
     def execute(self, context):
@@ -504,7 +506,7 @@ class AddPresetKeyconfig(AddPresetBase, Operator):
 
 
 class AddPresetOperator(AddPresetBase, Operator):
-    """Add an Application Interaction Preset"""
+    """Add an Operator Preset"""
     bl_idname = "wm.operator_preset_add"
     bl_label = "Operator Preset"
     preset_menu = "WM_MT_operator_presets"
@@ -512,7 +514,7 @@ class AddPresetOperator(AddPresetBase, Operator):
     operator = StringProperty(
             name="Operator",
             maxlen=64,
-            options={'HIDDEN'},
+            options={'HIDDEN', 'SKIP_SAVE'},
             )
 
     preset_defines = [
index 5cc041476c96a1758b358c79129a9360477263f8..2bff11a686d43984088ff9260d742ca9ec1e5755 100644 (file)
@@ -1290,7 +1290,7 @@ class WM_OT_blenderplayer_start(Operator):
             return {'CANCELLED'}
 
         filepath = os.path.join(bpy.app.tempdir, "game.blend")
-        bpy.ops.wm.save_as_mainfile(filepath=filepath, check_existing=False, copy=True)
+        bpy.ops.wm.save_as_mainfile('EXEC_DEFAULT', filepath=filepath, copy=True)
         subprocess.call([player_path, filepath])
         return {'FINISHED'}
 
index 769715ef1b9a77d67bfd877e185fc241c273d1e5..71fdc1d7b67722c05d5ec109c5c5ce8f6adfc920 100644 (file)
@@ -118,7 +118,7 @@ class DATA_PT_lamp(DataButtonsPanel, Panel):
 
 class DATA_PT_sunsky(DataButtonsPanel, Panel):
     bl_label = "Sky & Atmosphere"
-    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+    COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     @classmethod
     def poll(cls, context):
index 5ff49a7d369b3d4b74a68dfe709b18f90aefdc3b..bf0c9eb762a4a61be7e6c16ed250049fea65dd7e 100644 (file)
@@ -190,6 +190,14 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, Panel):
             layout.operator("mesh.navmesh_reset")
             layout.operator("mesh.navmesh_clear")
 
+        if physics_type not in {'NO_COLLISION', 'OCCLUDE'}:
+            layout.separator()
+            split = layout.split()
+
+            col = split.column()
+            col.prop(game, "collision_group")
+            col = split.column()
+            col.prop(game, "collision_mask")
 
 class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, Panel):
     bl_label = "Collision Bounds"
index 33ce0e07f177ff13b4369c2e934e69ddd7b73088..aa7d78225d5be91e427ba355dc4f29ef27da0624 100644 (file)
@@ -228,11 +228,13 @@ class RENDER_PT_performance(RenderButtonsPanel, Panel):
         split = layout.split()
 
         col = split.column()
-        col.label(text="Threads:")
-        col.row().prop(rd, "threads_mode", expand=True)
-        sub = col.column()
-        sub.enabled = rd.threads_mode == 'FIXED'
-        sub.prop(rd, "threads")
+        sub = col.column(align=True)
+        sub.label(text="Threads:")
+        sub.row().prop(rd, "threads_mode", expand=True)
+        subsub = sub.column()
+        subsub.enabled = rd.threads_mode == 'FIXED'
+        subsub.prop(rd, "threads")
+        
         sub = col.column(align=True)
         sub.label(text="Tiles:")
         sub.prop(rd, "parts_x", text="X")
index 9ab2a772df0d812c81cb3323b47c52861935b992..c0f2d3c361bab6cd91f1bdaaa7f8494b560bad6f 100644 (file)
@@ -112,8 +112,9 @@ class INFO_MT_file(Menu):
 
         layout.separator()
 
-        layout.operator_context = 'INVOKE_AREA'
-        layout.operator("wm.save_mainfile", text="Save", icon='FILE_TICK').check_existing = False
+        layout.operator_context = 'EXEC_AREA' if  context.blend_data.is_saved else 'INVOKE_AREA'
+        layout.operator("wm.save_mainfile", text="Save", icon='FILE_TICK')
+
         layout.operator_context = 'INVOKE_AREA'
         layout.operator("wm.save_as_mainfile", text="Save As...", icon='SAVE_AS')
         layout.operator_context = 'INVOKE_AREA'
index 5b7ecbfb6180fc18c65fee568b9acbac81e3f5a1..c46b1c20738f55a6d6f5b111c22810ee86709349 100644 (file)
@@ -166,11 +166,19 @@ class NODE_MT_node(Menu):
         layout.operator("node.delete_reconnect")
 
         layout.separator()
+
+        layout.operator("node.join", text="Join in new Frame")
+        layout.operator("node.detach", text="Remove from Frame")
+
+        layout.separator()
+
         layout.operator("node.link_make")
         layout.operator("node.link_make", text="Make and Replace Links").replace = True
         layout.operator("node.links_cut")
+        layout.operator("node.links_detach")
 
         layout.separator()
+
         layout.operator("node.group_edit")
         layout.operator("node.group_ungroup")
         layout.operator("node.group_make")
index eca9bc22db985aa41d66f423bd65e20c16f2fe62..8a853a09199fb9c5fcd248a3738d95234c7de9be 100644 (file)
@@ -56,12 +56,17 @@ class TEXT_HT_header(Header):
         row.prop(st, "show_syntax_highlight", text="")
 
         if text:
-            row = layout.row()
-            row.operator("text.run_script")
+            osl = text.name.endswith(".osl") or text.name.endswith(".oso")
 
-            row = layout.row()
-            row.active = text.name.endswith(".py")
-            row.prop(text, "use_module")
+            if osl:
+                row = layout.row()
+                row.operator("node.shader_script_update")
+            else:
+                row = layout.row()
+                row.operator("text.run_script")
+
+                row = layout.row()
+                row.prop(text, "use_module")
 
             row = layout.row()
             if text.filepath:
index da498268b9bb2777003d46ba59682295c9d8682c..81d67aa662c6c04c01a845c168231a90647592de 100644 (file)
@@ -186,10 +186,10 @@ class InputKeyMapPanel:
                 sub = split.column()
                 subrow = sub.row(align=True)
 
-                if map_type in {'KEYBOARD', 'NDOF'}:
+                if map_type == 'KEYBOARD':
                     subrow.prop(kmi, "type", text="", event=True)
                     subrow.prop(kmi, "value", text="")
-                elif map_type == 'MOUSE':
+                elif map_type in {'MOUSE', 'NDOF'}:
                     subrow.prop(kmi, "type", text="")
                     subrow.prop(kmi, "value", text="")
 
index 65e5b529487fa1ce7da0ada8e27778fef25021b2..5d949e89caa5cb963e34df2ad3c3352228461f19 100644 (file)
@@ -571,7 +571,7 @@ class VIEW3D_MT_select_edit_mesh(Menu):
         layout.separator()
 
         layout.operator("mesh.select_random", text="Random")
-        layout.operator("mesh.select_nth", text="Every N Number of Verts")
+        layout.operator("mesh.select_nth")
         layout.operator("mesh.edges_select_sharp", text="Sharp Edges")
         layout.operator("mesh.faces_select_linked_flat", text="Linked Flat Faces")
         layout.operator("mesh.select_interior_faces", text="Interior Faces")
@@ -579,7 +579,7 @@ class VIEW3D_MT_select_edit_mesh(Menu):
 
         layout.separator()
 
-        layout.operator("mesh.select_by_number_vertices", text="By Number of Verts")
+        layout.operator("mesh.select_face_by_sides")
         if context.scene.tool_settings.mesh_select_mode[2] is False:
             layout.operator("mesh.select_non_manifold", text="Non Manifold")
         layout.operator("mesh.select_loose_verts", text="Loose Verts/Edges")
@@ -968,8 +968,9 @@ class VIEW3D_MT_object_parent(Menu):
     def draw(self, context):
         layout = self.layout
 
-        layout.operator_menu_enum("object.parent_set", "type", text="Set")
-        layout.operator_menu_enum("object.parent_clear", "type", text="Clear")
+        layout.operator_enum("object.parent_set", "type")
+        layout.separator()
+        layout.operator_enum("object.parent_clear", "type")
 
 
 class VIEW3D_MT_object_track(Menu):
@@ -978,8 +979,9 @@ class VIEW3D_MT_object_track(Menu):
     def draw(self, context):
         layout = self.layout
 
-        layout.operator_menu_enum("object.track_set", "type", text="Set")
-        layout.operator_menu_enum("object.track_clear", "type", text="Clear")
+        layout.operator_enum("object.track_set", "type")
+        layout.separator()
+        layout.operator_enum("object.track_clear", "type")
 
 
 class VIEW3D_MT_object_group(Menu):
@@ -1951,10 +1953,6 @@ class VIEW3D_MT_edit_mesh_dissolve(Menu):
 
         layout.separator()
 
-        layout.operator_enum("mesh.dissolve", "type")
-
-        layout.separator()
-
         layout.operator("mesh.dissolve_limited")
 
 
index 9f4cf72d1207a72b7c06a67df9ac9261195bdc32..501f8cd2958c696e740d3231fb9784b0fc0d329f 100644 (file)
@@ -65,12 +65,14 @@ static char global_language[32];
 static char global_encoding_name[32];
 
 static const char **locales = NULL;
+static char **long_locales = NULL; /* XXX Temp fix until we get a final solution with modern intl lib under windows! */
 static int num_locales = 0;
 static EnumPropertyItem *locales_menu = NULL;
 static int num_locales_menu = 0;
 
 #define ULANGUAGE ((U.language >= 0 && U.language < num_locales) ? U.language : 0)
 #define LOCALE(_id) (locales ? locales[_id] : "")
+#define LONG_LOCALE(_id) (long_locales ? long_locales[_id] : "")
 
 static void free_locales(void)
 {
@@ -81,8 +83,18 @@ static void free_locales(void)
                        MEM_freeN((void*)locales_menu[idx].name);
                        MEM_freeN((void*)locales_menu[idx].description); /* Also frees locales's relevant value! */
                }
+
+               idx = num_locales;
+               while (idx--) {
+                       if (long_locales[idx]) {
+                               MEM_freeN(long_locales[idx]);
+                       }
+               }
+
                MEM_freeN(locales);
                locales = NULL;
+               MEM_freeN(long_locales);
+               long_locales = NULL;
        }
        if (locales_menu) {
                MEM_freeN(locales_menu);
@@ -128,9 +140,10 @@ static void fill_locales(void)
        /* Do not allocate locales with zero-sized mem, as LOCALE macro uses NULL locales as invalid marker! */
        if (num_locales > 0) {
                locales = MEM_callocN(num_locales * sizeof(char*), __func__);
+               long_locales = MEM_callocN(num_locales * sizeof(char*), __func__);
                while (line) {
                        int id;
-                       char *loc, *sep1, *sep2;
+                       char *loc, *sep1, *sep2, *sep3;
 
                        str = (char*) line->link;
                        if (str[0] == '#' || str[0] == '\0') {
@@ -144,23 +157,32 @@ static void fill_locales(void)
                                sep1++;
                                sep2 = strchr(sep1, ':');
                                if (sep2) {
+                                       locales_menu[idx].value = id;
+                                       locales_menu[idx].icon = 0;
+                                       locales_menu[idx].name = BLI_strdupn(sep1, sep2 - sep1);
+
+                                       sep2++;
+                                       sep3 = strchr(sep2, ':');
+                                       if (sep3) {
+                                               locales_menu[idx].identifier = loc = BLI_strdupn(sep2, sep3 - sep2);
 
-                                               locales_menu[idx].value = id;
-                                               locales_menu[idx].icon = 0;
-                                               locales_menu[idx].name = BLI_strdupn(sep1, sep2 - sep1);
-                                               locales_menu[idx].identifier = loc = BLI_strdup(sep2 + 1);
                                                if (id == 0) {
                                                        /* The DEFAULT item... */
-                                                       if (BLI_strnlen(loc, 2))
+                                                       if (BLI_strnlen(loc, 2)) {
                                                                locales[id] = locales_menu[idx].description = BLI_strdup("");
+                                                               long_locales[id] = BLI_strdup("");
+                                                       }
                                                        /* Menu "label", not to be stored in locales! */
-                                                       else
+                                                       else {
                                                                locales_menu[idx].description = BLI_strdup("");
+                                                       }
                                                }
-                                               else
+                                               else {
                                                        locales[id] = locales_menu[idx].description = BLI_strdup(loc);
+                                                       long_locales[id] = BLI_strdup(sep3 + 1);
+                                               }
                                                idx++;
-                               
+                                       }
                                }
                        }
 
@@ -243,43 +265,39 @@ static void get_language(const char *locale, const char *lang, char *language, c
 void BLF_lang_set(const char *str)
 {
        char *locreturn;
-       const char *short_locale;
        int ok = TRUE;
        int ulang = ULANGUAGE;
 
        if ((U.transopts & USER_DOTRANSLATE) == 0)
                return;
 
-       if (str)
-               short_locale = str;
-       else
-               short_locale = LOCALE(ulang);
-
 #if defined(_WIN32) && !defined(FREE_WINDOWS)
        {
-               if (short_locale) {
+               const char *long_locale = str ? str : LONG_LOCALE(ulang);
+               if (long_locale) {
                        char *envStr;
 
-                       if (ulang) /* Use system setting. */
+                       if (ulang)
+                               envStr = BLI_sprintfN("LANG=%s", long_locale);
+                       else /* Use system setting. */
                                envStr = BLI_sprintfN("LANG=%s", getenv("LANG"));
-                       else
-                               envStr = BLI_sprintfN("LANG=%s", short_locale);
 
                        gettext_putenv(envStr);
                        MEM_freeN(envStr);
                }
 
-               locreturn = setlocale(LC_ALL, short_locale);
+               locreturn = setlocale(LC_ALL, long_locale);
 
                if (locreturn == NULL) {
                        if (G.debug & G_DEBUG)
-                               printf("Could not change locale to %s\n", short_locale);
+                               printf("Could not change locale to %s\n", long_locale);
 
                        ok = FALSE;
                }
        }
 #else
        {
+               const char *short_locale = str ? str : LOCALE(ulang);
                static char default_lang[64] = "\0";
                static char default_language[64] = "\0";
 
index fa9223ba6e2c4f1f1ae17ebbca395046dd447506..c6c54cc6e8a3436213f9f565b9a79bc470532d4f 100644 (file)
@@ -148,6 +148,11 @@ typedef enum DMDrawFlag {
 typedef enum DMDirtyFlag {
        /* dm has valid tessellated faces, but tessellated CDDATA need to be updated. */
        DM_DIRTY_TESS_CDLAYERS = 1 << 0,
+       /* One of the MCOL layers have been updated, force updating of GPUDrawObject's colors buffer.
+        * This is necessary with modern, VBO draw code, as e.g. in vpaint mode me->mcol may be updated
+        * without actually rebuilding dm (hence by defautl keeping same GPUDrawObject, and same colors
+        * buffer, which prevents update during a stroke!). */
+       DM_DIRTY_MCOL_UPDATE_DRAW = 1 << 1,
 } DMDirtyFlag;
 
 typedef struct DerivedMesh DerivedMesh;
@@ -223,6 +228,7 @@ struct DerivedMesh {
        void *(*getVertData)(DerivedMesh * dm, int index, int type);
        void *(*getEdgeData)(DerivedMesh * dm, int index, int type);
        void *(*getTessFaceData)(DerivedMesh * dm, int index, int type);
+       void *(*getPolyData)(DerivedMesh * dm, int index, int type);
 
        /** Return a pointer to the entire array of vert/edge/face custom data
         * from the derived mesh (this gives a pointer to the actual data, not
@@ -231,7 +237,8 @@ struct DerivedMesh {
        void *(*getVertDataArray)(DerivedMesh * dm, int type);
        void *(*getEdgeDataArray)(DerivedMesh * dm, int type);
        void *(*getTessFaceDataArray)(DerivedMesh * dm, int type);
-       
+       void *(*getPolyDataArray)(DerivedMesh * dm, int type);
+
        /** Retrieves the base CustomData structures for
         * verts/edges/tessfaces/loops/facdes*/
        CustomData *(*getVertDataLayout)(DerivedMesh * dm);
@@ -493,6 +500,7 @@ void DM_add_poly_layer(struct DerivedMesh *dm, int type, int alloctype,
 void *DM_get_vert_data(struct DerivedMesh *dm, int index, int type);
 void *DM_get_edge_data(struct DerivedMesh *dm, int index, int type);
 void *DM_get_tessface_data(struct DerivedMesh *dm, int index, int type);
+void *DM_get_poly_data(struct DerivedMesh *dm, int index, int type);
 
 /* custom data layer access functions
  * return pointer to first data layer which matches type (a flat array)
@@ -701,4 +709,10 @@ void DM_debug_print(DerivedMesh *dm);
 void DM_debug_print_cdlayers(CustomData *cdata);
 #endif
 
+BLI_INLINE int DM_origindex_mface_mpoly(const int *index_mf_to_mpoly, const int *index_mp_to_orig, const int i)
+{
+       const int j = index_mf_to_mpoly[i];
+       return (j != ORIGINDEX_NONE) ? index_mp_to_orig[j] : ORIGINDEX_NONE;
+}
+
 #endif
index f30cc57bde4335dc4f099d4126939345e22ea2cf..96e05aa87b9c0dbcf810fd6b8e8d639d50a532be 100644 (file)
@@ -63,8 +63,8 @@ void                curvemapping_set_black_white(struct CurveMapping *cumap, con
 #define CURVEMAP_SLOPE_POSITIVE 1
 void                    curvemap_reset(struct CurveMap *cuma, const struct rctf *clipr, int preset, int slope);
 void                    curvemap_remove(struct CurveMap *cuma, const short flag);
-void                    curvemap_remove_point(struct CurveMap *cuma, struct CurveMapPoint *cmp);
-struct CurveMapPoint    *curvemap_insert(struct CurveMap *cuma, float x, float y);
+int                     curvemap_remove_point(struct CurveMap *cuma, struct CurveMapPoint *cmp);
+struct CurveMapPoint   *curvemap_insert(struct CurveMap *cuma, float x, float y);
 void                    curvemap_sethandle(struct CurveMap *cuma, int type);
 
 void                curvemapping_changed(struct CurveMapping *cumap, int rem_doubles);
index e387fc5f97ce319607f5ae8d2bfc43659e58c8ac..4736e7b7312657970753264637874f35dc44dd14 100644 (file)
@@ -122,7 +122,10 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
 void CustomData_bmesh_merge(struct CustomData *source, struct CustomData *dest, 
                             CustomDataMask mask, int alloctype, struct BMesh *bm, const char htype);
 
-/* frees data associated with a CustomData object (doesn't free the object
+/** NULL's all members and resets the typemap. */
+void CustomData_reset(struct CustomData *data);
+
+/** frees data associated with a CustomData object (doesn't free the object
  * itself, though)
  */
 void CustomData_free(struct CustomData *data, int totelem);
index 52a143ddf55a96b65577f92010b18359dd684f15..8306da714324195d6c9ae88f081fee6cac8869c1 100644 (file)
@@ -54,6 +54,7 @@ struct MDeformWeight    *defvert_verify_index(struct MDeformVert *dv, const int
 void                     defvert_add_index_notest(struct MDeformVert *dv, int defgroup, const float weight);
 void                     defvert_remove_group(struct MDeformVert *dvert, struct MDeformWeight *dw);
 void                     defvert_clear(struct MDeformVert *dvert);
+int                      defvert_find_shared(const struct MDeformVert *dvert_a, const struct MDeformVert *dvert_b);
 
 float  defvert_find_weight(const struct MDeformVert *dvert, const int defgroup);
 float  defvert_array_find_weight_safe(const struct MDeformVert *dvert, const int index, const int defgroup);
index 3cf4a2c5cdcd8de739cd32f107fa30f458c66973..a9f6a61a655dd163634ffbeb01ef759ccad7edc0 100644 (file)
@@ -154,6 +154,12 @@ __attribute__((nonnull))
 #endif
 ;
 
+void IDP_MergeGroup(IDProperty *dest, IDProperty *src, const int do_overwrite)
+#ifdef __GNUC__
+__attribute__((nonnull))
+#endif
+;
+
 /**
  * This function has a sanity check to make sure ID properties with the same name don't
  * get added to the group.
@@ -260,6 +266,12 @@ __attribute__((nonnull))
 #endif
 ;
 
+int IDP_EqualsProperties_ex(IDProperty *prop1, IDProperty *prop2, const int is_strict)
+#ifdef __GNUC__
+__attribute__((warn_unused_result))
+#endif
+;
+
 int IDP_EqualsProperties(struct IDProperty *prop1, struct IDProperty *prop2)
 #ifdef __GNUC__
 __attribute__((warn_unused_result))
@@ -306,11 +318,16 @@ void IDP_FreeProperty(struct IDProperty *prop);
 /** Unlinks any struct IDProperty<->ID linkage that might be going on.*/
 void IDP_UnlinkProperty(struct IDProperty *prop);
 
-#define IDP_Int(prop) ((prop)->data.val)
-#define IDP_Float(prop) (*(float *)&(prop)->data.val)
-#define IDP_String(prop) ((char *)(prop)->data.pointer)
-#define IDP_Array(prop) ((prop)->data.pointer)
-#define IDP_IDPArray(prop) ((IDProperty *)(prop)->data.pointer)
-#define IDP_Double(prop) (*(double *)&(prop)->data.val)
+#define IDP_Int(prop)                     ((prop)->data.val)
+#define IDP_Float(prop)        (*(float *)&(prop)->data.val)
+#define IDP_Double(prop)      (*(double *)&(prop)->data.val)
+#define IDP_String(prop)         ((char *) (prop)->data.pointer)
+#define IDP_Array(prop)                   ((prop)->data.pointer)
+#define IDP_IDPArray(prop) ((IDProperty *) (prop)->data.pointer)
+
+#ifdef DEBUG
+/* for printout only */
+void IDP_spit(IDProperty *prop);
+#endif
 
 #endif /* __BKE_IDPROP_H__ */
index cd1875f848b169730036caff863e2e43e7b132a4..29e03f66bcc6f3e36bea5ad97291affba16f8f88 100644 (file)
@@ -245,6 +245,7 @@ typedef struct bNodeType {
 #define NODE_CLASS_PARTICLES           25
 #define NODE_CLASS_TRANSFORM           30
 #define NODE_CLASS_COMBINE                     31
+#define NODE_CLASS_SCRIPT                      32
 #define NODE_CLASS_SHADER                      40
 #define NODE_CLASS_LAYOUT                      100
 
@@ -551,6 +552,7 @@ struct ShadeResult;
 #define SH_NODE_PARTICLE_INFO           168
 #define SH_NODE_TEX_BRICK                              169
 #define SH_NODE_BUMP                                   170
+#define SH_NODE_SCRIPT                                 171
 
 /* custom defines options for Material node */
 #define SH_NODE_MAT_DIFF   1
index 3b8d0eafd4d35727c84b62cd749da9a3e59116fa..653f2a42675d5f6fc0831e16586d5cb38c66173b 100644 (file)
@@ -64,10 +64,10 @@ typedef enum {
 } SubsurfFlags;
 
 struct DerivedMesh *subsurf_make_derived_from_derived(
-    struct DerivedMesh *dm,
-    struct SubsurfModifierData *smd,
-    float (*vertCos)[3],
-    SubsurfFlags flags);
+        struct DerivedMesh *dm,
+        struct SubsurfModifierData *smd,
+        float (*vertCos)[3],
+        SubsurfFlags flags);
 
 void subsurf_calculate_limit_positions(struct Mesh *me, float (*positions_r)[3]);
 
index 167f7bd831a2f2fb8ccc16e153ab8414fd712f7b..eb7004b1ceded0f710f86324c057aafe781ab07c 100644 (file)
@@ -114,7 +114,7 @@ void BKE_tracking_marker_get_subframe_position(struct MovieTrackingTrack *track,
 
 /* **** Object **** */
 struct MovieTrackingObject *BKE_tracking_object_add(struct MovieTracking *tracking, const char *name);
-void BKE_tracking_object_delete(struct MovieTracking *tracking, struct MovieTrackingObject *object);
+int BKE_tracking_object_delete(struct MovieTracking *tracking, struct MovieTrackingObject *object);
 
 void BKE_tracking_object_unique_name(struct MovieTracking *tracking, struct MovieTrackingObject *object);
 
index ddbd4588778d9f471604bcc6a78ecf6aedf7a891..fd92b7b5d69e83366572a3a842c147026305fe35 100644 (file)
@@ -265,9 +265,11 @@ void DM_init_funcs(DerivedMesh *dm)
        dm->getVertData = DM_get_vert_data;
        dm->getEdgeData = DM_get_edge_data;
        dm->getTessFaceData = DM_get_tessface_data;
+       dm->getPolyData = DM_get_poly_data;
        dm->getVertDataArray = DM_get_vert_da