Merging r41937 through r42061 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 22 Nov 2011 14:04:34 +0000 (14:04 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 22 Nov 2011 14:04:34 +0000 (14:04 +0000)
368 files changed:
SConstruct
build_files/cmake/cmake_consistency_check.py
build_files/cmake/project_info.py
build_files/cmake/project_source_info.py
build_files/scons/config/darwin-config.py
build_files/scons/config/freebsd7-config.py
build_files/scons/config/freebsd8-config.py
build_files/scons/config/freebsd9-config.py
build_files/scons/config/linux-config.py
build_files/scons/tools/Blender.py
build_files/scons/tools/btools.py
doc/manpage/blender.1.py
doc/python_api/epy/testbgl.py [deleted file]
doc/python_api/rst/info_gotcha.rst
doc/python_api/sphinx_doc_gen.py
extern/libmv/libmv/simple_pipeline/camera_intrinsics.cc
intern/cycles/CMakeLists.txt
intern/cycles/blender/CMakeLists.txt
intern/cycles/blender/addon/__init__.py
intern/cycles/blender/addon/ui.py
intern/cycles/blender/blender_shader.cpp
intern/cycles/cmake/external_libs.cmake
intern/cycles/device/device_opencl.cpp
intern/cycles/kernel/kernel.cl
intern/cycles/kernel/kernel_bvh.h
intern/cycles/kernel/kernel_camera.h
intern/cycles/kernel/kernel_compat_cpu.h
intern/cycles/kernel/kernel_compat_cuda.h
intern/cycles/kernel/kernel_compat_opencl.h
intern/cycles/kernel/kernel_globals.h
intern/cycles/kernel/kernel_shader.h
intern/cycles/kernel/kernel_types.h
intern/cycles/kernel/svm/bsdf_oren_nayar.h
intern/cycles/render/filter.cpp
intern/cycles/util/util_math.h
release/datafiles/fonts/droidsans.ttf.gz
release/scripts/modules/addon_utils.py
release/scripts/modules/animsys_refactor.py
release/scripts/presets/tracking_camera/Sony_A55.py
release/scripts/startup/bl_operators/clip.py
release/scripts/startup/bl_ui/__init__.py
release/scripts/startup/bl_ui/properties_data_modifier.py
release/scripts/startup/bl_ui/properties_game.py
release/scripts/startup/bl_ui/properties_particle.py
release/scripts/startup/bl_ui/properties_render.py
release/scripts/startup/bl_ui/properties_scene.py
release/scripts/startup/bl_ui/space_clip.py
release/scripts/startup/bl_ui/space_sequencer.py
release/scripts/startup/bl_ui/space_userpref.py
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenfont/intern/blf_lang.c
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/BKE_camera.h
source/blender/blenkernel/BKE_image.h
source/blender/blenkernel/BKE_modifier.h
source/blender/blenkernel/BKE_node.h
source/blender/blenkernel/BKE_object.h
source/blender/blenkernel/BKE_ocean.h
source/blender/blenkernel/BKE_scene.h
source/blender/blenkernel/BKE_writeavi.h
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/bmfont.c
source/blender/blenkernel/intern/camera.c
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/fcurve.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/mball.c
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/movieclip.c
source/blender/blenkernel/intern/nla.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/ocean.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/sequencer.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenkernel/intern/tracking.c
source/blender/blenkernel/intern/writeavi.c
source/blender/blenkernel/intern/writeffmpeg.c
source/blender/blenlib/BLI_math_geom.h
source/blender/blenlib/BLI_string_utf8.h
source/blender/blenlib/intern/BLI_mempool.c
source/blender/blenlib/intern/DLRB_tree.c
source/blender/blenlib/intern/math_geom.c
source/blender/blenlib/intern/math_rotation.c
source/blender/blenlib/intern/path_util.c
source/blender/blenlib/intern/string_utf8.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/gpencil/drawgpencil.c
source/blender/editors/gpencil/gpencil_edit.c
source/blender/editors/gpencil/gpencil_paint.c
source/blender/editors/include/ED_transform.h
source/blender/editors/include/ED_view3d.h
source/blender/editors/include/UI_interface.h
source/blender/editors/include/UI_resources.h
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_anim.c
source/blender/editors/interface/interface_icons.c
source/blender/editors/interface/interface_intern.h
source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/interface_panel.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/interface_style.c
source/blender/editors/interface/interface_utils.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/interface/resources.c
source/blender/editors/interface/view2d.c
source/blender/editors/interface/view2d_ops.c
source/blender/editors/mesh/loopcut.c
source/blender/editors/object/object_bake.c
source/blender/editors/object/object_constraint.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_modifier.c
source/blender/editors/physics/dynamicpaint_ops.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/render/render_shading.c
source/blender/editors/screen/area.c
source/blender/editors/screen/screendump.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sound/sound_ops.c
source/blender/editors/space_clip/clip_buttons.c
source/blender/editors/space_clip/tracking_ops.c
source/blender/editors/space_file/file_panels.c
source/blender/editors/space_image/image_buttons.c
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_node/node_draw.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_text/text_draw.c
source/blender/editors/space_view3d/drawarmature.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_intern.h
source/blender/editors/space_view3d/view3d_view.c
source/blender/editors/transform/transform_snap.c
source/blender/gpu/CMakeLists.txt
source/blender/gpu/GPU_material.h
source/blender/gpu/SConscript
source/blender/gpu/intern/gpu_codegen.c
source/blender/gpu/intern/gpu_shader_material.glsl
source/blender/gpu/intern/gpu_shader_material.glsl.c
source/blender/imbuf/IMB_imbuf_types.h
source/blender/imbuf/intern/IMB_anim.h
source/blender/imbuf/intern/IMB_filter.h
source/blender/imbuf/intern/allocimbuf.c
source/blender/imbuf/intern/anim_movie.c
source/blender/imbuf/intern/filter.c
source/blender/imbuf/intern/imbuf_cocoa.m
source/blender/imbuf/intern/iris.c
source/blender/imbuf/intern/jp2.c
source/blender/imbuf/intern/jpeg.c
source/blender/imbuf/intern/openexr/openexr_api.cpp
source/blender/imbuf/intern/png.c
source/blender/imbuf/intern/scaling.c
source/blender/imbuf/intern/targa.c
source/blender/imbuf/intern/thumbs.c
source/blender/imbuf/intern/tiff.c
source/blender/makesdna/DNA_modifier_types.h
source/blender/makesdna/DNA_node_types.h
source/blender/makesdna/DNA_object_fluidsim.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/RNA_access.h
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/RNA_types.h
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_actuator.c
source/blender/makesrna/intern/rna_armature.c
source/blender/makesrna/intern/rna_brush.c
source/blender/makesrna/intern/rna_camera.c
source/blender/makesrna/intern/rna_constraint.c
source/blender/makesrna/intern/rna_controller.c
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_fcurve.c
source/blender/makesrna/intern/rna_fluidsim.c
source/blender/makesrna/intern/rna_image.c
source/blender/makesrna/intern/rna_image_api.c
source/blender/makesrna/intern/rna_modifier.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_property.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_scene_api.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_texture_api.c
source/blender/makesrna/intern/rna_tracking.c
source/blender/makesrna/intern/rna_ui_api.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/modifiers/intern/MOD_fluidsim_util.c
source/blender/modifiers/intern/MOD_ocean.c
source/blender/modifiers/intern/MOD_uvproject.c
source/blender/nodes/NOD_composite.h
source/blender/nodes/NOD_shader.h
source/blender/nodes/NOD_texture.h
source/blender/nodes/composite/node_composite_tree.c
source/blender/nodes/composite/node_composite_util.c
source/blender/nodes/composite/node_composite_util.h
source/blender/nodes/composite/nodes/node_composite_alphaOver.c
source/blender/nodes/composite/nodes/node_composite_bilateralblur.c
source/blender/nodes/composite/nodes/node_composite_blur.c
source/blender/nodes/composite/nodes/node_composite_brightness.c
source/blender/nodes/composite/nodes/node_composite_channelMatte.c
source/blender/nodes/composite/nodes/node_composite_chromaMatte.c
source/blender/nodes/composite/nodes/node_composite_colorMatte.c
source/blender/nodes/composite/nodes/node_composite_colorSpill.c
source/blender/nodes/composite/nodes/node_composite_colorbalance.c
source/blender/nodes/composite/nodes/node_composite_common.c
source/blender/nodes/composite/nodes/node_composite_composite.c
source/blender/nodes/composite/nodes/node_composite_crop.c
source/blender/nodes/composite/nodes/node_composite_curves.c
source/blender/nodes/composite/nodes/node_composite_defocus.c
source/blender/nodes/composite/nodes/node_composite_diffMatte.c
source/blender/nodes/composite/nodes/node_composite_dilate.c
source/blender/nodes/composite/nodes/node_composite_directionalblur.c
source/blender/nodes/composite/nodes/node_composite_displace.c
source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
source/blender/nodes/composite/nodes/node_composite_filter.c
source/blender/nodes/composite/nodes/node_composite_flip.c
source/blender/nodes/composite/nodes/node_composite_gamma.c
source/blender/nodes/composite/nodes/node_composite_glare.c
source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
source/blender/nodes/composite/nodes/node_composite_huecorrect.c
source/blender/nodes/composite/nodes/node_composite_idMask.c
source/blender/nodes/composite/nodes/node_composite_image.c
source/blender/nodes/composite/nodes/node_composite_invert.c
source/blender/nodes/composite/nodes/node_composite_lensdist.c
source/blender/nodes/composite/nodes/node_composite_levels.c
source/blender/nodes/composite/nodes/node_composite_lummaMatte.c
source/blender/nodes/composite/nodes/node_composite_mapUV.c
source/blender/nodes/composite/nodes/node_composite_mapValue.c
source/blender/nodes/composite/nodes/node_composite_math.c
source/blender/nodes/composite/nodes/node_composite_mixrgb.c
source/blender/nodes/composite/nodes/node_composite_movieclip.c
source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
source/blender/nodes/composite/nodes/node_composite_normal.c
source/blender/nodes/composite/nodes/node_composite_normalize.c
source/blender/nodes/composite/nodes/node_composite_outputFile.c
source/blender/nodes/composite/nodes/node_composite_premulkey.c
source/blender/nodes/composite/nodes/node_composite_rgb.c
source/blender/nodes/composite/nodes/node_composite_rotate.c
source/blender/nodes/composite/nodes/node_composite_scale.c
source/blender/nodes/composite/nodes/node_composite_sepcombHSVA.c
source/blender/nodes/composite/nodes/node_composite_sepcombRGBA.c
source/blender/nodes/composite/nodes/node_composite_sepcombYCCA.c
source/blender/nodes/composite/nodes/node_composite_sepcombYUVA.c
source/blender/nodes/composite/nodes/node_composite_setalpha.c
source/blender/nodes/composite/nodes/node_composite_splitViewer.c
source/blender/nodes/composite/nodes/node_composite_stabilize2d.c
source/blender/nodes/composite/nodes/node_composite_texture.c
source/blender/nodes/composite/nodes/node_composite_tonemap.c
source/blender/nodes/composite/nodes/node_composite_transform.c
source/blender/nodes/composite/nodes/node_composite_translate.c
source/blender/nodes/composite/nodes/node_composite_valToRgb.c
source/blender/nodes/composite/nodes/node_composite_value.c
source/blender/nodes/composite/nodes/node_composite_vecBlur.c
source/blender/nodes/composite/nodes/node_composite_viewer.c
source/blender/nodes/composite/nodes/node_composite_zcombine.c
source/blender/nodes/intern/node_common.c
source/blender/nodes/intern/node_exec.c
source/blender/nodes/intern/node_util.c
source/blender/nodes/intern/node_util.h
source/blender/nodes/shader/node_shader_tree.c
source/blender/nodes/shader/node_shader_util.c
source/blender/nodes/shader/node_shader_util.h
source/blender/nodes/shader/nodes/node_shader_add_shader.c
source/blender/nodes/shader/nodes/node_shader_attribute.c
source/blender/nodes/shader/nodes/node_shader_background.c
source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.c
source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.c
source/blender/nodes/shader/nodes/node_shader_bsdf_glass.c
source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.c
source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.c
source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.c
source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.c
source/blender/nodes/shader/nodes/node_shader_camera.c
source/blender/nodes/shader/nodes/node_shader_common.c
source/blender/nodes/shader/nodes/node_shader_curves.c
source/blender/nodes/shader/nodes/node_shader_dynamic.c
source/blender/nodes/shader/nodes/node_shader_emission.c
source/blender/nodes/shader/nodes/node_shader_fresnel.c
source/blender/nodes/shader/nodes/node_shader_geom.c
source/blender/nodes/shader/nodes/node_shader_geometry.c
source/blender/nodes/shader/nodes/node_shader_holdout.c
source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
source/blender/nodes/shader/nodes/node_shader_invert.c
source/blender/nodes/shader/nodes/node_shader_layer_weight.c
source/blender/nodes/shader/nodes/node_shader_light_path.c
source/blender/nodes/shader/nodes/node_shader_mapping.c
source/blender/nodes/shader/nodes/node_shader_material.c
source/blender/nodes/shader/nodes/node_shader_math.c
source/blender/nodes/shader/nodes/node_shader_mixRgb.c
source/blender/nodes/shader/nodes/node_shader_mix_shader.c
source/blender/nodes/shader/nodes/node_shader_normal.c
source/blender/nodes/shader/nodes/node_shader_output.c
source/blender/nodes/shader/nodes/node_shader_output_lamp.c
source/blender/nodes/shader/nodes/node_shader_output_material.c
source/blender/nodes/shader/nodes/node_shader_output_world.c
source/blender/nodes/shader/nodes/node_shader_rgb.c
source/blender/nodes/shader/nodes/node_shader_sepcombRGB.c
source/blender/nodes/shader/nodes/node_shader_squeeze.c
source/blender/nodes/shader/nodes/node_shader_tex_coord.c
source/blender/nodes/shader/nodes/node_shader_tex_environment.c
source/blender/nodes/shader/nodes/node_shader_tex_gradient.c
source/blender/nodes/shader/nodes/node_shader_tex_image.c
source/blender/nodes/shader/nodes/node_shader_tex_magic.c
source/blender/nodes/shader/nodes/node_shader_tex_musgrave.c
source/blender/nodes/shader/nodes/node_shader_tex_noise.c
source/blender/nodes/shader/nodes/node_shader_tex_sky.c
source/blender/nodes/shader/nodes/node_shader_tex_voronoi.c
source/blender/nodes/shader/nodes/node_shader_tex_wave.c
source/blender/nodes/shader/nodes/node_shader_texture.c
source/blender/nodes/shader/nodes/node_shader_valToRgb.c
source/blender/nodes/shader/nodes/node_shader_value.c
source/blender/nodes/shader/nodes/node_shader_vectMath.c
source/blender/nodes/shader/nodes/node_shader_volume_isotropic.c
source/blender/nodes/shader/nodes/node_shader_volume_transparent.c
source/blender/nodes/texture/node_texture_tree.c
source/blender/nodes/texture/node_texture_util.c
source/blender/nodes/texture/node_texture_util.h
source/blender/nodes/texture/nodes/node_texture_at.c
source/blender/nodes/texture/nodes/node_texture_bricks.c
source/blender/nodes/texture/nodes/node_texture_checker.c
source/blender/nodes/texture/nodes/node_texture_common.c
source/blender/nodes/texture/nodes/node_texture_compose.c
source/blender/nodes/texture/nodes/node_texture_coord.c
source/blender/nodes/texture/nodes/node_texture_curves.c
source/blender/nodes/texture/nodes/node_texture_decompose.c
source/blender/nodes/texture/nodes/node_texture_distance.c
source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
source/blender/nodes/texture/nodes/node_texture_image.c
source/blender/nodes/texture/nodes/node_texture_invert.c
source/blender/nodes/texture/nodes/node_texture_math.c
source/blender/nodes/texture/nodes/node_texture_mixRgb.c
source/blender/nodes/texture/nodes/node_texture_output.c
source/blender/nodes/texture/nodes/node_texture_proc.c
source/blender/nodes/texture/nodes/node_texture_rotate.c
source/blender/nodes/texture/nodes/node_texture_scale.c
source/blender/nodes/texture/nodes/node_texture_texture.c
source/blender/nodes/texture/nodes/node_texture_translate.c
source/blender/nodes/texture/nodes/node_texture_valToNor.c
source/blender/nodes/texture/nodes/node_texture_valToRgb.c
source/blender/nodes/texture/nodes/node_texture_viewer.c
source/blender/python/BPY_extern.h
source/blender/python/generic/noise_py_api.c
source/blender/python/intern/bpy_driver.c
source/blender/python/intern/bpy_driver.h
source/blender/python/intern/bpy_rna.c
source/blender/python/mathutils/mathutils_geometry.c
source/blender/quicktime/apple/qtkit_export.m
source/blender/quicktime/apple/quicktime_export.c
source/blender/render/extern/include/RE_pipeline.h
source/blender/render/intern/include/render_types.h
source/blender/render/intern/source/envmap.c
source/blender/render/intern/source/initrender.c
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/rendercore.c
source/blender/windowmanager/intern/wm_keymap.c
source/blenderplayer/bad_level_call_stubs/stubs.c
source/creator/CMakeLists.txt
source/creator/creator.c
source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
source/gameengine/GamePlayer/common/bmfont.cpp
source/gameengine/Ketsji/BL_Shader.cpp
source/tests/pep8.py

index b5075aa..cd4e31e 100644 (file)
@@ -70,6 +70,7 @@ BlenderEnvironment = Blender.BlenderEnvironment
 B = Blender
 
 VERSION = btools.VERSION # This is used in creating the local config directories
+VERSION_RELEASE_CYCLE = btools.VERSION_RELEASE_CYCLE
 
 ### globals ###
 platform = sys.platform
@@ -524,6 +525,10 @@ if env['OURPLATFORM']!='darwin':
                 if '__pycache__' in dn:  # py3.2 cache dir
                     dn.remove('__pycache__')
 
+                # only for testing builds
+                if VERSION_RELEASE_CYCLE == "release" and "addons_contrib" in dn:
+                    dn.remove('addons_contrib')
+
                 dir = os.path.join(env['BF_INSTALLDIR'], VERSION)
                 dir += os.sep + os.path.basename(scriptpath) + dp[len(scriptpath):]
 
index be68455..65a9442 100755 (executable)
 
 # <pep8 compliant>
 
+import sys
+if not sys.version.startswith("3"):
+    print("\nPython3.x needed, found %s.\nAborting!\n" %
+          sys.version.partition(" ")[0])
+    sys.exit(1)
+
 from cmake_consistency_check_config import IGNORE, UTF8_CHECK, SOURCE_DIR
 
 import os
index 0b92297..65afd10 100755 (executable)
@@ -44,7 +44,14 @@ __all__ = (
     "project_name_get"
 )
 
+
 import sys
+if not sys.version.startswith("3"):
+    print("\nPython3.x needed, found %s.\nAborting!\n" %
+          sys.version.partition(" ")[0])
+    sys.exit(1)
+
+
 import os
 from os.path import join, dirname, normpath, abspath, splitext, exists
 
@@ -142,10 +149,11 @@ def cmake_advanced_info():
 
     from xml.dom.minidom import parse
     tree = parse(join(CMAKE_DIR, ".cproject"))
-    '''
-    f = open(".cproject_pretty", 'w')
-    f.write(tree.toprettyxml(indent="    ", newl=""))
-    '''
+
+    # to check on nicer xml
+    # f = open(".cproject_pretty", 'w')
+    # f.write(tree.toprettyxml(indent="    ", newl=""))
+
     ELEMENT_NODE = tree.ELEMENT_NODE
 
     cproject, = tree.getElementsByTagName("cproject")
@@ -224,7 +232,9 @@ def project_name_get(path, fallback="Blender", prefix="Blender_"):
 
     import subprocess
     info = subprocess.Popen(["svn", "info", path],
-                            stdout=subprocess.PIPE).communicate()[0].decode()
+                            stdout=subprocess.PIPE).communicate()[0]
+    # string version, we only want the URL
+    info = info.decode(encoding="utf-8", errors="ignore")
 
     for l in info.split("\n"):
         l = l.strip()
index 5d646ee..a39ed94 100644 (file)
@@ -25,6 +25,14 @@ __all__ = (
     "SOURCE_DIR",
     )
 
+
+import sys
+if not sys.version.startswith("3"):
+    print("\nPython3.x needed, found %s.\nAborting!\n" %
+          sys.version.partition(" ")[0])
+    sys.exit(1)
+
+
 import os
 from os.path import join, dirname, normpath, abspath
 
@@ -73,7 +81,7 @@ def do_ignore(filepath, ignore_prefix_list):
 def makefile_log():
     import subprocess
     import time
-    # Check blender is not 2.5x until it supports playback again
+
     print("running make with --dry-run ...")
     process = subprocess.Popen(["make", "--always-make", "--dry-run", "--keep-going", "VERBOSE=1"],
                                 stdout=subprocess.PIPE,
@@ -85,7 +93,7 @@ def makefile_log():
     out = process.stdout.read()
     process.stdout.close()
     print("done!", len(out), "bytes")
-    return out.decode("ascii").split("\n")
+    return out.decode("utf-8", errors="ignore").split("\n")
 
 
 def build_info(use_c=True, use_cxx=True, ignore_prefix_list=None):
index d6da908..028b1bd 100644 (file)
@@ -18,20 +18,20 @@ MACOSX_ARCHITECTURE = 'i386' # valid archs: ppc, i386, ppc64, x86_64
 
 
 cmd = 'uname -p'
-MAC_PROC=commands.getoutput(cmd) 
+MAC_PROC=commands.getoutput(cmd)
 cmd = 'uname -r'
-cmd_res=commands.getoutput(cmd) 
+cmd_res=commands.getoutput(cmd)
 
 if cmd_res[:1]=='7':
-       MAC_CUR_VER='10.3'
+    MAC_CUR_VER='10.3'
 elif cmd_res[:1]=='8':
-       MAC_CUR_VER='10.4'
+    MAC_CUR_VER='10.4'
 elif cmd_res[:1]=='9':
-       MAC_CUR_VER='10.5'
+    MAC_CUR_VER='10.5'
 elif cmd_res[:2]=='10':
-       MAC_CUR_VER='10.6'
+    MAC_CUR_VER='10.6'
 elif cmd_res[:2]=='11':
-       MAC_CUR_VER='10.7'
+    MAC_CUR_VER='10.7'
 cmd = 'xcodebuild -version'
 cmd_xcode=commands.getoutput(cmd)
 XCODE_CUR_VER=cmd_xcode
@@ -40,7 +40,7 @@ cmd_sdk=commands.getoutput(cmd)
 MACOSX_SDK_CHECK=cmd_sdk
 
 if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
-       USE_QTKIT=True # Carbon quicktime is not available for 64bit
+    USE_QTKIT=True # Carbon quicktime is not available for 64bit
 
 
 # Default target OSX settings per architecture
@@ -48,41 +48,41 @@ if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
 
 if MACOSX_ARCHITECTURE == 'ppc' and MAC_CUR_VER == '10.4':
 # all releases are now made for 10.5 !
-#      MAC_MIN_VERS = '10.3'
-#      MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
-#      LCGDIR = '#../lib/darwin-6.1-powerpc'
-#      CC = 'gcc-3.3'
-#      CXX = 'g++-3.3'
-       MAC_MIN_VERS = '10.4'
-       MACOSX_DEPLOYMENT_TARGET = '10.4'
-       MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
-       LCGDIR = '#../lib/darwin-8.0.0-powerpc'
-       CC = 'gcc-4.0'
-       CXX = 'g++-4.0'
+#   MAC_MIN_VERS = '10.3'
+#   MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
+#   LCGDIR = '#../lib/darwin-6.1-powerpc'
+#   CC = 'gcc-3.3'
+#   CXX = 'g++-3.3'
+    MAC_MIN_VERS = '10.4'
+    MACOSX_DEPLOYMENT_TARGET = '10.4'
+    MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
+    LCGDIR = '#../lib/darwin-8.0.0-powerpc'
+    CC = 'gcc-4.0'
+    CXX = 'g++-4.0'
 elif MACOSX_ARCHITECTURE == 'i386' and MAC_CUR_VER == '10.4':
-       MAC_MIN_VERS = '10.4'
-       MACOSX_DEPLOYMENT_TARGET = '10.4'
-       MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
-       LCGDIR = '#../lib/darwin-8.x.i386'
-       CC = 'gcc-4.0'
-       CXX = 'g++-4.0'
+    MAC_MIN_VERS = '10.4'
+    MACOSX_DEPLOYMENT_TARGET = '10.4'
+    MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
+    LCGDIR = '#../lib/darwin-8.x.i386'
+    CC = 'gcc-4.0'
+    CXX = 'g++-4.0'
 else :
-       if 'Mac OS X 10.5' in MACOSX_SDK_CHECK:
-               # OSX 10.5/6 with Xcode 3.x
-               MAC_MIN_VERS = '10.5'
-               MACOSX_DEPLOYMENT_TARGET = '10.5'
-               MACOSX_SDK='/Developer/SDKs/MacOSX10.5.sdk'
-               LCGDIR = '#../lib/darwin-9.x.universal'
-               CC = 'gcc-4.2'
-               CXX = 'g++-4.2'
-       else:
-               # OSX 10.6/7 with Xcode 4.x
-               MAC_MIN_VERS = '10.6'
-               MACOSX_DEPLOYMENT_TARGET = '10.6'
-               MACOSX_SDK='/Developer/SDKs/MacOSX10.6.sdk'
-               LCGDIR = '#../lib/darwin-9.x.universal'
-               CC = 'gcc-4.2'
-               CXX = 'g++-4.2'
+    if 'Mac OS X 10.5' in MACOSX_SDK_CHECK:
+        # OSX 10.5/6 with Xcode 3.x
+        MAC_MIN_VERS = '10.5'
+        MACOSX_DEPLOYMENT_TARGET = '10.5'
+        MACOSX_SDK='/Developer/SDKs/MacOSX10.5.sdk'
+        LCGDIR = '#../lib/darwin-9.x.universal'
+        CC = 'gcc-4.2'
+        CXX = 'g++-4.2'
+    else:
+        # OSX 10.6/7 with Xcode 4.x
+        MAC_MIN_VERS = '10.6'
+        MACOSX_DEPLOYMENT_TARGET = '10.6'
+        MACOSX_SDK='/Developer/SDKs/MacOSX10.6.sdk'
+        LCGDIR = '#../lib/darwin-9.x.universal'
+        CC = 'gcc-4.2'
+        CXX = 'g++-4.2'
 
 LIBDIR = '${LCGDIR}'
 
@@ -109,32 +109,32 @@ BF_PYTHON_VERSION = '3.2'
 WITH_OSX_STATICPYTHON = True
 
 if WITH_OSX_STATICPYTHON:
-       # python 3.2 uses precompiled libraries in bf svn /lib by default
-
-       BF_PYTHON = LIBDIR + '/python'
-       BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
-       # BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
-       BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
-       BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
-       # BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
+    # python 3.2 uses precompiled libraries in bf svn /lib by default
+
+    BF_PYTHON = LIBDIR + '/python'
+    BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
+    # BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
+    BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
+    BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
+    # BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
 else:
-       # python 3.2 uses Python-framework additionally installed in /Library/Frameworks
-       
-       BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
-       BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}m'
-       BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
-       #BF_PYTHON_LIB = ''
-       BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config-3.2m'
-       
+    # python 3.2 uses Python-framework additionally installed in /Library/Frameworks
+
+    BF_PYTHON = '/Library/Frameworks/Python.framework/Versions/'
+    BF_PYTHON_INC = '${BF_PYTHON}${BF_PYTHON_VERSION}/include/python${BF_PYTHON_VERSION}m'
+    BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
+    #BF_PYTHON_LIB = ''
+    BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config-3.2m'
+
 WITH_BF_OPENAL = True
 #different lib must be used  following version of gcc
 # for gcc 3.3
 #BF_OPENAL = LIBDIR + '/openal'
 # for gcc 3.4 and ulterior
 if MAC_PROC == 'powerpc':
-       BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal'
+    BF_OPENAL = '#../lib/darwin-8.0.0-powerpc/openal'
 else :
-       BF_OPENAL = LIBDIR + '/openal'
+    BF_OPENAL = LIBDIR + '/openal'
 
 WITH_BF_STATICOPENAL = False
 BF_OPENAL_INC = '${BF_OPENAL}/include' # only headers from libdir needed for proper use of framework !!!!
@@ -233,7 +233,7 @@ BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
 #WITH_BF_NSPR = True
 #BF_NSPR = $(LIBDIR)/nspr
 #BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
-#BF_NSPR_LIB = 
+#BF_NSPR_LIB =
 
 # Uncomment the following line to use Mozilla inplace of netscape
 #CPPFLAGS += -DMOZ_NOT_NET
@@ -284,7 +284,7 @@ BF_PCRE_LIBPATH = '${BF_PCRE}/lib'
 #BF_EXPAT_LIBPATH = '/usr/lib'
 
 #Cycles
-WITH_BF_CYCLES = True 
+WITH_BF_CYCLES = True
 
 WITH_BF_OIIO = True
 BF_OIIO = LIBDIR + '/openimageio'
@@ -318,9 +318,9 @@ WITH_BF_3DMOUSE = True
 BF_QUIET = '1' # suppress verbose output
 
 if MACOSX_ARCHITECTURE == 'x86_64' or MACOSX_ARCHITECTURE == 'ppc64':
-       ARCH_FLAGS = ['-m64']
+    ARCH_FLAGS = ['-m64']
 else:
-       ARCH_FLAGS = ['-m32']
+    ARCH_FLAGS = ['-m32']
 
 CFLAGS = []
 CXXFLAGS = []
@@ -329,53 +329,53 @@ CCFLAGS = ['-pipe','-funsigned-char']
 CPPFLAGS = list(ARCH_FLAGS)
 
 if WITH_GHOST_COCOA:
-       PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Cocoa','-framework','Carbon','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
+    PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Cocoa','-framework','Carbon','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
 else:
-       PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Carbon','-framework','AGL','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
+    PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Carbon','-framework','AGL','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','OpenAL']+ARCH_FLAGS
 
 if WITH_BF_QUICKTIME:
-       if USE_QTKIT:
-               PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QTKit']
-       else:
-               PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime']
+    if USE_QTKIT:
+        PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QTKit']
+    else:
+        PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','QuickTime']
 
 if not WITH_OSX_STATICPYTHON:
-               PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','Python']
+    PLATFORM_LINKFLAGS = PLATFORM_LINKFLAGS+['-framework','Python']
 
 
 #note to build succesfully on 10.3.9 SDK you need to patch  10.3.9 by adding the SystemStubs.a lib from 10.4
 #for 10.7.sdk, SystemStubs needs to be excluded (lib doesn't exist anymore)
 if MACOSX_DEPLOYMENT_TARGET == '10.7':
-       LLIBS = ['stdc++']
+    LLIBS = ['stdc++']
 else:
-       LLIBS = ['stdc++', 'SystemStubs']
+    LLIBS = ['stdc++', 'SystemStubs']
 
 # some flags shuffling for different OS versions
 if MAC_MIN_VERS == '10.3':
-       CCFLAGS = ['-fuse-cxa-atexit'] + CCFLAGS
-       PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit'] + PLATFORM_LINKFLAGS
-       LLIBS.append('crt3.o')
-       
+    CCFLAGS = ['-fuse-cxa-atexit'] + CCFLAGS
+    PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit'] + PLATFORM_LINKFLAGS
+    LLIBS.append('crt3.o')
+
 if USE_SDK:
-       SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS,'-arch',MACOSX_ARCHITECTURE]    
-       PLATFORM_LINKFLAGS = ['-mmacosx-version-min='+MAC_MIN_VERS,'-Wl','-isysroot',MACOSX_SDK,'-arch',MACOSX_ARCHITECTURE]+PLATFORM_LINKFLAGS
-       CCFLAGS=SDK_FLAGS+CCFLAGS
-       CXXFLAGS=SDK_FLAGS+CXXFLAGS
+    SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS,'-arch',MACOSX_ARCHITECTURE]
+    PLATFORM_LINKFLAGS = ['-mmacosx-version-min='+MAC_MIN_VERS,'-Wl','-isysroot',MACOSX_SDK,'-arch',MACOSX_ARCHITECTURE]+PLATFORM_LINKFLAGS
+    CCFLAGS=SDK_FLAGS+CCFLAGS
+    CXXFLAGS=SDK_FLAGS+CXXFLAGS
 
-#Intel Macs are CoreDuo and Up 
+#Intel Macs are CoreDuo and Up
 if MACOSX_ARCHITECTURE == 'i386' or MACOSX_ARCHITECTURE == 'x86_64':
-       REL_CFLAGS = []
-       REL_CXXFLAGS = []
-       REL_CCFLAGS = ['-DNDEBUG', '-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse']
+    REL_CFLAGS = []
+    REL_CXXFLAGS = []
+    REL_CCFLAGS = ['-DNDEBUG', '-O2','-ftree-vectorize','-msse','-msse2','-msse3','-mfpmath=sse']
 else:
-       CCFLAGS += ['-fno-strict-aliasing']
-       REL_CFLAGS = []
-       REL_CXXFLAGS = []
-       REL_CCFLAGS = ['-DNDEBUG', '-O2']
+    CCFLAGS += ['-fno-strict-aliasing']
+    REL_CFLAGS = []
+    REL_CXXFLAGS = []
+    REL_CCFLAGS = ['-DNDEBUG', '-O2']
 
 # Intel 64bit Macs are Core2Duo and up
 if MACOSX_ARCHITECTURE == 'x86_64':
-       REL_CCFLAGS += ['-march=core2','-mssse3','-with-tune=core2','-enable-threads']
+    REL_CCFLAGS += ['-march=core2','-mssse3','-with-tune=core2','-enable-threads']
 
 CC_WARN = ['-Wall']
 C_WARN = ['-Wno-char-subscripts', '-Wpointer-arith', '-Wcast-align', '-Wdeclaration-after-statement', '-Wno-unknown-pragmas', '-Wstrict-prototypes']
index ed99ac6..bf77806 100644 (file)
@@ -175,8 +175,8 @@ CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFIL
 CPPFLAGS = []
 CXXFLAGS = []
 if WITH_BF_FFMPEG:
-  # libavutil needs UINT64_C()
-  CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
+    # libavutil needs UINT64_C()
+    CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
 REL_CFLAGS = []
 REL_CXXFLAGS = []
 REL_CCFLAGS = ['-DNDEBUG', '-O2']
index c62b30a..738f14a 100644 (file)
@@ -175,8 +175,8 @@ CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing','-D_LARGEFIL
 CPPFLAGS = []
 CXXFLAGS = []
 if WITH_BF_FFMPEG:
-  # libavutil needs UINT64_C()
-  CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
+    # libavutil needs UINT64_C()
+    CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
 REL_CFLAGS = []
 REL_CXXFLAGS = []
 REL_CCFLAGS = ['-DNDEBUG', '-O2']
index c167959..f40fc33 100644 (file)
@@ -175,8 +175,8 @@ CXXFLAGS = []
 
 CPPFLAGS = []
 if WITH_BF_FFMPEG:
-  # libavutil needs UINT64_C()
-  CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
+    # libavutil needs UINT64_C()
+    CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
 REL_CFLAGS = []
 REL_CXXFLAGS = []
 REL_CCFLAGS = ['-DNDEBUG', '-O2']
index af5f73f..b25bf98 100644 (file)
@@ -247,8 +247,8 @@ CPPFLAGS = []
 # g++ 4.6, only needed for bullet
 CXXFLAGS += ['-fpermissive']
 if WITH_BF_FFMPEG:
-  # libavutil needs UINT64_C()
-  CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
+    # libavutil needs UINT64_C()
+    CXXFLAGS += ['-D__STDC_CONSTANT_MACROS', ]
 REL_CFLAGS = []
 REL_CXXFLAGS = []
 REL_CCFLAGS = ['-DNDEBUG', '-O2']
index 71a4af1..f9a9023 100644 (file)
@@ -34,6 +34,7 @@ import bcolors
 bc = bcolors.bcolors()
 import btools
 VERSION = btools.VERSION
+VERSION_RELEASE_CYCLE = btools.VERSION_RELEASE_CYCLE
 
 Split = SCons.Util.Split
 Action = SCons.Action.Action
@@ -257,9 +258,9 @@ def setup_syslibs(lenv):
         if lenv['WITH_BF_OGG']:
             syslibs += Split(lenv['BF_OGG_LIB'])
     if lenv['WITH_BF_JACK']:
-            syslibs += Split(lenv['BF_JACK_LIB'])
+        syslibs += Split(lenv['BF_JACK_LIB'])
     if lenv['WITH_BF_SNDFILE'] and not lenv['WITH_BF_STATICSNDFILE']:
-            syslibs += Split(lenv['BF_SNDFILE_LIB'])
+        syslibs += Split(lenv['BF_SNDFILE_LIB'])
     if lenv['WITH_BF_FFTW3'] and not lenv['WITH_BF_STATICFFTW3']:
         syslibs += Split(lenv['BF_FFTW3_LIB'])
     if lenv['WITH_BF_SDL']:
@@ -584,6 +585,10 @@ def AppIt(target=None, source=None, env=None):
         cmd = 'cp -R %s/release/scripts %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION)
         commands.getoutput(cmd)
 
+        if VERSION_RELEASE_CYCLE == "release":
+            cmd = 'rm -rf %s/%s.app/Contents/MacOS/%s/scripts/addons_contrib'%(installdir,binary,VERSION)
+            commands.getoutput(cmd)
+
         if env['WITH_BF_CYCLES']:
             croot = '%s/intern/cycles' % (bldroot)
             cinstalldir = '%s/%s.app/Contents/MacOS/%s/scripts/addons/cycles' % (installdir,binary,VERSION)
@@ -759,17 +764,17 @@ class BlenderEnvironment(SConsEnvironment):
             lenv.Append(CPPPATH=includes)
             lenv.Append(CPPDEFINES=defines)
             if lenv['BF_DEBUG'] or (libname in quickdebug):
-                    lenv.Append(CFLAGS = lenv['BF_DEBUG_CFLAGS'])
-                    lenv.Append(CCFLAGS = lenv['BF_DEBUG_CCFLAGS'])
-                    lenv.Append(CXXFLAGS = lenv['BF_DEBUG_CXXFLAGS'])
+                lenv.Append(CFLAGS = lenv['BF_DEBUG_CFLAGS'])
+                lenv.Append(CCFLAGS = lenv['BF_DEBUG_CCFLAGS'])
+                lenv.Append(CXXFLAGS = lenv['BF_DEBUG_CXXFLAGS'])
             else:
-                    lenv.Append(CFLAGS = lenv['REL_CFLAGS'])
-                    lenv.Append(CCFLAGS = lenv['REL_CCFLAGS'])
-                    lenv.Append(CXXFLAGS = lenv['REL_CXXFLAGS'])
+                lenv.Append(CFLAGS = lenv['REL_CFLAGS'])
+                lenv.Append(CCFLAGS = lenv['REL_CCFLAGS'])
+                lenv.Append(CXXFLAGS = lenv['REL_CXXFLAGS'])
             if lenv['BF_PROFILE']:
-                    lenv.Append(CFLAGS = lenv['BF_PROFILE_CFLAGS'])
-                    lenv.Append(CCFLAGS = lenv['BF_PROFILE_CCFLAGS'])
-                    lenv.Append(CXXFLAGS = lenv['BF_PROFILE_CXXFLAGS'])
+                lenv.Append(CFLAGS = lenv['BF_PROFILE_CFLAGS'])
+                lenv.Append(CCFLAGS = lenv['BF_PROFILE_CCFLAGS'])
+                lenv.Append(CXXFLAGS = lenv['BF_PROFILE_CXXFLAGS'])
             if compileflags:
                 lenv.Replace(CFLAGS = compileflags)
             if cc_compileflags:
@@ -829,7 +834,7 @@ class BlenderEnvironment(SConsEnvironment):
             if lenv['WITH_BF_PYTHON']:
                 lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS'])
             if lenv['CXX'].endswith('CC'):
-                 lenv.Replace(LINK = '$CXX')
+                lenv.Replace(LINK = '$CXX')
         if  lenv['OURPLATFORM']=='darwin':
             if lenv['WITH_BF_PYTHON']:
                 lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS'])
@@ -841,8 +846,8 @@ class BlenderEnvironment(SConsEnvironment):
         lenv.Append(LIBPATH=libpath)
         lenv.Append(LIBS=libs)
         if lenv['WITH_BF_QUICKTIME']:
-             lenv.Append(LIBS = lenv['BF_QUICKTIME_LIB'])
-             lenv.Append(LIBPATH = lenv['BF_QUICKTIME_LIBPATH'])
+            lenv.Append(LIBS = lenv['BF_QUICKTIME_LIB'])
+            lenv.Append(LIBPATH = lenv['BF_QUICKTIME_LIBPATH'])
         prog = lenv.Program(target=builddir+'bin/'+progname, source=sources)
         if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc') and lenv['BF_BSC']:
             f = lenv.File(progname + '.bsc', builddir)
index 856231e..4c826b1 100644 (file)
@@ -52,7 +52,7 @@ def get_version():
             else:
                 ver_display = "%s%s" % (ver_base, ver_char)  # assume release
 
-            return ver_base, ver_display
+            return ver_base, ver_display, ver_cycle
 
     raise Exception("%s: missing version string" % fname)
 
@@ -80,7 +80,7 @@ def checkEndian():
 
 
 # This is used in creating the local config directories
-VERSION, VERSION_DISPLAY = get_version()
+VERSION, VERSION_DISPLAY, VERSION_RELEASE_CYCLE = get_version()
 REVISION = get_revision()
 ENDIAN = checkEndian()
 
index 21df42a..0d43dac 100644 (file)
@@ -52,9 +52,9 @@ else:
 
 cmd = [blender_bin, "--help"]
 print("  executing:", " ".join(cmd))
-blender_help = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0].decode()
+blender_help = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0].decode(encoding="utf-8")
 
-blender_version = subprocess.Popen([blender_bin, "--version"], stdout=subprocess.PIPE).communicate()[0].decode().strip()
+blender_version = subprocess.Popen([blender_bin, "--version"], stdout=subprocess.PIPE).communicate()[0].decode(encoding="utf-8").strip()
 blender_version = blender_version.split("Build")[0]
 
 date_string = datetime.date.fromtimestamp(time.time()).strftime("%B %d, %Y")
diff --git a/doc/python_api/epy/testbgl.py b/doc/python_api/epy/testbgl.py
deleted file mode 100644 (file)
index e895d01..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# Testing the BGL module
-
-import Blender
-from Blender.BGL import *
-from Blender import Draw
-
-R = G = B = 0
-A = 1
-
-instructions = "Hold mouse buttons to change the background color."
-quitting = " Press ESC or q to quit."
-
-def show_win():
-  glClearColor(R,G,B,A)                # define color used to clear buffers 
-  glClear(GL_COLOR_BUFFER_BIT)         # use it to clear the color buffer
-  glColor3f(1,1,1)                     # change default color
-  glRasterPos2i(50,100)                # move cursor to x = 50, y = 100
-  Draw.Text("Testing BGL  + Draw")     # draw this text there
-  glRasterPos2i(350,20)                # move cursor again
-  Draw.Text(instructions + quitting)   # draw another msg
-  glBegin(GL_LINE_LOOP)                # begin a vertex-data list
-  glVertex2i(46,92)
-  glVertex2i(120,92)
-  glVertex2i(120,115)
-  glVertex2i(46,115)
-  glEnd()                              # close this list
-  glColor3f(0.35,0.18,0.92)            # change default color again
-  glBegin(GL_POLYGON)                  # another list, for a polygon
-  glVertex2i(315, 292)
-  glVertex2i(412, 200)
-  glVertex2i(264, 256)
-  glEnd()
-  Draw.Redraw(1)                       # make changes visible.
-
-def ev(evt, val):                      # this is a callback for Draw.Register()
-  global R,G,B,A                       # it handles input events
-  if evt == Draw.ESCKEY or evt == Draw.QKEY:
-    Draw.Exit()                        # this quits the script
-  elif evt == Draw.LEFTMOUSE: R = 1 - R
-  elif evt == Draw.MIDDLEMOUSE: G = 1 - G
-  elif evt == Draw.RIGHTMOUSE: B = 1 - B
-  else:
-    Draw.Register(show_win, ev, None)
-
-Draw.Register(show_win, ev, None)      # start the main loop
index b17debb..281f068 100644 (file)
@@ -147,7 +147,7 @@ Armature Bones in Blender have three distinct data structures that contain them.
 
 .. note::
 
-       In the following examples ``bpy.context.object`` is assumed to be an armature object.
+   In the following examples ``bpy.context.object`` is assumed to be an armature object.
 
 
 Edit Bones
@@ -163,11 +163,11 @@ This is only possible in edit mode.
 
 This will be empty outside of editmode.
 
-       >>> mybones = bpy.context.selected_editable_bones
+   >>> mybones = bpy.context.selected_editable_bones
 
 Returns an editbone only in edit mode.
 
-       >>> bpy.context.active_bone
+   >>> bpy.context.active_bone
 
 
 Bones (Object Mode)
@@ -179,15 +179,15 @@ Example using :class:`bpy.types.Bone` in object or pose mode:
 
 Returns a bone (not an editbone) outside of edit mode
 
-       >>> bpy.context.active_bone
+   >>> bpy.context.active_bone
 
 This works, as with blender the setting can be edited in any mode
 
-       >>> bpy.context.object.data.bones["Bone"].use_deform = True
+   >>> bpy.context.object.data.bones["Bone"].use_deform = True
 
 Accessible but read-only
 
-       >>> tail = myobj.data.bones["Bone"].tail
+   >>> tail = myobj.data.bones["Bone"].tail
 
 
 Pose Bones
@@ -199,20 +199,20 @@ Examples using :class:`bpy.types.PoseBone` in object or pose mode:
 
 .. code-block:: python
 
-       # Gets the name of the first constraint (if it exists)
-       bpy.context.object.pose.bones["Bone"].constraints[0].name 
+   # Gets the name of the first constraint (if it exists)
+   bpy.context.object.pose.bones["Bone"].constraints[0].name 
 
-       # Gets the last selected pose bone (pose mode only)
-       bpy.context.active_pose_bone
+   # Gets the last selected pose bone (pose mode only)
+   bpy.context.active_pose_bone
 
 
 .. note::
 
-       Notice the pose is accessed from the object rather than the object data, this is why blender can have 2 or more objects sharing the same armature in different poses.
+   Notice the pose is accessed from the object rather than the object data, this is why blender can have 2 or more objects sharing the same armature in different poses.
 
 .. note::
 
-       Strictly speaking PoseBone's are not bones, they are just the state of the armature, stored in the :class:`bpy.types.Object` rather than the :class:`bpy.types.Armature`, the real bones are however accessible from the pose bones - :class:`bpy.types.PoseBone.bone`
+   Strictly speaking PoseBone's are not bones, they are just the state of the armature, stored in the :class:`bpy.types.Object` rather than the :class:`bpy.types.Armature`, the real bones are however accessible from the pose bones - :class:`bpy.types.PoseBone.bone`
 
 
 Armature Mode Switching
@@ -223,6 +223,86 @@ While writing scripts that deal with armatures you may find you have to switch b
 This is mainly an issue with editmode since pose data can be manipulated without having to be in pose mode, however for operator access you may still need to enter pose mode.
 
 
+Data Names
+==========
+
+
+Naming Limitations
+------------------
+
+A common mistake is to assume newly created data is given the requested name.
+
+This can cause bugs when you add some data (normally imported) and then reference it later by name.
+
+.. code-block:: python
+
+   bpy.data.meshes.new(name=meshid)
+   
+   # normally some code, function calls...
+   bpy.data.meshes[meshid]
+
+
+Or with name assignment...
+
+.. code-block:: python
+
+   obj.name = objname
+   
+   # normally some code, function calls...
+   obj = bpy.data.meshes[objname]
+
+
+Data names may not match the assigned values if they exceed the maximum length, are already used or an empty string.
+
+
+Its better practice not to reference objects by names at all, once created you can store the data in a list, dictionary, on a class etc, there is rarely a reason to have to keep searching for the same data by name.
+
+
+If you do need to use name references, its best to use a dictionary to maintain a mapping between the names of the imported assets and the newly created data, this way you don't run this risk of referencing existing data from the blend file, or worse modifying it.
+
+.. code-block:: python
+
+   # typically declared in the main body of the function.
+   mesh_name_mapping = {}
+   
+   mesh = bpy.data.meshes.new(name=meshid)
+   mesh_name_mapping[meshid] = mesh
+   
+   # normally some code, or function calls...
+   
+   # use own dictionary rather then bpy.data
+   mesh = mesh_name_mapping[meshid]
+
+
+Library Collisions
+------------------
+
+Blender keeps data names unique - :class:`bpy.types.ID.name` so you can't name two objects, meshes, scenes etc the same thing by accident.
+
+However when linking in library data from another blend file naming collisions can occur, so its best to avoid referencing data by name at all.
+
+This can be tricky at times and not even blender handles this correctly in some case (when selecting the modifier object for eg you can't select between multiple objects with the same name), but its still good to try avoid problems in this area.
+
+
+If you need to select between local and library data, there is a feature in ``bpy.data`` members to allow for this.
+
+.. code-block:: python
+
+   # typical name lookup, could be local or library.
+   obj = bpy.data.objects["my_obj"]
+
+   # library object name look up using a pair
+   # where the second argument is the library path matching bpy.types.Library.filepath
+   obj = bpy.data.objects["my_obj", "//my_lib.blend"]
+
+   # local object name look up using a pair
+   # where the second argument excludes library data from being returned.
+   obj = bpy.data.objects["my_obj", None]
+
+   # both the examples above also works for 'get'
+   obj = bpy.data.objects.get(("my_obj", None))
+
+
 Relative File Paths
 ===================
 
@@ -230,12 +310,12 @@ Blenders relative file paths are not compatible with standard python modules suc
 
 Built in python functions don't understand blenders ``//`` prefix which denotes the blend file path.
 
-A common case where you would run into this problem is when exporting a material with assosiated image paths.
+A common case where you would run into this problem is when exporting a material with associated image paths.
 
 >>> bpy.path.abspath(image.filepath)
 
 
-When using blender data from linked libraries there is an unfortunate complication since the path will be relative to the library rather then the open blend file. When the data block may be from an external blend file pass the library argument from the `bpy.types.ID`.
+When using blender data from linked libraries there is an unfortunate complication since the path will be relative to the library rather then the open blend file. When the data block may be from an external blend file pass the library argument from the :class:`bpy.types.ID`.
 
 >>> bpy.path.abspath(image.filepath, library=image.library)
 
@@ -289,7 +369,7 @@ Unicode encoding/decoding is a big topic with comprehensive python documentation
 
 * To print paths or to include them in the user interface use ``repr(path)`` first or ``"%r" % path`` with string formatting.
 
-* **Possibly** - use bytes instead of python strings, when reading some input its less trouble to read it as binary data though you will still need to deciede how to treat any strings you want to use with Blender, some importers do this.
+* **Possibly** - use bytes instead of python strings, when reading some input its less trouble to read it as binary data though you will still need to decide how to treat any strings you want to use with Blender, some importers do this.
 
 
 Strange errors using 'threading' module
@@ -458,3 +538,14 @@ Removing Data
 **Any** data that you remove shouldn't be modified or accessed afterwards, this includes f-curves, drivers, render layers, timeline markers, modifiers, constraints along with objects, scenes, groups, bones.. etc.
 
 This is a problem in the API at the moment that we should eventually solve.
+
+
+sys.exit
+========
+
+Some python modules will call sys.exit() themselves when an error occurs, while not common behavior this is something to watch out for because it may seem as if blender is crashing since sys.exit() will quit blender immediately.
+
+For example, the ``optparse`` module will print an error and exit if the arguments are invalid.
+
+An ugly way of troubleshooting this is to set ``sys.exit = None`` and see what line of python code is quitting, you could of course replace ``sys.exit``/ with your own function but manipulating python in this way is bad practice.
+
index 9cbd682..fc17b9a 100644 (file)
@@ -658,7 +658,7 @@ def pycontext2sphinx(BASEPATH):
         char_array = c_char_p_p.from_address(attr)
         i = 0
         while char_array[i] is not None:
-            member = ctypes.string_at(char_array[i]).decode()
+            member = ctypes.string_at(char_array[i]).decode(encoding="ascii")
             fw(".. data:: %s\n\n" % member)
             member_type, is_seq = type_map[member]
             fw("   :type: %s :class:`bpy.types.%s`\n\n" % ("sequence of " if is_seq else "", member_type))
index 917f80e..ba88ce7 100644 (file)
@@ -24,7 +24,7 @@
 namespace libmv {
 
 struct Offset {
-  signed char ix, iy;
+  short ix, iy;
   unsigned char fx,fy;
 };
 
@@ -201,20 +201,14 @@ void CameraIntrinsics::ComputeLookupGrid(Grid* grid, int width, int height, doub
       warp_y = warp_y*aspy + 0.5 * overscan * h;
       int ix = int(warp_x), iy = int(warp_y);
       int fx = round((warp_x-ix)*256), fy = round((warp_y-iy)*256);
-      if(fx == 256) { fx=0; ix++; }
-      if(fy == 256) { fy=0; iy++; }
       // Use nearest border pixel
       if( ix < 0 ) { ix = 0, fx = 0; }
       if( iy < 0 ) { iy = 0, fy = 0; }
       if( ix >= width-2 ) ix = width-2;
       if( iy >= height-2 ) iy = height-2;
-      if ( ix-x > -128 && ix-x < 128 && iy-y > -128 && iy-y < 128 ) {
-        Offset offset = { ix-x, iy-y, fx, fy };
-        grid->offset[y*width+x] = offset;
-      } else {
-        Offset offset = { 0, 0, 0, 0 };
-        grid->offset[y*width+x] = offset;
-      }
+
+      Offset offset = { ix-x, iy-y, fx, fy };
+      grid->offset[y*width+x] = offset;
     }
   }
 }
index cfff748..a85b2ba 100644 (file)
@@ -61,6 +61,7 @@ include_directories(
 # Subdirectories
 
 if(WITH_CYCLES_BLENDER)
+       add_definitions(-DBLENDER_PLUGIN)
        add_subdirectory(blender)
 endif(WITH_CYCLES_BLENDER)
 
index ea46911..e81f02f 100644 (file)
@@ -1,11 +1,4 @@
 
-set(BLENDER_INCLUDE_DIRS
-       ${CMAKE_SOURCE_DIR}/intern/guardedalloc
-       ${CMAKE_SOURCE_DIR}/source/blender/makesdna
-       ${CMAKE_SOURCE_DIR}/source/blender/makesrna
-       ${CMAKE_SOURCE_DIR}/source/blender/blenloader
-       ${CMAKE_BINARY_DIR}/source/blender/makesrna/intern)
-
 set(INC
        ../render
        ../device
@@ -13,15 +6,18 @@ set(INC
        ../kernel/svm
        ../util
        ../subd
+       ../../../intern/guardedalloc
+       ../../../source/blender/makesdna
+       ../../../source/blender/makesrna
+       ../../../source/blender/blenloader
+       ${CMAKE_BINARY_DIR}/source/blender/makesrna/intern
 )
 
 set(INC_SYS
-       ${BLENDER_INCLUDE_DIRS}
        ${PYTHON_INCLUDE_DIRS}
        ${GLEW_INCLUDE_PATH}
 )
 
-
 set(SRC
        blender_camera.cpp
        blender_mesh.cpp
index ccb04ee..a7a8a74 100644 (file)
@@ -43,7 +43,7 @@ from cycles import presets
 
 class CyclesRender(bpy.types.RenderEngine):
     bl_idname = 'CYCLES'
-    bl_label = "Cycles"
+    bl_label = "Cycles Render"
     bl_use_shading_nodes = True
 
     def __init__(self):
index 00010bb..f3ed3b6 100644 (file)
@@ -295,7 +295,7 @@ class Cycles_PT_mesh_displacement(CyclesButtonsPanel, Panel):
 
     @classmethod
     def poll(cls, context):
-        return CyclesButtonsPanel.poll(context) and context.mesh or context.curve or context.meta_ball
+        return CyclesButtonsPanel.poll(context) and (context.mesh or context.curve or context.meta_ball)
 
     def draw(self, context):
         layout = self.layout
index a6ce0e9..cf8527b 100644 (file)
@@ -99,6 +99,9 @@ static float get_node_output_value(BL::Node b_node, const string& name)
 
 static void get_tex_mapping(TextureMapping *mapping, BL::TexMapping b_mapping)
 {
+       if(!b_mapping)
+               return;
+
        mapping->translation = get_float3(b_mapping.location());
        mapping->rotation = get_float3(b_mapping.rotation());
        mapping->scale = get_float3(b_mapping.scale());
@@ -110,6 +113,9 @@ static void get_tex_mapping(TextureMapping *mapping, BL::TexMapping b_mapping)
 
 static void get_tex_mapping(TextureMapping *mapping, BL::ShaderNodeMapping b_mapping)
 {
+       if(!b_mapping)
+               return;
+
        mapping->translation = get_float3(b_mapping.location());
        mapping->rotation = get_float3(b_mapping.rotation());
        mapping->scale = get_float3(b_mapping.scale());
index 9037362..7d12e26 100644 (file)
@@ -70,21 +70,6 @@ if(WITH_CYCLES_PARTIO)
 
 endif()
 
-###########################################################################
-# Blender
-
-if(WITH_CYCLES_BLENDER)
-
-       set(BLENDER_INCLUDE_DIRS
-               ${CMAKE_SOURCE_DIR}/intern/guardedalloc
-               ${CMAKE_SOURCE_DIR}/source/blender/makesdna
-               ${CMAKE_SOURCE_DIR}/source/blender/makesrna
-               ${CMAKE_SOURCE_DIR}/source/blender/blenloader
-               ${CMAKE_BINARY_DIR}/source/blender/makesrna/intern)
-
-       add_definitions(-DBLENDER_PLUGIN)
-endif()
-
 ###########################################################################
 # CUDA
 
index c96d461..f75928c 100644 (file)
@@ -260,12 +260,9 @@ public:
                return true;
        }
 
-       bool build_kernel(const string& kernel_path)
+       string kernel_build_options()
        {
-               string build_options = "";
-
-               build_options += "-I " + kernel_path + ""; /* todo: escape path */
-               build_options += " -cl-fast-relaxed-math ";
+               string build_options = " -cl-fast-relaxed-math ";
                
                /* Full Shading only on NVIDIA cards at the moment */
                char vendor[256];
@@ -273,14 +270,19 @@ public:
                clGetPlatformInfo(cpPlatform, CL_PLATFORM_NAME, sizeof(vendor), &vendor, NULL);
                string name = vendor;
                
-               if (name == "NVIDIA CUDA") {
-                       build_options += "-D __SVM__ ";
-                       build_options += "-D __EMISSION__ ";
-                       build_options += "-D __TEXTURES__ ";
-                       build_options += "-D __HOLDOUT__ ";
-                       build_options += "-D __MULTI_CLOSURE__ ";
-               }
+               if(name == "NVIDIA CUDA")
+                       build_options += "-D__KERNEL_SHADING__ -D__MULTI_CLOSURE__ ";
 
+               return build_options;
+       }
+
+       bool build_kernel(const string& kernel_path)
+       {
+               string build_options = "";
+
+               build_options += "-I " + kernel_path + ""; /* todo: escape path, but it doesn't get parsed correct? */
+               build_options += kernel_build_options();
+       
                ciErr = clBuildProgram(cpProgram, 0, NULL, build_options.c_str(), NULL, NULL);
 
                if(ciErr != CL_SUCCESS) {
@@ -344,6 +346,9 @@ public:
                md5.append((uint8_t*)name, strlen(name));
                md5.append((uint8_t*)driver, strlen(driver));
 
+               string options = kernel_build_options();
+               md5.append((uint8_t*)options.c_str(), options.size());
+
                return md5.get_hex();
        }
 
@@ -563,24 +568,20 @@ public:
        cl_int set_kernel_arg_mem(cl_kernel kernel, int *narg, const char *name)
        {
                cl_mem ptr;
-               cl_int size, err = 0;
+               cl_int err = 0;
 
                if(mem_map.find(name) != mem_map.end()) {
                        device_memory *mem = mem_map[name];
                
                        ptr = CL_MEM_PTR(mem->device_pointer);
-                       size = mem->data_width;
                }
                else {
                        /* work around NULL not working, even though the spec says otherwise */
                        ptr = CL_MEM_PTR(null_mem);
-                       size = 1;
                }
                
                err |= clSetKernelArg(kernel, (*narg)++, sizeof(ptr), (void*)&ptr);
                opencl_assert(err);
-               err |= clSetKernelArg(kernel, (*narg)++, sizeof(size), (void*)&size);
-               opencl_assert(err);
 
                return err;
        }
index 48bee8e..68ca24a 100644 (file)
@@ -33,8 +33,7 @@ __kernel void kernel_ocl_path_trace(
        __global uint *rng_state,
 
 #define KERNEL_TEX(type, ttype, name) \
-       __global type *name, \
-       int name##_width,
+       __global type *name,
 #include "kernel_textures.h"
 
        int sample,
@@ -45,8 +44,7 @@ __kernel void kernel_ocl_path_trace(
        kg->data = data;
 
 #define KERNEL_TEX(type, ttype, name) \
-       kg->name = name; \
-       kg->name##_width = name##_width;
+       kg->name = name;
 #include "kernel_textures.h"
 
        int x = sx + get_global_id(0);
@@ -62,8 +60,7 @@ __kernel void kernel_ocl_tonemap(
        __global float4 *buffer,
 
 #define KERNEL_TEX(type, ttype, name) \
-       __global type *name, \
-       int name##_width,
+       __global type *name,
 #include "kernel_textures.h"
 
        int sample, int resolution,
@@ -74,8 +71,7 @@ __kernel void kernel_ocl_tonemap(
        kg->data = data;
 
 #define KERNEL_TEX(type, ttype, name) \
-       kg->name = name; \
-       kg->name##_width = name##_width;
+       kg->name = name;
 #include "kernel_textures.h"
 
        int x = sx + get_global_id(0);
index b5f59b9..e98bb15 100644 (file)
@@ -97,11 +97,7 @@ __device_inline void bvh_node_intersect(KernelGlobals *kg,
        float c1loz = nz.z * idir.z - ood.z;
        float c1hiz = nz.w * idir.z - ood.z;
 
-       float c0min_x = min(c0lox, c0hix);
-       float c0min_y = min(c0loy, c0hiy);
-       float c0min_z = min(c0loz, c0hiz);
-
-       float c0min = max4(c0min_x, c0min_y, c0min_z, 0.0f);
+       float c0min = max4(min(c0lox, c0hix), min(c0loy, c0hiy), min(c0loz, c0hiz), 0.0f);
        float c0max = min4(max(c0lox, c0hix), max(c0loy, c0hiy), max(c0loz, c0hiz), t);
        float c1lox = n1xy.x * idir.x - ood.x;
        float c1hix = n1xy.y * idir.x - ood.x;
index c2828c2..9cdc2f1 100644 (file)
@@ -127,8 +127,8 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa
 __device void camera_sample(KernelGlobals *kg, int x, int y, float filter_u, float filter_v, float lens_u, float lens_v, Ray *ray)
 {
        /* pixel filter */
-       float raster_x = x + kernel_tex_interp(__filter_table, filter_u);
-       float raster_y = y + kernel_tex_interp(__filter_table, filter_v);
+       float raster_x = x + kernel_tex_interp(__filter_table, filter_u, FILTER_TABLE_SIZE);
+       float raster_y = y + kernel_tex_interp(__filter_table, filter_v, FILTER_TABLE_SIZE);
 
        /* motion blur */
        //ray->time = lerp(time_t, kernel_data.cam.shutter_open, kernel_data.cam.shutter_close);
index fd96148..783ae51 100644 (file)
@@ -55,8 +55,10 @@ template<typename T> struct texture  {
                return ((__m128i*)data)[index];
        }*/
 
-       float interp(float x)
+       float interp(float x, int size)
        {
+               kernel_assert(size == width);
+
                x = clamp(x, 0.0f, 1.0f)*width;
 
                int index = min((int)x, width-1);
@@ -151,7 +153,7 @@ typedef texture_image<uchar4> texture_image_uchar4;
 #define kernel_tex_fetch(tex, index) (kg->tex.fetch(index))
 #define kernel_tex_fetch_m128(tex, index) (kg->tex.fetch_m128(index))
 #define kernel_tex_fetch_m128i(tex, index) (kg->tex.fetch_m128i(index))
-#define kernel_tex_interp(tex, t) (kg->tex.interp(t))
+#define kernel_tex_interp(tex, t, size) (kg->tex.interp(t, size))
 #define kernel_tex_image_interp(tex, x, y) (kg->tex.interp(x, y))
 
 #define kernel_data (kg->__data)
index 72aef46..40129a2 100644 (file)
@@ -55,7 +55,7 @@ typedef texture<uchar4, 2, cudaReadModeNormalizedFloat> texture_image_uchar4;
 /* Macros to handle different memory storage on different devices */
 
 #define kernel_tex_fetch(t, index) tex1Dfetch(t, index)
-#define kernel_tex_interp(t, x) tex1D(t, x)
+#define kernel_tex_interp(t, x, size) tex1D(t, x)
 #define kernel_tex_image_interp(t, x, y) tex2D(t, x, y)
 
 #define kernel_data __data
index 287bf32..5515966 100644 (file)
@@ -100,7 +100,7 @@ __device float kernel_tex_interp_(__global float *data, int width, float x)
 
 /* data lookup defines */
 #define kernel_data (*kg->data)
-#define kernel_tex_interp(t, x) kernel_tex_interp_(kg->t, kg->t##_width, x)
+#define kernel_tex_interp(t, x, size) kernel_tex_interp_(kg->t, size, x)
 #define kernel_tex_fetch(t, index) kg->t[index]
 
 /* define NULL */
index ea86622..1f2fc97 100644 (file)
@@ -77,8 +77,7 @@ typedef struct KernelGlobals {
        __constant KernelData *data;
 
 #define KERNEL_TEX(type, ttype, name) \
-       __global type *name; \
-       int name##_width;
+       __global type *name;
 #include "kernel_textures.h"
 } KernelGlobals;
 
index 1647504..570e072 100644 (file)
@@ -226,7 +226,7 @@ __device void shader_setup_from_displace(KernelGlobals *kg, ShaderData *sd,
        Ng = triangle_normal_MT(kg, prim, &shader);
 
        /* force smooth shading for displacement */
-       sd->shader |= SHADER_SMOOTH_NORMAL;
+       shader |= SHADER_SMOOTH_NORMAL;
 
        /* watch out: no instance transform currently */
 
index 46cdcd1..d9bd645 100644 (file)
 
 CCL_NAMESPACE_BEGIN
 
-#define OBJECT_SIZE 16
-#define LIGHT_SIZE     4
+/* constants */
+#define OBJECT_SIZE            16
+#define LIGHT_SIZE                     4
+#define FILTER_TABLE_SIZE      256
 
+/* device capabilities */
+#ifdef __KERNEL_CPU__
+#define __KERNEL_SHADING__
+#define __KERNEL_ADV_SHADING__
+#endif
+
+#ifdef __KERNEL_CUDA__
+#define __KERNEL_SHADING__
+#if __CUDA_ARCH__ >= 200
+#define __KERNEL_ADV_SHADING__
+#endif
+#endif
+
+#ifdef __KERNEL_OPENCL__
+//#define __KERNEL_SHADING__
+//#define __KERNEL_ADV_SHADING__
+#endif
+
+/* kernel features */
 #define __SOBOL__
 #define __INSTANCING__
 #define __DPDU__
@@ -39,27 +60,20 @@ CCL_NAMESPACE_BEGIN
 #define __CAMERA_CLIPPING__
 #define __INTERSECTION_REFINE__
 
-#ifndef __KERNEL_OPENCL__
+#ifdef __KERNEL_SHADING__
 #define __SVM__
 #define __EMISSION__
 #define __TEXTURES__
 #define __HOLDOUT__
-//#define __MULTI_LIGHT__
 #endif
 
-#ifdef __KERNEL_CPU__
+#ifdef __KERNEL_ADV_SHADING__
 #define __MULTI_CLOSURE__
 #define __TRANSPARENT_SHADOWS__
-//#define __OSL__
-#endif
-
-#ifdef __KERNEL_CUDA__
-#if __CUDA_ARCH__ >= 200
-#define __MULTI_CLOSURE__
-#define __TRANSPARENT_SHADOWS__
-#endif
 #endif
 
+//#define __MULTI_LIGHT__
+//#define __OSL__
 //#define __SOBOL_FULL_SCREEN__
 //#define __MODIFY_TP__
 //#define __QBVH__
index 11dc07e..0ad7cad 100644 (file)
@@ -70,8 +70,8 @@ __device float3 bsdf_oren_nayar_get_intensity(const ShaderClosure *sc, float3 n,
                cos_b = nl;
        }
 
-       float sin_a = sqrtf(1.0f - cos_a * cos_a);
-       float tan_b = sqrtf(1.0f - cos_b * cos_b) / (cos_b + FLT_MIN);
+       float sin_a = sqrtf(max(1.0f - cos_a * cos_a, 0.0f));
+       float tan_b = sqrtf(max(1.0f - cos_b * cos_b, 0.0f)) / max(cos_b, 1e-8f);
 
        float is = nl * (sc->data0 + sc->data1 * t * sin_a * tan_b);
        return make_float3(is, is, is);
@@ -84,8 +84,10 @@ __device void bsdf_oren_nayar_setup(ShaderData *sd, ShaderClosure *sc, float sig
 
        sigma = clamp(sigma, 0.0f, 1.0f);
 
-       sc->data0 =  1.0f / ((1.0f + 0.5f * sigma) * M_PI_F);
-       sc->data1 = sigma / ((1.0f + 0.5f * sigma) * M_PI_F);
+       float div = 1.0f / ((1.0f + 0.5f * sigma) * M_PI_F);
+
+       sc->data0 =  1.0f * div;
+       sc->data1 = sigma * div;
 }
 
 __device void bsdf_oren_nayar_blur(ShaderClosure *sc, float roughness)
index 4925521..c000f1a 100644 (file)
@@ -21,6 +21,8 @@
 #include "filter.h"
 #include "scene.h"
 
+#include "kernel_types.h"
+
 #include "util_algorithm.h"
 #include "util_debug.h"
 #include "util_math.h"
@@ -51,7 +53,7 @@ static float filter_func_gaussian(float v, float width)
 
 static vector<float> filter_table(FilterType type, float width)
 {
-       const int filter_table_size = 256;
+       const int filter_table_size = FILTER_TABLE_SIZE;
        vector<float> filter_table_cdf(filter_table_size+1);
        vector<float> filter_table(filter_table_size+1);
        float (*filter_func)(float, float) = NULL;
index c0dd627..2f9e00d 100644 (file)
@@ -115,12 +115,12 @@ __device_inline double min(double a, double b)
 
 __device_inline float min4(float a, float b, float c, float d)
 {
-       return min(min(min(a, b), c), d);
+       return min(min(a, b), min(c, d));
 }
 
 __device_inline float max4(float a, float b, float c, float d)
 {
-       return max(max(max(a, b), c), d);
+       return max(max(a, b), max(c, d));
 }
 
 #ifndef __KERNEL_OPENCL__
index 1701612..9c70d31 100644 (file)
Binary files a/release/datafiles/fonts/droidsans.ttf.gz and b/release/datafiles/fonts/droidsans.ttf.gz differ
index 26611fb..bcde4ce 100644 (file)
@@ -62,7 +62,7 @@ def modules(module_cache):
     path_list = paths()
 
     # fake module importing
-    def fake_module(mod_name, mod_path, speedy=True):
+    def fake_module(mod_name, mod_path, speedy=True, force_support=None):
         global error_encoding
 
         if _bpy.app.debug:
@@ -134,6 +134,9 @@ def modules(module_cache):
                 traceback.print_exc()
                 raise
 
+            if force_support is not None:
+                mod.bl_info["support"] = force_support
+
             return mod
         else:
             return None
@@ -141,6 +144,13 @@ def modules(module_cache):
     modules_stale = set(module_cache.keys())
 
     for path in path_list:
+
+        # force all contrib addons to be 'TESTING'
+        if path.endswith("addons_contrib") or path.endswith("addons_extern"):
+            force_support = 'TESTING'
+        else:
+            force_support = None
+
         for mod_name, mod_path in _bpy.path.module_names(path):
             modules_stale -= {mod_name}
             mod = module_cache.get(mod_name)
@@ -161,7 +171,7 @@ def modules(module_cache):
                     mod = None
 
             if mod is None:
-                mod = fake_module(mod_name, mod_path)
+                mod = fake_module(mod_name, mod_path, force_support=force_support)
                 if mod:
                     module_cache[mod_name] = mod
 
index 64110b0..f97ba3c 100644 (file)
@@ -35,9 +35,9 @@ def drepr(string):
 
 
 class DataPathBuilder(object):
-    __slots__ = ("data_path", )
     """ Dummy class used to parse fcurve and driver data paths.
     """
+    __slots__ = ("data_path", )
     def __init__(self, attrs):
         self.data_path = attrs
 
index f3095c6..5805bfa 100644 (file)
@@ -2,7 +2,6 @@ import bpy
 camera = bpy.context.edit_movieclip.tracking.camera
 
 camera.sensor_width = 23.4
-camera.sensor_height = 15.6
 camera.units = 'MILLIMETERS'
 camera.focal_length = 24.0
 camera.pixel_aspect = 1
index d5d9684..63b928c 100644 (file)
@@ -77,11 +77,11 @@ class CLIP_OT_track_to_empty(Operator):
         return {'FINISHED'}
 
 
-class CLIP_OT_tracks_to_mesh(Operator):
-    """Create vertex cloud using coordinates of tracks"""
+class CLIP_OT_bundles_to_mesh(Operator):
+    """Create vertex cloud using coordinates of reconstructed tracks"""
 
-    bl_idname = "clip.tracks_to_mesh"
-    bl_label = "Tracks to Mesh"
+    bl_idname = "clip.bundles_to_mesh"
+    bl_label = "3D Markers to Mesh"
     bl_options = {'UNDO', 'REGISTER'}
 
     @classmethod
@@ -116,7 +116,7 @@ class CLIP_OT_delete_proxy(Operator):
 
     bl_idname = "clip.delete_proxy"
     bl_label = "Delete Proxy"
-    bl_options = {'UNDO', 'REGISTER'}
+    bl_options = {'REGISTER'}
 
     @classmethod
     def poll(cls, context):
@@ -191,7 +191,7 @@ class CLIP_OT_set_viewport_background(Operator):
 
     bl_idname = "clip.set_viewport_background"
     bl_label = "Set as Background"
-    bl_options = {'UNDO', 'REGISTER'}
+    bl_options = {'REGISTER'}
 
     @classmethod
     def poll(cls, context):
@@ -211,7 +211,7 @@ class CLIP_OT_set_viewport_background(Operator):
                 break
 
         if not bgpic:
-            bgpic = space_v3d.background_images.add()
+            bgpic = space_v3d.background_images.new()
 
         bgpic.source = 'MOVIE'
         bgpic.clip = clip
@@ -259,14 +259,10 @@ object's movement caused by this constraint"""
                 con = x
 
         if not con:
-            return
+            self.report({'ERROR'},
+                "Motion Tracking constraint to be converted not found")
 
-        if con.type == 'FOLLOW_TRACK' and con.use_3d_position:
-            mat = ob.matrix_world.copy()
-            ob.constraints.remove(con)
-            ob.matrix_world = mat
-
-            return
+            return {'CANCELLED'}
 
         # Get clip used for parenting
         if con.use_active_clip:
@@ -275,7 +271,17 @@ object's movement caused by this constraint"""
             clip = con.clip
 
         if not clip:
-            return
+            self.report({'ERROR'},
+                "Movie clip to use tracking data from isn't set")
+
+            return {'CANCELLED'}
+
+        if con.type == 'FOLLOW_TRACK' and con.use_3d_position:
+            mat = ob.matrix_world.copy()
+            ob.constraints.remove(con)
+            ob.matrix_world = mat
+
+            return {'FINISHED'}
 
         # Find start and end frames
         for track in clip.tracking.tracks:
index 3db768f..6aa08a7 100644 (file)
@@ -116,11 +116,15 @@ def register():
             )
 
     WindowManager.addon_support = EnumProperty(
-            items=[('OFFICIAL', "Official", ""),
-                   ('COMMUNITY', 'Community', ""),
+            items=[('OFFICIAL', "Official", "Officially supported"),
+                   ('COMMUNITY', "Community", "Maintained by community developers"),
+                   ('TESTING', "Testing", "Newly contributed scripts (excluded from release builds)"),
                   ],
             name="Support",
-            description="Display support level", default={'OFFICIAL', 'COMMUNITY'}, options={'ENUM_FLAG'})
+            description="Display support level",
+            default={'OFFICIAL', 'COMMUNITY'},
+            options={'ENUM_FLAG'},
+            )
     # done...
 
 
index e685de4..288f04b 100644 (file)
@@ -454,12 +454,19 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         layout.separator()
 
         layout.prop(md, "use_normals")
-
-        row = layout.row()
-        row.prop(md, "use_foam")
-        sub = row.row()
+        
+        split = layout.split()
+        
+        col = split.column()
+        col.prop(md, "use_foam")
+        sub = col.row()
         sub.active = md.use_foam
         sub.prop(md, "foam_coverage", text="Coverage")
+        
+        col = split.column()
+        col.active = md.use_foam
+        col.label("Foam Data Layer Name:")
+        col.prop(md, "foam_layer_name", text="")
 
         layout.separator()
 
index 877b6c0..db65b0f 100644 (file)
@@ -408,7 +408,7 @@ class SceneButtonsPanel():
 
 class SCENE_PT_game_navmesh(SceneButtonsPanel, Panel):
     bl_label = "Navigation mesh"
-    bl_default_closed = True
+    bl_options = {'DEFAULT_CLOSED'}
     COMPAT_ENGINES = {'BLENDER_GAME'}
 
     @classmethod
index a541f43..f7f6752 100644 (file)
@@ -262,10 +262,6 @@ class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, Panel):
         return psys.settings.type == 'HAIR' and (engine in cls.COMPAT_ENGINES)
 
     def draw_header(self, context):
-        #cloth = context.cloth.collision_settings
-
-        #self.layout.active = cloth_panel_enabled(context.cloth)
-        #self.layout.prop(cloth, "use_collision", text="")
         psys = context.particle_system
         self.layout.prop(psys, "use_hair_dynamics", text="")
 
index 145ae29..100f5b1 100644 (file)
@@ -452,66 +452,22 @@ class RENDER_PT_output(RenderButtonsPanel, Panel):
         layout = self.layout
 
         rd = context.scene.render
-        file_format = rd.file_format
+        image_settings = rd.image_settings
+        file_format = rd.image_settings.file_format
 
         layout.prop(rd, "filepath", text="")
 
         split = layout.split()
 
         col = split.column()
-        col.prop(rd, "file_format", text="")
-        col.row().prop(rd, "color_mode", text="Color", expand=True)
+        col.template_image_settings(rd.image_settings)
 
         col = split.column()
         col.prop(rd, "use_file_extension")
         col.prop(rd, "use_overwrite")
         col.prop(rd, "use_placeholder")
 
-        if file_format in {'AVI_JPEG', 'JPEG'}:
-            layout.prop(rd, "file_quality", slider=True)
-
-        if file_format == 'PNG':
-            layout.prop(rd, "file_quality", slider=True, text="Compression")
-
-        if file_format in {'OPEN_EXR', 'MULTILAYER'}:
-            row = layout.row()
-            row.prop(rd, "exr_codec", text="Codec")
-
-            if file_format == 'OPEN_EXR':
-                row = layout.row()
-                row.prop(rd, "use_exr_half")
-                row.prop(rd, "exr_zbuf")
-                row.prop(rd, "exr_preview")
-
-        elif file_format == 'JPEG2000':
-            split = layout.split()
-            col = split.column()
-            col.label(text="Depth:")
-            col.row().prop(rd, "jpeg2k_depth", expand=True)
-
-            col = split.column()
-            col.prop(rd, "jpeg2k_preset", text="")
-            col.prop(rd, "jpeg2k_ycc")
-
-        elif file_format in {'CINEON', 'DPX'}:
-
-            split = layout.split()
-            split.label("FIXME: hard coded Non-Linear, Gamma:1.0")
-            '''
-            col = split.column()
-            col.prop(rd, "use_cineon_log", text="Convert to Log")
-
-            col = split.column(align=True)
-            col.active = rd.use_cineon_log
-            col.prop(rd, "cineon_black", text="Black")
-            col.prop(rd, "cineon_white", text="White")
-            col.prop(rd, "cineon_gamma", text="Gamma")
-            '''
-
-        elif file_format == 'TIFF':
-            layout.prop(rd, "use_tiff_16bit")
-
-        elif file_format == 'QUICKTIME_CARBON':
+        if file_format == 'QUICKTIME_CARBON':
             layout.operator("scene.render_data_set_quicktime_codec")
 
         elif file_format == 'QUICKTIME_QTKIT':
@@ -552,7 +508,7 @@ class RENDER_PT_encoding(RenderButtonsPanel, Panel):
     @classmethod
     def poll(cls, context):
         rd = context.scene.render
-        return rd.file_format in {'FFMPEG', 'XVID', 'H264', 'THEORA'}
+        return rd.image_settings.file_format in {'FFMPEG', 'XVID', 'H264', 'THEORA'}
 
     def draw(self, context):
         layout = self.layout
index 86880b9..05f4887 100644 (file)
@@ -195,14 +195,13 @@ class SCENE_PT_simplify(SceneButtonsPanel, Panel):
     COMPAT_ENGINES = {'BLENDER_RENDER'}
 
     def draw_header(self, context):
-        scene = context.scene
-        rd = scene.render
+        rd = context.scene.render
         self.layout.prop(rd, "use_simplify", text="")
 
     def draw(self, context):
         layout = self.layout
-        scene = context.scene
-        rd = scene.render
+
+        rd = context.scene.render
 
         layout.active = rd.use_simplify
 
index 237dd7f..eb67f6b 100644 (file)
@@ -210,7 +210,7 @@ class CLIP_PT_tools_geometry(Panel):
     def draw(self, context):
         layout = self.layout
 
-        layout.operator("clip.tracks_to_mesh")
+        layout.operator("clip.bundles_to_mesh")
         layout.operator("clip.track_to_empty")
 
 
@@ -402,15 +402,15 @@ class CLIP_PT_display(Panel):
         col.prop(sc, "show_marker_search", text="Search")
         col.prop(sc, "show_pyramid_levels", text="Pyramid")
 
-        col.prop(sc, "show_track_path", text="Track Path")
+        col.prop(sc, "show_track_path", text="Path")
         row = col.row()
         row.active = sc.show_track_path
         row.prop(sc, "path_length", text="Length")
 
         col.prop(sc, "show_disabled", "Disabled Tracks")
-        col.prop(sc, "show_bundles", text="Bundles")
+        col.prop(sc, "show_bundles", text="3D Markers")
 
-        col.prop(sc, "show_names", text="Track Names and Status")
+        col.prop(sc, "show_names", text="Names and Status")
         col.prop(sc, "show_tiny_markers", text="Compact Markers")
 
         col.prop(sc, "show_grease_pencil", text="Grease Pencil")
@@ -474,16 +474,14 @@ class CLIP_PT_stabilization(Panel):
         return sc.mode == 'RECONSTRUCTION' and sc.clip
 
     def draw_header(self, context):
-        sc = context.space_data
-        tracking = sc.clip.tracking
-        stab = tracking.stabilization
-
+        stab = context.space_data.clip.tracking.stabilization
+        
         self.layout.prop(stab, "use_2d_stabilization", text="")
 
     def draw(self, context):
         layout = self.layout
-        sc = context.space_data
-        tracking = sc.clip.tracking
+
+        tracking = context.space_data.clip.tracking
         stab = tracking.stabilization
 
         layout.active = stab.use_2d_stabilization
index c1c9bc1..06f481d 100644 (file)
@@ -473,9 +473,9 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
         if strip.type == 'SPEED':
             col.prop(strip, "multiply_speed")
         elif strip.type in {'CROSS', 'GAMMA_CROSS', 'PLUGIN', 'WIPE'}:
-                col.prop(strip, "use_default_fade", "Default fade")
-                if not strip.use_default_fade:
-                    col.prop(strip, "effect_fader", text="Effect fader")
+            col.prop(strip, "use_default_fade", "Default fade")
+            if not strip.use_default_fade:
+                col.prop(strip, "effect_fader", text="Effect fader")
 
         layout.prop(strip, "use_translation", text="Image Offset:")
         if strip.use_translation:
index 665d790..d71d575 100644 (file)
@@ -634,12 +634,51 @@ class USERPREF_PT_theme(Panel):
             colsub.row().prop(ui, "inner_key_sel")
             colsub.row().prop(ui, "blend")
 
+            col.separator()
+            col.separator()
+
             ui = theme.user_interface
+            col.label("Icons:")
+
+            row = col.row()
+
+            subsplit = row.split(percentage=0.95)
+
+            padding = subsplit.split(percentage=0.15)
+            colsub = padding.column()
+            colsub = padding.column()
+            colsub.row().prop(ui, "icon_file")
+
+            subsplit = row.split(percentage=0.85)
+
+            padding = subsplit.split(percentage=0.15)
+            colsub = padding.column()
+            colsub = padding.column()
+            colsub.row().prop(ui, "icon_alpha")
+
             col.separator()
             col.separator()
 
-            split = col.split(percentage=0.93)
-            split.prop(ui, "icon_file")
+            ui = theme.user_interface.panel
+            col.label("Panels:")
+
+            row = col.row()
+
+            subsplit = row.split(percentage=0.95)
+
+            padding = subsplit.split(percentage=0.15)
+            colsub = padding.column()
+            colsub = padding.column()
+            rowsub = colsub.row()
+            rowsub.prop(ui, "show_header")
+            rowsub.label()
+
+            subsplit = row.split(percentage=0.85)
+
+            padding = subsplit.split(percentage=0.15)
+            colsub = padding.column()
+            colsub = padding.column()
+            colsub.row().prop(ui, "header")
 
             layout.separator()
             layout.separator()
@@ -891,6 +930,12 @@ class USERPREF_PT_addons(Panel):
     bl_region_type = 'WINDOW'
     bl_options = {'HIDE_HEADER'}
 
+    _support_icon_mapping = {
+        'OFFICIAL': 'FILE_BLEND',
+        'COMMUNITY': 'POSE_DATA',
+        'TESTING': 'MOD_EXPLODE',
+        }
+
     @classmethod
     def poll(cls, context):
         userpref = context.user_preferences
@@ -931,12 +976,13 @@ class USERPREF_PT_addons(Panel):
         split = layout.split(percentage=0.2)
         col = split.column()
         col.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM')
-        col.label(text="Categories")
-        col.prop(context.window_manager, "addon_filter", expand=True)
 
         col.label(text="Supported Level")
         col.prop(context.window_manager, "addon_support", expand=True)
 
+        col.label(text="Categories")
+        col.prop(context.window_manager, "addon_filter", expand=True)
+
         col = split.column()
 
         # set in addon_utils.modules(...)
@@ -995,12 +1041,7 @@ class USERPREF_PT_addons(Panel):
                     rowsub.label(icon='ERROR')
 
                 # icon showing support level.
-                if info["support"] == 'OFFICIAL':
-                    rowsub.label(icon='FILE_BLEND')
-                elif info["support"] == 'COMMUNITY':
-                    rowsub.label(icon='POSE_DATA')
-                else:
-                    rowsub.label(icon='QUESTION')
+                rowsub.label(icon=self._support_icon_mapping.get(info["support"], 'QUESTION'))
 
                 if is_enabled:
                     row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name
index 6bf8dd8..e090b33 100644 (file)
@@ -262,6 +262,7 @@ class VIEW3D_MT_uv_map(Menu):
 
         layout.separator()
 
+        layout.operator_context = 'EXEC_REGION_WIN'
         layout.operator("uv.project_from_view")
         layout.operator("uv.project_from_view", text="Project from View (Bounds)").scale_to_bounds = True
 
@@ -525,7 +526,7 @@ class VIEW3D_MT_select_edit_mesh(Menu):
         layout.operator("mesh.select_by_number_vertices", text="Triangles").type = 'TRIANGLES'
         layout.operator("mesh.select_by_number_vertices", text="Quads").type = 'QUADS'
         if context.scene.tool_settings.mesh_select_mode[2] == False:
-                layout.operator("mesh.select_non_manifold", text="Non Manifold")
+            layout.operator("mesh.select_non_manifold", text="Non Manifold")
         layout.operator("mesh.select_by_number_vertices", text="Loose Verts/Edges").type = 'OTHER'
         layout.operator("mesh.select_similar", text="Similar")
 
@@ -1830,32 +1831,32 @@ class VIEW3D_MT_edit_text_chars(Menu):
     def draw(self, context):
         layout = self.layout
 
-        layout.operator("font.text_insert", text="Copyright|Alt C").text = b'\xC2\xA9'.decode()
-        layout.operator("font.text_insert", text="Registered Trademark|Alt R").text = b'\xC2\xAE'.decode()
+        layout.operator("font.text_insert", text="Copyright|Alt C").text = "\u00A9"
+        layout.operator("font.text_insert", text="Registered Trademark|Alt R").text = "\u00AE"
 
         layout.separator()
 
-        layout.operator("font.text_insert", text="Degree Sign|Alt G").text = b'\xC2\xB0'.decode()
-        layout.operator("font.text_insert", text="Multiplication Sign|Alt x").text = b'\xC3\x97'.decode()
-        layout.operator("font.text_insert", text="Circle|Alt .").text = b'\xC2\x8A'.decode()
-        layout.operator("font.text_insert", text="Superscript 1|Alt 1").text = b'\xC2\xB9'.decode()
-        layout.operator("font.text_insert", text="Superscript 2|Alt 2").text = b'\xC2\xB2'.decode()
-        layout.operator("font.text_insert", text="Superscript 3|Alt 3").text = b'\xC2\xB3'.decode()
-        layout.operator("font.text_insert", text="Double >>|Alt >").text = b'\xC2\xBB'.decode()
-        layout.operator("font.text_insert", text="Double <<|Alt <").text = b'\xC2\xAB'.decode()
-        layout.operator("font.text_insert", text="Promillage|Alt %").text = b'\xE2\x80\xB0'.decode()
+        layout.operator("font.text_insert", text="Degree Sign|Alt G").text = "\u00B0"
+        layout.operator("font.text_insert", text="Multiplication Sign|Alt x").text = "\u00D7"
+        layout.operator("font.text_insert", text="Circle|Alt .").text = "\u008A"
+        layout.operator("font.text_insert", text="Superscript 1|Alt 1").text = "\u00B9"
+        layout.operator("font.text_insert", text="Superscript 2|Alt 2").text = "\u00B2"
+        layout.operator("font.text_insert", text="Superscript 3|Alt 3").text = "\u00B3"
+        layout.operator("font.text_insert", text="Double >>|Alt >").text = "\u00BB"
+        layout.operator("font.text_insert", text="Double <<|Alt <").text = "\u00AB"
+        layout.operator("font.text_insert", text="Promillage|Alt %").text = "\u2030"
 
         layout.separator()
 
-        layout.operator("font.text_insert", text="Dutch Florin|Alt F").text = b'\xC2\xA4'.decode()
-        layout.operator("font.text_insert", text="British Pound|Alt L").text = b'\xC2\xA3'.decode()
-        layout.operator("font.text_insert", text="Japanese Yen|Alt Y").text = b'\xC2\xA5'.decode()
+        layout.operator("font.text_insert", text="Dutch Florin|Alt F").text = "\u00A4"
+        layout.operator("font.text_insert", text="British Pound|Alt L").text = "\u00A3"
+        layout.operator("font.text_insert", text="Japanese Yen|Alt Y").text = "\u00A5"
 
         layout.separator()
 
-        layout.operator("font.text_insert", text="German S|Alt S").text = b'\xC3\x9F'.decode()
-        layout.operator("font.text_insert", text="Spanish Question Mark|Alt ?").text = b'\xC2\xBF'.decode()
-        layout.operator("font.text_insert", text="Spanish Exclamation Mark|Alt !").text = b'\xC2\xA1'.decode()
+        layout.operator("font.text_insert", text="German S|Alt S").text = "\u00DF"
+        layout.operator("font.text_insert", text="Spanish Question Mark|Alt ?").text = "\u00BF"
+        layout.operator("font.text_insert", text="Spanish Exclamation Mark|Alt !").text = "\u00A1"
 
 
 class VIEW3D_MT_edit_meta(Menu):
@@ -2192,10 +2193,9 @@ class VIEW3D_PT_view3d_motion_tracking(Panel):
         return (view)
 
     def draw_header(self, context):
-        layout = self.layout
         view = context.space_data
 
-        layout.prop(view, "show_reconstruction", text="")
+        self.layout.prop(view, "show_reconstruction", text="")
 
     def draw(self, context):
         layout = self.layout
@@ -2204,7 +2204,7 @@ class VIEW3D_PT_view3d_motion_tracking(Panel):
 
         col = layout.column()
         col.active = view.show_reconstruction
-        col.prop(view, "show_tracks_name")
+        col.prop(view, "show_bundle_names")
         col.prop(view, "show_camera_path")
         col.label(text="Tracks:")
         col.prop(view, "tracks_draw_type", text="")
@@ -2277,10 +2277,9 @@ class VIEW3D_PT_background_image(Panel):
     bl_options = {'DEFAULT_CLOSED'}
 
     def draw_header(self, context):
-        layout = self.layout
         view = context.space_data
 
-        layout.prop(view, "show_background_images", text="")
+        self.layout.prop(view, "show_background_images", text="")
 
     def draw(self, context):
         layout = self.layout
@@ -2297,7 +2296,7 @@ class VIEW3D_PT_background_image(Panel):
             row.prop(bg, "show_expanded", text="", emboss=False)
             if bg.source == 'IMAGE' and bg.image:
                 row.prop(bg.image, "name", text="", emboss=False)
-            if bg.source == 'MOVIE' and bg.clip:
+            elif bg.source == 'MOVIE' and bg.clip:
                 row.prop(bg.clip, "name", text="", emboss=False)
             else:
                 row.label(text="Not Set")
@@ -2359,14 +2358,12 @@ class VIEW3D_PT_transform_orientations(Panel):
         layout = self.layout
 
         view = context.space_data
+        orientation = view.current_orientation
 
         col = layout.column()
-
         col.prop(view, "transform_orientation")
         col.operator("transform.create_orientation", text="Create")
 
-        orientation = view.current_orientation
-
         if orientation:
             col.prop(orientation, "name")
             col.operator("transform.delete_orientation", text="Delete")
index e8c6ff7..2ba23e5 100644 (file)
@@ -78,7 +78,7 @@ static const char *locales[] = {
        "finnish", "fi_FI",
        "swedish", "sv_SE",
        "french", "fr_FR",
-       "spanish", "es_ES",
+       "spanish", "es",
        "catalan", "ca_AD",
        "czech", "cs_CZ",
        "ptb", "pt_BR",
index 34b674f..fdd876f 100644 (file)
@@ -42,7 +42,7 @@ extern "C" {
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION                        260
-#define BLENDER_SUBVERSION             4
+#define BLENDER_SUBVERSION             5
 
 #define BLENDER_MINVERSION             250
 #define BLENDER_MINSUBVERSION  0
index fc0ef02..72e22dc 100644 (file)
 extern "C" {
 #endif
 
+#include "DNA_vec_types.h"
+
 struct Camera;
 struct Object;
+struct RegionView3D;
 struct RenderData;
 struct Scene;
 struct rctf;
 struct View3D;
 
+/* Camera Datablock */
+
 void *add_camera(const char *name);
 struct Camera *copy_camera(struct Camera *cam);
 void make_local_camera(struct Camera *cam);
 void free_camera(struct Camera *ca);
 
-float dof_camera(struct Object *ob);
+/* Camera Usage */
+
+float object_camera_dof_distance(struct Object *ob);
+void object_camera_mode(struct RenderData *rd, struct Object *ob);
+
+int camera_sensor_fit(int sensor_fit, float sizex, float sizey);
+float camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y);
+
+/* Camera Parameters:
+ *
+ * Intermediate struct for storing camera parameters from various sources,
+ * to unify computation of viewplane, window matrix, ... */
+
+typedef struct CameraParams {
+       /* lens */
+       int is_ortho;
+       float lens;
+       float ortho_scale;
+       float zoom;
+
+       float shiftx;
+       float shifty;
+       float offsetx;
+       float offsety;
+
+       /* sensor */
+       float sensor_x;
+       float sensor_y;
+       int sensor_fit;
+
+       /* clipping */
+       float clipsta;
+       float clipend;
+
+       /* fields */
+       int use_fields;
+       int field_second;
+       int field_odd;
+
+       /* computed viewplane */
+       float ycor;
+       float viewdx;
+       float viewdy;
+       rctf viewplane;
+
+       /* computed matrix */
+       float winmat[4][4];
+} CameraParams;
+
+void camera_params_init(CameraParams *params);
+void camera_params_from_object(CameraParams *params, struct Object *camera);
+void camera_params_from_view3d(CameraParams *params, struct View3D *v3d, struct RegionView3D *rv3d);
+
+void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float aspx, float aspy);
+void camera_params_compute_matrix(CameraParams *params);
 
-void object_camera_mode(struct RenderData *rd, struct Object *camera);
-void object_camera_intrinsics(struct Object *camera, struct Camera **cam_r, short *is_ortho, float *shiftx, float *shifty,
-                       float *clipsta, float *clipend, float *lens, float *sensor_x, float *sensor_y, short *sensor_fit);
-void object_camera_matrix(
-               struct RenderData *rd, struct Object *camera, int winx, int winy, short field_second,
-               float winmat[][4], struct rctf *viewplane, float *clipsta, float *clipend, float *lens,
-               float *sensor_x, float *sensor_y, short *sensor_fit, float *ycor,
-               float *viewdx, float *viewdy);
+/* Camera View Frame */
 
 void camera_view_frame_ex(struct Scene *scene, struct Camera *camera, float drawsize, const short do_clip, const float scale[3],
                           float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3]);
index adb34f4..7233f95 100644 (file)
@@ -43,6 +43,7 @@ struct Tex;
 struct anim;
 struct Scene;
 struct Object;
+struct ImageFormatData;
 
 /* call from library */
 void   free_image(struct Image *me);
@@ -50,13 +51,19 @@ void        free_image(struct Image *me);
 void   BKE_stamp_info(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf);
 void   BKE_stamp_buf(struct Scene *scene, struct Object *camera, unsigned char *rect, float *rectf, int width, int height, int channels);
 int            BKE_alphatest_ibuf(struct ImBuf *ibuf);
-int            BKE_write_ibuf_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
-int            BKE_write_ibuf(struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
-void   BKE_makepicstring(char *string, const char *base, int frame, int imtype, const short use_ext, const short use_frames);
-int            BKE_add_image_extension(char *string, int imtype);
-int            BKE_ftype_to_imtype(int ftype);
-int            BKE_imtype_to_ftype(int imtype);
-int            BKE_imtype_is_movie(int imtype);
+int            BKE_write_ibuf_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
+int            BKE_write_ibuf(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf);
+void   BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, char imtype, const short use_ext, const short use_frames);
+int            BKE_add_image_extension(char *string, const char imtype);
+char   BKE_ftype_to_imtype(const int ftype);
+int            BKE_imtype_to_ftype(char imtype);
+
+int            BKE_imtype_is_movie(const char imtype);
+int            BKE_imtype_supports_alpha(const char imtype);
+int            BKE_imtype_supports_zbuf(const char imtype);
+int            BKE_imtype_supports_compress(const char imtype);
+int            BKE_imtype_supports_quality(const char imtype);
+char   BKE_imtype_valid_depths(const char imtype);
 
 struct anim *openanim(const char *name, int flags, int streamindex);
 
index a47cefe..84f8995 100644 (file)
@@ -364,5 +364,8 @@ void test_object_modifiers(struct Object *ob);
 /* here for do_versions */
 void modifier_mdef_compact_influences(struct ModifierData *md);
 
+void        modifier_path_init(char *path, int path_maxlen, const char *name);
+const char *modifier_path_relbase(struct Object *ob);
+
 #endif
 
index 580f78d..82e42ae 100644 (file)
@@ -190,10 +190,24 @@ typedef struct bNodeType {
         * when a final generic version of execution code is defined, this will be changed anyway
         */
        void (*newexecfunc)(void *data, int thread, struct bNode *, void *nodedata, struct bNodeStack **, struct bNodeStack **);
+       /* This is the muting callback.
+        * XXX Mimics the newexecfunc signature... Not sure all of this will be useful, we will see.
+        */
+       void (*mutefunc)(void *data, int thread, struct bNode *, void *nodedata, struct bNodeStack **, struct bNodeStack **);
+       /* And the muting util.
+        * Returns links as a ListBase, as pairs of bNodeStack* if in/out bNodeStacks were provided,
+        * else as pairs of bNodeSocket* if node tree was provided.
+        */
+       ListBase (*mutelinksfunc)(struct bNodeTree *, struct bNode *, struct bNodeStack **, struct bNodeStack **,
+                                 struct GPUNodeStack *, struct GPUNodeStack *);
        /* gpu */
        int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out);
        /* extended gpu function */
        int (*gpuextfunc)(struct GPUMaterial *mat, struct bNode *node, void *nodedata, struct GPUNodeStack *in, struct GPUNodeStack *out);
+       /* This is the muting gpu callback.
+        * XXX Mimics the gpuextfunc signature... Not sure all of this will be useful, we will see.
+        */
+       int (*gpumutefunc)(struct GPUMaterial *, struct bNode *, void *, struct GPUNodeStack *, struct GPUNodeStack *);
 } bNodeType;
 
 /* node->exec, now in use for composites (#define for break is same as ready yes) */
@@ -270,6 +284,13 @@ typedef struct bNodeTreeType
        void (*update_node)(struct bNodeTree *ntree, struct bNode *node);
        
        int (*validate_link)(struct bNodeTree *ntree, struct bNodeLink *link);
+
+       /* Default muting pointers. */
+       void (*mutefunc)(void *data, int thread, struct bNode *, void *nodedata, struct bNodeStack **, struct bNodeStack **);
+       ListBase (*mutelinksfunc)(struct bNodeTree *, struct bNode *, struct bNodeStack **, struct bNodeStack **,
+                                 struct GPUNodeStack *, struct GPUNodeStack *);
+       /* gpu */
+       int (*gpumutefunc)(struct GPUMaterial *, struct bNode *, void *, struct GPUNodeStack *, struct GPUNodeStack *);
 } bNodeTreeType;
 
 /* ************** GENERIC API, TREES *************** */
@@ -325,7 +346,7 @@ struct bNode        *nodeAddNode(struct bNodeTree *ntree, struct bNodeTemplate *ntemp);
 void                   nodeUnlinkNode(struct bNodeTree *ntree, struct bNode *node);
 void                   nodeUniqueName(struct bNodeTree *ntree, struct bNode *node);
 
-void                   nodeRegisterType(struct ListBase *typelist, struct bNodeType *ntype) ;
+void                   nodeRegisterType(struct bNodeTreeType *ttype, struct bNodeType *ntype) ;
 void                   nodeMakeDynamicType(struct bNode *node);
 int                            nodeDynamicUnlinkText(struct ID *txtid);
 
@@ -368,7 +389,8 @@ struct bNodeTree *nodeGroupEditSet(struct bNode *node, int edit);
 void                   nodeGroupEditClear(struct bNode *node);
 
 /* Init a new node type struct with default values and callbacks */
-void                   node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag);
+void                   node_type_base(struct bNodeTreeType *ttype, struct bNodeType *ntype, int type,
+                               const char *name, short nclass, short flag);
 void                   node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs);
 void                   node_type_size(struct bNodeType *ntype, int width, int minwidth, int maxwidth);
 void                   node_type_init(struct bNodeType *ntype, void (*initfunc)(struct bNodeTree *ntree, struct bNode *node, struct bNodeTemplate *ntemp));
@@ -390,13 +412,25 @@ void                      node_type_group_edit(struct bNodeType *ntype,
                                                                         struct bNodeTree *(*group_edit_set)(struct bNode *node, int edit),
                                                                         void (*group_edit_clear)(struct bNode *node));
 
-void                   node_type_exec(struct bNodeType *ntype, void (*execfunc)(void *data, struct bNode *, struct bNodeStack **, struct bNodeStack **));
+void                   node_type_exec(struct bNodeType *ntype, void (*execfunc)(void *data, struct bNode *, struct bNodeStack **,
+                                                                         struct bNodeStack **));
 void                   node_type_exec_new(struct bNodeType *ntype,
                                                                   void *(*initexecfunc)(struct bNode *node),
                                                                   void (*freeexecfunc)(struct bNode *node, void *nodedata),
-                                                                  void (*newexecfunc)(void *data, int thread, struct bNode *, void *nodedata, struct bNodeStack **, struct bNodeStack **));
-void                   node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out));
-void                   node_type_gpu_ext(struct bNodeType *ntype, int (*gpuextfunc)(struct GPUMaterial *mat, struct bNode *node, void *nodedata, struct GPUNodeStack *in, struct GPUNodeStack *out));
+                                                                  void (*newexecfunc)(void *data, int thread, struct bNode *, void *nodedata,
+                                                                                      struct bNodeStack **, struct bNodeStack **));
+void                   node_type_mute(struct bNodeType *ntype,
+                               void (*mutefunc)(void *data, int thread, struct bNode *, void *nodedata,
+                                                struct bNodeStack **, struct bNodeStack **),
+                               ListBase (*mutelinksfunc)(struct bNodeTree *, struct bNode *, struct bNodeStack **,
+                                                         struct bNodeStack **, struct GPUNodeStack*, struct GPUNodeStack*));
+void                   node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node,
+                                                                      struct GPUNodeStack *in, struct GPUNodeStack *out));
+void                   node_type_gpu_ext(struct bNodeType *ntype, int (*gpuextfunc)(struct GPUMaterial *mat, struct bNode *node,
+                                                                             void *nodedata, struct GPUNodeStack *in,
+                                                                             struct GPUNodeStack *out));
+void                   node_type_gpu_mute(struct bNodeType *ntype, int (*gpumutefunc)(struct GPUMaterial *, struct bNode *, void *,
+                                                                               struct GPUNodeStack *, struct GPUNodeStack *));
 void                   node_type_compatibility(struct bNodeType *ntype, short compatibility);
 
 /* ************** COMMON NODES *************** */
@@ -421,7 +455,7 @@ struct bNode        *node_group_make_from_selected(struct bNodeTree *ntree);
 int                            node_group_ungroup(struct bNodeTree *ntree, struct bNode *gnode);
 
 /* in node_common.c */
-void register_node_type_frame(ListBase *lb);
+void register_node_type_frame(struct bNodeTreeType *ttype);
 
 /* ************** SHADER NODES *************** */
 
index cb79c7a..5eb9529 100644 (file)
@@ -94,7 +94,6 @@ void object_to_mat3(struct Object *ob, float mat[][3]);
 void object_to_mat4(struct Object *ob, float mat[][4]);
 void object_apply_mat4(struct Object *ob, float mat[][4], const short use_compat, const short use_parent);
 
-void set_no_parent_ipo(int val);
 struct Object *object_pose_armature_get(struct Object *ob);
 
 void where_is_object_time(struct Scene *scene, struct Object *ob, float ctime);
index c1f228f..c8ce3f8 100644 (file)
@@ -48,7 +48,8 @@ typedef struct OceanCache {
        struct ImBuf **ibufs_foam;
        struct ImBuf **ibufs_norm;
        
-       char *bakepath;
+       const char *bakepath;
+       const char *relbase;
        
        /* precalculated for time range */
        float *time;
@@ -92,8 +93,9 @@ void BKE_ocean_eval_ij(struct Ocean * oc, struct OceanResult *ocr, int i, int j)
 
 
 /* ocean cache handling */
-struct OceanCache *BKE_init_ocean_cache(char *bakepath, int start, int end, float wave_scale, 
-                                                 float chop_amount, float foam_coverage, float foam_fade, int resolution);
+struct OceanCache *BKE_init_ocean_cache(const char *bakepath, const char *relbase,
+                                        int start, int end, float wave_scale,
+                                        float chop_amount, float foam_coverage, float foam_fade, int resolution);
 void BKE_simulate_ocean_cache(struct OceanCache *och, int frame);
        
 void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(void *, float progress, int *cancel), void *update_cb_data);
index ad394f9..7cb3150 100644 (file)
@@ -44,6 +44,7 @@ struct Main;
 struct Object;
 struct QuicktimeCodecData;
 struct RenderData;
+struct SceneRenderLayer;
 struct Scene;
 struct Text;
 struct Text;
@@ -93,7 +94,8 @@ void scene_clear_tagged(struct Main *bmain, struct Scene *sce);
 
 void scene_update_for_newframe(struct Main *bmain, struct Scene *sce, unsigned int lay);
 
-void scene_add_render_layer(struct Scene *sce);
+struct SceneRenderLayer *scene_add_render_layer(struct Scene *sce, const char *name);
+int scene_remove_render_layer(struct Main *main, struct Scene *scene, struct SceneRenderLayer *srl);
 
 /* render profile */
 int get_render_subsurf_level(struct RenderData *r, int level);
index f2502cf..01a16be 100644 (file)
@@ -50,7 +50,7 @@ typedef struct bMovieHandle {
        void (*get_movie_path)(char *string, struct RenderData *rd); /* optional */
 } bMovieHandle;
 
-bMovieHandle *BKE_get_movie_handle(int imtype);
+bMovieHandle *BKE_get_movie_handle(const char imtype);
 void BKE_makeanimstring(char *string, struct RenderData *rd);
 
 #ifdef __cplusplus
index 63ab74f..b32421a 100644 (file)
@@ -1373,17 +1373,17 @@ void animsys_evaluate_action (PointerRNA *ptr, bAction *act, AnimMapper *remap,
 static float nlastrip_get_influence (NlaStrip *strip, float cframe)
 {
        /* sanity checks - normalise the blendin/out values? */
-       strip->blendin= (float)fabs(strip->blendin);
-       strip->blendout= (float)fabs(strip->blendout);
+       strip->blendin= fabsf(strip->blendin);
+       strip->blendout= fabsf(strip->blendout);
        
        /* result depends on where frame is in respect to blendin/out values */
        if (IS_EQ(strip->blendin, 0)==0 && (cframe <= (strip->start + strip->blendin))) {
                /* there is some blend-in */
-               return (float)fabs(cframe - strip->start) / (strip->blendin);
+               return fabsf(cframe - strip->start) / (strip->blendin);
        }
        else if (IS_EQ(strip->blendout, 0)==0 && (cframe >= (strip->end - strip->blendout))) {
                /* there is some blend-out */
-               return (float)fabs(strip->end - cframe) / (strip->blendout);
+               return fabsf(strip->end - cframe) / (strip->blendout);
        }
        else {
                /* in the middle of the strip, we should be full strength */
index f1e6de9..0211dcd 100644 (file)
@@ -159,7 +159,7 @@ void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step)
                ibuf->userdata = bmfont;
                ibuf->userflags |= IB_BITMAPFONT;
 
-               if (ibuf->depth < 32) {
+               if (ibuf->planes < 32) {
                        // we're going to fake alpha here:
                        calcAlpha(ibuf);
                }
index 6ba7a76..08e8a80 100644 (file)
@@ -35,6 +35,7 @@
 #include "DNA_lamp_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
+#include "DNA_view3d_types.h"
 
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
@@ -45,6 +46,9 @@
 #include "BKE_global.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
+#include "BKE_screen.h"
+
+/****************************** Camera Datablock *****************************/
 
 void *add_camera(const char *name)
 {
@@ -70,7 +74,9 @@ Camera *copy_camera(Camera *cam)
        Camera *camn;
        
        camn= copy_libblock(&cam->id);
-       
+
+       id_lib_extern((ID *)camn->dof_ob);
+
        return camn;
 }
 
@@ -121,8 +127,26 @@ void make_local_camera(Camera *cam)
        }
 }
 
+void free_camera(Camera *ca)
+{
+       BKE_free_animdata((ID *)ca);
+}
+
+/******************************** Camera Usage *******************************/
+
+void object_camera_mode(RenderData *rd, Object *cam_ob)
+{
+       rd->mode &= ~(R_ORTHO|R_PANORAMA);
+
+       if(cam_ob && cam_ob->type==OB_CAMERA) {
+               Camera *cam= cam_ob->data;
+               if(cam->type == CAM_ORTHO) rd->mode |= R_ORTHO;
+               if(cam->flag & CAM_PANORAMA) rd->mode |= R_PANORAMA;
+       }
+}
+
 /* get the camera's dof value, takes the dof object into account */
-float dof_camera(Object *ob)
+float object_camera_dof_distance(Object *ob)
 {
        Camera *cam = (Camera *)ob->data; 
        if (ob->type != OB_CAMERA)
@@ -136,180 +160,212 @@ float dof_camera(Object *ob)
                normalize_m4(obmat);
                invert_m4_m4(imat, obmat);
                mul_m4_m4m4(mat, cam->dof_ob->obmat, imat);
-               return (float)fabs(mat[3][2]);
+               return fabsf(mat[3][2]);
        }
        return cam->YF_dofdist;
 }
 
-void free_camera(Camera *ca)
+float camera_sensor_size(int sensor_fit, float sensor_x, float sensor_y)
 {
-       BKE_free_animdata((ID *)ca);
+       /* sensor size used to fit to. for auto, sensor_x is both x and y. */
+       if(sensor_fit == CAMERA_SENSOR_FIT_VERT)
+               return sensor_y;
+
+       return sensor_x;
 }
 
-void object_camera_mode(RenderData *rd, Object *camera)
+int camera_sensor_fit(int sensor_fit, float sizex, float sizey)
 {
-       rd->mode &= ~(R_ORTHO|R_PANORAMA);
-       if(camera && camera->type==OB_CAMERA) {
-               Camera *cam= camera->data;
-               if(cam->type == CAM_ORTHO) rd->mode |= R_ORTHO;
-               if(cam->flag & CAM_PANORAMA) rd->mode |= R_PANORAMA;
+       if(sensor_fit == CAMERA_SENSOR_FIT_AUTO) {
+               if(sizex >= sizey)
+                       return CAMERA_SENSOR_FIT_HOR;
+               else
+                       return CAMERA_SENSOR_FIT_VERT;
        }
+
+       return sensor_fit;
 }
 
-void object_camera_intrinsics(Object *camera, Camera **cam_r, short *is_ortho, float *shiftx, float *shifty,
-                       float *clipsta, float *clipend, float *lens, float *sensor_x, float *sensor_y, short *sensor_fit)
+/******************************** Camera Params *******************************/
+
+void camera_params_init(CameraParams *params)
 {
-       Camera *cam= NULL;
+       memset(params, 0, sizeof(CameraParams));
 
-       (*shiftx)= 0.0f;
-       (*shifty)= 0.0f;
+       /* defaults */
+       params->sensor_x= DEFAULT_SENSOR_WIDTH;
+       params->sensor_y= DEFAULT_SENSOR_HEIGHT;
+       params->sensor_fit= CAMERA_SENSOR_FIT_AUTO;
 
-       (*sensor_x)= DEFAULT_SENSOR_WIDTH;
-       (*sensor_y)= DEFAULT_SENSOR_HEIGHT;
-       (*sensor_fit)= CAMERA_SENSOR_FIT_AUTO;
+       params->zoom= 1.0f;
+}
 
-       if(camera->type==OB_CAMERA) {
-               cam= camera->data;
+void camera_params_from_object(CameraParams *params, Object *ob)
+{
+       if(!ob)
+               return;
 
-               if(cam->type == CAM_ORTHO) {
-                       *is_ortho= TRUE;
-               }
+       if(ob->type==OB_CAMERA) {
+               /* camera object */
+               Camera *cam= ob->data;
 
-               /* solve this too... all time depending stuff is in convertblender.c?
-                * Need to update the camera early because it's used for projection matrices
-                * and other stuff BEFORE the animation update loop is done
-                * */
-#if 0 // XXX old animation system
-               if(cam->ipo) {
-                       calc_ipo(cam->ipo, frame_to_float(re->scene, re->r.cfra));
-                       execute_ipo(&cam->id, cam->ipo);
-               }
-#endif // XXX old animation system
-               (*shiftx)=cam->shiftx;
-               (*shifty)=cam->shifty;
-               (*lens)= cam->lens;
-               (*sensor_x)= cam->sensor_x;
-               (*sensor_y)= cam->sensor_y;
-               (*clipsta)= cam->clipsta;
-               (*clipend)= cam->clipend;
-               (*sensor_fit)= cam->sensor_fit;
+               if(cam->type == CAM_ORTHO)
+                       params->is_ortho= TRUE;
+               params->lens= cam->lens;
+               params->ortho_scale= cam->ortho_scale;
+
+               params->shiftx= cam->shiftx;
+               params->shifty= cam->shifty;
+
+               params->sensor_x= cam->sensor_x;
+               params->sensor_y= cam->sensor_y;
+               params->sensor_fit= cam->sensor_fit;
+
+               params->clipsta= cam->clipsta;
+               params->clipend= cam->clipend;
        }
-       else if(camera->type==OB_LAMP) {
-               Lamp *la= camera->data;
+       else if(ob->type==OB_LAMP) {
+               /* lamp object */
+               Lamp *la= ob->data;
                float fac= cosf((float)M_PI*la->spotsize/360.0f);
                float phi= acos(fac);
 
-               (*lens)= 16.0f*fac/sinf(phi);
-               if((*lens)==0.0f)
-                       (*lens)= 35.0f;
-               (*clipsta)= la->clipsta;
-               (*clipend)= la->clipend;
-       }
-       else {  /* envmap exception... */;
-               if((*lens)==0.0f) /* is this needed anymore? */
-                       (*lens)= 16.0f;
+               params->lens= 16.0f*fac/sinf(phi);
+               if(params->lens==0.0f)
+                       params->lens= 35.0f;
 
-               if((*clipsta)==0.0f || (*clipend)==0.0f) {
-                       (*clipsta)= 0.1f;
-                       (*clipend)= 1000.0f;
-               }
+               params->clipsta= la->clipsta;
+               params->clipend= la->clipend;
        }
-
-       (*cam_r)= cam;
 }
 
-/* 'lens' may be set for envmap only */
-void object_camera_matrix(
-               RenderData *rd, Object *camera, int winx, int winy, short field_second,
-               float winmat[][4], rctf *viewplane, float *clipsta, float *clipend, float *lens,
-               float *sensor_x, float *sensor_y, short *sensor_fit, float *ycor,
-               float *viewdx, float *viewdy)
+void camera_params_from_view3d(CameraParams *params, View3D *v3d, RegionView3D *rv3d)
 {
-       Camera *cam=NULL;
-       float pixsize;
-       float shiftx=0.0, shifty=0.0, winside, viewfac;
-       short is_ortho= FALSE;
-
-       /* question mark */
-       (*ycor)= rd->yasp / rd->xasp;
-       if(rd->mode & R_FIELDS)
-               (*ycor) *= 2.0f;
-
-       object_camera_intrinsics(camera, &cam, &is_ortho, &shiftx, &shifty, clipsta, clipend, lens, sensor_x, sensor_y, sensor_fit);
-
-       /* ortho only with camera available */
-       if(cam && is_ortho) {
-               if((*sensor_fit)==CAMERA_SENSOR_FIT_AUTO) {
-                       if(rd->xasp*winx >= rd->yasp*winy) viewfac= winx;
-                       else viewfac= (*ycor) * winy;
-               }
-               else if((*sensor_fit)==CAMERA_SENSOR_FIT_HOR) {
-                       viewfac= winx;
-               }
-               else { /* if((*sensor_fit)==CAMERA_SENSOR_FIT_VERT) { */
-                       viewfac= (*ycor) * winy;
-               }
+       /* common */
+       params->lens= v3d->lens;
+       params->clipsta= v3d->near;
+       params->clipend= v3d->far;
+
+       if(rv3d->persp==RV3D_CAMOB) {
+               /* camera view */
+               camera_params_from_object(params, v3d->camera);
 
-               /* ortho_scale == 1.0 means exact 1 to 1 mapping */
-               pixsize= cam->ortho_scale/viewfac;
+               params->zoom= BKE_screen_view3d_zoom_to_fac((float)rv3d->camzoom);
+
+               params->offsetx= 2.0f*rv3d->camdx*params->zoom;
+               params->offsety= 2.0f*rv3d->camdy*params->zoom;
+
+               params->shiftx *= params->zoom;
+               params->shifty *= params->zoom;
+
+               params->zoom= 1.0f/params->zoom;
+       }
+       else if(rv3d->persp==RV3D_ORTHO) {
+               /* orthographic view */
+               params->clipend *= 0.5f;        // otherwise too extreme low zbuffer quality
+               params->clipsta= - params->clipend;
+
+               params->is_ortho= TRUE;
+               params->ortho_scale = rv3d->dist;
+               params->zoom= 2.0f;
        }
        else {
-               if((*sensor_fit)==CAMERA_SENSOR_FIT_AUTO) {
-                       if(rd->xasp*winx >= rd->yasp*winy)      viewfac= ((*lens) * winx) / (*sensor_x);
-                       else                                    viewfac= (*ycor) * ((*lens) * winy) / (*sensor_x);
-               }
-               else if((*sensor_fit)==CAMERA_SENSOR_FIT_HOR) {
-                       viewfac= ((*lens) * winx) / (*sensor_x);
-               }
-               else { /* if((*sensor_fit)==CAMERA_SENSOR_FIT_VERT) { */
-                       viewfac= ((*lens) * winy) / (*sensor_y);
-               }
-
-               pixsize= (*clipsta) / viewfac;
+               /* perspective view */
+               params->zoom= 2.0f;
        }
+}
 
-       /* viewplane fully centered, zbuffer fills in jittered between -.5 and +.5 */
-       winside= MAX2(winx, winy);
-
-       if(cam) {
-               if(cam->sensor_fit==CAMERA_SENSOR_FIT_HOR)
-                       winside= winx;
-               else if(cam->sensor_fit==CAMERA_SENSOR_FIT_VERT)
-                       winside= winy;
+void camera_params_compute_viewplane(CameraParams *params, int winx, int winy, float xasp, float yasp)
+{
+       rctf viewplane;
+       float pixsize, viewfac, sensor_size, dx, dy;
+       int sensor_fit;
+
+       /* fields rendering */
+       params->ycor= yasp/xasp;
+       if(params->use_fields)
+               params->ycor *= 2.0f;
+
+       if(params->is_ortho) {
+               /* orthographic camera */
+               /* scale == 1.0 means exact 1 to 1 mapping */
+               pixsize= params->ortho_scale;
+       }
+       else {
+               /* perspective camera */
+               sensor_size= camera_sensor_size(params->sensor_fit, params->sensor_x, params->sensor_y);
+               pixsize= (sensor_size * params->clipsta)/params->lens;
        }
 
-       viewplane->xmin= -0.5f*(float)winx + shiftx*winside;
-       viewplane->ymin= -0.5f*(*ycor)*(float)winy + shifty*winside;
-       viewplane->xmax=  0.5f*(float)winx + shiftx*winside;
-       viewplane->ymax=  0.5f*(*ycor)*(float)winy + shifty*winside;
+       /* determine sensor fit */
+       sensor_fit = camera_sensor_fit(params->sensor_fit, xasp*winx, yasp*winy);
 
-       if(field_second) {
-               if(rd->mode & R_ODDFIELD) {
-                       viewplane->ymin-= 0.5f * (*ycor);
-                       viewplane->ymax-= 0.5f * (*ycor);
+       if(sensor_fit==CAMERA_SENSOR_FIT_HOR)
+               viewfac= winx;
+       else
+               viewfac= params->ycor * winy;
+
+       pixsize /= viewfac;
+
+       /* extra zoom factor */
+       pixsize *= params->zoom;
+
+       /* compute view plane:
+        * fully centered, zbuffer fills in jittered between -.5 and +.5 */
+       viewplane.xmin= -0.5f*(float)winx;
+       viewplane.ymin= -0.5f*params->ycor*(float)winy;
+       viewplane.xmax=  0.5f*(float)winx;
+       viewplane.ymax=  0.5f*params->ycor*(float)winy;
+
+       /* lens shift and offset */
+       dx= params->shiftx*viewfac + winx*params->offsetx;
+       dy= params->shifty*viewfac + winy*params->offsety;
+
+       viewplane.xmin += dx;
+       viewplane.ymin += dy;
+       viewplane.xmax += dx;
+       viewplane.ymax += dy;
+
+       /* fields offset */
+       if(params->field_second) {
+               if(params->field_odd) {
+                       viewplane.ymin-= 0.5f * params->ycor;
+                       viewplane.ymax-= 0.5f * params->ycor;
                }
                else {
-                       viewplane->ymin+= 0.5f * (*ycor);
-                       viewplane->ymax+= 0.5f * (*ycor);
+                       viewplane.ymin+= 0.5f * params->ycor;
+                       viewplane.ymax+= 0.5f * params->ycor;
                }
        }
+
        /* the window matrix is used for clipping, and not changed during OSA steps */
        /* using an offset of +0.5 here would give clip errors on edges */
-       viewplane->xmin *= pixsize;
-       viewplane->xmax *= pixsize;
-       viewplane->ymin *= pixsize;
-       viewplane->ymax *= pixsize;
+       viewplane.xmin *= pixsize;
+       viewplane.xmax *= pixsize;
+       viewplane.ymin *= pixsize;
+       viewplane.ymax *= pixsize;
+
+       params->viewdx= pixsize;
+       params->viewdy= params->ycor * pixsize;
+       params->viewplane= viewplane;
+}
 
-       (*viewdx)= pixsize;
-       (*viewdy)= (*ycor) * pixsize;
+/* viewplane is assumed to be already computed */
+void camera_params_compute_matrix(CameraParams *params)
+{
+       rctf viewplane= params->viewplane;
 
-       if(is_ortho)
-               orthographic_m4(winmat, viewplane->xmin, viewplane->xmax, viewplane->ymin, viewplane->ymax, *clipsta, *clipend);
+       /* compute projection matrix */
+       if(params->is_ortho)
+               orthographic_m4(params->winmat, viewplane.xmin, viewplane.xmax,
+                       viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend);
        else
-               perspective_m4(winmat, viewplane->xmin, viewplane->xmax, viewplane->ymin, viewplane->ymax, *clipsta, *clipend);
-
+               perspective_m4(params->winmat, viewplane.xmin, viewplane.xmax,
+                       viewplane.ymin, viewplane.ymax, params->clipsta, params->clipend);
 }
 
+/***************************** Camera View Frame *****************************/
+
 void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const short do_clip, const float scale[3],
                           float r_asp[2], float r_shift[2], float *r_drawsize, float r_vec[4][3])
 {
@@ -320,25 +376,16 @@ void camera_view_frame_ex(Scene *scene, Camera *camera, float drawsize, const sh
        if (scene) {
                float aspx= (float) scene->r.xsch*scene->r.xasp;
                float aspy= (float) scene->r.ysch*scene->r.yasp;
+               int sensor_fit= camera_sensor_fit(camera->sensor_fit, aspx, aspy);
 
-               if(camera->sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
-                       if(aspx < aspy) {
-                               r_asp[0]= aspx / aspy;
-                               r_asp[1]= 1.0;
-                       }
-                       else {
-                               r_asp[0]= 1.0;
-                               r_asp[1]= aspy / aspx;
-                       }
+               if(sensor_fit==CAMERA_SENSOR_FIT_HOR) {
+                       r_asp[0]= 1.0;
+                       r_asp[1]= aspy / aspx;
                }
-               else if(camera->sensor_fit==CAMERA_SENSOR_FIT_AUTO) {
+               else {
                        r_asp[0]= aspx / aspy;
                        r_asp[1]= 1.0;
                }
-               else {
-                       r_asp[0]= 1.0;
-                       r_asp[1]= aspy / aspx;
-               }
        }
        else {
                r_asp[0]= 1.0f;
@@ -409,7 +456,7 @@ static void camera_to_frame_view_cb(const float co[3], void *user_data)
        unsigned int i;
 
        for (i= 0; i < 4; i++) {
-               float nd= -dist_to_plane_v3(co, data->frame_tx[i], data->normal_tx[i]);
+               float nd= dist_to_plane_v3(co, data->frame_tx[i], data->normal_tx[i]);
                if (nd < data->dist_vals[i]) {
                        data->dist_vals[i]= nd;
                }
@@ -419,6 +466,7 @@ static void camera_to_frame_view_cb(const float co[3], void *user_data)
 }
 
 /* dont move the camera, just yield the fit location */
+/* only valid for perspective cameras */
 int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *camera_ob, float r_co[3])
 {
        float shift[2];
@@ -482,55 +530,49 @@ int camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object *cam
                        mul_v3_v3fl(plane_tx[i], data_cb.normal_tx[i], data_cb.dist_vals[i]);
                }
 
-               if ( (isect_plane_plane_v3(plane_isect_1, plane_isect_1_no,
-                                          plane_tx[0], data_cb.normal_tx[0],
-                                          plane_tx[2], data_cb.normal_tx[2]) == 0) ||
-                    (isect_plane_plane_v3(plane_isect_2, plane_isect_2_no,
-                                          plane_tx[1], data_cb.normal_tx[1],
-                                          plane_tx[3], data_cb.normal_tx[3]) == 0))
+               isect_plane_plane_v3(plane_isect_1, plane_isect_1_no,
+                                    plane_tx[0], data_cb.normal_tx[0],
+                                    plane_tx[2], data_cb.normal_tx[2]);
+               isect_plane_plane_v3(plane_isect_2, plane_isect_2_no,
+                                    plane_tx[1], data_cb.normal_tx[1],
+                                    plane_tx[3], data_cb.normal_tx[3]);
+
+               add_v3_v3v3(plane_isect_1_other, plane_isect_1, plane_isect_1_no);
+               add_v3_v3v3(plane_isect_2_other, plane_isect_2, plane_isect_2_no);
+
+               if (isect_line_line_v3(plane_isect_1, plane_isect_1_other,
+                                      plane_isect_2, plane_isect_2_other,
+                                      plane_isect_pt_1, plane_isect_pt_2) == 0)
                {
-                       /* this is very unlikely */
                        return FALSE;
                }
                else {
+                       float cam_plane_no[3]= {0.0f, 0.0f, -1.0f};
+                       float plane_isect_delta[3];
+                       float plane_isect_delta_len;
 
-                       add_v3_v3v3(plane_isect_1_other, plane_isect_1, plane_isect_1_no);
-                       add_v3_v3v3(plane_isect_2_other, plane_isect_2, plane_isect_2_no);
+                       mul_m3_v3(rot_obmat, cam_plane_no);
 
-                       if (isect_line_line_v3(plane_isect_1, plane_isect_1_other,
-                                              plane_isect_2, plane_isect_2_other,
-                                              plane_isect_pt_1, plane_isect_pt_2) == 0)
-                       {
-                               return FALSE;
-                       }
-                       else {
-                               float cam_plane_no[3]= {0.0f, 0.0f, -1.0f};
-                               float plane_isect_delta[3];
-                               float plane_isect_delta_len;
-
-                               mul_m3_v3(rot_obmat, cam_plane_no);
+                       sub_v3_v3v3(plane_isect_delta, plane_isect_pt_2, plane_isect_pt_1);
+                       plane_isect_delta_len= len_v3(plane_isect_delta);
 
-                               sub_v3_v3v3(plane_isect_delta, plane_isect_pt_2, plane_isect_pt_1);
-                               plane_isect_delta_len= len_v3(plane_isect_delta);
+                       if (dot_v3v3(plane_isect_delta, cam_plane_no) > 0.0f) {
+                               copy_v3_v3(r_co, plane_isect_pt_1);
 
-                               if (dot_v3v3(plane_isect_delta, cam_plane_no) > 0.0f) {
-                                       copy_v3_v3(r_co, plane_isect_pt_1);
-
-                                       /* offset shift */
-                                       normalize_v3(plane_isect_1_no);
-                                       madd_v3_v3fl(r_co, plane_isect_1_no, shift[1] * -plane_isect_delta_len);
-                               }
-                               else {
-                                       copy_v3_v3(r_co, plane_isect_pt_2);
+                               /* offset shift */
+                               normalize_v3(plane_isect_1_no);
+                               madd_v3_v3fl(r_co, plane_isect_1_no, shift[1] * -plane_isect_delta_len);
+                       }
+                       else {
+                               copy_v3_v3(r_co, plane_isect_pt_2);
 
-                                       /* offset shift */
-                                       normalize_v3(plane_isect_2_no);
-                                       madd_v3_v3fl(r_co, plane_isect_2_no, shift[0] * -plane_isect_delta_len);
-                               }
+                               /* offset shift */
+                               normalize_v3(plane_isect_2_no);
+                               madd_v3_v3fl(r_co, plane_isect_2_no, shift[0] * -plane_isect_delta_len);
+                       }
 
 
-                               return TRUE;
-                       }
+                       return TRUE;
                }
        }
 }
index abcd690..6f29594 100644 (file)
@@ -3988,7 +3988,7 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
                        MovieTrackingMarker *marker;
                        float vec[3], disp[3], axis[3], mat[4][4];
                        float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp);
-                       float sensor_x, sensor_y, lens, len, d, ortho_scale= 1.0f;
+                       float len, d;
                        
                        where_is_object_mat(scene, camob, mat);
                        
@@ -4006,23 +4006,20 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
                        len= len_v3(disp);
                        
                        if (len > FLT_EPSILON) {
-                               float pos[2], rmat[4][4], shiftx= 0.0f, shifty= 0.0f, clipsta= 0.0f, clipend= 0.0f;
-                               short is_ortho= 0, sensor_fit= CAMERA_SENSOR_FIT_AUTO;
-                               Camera *cam= NULL;
+                               CameraParams params;
+                               float pos[2], rmat[4][4];
                                
                                user.framenr= scene->r.cfra;
                                marker= BKE_tracking_get_marker(track, user.framenr);
                                
                                add_v2_v2v2(pos, marker->pos, track->offset);
                                
-                               object_camera_intrinsics(camob, &cam, &is_ortho, &shiftx, &shifty, &clipsta, &clipend, &lens, &sensor_x, &sensor_y, &sensor_fit);
-                               
-                               if (is_ortho) {
-                                       if (cam)
-                                               ortho_scale= cam->ortho_scale;
-                                       
-                                       vec[0]= ortho_scale * (pos[0]-0.5f+shiftx);
-                                       vec[1]= ortho_scale * (pos[1]-0.5f+shifty);
+                               camera_params_init(&params);
+                               camera_params_from_object(&params, camob);
+
+                               if (params.is_ortho) {
+                                       vec[0]= params.ortho_scale * (pos[0]-0.5f+params.shiftx);
+                                       vec[1]= params.ortho_scale * (pos[1]-0.5f+params.shifty);
                                        vec[2]= -len;
                                        
                                        if (aspect > 1.0f) vec[1] /= aspect;
@@ -4037,10 +4034,10 @@ static void followtrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase
                                        copy_v3_v3(cob->matrix[3], disp);
                                }
                                else {
-                                       d= (len*sensor_x) / (2.0f*lens);
+                                       d= (len*params.sensor_x) / (2.0f*params.lens);
                                        
-                                       vec[0]= d*(2.0f*(pos[0]+shiftx)-1.0f);
-                                       vec[1]= d*(2.0f*(pos[1]+shifty)-1.0f);
+                                       vec[0]= d*(2.0f*(pos[0]+params.shiftx)-1.0f);
+                                       vec[1]= d*(2.0f*(pos[1]+params.shifty)-1.0f);
                                        vec[2]= -len;
                                        
                                        if (aspect > 1.0f) vec[1] /= aspect;
index 7634d69..4f3e373 100644 (file)
@@ -976,8 +976,8 @@ struct DynamicPaintSurface *dynamicPaint_createNewSurface(DynamicPaintCanvasSett
        surface->wave_timescale = 1.0f;
        surface->wave_spring = 0.20f;
 
-       BLI_snprintf(surface->image_output_path, sizeof(surface->image_output_path), "%sdynamicpaint", U.textudir);
-       BLI_cleanup_dir(NULL, surface->image_output_path);
+       modifier_path_init(surface->image_output_path, sizeof(surface->image_output_path), "cache_dynamicpaint");
+
        dynamicPaintSurface_setUniqueName(surface, "Surface");
 
        surface->effector_weights = BKE_add_effector_weights(NULL);
@@ -1475,11 +1475,12 @@ int dynamicPaint_resetSurface(DynamicPaintSurface *surface)
 }
 
 /* make sure allocated surface size matches current requirements */
-static void dynamicPaint_checkSurfaceData(DynamicPaintSurface *surface)
+static int dynamicPaint_checkSurfaceData(DynamicPaintSurface *surface)
 {
        if (!surface->data || ((dynamicPaint_surfaceNumOfPoints(surface) != surface->data->total_points))) {
-               dynamicPaint_resetSurface(surface);
+               return dynamicPaint_resetSurface(surface);
        }
+       return 1;
 }
 
 
@@ -1614,6 +1615,10 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
 
                                                /* paint layer */
                                                col = CustomData_get_layer_named(&result->faceData, CD_MCOL, surface->output_name);
+                                               /* if output layer is lost from a constructive modifier, re-add it */
+                                               if (!col && dynamicPaint_outputLayerExists(surface, ob, 0))
+                                                       col = CustomData_add_layer_named(&result->faceData, CD_MCOL, CD_CALLOC, NULL, numOfFaces, surface->output_name);
+                                               /* apply color */
                                                if (col) {
                                                        #pragma omp parallel for schedule(static)
                                                        for (i=0; i<numOfFaces; i++) {
@@ -1634,6 +1639,10 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
 
                                                /* wet layer */
                                                col = CustomData_get_layer_named(&result->faceData, CD_MCOL, surface->output_name2);
+                                               /* if output layer is lost from a constructive modifier, re-add it */
+                                               if (!col && dynamicPaint_outputLayerExists(surface, ob, 1))
+                                                       col = CustomData_add_layer_named(&result->faceData, CD_MCOL, CD_CALLOC, NULL, numOfFaces, surface->output_name2);
+                                               /* apply color */
                                                if (col) {
                                                        #pragma omp parallel for schedule(static)
                                                        for (i=0; i<numOfFaces; i++) {
@@ -1792,7 +1801,7 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene
                        if (!(surface->flags & MOD_DPAINT_ACTIVE)) continue;
 
                        /* make sure surface is valid */
-                       dynamicPaint_checkSurfaceData(surface);
+                       if (!dynamicPaint_checkSurfaceData(surface)) continue;
 
                        /* limit frame range */
                        CLAMP(current_frame, surface->start_frame, surface->end_frame);
@@ -2518,13 +2527,13 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char* filenam
        PaintSurfaceData *sData = surface->data;
        ImgSeqFormatData *f_data = (ImgSeqFormatData*)sData->format_data;
        /* OpenEXR or PNG       */
-       int format = (surface->image_fileformat & MOD_DPAINT_IMGFORMAT_OPENEXR) ? R_OPENEXR : R_PNG;
+       int format = (surface->image_fileformat & MOD_DPAINT_IMGFORMAT_OPENEXR) ? R_IMF_IMTYPE_OPENEXR : R_IMF_IMTYPE_PNG;
        char output_file[FILE_MAX];
 
        if (!sData || !sData->type_data) {setError(surface->canvas, "Image save failed: Invalid surface.");return;}
        /* if selected format is openexr, but current build doesnt support one */
        #ifndef WITH_OPENEXR
-       if (format == R_OPENEXR) format = R_PNG;
+       if (format == R_IMF_IMTYPE_OPENEXR) format = R_IMF_IMTYPE_PNG;
        #endif
        BLI_strncpy(output_file, filename, sizeof(output_file));
        BKE_add_image_extension(output_file, format);
@@ -2613,7 +2622,7 @@ void dynamicPaint_outputSurfaceImage(DynamicPaintSurface *surface, char* filenam
        /* Set output format, png in case exr isnt supported */
        ibuf->ftype= PNG|95;
 #ifdef WITH_OPENEXR
-       if (format == R_OPENEXR) {      /* OpenEXR 32-bit float */
+       if (format == R_IMF_IMTYPE_OPENEXR) {   /* OpenEXR 32-bit float */
                ibuf->ftype = OPENEXR | OPENEXR_COMPRESS;
        }
 #endif
@@ -3396,7 +3405,8 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
                                                        velocity_val = len_v3(velocity);
 
                                                        /* if brush has smudge enabled store brush velocity */
-                                                       if (brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) {
+                                                       if (surface->type == MOD_DPAINT_SURFACE_T_PAINT &&
+                                                               brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) {
                                                                copy_v3_v3(&bData->brush_velocity[index*4], velocity);
                                                                mul_v3_fl(&bData->brush_velocity[index*4], 1.0f/velocity_val);
                                                                bData->brush_velocity[index*4+3] = velocity_val;
@@ -3690,7 +3700,8 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface,
                                                velocity_val = len_v3(velocity);
 
                                                /* store brush velocity for smudge */
-                                               if (brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) {
+                                               if (surface->type == MOD_DPAINT_SURFACE_T_PAINT &&
+                                                       brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) {
                                                        copy_v3_v3(&bData->brush_velocity[index*4], velocity);
                                                        mul_v3_fl(&bData->brush_velocity[index*4], 1.0f/velocity_val);
                                                        bData->brush_velocity[index*4+3] = velocity_val;
@@ -3788,7 +3799,8 @@ static int dynamicPaint_paintSinglePoint(DynamicPaintSurface *surface, float *po
                                velocity_val = len_v3(velocity);
 
                                /* store brush velocity for smudge */
-                               if (brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) {
+                               if (surface->type == MOD_DPAINT_SURFACE_T_PAINT && 
+                                       brush->flags & MOD_DPAINT_DO_SMUDGE && bData->brush_velocity) {
                                        copy_v3_v3(&bData->brush_velocity[index*4], velocity);
                                        mul_v3_fl(&bData->brush_velocity[index*4], 1.0f/velocity_val);
                                        bData->brush_velocity[index*4+3] = velocity_val;
@@ -4802,7 +4814,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
                                        BrushMaterials bMats = {0};
 
                                        /* calculate brush speed vectors if required */
-                                       if (brush->flags & MOD_DPAINT_DO_SMUDGE) {
+                                       if (surface->type == MOD_DPAINT_SURFACE_T_PAINT && brush->flags & MOD_DPAINT_DO_SMUDGE) {
                                                bData->brush_velocity = MEM_callocN(sData->total_points*sizeof(float)*4, "Dynamic Paint brush velocity");
                                                /* init adjacency data if not already */
                                                if (!sData->adj_data)
@@ -4852,7 +4864,7 @@ static int dynamicPaint_doStep(Scene *scene, Object *ob, DynamicPaintSurface *su
 
                                        /* process special brush effects, like smudge */
                                        if (bData->brush_velocity) {
-                                               if (brush->flags & MOD_DPAINT_DO_SMUDGE)
+                                               if (surface->type == MOD_DPAINT_SURFACE_T_PAINT && brush->flags & MOD_DPAINT_DO_SMUDGE)
                                                        dynamicPaint_doSmudge(surface, brush, timescale);
                                                MEM_freeN(bData->brush_velocity);
                                                bData->brush_velocity = NULL;
index 5ab997d..d01e3de 100644 (file)
@@ -1576,7 +1576,7 @@ float driver_get_variable_value (ChannelDriver *driver, DriverVar *dvar)
  *     - "evaltime" is the frame at which F-Curve is being evaluated
  *     - has to return a float value 
  */
-static float evaluate_driver (ChannelDriver *driver, float UNUSED(evaltime))
+static float evaluate_driver (ChannelDriver *driver, const float evaltime)
 {
        DriverVar *dvar;
        
@@ -1663,8 +1663,10 @@ static float evaluate_driver (ChannelDriver *driver, float UNUSED(evaltime))
                                /* this evaluates the expression using Python,and returns its result:
                                 *      - on errors it reports, then returns 0.0f
                                 */
-                               driver->curval= BPY_driver_exec(driver);
+                               driver->curval= BPY_driver_exec(driver, evaltime);
                        }
+#else /* WITH_PYTHON*/
+               (void)evaltime;
 #endif /* WITH_PYTHON*/
                }
                        break;
@@ -1705,8 +1707,8 @@ void correct_bezpart (float *v1, float *v2, float *v3, float *v4)
         *      - len2  = length of handle of end key
         */
        len= v4[0]- v1[0];
-       len1= (float)fabs(h1[0]);
-       len2= (float)fabs(h2[0]);
+       len1= fabsf(h1[0]);
+       len2= fabsf(h2[0]);
        
        /* if the handles have no length, no need to do any corrections */
        if ((len1+len2) == 0.0f) 
@@ -2087,7 +2089,7 @@ static float fcurve_eval_samples (FCurve *fcu, FPoint *fpts, float evaltime)
 /* Evaluate and return the value of the given F-Curve at the specified frame ("evaltime") 
  * Note: this is also used for drivers
  */
-float evaluate_fcurve (FCurve *fcu, float evaltime) 
+float evaluate_fcurve (FCurve *fcu, float evaltime)
 {
        float cvalue= 0.0f;
        float devaltime;
index 0844084..ef764f2 100644 (file)
@@ -556,13 +556,13 @@ Image *BKE_add_image_size(unsigned int width, unsigned int height, const char *n
        if (ima) {
                ImBuf *ibuf;
                
-               BLI_strncpy(ima->name, name, FILE_MAX);
+               /* BLI_strncpy(ima->name, name, FILE_MAX); */ /* dont do this, this writes in ain invalid filepath! */
                ima->gen_x= width;
                ima->gen_y= height;
                ima->gen_type= uvtestgrid;
                ima->gen_flag |= (floatbuf ? IMA_GEN_FLOAT : 0);
                
-               ibuf= add_ibuf_size(width, height, name, depth, floatbuf, uvtestgrid, color);
+               ibuf= add_ibuf_size(width, height, ima->name, depth, floatbuf, uvtestgrid, color);
                image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
                
                ima->ok= IMA_OK_LOADED;
@@ -601,7 +601,7 @@ void BKE_image_memorypack(Image *ima)
        }
        
        ibuf->ftype= PNG;
-       ibuf->depth= 32;
+       ibuf->planes= R_IMF_PLANES_RGBA;
        
        IMB_saveiff(ibuf, ibuf->name, IB_rect | IB_mem);
        if(ibuf->encodedbuffer==NULL) {
@@ -800,175 +800,246 @@ void BKE_image_all_free_anim_ibufs(int cfra)
 
 /* *********** READ AND WRITE ************** */
 
-int BKE_imtype_to_ftype(int imtype)
+int BKE_imtype_to_ftype(const char imtype)
 {
-       if(imtype==R_TARGA)
+       if(imtype==R_IMF_IMTYPE_TARGA)
                return TGA;
-       else if(imtype==R_RAWTGA)
+       else if(imtype==R_IMF_IMTYPE_RAWTGA)
                return RAWTGA;
-       else if(imtype== R_IRIS) 
+       else if(imtype== R_IMF_IMTYPE_IRIS) 
                return IMAGIC;
 #ifdef WITH_HDR
-       else if (imtype==R_RADHDR)
+       else if (imtype==R_IMF_IMTYPE_RADHDR)
                return RADHDR;
 #endif
-       else if (imtype==R_PNG)
+       else if (imtype==R_IMF_IMTYPE_PNG)
                return PNG;
 #ifdef WITH_DDS
-       else if (imtype==R_DDS)
+       else if (imtype==R_IMF_IMTYPE_DDS)
                return DDS;
 #endif
-       else if (imtype==R_BMP)
+       else if (imtype==R_IMF_IMTYPE_BMP)
                return BMP;
 #ifdef WITH_TIFF
-       else if (imtype==R_TIFF)
+       else if (imtype==R_IMF_IMTYPE_TIFF)
                return TIF;
 #endif
-       else if (imtype==R_OPENEXR || imtype==R_MULTILAYER)
+       else if (imtype==R_IMF_IMTYPE_OPENEXR || imtype==R_IMF_IMTYPE_MULTILAYER)
                return OPENEXR;
 #ifdef WITH_CINEON
-       else if (imtype==R_CINEON)
+       else if (imtype==R_IMF_IMTYPE_CINEON)
                return CINEON;
-       else if (imtype==R_DPX)
+       else if (imtype==R_IMF_IMTYPE_DPX)
                return DPX;
 #endif
 #ifdef WITH_OPENJPEG
-       else if(imtype==R_JP2)
+       else if(imtype==R_IMF_IMTYPE_JP2)
                return JP2;
 #endif
        else
                return JPG|90;
 }
 
-int BKE_ftype_to_imtype(int ftype)
+char BKE_ftype_to_imtype(const int ftype)
 {
        if(ftype==0)
-               return TGA;
+               return R_IMF_IMTYPE_TARGA;
        else if(ftype == IMAGIC) 
-               return R_IRIS;
+               return R_IMF_IMTYPE_IRIS;
 #ifdef WITH_HDR
        else if (ftype & RADHDR)
-               return R_RADHDR;
+               return R_IMF_IMTYPE_RADHDR;
 #endif
        else if (ftype & PNG)
-               return R_PNG;
+               return R_IMF_IMTYPE_PNG;
 #ifdef WITH_DDS
        else if (ftype & DDS)
-               return R_DDS;
+               return R_IMF_IMTYPE_DDS;
 #endif
        else if (ftype & BMP)
-               return R_BMP;
+               return R_IMF_IMTYPE_BMP;
 #ifdef WITH_TIFF
        else if (ftype & TIF)
-               return R_TIFF;
+               return R_IMF_IMTYPE_TIFF;
 #endif
        else if (ftype & OPENEXR)
-               return R_OPENEXR;
+               return R_IMF_IMTYPE_OPENEXR;
 #ifdef WITH_CINEON
        else if (ftype & CINEON)
-               return R_CINEON;
+               return R_IMF_IMTYPE_CINEON;
        else if (ftype & DPX)
-               return R_DPX;
+               return R_IMF_IMTYPE_DPX;
 #endif
        else if (ftype & TGA)
-               return R_TARGA;
+               return R_IMF_IMTYPE_TARGA;
        else if(ftype & RAWTGA)
-               return R_RAWTGA;
+               return R_IMF_IMTYPE_RAWTGA;
 #ifdef WITH_OPENJPEG
        else if(ftype & JP2)
-               return R_JP2;
+               return R_IMF_IMTYPE_JP2;
 #endif
        else
-               return R_JPEG90;
+               return R_IMF_IMTYPE_JPEG90;
 }
 
 
-int BKE_imtype_is_movie(int imtype)
+int BKE_imtype_is_movie(const char imtype)
+{
+       switch(imtype) {
+       case R_IMF_IMTYPE_AVIRAW:
+       case R_IMF_IMTYPE_AVIJPEG:
+       case R_IMF_IMTYPE_AVICODEC:
+       case R_IMF_IMTYPE_QUICKTIME:
+       case R_IMF_IMTYPE_FFMPEG:
+       case R_IMF_IMTYPE_H264:
+       case R_IMF_IMTYPE_THEORA:
+       case R_IMF_IMTYPE_XVID:
+       case R_IMF_IMTYPE_FRAMESERVER:
+                       return 1;
+       }
+       return 0;
+}
+
+int BKE_imtype_supports_alpha(const char imtype)
 {
        switch(imtype) {
-       case R_AVIRAW:
-       case R_AVIJPEG:
-       case R_AVICODEC:
-       case R_QUICKTIME:
-       case R_FFMPEG:
-       case R_H264:
-       case R_THEORA:
-       case R_XVID:
-       case R_FRAMESERVER:
+       case R_IMF_IMTYPE_TARGA:
+       case R_IMF_IMTYPE_IRIS:
+       case R_IMF_IMTYPE_PNG:
+       /* case R_IMF_IMTYPE_BMP: */ /* read but not write */
+       case R_IMF_IMTYPE_RADHDR:
+       case R_IMF_IMTYPE_TIFF:
+       case R_IMF_IMTYPE_OPENEXR:
+       case R_IMF_IMTYPE_MULTILAYER:
+       case R_IMF_IMTYPE_DDS:
+       case R_IMF_IMTYPE_JP2:
                        return 1;
        }
        return 0;
 }
 
-int BKE_add_image_extension(char *string, int imtype)
+int BKE_imtype_supports_zbuf(const char imtype)
+{
+       switch(imtype) {
+       case R_IMF_IMTYPE_IRIZ:
+       case R_IMF_IMTYPE_OPENEXR: /* but not R_IMF_IMTYPE_MULTILAYER */
+                       return 1;
+       }
+       return 0;
+}
+
+int BKE_imtype_supports_compress(const char imtype)
+{
+       switch(imtype) {
+       case R_IMF_IMTYPE_PNG:
+                       return 1;
+       }
+       return 0;
+}
+
+int BKE_imtype_supports_quality(const char imtype)
+{
+       switch(imtype) {
+       case R_IMF_IMTYPE_JPEG90:
+       case R_IMF_IMTYPE_JP2:
+       case R_IMF_IMTYPE_AVIJPEG:
+                       return 1;
+       }
+       return 0;
+}
+
+char BKE_imtype_valid_depths(const char imtype)
+{
+       switch (imtype) {
+       case R_IMF_IMTYPE_RADHDR:
+               return R_IMF_CHAN_DEPTH_32;
+       case R_IMF_IMTYPE_TIFF:
+               return R_IMF_CHAN_DEPTH_8 | R_IMF_CHAN_DEPTH_16;
+       case R_IMF_IMTYPE_OPENEXR:
+               return R_IMF_CHAN_DEPTH_16 | R_IMF_CHAN_DEPTH_32;
+       case R_IMF_IMTYPE_MULTILAYER:
+               return R_IMF_CHAN_DEPTH_32;
+       /* eeh, cineone does some strange 10bits per channel */
+       case R_IMF_IMTYPE_DPX:
+       case R_IMF_IMTYPE_CINEON:
+               return R_IMF_CHAN_DEPTH_12;
+       case R_IMF_IMTYPE_JP2:
+               return R_IMF_CHAN_DEPTH_8 | R_IMF_CHAN_DEPTH_12 | R_IMF_CHAN_DEPTH_16;
+       /* most formats are 8bit only */
+       default:
+               return R_IMF_CHAN_DEPTH_8;
+       }
+}
+
+int BKE_add_image_extension(char *string, const char imtype)
 {
        const char *extension= NULL;
        
-       if(imtype== R_IRIS) {
+       if(imtype== R_IMF_IMTYPE_IRIS) {
                if(!BLI_testextensie(string, ".rgb"))
                        extension= ".rgb";
        }
-       else if(imtype==R_IRIZ) {
+       else if(imtype==R_IMF_IMTYPE_IRIZ) {
                if(!BLI_testextensie(string, ".rgb"))
                        extension= ".rgb";
        }
 #ifdef WITH_HDR
-       else if(imtype==R_RADHDR) {
+       else if(imtype==R_IMF_IMTYPE_RADHDR) {
                if(!BLI_testextensie(string, ".hdr"))
                        extension= ".hdr";
        }
 #endif
-       else if (ELEM5(imtype, R_PNG, R_FFMPEG, R_H264, R_THEORA, R_XVID)) {
+       else if (ELEM5(imtype, R_IMF_IMTYPE_PNG, R_IMF_IMTYPE_FFMPEG, R_IMF_IMTYPE_H264, R_IMF_IMTYPE_THEORA, R_IMF_IMTYPE_XVID)) {
                if(!BLI_testextensie(string, ".png"))
                        extension= ".png";
        }
 #ifdef WITH_DDS
-       else if(imtype==R_DDS) {
+       else if(imtype==R_IMF_IMTYPE_DDS) {
                if(!BLI_testextensie(string, ".dds"))
                        extension= ".dds";
        }
 #endif
-       else if(imtype==R_RAWTGA) {
+       else if(imtype==R_IMF_IMTYPE_RAWTGA) {
                if(!BLI_testextensie(string, ".tga"))
                        extension= ".tga";
        }
-       else if(imtype==R_BMP) {
+       else if(imtype==R_IMF_IMTYPE_BMP) {
                if(!BLI_testextensie(string, ".bmp"))
                        extension= ".bmp";
        }
 #ifdef WITH_TIFF
-       else if(imtype==R_TIFF) {
+       else if(imtype==R_IMF_IMTYPE_TIFF) {
                if(!BLI_testextensie(string, ".tif") && 
                        !BLI_testextensie(string, ".tiff")) extension= ".tif";
        }
 #endif
 #ifdef WITH_OPENEXR
-       else if( ELEM(imtype, R_OPENEXR, R_MULTILAYER)) {
+       else if( ELEM(imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER)) {
                if(!BLI_testextensie(string, ".exr"))
                        extension= ".exr";
        }
 #endif
 #ifdef WITH_CINEON
-       else if(imtype==R_CINEON){
+       else if(imtype==R_IMF_IMTYPE_CINEON){
                if (!BLI_testextensie(string, ".cin"))
                        extension= ".cin";
        }
-       else if(imtype==R_DPX){
+       else if(imtype==R_IMF_IMTYPE_DPX){
                if (!BLI_testextensie(string, ".dpx"))
                        extension= ".dpx";
        }
 #endif
-       else if(imtype==R_TARGA) {
+       else if(imtype==R_IMF_IMTYPE_TARGA) {
                if(!BLI_testextensie(string, ".tga"))
                        extension= ".tga";
        }
 #ifdef WITH_OPENJPEG
-       else if(imtype==R_JP2) {
+       else if(imtype==R_IMF_IMTYPE_JP2) {
                if(!BLI_testextensie(string, ".jp2"))
                        extension= ".jp2";
        }
 #endif
-       else { //   R_AVICODEC, R_AVIRAW, R_AVIJPEG, R_JPEG90, R_QUICKTIME etc
+       else { //   R_IMF_IMTYPE_AVICODEC, R_IMF_IMTYPE_AVIRAW, R_IMF_IMTYPE_AVIJPEG, R_IMF_IMTYPE_JPEG90, R_IMF_IMTYPE_QUICKTIME etc
                if(!( BLI_testextensie(string, ".jpg") || BLI_testextensie(string, ".jpeg")))
                        extension= ".jpg";
        }
@@ -1371,98 +1442,101 @@ int BKE_alphatest_ibuf(ImBuf *ibuf)
        return FALSE;
 }
 
-int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality)
+int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf)
 {
+       char imtype= imf->imtype;
+       char compress= imf->compress;
+       char quality= imf->quality;
+
        int ok;
-       (void)subimtype; /* quies unused warnings */
 
        if(imtype == -1) {
                /* use whatever existing image type is set by 'ibuf' */
        }
-       else if(imtype== R_IRIS) {
+       else if(imtype== R_IMF_IMTYPE_IRIS) {
                ibuf->ftype= IMAGIC;
        }
 #ifdef WITH_HDR
-       else if (imtype==R_RADHDR) {
+       else if (imtype==R_IMF_IMTYPE_RADHDR) {
                ibuf->ftype= RADHDR;
        }
 #endif
-       else if (ELEM5(imtype, R_PNG, R_FFMPEG, R_H264, R_THEORA, R_XVID)) {
+       else if (ELEM5(imtype, R_IMF_IMTYPE_PNG, R_IMF_IMTYPE_FFMPEG, R_IMF_IMTYPE_H264, R_IMF_IMTYPE_THEORA, R_IMF_IMTYPE_XVID)) {
                ibuf->ftype= PNG;
 
-               if(imtype==R_PNG)
-                       ibuf->ftype |= quality;  /* quality is actually compression 0-100 --> 0-9 */
+               if(imtype==R_IMF_IMTYPE_PNG)
+                       ibuf->ftype |= compress;
 
        }
 #ifdef WITH_DDS
-       else if (imtype==R_DDS) {
+       else if (imtype==R_IMF_IMTYPE_DDS) {
                ibuf->ftype= DDS;
        }
 #endif
-       else if (imtype==R_BMP) {
+       else if (imtype==R_IMF_IMTYPE_BMP) {
                ibuf->ftype= BMP;
        }
 #ifdef WITH_TIFF
-       else if (imtype==R_TIFF) {
+       else if (imtype==R_IMF_IMTYPE_TIFF) {
                ibuf->ftype= TIF;
 
-               if(subimtype & R_TIFF_16BIT)
+               if(imf->depth == R_IMF_CHAN_DEPTH_16)
                        ibuf->ftype |= TIF_16BIT;
        }
 #endif
 #ifdef WITH_OPENEXR
-       else if (imtype==R_OPENEXR || imtype==R_MULTILAYER) {
+       else if (imtype==R_IMF_IMTYPE_OPENEXR || imtype==R_IMF_IMTYPE_MULTILAYER) {
                ibuf->ftype= OPENEXR;
-               if(subimtype & R_OPENEXR_HALF)
+               if(imf->depth == R_IMF_CHAN_DEPTH_16)
                        ibuf->ftype |= OPENEXR_HALF;
                ibuf->ftype |= (quality & OPENEXR_COMPRESS);
                
-               if(!(subimtype & R_OPENEXR_ZBUF))
+               if(!(imf->flag & R_IMF_FLAG_ZBUF))
                        ibuf->zbuf_float = NULL;        /* signal for exr saving */
                
        }
 #endif
 #ifdef WITH_CINEON
-       else if (imtype==R_CINEON) {
+       else if (imtype==R_IMF_IMTYPE_CINEON) {
                ibuf->ftype = CINEON;
        }
-       else if (imtype==R_DPX) {
+       else if (imtype==R_IMF_IMTYPE_DPX) {
                ibuf->ftype = DPX;
        }
 #endif
-       else if (imtype==R_TARGA) {
+       else if (imtype==R_IMF_IMTYPE_TARGA) {
                ibuf->ftype= TGA;
        }
-       else if(imtype==R_RAWTGA) {
+       else if(imtype==R_IMF_IMTYPE_RAWTGA) {
                ibuf->ftype= RAWTGA;
        }
 #ifdef WITH_OPENJPEG
-       else if(imtype==R_JP2) {
+       else if(imtype==R_IMF_IMTYPE_JP2) {
                if(quality < 10) quality= 90;
                ibuf->ftype= JP2|quality;
                
-               if (subimtype & R_JPEG2K_16BIT) {
+               if (imf->depth == R_IMF_CHAN_DEPTH_16) {
                        ibuf->ftype |= JP2_16BIT;
-               } else if (subimtype & R_JPEG2K_12BIT) {
+               } else if (imf->depth == R_IMF_CHAN_DEPTH_12) {
                        ibuf->ftype |= JP2_12BIT;
                }
                
-               if (subimtype & R_JPEG2K_YCC) {
+               if (imf->jp2_flag & R_IMF_JP2_FLAG_YCC) {
                        ibuf->ftype |= JP2_YCC;
                }
-               
-               if (subimtype & R_JPEG2K_CINE_PRESET) {
+
+               if (imf->jp2_flag & R_IMF_JP2_FLAG_CINE_PRESET) {
                        ibuf->ftype |= JP2_CINE;
-                       if (subimtype & R_JPEG2K_CINE_48FPS)
+                       if (imf->jp2_flag & R_IMF_JP2_FLAG_CINE_48)
                                ibuf->ftype |= JP2_CINE_48FPS;
                }
        }
 #endif
        else {
-               /* R_JPEG90, etc. default we save jpegs */
+               /* R_IMF_IMTYPE_JPEG90, etc. default we save jpegs */
                if(quality < 10) quality= 90;
                ibuf->ftype= JPG|quality;
-               if(ibuf->depth==32) ibuf->depth= 24;    /* unsupported feature only confuses other s/w */
+               if(ibuf->planes==32) ibuf->planes= 24;  /* unsupported feature only confuses other s/w */
        }
        
        BLI_make_existing_file(name);
@@ -1475,20 +1549,20 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, int
        return(ok);
 }
 
-int BKE_write_ibuf_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality)
+int BKE_write_ibuf_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, const char *name, struct ImageFormatData *imf)
 {
        if(scene && scene->r.stamp & R_STAMP_ALL)
                BKE_stamp_info(scene, camera, ibuf);
 
-       return BKE_write_ibuf(ibuf, name, imtype, subimtype, quality);
+       return BKE_write_ibuf(ibuf, name, imf);
 }
 
 
-void BKE_makepicstring(char *string, const char *base, int frame, int imtype, const short use_ext, const short use_frames)
+void BKE_makepicstring(char *string, const char *base, const char *relbase, int frame, const char imtype, const short use_ext, const short use_frames)
 {
        if (string==NULL) return;
        BLI_strncpy(string, base, FILE_MAX - 10);       /* weak assumption */
-       BLI_path_abs(string, G.main->name);
+       BLI_path_abs(string, relbase);
 
        if(use_frames)
                BLI_path_frame(string, frame, 4);
@@ -2414,13 +2488,13 @@ int BKE_image_has_alpha(struct Image *image)
 {
        ImBuf *ibuf;
        void *lock;
-       int depth;
+       int planes;
        
        ibuf= BKE_image_acquire_ibuf(image, NULL, &lock);
-       depth = (ibuf?ibuf->depth:0);
+       planes = (ibuf?ibuf->planes:0);
        BKE_image_release_ibuf(image, lock);
 
-       if (depth == 32)
+       if (planes == 32)
                return 1;
        else
                return 0;
index d8628e5..3e3f16d 100644 (file)
@@ -1781,11 +1781,11 @@ float init_meta(Scene *scene, Object *ob)       /* return totsize */
 
                calc_mballco(mainb[a], vec);
        
-               size= (float)fabs( vec[0] );
+               size= fabsf( vec[0] );
                if( size > totsize ) totsize= size;
-               size= (float)fabs( vec[1] );
+               size= fabsf( vec[1] );
                if( size > totsize ) totsize= size;
-               size= (float)fabs( vec[2] );
+               size= fabsf( vec[2] );
                if( size > totsize ) totsize= size;
 
                vec[0]= mainb[a]->x - mainb[a]->rad;
@@ -1794,11 +1794,11 @@ float init_meta(Scene *scene, Object *ob)       /* return totsize */
                                
                calc_mballco(mainb[a], vec);
        
-               size= (float)fabs( vec[0] );
+               size= fabsf( vec[0] );
                if( size > totsize ) totsize= size;
-               size= (float)fabs( vec[1] );
+               size= fabsf( vec[1] );
                if( size > totsize ) totsize= size;
-               size= (float)fabs( vec[2] );
+               size= fabsf( vec[2] );
                if( size > totsize ) totsize= size;
        }
 
index bbc1b59..f09be8c 100644 (file)
 #include "BKE_key.h"
 #include "BKE_multires.h"
 
+/* may move these, only for modifier_path_relbase */
+#include "BKE_global.h" /* ugh, G.main->name only */
+#include "BKE_main.h"
+/* end */
+
 #include "MOD_modifiertypes.h"
 
 ModifierTypeInfo *modifierType_getInfo(ModifierType type)
@@ -573,3 +578,36 @@ void test_object_modifiers(Object *ob)
                }
        }
 }
+
+/* where should this go?, it doesnt fit well anywhere :S - campbell */
+
+/* elubie: changed this to default to the same dir as the render output
+ * to prevent saving to C:\ on Windows */
+
+/* campbell: logic behind this...
+ *
+ * - if the ID is from a library, return library path
+ * - else if the file has been saved return the blend file path.
+ * - else if the file isn't saved and the ID isnt from a library, return the temp dir.
+ */
+const char *modifier_path_relbase(Object *ob)
+{
+       if (G.relbase_valid || ob->id.lib) {
+               return ID_BLEND_PATH(G.main, &ob->id);
+       }
+       else {
+               /* last resort, better then using "" which resolves to the current
+                * working directory */
+               return BLI_temporary_dir();
+       }
+}
+
+/* initializes the path with either */
+void modifier_path_init(char *path, int path_maxlen, const char *name)
+{
+       /* elubie: changed this to default to the same dir as the render output
+        * to prevent saving to C:\ on Windows */
+       BLI_join_dirfile(path, path_maxlen,
+                        G.relbase_valid ? "//" : BLI_temporary_dir(),
+                        name);
+}
index 540d757..12a2fe2 100644 (file)
@@ -913,8 +913,8 @@ static void movieclip_build_proxy_ibuf(MovieClip *clip, ImBuf *ibuf, int cfra, i
        scaleibuf->ftype= JPG | quality;
 
        /* unsupported feature only confuses other s/w */
-       if(scaleibuf->depth==32)
-               scaleibuf->depth= 24;
+       if(scaleibuf->planes==32)
+               scaleibuf->planes= 24;
 
        BLI_lock_thread(LOCK_MOVIECLIP);
 
index 8a90809..fd184b9 100644 (file)
@@ -400,7 +400,7 @@ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short
        
        /* scaling */
        if (IS_EQF(strip->scale, 0.0f)) strip->scale= 1.0f;
-       scale = (float)fabs(strip->scale); /* scale must be positive - we've got a special flag for reversing */
+       scale = fabsf(strip->scale); /* scale must be positive - we've got a special flag for reversing */
        
        /* length of referenced action */
        actlength = strip->actend - strip->actstart;
@@ -1087,7 +1087,7 @@ void BKE_nlastrip_set_active (AnimData *adt, NlaStrip *strip)
 short BKE_nlastrip_within_bounds (NlaStrip *strip, float min, float max)
 {
        const float stripLen= (strip) ? strip->end - strip->start : 0.0f;
-       const float boundsLen= (float)fabs(max - min);
+       const float boundsLen= fabsf(max - min);
        
        /* sanity checks */
        if ((strip == NULL) || IS_EQF(stripLen, 0.0f) || IS_EQF(boundsLen, 0.0f))
index c4edddf..7be6ef9 100644 (file)
@@ -1643,15 +1643,22 @@ struct bNodeTemplate nodeMakeTemplate(struct bNode *node)
        }
 }
 
-void node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag)
+void node_type_base(bNodeTreeType *ttype, bNodeType *ntype, int type, const char *name, short nclass, short flag)
 {
        memset(ntype, 0, sizeof(bNodeType));
-       
+
        ntype->type = type;
        BLI_strncpy(ntype->name, name, sizeof(ntype->name));
        ntype->nclass = nclass;
        ntype->flag = flag;
-       
+
+       /* Default muting stuff. */
+       if(ttype) {
+               ntype->mutefunc      = ttype->mutefunc;
+               ntype->mutelinksfunc = ttype->mutelinksfunc;
+               ntype->gpumutefunc   = ttype->gpumutefunc;
+       }
+
        /* default size values */
        ntype->width = 140;
        ntype->minwidth = 100;
@@ -1746,6 +1753,16 @@ void node_type_exec_new(struct bNodeType *ntype,
        ntype->newexecfunc = newexecfunc;
 }
 
+void node_type_mute(struct bNodeType *ntype,
+                    void (*mutefunc)(void *data, int thread, struct bNode *, void *nodedata,
+                                     struct bNodeStack **, struct bNodeStack **),
+                    ListBase (*mutelinksfunc)(struct bNodeTree *, struct bNode *, struct bNodeStack **, struct bNodeStack **,
+                                              struct GPUNodeStack *, struct GPUNodeStack *))
+{
+       ntype->mutefunc = mutefunc;
+       ntype->mutelinksfunc = mutelinksfunc;
+}
+
 void node_type_gpu(struct bNodeType *ntype, int (*gpufunc)(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *in, struct GPUNodeStack *out))
 {
        ntype->gpufunc = gpufunc;
@@ -1756,6 +1773,12 @@ void node_type_gpu_ext(struct bNodeType *ntype, int (*gpuextfunc)(struct GPUMate
        ntype->gpuextfunc = gpuextfunc;
 }
 
+void node_type_gpu_mute(struct bNodeType *ntype, int (*gpumutefunc)(struct GPUMaterial *, struct bNode *, void *,
+                                                                    struct GPUNodeStack *, struct GPUNodeStack *))
+{
+       ntype->gpumutefunc = gpumutefunc;
+}
+
 void node_type_compatibility(struct bNodeType *ntype, short compatibility)
 {
        ntype->compatibility = compatibility;
@@ -1772,211 +1795,212 @@ static bNodeType *is_nodetype_registered(ListBase *typelist, int type)
        return NULL;
 }
 
-void nodeRegisterType(ListBase *typelist, bNodeType *ntype) 
+void nodeRegisterType(bNodeTreeType *ttype, bNodeType *ntype) 
 {
+       ListBase *typelist = &(ttype->node_types);
        bNodeType *found= is_nodetype_registered(typelist, ntype->type);
        
        if(found==NULL)
                BLI_addtail(typelist, ntype);
 }
 
-static void registerCompositNodes(ListBase *ntypelist)
-{
-       register_node_type_frame(ntypelist);
-       
-       register_node_type_cmp_group(ntypelist);
-//     register_node_type_cmp_forloop(ntypelist);
-//     register_node_type_cmp_whileloop(ntypelist);
-       
-       register_node_type_cmp_rlayers(ntypelist);
-       register_node_type_cmp_image(ntypelist);
-       register_node_type_cmp_texture(ntypelist);
-       register_node_type_cmp_value(ntypelist);
-       register_node_type_cmp_rgb(ntypelist);
-       register_node_type_cmp_curve_time(ntypelist);
-       register_node_type_cmp_movieclip(ntypelist);
-       
-       register_node_type_cmp_composite(ntypelist);
-       register_node_type_cmp_viewer(ntypelist);
-       register_node_type_cmp_splitviewer(ntypelist);
-       register_node_type_cmp_output_file(ntypelist);
-       register_node_type_cmp_view_levels(ntypelist);
-       
-       register_node_type_cmp_curve_rgb(ntypelist);
-       register_node_type_cmp_mix_rgb(ntypelist);
-       register_node_type_cmp_hue_sat(ntypelist);
-       register_node_type_cmp_brightcontrast(ntypelist);
-       register_node_type_cmp_gamma(ntypelist);
-       register_node_type_cmp_invert(ntypelist);
-       register_node_type_cmp_alphaover(ntypelist);
-       register_node_type_cmp_zcombine(ntypelist);
-       register_node_type_cmp_colorbalance(ntypelist);
-       register_node_type_cmp_huecorrect(ntypelist);
-       
-       register_node_type_cmp_normal(ntypelist);
-       register_node_type_cmp_curve_vec(ntypelist);
-       register_node_type_cmp_map_value(ntypelist);
-       register_node_type_cmp_normalize(ntypelist);
-       
-       register_node_type_cmp_filter(ntypelist);
-       register_node_type_cmp_blur(ntypelist);
-       register_node_type_cmp_dblur(ntypelist);
-       register_node_type_cmp_bilateralblur(ntypelist);
-       register_node_type_cmp_vecblur(ntypelist);
-       register_node_type_cmp_dilateerode(ntypelist);
-       register_node_type_cmp_defocus(ntypelist);
-       
-       register_node_type_cmp_valtorgb(ntypelist);
-       register_node_type_cmp_rgbtobw(ntypelist);
-       register_node_type_cmp_setalpha(ntypelist);
-       register_node_type_cmp_idmask(ntypelist);
-       register_node_type_cmp_math(ntypelist);
-       register_node_type_cmp_seprgba(ntypelist);
-       register_node_type_cmp_combrgba(ntypelist);
-       register_node_type_cmp_sephsva(ntypelist);
-       register_node_type_cmp_combhsva(ntypelist);
-       register_node_type_cmp_sepyuva(ntypelist);
-       register_node_type_cmp_combyuva(ntypelist);
-       register_node_type_cmp_sepycca(ntypelist);
-       register_node_type_cmp_combycca(ntypelist);
-       register_node_type_cmp_premulkey(ntypelist);
-       
-       register_node_type_cmp_diff_matte(ntypelist);
-       register_node_type_cmp_distance_matte(ntypelist);
-       register_node_type_cmp_chroma_matte(ntypelist);
-       register_node_type_cmp_color_matte(ntypelist);
-       register_node_type_cmp_channel_matte(ntypelist);
-       register_node_type_cmp_color_spill(ntypelist);
-       register_node_type_cmp_luma_matte(ntypelist);
-       
-       register_node_type_cmp_translate(ntypelist);
-       register_node_type_cmp_rotate(ntypelist);
-       register_node_type_cmp_scale(ntypelist);
-       register_node_type_cmp_flip(ntypelist);
-       register_node_type_cmp_crop(ntypelist);
-       register_node_type_cmp_displace(ntypelist);
-       register_node_type_cmp_mapuv(ntypelist);
-       register_node_type_cmp_glare(ntypelist);
-       register_node_type_cmp_tonemap(ntypelist);
-       register_node_type_cmp_lensdist(ntypelist);
-       register_node_type_cmp_transform(ntypelist);
-       register_node_type_cmp_stabilize2d(ntypelist);
-       register_node_type_cmp_moviedistortion(ntypelist);
-}
-
-static void registerShaderNodes(ListBase *ntypelist
-{
-       register_node_type_frame(ntypelist);
-       
-       register_node_type_sh_group(ntypelist);
-       //register_node_type_sh_forloop(ntypelist);
-       //register_node_type_sh_whileloop(ntypelist);
-
-       register_node_type_sh_output(ntypelist);
-       register_node_type_sh_material(ntypelist);
-       register_node_type_sh_camera(ntypelist);
-       register_node_type_sh_value(ntypelist);
-       register_node_type_sh_rgb(ntypelist);
-       register_node_type_sh_mix_rgb(ntypelist);
-       register_node_type_sh_valtorgb(ntypelist);
-       register_node_type_sh_rgbtobw(ntypelist);
-       register_node_type_sh_texture(ntypelist);
-       register_node_type_sh_normal(ntypelist);
-       register_node_type_sh_geom(ntypelist);
-       register_node_type_sh_mapping(ntypelist);
-       register_node_type_sh_curve_vec(ntypelist);
-       register_node_type_sh_curve_rgb(ntypelist);
-       register_node_type_sh_math(ntypelist);
-       register_node_type_sh_vect_math(ntypelist);
-       register_node_type_sh_squeeze(ntypelist);
-       //register_node_type_sh_dynamic(ntypelist);
-       register_node_type_sh_material_ext(ntypelist);
-       register_node_type_sh_invert(ntypelist);
-       register_node_type_sh_seprgb(ntypelist);
-       register_node_type_sh_combrgb(ntypelist);
-       register_node_type_sh_hue_sat(ntypelist);
-
-       register_node_type_sh_attribute(ntypelist);
-       register_node_type_sh_geometry(ntypelist);
-       register_node_type_sh_light_path(ntypelist);
-       register_node_type_sh_fresnel(ntypelist);
-       register_node_type_sh_layer_weight(ntypelist);
-       register_node_type_sh_tex_coord(ntypelist);
-
-       register_node_type_sh_background(ntypelist);
-       register_node_type_sh_bsdf_diffuse(ntypelist);
-       register_node_type_sh_bsdf_glossy(ntypelist);
-       register_node_type_sh_bsdf_glass(ntypelist);
-       register_node_type_sh_bsdf_translucent(ntypelist);
-       register_node_type_sh_bsdf_transparent(ntypelist);
-       register_node_type_sh_bsdf_velvet(ntypelist);
-       register_node_type_sh_emission(ntypelist);
-       register_node_type_sh_holdout(ntypelist);
-       //register_node_type_sh_volume_transparent(ntypelist);
-       //register_node_type_sh_volume_isotropic(ntypelist);
-       register_node_type_sh_mix_shader(ntypelist);
-       register_node_type_sh_add_shader(ntypelist);
-
-       register_node_type_sh_output_lamp(ntypelist);
-       register_node_type_sh_output_material(ntypelist);
-       register_node_type_sh_output_world(ntypelist);
-
-       register_node_type_sh_tex_image(ntypelist);
-       register_node_type_sh_tex_environment(ntypelist);
-       register_node_type_sh_tex_sky(ntypelist);
-       register_node_type_sh_tex_noise(ntypelist);
-       register_node_type_sh_tex_wave(ntypelist);
-       register_node_type_sh_tex_voronoi(ntypelist);
-       register_node_type_sh_tex_musgrave(ntypelist);
-       register_node_type_sh_tex_gradient(ntypelist);
-       register_node_type_sh_tex_magic(ntypelist);
-}
-
-static void registerTextureNodes(ListBase *ntypelist)
-{
-       register_node_type_frame(ntypelist);
-       
-       register_node_type_tex_group(ntypelist);
-//     register_node_type_tex_forloop(ntypelist);
-//     register_node_type_tex_whileloop(ntypelist);
-       
-       register_node_type_tex_math(ntypelist);
-       register_node_type_tex_mix_rgb(ntypelist);
-       register_node_type_tex_valtorgb(ntypelist);
-       register_node_type_tex_rgbtobw(ntypelist);
-       register_node_type_tex_valtonor(ntypelist);
-       register_node_type_tex_curve_rgb(ntypelist);
-       register_node_type_tex_curve_time(ntypelist);
-       register_node_type_tex_invert(ntypelist);
-       register_node_type_tex_hue_sat(ntypelist);
-       register_node_type_tex_coord(ntypelist);
-       register_node_type_tex_distance(ntypelist);
-       register_node_type_tex_compose(ntypelist);
-       register_node_type_tex_decompose(ntypelist);
-       
-       register_node_type_tex_output(ntypelist);
-       register_node_type_tex_viewer(ntypelist);
-       
-       register_node_type_tex_checker(ntypelist);
-       register_node_type_tex_texture(ntypelist);
-       register_node_type_tex_bricks(ntypelist);
-       register_node_type_tex_image(ntypelist);
-       
-       register_node_type_tex_rotate(ntypelist);
-       register_node_type_tex_translate(ntypelist);
-       register_node_type_tex_scale(ntypelist);
-       register_node_type_tex_at(ntypelist);
-       
-       register_node_type_tex_proc_voronoi(ntypelist);
-       register_node_type_tex_proc_blend(ntypelist);
-       register_node_type_tex_proc_magic(ntypelist);
-       register_node_type_tex_proc_marble(ntypelist);
-       register_node_type_tex_proc_clouds(ntypelist);
-       register_node_type_tex_proc_wood(ntypelist);
-       register_node_type_tex_proc_musgrave(ntypelist);
-       register_node_type_tex_proc_noise(ntypelist);
-       register_node_type_tex_proc_stucci(ntypelist);
-       register_node_type_tex_proc_distnoise(ntypelist);
+static void registerCompositNodes(bNodeTreeType *ttype)
+{
+       register_node_type_frame(ttype);
+       
+       register_node_type_cmp_group(ttype);
+//     register_node_type_cmp_forloop(ttype);
+//     register_node_type_cmp_whileloop(ttype);
+       
+       register_node_type_cmp_rlayers(ttype);
+       register_node_type_cmp_image(ttype);
+       register_node_type_cmp_texture(ttype);
+       register_node_type_cmp_value(ttype);
+       register_node_type_cmp_rgb(ttype);
+       register_node_type_cmp_curve_time(ttype);
+       register_node_type_cmp_movieclip(ttype);
+       
+       register_node_type_cmp_composite(ttype);
+       register_node_type_cmp_viewer(ttype);
+       register_node_type_cmp_splitviewer(ttype);
+       register_node_type_cmp_output_file(ttype);
+       register_node_type_cmp_view_levels(ttype);
+       
+       register_node_type_cmp_curve_rgb(ttype);
+       register_node_type_cmp_mix_rgb(ttype);
+       register_node_type_cmp_hue_sat(ttype);
+       register_node_type_cmp_brightcontrast(ttype);
+       register_node_type_cmp_gamma(ttype);
+       register_node_type_cmp_invert(ttype);
+       register_node_type_cmp_alphaover(ttype);
+       register_node_type_cmp_zcombine(ttype);
+       register_node_type_cmp_colorbalance(ttype);
+       register_node_type_cmp_huecorrect(ttype);
+       
+       register_node_type_cmp_normal(ttype);
+       register_node_type_cmp_curve_vec(ttype);
+       register_node_type_cmp_map_value(ttype);
+       register_node_type_cmp_normalize(ttype);
+       
+       register_node_type_cmp_filter(ttype);
+       register_node_type_cmp_blur(ttype);
+       register_node_type_cmp_dblur(ttype);
+       register_node_type_cmp_bilateralblur(ttype);
+       register_node_type_cmp_vecblur(ttype);
+       register_node_type_cmp_dilateerode(ttype);
+       register_node_type_cmp_defocus(ttype);
+       
+       register_node_type_cmp_valtorgb(ttype);
+       register_node_type_cmp_rgbtobw(ttype);
+       register_node_type_cmp_setalpha(ttype);
+       register_node_type_cmp_idmask(ttype);
+       register_node_type_cmp_math(ttype);
+       register_node_type_cmp_seprgba(ttype);
+       register_node_type_cmp_combrgba(ttype);
+       register_node_type_cmp_sephsva(ttype);
+       register_node_type_cmp_combhsva(ttype);
+       register_node_type_cmp_sepyuva(ttype);
+       register_node_type_cmp_combyuva(ttype);
+       register_node_type_cmp_sepycca(ttype);
+       register_node_type_cmp_combycca(ttype);
+       register_node_type_cmp_premulkey(ttype);
+       
+       register_node_type_cmp_diff_matte(ttype);
+       register_node_type_cmp_distance_matte(ttype);
+       register_node_type_cmp_chroma_matte(ttype);
+       register_node_type_cmp_color_matte(ttype);
+       register_node_type_cmp_channel_matte(ttype);
+       register_node_type_cmp_color_spill(ttype);
+       register_node_type_cmp_luma_matte(ttype);
+       
+       register_node_type_cmp_translate(ttype);
+       register_node_type_cmp_rotate(ttype);
+       register_node_type_cmp_scale(ttype);
+       register_node_type_cmp_flip(ttype);
+       register_node_type_cmp_crop(ttype);
+       register_node_type_cmp_displace(ttype);
+       register_node_type_cmp_mapuv(ttype);
+       register_node_type_cmp_glare(ttype);
+       register_node_type_cmp_tonemap(ttype);
+       register_node_type_cmp_lensdist(ttype);
+       register_node_type_cmp_transform(ttype);
+       register_node_type_cmp_stabilize2d(ttype);
+       register_node_type_cmp_moviedistortion(ttype);
+}
+
+static void registerShaderNodes(bNodeTreeType *ttype
+{
+       register_node_type_frame(ttype);
+       
+       register_node_type_sh_group(ttype);
+       //register_node_type_sh_forloop(ttype);
+       //register_node_type_sh_whileloop(ttype);
+
+       register_node_type_sh_output(ttype);
+       register_node_type_sh_material(ttype);
+       register_node_type_sh_camera(ttype);
+       register_node_type_sh_value(ttype);
+       register_node_type_sh_rgb(ttype);
+       register_node_type_sh_mix_rgb(ttype);
+       register_node_type_sh_valtorgb(ttype);
+       register_node_type_sh_rgbtobw(ttype);
+       register_node_type_sh_texture(ttype);
+       register_node_type_sh_normal(ttype);
+       register_node_type_sh_geom(ttype);
+       register_node_type_sh_mapping(ttype);
+       register_node_type_sh_curve_vec(ttype);
+       register_node_type_sh_curve_rgb(ttype);
+       register_node_type_sh_math(ttype);
+       register_node_type_sh_vect_math(ttype);
+       register_node_type_sh_squeeze(ttype);
+       //register_node_type_sh_dynamic(ttype);
+       register_node_type_sh_material_ext(ttype);
+       register_node_type_sh_invert(ttype);
+       register_node_type_sh_seprgb(ttype);
+       register_node_type_sh_combrgb(ttype);
+       register_node_type_sh_hue_sat(ttype);
+
+       register_node_type_sh_attribute(ttype);
+       register_node_type_sh_geometry(ttype);
+       register_node_type_sh_light_path(ttype);
+       register_node_type_sh_fresnel(ttype);
+       register_node_type_sh_layer_weight(ttype);
+       register_node_type_sh_tex_coord(ttype);
+
+       register_node_type_sh_background(ttype);
+       register_node_type_sh_bsdf_diffuse(ttype);
+       register_node_type_sh_bsdf_glossy(ttype);
+       register_node_type_sh_bsdf_glass(ttype);
+       register_node_type_sh_bsdf_translucent(ttype);
+       register_node_type_sh_bsdf_transparent(ttype);
+       register_node_type_sh_bsdf_velvet(ttype);
+       register_node_type_sh_emission(ttype);
+       register_node_type_sh_holdout(ttype);
+       //register_node_type_sh_volume_transparent(ttype);
+       //register_node_type_sh_volume_isotropic(ttype);
+       register_node_type_sh_mix_shader(ttype);
+       register_node_type_sh_add_shader(ttype);
+
+       register_node_type_sh_output_lamp(ttype);
+       register_node_type_sh_output_material(ttype);
+       register_node_type_sh_output_world(ttype);
+
+       register_node_type_sh_tex_image(ttype);
+       register_node_type_sh_tex_environment(ttype);
+       register_node_type_sh_tex_sky(ttype);
+       register_node_type_sh_tex_noise(ttype);
+       register_node_type_sh_tex_wave(ttype);
+       register_node_type_sh_tex_voronoi(ttype);
+       register_node_type_sh_tex_musgrave(ttype);
+       register_node_type_sh_tex_gradient(ttype);
+       register_node_type_sh_tex_magic(ttype);
+}
+
+static void registerTextureNodes(bNodeTreeType *ttype)
+{
+       register_node_type_frame(ttype);
+       
+       register_node_type_tex_group(ttype);
+//     register_node_type_tex_forloop(ttype);
+//     register_node_type_tex_whileloop(ttype);
+       
+       register_node_type_tex_math(ttype);
+       register_node_type_tex_mix_rgb(ttype);
+       register_node_type_tex_valtorgb(ttype);
+       register_node_type_tex_rgbtobw(ttype);
+       register_node_type_tex_valtonor(ttype);
+       register_node_type_tex_curve_rgb(ttype);
+       register_node_type_tex_curve_time(ttype);
+       register_node_type_tex_invert(ttype);
+       register_node_type_tex_hue_sat(ttype);
+       register_node_type_tex_coord(ttype);
+       register_node_type_tex_distance(ttype);
+       register_node_type_tex_compose(ttype);
+       register_node_type_tex_decompose(ttype);
+       
+       register_node_type_tex_output(ttype);
+       register_node_type_tex_viewer(ttype);
+       
+       register_node_type_tex_checker(ttype);
+       register_node_type_tex_texture(ttype);
+       register_node_type_tex_bricks(ttype);
+       register_node_type_tex_image(ttype);
+       
+       register_node_type_tex_rotate(ttype);
+       register_node_type_tex_translate(ttype);
+       register_node_type_tex_scale(ttype);
+       register_node_type_tex_at(ttype);
+       
+       register_node_type_tex_proc_voronoi(ttype);
+       register_node_type_tex_proc_blend(ttype);
+       register_node_type_tex_proc_magic(ttype);
+       register_node_type_tex_proc_marble(ttype);
+       register_node_type_tex_proc_clouds(ttype);
+       register_node_type_tex_proc_wood(ttype);
+       register_node_type_tex_proc_musgrave(ttype);
+       register_node_type_tex_proc_noise(ttype);
+       register_node_type_tex_proc_stucci(ttype);
+       register_node_type_tex_proc_distnoise(ttype);
 }
 
 static void free_dynamic_typeinfo(bNodeType *ntype)
@@ -2010,9 +2034,9 @@ static void free_typeinfos(ListBase *list)
 
 void init_nodesystem(void) 
 {
-       registerCompositNodes(&ntreeGetType(NTREE_COMPOSIT)->node_types);
-       registerShaderNodes(&ntreeGetType(NTREE_SHADER)->node_types);
-       registerTextureNodes(&ntreeGetType(NTREE_TEXTURE)->node_types);
+       registerCompositNodes(ntreeGetType(NTREE_COMPOSIT));
+       registerShaderNodes(ntreeGetType(NTREE_SHADER));
+       registerTextureNodes(ntreeGetType(NTREE_TEXTURE));
 }
 
 void free_nodesystem(void) 
index dedf267..51e3dc7 100644 (file)
@@ -1887,13 +1887,6 @@ static void ob_parvert3(Object *ob, Object *par, float mat[][4])
        }
 }
 
-// XXX what the hell is this?
-static int no_parent_ipo=0;
-void set_no_parent_ipo(int val)
-{
-       no_parent_ipo= val;
-}
-
 static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[4][4])
 {
        float *fp1, *fp2;
@@ -1901,7 +1894,7 @@ static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[
        int a;
 
        // include framerate
-       fac1= ( 1.0f / (1.0f + (float)fabs(ob->sf)) );
+       fac1= ( 1.0f / (1.0f + fabsf(ob->sf)) );
        if(fac1 >= 1.0f) return 0;
        fac2= 1.0f-fac1;
 
@@ -1933,7 +1926,7 @@ void where_is_object_time(Scene *scene, Object *ob, float ctime)
                
                /* hurms, code below conflicts with depgraph... (ton) */
                /* and even worse, it gives bad effects for NLA stride too (try ctime != par->ctime, with MBlur) */
-               if(no_parent_ipo==0 && stime != par->ctime) {
+               if(stime != par->ctime) {
                        // only for ipo systems? 
                        Object tmp= *par;
                        
index df4cd94..b8f96fa 100644 (file)
@@ -998,7 +998,7 @@ void BKE_free_ocean(struct Ocean *oc)
 #define CACHE_TYPE_FOAM                2
 #define CACHE_TYPE_NORMAL      3
 
-static void cache_filename(char *string, const char *path, int frame, int type)
+static void cache_filename(char *string, const char *path, const char *relbase, int frame, int type)
 {
        char cachepath[FILE_MAX];
        const char *fname;
@@ -1018,7 +1018,7 @@ static void cache_filename(char *string, const char *path, int frame, int type)
 
        BLI_join_dirfile(cachepath, sizeof(cachepath), path, fname);
 
-       BKE_makepicstring(string, cachepath, frame, R_OPENEXR, 1, TRUE);
+       BKE_makepicstring(string, cachepath, relbase, frame, R_IMF_IMTYPE_OPENEXR, 1, TRUE);
 }
 
 void BKE_free_ocean_cache(struct OceanCache *och)
@@ -1119,12 +1119,15 @@ void BKE_ocean_cache_eval_ij(struct OceanCache *och, struct OceanResult *ocr, in
        }
 }
 
-struct OceanCache *BKE_init_ocean_cache(char *bakepath, int start, int end, float wave_scale,
-                                                 float chop_amount, float foam_coverage, float foam_fade, int resolution)
+struct OceanCache *BKE_init_ocean_cache(const char *bakepath, const char *relbase,
+                                        int start, int end, float wave_scale,
+                                        float chop_amount, float foam_coverage, float foam_fade, int resolution)
 {
        OceanCache *och = MEM_callocN(sizeof(OceanCache), "ocean cache data");
 
        och->bakepath = bakepath;
+       och->relbase = relbase;
+
        och->start = start;
        och->end = end;
        och->duration = (end - start) + 1;
@@ -1158,17 +1161,17 @@ void BKE_simulate_ocean_cache(struct OceanCache *och, int frame)
        if (och->ibufs_disp[f] != NULL ) return;
 
 
-       cache_filename(string, och->bakepath, frame, CACHE_TYPE_DISPLACE);
+       cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_DISPLACE);
        och->ibufs_disp[f] = IMB_loadiffname(string, 0);
        //if (och->ibufs_disp[f] == NULL) printf("error loading %s \n", string);
        //else printf("loaded cache %s \n", string);
 
-       cache_filename(string, och->bakepath, frame, CACHE_TYPE_FOAM);
+       cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_FOAM);
        och->ibufs_foam[f] = IMB_loadiffname(string, 0);
        //if (och->ibufs_foam[f] == NULL) printf("error loading %s \n", string);
        //else printf("loaded cache %s \n", string);
 
-       cache_filename(string, och->bakepath, frame, CACHE_TYPE_NORMAL);
+       cache_filename(string, och->bakepath, och->relbase, frame, CACHE_TYPE_NORMAL);
        och->ibufs_norm[f] = IMB_loadiffname(string, 0);
        //if (och->ibufs_norm[f] == NULL) printf("error loading %s \n", string);
        //else printf("loaded cache %s \n", string);
@@ -1182,6 +1185,8 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
         * before use - campbell */
        OceanResult ocr;
 
+       ImageFormatData imf= {0};
+
        int f, i=0, x, y, cancel=0;
        float progress;
 
@@ -1198,6 +1203,13 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
 
        BLI_srand(0);
 
+       /* setup image format */
+       imf.imtype= R_IMF_IMTYPE_OPENEXR;
+       imf.depth=  R_IMF_CHAN_DEPTH_16;
+       imf.exr_codec= R_IMF_EXR_CODEC_ZIP; /* ZIP */
+
+
+
        for (f=och->start, i=0; f<=och->end; f++, i++) {
 
                /* create a new imbuf to store image for this frame */
@@ -1288,19 +1300,19 @@ void BKE_bake_ocean(struct Ocean *o, struct OceanCache *och, void (*update_cb)(v
                }
 
                /* write the images */
-               cache_filename(string, och->bakepath, f, CACHE_TYPE_DISPLACE);
-               if(0 == BKE_write_ibuf(ibuf_disp, string, R_OPENEXR, R_OPENEXR_HALF, 2))  // 2 == ZIP exr codec
+               cache_filename(string, och->bakepath, och->relbase, f, CACHE_TYPE_DISPLACE);
+               if(0 == BKE_write_ibuf(ibuf_disp, string, &imf))  // 2 == ZIP exr codec
                        printf("Cannot save Displacement File Output to %s\n", string);
 
                if (o->_do_jacobian) {
-                       cache_filename(string, och->bakepath, f, CACHE_TYPE_FOAM);
-                       if(0 == BKE_write_ibuf(ibuf_foam, string, R_OPENEXR, R_OPENEXR_HALF, 2))  // 2 == ZIP exr codec
+                       cache_filename(string, och->bakepath, och->relbase,  f, CACHE_TYPE_FOAM);
+                       if(0 == BKE_write_ibuf(ibuf_foam, string, &imf))  // 2 == ZIP exr codec
                                printf("Cannot save Foam File Output to %s\n", string);
                }
 
                if (o->_do_normals) {
-                       cache_filename(string, och->bakepath, f, CACHE_TYPE_NORMAL);
-                       if(0 == BKE_write_ibuf(ibuf_normal, string, R_OPENEXR, R_OPENEXR_HALF, 2))  // 2 == ZIP exr codec
+                       cache_filename(string, och->bakepath,  och->relbase, f, CACHE_TYPE_NORMAL);
+                       if(0 == BKE_write_ibuf(ibuf_normal, string, &imf))  // 2 == ZIP exr codec
                                printf("Cannot save Normal File Output to %s\n", string);
                }
 
@@ -1401,8 +1413,9 @@ void BKE_ocean_cache_eval_ij(struct OceanCache *UNUSED(och), struct OceanResult
 {
 }
 
-struct OceanCache *BKE_init_ocean_cache(char *UNUSED(bakepath), int UNUSED(start), int UNUSED(end), float UNUSED(wave_scale),
-                                                 float UNUSED(chop_amount), float UNUSED(foam_coverage), float UNUSED(foam_fade), int UNUSED(resolution))
+struct OceanCache *BKE_init_ocean_cache(const char *UNUSED(bakepath), const char *UNUSED(relbase),
+                                        int UNUSED(start), int UNUSED(end), float UNUSED(wave_scale),
+                                        float UNUSED(chop_amount), float UNUSED(foam_coverage), float UNUSED(foam_fade), int UNUSED(resolution))
 {
        OceanCache *och = MEM_callocN(sizeof(OceanCache), "ocean cache data");
 
index 74fd8ff..a955643 100644 (file)
@@ -3935,9 +3935,10 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
 //                             return;
 
                        // ok, start loading
-                       BLI_snprintf(filename, sizeof(filename), "%sfluidsurface_particles_####.gz", fss->surfdataPath);
-                       
-                       BLI_path_abs(filename, G.main->name);
+                       BLI_join_dirfile(filename, sizeof(filename), fss->surfdataPath, OB_FLUIDSIM_SURF_PARTICLES_FNAME);
+
+                       BLI_path_abs(filename, modifier_path_relbase(sim->ob));
+
                        BLI_path_frame(filename, curFrame, 0); // fixed #frame-no 
 
                        gzf = gzopen(filename, "rb");
index 8b8c974..b7aa02b 100644 (file)
@@ -44,6 +44,7 @@
 
 #include "DNA_anim_types.h"
 #include "DNA_group_types.h"
+#include "DNA_node_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
@@ -346,9 +347,11 @@ Scene *add_scene(const char *name)
        sce->r.mblur_samples= 1;
        sce->r.filtertype= R_FILTER_MITCH;
        sce->r.size= 50;
-       sce->r.planes= 24;
-       sce->r.imtype= R_PNG;
-       sce->r.quality= 90;
+
+       sce->r.im_format.planes= R_IMF_PLANES_RGB;
+       sce->r.im_format.imtype= R_IMF_IMTYPE_PNG;
+       sce->r.im_format.quality= 90;
+
        sce->r.displaymode= R_OUTPUT_AREA;
        sce->r.framapto= 100;
        sce->r.images= 100;
@@ -483,7 +486,7 @@ Scene *add_scene(const char *name)
        sce->r.osa= 8;
 
        /* note; in header_info.c the scene copy happens..., if you add more to renderdata it has to be checked there */
-       scene_add_render_layer(sce);
+       scene_add_render_layer(sce, NULL);
        
        /* game data */
        sce->gm.stereoflag = STEREO_NOSTEREO;
@@ -1086,13 +1089,15 @@ void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay)
 }
 
 /* return default layer, also used to patch old files */
-void scene_add_render_layer(Scene *sce)
+SceneRenderLayer *scene_add_render_layer(Scene *sce, const char *name)
 {
        SceneRenderLayer *srl;
-//     int tot= 1 + BLI_countlist(&sce->r.layers);
-       
+
+       if(!name)
+               name= "RenderLayer";
+
        srl= MEM_callocN(sizeof(SceneRenderLayer), "new render layer");
-       strcpy(srl->name, "RenderLayer");
+       BLI_strncpy(srl->name, name, sizeof(srl->name));
        BLI_uniquename(&sce->r.layers, srl, "RenderLayer", '.', offsetof(SceneRenderLayer, name), sizeof(srl->name));
        BLI_addtail(&sce->r.layers, srl);
 
@@ -1100,6 +1105,45 @@ void scene_add_render_layer(Scene *sce)
        srl->lay= (1<<20) -1;
        srl->layflag= 0x7FFF;   /* solid ztra halo edge strand */
        srl->passflag= SCE_PASS_COMBINED|SCE_PASS_Z;
+
+       return srl;
+}
+
+int scene_remove_render_layer(Main *bmain, Scene *scene, SceneRenderLayer *srl)
+{
+       const int act= BLI_findindex(&scene->r.layers, srl);
+       Scene *sce;
+
+       if (act == -1) {
+               return 0;
+       }
+       else if ( (scene->r.layers.first == scene->r.layers.last) &&
+                 (scene->r.layers.first == srl))
+       {
+               /* ensure 1 layer is kept */
+               return 0;
+       }
+
+       BLI_remlink(&scene->r.layers, srl);
+       MEM_freeN(srl);
+
+       scene->r.actlay= 0;
+
+       for(sce = bmain->scene.first; sce; sce = sce->id.next) {
+               if(sce->nodetree) {
+                       bNode *node;
+                       for(node = sce->nodetree->nodes.first; node; node = node->next) {
+                               if(node->type==CMP_NODE_R_LAYERS && (Scene*)node->id==scene) {
+                                       if(node->custom1==act)
+                                               node->custom1= 0;
+                                       else if(node->custom1>act)
+                                               node->custom1--;
+                               }
+                       }
+               }