svn merge ^/trunk/blender -r46330:46335
authorOve Murberg Henriksen <sorayasilvermoon@hotmail.com>
Mon, 7 May 2012 22:28:59 +0000 (22:28 +0000)
committerOve Murberg Henriksen <sorayasilvermoon@hotmail.com>
Mon, 7 May 2012 22:28:59 +0000 (22:28 +0000)
195 files changed:
doc/python_api/examples/bpy.ops.2.py [deleted file]
doc/python_api/examples/bpy.ops.3.py [deleted file]
extern/libmv/libmv/simple_pipeline/modal_solver.cc [deleted file]
extern/libmv/libmv/simple_pipeline/modal_solver.h [deleted file]
intern/cycles/app/cycles_xml.cpp
intern/cycles/blender/addon/enums.py
intern/cycles/blender/addon/properties.py
intern/cycles/blender/blender_camera.cpp
intern/cycles/bvh/bvh_binning.cpp [deleted file]
intern/cycles/bvh/bvh_binning.h [deleted file]
intern/cycles/bvh/bvh_split.cpp [deleted file]
intern/cycles/bvh/bvh_split.h [deleted file]
intern/cycles/device/device_cuda.cpp
intern/cycles/kernel/kernel_camera.h
intern/cycles/kernel/kernel_path.h
intern/cycles/kernel/kernel_shader.h
intern/cycles/kernel/kernel_types.h
intern/cycles/render/camera.cpp
intern/cycles/render/camera.h
intern/cycles/util/util_task.cpp [deleted file]
intern/cycles/util/util_task.h [deleted file]
intern/ghost/intern/GHOST_WindowWin32.cpp
intern/guardedalloc/cpp/mallocn.cpp
release/scripts/presets/tracking_settings/blurry_movie.py [deleted file]
release/scripts/startup/bl_operators/image.py
release/scripts/startup/bl_ui/properties_data_camera.py
release/scripts/startup/bl_ui/properties_data_curve.py
release/scripts/startup/bl_ui/space_clip.py
release/scripts/startup/bl_ui/space_text.py
source/blender/blenfont/intern/blf_internal_types.h
source/blender/blenkernel/BKE_DerivedMesh.h
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/BKE_paint.h
source/blender/blenkernel/BKE_text.h
source/blender/blenkernel/BKE_tracking.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/camera.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/editderivedmesh.c
source/blender/blenkernel/intern/fluidsim.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/movieclip.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenkernel/intern/text.c
source/blender/blenkernel/intern/tracking.c
source/blender/blenlib/BLI_ghash.h
source/blender/blenlib/BLI_lasso.h [deleted file]
source/blender/blenlib/intern/BLI_ghash.c
source/blender/blenlib/intern/lasso.c [deleted file]
source/blender/blenlib/intern/uvproject.c
source/blender/blenloader/CMakeLists.txt
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/readfile.h
source/blender/blenloader/intern/versioning_250.c [deleted file]
source/blender/blenloader/intern/versioning_legacy.c [deleted file]
source/blender/blenloader/intern/writefile.c
source/blender/bmesh/intern/bmesh_construct.c
source/blender/bmesh/intern/bmesh_interp.c
source/blender/bmesh/intern/bmesh_mesh.c
source/blender/bmesh/intern/bmesh_mesh_validate.c
source/blender/bmesh/intern/bmesh_mods.c
source/blender/bmesh/intern/bmesh_opdefines.c
source/blender/bmesh/intern/bmesh_operators.c
source/blender/bmesh/intern/bmesh_operators.h
source/blender/bmesh/intern/bmesh_queries.c
source/blender/bmesh/operators/bmo_bevel.c
source/blender/bmesh/operators/bmo_create.c
source/blender/bmesh/operators/bmo_dissolve.c
source/blender/bmesh/operators/bmo_extrude.c
source/blender/bmesh/operators/bmo_hull.c [deleted file]
source/blender/bmesh/operators/bmo_inset.c
source/blender/bmesh/operators/bmo_removedoubles.c
source/blender/bmesh/operators/bmo_subdivide.c
source/blender/bmesh/operators/bmo_subdivide.h
source/blender/bmesh/operators/bmo_triangulate.c
source/blender/bmesh/operators/bmo_wireframe.c [deleted file]
source/blender/bmesh/tools/BME_bevel.c
source/blender/collada/AnimationImporter.cpp
source/blender/collada/AnimationImporter.h
source/blender/collada/ArmatureImporter.cpp
source/blender/collada/CameraExporter.cpp
source/blender/collada/DocumentImporter.cpp
source/blender/collada/MeshImporter.cpp
source/blender/collada/SkinInfo.cpp
source/blender/collada/collada_utils.cpp
source/blender/collada/collada_utils.h
source/blender/editors/animation/keyframing.c
source/blender/editors/animation/keyingsets.c
source/blender/editors/armature/editarmature.c
source/blender/editors/curve/editcurve.c
source/blender/editors/curve/editfont.c
source/blender/editors/include/BIF_glutil.h
source/blender/editors/include/ED_clip.h
source/blender/editors/include/ED_sculpt.h
source/blender/editors/interface/interface_draw.c
source/blender/editors/mesh/editmesh_add.c
source/blender/editors/mesh/editmesh_knife.c
source/blender/editors/mesh/editmesh_loopcut.c
source/blender/editors/mesh/editmesh_select.c
source/blender/editors/mesh/editmesh_slide.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/editmesh_utils.c
source/blender/editors/mesh/mesh_data.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_hook.c
source/blender/editors/object/object_intern.h
source/blender/editors/object/object_ops.c
source/blender/editors/object/object_vgroup.c
source/blender/editors/physics/particle_boids.c
source/blender/editors/render/render_opengl.c
source/blender/editors/screen/area.c
source/blender/editors/screen/glutil.c
source/blender/editors/sculpt_paint/paint_intern.h
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/editors/sculpt_paint/paint_stroke.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/sculpt_paint/sculpt_uv.c
source/blender/editors/space_clip/clip_buttons.c
source/blender/editors/space_clip/clip_dopesheet_draw.c [deleted file]
source/blender/editors/space_clip/clip_dopesheet_ops.c [deleted file]
source/blender/editors/space_clip/clip_draw.c
source/blender/editors/space_clip/clip_editor.c
source/blender/editors/space_clip/clip_graph_draw.c
source/blender/editors/space_clip/clip_graph_ops.c
source/blender/editors/space_clip/clip_ops.c
source/blender/editors/space_clip/clip_utils.c
source/blender/editors/space_clip/space_clip.c
source/blender/editors/space_clip/tracking_ops.c
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_info/info_ops.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_text/space_text.c
source/blender/editors/space_text/text_intern.h
source/blender/editors/space_view3d/drawarmature.c
source/blender/editors/space_view3d/drawmesh.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_select.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_input.c
source/blender/editors/uvedit/uvedit_draw.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/editors/uvedit/uvedit_smart_stitch.c
source/blender/editors/uvedit/uvedit_unwrap_ops.c
source/blender/gpu/intern/gpu_draw.c
source/blender/imbuf/intern/moviecache.c
source/blender/imbuf/intern/tiff.c
source/blender/makesdna/DNA_ID.h
source/blender/makesdna/DNA_camera_types.h
source/blender/makesdna/DNA_curve_types.h
source/blender/makesdna/DNA_image_types.h
source/blender/makesdna/DNA_space_types.h
source/blender/makesdna/DNA_tracking_types.h
source/blender/makesdna/intern/makesdna.c
source/blender/makesrna/intern/rna_camera.c
source/blender/makesrna/intern/rna_curve.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_tracking.c
source/blender/modifiers/intern/MOD_boolean_util.c
source/blender/modifiers/intern/MOD_cloth.c
source/blender/modifiers/intern/MOD_collision.c
source/blender/modifiers/intern/MOD_decimate.c
source/blender/modifiers/intern/MOD_displace.c
source/blender/modifiers/intern/MOD_edgesplit.c
source/blender/modifiers/intern/MOD_hook.c
source/blender/modifiers/intern/MOD_mask.c
source/blender/modifiers/intern/MOD_meshdeform.c
source/blender/modifiers/intern/MOD_mirror.c
source/blender/modifiers/intern/MOD_solidify.c
source/blender/modifiers/intern/MOD_uvproject.c
source/blender/modifiers/intern/MOD_warp.c
source/blender/modifiers/intern/MOD_weightvgproximity.c
source/blender/nodes/composite/nodes/node_composite_blur.c
source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
source/blender/nodes/shader/nodes/node_shader_common.c
source/blender/nodes/texture/nodes/node_texture_common.c
source/blender/python/intern/bpy_props.c
source/blender/render/intern/include/strand.h
source/blender/render/intern/source/strand.c
source/blender/render/intern/source/zbuf.c
source/blender/windowmanager/intern/wm_draw.c
source/blender/windowmanager/intern/wm_operators.c
source/blender/windowmanager/intern/wm_subwindow.c
source/gameengine/GamePlayer/common/GPC_Canvas.cpp

diff --git a/doc/python_api/examples/bpy.ops.2.py b/doc/python_api/examples/bpy.ops.2.py
deleted file mode 100644 (file)
index 86b7438..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-"""
-Overriding Context
-++++++++++++++++++
-
-It is possible to override context members that the operator sees, so that they
-act on specified rather than the selected or active data, or to execute an
-operator in the different part of the user interface.
-
-The context overrides are passed as a dictionary, with keys matching the context
-member names in bpy.context. For example to override bpy.context.active_object,
-you would pass {'active_object': object}.
-"""
-
-# remove all objects in scene rather than the selected ones
-import bpy
-override = {'selected_bases': list(bpy.context.scene.object_bases)}
-bpy.ops.object.delete(override)
-
diff --git a/doc/python_api/examples/bpy.ops.3.py b/doc/python_api/examples/bpy.ops.3.py
deleted file mode 100644 (file)
index 0b5bcaf..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-"""
-It is also possible to run an operator in a particular part of the user
-interface. For this we need to pass the window, screen, area and sometimes
-a region.
-"""
-
-# maximize 3d view in all windows
-import bpy
-
-for window in bpy.context.window_manager.windows:
-    screen = window.screen
-    
-    for area in screen.areas:
-        if area.type == 'VIEW_3D':
-            override = {'window': window, 'screen': screen, 'area': area}
-            bpy.ops.screen.screen_full_area(override)
-            break
-
diff --git a/extern/libmv/libmv/simple_pipeline/modal_solver.cc b/extern/libmv/libmv/simple_pipeline/modal_solver.cc
deleted file mode 100644 (file)
index bb49b30..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright (c) 2012 libmv authors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-
-#include <cstdio>
-
-#include "libmv/logging/logging.h"
-#include "libmv/simple_pipeline/modal_solver.h"
-#include "libmv/simple_pipeline/rigid_registration.h"
-
-#ifdef _MSC_VER
-#  define snprintf _snprintf
-#endif
-
-namespace libmv {
-
-static void ProjectMarkerOnSphere(Marker &marker, Vec3 &X) {
-  X(0) = marker.x;
-  X(1) = marker.y;
-  X(2) = 1.0;
-
-  X *= 5.0 / X.norm();
-}
-
-static void ModalSolverLogProress(ProgressUpdateCallback *update_callback,
-    double progress)
-{
-  if (update_callback) {
-    char message[256];
-
-    snprintf(message, sizeof(message), "Solving progress %d%%", (int)(progress * 100));
-
-    update_callback->invoke(progress, message);
-  }
-}
-
-void ModalSolver(Tracks &tracks,
-                 EuclideanReconstruction *reconstruction,
-                 ProgressUpdateCallback *update_callback) {
-  int max_image = tracks.MaxImage();
-  int max_track = tracks.MaxTrack();
-
-  LG << "Max image: " << max_image;
-  LG << "Max track: " << max_track;
-
-  Mat3 R = Mat3::Identity();
-
-  for (int image = 0; image <= max_image; ++image) {
-    vector<Marker> all_markers = tracks.MarkersInImage(image);
-
-    ModalSolverLogProress(update_callback, (float) image / max_image);
-
-    // Skip empty frames without doing anything
-    if (all_markers.size() == 0) {
-      LG << "Skipping frame: " << image;
-      continue;
-    }
-
-    vector<Vec3> points, reference_points;
-
-    // Cnstruct pairs of markers from current and previous image,
-    // to reproject them and find rigid transformation between
-    // previous and current image
-    for (int track = 0; track <= max_track; ++track) {
-      EuclideanPoint *point = reconstruction->PointForTrack(track);
-
-      if (point) {
-        Marker marker = tracks.MarkerInImageForTrack(image, track);
-
-        if (marker.image == image) {
-          Vec3 X;
-
-          LG << "Use track " << track << " for rigid registration between image " <<
-            image - 1 << " and " << image;
-
-          ProjectMarkerOnSphere(marker, X);
-
-          points.push_back(point->X);
-          reference_points.push_back(X);
-        }
-      }
-    }
-
-    if (points.size()) {
-      // Find rigid delta transformation to current image
-      RigidRegistration(reference_points, points, R);
-    }
-
-    reconstruction->InsertCamera(image, R, Vec3::Zero());
-
-    // Review if there's new tracks for which position might be reconstructed
-    for (int track = 0; track <= max_track; ++track) {
-      if (!reconstruction->PointForTrack(track)) {
-        Marker marker = tracks.MarkerInImageForTrack(image, track);
-
-        if (marker.image == image) {
-          // New track appeared on this image, project it's position onto sphere
-
-          LG << "Projecting track " << track << " at image " << image;
-
-          Vec3 X;
-          ProjectMarkerOnSphere(marker, X);
-          reconstruction->InsertPoint(track, R.inverse() * X);
-        }
-      }
-    }
-  }
-}
-
-}  // namespace libmv
diff --git a/extern/libmv/libmv/simple_pipeline/modal_solver.h b/extern/libmv/libmv/simple_pipeline/modal_solver.h
deleted file mode 100644 (file)
index 560b37c..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) 2012 libmv authors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-
-#ifndef LIBMV_SIMPLE_PIPELINE_MODAL_SOLVER_H_
-#define LIBMV_SIMPLE_PIPELINE_MODAL_SOLVER_H_
-
-#include "libmv/simple_pipeline/tracks.h"
-#include "libmv/simple_pipeline/reconstruction.h"
-#include "libmv/simple_pipeline/callbacks.h"
-
-namespace libmv {
-
-/*!
-    This solver solves such camera motion as tripod rotation, reconstructing
-    only camera motion itself. Bundles are not reconstructing properly, they're
-    just getting projected onto sphere.
-
-    Markers from tracks object would be used for recosntruction, and algorithm
-    assumes thir's positions are undistorted already and they're in nnormalized
-    space.
-
-    Reconstructed cameras and projected bundles would be added to reconstruction
-    object.
-*/
-void ModalSolver(Tracks &tracks,
-                 EuclideanReconstruction *reconstruction,
-                 ProgressUpdateCallback *update_callback = NULL);
-
-}  // namespace libmv
-
-#endif  // LIBMV_SIMPLE_PIPELINE_MODAL_SOLVER_H_
index db3592f12273a3dc8a2089dbaa73a91e644fa8a9..82f1338d86bd9a05213fda7198a417affebe26e5 100644 (file)
@@ -290,22 +290,8 @@ static void xml_read_camera(const XMLReadState& state, pugi::xml_node node)
                cam->type = CAMERA_ORTHOGRAPHIC;
        else if(xml_equal_string(node, "type", "perspective"))
                cam->type = CAMERA_PERSPECTIVE;
-       else if(xml_equal_string(node, "type", "panorama"))
-               cam->type = CAMERA_PANORAMA;
-
-       if(xml_equal_string(node, "panorama_type", "equirectangular"))
-               cam->panorama_type = PANORAMA_EQUIRECTANGULAR;
-       else if(xml_equal_string(node, "panorama_type", "fisheye_equidistant"))
-               cam->panorama_type = PANORAMA_FISHEYE_EQUIDISTANT;
-       else if(xml_equal_string(node, "panorama_type", "fisheye_equisolid"))
-               cam->panorama_type = PANORAMA_FISHEYE_EQUISOLID;
-
-       xml_read_float(&cam->fisheye_fov, node, "fisheye_fov");
-       xml_read_float(&cam->fisheye_lens, node, "fisheye_lens");
-
-       xml_read_float(&cam->sensorwidth, node, "sensorwidth");
-       xml_read_float(&cam->sensorheight, node, "sensorheight");
-
+       else if(xml_equal_string(node, "type", "environment"))
+               cam->type = CAMERA_ENVIRONMENT;
 
        cam->matrix = state.tfm;
 
index 6cc3010eb0ebb2b65f926d0df2b4fd693dd8b063..b4b1646c10ddae42bf197ffe33ddcbed925a1805 100644 (file)
@@ -54,9 +54,3 @@ aperture_types = (
     ('RADIUS', "Radius", "Directly change the size of the aperture"),
     ('FSTOP', "F/stop", "Change the size of the aperture by f/stops"),
     )
-
-panorama_types = (
-    ('EQUIRECTANGULAR', "Equirectangular", "Render the scene with a spherical camera, also known as Lat Long panorama"),
-    ('FISHEYE_EQUIDISTANT', "Fisheye Equidistant", "Ideal for fulldomes, ignore the sensor dimensions"),
-    ('FISHEYE_EQUISOLID', "Fisheye Equisolid", "Similar to most fisheye modern lens, take sensor dimensions into consideration"),
-    )
index fb066a3a9395e452e7cd84857700b815272f865d..35f97bf629f42e303f60059709f273de485a440c 100644 (file)
@@ -278,25 +278,6 @@ class CyclesCameraSettings(bpy.types.PropertyGroup):
                 subtype='ANGLE',
                 default=0,
                 )
-        cls.panorama_type = EnumProperty(
-                name="Panorama Type",
-                description="Distortion to use for the calculation",
-                items=enums.panorama_types,
-                default='FISHEYE_EQUISOLID',
-                )
-        cls.fisheye_fov = FloatProperty(
-                name="Field of View",
-                description="Field of view for the fisheye lens",
-                min=0.1745, soft_max=2*math.pi, max=10.0*math.pi,
-                subtype='ANGLE',
-                default=math.pi,
-                )
-        cls.fisheye_lens = FloatProperty(
-                name="Fisheye Lens",
-                description="Lens focal length (mm))",
-                min=0.01, soft_max=15.0, max=100.0,
-                default=10.5,
-                )
 
     @classmethod
     def unregister(cls):
index bdd02bb508601e882546c9706296be44ee83dbed..55a32d8fc1064e11f7b3f70e729b5321abc5eddb 100644 (file)
@@ -48,10 +48,6 @@ struct BlenderCamera {
 
        float2 pixelaspect;
 
-       PanoramaType panorama_type;
-       float fisheye_fov;
-       float fisheye_lens;
-
        enum { AUTO, HORIZONTAL, VERTICAL } sensor_fit;
        float sensor_width;
        float sensor_height;
@@ -98,37 +94,9 @@ static void blender_camera_from_object(BlenderCamera *bcam, BL::Object b_ob)
                bcam->nearclip = b_camera.clip_start();
                bcam->farclip = b_camera.clip_end();
 
-               switch(b_camera.type())
-               {
-                       case BL::Camera::type_ORTHO:
-                               bcam->type = CAMERA_ORTHOGRAPHIC;
-                               break;
-                       case BL::Camera::type_PANO:
-                               bcam->type = CAMERA_PANORAMA;
-                               break;
-                       case BL::Camera::type_PERSP:
-                       default:
-                               bcam->type = CAMERA_PERSPECTIVE;
-                               break;
-               }       
-
-               switch(RNA_enum_get(&ccamera, "panorama_type"))
-               {
-                       case 1:
-                               bcam->panorama_type = PANORAMA_FISHEYE_EQUIDISTANT;
-                               break;
-                       case 2:
-                               bcam->panorama_type = PANORAMA_FISHEYE_EQUISOLID;
-                               break;
-                       case 0:
-                       default:
-                               bcam->panorama_type = PANORAMA_EQUIRECTANGULAR;
-                               break;
-               }       
-
-               bcam->fisheye_fov = RNA_float_get(&ccamera, "fisheye_fov");
-               bcam->fisheye_lens = RNA_float_get(&ccamera, "fisheye_lens");
-
+               bcam->type = (b_camera.type() == BL::Camera::type_ORTHO)? CAMERA_ORTHOGRAPHIC: CAMERA_PERSPECTIVE;
+               if(bcam->type == CAMERA_PERSPECTIVE && b_camera.use_panorama())
+                       bcam->type = CAMERA_ENVIRONMENT;
                bcam->ortho_scale = b_camera.ortho_scale();
 
                bcam->lens = b_camera.lens();
@@ -170,7 +138,7 @@ static Transform blender_camera_matrix(const Transform& tfm, CameraType type)
 {
        Transform result;
 
-       if(type == CAMERA_PANORAMA) {
+       if(type == CAMERA_ENVIRONMENT) {
                /* make it so environment camera needs to be pointed in the direction
                   of the positive x-axis to match an environment texture, this way
                   it is looking at the center of the texture */
@@ -204,9 +172,6 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
        bool horizontal_fit;
        float sensor_size;
 
-       cam->sensorwidth = bcam->sensor_width;
-       cam->sensorheight = bcam->sensor_height;
-
        if(bcam->sensor_fit == BlenderCamera::AUTO) {
                horizontal_fit = (xratio > yratio);
                sensor_size = bcam->sensor_width;
@@ -238,7 +203,7 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
                aspectratio = bcam->ortho_scale/2.0f;
        }
 
-       if(bcam->type == CAMERA_PANORAMA) {
+       if(bcam->type == CAMERA_ENVIRONMENT) {
                /* set viewplane */
                cam->left = 0.0f;
                cam->right = 1.0f;
@@ -275,11 +240,6 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
        /* type */
        cam->type = bcam->type;
 
-       /* panorama */
-       cam->panorama_type = bcam->panorama_type;
-       cam->fisheye_fov = bcam->fisheye_fov;
-       cam->fisheye_lens = bcam->fisheye_lens;
-
        /* perspective */
        cam->fov = 2.0f*atan((0.5f*sensor_size)/bcam->lens/aspectratio);
        cam->focaldistance = bcam->focaldistance;
diff --git a/intern/cycles/bvh/bvh_binning.cpp b/intern/cycles/bvh/bvh_binning.cpp
deleted file mode 100644 (file)
index e4b8858..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Adapted from code copyright 2009-2011 Intel Corporation
- * Modifications Copyright 2012, Blender Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//#define __KERNEL_SSE__
-
-#include <stdlib.h>
-
-#include "bvh_binning.h"
-
-#include "util_algorithm.h"
-#include "util_boundbox.h"
-#include "util_types.h"
-
-CCL_NAMESPACE_BEGIN
-
-/* SSE replacements */
-
-__forceinline void prefetch_L1 (const void* ptr) { }
-__forceinline void prefetch_L2 (const void* ptr) { }
-__forceinline void prefetch_L3 (const void* ptr) { }
-__forceinline void prefetch_NTA(const void* ptr) { }
-
-template<size_t src> __forceinline float extract(const int4& b)
-{ return b[src]; }
-template<size_t dst> __forceinline const float4 insert(const float4& a, const float b)
-{ float4 r = a; r[dst] = b; return r; }
-
-__forceinline int get_best_dimension(const float4& bestSAH)
-{
-       // return (int)__bsf(movemask(reduce_min(bestSAH) == bestSAH));
-
-       float minSAH = min(bestSAH.x, min(bestSAH.y, bestSAH.z));
-
-       if(bestSAH.x == minSAH) return 0;
-       else if(bestSAH.y == minSAH) return 1;
-       else return 2;
-}
-
-/* BVH Object Binning */
-
-BVHObjectBinning::BVHObjectBinning(const BVHRange& job, BVHReference *prims)
-: BVHRange(job), splitSAH(FLT_MAX), dim(0), pos(0)
-{
-       /* compute number of bins to use and precompute scaling factor for binning */
-       num_bins = min(size_t(MAX_BINS), size_t(4.0f + 0.05f*size()));
-       scale = rcp(cent_bounds().size()) * make_float3((float)num_bins);
-
-       /* initialize binning counter and bounds */
-       BoundBox bin_bounds[MAX_BINS][4];       /* bounds for every bin in every dimension */
-       int4 bin_count[MAX_BINS];                       /* number of primitives mapped to bin */
-
-       for(size_t i = 0; i < num_bins; i++) {
-               bin_count[i] = make_int4(0);
-               bin_bounds[i][0] = bin_bounds[i][1] = bin_bounds[i][2] = BoundBox::empty;
-       }
-
-       /* map geometry to bins, unrolled once */
-       {
-               ssize_t i;
-
-               for(i = 0; i < ssize_t(size()) - 1; i += 2) {
-                       prefetch_L2(&prims[start() + i + 8]);
-
-                       /* map even and odd primitive to bin */
-                       BVHReference prim0 = prims[start() + i + 0];
-                       BVHReference prim1 = prims[start() + i + 1];
-
-                       int4 bin0 = get_bin(prim0.bounds());
-                       int4 bin1 = get_bin(prim1.bounds());
-
-                       /* increase bounds for bins for even primitive */
-                       int b00 = extract<0>(bin0); bin_count[b00][0]++; bin_bounds[b00][0].grow(prim0.bounds());
-                       int b01 = extract<1>(bin0); bin_count[b01][1]++; bin_bounds[b01][1].grow(prim0.bounds());
-                       int b02 = extract<2>(bin0); bin_count[b02][2]++; bin_bounds[b02][2].grow(prim0.bounds());
-
-                       /* increase bounds of bins for odd primitive */
-                       int b10 = extract<0>(bin1); bin_count[b10][0]++; bin_bounds[b10][0].grow(prim1.bounds());
-                       int b11 = extract<1>(bin1); bin_count[b11][1]++; bin_bounds[b11][1].grow(prim1.bounds());
-                       int b12 = extract<2>(bin1); bin_count[b12][2]++; bin_bounds[b12][2].grow(prim1.bounds());
-               }
-
-               /* for uneven number of primitives */
-               if(i < ssize_t(size())) {
-                       /* map primitive to bin */
-                       BVHReference prim0 = prims[start() + i];
-                       int4 bin0 = get_bin(prim0.bounds());
-
-                       /* increase bounds of bins */
-                       int b00 = extract<0>(bin0); bin_count[b00][0]++; bin_bounds[b00][0].grow(prim0.bounds());
-                       int b01 = extract<1>(bin0); bin_count[b01][1]++; bin_bounds[b01][1].grow(prim0.bounds());
-                       int b02 = extract<2>(bin0); bin_count[b02][2]++; bin_bounds[b02][2].grow(prim0.bounds());
-               }
-       }
-
-       /* sweep from right to left and compute parallel prefix of merged bounds */
-       float4 r_area[MAX_BINS];        /* area of bounds of primitives on the right */
-       float4 r_count[MAX_BINS];       /* number of primitives on the right */
-       int4 count = make_int4(0);
-
-       BoundBox bx = BoundBox::empty;
-       BoundBox by = BoundBox::empty;
-       BoundBox bz = BoundBox::empty;
-
-       for(size_t i = num_bins - 1; i > 0; i--) {
-               count = count + bin_count[i];
-               r_count[i] = blocks(count);
-
-               bx = merge(bx,bin_bounds[i][0]); r_area[i][0] = bx.half_area();
-               by = merge(by,bin_bounds[i][1]); r_area[i][1] = by.half_area();
-               bz = merge(bz,bin_bounds[i][2]); r_area[i][2] = bz.half_area();
-               r_area[i][3] = r_area[i][2];
-       }
-
-       /* sweep from left to right and compute SAH */
-       int4 ii = make_int4(1);
-       float4 bestSAH = make_float4(FLT_MAX);
-       int4 bestSplit = make_int4(-1);
-
-       count = make_int4(0);
-
-       bx = BoundBox::empty;
-       by = BoundBox::empty;
-       bz = BoundBox::empty;
-
-       for(size_t i = 1; i < num_bins; i++, ii += make_int4(1)) {
-               count = count + bin_count[i-1];
-
-               bx = merge(bx,bin_bounds[i-1][0]); float Ax = bx.half_area();
-               by = merge(by,bin_bounds[i-1][1]); float Ay = by.half_area();
-               bz = merge(bz,bin_bounds[i-1][2]); float Az = bz.half_area();
-
-               float4 lCount = blocks(count);
-               float4 lArea = make_float4(Ax,Ay,Az,Az);
-               float4 sah = lArea*lCount + r_area[i]*r_count[i];
-
-               bestSplit = select(sah < bestSAH,ii,bestSplit);
-               bestSAH = min(sah,bestSAH);
-       }
-
-       int4 mask = float3_to_float4(cent_bounds().size()) <= make_float4(0.0f);
-       bestSAH = insert<3>(select(mask, make_float4(FLT_MAX), bestSAH), FLT_MAX);
-
-       /* find best dimension */
-       dim = get_best_dimension(bestSAH);
-       splitSAH = bestSAH[dim];
-       pos = bestSplit[dim];
-       leafSAH = bounds().half_area() * blocks(size());
-}
-
-void BVHObjectBinning::split(BVHReference* prims, BVHObjectBinning& left_o, BVHObjectBinning& right_o) const
-{
-       size_t N = size();
-
-       BoundBox lgeom_bounds = BoundBox::empty;
-       BoundBox rgeom_bounds = BoundBox::empty;
-       BoundBox lcent_bounds = BoundBox::empty;
-       BoundBox rcent_bounds = BoundBox::empty;
-
-       ssize_t l = 0, r = N-1;
-
-       while(l <= r) {
-               prefetch_L2(&prims[start() + l + 8]);
-               prefetch_L2(&prims[start() + r - 8]);
-
-               BVHReference prim = prims[start() + l];
-               float3 center = prim.bounds().center2();
-
-               if(get_bin(center)[dim] < pos) {
-                       lgeom_bounds.grow(prim.bounds());
-                       lcent_bounds.grow(center);
-                       l++;
-               }
-               else {
-                       rgeom_bounds.grow(prim.bounds());
-                       rcent_bounds.grow(center);
-                       swap(prims[start()+l],prims[start()+r]);
-                       r--;
-               }
-       }
-
-       /* finish */
-       if(l != 0 && N-1-r != 0) {
-               right_o = BVHObjectBinning(BVHRange(rgeom_bounds, rcent_bounds, start() + l, N-1-r), prims);
-               left_o  = BVHObjectBinning(BVHRange(lgeom_bounds, lcent_bounds, start(), l), prims);
-               return;
-       }
-
-       /* object medium split if we did not make progress, can happen when all
-          primitives have same centroid */
-       lgeom_bounds = BoundBox::empty;
-       rgeom_bounds = BoundBox::empty;
-       lcent_bounds = BoundBox::empty;
-       rcent_bounds = BoundBox::empty;
-
-       for(size_t i = 0; i < N/2; i++) {
-               lgeom_bounds.grow(prims[start()+i].bounds());
-               lcent_bounds.grow(prims[start()+i].bounds().center2());
-       }
-
-       for(size_t i = N/2; i < N; i++) {
-               rgeom_bounds.grow(prims[start()+i].bounds());
-               rcent_bounds.grow(prims[start()+i].bounds().center2());
-       }
-
-       right_o = BVHObjectBinning(BVHRange(rgeom_bounds, rcent_bounds, start() + N/2, N/2 + N%2), prims);
-       left_o  = BVHObjectBinning(BVHRange(lgeom_bounds, lcent_bounds, start(), N/2), prims);
-}
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/bvh/bvh_binning.h b/intern/cycles/bvh/bvh_binning.h
deleted file mode 100644 (file)
index 6074215..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Adapted from code copyright 2009-2011 Intel Corporation
- * Modifications Copyright 2012, Blender Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __BVH_BINNING_H__
-#define __BVH_BINNING_H__
-
-#include "bvh_params.h"
-
-#include "util_types.h"
-
-CCL_NAMESPACE_BEGIN
-
-/* Single threaded object binner. Finds the split with the best SAH heuristic
- * by testing for each dimension multiple partitionings for regular spaced
- * partition locations. A partitioning for a partition location is computed,
- * by putting primitives whose centroid is on the left and right of the split
- * location to different sets. The SAH is evaluated by computing the number of
- * blocks occupied by the primitives in the partitions. */
-
-class BVHObjectBinning : public BVHRange
-{
-public:
-       __forceinline BVHObjectBinning() {}
-       BVHObjectBinning(const BVHRange& job, BVHReference *prims);
-
-       void split(BVHReference *prims, BVHObjectBinning& left_o, BVHObjectBinning& right_o) const;
-
-       float splitSAH; /* SAH cost of the best split */
-       float leafSAH;  /* SAH cost of creating a leaf */
-
-protected:
-       int dim;                        /* best split dimension */
-       int pos;                        /* best split position */
-       size_t num_bins;        /* actual number of bins to use */
-       float3 scale;           /* scaling factor to compute bin */
-
-       enum { MAX_BINS = 32 };
-       enum { LOG_BLOCK_SIZE = 2 };
-
-       /* computes the bin numbers for each dimension for a box. */
-       __forceinline int4 get_bin(const BoundBox& box) const
-       {
-               int4 a = make_int4((box.center2() - cent_bounds().min)*scale - make_float3(0.5f));
-               int4 mn = make_int4(0);
-               int4 mx = make_int4((int)num_bins-1);
-
-               return clamp(a, mn, mx);
-       }
-
-       /* computes the bin numbers for each dimension for a point. */
-       __forceinline int4 get_bin(const float3& c) const
-       {
-               return make_int4((c - cent_bounds().min)*scale - make_float3(0.5f));
-       }
-
-       /* compute the number of blocks occupied for each dimension. */
-       __forceinline float4 blocks(const int4& a) const
-       {
-               return make_float4((a + make_int4((1 << LOG_BLOCK_SIZE)-1)) >> LOG_BLOCK_SIZE);
-       }
-
-       /* compute the number of blocks occupied in one dimension. */
-       __forceinline int blocks(size_t a) const
-       {
-               return (int)((a+((1LL << LOG_BLOCK_SIZE)-1)) >> LOG_BLOCK_SIZE);
-       }
-};
-
-CCL_NAMESPACE_END
-
-#endif
-
diff --git a/intern/cycles/bvh/bvh_split.cpp b/intern/cycles/bvh/bvh_split.cpp
deleted file mode 100644 (file)
index 263c583..0000000
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Adapted from code copyright 2009-2010 NVIDIA Corporation
- * Modifications Copyright 2011, Blender Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "bvh_build.h"
-#include "bvh_split.h"
-#include "bvh_sort.h"
-
-#include "mesh.h"
-#include "object.h"
-
-#include "util_algorithm.h"
-
-CCL_NAMESPACE_BEGIN
-
-/* Object Split */
-
-BVHObjectSplit::BVHObjectSplit(BVHBuild *builder, const BVHRange& range, float nodeSAH)
-: sah(FLT_MAX), dim(0), num_left(0), left_bounds(BoundBox::empty), right_bounds(BoundBox::empty)
-{
-       const BVHReference *ref_ptr = &builder->references[range.start()];
-       float min_sah = FLT_MAX;
-
-       for(int dim = 0; dim < 3; dim++) {
-               /* sort references */
-               bvh_reference_sort(range.start(), range.end(), &builder->references[0], dim);
-
-               /* sweep right to left and determine bounds. */
-               BoundBox right_bounds = BoundBox::empty;
-
-               for(int i = range.size() - 1; i > 0; i--) {
-                       right_bounds.grow(ref_ptr[i].bounds());
-                       builder->spatial_right_bounds[i - 1] = right_bounds;
-               }
-
-               /* sweep left to right and select lowest SAH. */
-               BoundBox left_bounds = BoundBox::empty;
-
-               for(int i = 1; i < range.size(); i++) {
-                       left_bounds.grow(ref_ptr[i - 1].bounds());
-                       right_bounds = builder->spatial_right_bounds[i - 1];
-
-                       float sah = nodeSAH +
-                               left_bounds.safe_area() * builder->params.triangle_cost(i) +
-                               right_bounds.safe_area() * builder->params.triangle_cost(range.size() - i);
-
-                       if(sah < min_sah) {
-                               min_sah = sah;
-
-                               this->sah = sah;
-                               this->dim = dim;
-                               this->num_left = i;
-                               this->left_bounds = left_bounds;
-                               this->right_bounds = right_bounds;
-                       }
-               }
-       }
-}
-
-void BVHObjectSplit::split(BVHBuild *builder, BVHRange& left, BVHRange& right, const BVHRange& range)
-{
-       /* sort references according to split */
-       bvh_reference_sort(range.start(), range.end(), &builder->references[0], this->dim);
-
-       /* split node ranges */
-       left = BVHRange(this->left_bounds, range.start(), this->num_left);
-       right = BVHRange(this->right_bounds, left.end(), range.size() - this->num_left);
-
-}
-
-/* Spatial Split */
-
-BVHSpatialSplit::BVHSpatialSplit(BVHBuild *builder, const BVHRange& range, float nodeSAH)
-: sah(FLT_MAX), dim(0), pos(0.0f)
-{
-       /* initialize bins. */
-       float3 origin = range.bounds().min;
-       float3 binSize = (range.bounds().max - origin) * (1.0f / (float)BVHParams::NUM_SPATIAL_BINS);
-       float3 invBinSize = 1.0f / binSize;
-
-       for(int dim = 0; dim < 3; dim++) {
-               for(int i = 0; i < BVHParams::NUM_SPATIAL_BINS; i++) {
-                       BVHSpatialBin& bin = builder->spatial_bins[dim][i];
-
-                       bin.bounds = BoundBox::empty;
-                       bin.enter = 0;
-                       bin.exit = 0;
-               }
-       }
-
-       /* chop references into bins. */
-       for(unsigned int refIdx = range.start(); refIdx < range.end(); refIdx++) {
-               const BVHReference& ref = builder->references[refIdx];
-               float3 firstBinf = (ref.bounds().min - origin) * invBinSize;
-               float3 lastBinf = (ref.bounds().max - origin) * invBinSize;
-               int3 firstBin = make_int3((int)firstBinf.x, (int)firstBinf.y, (int)firstBinf.z);
-               int3 lastBin = make_int3((int)lastBinf.x, (int)lastBinf.y, (int)lastBinf.z);
-
-               firstBin = clamp(firstBin, 0, BVHParams::NUM_SPATIAL_BINS - 1);
-               lastBin = clamp(lastBin, firstBin, BVHParams::NUM_SPATIAL_BINS - 1);
-
-               for(int dim = 0; dim < 3; dim++) {
-                       BVHReference currRef = ref;
-
-                       for(int i = firstBin[dim]; i < lastBin[dim]; i++) {
-                               BVHReference leftRef, rightRef;
-
-                               split_reference(builder, leftRef, rightRef, currRef, dim, origin[dim] + binSize[dim] * (float)(i + 1));
-                               builder->spatial_bins[dim][i].bounds.grow(leftRef.bounds());
-                               currRef = rightRef;
-                       }
-
-                       builder->spatial_bins[dim][lastBin[dim]].bounds.grow(currRef.bounds());
-                       builder->spatial_bins[dim][firstBin[dim]].enter++;
-                       builder->spatial_bins[dim][lastBin[dim]].exit++;
-               }
-       }
-
-       /* select best split plane. */
-       for(int dim = 0; dim < 3; dim++) {
-               /* sweep right to left and determine bounds. */
-               BoundBox right_bounds = BoundBox::empty;
-
-               for(int i = BVHParams::NUM_SPATIAL_BINS - 1; i > 0; i--) {
-                       right_bounds.grow(builder->spatial_bins[dim][i].bounds);
-                       builder->spatial_right_bounds[i - 1] = right_bounds;
-               }
-
-               /* sweep left to right and select lowest SAH. */
-               BoundBox left_bounds = BoundBox::empty;
-               int leftNum = 0;
-               int rightNum = range.size();
-
-               for(int i = 1; i < BVHParams::NUM_SPATIAL_BINS; i++) {
-                       left_bounds.grow(builder->spatial_bins[dim][i - 1].bounds);
-                       leftNum += builder->spatial_bins[dim][i - 1].enter;
-                       rightNum -= builder->spatial_bins[dim][i - 1].exit;
-
-                       float sah = nodeSAH +
-                               left_bounds.safe_area() * builder->params.triangle_cost(leftNum) +
-                               builder->spatial_right_bounds[i - 1].safe_area() * builder->params.triangle_cost(rightNum);
-
-                       if(sah < this->sah) {
-                               this->sah = sah;
-                               this->dim = dim;
-                               this->pos = origin[dim] + binSize[dim] * (float)i;
-                       }
-               }
-       }
-}
-
-void BVHSpatialSplit::split(BVHBuild *builder, BVHRange& left, BVHRange& right, const BVHRange& range)
-{
-       /* Categorize references and compute bounds.
-        *
-        * Left-hand side:                      [left_start, left_end[
-        * Uncategorized/split:         [left_end, right_start[
-        * Right-hand side:                     [right_start, refs.size()[ */
-
-       vector<BVHReference>& refs = builder->references;
-       int left_start = range.start();
-       int left_end = left_start;
-       int right_start = range.end();
-       int right_end = range.end();
-       BoundBox left_bounds = BoundBox::empty;
-       BoundBox right_bounds = BoundBox::empty;
-
-       for(int i = left_end; i < right_start; i++) {
-               if(refs[i].bounds().max[this->dim] <= this->pos) {
-                       /* entirely on the left-hand side */
-                       left_bounds.grow(refs[i].bounds());
-                       swap(refs[i], refs[left_end++]);
-               }
-               else if(refs[i].bounds().min[this->dim] >= this->pos) {
-                       /* entirely on the right-hand side */
-                       right_bounds.grow(refs[i].bounds());
-                       swap(refs[i--], refs[--right_start]);
-               }
-       }
-
-       /* duplicate or unsplit references intersecting both sides. */
-       while(left_end < right_start) {
-               /* split reference. */
-               BVHReference lref, rref;
-
-               split_reference(builder, lref, rref, refs[left_end], this->dim, this->pos);
-
-               /* compute SAH for duplicate/unsplit candidates. */
-               BoundBox lub = left_bounds;             // Unsplit to left:             new left-hand bounds.
-               BoundBox rub = right_bounds;    // Unsplit to right:    new right-hand bounds.
-               BoundBox ldb = left_bounds;             // Duplicate:                   new left-hand bounds.
-               BoundBox rdb = right_bounds;    // Duplicate:                   new right-hand bounds.
-
-               lub.grow(refs[left_end].bounds());
-               rub.grow(refs[left_end].bounds());
-               ldb.grow(lref.bounds());
-               rdb.grow(rref.bounds());
-
-               float lac = builder->params.triangle_cost(left_end - left_start);
-               float rac = builder->params.triangle_cost(right_end - right_start);
-               float lbc = builder->params.triangle_cost(left_end - left_start + 1);
-               float rbc = builder->params.triangle_cost(right_end - right_start + 1);
-
-               float unsplitLeftSAH = lub.safe_area() * lbc + right_bounds.safe_area() * rac;
-               float unsplitRightSAH = left_bounds.safe_area() * lac + rub.safe_area() * rbc;
-               float duplicateSAH = ldb.safe_area() * lbc + rdb.safe_area() * rbc;
-               float minSAH = min(min(unsplitLeftSAH, unsplitRightSAH), duplicateSAH);
-
-               if(minSAH == unsplitLeftSAH) {
-                       /* unsplit to left */
-                       left_bounds = lub;
-                       left_end++;
-               }
-               else if(minSAH == unsplitRightSAH) {
-                       /* unsplit to right */
-                       right_bounds = rub;
-                       swap(refs[left_end], refs[--right_start]);
-               }
-               else {
-                       /* duplicate */
-                       left_bounds = ldb;
-                       right_bounds = rdb;
-                       refs[left_end++] = lref;
-                       refs.insert(refs.begin() + right_end, rref);
-                       right_end++;
-               }
-       }
-
-       left = BVHRange(left_bounds, left_start, left_end - left_start);
-       right = BVHRange(right_bounds, right_start, right_end - right_start);
-}
-
-void BVHSpatialSplit::split_reference(BVHBuild *builder, BVHReference& left, BVHReference& right, const BVHReference& ref, int dim, float pos)
-{
-       /* initialize boundboxes */
-       BoundBox left_bounds = BoundBox::empty;
-       BoundBox right_bounds = BoundBox::empty;
-
-       /* loop over vertices/edges. */
-       Object *ob = builder->objects[ref.prim_object()];
-       const Mesh *mesh = ob->mesh;
-       const int *inds = mesh->triangles[ref.prim_index()].v;
-       const float3 *verts = &mesh->verts[0];
-       const float3* v1 = &verts[inds[2]];
-
-       for(int i = 0; i < 3; i++) {
-               const float3* v0 = v1;
-               int vindex = inds[i];
-               v1 = &verts[vindex];
-               float v0p = (*v0)[dim];
-               float v1p = (*v1)[dim];
-
-               /* insert vertex to the boxes it belongs to. */
-               if(v0p <= pos)
-                       left_bounds.grow(*v0);
-
-               if(v0p >= pos)
-                       right_bounds.grow(*v0);
-
-               /* edge intersects the plane => insert intersection to both boxes. */
-               if((v0p < pos && v1p > pos) || (v0p > pos && v1p < pos)) {
-                       float3 t = lerp(*v0, *v1, clamp((pos - v0p) / (v1p - v0p), 0.0f, 1.0f));
-                       left_bounds.grow(t);
-                       right_bounds.grow(t);
-               }
-       }
-
-       /* intersect with original bounds. */
-       left_bounds.max[dim] = pos;
-       right_bounds.min[dim] = pos;
-       left_bounds.intersect(ref.bounds());
-       right_bounds.intersect(ref.bounds());
-
-       /* set referecnes */
-       left = BVHReference(left_bounds, ref.prim_index(), ref.prim_object());
-       right = BVHReference(right_bounds, ref.prim_index(), ref.prim_object());
-}
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/bvh/bvh_split.h b/intern/cycles/bvh/bvh_split.h
deleted file mode 100644 (file)
index 1f4befb..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Adapted from code copyright 2009-2010 NVIDIA Corporation
- * Modifications Copyright 2011, Blender Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __BVH_SPLIT_H__
-#define __BVH_SPLIT_H__
-
-#include "bvh_build.h"
-#include "bvh_params.h"
-
-CCL_NAMESPACE_BEGIN
-
-class BVHBuild;
-
-/* Object Split */
-
-class BVHObjectSplit
-{
-public:
-       float sah;
-       int dim;
-       int num_left;
-       BoundBox left_bounds;
-       BoundBox right_bounds;
-
-       BVHObjectSplit() {}
-       BVHObjectSplit(BVHBuild *builder, const BVHRange& range, float nodeSAH);
-
-       void split(BVHBuild *builder, BVHRange& left, BVHRange& right, const BVHRange& range);
-};
-
-/* Spatial Split */
-
-class BVHSpatialSplit
-{
-public:
-       float sah;
-       int dim;
-       float pos;
-
-       BVHSpatialSplit() : sah(FLT_MAX), dim(0), pos(0.0f) {}
-       BVHSpatialSplit(BVHBuild *builder, const BVHRange& range, float nodeSAH);
-
-       void split(BVHBuild *builder, BVHRange& left, BVHRange& right, const BVHRange& range);
-       void split_reference(BVHBuild *builder, BVHReference& left, BVHReference& right, const BVHReference& ref, int dim, float pos);
-};
-
-/* Mixed Object-Spatial Split */
-
-class BVHMixedSplit
-{
-public:
-       BVHObjectSplit object;
-       BVHSpatialSplit spatial;
-
-       float leafSAH;
-       float nodeSAH;
-       float minSAH;
-
-       bool no_split;
-
-       __forceinline BVHMixedSplit(BVHBuild *builder, const BVHRange& range, int level)
-       {
-               /* find split candidates. */
-               float area = range.bounds().safe_area();
-
-               leafSAH = area * builder->params.triangle_cost(range.size());
-               nodeSAH = area * builder->params.node_cost(2);
-
-               object = BVHObjectSplit(builder, range, nodeSAH);
-
-               if(builder->params.use_spatial_split && level < BVHParams::MAX_SPATIAL_DEPTH) {
-                       BoundBox overlap = object.left_bounds;
-                       overlap.intersect(object.right_bounds);
-
-                       if(overlap.safe_area() >= builder->spatial_min_overlap)
-                               spatial = BVHSpatialSplit(builder, range, nodeSAH);
-               }
-
-               /* leaf SAH is the lowest => create leaf. */
-               minSAH = min(min(leafSAH, object.sah), spatial.sah);
-               no_split = (minSAH == leafSAH && range.size() <= builder->params.max_leaf_size);
-       }
-
-       __forceinline void split(BVHBuild *builder, BVHRange& left, BVHRange& right, const BVHRange& range)
-       {
-               if(builder->params.use_spatial_split && minSAH == spatial.sah)
-                       spatial.split(builder, left, right, range);
-               if(!left.size() || !right.size())
-                       object.split(builder, left, right, range);
-       }
-};
-
-CCL_NAMESPACE_END
-
-#endif /* __BVH_SPLIT_H__ */
-
index 0a780e5f5762a6cbc153ce1ecb2eb69d21e41905..0c08baae3ff6df4ae7163ae9e5cd5e624d3588ab 100644 (file)
@@ -172,18 +172,11 @@ public:
 
                CUresult result;
 
-               if(background) {
+               if(background)
                        result = cuCtxCreate(&cuContext, 0, cuDevice);
-               }
-               else {
+               else
                        result = cuGLCtxCreate(&cuContext, 0, cuDevice);
 
-                       if(result != CUDA_SUCCESS) {
-                               result = cuCtxCreate(&cuContext, 0, cuDevice);
-                               background = true;
-                       }
-               }
-
                if(cuda_error(result))
                        return;
 
@@ -693,25 +686,14 @@ public:
                        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
                        glBindTexture(GL_TEXTURE_2D, 0);
                        
-                       CUresult result = cuGraphicsGLRegisterBuffer(&pmem.cuPBOresource, pmem.cuPBO, CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE);
-
-                       if(!cuda_error(result)) {
-                               cuda_pop_context();
-
-                               mem.device_pointer = pmem.cuTexId;
-                               pixel_mem_map[mem.device_pointer] = pmem;
+                       cuda_assert(cuGraphicsGLRegisterBuffer(&pmem.cuPBOresource, pmem.cuPBO, CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE))
 
-                               return;
-                       }
-                       else {
-                               /* failed to register buffer, fallback to no interop */
-                               glDeleteBuffers(1, &pmem.cuPBO);
-                               glDeleteTextures(1, &pmem.cuTexId);
+                       cuda_pop_context();
 
-                               cuda_pop_context();
+                       mem.device_pointer = pmem.cuTexId;
+                       pixel_mem_map[mem.device_pointer] = pmem;
 
-                               background = true;
-                       }
+                       return;
                }
 
                Device::pixels_alloc(mem);
index 220ebec13ce1707220f57e54bb98dc6bf6b3ae43..aed26f5e852d8898fcf3608a205782d56cef1a5d 100644 (file)
@@ -132,7 +132,7 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa
 #endif
 }
 
-/* Panorama Camera */
+/* Environment Camera */
 
 __device float3 panorama_to_direction(KernelGlobals *kg, float u, float v)
 {
@@ -154,6 +154,7 @@ __device void camera_sample_panorama(KernelGlobals *kg, float raster_x, float ra
 
        /* create ray form raster position */
        ray->P = make_float3(0.0f, 0.0f, 0.0f);
+       ray->D = equirectangular_to_direction(Pcamera.x, Pcamera.y);
 
 #ifdef __CAMERA_CLIPPING__
        /* clipping */
@@ -193,6 +194,11 @@ __device void camera_sample_panorama(KernelGlobals *kg, float raster_x, float ra
        Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y + 1.0f, 0.0f));
        ray->dD.dy = normalize(transform_direction(&cameratoworld, panorama_to_direction(kg, Pcamera.x, Pcamera.y))) - ray->D;
 
+#ifdef __CAMERA_CLIPPING__
+       /* clipping */
+       ray->t = kernel_data.cam.cliplength;
+#else
+       ray->t = FLT_MAX;
 #endif
 }
 
@@ -219,7 +225,7 @@ __device void camera_sample(KernelGlobals *kg, int x, int y, float filter_u, flo
        else if(kernel_data.cam.type == CAMERA_ORTHOGRAPHIC)
                camera_sample_orthographic(kg, raster_x, raster_y, ray);
        else
-               camera_sample_panorama(kg, raster_x, raster_y, ray);
+               camera_sample_environment(kg, raster_x, raster_y, ray);
 }
 
 CCL_NAMESPACE_END
index d53951a1f34ad946ca35c80760b5461bade6d203..87d996ef9e27cf43d5562f7d28b917965d132ce8 100644 (file)
@@ -474,12 +474,7 @@ __device void kernel_path_trace(KernelGlobals *kg,
        camera_sample(kg, x, y, filter_u, filter_v, lens_u, lens_v, time, &ray);
 
        /* integrate */
-       float4 L;
-
-       if (ray.t != 0.f)
-               L = kernel_path_integrate(kg, &rng, sample, ray, buffer);
-       else
-               L = make_float4(0.f, 0.f, 0.f, 0.f);
+       float4 L = kernel_path_integrate(kg, &rng, sample, ray, buffer);
 
        /* accumulate result in output buffer */
        kernel_write_pass_float4(buffer, sample, L);
index 2138038e49d974f0765465b79adb0cd59f2a563d..af821bad8680749c618f65fd861b451e49b35ace 100644 (file)
@@ -180,8 +180,7 @@ __device void shader_setup_from_sample(KernelGlobals *kg, ShaderData *sd,
        }
 
        sd->flag = kernel_tex_fetch(__shader_flag, (sd->shader & SHADER_MASK)*2);
-       if(sd->object != -1)
-               sd->flag |= kernel_tex_fetch(__object_flag, sd->object);
+       sd->flag |= kernel_tex_fetch(__object_flag, sd->object);
 
 #ifdef __DPDU__
        /* dPdu/dPdv */
index 25ff7f73888684c322e5e5a27eaff998e741a126..85ee16fc5c6679ec8362d4c5274c5c106c0d93ee 100644 (file)
@@ -268,15 +268,7 @@ typedef enum LightType {
 enum CameraType {
        CAMERA_PERSPECTIVE,
        CAMERA_ORTHOGRAPHIC,
-       CAMERA_PANORAMA
-};
-
-/* Panorama Type */
-
-enum PanoramaType {
-       PANORAMA_EQUIRECTANGULAR,
-       PANORAMA_FISHEYE_EQUIDISTANT,
-       PANORAMA_FISHEYE_EQUISOLID
+       CAMERA_ENVIRONMENT
 };
 
 /* Differential */
@@ -460,11 +452,7 @@ typedef struct ShaderData {
 typedef struct KernelCamera {
        /* type */
        int type;
-
-       /* panorama */
-       int panorama_type;
-       float fisheye_fov;
-       float fisheye_lens;
+       int pad1, pad2, pad3;
 
        /* matrices */
        Transform cameratoworld;
@@ -488,11 +476,6 @@ typedef struct KernelCamera {
        float nearclip;
        float cliplength;
 
-       /* sensor size */
-       float sensorwidth;
-       float sensorheight;
-       int pad1, pad2;
-
        /* more matrices */
        Transform screentoworld;
        Transform rastertoworld;
index 95405519cc098a239d18cab567d7cbad721dc175..f0b77871130086a56abdd52578298e11b2aa5ea3 100644 (file)
@@ -39,14 +39,8 @@ Camera::Camera()
        use_motion = false;
 
        type = CAMERA_PERSPECTIVE;
-       panorama_type = PANORAMA_EQUIRECTANGULAR;
-       fisheye_fov = M_PI_F;
-       fisheye_lens = 10.5f;
        fov = M_PI_F/4.0f;
 
-       sensorwidth = 0.036;
-       sensorheight = 0.024;
-
        nearclip = 1e-5f;
        farclip = 1e5f;
 
@@ -187,15 +181,6 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
        /* type */
        kcam->type = type;
 
-       /* panorama */
-       kcam->panorama_type = panorama_type;
-       kcam->fisheye_fov = fisheye_fov;
-       kcam->fisheye_lens = fisheye_lens;
-
-       /* sensor size */
-       kcam->sensorwidth = sensorwidth;
-       kcam->sensorheight = sensorheight;
-
        /* store differentials */
        kcam->dx = float3_to_float4(dx);
        kcam->dy = float3_to_float4(dy);
@@ -223,8 +208,6 @@ bool Camera::modified(const Camera& cam)
                (fov == cam.fov) &&
                (nearclip == cam.nearclip) &&
                (farclip == cam.farclip) &&
-               (sensorwidth == cam.sensorwidth) &&
-               (sensorheight == cam.sensorheight) &&
                // modified for progressive render
                // (width == cam.width) &&
                // (height == cam.height) &&
@@ -234,10 +217,7 @@ bool Camera::modified(const Camera& cam)
                (top == cam.top) &&
                (matrix == cam.matrix) &&
                (motion == cam.motion) &&
-               (use_motion == cam.use_motion) &&
-               (panorama_type == cam.panorama_type) &&
-               (fisheye_fov == cam.fisheye_fov) &&
-               (fisheye_lens == cam.fisheye_lens));
+               (use_motion == cam.use_motion));
 }
 
 void Camera::tag_update()
index 7a09b5981e4042800dc491d121a96dca84d25e09..935489711c84f9dc39863eadefaec223f01d71ce 100644 (file)
@@ -50,15 +50,6 @@ public:
        CameraType type;
        float fov;
 
-       /* panorama */
-       PanoramaType panorama_type;
-       float fisheye_fov;
-       float fisheye_lens;
-
-       /* sensor */
-       float sensorwidth;
-       float sensorheight;
-
        /* clipping */
        float nearclip;
        float farclip;
diff --git a/intern/cycles/util/util_task.cpp b/intern/cycles/util/util_task.cpp
deleted file mode 100644 (file)
index fc80627..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "util_debug.h"
-#include "util_foreach.h"
-#include "util_system.h"
-#include "util_task.h"
-
-CCL_NAMESPACE_BEGIN
-
-/* Task Pool */
-
-TaskPool::TaskPool()
-{
-       num = 0;
-       num_done = 0;
-
-       do_cancel = false;
-}
-
-TaskPool::~TaskPool()
-{
-       stop();
-}
-
-void TaskPool::push(Task *task, bool front)
-{
-       TaskScheduler::Entry entry;
-
-       entry.task = task;
-       entry.pool = this;
-
-       TaskScheduler::push(entry, front);
-}
-
-void TaskPool::push(const TaskRunFunction& run, bool front)
-{
-       push(new Task(run), front);
-}
-
-void TaskPool::wait_work()
-{
-       thread_scoped_lock done_lock(done_mutex);
-
-       while(num_done != num) {
-               thread_scoped_lock queue_lock(TaskScheduler::queue_mutex);
-
-               /* find task from this pool. if we get a task from another pool,
-                * we can get into deadlock */
-               TaskScheduler::Entry work_entry;
-               bool found_entry = false;
-               list<TaskScheduler::Entry>::iterator it;
-
-               for(it = TaskScheduler::queue.begin(); it != TaskScheduler::queue.end(); it++) {
-                       TaskScheduler::Entry& entry = *it;
-
-                       if(entry.pool == this) {
-                               work_entry = entry;
-                               found_entry = true;
-                               TaskScheduler::queue.erase(it);
-                               break;
-                       }
-               }
-
-               queue_lock.unlock();
-
-               /* if found task, do it, otherwise wait until other tasks are done */
-               if(found_entry) {
-                       done_lock.unlock();
-
-                       /* run task */
-                       work_entry.task->run();
-
-                       /* delete task */
-                       delete work_entry.task;
-
-                       /* notify pool task was done */
-                       done_increase(1);
-
-                       done_lock.lock();
-               }
-               else
-                       done_cond.wait(done_lock);
-       }
-}
-
-void TaskPool::cancel()
-{
-       TaskScheduler::clear(this);
-
-       do_cancel = true;
-       {
-               thread_scoped_lock lock(done_mutex);
-
-               while(num_done != num)
-                       done_cond.wait(lock);
-       }
-       do_cancel = false;
-}
-
-void TaskPool::stop()
-{
-       TaskScheduler::clear(this);
-
-       assert(num_done == num);
-}
-
-bool TaskPool::cancelled()
-{
-       return do_cancel;
-}
-
-void TaskPool::done_increase(int done)
-{
-       done_mutex.lock();
-       num_done += done;
-       done_mutex.unlock();
-
-       assert(num_done <= num);
-       done_cond.notify_all();
-}
-
-/* Task Scheduler */
-
-thread_mutex TaskScheduler::mutex;
-int TaskScheduler::users = 0;
-vector<thread*> TaskScheduler::threads;
-vector<int> TaskScheduler::thread_level;
-volatile bool TaskScheduler::do_exit = false;
-
-list<TaskScheduler::Entry> TaskScheduler::queue;
-thread_mutex TaskScheduler::queue_mutex;
-thread_condition_variable TaskScheduler::queue_cond;
-
-void TaskScheduler::init(int num_threads)
-{
-       thread_scoped_lock lock(mutex);
-
-       /* multiple cycles instances can use this task scheduler, sharing the same
-          threads, so we keep track of the number of users. */
-       if(users == 0) {
-               do_exit = false;
-
-               /* launch threads that will be waiting for work */
-               if(num_threads == 0)
-                       num_threads = system_cpu_thread_count();
-
-               threads.resize(num_threads);
-               thread_level.resize(num_threads);
-
-               for(size_t i = 0; i < threads.size(); i++) {
-                       threads[i] = new thread(function_bind(&TaskScheduler::thread_run, i));
-                       thread_level[i] = 0;
-               }
-       }
-       
-       users++;
-}
-
-void TaskScheduler::exit()
-{
-       thread_scoped_lock lock(mutex);
-
-       users--;
-
-       if(users == 0) {
-               /* stop all waiting threads */
-               do_exit = true;
-               TaskScheduler::queue_cond.notify_all();
-
-               /* delete threads */
-               foreach(thread *t, threads) {
-                       t->join();
-                       delete t;
-               }
-
-               threads.clear();
-               thread_level.clear();
-       }
-}
-
-bool TaskScheduler::thread_wait_pop(Entry& entry)
-{
-       thread_scoped_lock lock(queue_mutex);
-
-       while(queue.empty() && !do_exit)
-               queue_cond.wait(lock);
-
-       if(queue.empty()) {
-               assert(do_exit);
-               return false;
-       }
-       
-       entry = queue.front();
-       queue.pop_front();
-
-       return true;
-}
-
-void TaskScheduler::thread_run(int thread_id)
-{
-       Entry entry;
-
-       /* todo: test affinity/denormal mask */
-
-       /* keep popping off tasks */
-       while(thread_wait_pop(entry)) {
-               /* run task */
-               entry.task->run();
-
-               /* delete task */
-               delete entry.task;
-
-               /* notify pool task was done */
-               entry.pool->done_increase(1);
-       }
-}
-
-void TaskScheduler::push(Entry& entry, bool front)
-{
-       /* add entry to queue */
-       TaskScheduler::queue_mutex.lock();
-       if(front)
-               TaskScheduler::queue.push_front(entry);
-       else
-               TaskScheduler::queue.push_back(entry);
-       entry.pool->num++;
-       TaskScheduler::queue_mutex.unlock();
-
-       TaskScheduler::queue_cond.notify_one();
-}
-
-void TaskScheduler::clear(TaskPool *pool)
-{
-       thread_scoped_lock lock(queue_mutex);
-
-       /* erase all tasks from this pool from the queue */
-       list<Entry>::iterator it = queue.begin();
-       int done = 0;
-
-       while(it != queue.end()) {
-               Entry& entry = *it;
-
-               if(entry.pool == pool) {
-                       done++;
-                       delete entry.task;
-
-                       it = queue.erase(it);
-               }
-               else
-                       it++;
-       }
-
-       /* notify done */
-       pool->done_increase(done);
-}
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/util/util_task.h b/intern/cycles/util/util_task.h
deleted file mode 100644 (file)
index 6b7562c..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef __UTIL_TASK_H__
-#define __UTIL_TASK_H__
-
-#include "util_list.h"
-#include "util_thread.h"
-#include "util_vector.h"
-
-CCL_NAMESPACE_BEGIN
-
-class Task;
-class TaskPool;
-class TaskScheduler;
-
-typedef boost::function<void(void)> TaskRunFunction;
-
-/* Task
- *
- * Base class for tasks to be executed in threads. */
-
-class Task
-{
-public:
-       Task() {};
-       Task(const TaskRunFunction& run_) : run(run_) {}
-
-       virtual ~Task() {}
-
-       TaskRunFunction run;
-};
-
-/* Task Pool
- *
- * Pool of tasks that will be executed by the central TaskScheduler.For each
- * pool, we can wait for all tasks to be done, or cancel them before they are
- * done.
- *
- * The run callback that actually executes the task may be create like this:
- * function_bind(&MyClass::task_execute, this, _1, _2) */
-
-class TaskPool
-{
-public:
-       TaskPool();
-       ~TaskPool();
-
-       void push(Task *task, bool front = false);
-       void push(const TaskRunFunction& run, bool front = false);
-
-       void wait_work();       /* work and wait until all tasks are done */
-       void cancel();          /* cancel all tasks, keep worker threads running */
-       void stop();            /* stop all worker threads */
-
-       bool cancelled();       /* for worker threads, test if cancelled */
-
-protected:
-       friend class TaskScheduler;
-
-       void done_increase(int done);
-
-       thread_mutex done_mutex;
-       thread_condition_variable done_cond;
-
-       volatile int num, num_done;
-       volatile bool do_cancel;
-};
-
-/* Task Scheduler
- * 
- * Central scheduler that holds running threads ready to execute tasks. A singe
- * queue holds the task from all pools. */
-
-class TaskScheduler
-{
-public:
-       static void init(int num_threads = 0);
-       static void exit();
-
-       static int num_threads() { return threads.size(); }
-
-protected:
-       friend class TaskPool;
-
-       struct Entry {
-               Task *task;
-               TaskPool *pool;
-       };
-
-       static thread_mutex mutex;
-       static int users;
-       static vector<thread*> threads;
-       static vector<int> thread_level;
-       static volatile bool do_exit;
-
-       static list<Entry> queue;
-       static thread_mutex queue_mutex;
-       static thread_condition_variable queue_cond;
-
-       static void thread_run(int thread_id);
-       static bool thread_wait_pop(Entry& entry);
-
-       static void push(Entry& entry, bool front);
-       static void clear(TaskPool *pool);
-};
-
-CCL_NAMESPACE_END
-
-#endif
-
index 3715da12cd6d675a6aff51e2c1524d9848321f7f..9d105748095bf8427affcd5f62e172e12493add4 100644 (file)
@@ -55,7 +55,7 @@
 #endif
 
 // Some more multisample defines
-#define WGL_SAMPLE_BUFFERS_ARB 0x2041
+#define WGL_SAMPLE_BUFERS_ARB  0x2041
 #define        WGL_SAMPLES_ARB                 0x2042
 
 // win64 doesn't define GWL_USERDATA
index 130fcb6960bd5a62d27fac4caabba093284066ac..97e68d06ace6ef1111536614b27bfcf14c99b891 100644 (file)
@@ -41,7 +41,5 @@ void* operator new (size_t size, const char *str)
 
 void operator delete (void *p)
 {
-       /* delete NULL is valid in c++ */
-       if(p)
-               MEM_freeN(p);
+       MEM_freeN(p);
 }
diff --git a/release/scripts/presets/tracking_settings/blurry_movie.py b/release/scripts/presets/tracking_settings/blurry_movie.py
deleted file mode 100644 (file)
index 8a503be..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-import bpy
-settings = bpy.context.edit_movieclip.tracking.settings
-
-settings.default_tracker = 'KLT'
-settings.default_pyramid_levels = 4
-settings.default_correlation_min = 0.75
-settings.default_pattern_size = 11
-settings.default_search_size = 202
-settings.default_frames_limit = 25
-settings.default_pattern_match = 'KEYFRAME'
-settings.default_margin = 0
index 6af6488e86bf3303643881cef700838336777435..1b7d5e3a40d059ea2f97643e73b0827cb58d8dcc 100644 (file)
@@ -118,24 +118,16 @@ class SaveDirty(Operator):
         unique_paths = set()
         for image in bpy.data.images:
             if image.is_dirty:
-                if image.packed_file:
-                    if image.library:
-                        self.report({'WARNING'},
-                                    "Packed library image: %r from library %r can't be re-packed" %
-                                    (image.name, image.library.filepath))
-                    else:
-                        image.pack(as_png=True)
+                filepath = bpy.path.abspath(image.filepath)
+                if "\\" not in filepath and "/" not in filepath:
+                    self.report({'WARNING'}, "Invalid path: " + filepath)
+                elif filepath in unique_paths:
+                    self.report({'WARNING'},
+                                "Path used by more then one image: %r" %
+                                filepath)
                 else:
-                    filepath = bpy.path.abspath(image.filepath, library=image.library)
-                    if "\\" not in filepath and "/" not in filepath:
-                        self.report({'WARNING'}, "Invalid path: " + filepath)
-                    elif filepath in unique_paths:
-                        self.report({'WARNING'},
-                                    "Path used by more then one image: %r" %
-                                    filepath)
-                    else:
-                        unique_paths.add(filepath)
-                        image.save()
+                    unique_paths.add(filepath)
+                    image.save()
         return {'FINISHED'}
 
 
index 49457b8e569bb21de67d31dc418f299e879688ab..5da41a668f621a4fcb08f1abf9e55ef30c8f9ef1 100644 (file)
@@ -87,16 +87,10 @@ class DATA_PT_lens(CameraButtonsPanel, Panel):
         elif cam.type == 'ORTHO':
             col.prop(cam, "ortho_scale")
 
-        elif cam.type == 'PANO':
-            if context.scene.render.engine == 'CYCLES':
-                ccam = cam.cycles
-                col.prop(ccam, "panorama_type", text="Type")
-                if ccam.panorama_type == 'FISHEYE_EQUIDISTANT':
-                    col.prop(ccam, "fisheye_fov")
-                elif ccam.panorama_type == 'FISHEYE_EQUISOLID':
-                    row = layout.row()
-                    row.prop(ccam, "fisheye_lens", text="Lens")
-                    row.prop(ccam, "fisheye_fov")
+        col = layout.column()
+        col.enabled = cam.type == 'PERSP'
+
+        col.prop(cam, "use_panorama")
 
         split = layout.split()
 
index 6a7415f7cec5ee0c56fddd8c43bdb07423f262c1..b8a37e38a1721495856cfa7904503cdc93f68504 100644 (file)
@@ -173,11 +173,9 @@ class DATA_PT_geometry_curve(CurveButtonsPanel, Panel):
         col.label(text="Bevel Object:")
         col.prop(curve, "bevel_object", text="")
 
-        col = layout.column(align=True)
-        col.active = (curve.bevel_object is not None)
-        col.prop(curve, "use_fill_caps")
-        col.prop(curve, "bevel_factor_start")
-        col.prop(curve, "bevel_factor_end")
+        row = col.row()
+        row.active = (curve.bevel_object is not None)
+        row.prop(curve, "use_fill_caps")
 
 
 class DATA_PT_pathanim(CurveButtonsPanelCurve, Panel):
index bd3f087e38a686c67cc52e8f121e88615fd73e26..0b96ec772c83724f5441aa6c9baaa4aaddaecf1c 100644 (file)
@@ -84,11 +84,6 @@ class CLIP_HT_header(Header):
                 layout.label(text="Average solve error: %.4f" %
                     (r.average_error))
 
-            if sc.view == 'DOPESHEET':
-                layout.label(text="Sort by:")
-                layout.prop(sc, "dopesheet_sort_method", text="")
-                layout.prop(sc, "invert_dopesheet_sort", text="Invert")
-
         layout.template_running_jobs()
 
 
@@ -781,28 +776,27 @@ class CLIP_MT_view(Menu):
         layout = self.layout
         sc = context.space_data
 
-        if sc.view == 'CLIP':
-            layout.operator("clip.properties", icon='MENU_PANEL')
-            layout.operator("clip.tools", icon='MENU_PANEL')
-            layout.separator()
+        layout.prop(sc, "show_seconds")
+        layout.separator()
 
-            layout.operator("clip.view_selected")
-            layout.operator("clip.view_all")
+        layout.operator("clip.properties", icon='MENU_PANEL')
+        layout.operator("clip.tools", icon='MENU_PANEL')
+        layout.separator()
 
-            layout.separator()
-            layout.operator("clip.view_zoom_in")
-            layout.operator("clip.view_zoom_out")
+        layout.operator("clip.view_selected")
+        layout.operator("clip.view_all")
 
-            layout.separator()
+        layout.separator()
+        layout.operator("clip.view_zoom_in")
+        layout.operator("clip.view_zoom_out")
 
-            ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
+        layout.separator()
 
-            for a, b in ratios:
-                text = "Zoom %d:%d" % (a, b)
-                layout.operator("clip.view_zoom_ratio", text=text).ratio = a / b
-        else:
-            layout.prop(sc, "show_seconds")
-            layout.separator()
+        ratios = ((1, 8), (1, 4), (1, 2), (1, 1), (2, 1), (4, 1), (8, 1))
+
+        for a, b in ratios:
+            text = "Zoom %d:%d" % (a, b)
+            layout.operator("clip.view_zoom_ratio", text=text).ratio = a / b
 
         layout.separator()
         layout.operator("screen.area_dupli")
index dd752431df9efceca4f125b78b9978449e0bb028..a40e08c2e5c63d7ff973efe5042272353f46c185 100644 (file)
@@ -277,11 +277,6 @@ class TEXT_MT_edit(Menu):
 
         layout.separator()
 
-        layout.operator("text.move_lines_up")
-        layout.operator("text.move_lines_down")
-
-        layout.separator()
-
         layout.menu("TEXT_MT_edit_select")
         layout.menu("TEXT_MT_edit_markers")
 
index bf9b98583481e08f68cddcdcc268128e4d3c8661..cbe7975fdd6897a20d3be566d1fef0afc84c8967 100644 (file)
@@ -180,7 +180,7 @@ typedef struct FontBLF {
        /* max texture size. */
        int max_tex_size;
 
-       /* cache current OpenGL texture to save calls into the API */
+       /* current opengl texture  bind, avoids calling glGet */
        int tex_bind_state;
 
        /* font options. */
index a15192f156a904cbcdf9f6abd93e3a233f470e1d..3a28af97166234cc517c46ef526ac343ed21c93c 100644 (file)
@@ -664,22 +664,22 @@ void DM_update_weight_mcol(struct Object *ob, struct DerivedMesh *dm, int const
 typedef struct DMVertexAttribs {
        struct {
                struct MTFace *array;
-               int em_offset, gl_index, gl_texco;
+               int emOffset, glIndex, glTexco;
        } tface[MAX_MTFACE];
 
        struct {
                struct MCol *array;
-               int em_offset, gl_index;
+               int emOffset, glIndex;
        } mcol[MAX_MCOL];
 
        struct {
                float (*array)[4];
-               int em_offset, gl_index;
+               int emOffset, glIndex;
        } tang;
 
        struct {
                float (*array)[3];
-               int em_offset, gl_index, gl_texco;
+               int emOffset, glIndex, glTexco;
        } orco;
 
        int tottface, totmcol, tottang, totorco;
index 62f1dbc58676de9d3c325830807cfba145485acf..4ea38628001abb3212f2bceaf441c9d5e4748dd4 100644 (file)
@@ -42,7 +42,7 @@ extern "C" {
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION                        263
-#define BLENDER_SUBVERSION             4
+#define BLENDER_SUBVERSION             3
 
 #define BLENDER_MINVERSION             250
 #define BLENDER_MINSUBVERSION  0
index bd31a62abf914aa72a4f02ce0b07ddd49f3df268..acf39d83370c14a19263ee38610352598d248050 100644 (file)
@@ -103,10 +103,6 @@ typedef struct SculptSession {
 
        struct SculptStroke *stroke;
        struct StrokeCache *cache;
-
-       /* last paint/sculpt stroke location */
-       int last_stroke_valid;
-       float last_stroke[3];
 } SculptSession;
 
 void free_sculptsession(struct Object *ob);
index 875903f2e20afb89639d389a5163ef0146adc6aa..592b3d1d2e0f5f8f55e181a69fc9784d36fc17c5 100644 (file)
@@ -96,7 +96,6 @@ void  txt_unindent            (struct Text *text);
 void   txt_comment                     (struct Text *text);
 void   txt_indent                      (struct Text *text);
 void   txt_uncomment           (struct Text *text);
-void   txt_move_lines          (struct Text *text, const int direction);
 void   txt_duplicate_line      (struct Text *text);
 int    setcurr_tab_spaces      (struct Text *text, int space);
 
@@ -115,11 +114,6 @@ int text_check_digit(const char ch);
 int text_check_identifier(const char ch);
 int text_check_whitespace(const char ch);
 
-enum {
-       TXT_MOVE_LINE_UP   = -1,
-       TXT_MOVE_LINE_DOWN =  1
-};
-
 
 /* Undo opcodes */
 
@@ -176,9 +170,6 @@ enum {
 #define UNDO_COMMENT    034
 #define UNDO_UNCOMMENT  035
 
-#define UNDO_MOVE_LINES_UP      036
-#define UNDO_MOVE_LINES_DOWN    037
-
 #define UNDO_DUPLICATE  040
 
 /* Marker flags */
index 817cb477abad0173b57ea272e8c79350d66237b4..3b1a5dbfc8a36a62357a8cba4b188850dc310659 100644 (file)
@@ -165,8 +165,7 @@ void BKE_tracking_select_track(struct ListBase *tracksbase, struct MovieTracking
 void BKE_tracking_deselect_track(struct MovieTrackingTrack *track, int area);
 
 /* Dopesheet */
-void BKE_tracking_dopesheet_tag_update(struct MovieTracking *tracking);
-void BKE_tracking_dopesheet_update(struct MovieTracking *tracking, int sort_method, int inverse);
+void BKE_tracking_update_dopesheet(struct MovieTracking *tracking);
 
 #define TRACK_SELECTED(track)                          ((track)->flag&SELECT || (track)->pat_flag&SELECT || (track)->search_flag&SELECT)
 
@@ -179,7 +178,7 @@ void BKE_tracking_dopesheet_update(struct MovieTracking *tracking, int sort_meth
                                                 (((sc)->flag & SC_SHOW_MARKER_PATTERN) && TRACK_AREA_SELECTED(track, TRACK_AREA_PAT)) || \
                                                 (((sc)->flag & SC_SHOW_MARKER_SEARCH) && TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))))
 
-#define MARKER_VISIBLE(sc, track, marker)              (((marker)->flag & MARKER_DISABLED)==0 || ((sc)->flag & SC_HIDE_DISABLED)==0 || (sc->clip->tracking.act_track == track))
+#define MARKER_VISIBLE(sc, marker)                     (((marker)->flag & MARKER_DISABLED)==0 || ((sc)->flag & SC_HIDE_DISABLED)==0)
 
 #define TRACK_CLEAR_UPTO               0
 #define TRACK_CLEAR_REMAINED   1
@@ -198,9 +197,4 @@ void BKE_tracking_dopesheet_update(struct MovieTracking *tracking, int sort_meth
 
 #define TRACK_AREA_ALL         (TRACK_AREA_POINT|TRACK_AREA_PAT|TRACK_AREA_SEARCH)
 
-#define TRACK_SORT_NONE                -1
-#define TRACK_SORT_NAME                0
-#define TRACK_SORT_LONGEST     1
-#define TRACK_SORT_TOTAL       2
-
 #endif
index 2024a5ce09165d19732271d4a7dd6885fa200a07..c0bf798478c90110db70391d640c7afb343ee756 100644 (file)
@@ -2786,9 +2786,9 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
                                        a = attribs->tottface++;
 
                                        attribs->tface[a].array = tfdata->layers[layer].data;
-                                       attribs->tface[a].em_offset = tfdata->layers[layer].offset;
-                                       attribs->tface[a].gl_index = gattribs->layer[b].glindex;
-                                       attribs->tface[a].gl_texco = gattribs->layer[b].gltexco;
+                                       attribs->tface[a].emOffset = tfdata->layers[layer].offset;
+                                       attribs->tface[a].glIndex = gattribs->layer[b].glindex;
+                                       attribs->tface[a].glTexco = gattribs->layer[b].gltexco;
                                }
                        }
                        else {
@@ -2802,9 +2802,9 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
                                        a = attribs->tottface++;
 
                                        attribs->tface[a].array = tfdata->layers[layer].data;
-                                       attribs->tface[a].em_offset = tfdata->layers[layer].offset;
-                                       attribs->tface[a].gl_index = gattribs->layer[b].glindex;
-                                       attribs->tface[a].gl_texco = gattribs->layer[b].gltexco;
+                                       attribs->tface[a].emOffset = tfdata->layers[layer].offset;
+                                       attribs->tface[a].glIndex = gattribs->layer[b].glindex;
+                                       attribs->tface[a].glTexco = gattribs->layer[b].gltexco;
                                }
                        }
                }
@@ -2823,8 +2823,8 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
                                        a = attribs->totmcol++;
 
                                        attribs->mcol[a].array = tfdata->layers[layer].data;
-                                       attribs->mcol[a].em_offset = tfdata->layers[layer].offset;
-                                       attribs->mcol[a].gl_index = gattribs->layer[b].glindex;
+                                       attribs->mcol[a].emOffset = tfdata->layers[layer].offset;
+                                       attribs->mcol[a].glIndex = gattribs->layer[b].glindex;
                                }
                        }
                        else {
@@ -2839,8 +2839,8 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
                                        a = attribs->totmcol++;
 
                                        attribs->mcol[a].array = tfdata->layers[layer].data;
-                                       attribs->mcol[a].em_offset = tfdata->layers[layer].offset;
-                                       attribs->mcol[a].gl_index = gattribs->layer[b].glindex;
+                                       attribs->mcol[a].emOffset = tfdata->layers[layer].offset;
+                                       attribs->mcol[a].glIndex = gattribs->layer[b].glindex;
                                }
                        }
                }
@@ -2852,8 +2852,8 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
                                attribs->tottang = 1;
 
                                attribs->tang.array = fdata->layers[layer].data;
-                               attribs->tang.em_offset = fdata->layers[layer].offset;
-                               attribs->tang.gl_index = gattribs->layer[b].glindex;
+                               attribs->tang.emOffset = fdata->layers[layer].offset;
+                               attribs->tang.glIndex = gattribs->layer[b].glindex;
                        }
                }
                else if (gattribs->layer[b].type == CD_ORCO) {
@@ -2864,9 +2864,9 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
                                attribs->totorco = 1;
 
                                attribs->orco.array = vdata->layers[layer].data;
-                               attribs->orco.em_offset = vdata->layers[layer].offset;
-                               attribs->orco.gl_index = gattribs->layer[b].glindex;
-                               attribs->orco.gl_texco = gattribs->layer[b].gltexco;
+                               attribs->orco.emOffset = vdata->layers[layer].offset;
+                               attribs->orco.glIndex = gattribs->layer[b].glindex;
+                               attribs->orco.glTexco = gattribs->layer[b].gltexco;
                        }
                }
        }
index efede6bbae78617cbb673f4a67c92e92f8c58fdd..6aff331e1b48e5e837a8e5801d5befdfa1dc044a 100644 (file)
@@ -141,7 +141,7 @@ void BKE_camera_object_mode(RenderData *rd, Object *cam_ob)
        if (cam_ob && cam_ob->type==OB_CAMERA) {
                Camera *cam= cam_ob->data;
                if (cam->type == CAM_ORTHO) rd->mode |= R_ORTHO;
-               if (cam->type == CAM_PANO) rd->mode |= R_PANORAMA;
+               if (cam->flag & CAM_PANORAMA) rd->mode |= R_PANORAMA;
        }
 }
 
index 15db0df1bad5a75a3e9058ce649e47fbda0a2745..6fdaa3043cb440a573e6ea51723cab700dfb3e1a 100644 (file)
@@ -989,20 +989,20 @@ static void cddm_draw_attrib_vertex(DMVertexAttribs *attribs, MVert *mvert, int
 
        /* orco texture coordinates */
        if (attribs->totorco) {
-               if (attribs->orco.gl_texco)
+               if (attribs->orco.glTexco)
                        glTexCoord3fv(attribs->orco.array[index]);
                else
-                       glVertexAttrib3fvARB(attribs->orco.gl_index, attribs->orco.array[index]);
+                       glVertexAttrib3fvARB(attribs->orco.glIndex, attribs->orco.array[index]);
        }
 
        /* uv texture coordinates */
        for (b = 0; b < attribs->tottface; b++) {
                MTFace *tf = &attribs->tface[b].array[a];
 
-               if (attribs->tface[b].gl_texco)
+               if (attribs->tface[b].glTexco)
                        glTexCoord2fv(tf->uv[vert]);
                else
-                       glVertexAttrib2fvARB(attribs->tface[b].gl_index, tf->uv[vert]);
+                       glVertexAttrib2fvARB(attribs->tface[b].glIndex, tf->uv[vert]);
        }
 
        /* vertex colors */
@@ -1010,13 +1010,13 @@ static void cddm_draw_attrib_vertex(DMVertexAttribs *attribs, MVert *mvert, int
                MCol *cp = &attribs->mcol[b].array[a*4 + vert];
                GLubyte col[4];
                col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;
-               glVertexAttrib4ubvARB(attribs->mcol[b].gl_index, col);
+               glVertexAttrib4ubvARB(attribs->mcol[b].glIndex, col);
        }
 
        /* tangent for normal mapping */
        if (attribs->tottang) {
                float *tang = attribs->tang.array[a*4 + vert];
-               glVertexAttrib4fvARB(attribs->tang.gl_index, tang);
+               glVertexAttrib4fvARB(attribs->tang.glIndex, tang);
        }
 
        /* vertex normal */
@@ -1167,25 +1167,25 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
                                                DM_vertex_attributes_from_gpu(dm, &gattribs, &attribs);
 
                                                if (attribs.totorco) {
-                                                       datatypes[numdata].index = attribs.orco.gl_index;
+                                                       datatypes[numdata].index = attribs.orco.glIndex;
                                                        datatypes[numdata].size = 3;
                                                        datatypes[numdata].type = GL_FLOAT;
                                                        numdata++;
                                                }
                                                for (b = 0; b < attribs.tottface; b++) {
-                                                       datatypes[numdata].index = attribs.tface[b].gl_index;
+                                                       datatypes[numdata].index = attribs.tface[b].glIndex;
                                                        datatypes[numdata].size = 2;
                                                        datatypes[numdata].type = GL_FLOAT;
                                                        numdata++;
                                                }       
                                                for (b = 0; b < attribs.totmcol; b++) {
-                                                       datatypes[numdata].index = attribs.mcol[b].gl_index;
+                                                       datatypes[numdata].index = attribs.mcol[b].glIndex;
                                                        datatypes[numdata].size = 4;
                                                        datatypes[numdata].type = GL_UNSIGNED_BYTE;
                                                        numdata++;
                                                }       
                                                if (attribs.tottang) {
-                                                       datatypes[numdata].index = attribs.tang.gl_index;
+                                                       datatypes[numdata].index = attribs.tang.glIndex;
                                                        datatypes[numdata].size = 4;
                                                        datatypes[numdata].type = GL_FLOAT;
                                                        numdata++;
index 0f12b79e05dcdccaeba0c7a20d4670e378d1c8b0..771ba5e98a0be599a964910ace7f2e816c3dfcc4 100644 (file)
@@ -169,8 +169,6 @@ Curve *BKE_curve_add(const char *name, int type)
        cu->smallcaps_scale= 0.75f;
        cu->twist_mode= CU_TWIST_MINIMUM;       // XXX: this one seems to be the best one in most cases, at least for curve deform...
        cu->type= type;
-       cu->bevfac1= 0.0f;
-       cu->bevfac2= 1.0f;
        
        cu->bb= BKE_boundbox_alloc_unit();
        
index e32182ed36ef1740e5bfbbeabc3ce2f13f774d42..a6666bf4faef332e7b13c7e4ac6097064f17e71e 100644 (file)
@@ -586,7 +586,7 @@ static int layerEqual_mloopcol(void *data1, void *data2)
        b = m1->b - m2->b;
        a = m1->a - m2->a;
 
-       return r * r + g * g + b * b + a * a < 0.001f;
+       return r*r + g*g + b*b + a*a < 0.001;
 }
 
 static void layerMultiply_mloopcol(void *data, float fac)
@@ -2610,7 +2610,7 @@ const char *CustomData_layertype_name(int type)
 int CustomData_layertype_is_singleton(int type)
 {
        const LayerTypeInfo *typeInfo = layerType_getInfo(type);
-       return typeInfo->defaultname == NULL;
+       return typeInfo->defaultname != NULL;
 }
 
 static int  CustomData_is_property_layer(int type)
index 54655cf8582c56bd87aa498a7bdefb7ed94ae975..45298aa0b3b594e511f3d546a8e39d6b4be7e67a 100644 (file)
@@ -72,7 +72,6 @@
 #include "BKE_pointcache.h"
 #include "BKE_scene.h"
 #include "BKE_screen.h"
-#include "BKE_tracking.h"
 #include "BKE_utildefines.h"
 
 #include "depsgraph_private.h"
@@ -2581,10 +2580,6 @@ static void dag_id_flush_update(Scene *sce, ID *id)
                }
 
                if (idtype == ID_MC) {
-                       MovieClip *clip = (MovieClip *) id;
-
-                       BKE_tracking_dopesheet_tag_update(&clip->tracking);
-
                        for (obt=bmain->object.first; obt; obt= obt->id.next) {
                                bConstraint *con;
                                for (con = obt->constraints.first; con; con=con->next) {
index 04e559388ca3f749e540ff11bbed3877c555fc23..e7226a403bb5ebeba64d25f36adbd85dbcff0af1 100644 (file)
@@ -1220,11 +1220,10 @@ static void rotateBevelPiece(Curve *cu, BevPoint *bevp, DispList *dlb, float wid
        *data_r = data;
 }
 
-static void fillBevelCap(Nurb *nu, DispList *dlb, float *prev_fp, ListBase *dispbase)
+static void fillBevelCap(Curve *cu, Nurb *nu, BevPoint *bevp, DispList *dlb, float fac, float widfac, ListBase *dispbase)
 {
        DispList *dl;
        float *data;
-       int b;
 
        dl= MEM_callocN(sizeof(DispList), "makeDispListbev2");
        dl->verts= data= MEM_callocN(3*sizeof(float)*dlb->nr, "dlverts");
@@ -1240,8 +1239,7 @@ static void fillBevelCap(Nurb *nu, DispList *dlb, float *prev_fp, ListBase *disp
        /* CU_2D conflicts with R_NOPUNOFLIP */
        dl->rt= nu->flag & ~CU_2D;
 
-       for (b = 0; b < dlb->nr; b++, prev_fp += 3, data += 3)
-               copy_v3_v3(data, prev_fp);
+       rotateBevelPiece(cu, bevp, dlb, widfac, fac, &data);
 
        BLI_addtail(dispbase, dl);
 }
@@ -1334,26 +1332,9 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
                                                ListBase top_capbase = {NULL, NULL};
 
                                                for (dlb=dlbev.first; dlb; dlb=dlb->next) {
-                                                       int i, start, steps;
-                                                       float bevfac1 = MIN2(cu->bevfac1, cu->bevfac2), bevfac2 = MAX2(cu->bevfac1, cu->bevfac2);
-                                                       float firstblend = 0.0f, lastblend = 0.0f;
-
-                                                       if (cu->bevfac1 - cu->bevfac2 == 0.0f)
-                                                               continue;
-
-                                                       start = (int)(bevfac1*(bl->nr-1));
-                                                       steps = 2+(int)((bevfac2)*(bl->nr-1)) - start;
-                                                       firstblend = 1.0f - ((float)bevfac1*(bl->nr-1) - (int)((float)bevfac1*(bl->nr-1)));
-                                                       lastblend  = (float)bevfac2*(bl->nr-1) - (int)((float)bevfac2*(bl->nr-1));
-
-                                                       if (steps > bl->nr) {
-                                                               steps = bl->nr;
-                                                               lastblend = 1.0f;
-                                                       }
-
                                                        /* for each part of the bevel use a separate displblock */
                                                        dl= MEM_callocN(sizeof(DispList), "makeDispListbev1");
-                                                       dl->verts= data= MEM_callocN(3*sizeof(float)*dlb->nr*steps, "dlverts");
+                                                       dl->verts= data= MEM_callocN(3*sizeof(float)*dlb->nr*bl->nr, "dlverts");
                                                        BLI_addtail(dispbase, dl);
        
                                                        dl->type= DL_SURF;
@@ -1361,8 +1342,8 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
                                                        dl->flag= dlb->flag & (DL_FRONT_CURVE|DL_BACK_CURVE);
                                                        if (dlb->type==DL_POLY) dl->flag |= DL_CYCL_U;
                                                        if (bl->poly>=0) dl->flag |= DL_CYCL_V;
-
-                                                       dl->parts= steps;
+                                                       
+                                                       dl->parts= bl->nr;
                                                        dl->nr= dlb->nr;
                                                        dl->col= nu->mat_nr;
                                                        dl->charidx= nu->charidx;
@@ -1371,20 +1352,18 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
                                                        /* CU_2D conflicts with R_NOPUNOFLIP */
                                                        dl->rt= nu->flag & ~CU_2D;
 
-                                                       dl->bevelSplitFlag= MEM_callocN(sizeof(*dl->col2)*((steps+0x1F)>>5), "bevelSplitFlag");
+                                                       dl->bevelSplitFlag= MEM_callocN(sizeof(*dl->col2)*((bl->nr+0x1F)>>5), "bevelSplitFlag");
        
                                                        /* for each point of poly make a bevel piece */
-                                                       bevp= (BevPoint *)(bl+1) + start;
-                                                       for (i=start, a=0; a<steps; i++,bevp++,a++) {
+                                                       bevp= (BevPoint *)(bl+1);
+                                                       for (a=0; a<bl->nr; a++, bevp++) {
                                                                float fac=1.0;
-                                                               float *cur_data = data;
-
                                                                if (cu->taperobj==NULL) {
                                                                        if ( (cu->bevobj!=NULL) || !((cu->flag & CU_FRONT) || (cu->flag & CU_BACK)) )
                                                                                fac = bevp->radius;
                                                                }
                                                                else {
-                                                                       fac = calc_taper(scene, cu->taperobj, i, bl->nr);
+                                                                       fac = calc_taper(scene, cu->taperobj, a, bl->nr);
                                                                }
 
                                                                if (bevp->split_tag) {
@@ -1394,31 +1373,11 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
                                                                /* rotate bevel piece and write in data */
                                                                rotateBevelPiece(cu, bevp, dlb, widfac, fac, &data);
 
-                                                               if (a == 1 || a == steps - 1) {
-                                                                       float *cur_fp = cur_data, *prev_fp = cur_data - 3*dlb->nr;
-                                                                       int b;
-
-                                                                       for (b = 0; b < dlb->nr; b++, prev_fp += 3, cur_fp += 3) {
-                                                                               float cur[3], prev[3];
-
-                                                                               copy_v3_v3(cur, cur_fp);
-                                                                               copy_v3_v3(prev, prev_fp);
-
-                                                                               if (a == 1)
-                                                                                       interp_v3_v3v3(prev, cur_fp, prev_fp, firstblend);
-                                                                               if (a == steps - 1)
-                                                                                       interp_v3_v3v3(cur, prev_fp, cur_fp, lastblend);
-
-                                                                               copy_v3_v3(cur_fp, cur);
-                                                                               copy_v3_v3(prev_fp, prev);
-                                                                       }
-                                                               }
-
                                                                if (cu->bevobj && (cu->flag & CU_FILL_CAPS)) {
-                                                                       if (a == 1) 
-                                                                               fillBevelCap(nu, dlb, cur_data - 3*dlb->nr, &bottom_capbase);
-                                                                       if (a == steps - 1)
-                                                                               fillBevelCap(nu, dlb, cur_data, &top_capbase);
+                                                                       if (a == 0)
+                                                                               fillBevelCap(cu, nu, bevp, dlb, fac, widfac, &bottom_capbase);
+                                                                       else if (a == bl->nr - 1)
+                                                                               fillBevelCap(cu, nu, bevp, dlb, fac, widfac, &top_capbase);
                                                                }
                                                        }
 
index 428dc176e1de5abf21e91611706426a9dafee7ff..34794bd5b1f90bd0efac549088b50e1490e75b31 100644 (file)
@@ -150,7 +150,8 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
 
 #endif
 
-       BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+       f = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL);
+       for ( ; f; f=BM_iter_step(&iter)) {
                /*don't consider two-edged faces*/
                if (f->len < 3) {
                        /* do nothing */
@@ -356,18 +357,17 @@ static void emDM_foreachMappedVert(
         void (*func)(void *userData, int index, const float co[3], const float no_f[3], const short no_s[3]),
         void *userData)
 {
-       EditDerivedBMesh *bmdm= (EditDerivedBMesh *)dm;
+       EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
        BMVert *eve;
        BMIter iter;
        int i;
 
-       if (bmdm->vertexCos) {
-               BM_ITER_MESH_INDEX (eve, &iter, bmdm->tc->bm, BM_VERTS_OF_MESH, i) {
+       eve = BM_iter_new(&iter, bmdm->tc->bm, BM_VERTS_OF_MESH, NULL);
+       for (i=0; eve; i++, eve=BM_iter_step(&iter)) {
+               if (bmdm->vertexCos) {
                        func(userData, i, bmdm->vertexCos[i], bmdm->vertexNos[i], NULL);
                }
-       }
-       else {
-               BM_ITER_MESH_INDEX (eve, &iter, bmdm->tc->bm, BM_VERTS_OF_MESH, i) {
+               else {
                        func(userData, i, eve->co, eve->no, NULL);
                }
        }
@@ -377,7 +377,7 @@ static void emDM_foreachMappedEdge(
         void (*func)(void *userData, int index, const float v0co[3], const float v1co[3]),
         void *userData)
 {
-       EditDerivedBMesh *bmdm= (EditDerivedBMesh *)dm;
+       EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
        BMEdge *eed;
        BMIter iter;
        int i;
@@ -404,7 +404,7 @@ static void emDM_drawMappedEdges(
                DMSetDrawOptions setDrawOptions,
                void *userData)
 {
-       EditDerivedBMesh *bmdm= (EditDerivedBMesh *)dm;
+       EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
        BMEdge *eed;
        BMIter iter;
        int i;
@@ -449,7 +449,7 @@ static void emDM_drawMappedEdgesInterp(
                DMSetDrawInterpOptions setDrawInterpOptions,
                void *userData)
 {
-       EditDerivedBMesh *bmdm= (EditDerivedBMesh *)dm;
+       EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
        BMEdge *eed;
        BMIter iter;
        int i;
@@ -487,7 +487,7 @@ static void emDM_drawMappedEdgesInterp(
 
 static void emDM_drawUVEdges(DerivedMesh *dm)
 {
-       EditDerivedBMesh *bmdm= (EditDerivedBMesh *)dm;
+       EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
        BMEditMesh *em = bmdm->tc;
        BMFace *efa;
        BMIter iter;
@@ -557,7 +557,7 @@ static void emDM_foreachMappedFaceCenter(
         void (*func)(void *userData, int index, const float co[3], const float no[3]),
         void *userData)
 {
-       EditDerivedBMesh *bmdm= (EditDerivedBMesh *)dm;
+       EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
        float (*polyNos)[3] = NULL;
        BMFace *efa;
        BMIter iter;
@@ -572,7 +572,8 @@ static void emDM_foreachMappedFaceCenter(
                BLI_assert(polyNos != NULL);
        }
 
-       BM_ITER_MESH_INDEX (efa, &iter, bmdm->tc->bm, BM_FACES_OF_MESH, i) {
+       efa = BM_iter_new(&iter, bmdm->tc->bm, BM_FACES_OF_MESH, NULL);
+       for (i=0; efa; efa=BM_iter_step(&iter), i++) {
                emDM__calcFaceCent(bmdm->tc->bm, efa, cent, bmdm->vertexCos);
                func(userData, i, cent, polyNos ? polyNos[i] : efa->no);
        }
@@ -586,18 +587,18 @@ static void emDM_drawMappedFaces(
                void *userData,
                DMDrawFlag flag)
 {
-       EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
+       EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
        BMFace *efa;
-       struct BMLoop *(*looptris)[3] = bmdm->tc->looptris;
-       const int tottri = bmdm->tc->tottri;
-       const int lasttri = tottri - 1; /* compare agasint this a lot */
+       struct BMLoop *(*looptris)[3]= bmdm->tc->looptris;
+       const int tottri= bmdm->tc->tottri;
+       const int lasttri= tottri - 1; /* compare agasint this a lot */
        DMDrawOption draw_option;
        int i, flush;
-       const int skip_normals = !glIsEnabled(GL_LIGHTING); /* could be passed as an arg */
+       const int skip_normals= !glIsEnabled(GL_LIGHTING); /* could be passed as an arg */
 
        /* GL_ZERO is used to detect if drawing has started or not */
-       GLenum poly_prev = GL_ZERO;
-       GLenum shade_prev = GL_ZERO;
+       GLenum poly_prev= GL_ZERO;
+       GLenum shade_prev= GL_ZERO;
 
        (void)setMaterial; /* UNUSED */
 
@@ -606,29 +607,29 @@ static void emDM_drawMappedFaces(
 
        if (bmdm->vertexCos) {
                /* add direct access */
-               float (*vertexCos)[3] = bmdm->vertexCos;
-               float (*vertexNos)[3] = bmdm->vertexNos;
-               float (*polyNos)[3]   = bmdm->polyNos;
+               float (*vertexCos)[3]= bmdm->vertexCos;
+               float (*vertexNos)[3]= bmdm->vertexNos;
+               float (*polyNos)[3]=   bmdm->polyNos;
                // int *triPolyMap= bmdm->triPolyMap;
 
                BM_mesh_elem_index_ensure(bmdm->tc->bm, BM_VERT | BM_FACE);
 
-               for (i = 0; i < tottri; i++) {
+               for (i=0; i < tottri; i++) {
                        BMLoop **l = looptris[i];
                        int drawSmooth;
 
                        efa = l[0]->f;
-                       drawSmooth = (flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : BM_elem_flag_test(efa, BM_ELEM_SMOOTH);
+                       drawSmooth= (flag & DM_DRAW_ALWAYS_SMOOTH) ? 1 : BM_elem_flag_test(efa, BM_ELEM_SMOOTH);
 
                        draw_option = (!setDrawOptions ?
                                                   DM_DRAW_OPTION_NORMAL :
                                                   setDrawOptions(userData, BM_elem_index_get(efa)));
                        if (draw_option != DM_DRAW_OPTION_SKIP) {
-                               const GLenum poly_type = GL_TRIANGLES; /* BMESH NOTE, this is odd but keep it for now to match trunk */
+                               const GLenum poly_type= GL_TRIANGLES; /* BMESH NOTE, this is odd but keep it for now to match trunk */
                                if (draw_option == DM_DRAW_OPTION_STIPPLE) { /* enabled with stipple */
 
                                        if (poly_prev != GL_ZERO) glEnd();
-                                       poly_prev = GL_ZERO; /* force glBegin */
+                                       poly_prev= GL_ZERO; /* force glBegin */
 
                                        glEnable(GL_POLYGON_STIPPLE);
                                        glPolygonStipple(stipple_quarttone);
@@ -637,22 +638,22 @@ static void emDM_drawMappedFaces(
                                if (skip_normals) {
                                        if (poly_type != poly_prev) {
                                                if (poly_prev != GL_ZERO) glEnd();
-                                               glBegin((poly_prev = poly_type)); /* BMesh: will always be GL_TRIANGLES */
+                                               glBegin((poly_prev= poly_type)); /* BMesh: will always be GL_TRIANGLES */
                                        }
                                        glVertex3fv(vertexCos[BM_elem_index_get(l[0]->v)]);
                                        glVertex3fv(vertexCos[BM_elem_index_get(l[1]->v)]);
                                        glVertex3fv(vertexCos[BM_elem_index_get(l[2]->v)]);
                                }
                                else {
-                                       const GLenum shade_type = drawSmooth ? GL_SMOOTH : GL_FLAT;
+                                       const GLenum shade_type= drawSmooth ? GL_SMOOTH : GL_FLAT;
                                        if (shade_type != shade_prev) {
                                                if (poly_prev != GL_ZERO) glEnd();
-                                               glShadeModel((shade_prev = shade_type)); /* same as below but switch shading */
-                                               glBegin((poly_prev = poly_type)); /* BMesh: will always be GL_TRIANGLES */
+                                               glShadeModel((shade_prev= shade_type)); /* same as below but switch shading */
+                                               glBegin((poly_prev= poly_type)); /* BMesh: will always be GL_TRIANGLES */
                                        }
                                        if (poly_type != poly_prev) {
                                                if (poly_prev != GL_ZERO) glEnd();
-                                               glBegin((poly_prev = poly_type)); /* BMesh: will always be GL_TRIANGLES */
+                                               glBegin((poly_prev= poly_type)); /* BMesh: will always be GL_TRIANGLES */
                                        }
 
                                        if (!drawSmooth) {
@@ -671,13 +672,13 @@ static void emDM_drawMappedFaces(
                                        }
                                }
 
-                               flush = (draw_option == DM_DRAW_OPTION_STIPPLE);
+                               flush= (draw_option == DM_DRAW_OPTION_STIPPLE);
                                if (!skip_normals && !flush && (i != lasttri))
-                                       flush |= efa->mat_nr != looptris[i + 1][0]->f->mat_nr; /* TODO, make this neater */
+                                       flush|= efa->mat_nr != looptris[i + 1][0]->f->mat_nr; /* TODO, make this neater */
 
                                if (flush) {
                                        glEnd();
-                                       poly_prev = GL_ZERO; /* force glBegin */
+                                       poly_prev= GL_ZERO; /* force glBegin */
 
                                        glDisable(GL_POLYGON_STIPPLE);
                                }
@@ -698,11 +699,11 @@ static void emDM_drawMappedFaces(
                                                   DM_DRAW_OPTION_NORMAL :
                                                   setDrawOptions(userData, BM_elem_index_get(efa)));
                        if (draw_option != DM_DRAW_OPTION_SKIP) {
-                               const GLenum poly_type = GL_TRIANGLES; /* BMESH NOTE, this is odd but keep it for now to match trunk */
+                               const GLenum poly_type= GL_TRIANGLES; /* BMESH NOTE, this is odd but keep it for now to match trunk */
                                if (draw_option == DM_DRAW_OPTION_STIPPLE) { /* enabled with stipple */
 
                                        if (poly_prev != GL_ZERO) glEnd();
-                                       poly_prev = GL_ZERO; /* force glBegin */
+                                       poly_prev= GL_ZERO; /* force glBegin */
 
                                        glEnable(GL_POLYGON_STIPPLE);
                                        glPolygonStipple(stipple_quarttone);
@@ -711,22 +712,22 @@ static void emDM_drawMappedFaces(
                                if (skip_normals) {
                                        if (poly_type != poly_prev) {
                                                if (poly_prev != GL_ZERO) glEnd();
-                                               glBegin((poly_prev = poly_type)); /* BMesh: will always be GL_TRIANGLES */
+                                               glBegin((poly_prev= poly_type)); /* BMesh: will always be GL_TRIANGLES */
                                        }
                                        glVertex3fv(l[0]->v->co);
                                        glVertex3fv(l[1]->v->co);
                                        glVertex3fv(l[2]->v->co);
                                }
                                else {
-                                       const GLenum shade_type = drawSmooth ? GL_SMOOTH : GL_FLAT;
+                                       const GLenum shade_type= drawSmooth ? GL_SMOOTH : GL_FLAT;
                                        if (shade_type != shade_prev) {
                                                if (poly_prev != GL_ZERO) glEnd();
-                                               glShadeModel((shade_prev = shade_type)); /* same as below but switch shading */
-                                               glBegin((poly_prev = poly_type)); /* BMesh: will always be GL_TRIANGLES */
+                                               glShadeModel((shade_prev= shade_type)); /* same as below but switch shading */
+                                               glBegin((poly_prev= poly_type)); /* BMesh: will always be GL_TRIANGLES */
                                        }
                                        if (poly_type != poly_prev) {
                                                if (poly_prev != GL_ZERO) glEnd();
-                                               glBegin((poly_prev = poly_type)); /* BMesh: will always be GL_TRIANGLES */
+                                               glBegin((poly_prev= poly_type)); /* BMesh: will always be GL_TRIANGLES */
                                        }
 
                                        if (!drawSmooth) {
@@ -745,9 +746,9 @@ static void emDM_drawMappedFaces(
                                        }
                                }
 
-                               flush = (draw_option == DM_DRAW_OPTION_STIPPLE);
+                               flush= (draw_option == DM_DRAW_OPTION_STIPPLE);
                                if (!skip_normals && !flush && (i != lasttri)) {
-                                       flush |= efa->mat_nr != looptris[i + 1][0]->f->mat_nr; /* TODO, make this neater */
+                                       flush|= efa->mat_nr != looptris[i + 1][0]->f->mat_nr; /* TODO, make this neater */
                                }
 
                                if (flush) {
@@ -765,7 +766,7 @@ static void emDM_drawMappedFaces(
 }
 
 static void bmdm_get_tri_tex(BMesh *bm, BMLoop **ls, MLoopUV *luv[3], MLoopCol *lcol[3],
-                             int has_uv, int has_col)
+                                int has_uv, int has_col)
 {
        if (has_uv) {
                luv[0] = CustomData_bmesh_get(&bm->ldata, ls[0]->head.data, CD_MLOOPUV);
@@ -789,11 +790,11 @@ static void emDM_drawFacesTex_common(
                DMCompareDrawOptions compareDrawOptions,
                void *userData)
 {
-       EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
+       EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
        BMEditMesh *em = bmdm->tc;
-       BMesh *bm = bmdm->tc->bm;
-       float (*vertexCos)[3] = bmdm->vertexCos;
-       float (*vertexNos)[3] = bmdm->vertexNos;
+       BMesh *bm= bmdm->tc->bm;
+       float (*vertexCos)[3]= bmdm->vertexCos;
+       float (*vertexNos)[3]= bmdm->vertexNos;
        BMFace *efa;
        MLoopUV *luv[3], dummyluv = {{0}};
        MLoopCol *lcol[3] = {NULL}, dummylcol = {0};
@@ -814,12 +815,12 @@ static void emDM_drawFacesTex_common(
        if (vertexCos) {
                BM_mesh_elem_index_ensure(bm, BM_VERT);
 
-               for (i = 0; i < em->tottri; i++) {
+               for (i=0; i<em->tottri; i++) {
                        BMLoop **ls = em->looptris[i];
-                       MTexPoly *tp = has_uv ? CustomData_bmesh_get(&bm->pdata, ls[0]->f->head.data, CD_MTEXPOLY) : NULL;
+                       MTexPoly *tp= has_uv ? CustomData_bmesh_get(&bm->pdata, ls[0]->f->head.data, CD_MTEXPOLY) : NULL;
                        MTFace mtf = {{{0}}};
                        /*unsigned char *cp= NULL;*/ /*UNUSED*/
-                       int drawSmooth = BM_elem_flag_test(ls[0]->f, BM_ELEM_SMOOTH);
+                       int drawSmooth= BM_elem_flag_test(ls[0]->f, BM_ELEM_SMOOTH);
                        DMDrawOption draw_option;
 
                        efa = ls[0]->f;
@@ -829,11 +830,11 @@ static void emDM_drawFacesTex_common(
                        }
 
                        if (drawParams)
-                               draw_option = drawParams(&mtf, has_vcol, efa->mat_nr);
+                               draw_option= drawParams(&mtf, has_vcol, efa->mat_nr);
                        else if (drawParamsMapped)
-                               draw_option = drawParamsMapped(userData, BM_elem_index_get(efa));
+                               draw_option= drawParamsMapped(userData, BM_elem_index_get(efa));
                        else
-                               draw_option = DM_DRAW_OPTION_NORMAL;
+                               draw_option= DM_DRAW_OPTION_NORMAL;
 
                        if (draw_option != DM_DRAW_OPTION_SKIP) {
 
@@ -886,12 +887,12 @@ static void emDM_drawFacesTex_common(
        else {
                BM_mesh_elem_index_ensure(bm, BM_VERT);
 
-               for (i = 0; i < em->tottri; i++) {
+               for (i=0; i<em->tottri; i++) {
                        BMLoop **ls = em->looptris[i];
-                       MTexPoly *tp = has_uv ? CustomData_bmesh_get(&bm->pdata, ls[0]->f->head.data, CD_MTEXPOLY) : NULL;
+                       MTexPoly *tp= has_uv ? CustomData_bmesh_get(&bm->pdata, ls[0]->f->head.data, CD_MTEXPOLY) : NULL;
                        MTFace mtf = {{{0}}};
                        /*unsigned char *cp= NULL;*/ /*UNUSED*/
-                       int drawSmooth = BM_elem_flag_test(ls[0]->f, BM_ELEM_SMOOTH);
+                       int drawSmooth= BM_elem_flag_test(ls[0]->f, BM_ELEM_SMOOTH);
                        DMDrawOption draw_option;
 
                        efa = ls[0]->f;
@@ -901,11 +902,11 @@ static void emDM_drawFacesTex_common(
                        }
 
                        if (drawParams)
-                               draw_option = drawParams(&mtf, has_vcol, efa->mat_nr);
+                               draw_option= drawParams(&mtf, has_vcol, efa->mat_nr);
                        else if (drawParamsMapped)
-                               draw_option = drawParamsMapped(userData, BM_elem_index_get(efa));
+                               draw_option= drawParamsMapped(userData, BM_elem_index_get(efa));
                        else
-                               draw_option = DM_DRAW_OPTION_NORMAL;
+                               draw_option= DM_DRAW_OPTION_NORMAL;
 
                        if (draw_option != DM_DRAW_OPTION_SKIP) {
 
@@ -989,11 +990,11 @@ static void emDM_drawMappedFacesGLSL(
                DMSetDrawOptions setDrawOptions,
                void *userData)
 {
-       EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
-       BMesh *bm = bmdm->tc->bm;
+       EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
+       BMesh *bm= bmdm->tc->bm;
        BMEditMesh *em = bmdm->tc;
-       float (*vertexCos)[3] = bmdm->vertexCos;
-       float (*vertexNos)[3] = bmdm->vertexNos;
+       float (*vertexCos)[3]= bmdm->vertexCos;
+       float (*vertexNos)[3]= bmdm->vertexNos;
        BMFace *efa;
        BMLoop **ltri;
        DMVertexAttribs attribs;
@@ -1013,30 +1014,30 @@ static void emDM_drawMappedFacesGLSL(
 #define PASSATTRIB(loop, eve, vert) {                                                                                  \
        if (attribs.totorco) {                                                                                                          \
                float *orco = attribs.orco.array[BM_elem_index_get(eve)];                                               \
-               glVertexAttrib3fvARB(attribs.orco.gl_index, orco);                                              \
+               glVertexAttrib3fvARB(attribs.orco.glIndex, orco);                                               \
        }                                                                                                                                                       \
        for (b = 0; b < attribs.tottface; b++) {                                                                        \
                MLoopUV *_luv = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, CD_MLOOPUV, b);\
-               glVertexAttrib2fvARB(attribs.tface[b].gl_index, _luv->uv);                              \
+               glVertexAttrib2fvARB(attribs.tface[b].glIndex, _luv->uv);                               \
        }                                                                                                                                                       \
        for (b = 0; b < attribs.totmcol; b++) {                                                                         \
                MLoopCol *_cp = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, CD_MLOOPCOL, b);\
                GLubyte _col[4];                                                                                                                \
                _col[0]= _cp->b; _col[1]= _cp->g; _col[2]= _cp->r; _col[3]= _cp->a;             \
-               glVertexAttrib4ubvARB(attribs.mcol[b].gl_index, _col);                                  \
+               glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, _col);                                   \
        }                                                                                                                                                       \
        if (attribs.tottang) {                                                                                                          \
                float *tang = attribs.tang.array[i*4 + vert];                                                   \
-               glVertexAttrib3fvARB(attribs.tang.gl_index, tang);                                              \
+               glVertexAttrib3fvARB(attribs.tang.glIndex, tang);                                               \
        }                                                                                                                                                       \
        }
 
 
-       for (i = 0, ltri = em->looptris[0]; i < em->tottri; i++, ltri += 3) {
+       for (i=0, ltri=em->looptris[0]; i<em->tottri; i++, ltri += 3) {
                int drawSmooth;
 
                efa = ltri[0]->f;
-               drawSmooth = BM_elem_flag_test(efa, BM_ELEM_SMOOTH);
+               drawSmooth= BM_elem_flag_test(efa, BM_ELEM_SMOOTH);
 
                if (setDrawOptions && (setDrawOptions(userData, BM_elem_index_get(efa)) == DM_DRAW_OPTION_SKIP))
                        continue;
@@ -1115,14 +1116,14 @@ static void emDM_drawMappedFacesMat(
                void (*setMaterial)(void *userData, int, void *attribs),
                int (*setFace)(void *userData, int index), void *userData)
 {
-       EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
-       BMesh *bm = bmdm->tc->bm;
+       EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
+       BMesh *bm= bmdm->tc->bm;
        BMEditMesh *em = bmdm->tc;
-       float (*vertexCos)[3] = bmdm->vertexCos;
-       float (*vertexNos)[3] = bmdm->vertexNos;
+       float (*vertexCos)[3]= bmdm->vertexCos;
+       float (*vertexNos)[3]= bmdm->vertexNos;
        BMFace *efa;
        BMLoop **ltri;
-       DMVertexAttribs attribs = {{{0}}};
+       DMVertexAttribs attribs= {{{0}}};
        GPUVertexAttribs gattribs;
        int i, b, matnr, new_matnr;
 
@@ -1131,36 +1132,36 @@ static void emDM_drawMappedFacesMat(
        /* always use smooth shading even for flat faces, else vertex colors wont interpolate */
        glShadeModel(GL_SMOOTH);
 
-       BM_mesh_elem_index_ensure(bm, BM_VERT | BM_FACE);
+       BM_mesh_elem_index_ensure(bm, BM_VERT|BM_FACE);
 
 #define PASSATTRIB(loop, eve, vert) {                                                                                  \
        if (attribs.totorco) {                                                                                                          \
                float *orco = attribs.orco.array[BM_elem_index_get(eve)];                               \
-               if (attribs.orco.gl_texco)                                                                                              \
+               if (attribs.orco.glTexco)                                                                                               \
                        glTexCoord3fv(orco);                                                                                            \
                else                                                                                                                                    \
-                       glVertexAttrib3fvARB(attribs.orco.gl_index, orco);                                      \
+                       glVertexAttrib3fvARB(attribs.orco.glIndex, orco);                                       \
        }                                                                                                                                                       \
        for (b = 0; b < attribs.tottface; b++) {                                                                        \
                MLoopUV *_luv = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, CD_MLOOPUV, b);\
-               if (attribs.tface[b].gl_texco)                                                                                  \
+               if (attribs.tface[b].glTexco)                                                                                   \
                        glTexCoord2fv(_luv->uv);                                                                                        \
                else                                                                                                                                    \
-                       glVertexAttrib2fvARB(attribs.tface[b].gl_index, _luv->uv);                      \
+                       glVertexAttrib2fvARB(attribs.tface[b].glIndex, _luv->uv);                       \
        }                                                                                                                                                       \
        for (b = 0; b < attribs.totmcol; b++) {                                                                         \
                MLoopCol *_cp = CustomData_bmesh_get_n(&bm->ldata, loop->head.data, CD_MLOOPCOL, b);\
                GLubyte _col[4];                                                                                                                \
                _col[0]= _cp->b; _col[1]= _cp->g; _col[2]= _cp->r; _col[3]= _cp->a;             \
-               glVertexAttrib4ubvARB(attribs.mcol[b].gl_index, _col);                                  \
+               glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, _col);                                   \
        }                                                                                                                                                       \
        if (attribs.tottang) {                                                                                                          \
                float *tang = attribs.tang.array[i*4 + vert];                                                   \
-               glVertexAttrib4fvARB(attribs.tang.gl_index, tang);                                              \
+               glVertexAttrib4fvARB(attribs.tang.glIndex, tang);                                               \
        }                                                                                                                                                       \
 }
 
-       for (i = 0, ltri = em->looptris[0]; i < em->tottri; i++, ltri += 3) {
+       for (i=0, ltri=em->looptris[0]; i<em->tottri; i++, ltri += 3) {
                int drawSmooth;
 
                efa = ltri[0]->f;
@@ -1234,19 +1235,18 @@ static void emDM_drawMappedFacesMat(
 
 static void emDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3])
 {
-       EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
+       EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
        BMVert *eve;
        BMIter iter;
        int i;
 
        if (bmdm->tc->bm->totvert) {
-               if (bmdm->vertexCos) {
-                       BM_ITER_MESH_INDEX (eve, &iter, bmdm->tc->bm, BM_VERTS_OF_MESH, i) {
+               eve = BM_iter_new(&iter, bmdm->tc->bm, BM_VERTS_OF_MESH, NULL);
+               for (i=0; eve; eve=BM_iter_step(&iter), i++) {
+                       if (bmdm->vertexCos) {
                                DO_MINMAX(bmdm->vertexCos[i], min_r, max_r);
                        }
-               }
-               else {
-                       BM_ITER_MESH (eve, &iter, bmdm->tc->bm, BM_VERTS_OF_MESH) {
+                       else {
                                DO_MINMAX(eve->co, min_r, max_r);
                        }
                }
@@ -1258,35 +1258,35 @@ static void emDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3])
 }
 static int emDM_getNumVerts(DerivedMesh *dm)
 {
-       EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
+       EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
 
        return bmdm->tc->bm->totvert;
 }
 
 static int emDM_getNumEdges(DerivedMesh *dm)
 {
-       EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
+       EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
 
        return bmdm->tc->bm->totedge;
 }
 
 static int emDM_getNumTessFaces(DerivedMesh *dm)
 {
-       EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
+       EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
 
        return bmdm->tc->tottri;
 }
 
 static int emDM_getNumLoops(DerivedMesh *dm)
 {
-       EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
+       EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
 
        return bmdm->tc->bm->totloop;
 }
 
 static int emDM_getNumPolys(DerivedMesh *dm)
 {
-       EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
+       EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
 
        return bmdm->tc->bm->totface;
 }
@@ -1413,7 +1413,8 @@ static void emDM_copyEdgeArray(DerivedMesh *dm, MEdge *edge_r)
 
        BM_mesh_elem_index_ensure(bm, BM_VERT);
 
-       for (ee = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL); ee; ee = BM_iter_step(&iter), edge_r++) {
+       ee = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL);
+       for ( ; ee; ee=BM_iter_step(&iter), edge_r++) {
                if (has_bweight) {
                        edge_r->bweight = (unsigned char) (BM_elem_float_data_get(&bm->edata, ee, CD_BWEIGHT)*255.0f);
                }
@@ -1439,7 +1440,7 @@ static void emDM_copyTessFaceArray(DerivedMesh *dm, MFace *face_r)
 
        BM_mesh_elem_index_ensure(bm, BM_VERT);
 
-       for (i = 0; i < bmdm->tc->tottri; i++, face_r++) {
+       for (i=0; i<bmdm->tc->tottri; i++, face_r++) {
                l = bmdm->tc->looptris[i];
                ef = l[0]->f;
 
@@ -1498,8 +1499,8 @@ static void emDM_copyPolyArray(DerivedMesh *dm, MPoly *poly_r)
 
 static void *emDM_getTessFaceDataArray(DerivedMesh *dm, int type)
 {
-       EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
-       BMesh *bm = bmdm->tc->bm;
+       EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
+       BMesh *bm= bmdm->tc->bm;
        void *datalayer;
 
        datalayer = DM_get_tessface_data_layer(dm, type);
@@ -1552,26 +1553,27 @@ static void *emDM_getTessFaceDataArray(DerivedMesh *dm, int type)
 
 static void emDM_getVertCos(DerivedMesh *dm, float (*cos_r)[3])
 {
-       EditDerivedBMesh *emdm = (EditDerivedBMesh *)dm;
+       EditDerivedBMesh *emdm= (EditDerivedBMesh*) dm;
        BMVert *eve;
        BMIter iter;
        int i;
 
-       if (emdm->vertexCos) {
-               BM_ITER_MESH_INDEX (eve, &iter, emdm->tc->bm, BM_VERTS_OF_MESH, i) {
+       i= 0;
+       BM_ITER_MESH (eve, &iter, emdm->tc->bm, BM_VERTS_OF_MESH) {
+               if (emdm->vertexCos) {
                        copy_v3_v3(cos_r[i], emdm->vertexCos[i]);
                }
-       }
-       else {
-               BM_ITER_MESH_INDEX (eve, &iter, emdm->tc->bm, BM_VERTS_OF_MESH, i) {
+               else {
                        copy_v3_v3(cos_r[i], eve->co);
                }
+
+               i++;
        }
 }
 
 static void emDM_release(DerivedMesh *dm)
 {
-       EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
+       EditDerivedBMesh *bmdm= (EditDerivedBMesh *)dm;
 
        if (DM_release(dm)) {
                if (bmdm->vertexCos) {
@@ -1688,10 +1690,10 @@ DerivedMesh *getEditDerivedBMesh(
 
                DM_add_vert_layer(&bmdm->dm, CD_MDEFORMVERT, CD_CALLOC, NULL);
 
-               BM_ITER_MESH_INDEX (eve, &iter, bmdm->tc->bm, BM_VERTS_OF_MESH, i) {
+               eve = BM_iter_new(&iter, bmdm->tc->bm, BM_VERTS_OF_MESH, NULL);
+               for (i=0; eve; eve=BM_iter_step(&iter), i++)
                        DM_set_vert_data(&bmdm->dm, i, CD_MDEFORMVERT,
                                                         CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_MDEFORMVERT));
-               }
        }
 
        if (vertexCos) {
@@ -1706,13 +1708,16 @@ DerivedMesh *getEditDerivedBMesh(
                bmdm->vertexNos = MEM_callocN(sizeof(*bmdm->vertexNos) * bm->totvert, "bmdm_vno");
                bmdm->polyNos = MEM_mallocN(sizeof(*bmdm->polyNos)*bm->totface, "bmdm_pno");
 
-               BM_ITER_MESH_INDEX (efa, &fiter, bm, BM_FACES_OF_MESH, i) {
+               i = 0;
+               BM_ITER_MESH (efa, &fiter, bm, BM_FACES_OF_MESH) {
                        BM_elem_index_set(efa, i); /* set_inline */
                        BM_face_normal_update_vcos(bm, efa, bmdm->polyNos[i], (float const (*)[3])vertexCos);
+                       i++;
                }
                bm->elem_index_dirty &= ~BM_FACE;
 
-               BM_ITER_MESH_INDEX (eve, &viter, bm, BM_VERTS_OF_MESH, i) {
+               eve=BM_iter_new(&viter, bm, BM_VERTS_OF_MESH, NULL);
+               for (i=0; eve; eve=BM_iter_step(&viter), i++) {
                        float *no = bmdm->vertexNos[i];
                        BM_ITER_ELEM (efa, &fiter, eve, BM_FACES_OF_VERT) {
                                add_v3_v3(no, bmdm->polyNos[BM_elem_index_get(efa)]);
@@ -1720,14 +1725,14 @@ DerivedMesh *getEditDerivedBMesh(
 
                        /* following Mesh convention; we use vertex coordinate itself
                         * for normal in this case */
-                       if (normalize_v3(no) == 0.0f) {
+                       if (normalize_v3(no)==0.0) {
                                copy_v3_v3(no, vertexCos[i]);
                                normalize_v3(no);
                        }
                }
        }
 
-       return (DerivedMesh *)bmdm;
+       return (DerivedMesh*) bmdm;
 }
 
 /**
index 9be599ac66c32cd6d429f5cbed15fe2774965b55..9f7d76d251d0b4d0734f3d2d6bbd6df9a95527fb 100644 (file)
@@ -78,8 +78,7 @@ void initElbeemMesh(struct Scene *scene, struct Object *ob,
        int *tris;
 
        dm = mesh_create_derived_index_render(scene, ob, CD_MASK_BAREMESH, modifierIndex);
-
-       DM_ensure_tessface(dm);
+       //dm = mesh_create_derived_no_deform(ob,NULL);
 
        mvert = dm->getVertArray(dm);
        mface = dm->getTessFaceArray(dm);
@@ -123,4 +122,3 @@ void initElbeemMesh(struct Scene *scene, struct Object *ob,
 
        dm->release(dm);
 }
-
index ffc33e3b86a53cda878569c5a746ddd2be150e2a..f431b21b78c6b2f3e1f172290c02f0c0bd05600a 100644 (file)
@@ -2017,7 +2017,7 @@ static void bm_corners_to_loops(Mesh *me, int findex, int loopstart, int numTex,
                
                        for (i=0; i<tot; i++, disps += side*side, ld++) {
                                ld->totdisp = side*side;
-                               ld->level = (int)(logf(side - 1.0f) / (float)M_LN2) + 1;
+                               ld->level = (int)(logf(side - 1.0f) / M_LN2) + 1;
                        
                                if (ld->disps)
                                        MEM_freeN(ld->disps);
@@ -2769,20 +2769,64 @@ int BKE_mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
 static void mesh_calc_ngon_normal(MPoly *mpoly, MLoop *loopstart, 
                                   MVert *mvert, float normal[3])
 {
-       const int nverts = mpoly->totloop;
-       float const *v_prev = mvert[loopstart[nverts - 1].v].co;
-       float const *v_curr = mvert[loopstart->v].co;
-       float n[3] = {0.0f};
+
+       MVert *v1, *v2, *v3;
+       double u[3], v[3], w[3];
+       double n[3] = {0.0, 0.0, 0.0}, l;
        int i;
 
-       /* Newell's Method */
-       for (i = 0; i < nverts; v_prev = v_curr, v_curr = mvert[loopstart[++i].v].co) {
-               add_newell_cross_v3_v3v3(n, v_prev, v_curr);
+       for (i = 0; i < mpoly->totloop; i++) {
+               v1 = mvert + loopstart[i].v;
+               v2 = mvert + loopstart[(i+1)%mpoly->totloop].v;
+               v3 = mvert + loopstart[(i+2)%mpoly->totloop].v;
+               
+               copy_v3db_v3fl(u, v1->co);
+               copy_v3db_v3fl(v, v2->co);
+               copy_v3db_v3fl(w, v3->co);
+
+               /*this fixes some weird numerical error*/
+               if (i==0) {
+                       u[0] += 0.0001f;
+                       u[1] += 0.0001f;
+                       u[2] += 0.0001f;
+               }
+               
+               /* newell's method
+                * 
+                * so thats?:
+                * (a[1] - b[1]) * (a[2] + b[2]);
+                * a[1]*b[2] - b[1]*a[2] - b[1]*b[2] + a[1]*a[2]
+                * 
+                * odd.  half of that is the cross product. . .what's the
+                * other half?
+                * 
+                * also could be like a[1]*(b[2] + a[2]) - b[1]*(a[2] - b[2])
+                */
+
+               n[0] += (u[1] - v[1]) * (u[2] + v[2]);
+               n[1] += (u[2] - v[2]) * (u[0] + v[0]);
+               n[2] += (u[0] - v[0]) * (u[1] + v[1]);
        }
+       
+       l = n[0]*n[0]+n[1]*n[1]+n[2]*n[2];
+       l = sqrt(l);
+
+       if (l == 0.0) {
+               normal[0] = 0.0f;
+               normal[1] = 0.0f;
+               normal[2] = 1.0f;
 
-       if (UNLIKELY(normalize_v3_v3(normal, n) == 0.0f)) {
-               normal[2] = 1.0f; /* other axis set to 0.0 */
+               return;
        }
+       else l = 1.0f / l;
+
+       n[0] *= l;
+       n[1] *= l;
+       n[2] *= l;
+       
+       normal[0] = (float) n[0];
+       normal[1] = (float) n[1];
+       normal[2] = (float) n[2];
 }
 
 void mesh_calc_poly_normal(MPoly *mpoly, MLoop *loopstart, 
@@ -2816,20 +2860,54 @@ void mesh_calc_poly_normal(MPoly *mpoly, MLoop *loopstart,
 static void mesh_calc_ngon_normal_coords(MPoly *mpoly, MLoop *loopstart,
                                          const float (*vertex_coords)[3], float normal[3])
 {
-       const int nverts = mpoly->totloop;
-       float const *v_prev = vertex_coords[loopstart[nverts - 1].v];
-       float const *v_curr = vertex_coords[loopstart->v];
-       float n[3] = {0.0f};
+
+       const float *v1, *v2, *v3;
+       double u[3], v[3], w[3];
+       double n[3] = {0.0, 0.0, 0.0}, l;
        int i;
 
-       /* Newell's Method */
-       for (i = 0; i < nverts; v_prev = v_curr, v_curr = vertex_coords[loopstart[++i].v]) {
-               add_newell_cross_v3_v3v3(n, v_prev, v_curr);
+       for (i = 0; i < mpoly->totloop; i++) {
+               v1 = (const float *)(vertex_coords + loopstart[i].v);
+               v2 = (const float *)(vertex_coords + loopstart[(i+1)%mpoly->totloop].v);
+               v3 = (const float *)(vertex_coords + loopstart[(i+2)%mpoly->totloop].v);
+
+               copy_v3db_v3fl(u, v1);
+               copy_v3db_v3fl(v, v2);
+               copy_v3db_v3fl(w, v3);
+
+               /*this fixes some weird numerical error*/
+               if (i==0) {
+                       u[0] += 0.0001f;
+                       u[1] += 0.0001f;
+                       u[2] += 0.0001f;
+               }
+
+               n[0] += (u[1] - v[1]) * (u[2] + v[2]);
+               n[1] += (u[2] - v[2]) * (u[0] + v[0]);
+               n[2] += (u[0] - v[0]) * (u[1] + v[1]);
        }
 
-       if (UNLIKELY(normalize_v3_v3(normal, n) == 0.0f)) {
-               normal[2] = 1.0f; /* other axis set to 0.0 */
+       l = n[0]*n[0]+n[1]*n[1]+n[2]*n[2];
+       l = sqrt(l);
+
+       if (l == 0.0) {
+               normal[0] = 0.0f;
+               normal[1] = 0.0f;
+               normal[2] = 1.0f;
+
+               return;
+       }
+       else {
+               l = 1.0f / l;
        }
+
+       n[0] *= l;
+       n[1] *= l;
+       n[2] *= l;
+
+       normal[0] = (float) n[0];
+       normal[1] = (float) n[1];
+       normal[2] = (float) n[2];
 }
 
 void BKE_mesh_calc_poly_normal_coords(MPoly *mpoly, MLoop *loopstart,
index 849dbd83366b9c156f4c1e23bffd9f8725898a35..964a20659e07d4975dfbc5527c9a1c340a1e1893 100644 (file)
@@ -155,7 +155,7 @@ static void get_sequence_fname(MovieClip *clip, int framenr, char *name)
 
        /* movieclips always points to first image from sequence,
         * autoguess offset for now. could be something smarter in the future */
-       offset = sequence_guess_offset(clip->name, strlen(head), numlen);
+       offset= sequence_guess_offset(clip->name, strlen(head), numlen);
 
        if (numlen)
                BLI_stringenc(name, head, tail, numlen, offset + framenr - 1);
@@ -195,7 +195,7 @@ static ImBuf *movieclip_load_sequence_file(MovieClip *clip, MovieClipUser *user,
 {
        struct ImBuf *ibuf;
        char name[FILE_MAX];
-       int loadflag, use_proxy = 0;
+       int loadflag, use_proxy= 0;
 
        use_proxy = (flag & MCLIP_USE_PROXY) && user->render_size != MCLIP_PROXY_RENDER_SIZE_FULL;
        if (use_proxy) {
@@ -432,7 +432,7 @@ static MovieClip *movieclip_alloc(const char *name)
 
        clip = BKE_libblock_alloc(&G.main->movieclip, ID_MC, name);
 
-       clip->aspx = clip->aspy = 1.0f;
+       clip->aspx = clip->aspy= 1.0f;
 
        BKE_tracking_init_settings(&clip->tracking);
 
@@ -660,7 +660,7 @@ static ImBuf *put_postprocessed_frame_to_cache(MovieClip *clip, MovieClipUser *u
                copy_v2_v2(cache->postprocessed.principal, camera->principal);
                copy_v3_v3(&cache->postprocessed.k1, &camera->k1);
                cache->postprocessed.undistoriton_used = TRUE;
-               postproc_ibuf = get_undistorted_ibuf(clip, NULL, ibuf);
+               postproc_ibuf= get_undistorted_ibuf(clip, NULL, ibuf);
        }
        else {
                cache->postprocessed.undistoriton_used = FALSE;
@@ -704,14 +704,14 @@ static ImBuf *movieclip_get_postprocessed_ibuf(MovieClip *clip, MovieClipUser *u
 
        /* try to obtain cached postprocessed frame first */
        if (need_postprocessed_frame(user, flag, postprocess_flag)) {
-               ibuf = get_postprocessed_cached_frame(clip, user, flag, postprocess_flag);
+               ibuf= get_postprocessed_cached_frame(clip, user, flag, postprocess_flag);
 
                if (!ibuf)
                        need_postprocess = TRUE;
        }
 
        if (!ibuf)
-               ibuf = get_imbuf_cache(clip, user, flag);
+               ibuf= get_imbuf_cache(clip, user, flag);
 
        if (!ibuf) {
                int use_sequence = FALSE;
@@ -825,7 +825,7 @@ static ImBuf *put_stabilized_frame_to_cache(MovieClip *clip, MovieClipUser *user
 
        stableibuf = BKE_tracking_stabilize(&clip->tracking, framenr, ibuf, tloc, &tscale, &tangle);
 
-       cache->stabilized.ibuf = stableibuf;
+       cache->stabilized.ibuf= stableibuf;
 
        copy_v2_v2(cache->stabilized.loc, tloc);
 
@@ -862,7 +862,7 @@ ImBuf *BKE_movieclip_get_stable_ibuf(MovieClip *clip, MovieClipUser *user, float
                return NULL;
 
        if (clip->tracking.stabilization.flag & TRACKING_2D_STABILIZATION) {
-               MovieClipCache *cache = clip->cache;
+               MovieClipCache *cache= clip->cache;
 
                stableibuf = get_stable_cached_frame(clip, user, framenr, postprocess_flag);
 
@@ -873,20 +873,20 @@ ImBuf *BKE_movieclip_get_stable_ibuf(MovieClip *clip, MovieClipUser *user, float
                        copy_v2_v2(loc, cache->stabilized.loc);
 
                if (scale)
-                       *scale = cache->stabilized.scale;
+                       *scale= cache->stabilized.scale;
 
                if (angle)
-                       *angle = cache->stabilized.angle;
+                       *angle= cache->stabilized.angle;
        }
        else {
                if (loc)
                        zero_v2(loc);
 
                if (scale)
-                       *scale = 1.0f;
+                       *scale= 1.0f;
 
                if (angle)
-                       *angle = 0.0f;
+                       *angle= 0.0f;
 
                stableibuf = ibuf;
        }
@@ -1044,7 +1044,7 @@ void BKE_movieclip_update_scopes(MovieClip *clip, MovieClipUser *user, MovieClip
 
                                        if (user->render_flag & MCLIP_PROXY_RENDER_UNDISTORT) {
                                                int width, height;
-                                               float aspy = 1.0f / clip->tracking.camera.pixel_aspect;
+                                               float aspy= 1.0f / clip->tracking.camera.pixel_aspect;
 
                                                BKE_movieclip_get_size(clip, user, &width, &height);
 
@@ -1058,14 +1058,14 @@ void BKE_movieclip_update_scopes(MovieClip *clip, MovieClipUser *user, MovieClip
                                        }
 
                                        /* NOTE: margin should be kept in sync with value from ui_draw_but_TRACKPREVIEW */
-                                       tmpibuf = BKE_tracking_get_pattern_imbuf(ibuf, track, &undist_marker, 3 /* margin */,
+                                       tmpibuf= BKE_tracking_get_pattern_imbuf(ibuf, track, &undist_marker, 3 /* margin */,
                                                        1 /* anchor */, scopes->track_pos, NULL);
 
                                        if (tmpibuf->rect_float)
                                                IMB_rect_from_float(tmpibuf);
 
                                        if (tmpibuf->rect)
-                                               scopes->track_preview = tmpibuf;
+                                               scopes->track_preview= tmpibuf;
                                        else
                                                IMB_freeImBuf(tmpibuf);
                                }
index 1057b027d1b3fcbf9371c510b419ddcb9d21cb0e..fae96a732a7237a96fc02e843e62539b17eae81f 100644 (file)
@@ -772,9 +772,6 @@ Object *BKE_object_add_only_object(int type, const char *name)
 {
        Object *ob;
 
-       if(!name)
-               name = get_obdata_defname(type);
-
        ob= BKE_libblock_alloc(&G.main->object, ID_OB, name);
 
        /* default object vars */
index 950298f382468b3e4a4ca8fb0cd0a1d222d58691..2af1645bba50b83139f84b28639e40dbe4c66e1f 100644 (file)
@@ -1064,7 +1064,6 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
                if (part->distr==PART_DISTR_GRID && from != PART_FROM_VERT) {
                        BLI_srandom(31415926 + psys->seed);
                        dm= CDDM_from_mesh((Mesh*)ob->data, ob);
-                       DM_ensure_tessface(dm);
                        distribute_grid(dm, psys);
                        dm->release(dm);
                        return 0;
index 37d7cc06fe74f6d7582a61492d8524c3cc4c3a3a..2526bd058576b0bb71752c56b202d5d39b8e07f3 100644 (file)
@@ -888,6 +888,8 @@ void BKE_scene_base_deselect_all(Scene *sce)
 
 void BKE_scene_base_select(Scene *sce, Base *selbase)
 {
+       scene_deselect_all(sce);
+
        selbase->flag |= SELECT;
        selbase->object->flag= selbase->flag;
 
index 857a0c86349996fd1489884e4a6a2448af04d62b..99880cd659f3e2ae9ac44128fb3357df2b21c940 100644 (file)
@@ -1718,21 +1718,21 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
 #define PASSATTRIB(dx, dy, vert) {                                              \
        if (attribs.totorco) {                                                      \
                index = getFaceIndex(ss, f, S, x + dx, y + dy, edgeSize, gridSize);     \
-               glVertexAttrib3fvARB(attribs.orco.gl_index, attribs.orco.array[index]);  \
+               glVertexAttrib3fvARB(attribs.orco.glIndex, attribs.orco.array[index]);  \
        }                                                                           \
        for (b = 0; b < attribs.tottface; b++) {                                    \
                MTFace *tf = &attribs.tface[b].array[a];                                \
-               glVertexAttrib2fvARB(attribs.tface[b].gl_index, tf->uv[vert]);           \
+               glVertexAttrib2fvARB(attribs.tface[b].glIndex, tf->uv[vert]);           \
        }                                                                           \
        for (b = 0; b < attribs.totmcol; b++) {                                     \
                MCol *cp = &attribs.mcol[b].array[a * 4 + vert];                        \
                GLubyte col[4];                                                         \
                col[0] = cp->b; col[1] = cp->g; col[2] = cp->r; col[3] = cp->a;         \
-               glVertexAttrib4ubvARB(attribs.mcol[b].gl_index, col);                    \
+               glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col);                    \
        }                                                                           \
        if (attribs.tottang) {                                                      \
                float *tang = attribs.tang.array[a * 4 + vert];                         \
-               glVertexAttrib4fvARB(attribs.tang.gl_index, tang);                       \
+               glVertexAttrib4fvARB(attribs.tang.glIndex, tang);                       \
        }                                                                           \
 }
 
@@ -1863,27 +1863,27 @@ static void ccgDM_drawMappedFacesMat(DerivedMesh *dm, void (*setMaterial)(void *
 #define PASSATTRIB(dx, dy, vert) {                                              \
        if (attribs.totorco) {                                                      \
                index = getFaceIndex(ss, f, S, x + dx, y + dy, edgeSize, gridSize);     \
-               if (attribs.orco.gl_texco)                                               \
+               if (attribs.orco.glTexco)                                               \
                        glTexCoord3fv(attribs.orco.array[index]);                           \
                else                                                                    \
-                       glVertexAttrib3fvARB(attribs.orco.gl_index, attribs.orco.array[index]);  \
+                       glVertexAttrib3fvARB(attribs.orco.glIndex, attribs.orco.array[index]);  \
        }                                                                           \
        for (b = 0; b < attribs.tottface; b++) {                                    \
                MTFace *tf = &attribs.tface[b].array[a];                                \
-               if (attribs.tface[b].gl_texco)                                           \
+               if (attribs.tface[b].glTexco)                                           \
                        glTexCoord2fv(tf->uv[vert]);                                        \
                else                                                                    \
-                       glVertexAttrib2fvARB(attribs.tface[b].gl_index, tf->uv[vert]);       \
+                       glVertexAttrib2fvARB(attribs.tface[b].glIndex, tf->uv[vert]);       \
        }                                                                           \
        for (b = 0; b < attribs.totmcol; b++) {                                     \
                MCol *cp = &attribs.mcol[b].array[a * 4 + vert];                        \
                GLubyte col[4];                                                         \
                col[0] = cp->b; col[1] = cp->g; col[2] = cp->r; col[3] = cp->a;         \
-               glVertexAttrib4ubvARB(attribs.mcol[b].gl_index, col);                    \
+               glVertexAttrib4ubvARB(attribs.mcol[b].glIndex, col);                    \
        }                                                                           \
        if (attribs.tottang) {                                                      \
                float *tang = attribs.tang.array[a * 4 + vert];                         \
-               glVertexAttrib4fvARB(attribs.tang.gl_index, tang);                       \
+               glVertexAttrib4fvARB(attribs.tang.glIndex, tang);                       \
        }                                                                           \
 }
 
index e3e4f663e2765ac45365052b4cb8ba802bb4158c..b4b4e0f623c71a6fd3b83ce9748092c7b1d03b43 100644 (file)
@@ -2129,7 +2129,7 @@ void txt_do_undo(Text *text)
                case UNDO_IBLOCK:
                        linep= txt_undo_read_uint32(text->undo_buf, &text->undo_pos);
                        txt_delete_sel(text);
-                       
+
                        /* txt_backspace_char removes utf8-characters, not bytes */
                        buf= MEM_mallocN(linep+1, "iblock buffer");
                        for (i=0; i < linep; i++) {
@@ -2139,19 +2139,19 @@ void txt_do_undo(Text *text)
                        buf[i]= 0;
                        linep= txt_utf8_len(buf);
                        MEM_freeN(buf);
-                       
+
                        while (linep>0) {
                                txt_backspace_char(text);
                                linep--;
                        }
-                       
+
                        text->undo_pos--;
                        text->undo_pos--;
                        text->undo_pos--; 
                        text->undo_pos--;
                        
                        text->undo_pos--;
-                       
+
                        break;
                case UNDO_INDENT:
                case UNDO_UNINDENT:
@@ -2169,7 +2169,7 @@ void txt_do_undo(Text *text)
                        for (i= 0; i < linep; i++) {
                                text->sell = text->sell->next;
                        }
-                       
+
                        linep= txt_undo_read_uint32(text->undo_buf, &text->undo_pos);
                        //first line to be selected
                        
@@ -2180,7 +2180,7 @@ void txt_do_undo(Text *text)
                        for (i = 0; i < linep; i++) {
                                text->curl = text->curl->next;
                        }
-                       
+
                        
                        if (op==UNDO_INDENT) {
                                txt_unindent(text);
@@ -2194,18 +2194,12 @@ void txt_do_undo(Text *text)
                        else if (op == UNDO_UNCOMMENT) {
                                txt_comment(text);
                        }
-                       
+
                        text->undo_pos--;
                        break;
                case UNDO_DUPLICATE:
                        txt_delete_line(text, text->curl->next);
                        break;
-               case UNDO_MOVE_LINES_UP:
-                       txt_move_lines(text, TXT_MOVE_LINE_DOWN);
-                       break;
-               case UNDO_MOVE_LINES_DOWN:
-                       txt_move_lines(text, TXT_MOVE_LINE_UP);
-                       break;
                default:
                        //XXX error("Undo buffer error - resetting");
                        text->undo_pos= -1;
@@ -2406,16 +2400,10 @@ void txt_do_redo(Text *text)
                case UNDO_DUPLICATE:
                        txt_duplicate_line(text);
                        break;
-               case UNDO_MOVE_LINES_UP:
-                       txt_move_lines(text, TXT_MOVE_LINE_UP);
-                       break;
-               case UNDO_MOVE_LINES_DOWN:
-                       txt_move_lines(text, TXT_MOVE_LINE_DOWN);
-                       break;
                default:
                        //XXX error("Undo buffer error - resetting");
                        text->undo_pos= -1;
-                       
+
                        break;
        }
        
@@ -3045,61 +3033,6 @@ void txt_uncomment(Text *text)
        }
 }
 
-
-void txt_move_lines_up(struct Text *text)
-{
-       TextLine *prev_line;
-       
-       if (!text || !text->curl || !text->sell) return;
-       
-       txt_order_cursors(text);
-       
-       prev_line= text->curl->prev;
-       
-       if (!prev_line) return;
-       
-       BLI_remlink(&text->lines, prev_line);
-       BLI_insertlinkafter(&text->lines, text->sell, prev_line);
-       
-       txt_make_dirty(text);
-       txt_clean_text(text);
-       
-       if (!undoing) {
-               txt_undo_add_op(text, UNDO_MOVE_LINES_UP);
-       }
-}
-
-void txt_move_lines(struct Text *text, const int direction)
-{
-       TextLine *line_other;
-
-       BLI_assert(ELEM(direction, TXT_MOVE_LINE_UP, TXT_MOVE_LINE_DOWN));
-
-       if (!text || !text->curl || !text->sell) return;
-       
-       txt_order_cursors(text);
-
-       line_other =  (direction == TXT_MOVE_LINE_DOWN) ? text->sell->next : text->curl->prev;
-       
-       if (!line_other) return;
-               
-       BLI_remlink(&text->lines, line_other);
-
-       if (direction == TXT_MOVE_LINE_DOWN) {
-               BLI_insertlinkbefore(&text->lines, text->curl, line_other);
-       }
-       else {
-               BLI_insertlinkafter(&text->lines, text->sell, line_other);
-       }
-
-       txt_make_dirty(text);
-       txt_clean_text(text);
-       
-       if (!undoing) {
-               txt_undo_add_op(text, (direction == TXT_MOVE_LINE_DOWN) ? UNDO_MOVE_LINES_DOWN : UNDO_MOVE_LINES_UP);
-       }
-}
-
 int setcurr_tab_spaces(Text *text, int space)
 {
        int i = 0;
index b68102885eaa9cf2aca4c02d9a279693bf99258d..760743aafeb82f9436fca03e510045144bf29e8b 100644 (file)
@@ -107,7 +107,7 @@ void BKE_tracking_clamp_track(MovieTrackingTrack *track, int event)
        float max_pyramid_level_factor = 1.0;
 
        if (track->tracker == TRACKER_KLT) {
-               max_pyramid_level_factor = 1 << (track->pyramid_levels - 1);
+               max_pyramid_level_factor= 1 << (track->pyramid_levels - 1);
        }
 
        /* sort */
@@ -277,7 +277,7 @@ MovieTrackingTrack *BKE_tracking_add_track(MovieTracking *tracking, ListBase *tr
 
 MovieTrackingMarker *BKE_tracking_insert_marker(MovieTrackingTrack *track, MovieTrackingMarker *marker)
 {
-       MovieTrackingMarker *old_marker = NULL;
+       MovieTrackingMarker *old_marker= NULL;
 
        if (track->markersnr)
                old_marker = BKE_tracking_exact_marker(track, marker->framenr);
@@ -313,7 +313,7 @@ MovieTrackingMarker *BKE_tracking_insert_marker(MovieTrackingTrack *track, Movie
 
 void BKE_tracking_delete_marker(MovieTrackingTrack *track, int framenr)
 {
-       int a = 0;
+       int a= 0;
 
        while (a<track->markersnr) {
                if (track->markers[a].framenr == framenr) {
@@ -464,7 +464,7 @@ void BKE_tracking_clear_path(MovieTrackingTrack *track, int ref_frame, int actio
                        put_disabled_marker(track, &track->markers[track->markersnr-1], 0, 1);
        }
        else if (action == TRACK_CLEAR_UPTO) {
-               a = track->markersnr-1;
+               a= track->markersnr-1;
 
                while (a >= 0) {
                        if (track->markers[a].framenr <= ref_frame) {
@@ -634,20 +634,7 @@ static void tracking_objects_free(ListBase *objects)
 
 static void tracking_dopesheet_free(MovieTrackingDopesheet *dopesheet)
 {
-       MovieTrackingDopesheetChannel *channel;
-
-       channel = dopesheet->channels.first;
-       while (channel) {
-               if (channel->segments) {
-                       MEM_freeN(channel->segments);
-               }
-
-               channel = channel->next;
-       }
-
        BLI_freelistN(&dopesheet->channels);
-
-       dopesheet->channels.first = dopesheet->channels.last = NULL;
        dopesheet->tot_channel = 0;
 }
 
@@ -701,8 +688,6 @@ void BKE_tracking_clipboard_copy_tracks(MovieTracking *tracking, MovieTrackingOb
        ListBase *tracksbase = BKE_tracking_object_tracks(tracking, object);
        MovieTrackingTrack *track = tracksbase->first;
 
-       BKE_tracking_free_clipboard();
-
        while (track) {
                if (TRACK_SELECTED(track) && (track->flag & TRACK_HIDDEN) == 0) {
                        MovieTrackingTrack *new_track = duplicate_track(track);
@@ -786,7 +771,7 @@ static void tracks_map_get(TracksMap *map, int index, MovieTrackingTrack **track
 
 static void tracks_map_insert(TracksMap *map, MovieTrackingTrack *track, void *customdata)
 {
-       MovieTrackingTrack new_track = *track;
+       MovieTrackingTrack new_track= *track;
 
        new_track.markers = MEM_dupallocN(new_track.markers);
 
@@ -866,10 +851,10 @@ static void tracks_map_merge(TracksMap *map, MovieTracking *tracking)
                BLI_ghash_insert(map->hash, track, new_track);
 
                if (replace_sel)                /* update current selection in clip */
-                       tracking->act_track = new_track;
+                       tracking->act_track= new_track;
 
                if (replace_rot)                /* update track used for rotation stabilization */
-                       tracking->stabilization.rot_track = new_track;
+                       tracking->stabilization.rot_track= new_track;
 
                BLI_addtail(&tracks, new_track);
        }
@@ -882,7 +867,7 @@ static void tracks_map_merge(TracksMap *map, MovieTracking *tracking)
                track->next = track->prev = NULL;
                BLI_addtail(&new_tracks, track);
 
-               track = next;
+               track= next;
        }
 
        /* now move all tracks which are currently operating and keep their names unique */
@@ -897,15 +882,15 @@ static void tracks_map_merge(TracksMap *map, MovieTracking *tracking)
 
                BLI_uniquename(&new_tracks, track, "Track", '.', offsetof(MovieTrackingTrack, name), sizeof(track->name));
 
-               track = next;
+               track= next;
        }
 
-       *old_tracks = new_tracks;
+       *old_tracks= new_tracks;
 }
 
 static void tracks_map_free(TracksMap *map, void (*customdata_free) (void *customdata))
 {
-       int i = 0;
+       int i= 0;
 
        BLI_ghash_free(map->hash, NULL, NULL);
 
@@ -1021,7 +1006,7 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
                                                 * than the search size */
                                                int level = MIN2(track->pyramid_levels, max_pyramid_levels);
 
-                                               if (track->tracker == TRACKER_KLT) {
+                                               if (track->tracker==TRACKER_KLT) {
                                                        track_context.region_tracker =
                                                                libmv_pyramidRegionTrackerNew(100, level, half_wnd, track->minimum_correlation);
                                                }
@@ -1030,7 +1015,7 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
                                                                libmv_hybridRegionTrackerNew(100, half_wnd, track->minimum_correlation);
                                                }
                                                else if (track->tracker == TRACKER_SAD) {
-                                                       track_context.region_tracker = libmv_bruteRegionTrackerNew(MAX2(wndx, wndy), track->minimum_correlation);
+                                                       track_context.region_tracker= libmv_bruteRegionTrackerNew(MAX2(wndx, wndy), track->minimum_correlation);
                                                }
                                        }
 #endif
@@ -1053,7 +1038,7 @@ MovieTrackingContext *BKE_tracking_context_new(MovieClip *clip, MovieClipUser *u
         * - MCLIP_USE_PROXY_CUSTOM_DIR is needed because proxy/timecode files might
         *   be stored in a different location
         * ignore all the rest possible flags for now */
-       context->clip_flag = clip->flag & MCLIP_TIMECODE_FLAGS;
+       context->clip_flag = clip->flag&MCLIP_TIMECODE_FLAGS;
 
        context->user = *user;
        context->user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL;
@@ -1321,7 +1306,7 @@ static ImBuf *get_keyframed_ibuf(MovieTrackingContext *context, MovieTrackingTra
                MovieTrackingMarker *next_marker = NULL;
 
                if (next>=0 && next<track->markersnr)
-                       next_marker = &track->markers[next];
+                       next_marker= &track->markers[next];
 
                /* if next mrker is disabled, stop searching keyframe and use current frame as keyframe */
                if (next_marker && next_marker->flag & MARKER_DISABLED)
@@ -1376,7 +1361,7 @@ void BKE_tracking_sync(MovieTrackingContext *context)
 
        context->sync_frame = newframe;
 
-       tracking->dopesheet.ok = FALSE;
+       BKE_tracking_update_dopesheet(tracking);
 }
 
 void BKE_tracking_sync_user(MovieClipUser *user, MovieTrackingContext *context)
@@ -1498,7 +1483,7 @@ int BKE_tracking_next(MovieTrackingContext *context)
                                }
 
                                marker_new.flag |= MARKER_TRACKED;
-                               marker_new.framenr = nextfra;
+                               marker_new.framenr= nextfra;
 
                                #pragma omp critical
                                {
@@ -1757,7 +1742,7 @@ static int get_refine_intrinsics_flags(MovieTracking *tracking, MovieTrackingObj
 static int count_tracks_on_both_keyframes(MovieTracking *tracking, ListBase *tracksbase)
 {
        int tot = 0;
-       int frame1 = tracking->settings.keyframe1, frame2 = tracking->settings.keyframe2;
+       int frame1 = tracking->settings.keyframe1, frame2= tracking->settings.keyframe2;
        MovieTrackingTrack *track;
 
        track = tracksbase->first;
@@ -1888,7 +1873,7 @@ void BKE_tracking_reconstruction_context_free(MovieReconstructContext *context)
 #ifdef WITH_LIBMV
 static void solve_reconstruction_update_cb(void *customdata, double progress, const char *message)
 {
-       ReconstructProgressData *progressdata = customdata;
+       ReconstructProgressData *progressdata= customdata;
 
        if (progressdata->progress) {
                *progressdata->progress = progress;
@@ -2004,7 +1989,7 @@ MovieTrackingTrack *BKE_tracking_named_track(MovieTracking *tracking, MovieTrack
 
 static int reconstruction_camera_index(MovieTrackingReconstruction *reconstruction, int framenr, int nearest)
 {
-       MovieReconstructedCamera *cameras = reconstruction->cameras;
+       MovieReconstructedCamera *cameras= reconstruction->cameras;
        int a = 0, d = 1;
 
        if (!reconstruction->camnr)
@@ -2241,7 +2226,7 @@ MovieTrackingObject *BKE_tracking_get_camera_object(MovieTracking *tracking)
                if (object->flag & TRACKING_OBJECT_CAMERA)
                        return object;
 
-               object = object->next;
+               object= object->next;
        }
 
        return NULL;
@@ -2274,7 +2259,7 @@ MovieTrackingReconstruction *BKE_tracking_get_reconstruction(MovieTracking *trac
 
 void BKE_tracking_apply_intrinsics(MovieTracking *tracking, float co[2], float nco[2])
 {
-       MovieTrackingCamera *camera = &tracking->camera;
+       MovieTrackingCamera *camera= &tracking->camera;
 
 #ifdef WITH_LIBMV
        double x, y;
@@ -2334,7 +2319,7 @@ static int point_in_stroke(bGPDstroke *stroke, float x, float y)
                                count++;
                }
 
-               prev = i;
+               prev= i;
        }
 
        return count % 2;
@@ -2443,10 +2428,10 @@ MovieTrackingTrack *BKE_tracking_indexed_track(MovieTracking *tracking, int trac
                        track = track->next;
                }
 
-               object = object->next;
+               object= object->next;
        }
 
-       *tracksbase_r = NULL;
+       *tracksbase_r= NULL;
 
        return NULL;
 }
@@ -2670,8 +2655,8 @@ void BKE_tracking_stabilization_data(MovieTracking *tracking, int framenr, int w
 
        if ((stab->flag & TRACKING_2D_STABILIZATION) == 0) {
                zero_v2(loc);
-               *scale = 1.0f;
-               *angle = 0.0f;
+               *scale= 1.0f;
+               *angle= 0.0f;
 
                return;
        }
@@ -2790,10 +2775,10 @@ ImBuf *BKE_tracking_stabilize(MovieTracking *tracking, int framenr, ImBuf *ibuf,
                copy_v2_v2(loc, tloc);
 
        if (scale)
-               *scale = tscale;
+               *scale= tscale;
 
        if (angle)
-               *angle = tangle;
+               *angle= tangle;
 
        return tmpibuf;
 }
@@ -3026,7 +3011,7 @@ void BKE_tracking_remove_object(MovieTracking *tracking, MovieTrackingObject *ob
                if (track == tracking->act_track)
                        tracking->act_track = NULL;
 
-               track = track->next;
+               track= track->next;
        }
 
        tracking_object_free(object);
@@ -3072,202 +3057,39 @@ static int channels_alpha_sort(void *a, void *b)
                return 0;
 }
 
-static int channels_total_track_sort(void *a, void *b)
-{
-       MovieTrackingDopesheetChannel *channel_a = a;
-       MovieTrackingDopesheetChannel *channel_b = b;
-
-       if (channel_a->total_frames > channel_b->total_frames)
-               return 1;
-       else
-               return 0;
-}
-
-static int channels_longest_segment_sort(void *a, void *b)
-{
-       MovieTrackingDopesheetChannel *channel_a = a;
-       MovieTrackingDopesheetChannel *channel_b = b;
-
-       if (channel_a->max_segment > channel_b->max_segment)
-               return 1;
-       else
-               return 0;
-}
-
-static int channels_alpha_inverse_sort(void *a, void *b)
-{
-       if (channels_alpha_sort(a, b))
-               return 0;
-       else
-               return 1;
-}
-
-static int channels_total_track_inverse_sort(void *a, void *b)
-{
-       if (channels_total_track_sort(a, b))
-               return 0;
-       else
-               return 1;
-}
-
-static int channels_longest_segment_inverse_sort(void *a, void *b)
-{
-       if (channels_longest_segment_sort(a, b))
-               return 0;
-       else
-               return 1;
-}
-
-static void channels_segments_calc(MovieTrackingDopesheetChannel *channel)
-{
-       MovieTrackingTrack *track = channel->track;
-       int i, segment;
-
-       channel->tot_segment = 0;
-       channel->max_segment = 0;
-       channel->total_frames = 0;
-
-       /* count */
-       i = 0;
-       while (i < track->markersnr) {
-               MovieTrackingMarker *marker = &track->markers[i];
-
-               if ((marker->flag & MARKER_DISABLED) == 0) {
-                       int prev_fra = marker->framenr, len = 0;
-
-                       i++;
-                       while (i < track->markersnr) {
-                               marker = &track->markers[i];
-
-                               if (marker->framenr != prev_fra + 1)
-                                       break;
-                               if (marker->flag & MARKER_DISABLED)
-                                       break;
-
-                               prev_fra = marker->framenr;
-                               len++;
-                               i++;
-                       }
-
-                       channel->tot_segment++;
-               }
-
-               i++;
-       }
-
-       if (!channel->tot_segment)
-               return;
-
-       channel->segments = MEM_callocN(2 * sizeof(int) * channel->tot_segment, "tracking channel segments");
-
-       /* create segments */
-       i = 0;
-       segment = 0;
-       while (i < track->markersnr) {
-               MovieTrackingMarker *marker = &track->markers[i];
-
-               if ((marker->flag & MARKER_DISABLED) == 0) {
-                       MovieTrackingMarker *start_marker = marker;
-                       int prev_fra = marker->framenr, len = 0;
-
-                       i++;
-                       while (i < track->markersnr) {
-                               marker = &track->markers[i];
-
-                               if (marker->framenr != prev_fra + 1)
-                                       break;
-                               if (marker->flag & MARKER_DISABLED)
-                                       break;
-
-                               prev_fra = marker->framenr;
-                               channel->total_frames++;
-                               len++;
-                               i++;
-                       }
-
-                       channel->segments[2 * segment] = start_marker->framenr;
-                       channel->segments[2 * segment + 1] = start_marker->framenr + len;
-
-                       channel->max_segment =  MAX2(channel->max_segment, len);
-                       segment++;
-               }
-
-               i++;
-       }
-}
-
-static void  tracking_dopesheet_sort(MovieTracking *tracking, int sort_method, int inverse)
-{
-       MovieTrackingDopesheet *dopesheet = &tracking->dopesheet;
-
-       if (dopesheet->sort_method == sort_method && dopesheet->sort_inverse == inverse)
-               return;
-
-       if (inverse) {
-               if (sort_method == TRACK_SORT_NAME) {
-                       BLI_sortlist(&dopesheet->channels, channels_alpha_inverse_sort);
-               }
-               else if (sort_method == TRACK_SORT_LONGEST) {
-                       BLI_sortlist(&dopesheet->channels, channels_longest_segment_inverse_sort);
-               }
-               else if (sort_method == TRACK_SORT_TOTAL) {
-                       BLI_sortlist(&dopesheet->channels, channels_total_track_inverse_sort);
-               }
-       }
-       else {
-               if (sort_method == TRACK_SORT_NAME) {
-                       BLI_sortlist(&dopesheet->channels, channels_alpha_sort);
-               }
-               else if (sort_method == TRACK_SORT_LONGEST) {
-                       BLI_sortlist(&dopesheet->channels, channels_longest_segment_sort);
-               }
-               else if (sort_method == TRACK_SORT_TOTAL) {
-                       BLI_sortlist(&dopesheet->channels, channels_total_track_sort);
-               }
-       }
-
-       dopesheet->sort_method = sort_method;
-       dopesheet->sort_inverse = inverse;
-}
-
-void BKE_tracking_dopesheet_tag_update(MovieTracking *tracking)
-{
-       MovieTrackingDopesheet *dopesheet = &tracking->dopesheet;
-
-       dopesheet->ok = FALSE;
-}
-
-void BKE_tracking_dopesheet_update(MovieTracking *tracking, int sort_method, int inverse)
+void BKE_tracking_update_dopesheet(MovieTracking *tracking)
 {
        MovieTrackingObject *object = BKE_tracking_active_object(tracking);
        MovieTrackingDopesheet *dopesheet = &tracking->dopesheet;
        MovieTrackingTrack *track;
        ListBase *tracksbase = BKE_tracking_object_tracks(tracking, object);
+       ListBase old_channels;
 
-       if (dopesheet->ok) {
-               tracking_dopesheet_sort(tracking, sort_method, inverse);
-               return;
-       }
-
-       tracking_dopesheet_free(dopesheet);
+       old_channels = dopesheet->channels;
+       dopesheet->channels.first = dopesheet->channels.last = NULL;
+       dopesheet->tot_channel = 0;
 
        for (track = tracksbase->first; track; track = track->next) {
                if (TRACK_SELECTED(track) && (track->flag & TRACK_HIDDEN) == 0) {
-                       MovieTrackingDopesheetChannel *channel;
+                       MovieTrackingDopesheetChannel *channel, *old_channel;
 
                        channel = MEM_callocN(sizeof(MovieTrackingDopesheetChannel), "tracking dopesheet channel");
                        channel->track = track;
 
-                       channels_segments_calc(channel);
+                       /* copy flags from current dopsheet information to new one */
+                       for (old_channel = old_channels.first; old_channel; old_channel = old_channel->next) {
+                               if (old_channel->track == track) {
+                                       channel->flag = old_channel->flag;
+                                       break;
+                               }
+                       }
 
                        BLI_addtail(&dopesheet->channels, channel);
                        dopesheet->tot_channel++;
                }
        }
 
-       dopesheet->sort_method = TRACK_SORT_NONE;
-
-       tracking_dopesheet_sort(tracking, sort_method, inverse);
+       BLI_sortlist(&dopesheet->channels, channels_alpha_sort);
 
-       dopesheet->ok = TRUE;
+       BLI_freelistN(&old_channels);
 }
index b178538edf2e959db35a1fdaed8706f191b6c6b9..02042fbfb95d2e8ad8e0179438ea899924bd9592 100644 (file)
@@ -149,10 +149,10 @@ int                               BLI_ghashutil_intcmp    (const void *a, const void *b);
 
 typedef struct GHashPair {
        const void *first;
-       const void *second;
+       int second;
 } GHashPair;
 
-GHashPair*             BLI_ghashutil_pairalloc (const void *first, const void *second);
+GHashPair*             BLI_ghashutil_pairalloc (const void *first, int second);
 unsigned int   BLI_ghashutil_pairhash  (const void *ptr);
 int                            BLI_ghashutil_paircmp   (const void *a, const void *b);
 void                   BLI_ghashutil_pairfree  (void *ptr);
diff --git a/source/blender/blenlib/BLI_lasso.h b/source/blender/blenlib/BLI_lasso.h
deleted file mode 100644 (file)
index 2360173..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#ifndef __BLI_LASSO_H__
-#define __BLI_LASSO_H__
-
-/** \file BLI_lasso.h
- *  \ingroup bli
- */
-
-struct rcti;
-
-void BLI_lasso_boundbox(struct rcti *rect, int mcords[][2], short moves);
-int  BLI_lasso_is_point_inside(int mcords[][2], short moves, int sx, int sy, const int error_value);
-int  BLI_lasso_is_edge_inside(int mcords[][2], short moves, int x0, int y0, int x1, int y1, const int error_value);
-
-#endif
index 4dba726cb61a66687d8e1a2c0c0954ca3b12fc38..28b4794ed1b06bef824e29f28390b24db27cf116 100644 (file)
@@ -305,7 +305,7 @@ int BLI_ghashutil_strcmp(const void *a, const void *b)
        return strcmp(a, b);
 }
 
-GHashPair *BLI_ghashutil_pairalloc(const void *first, const void *second)
+GHashPair *BLI_ghashutil_pairalloc(const void *first, int second)
 {
        GHashPair *pair = MEM_mallocN(sizeof(GHashPair), "GHashPair");
        pair->first = first;
@@ -317,7 +317,7 @@ unsigned int BLI_ghashutil_pairhash(const void *ptr)
 {
        const GHashPair *pair = ptr;
        unsigned int hash = BLI_ghashutil_ptrhash(pair->first);
-       return hash ^ BLI_ghashutil_ptrhash(pair->second);
+       return hash ^ BLI_ghashutil_inthash(SET_INT_IN_POINTER(pair->second));
 }
 
 int BLI_ghashutil_paircmp(const void *a, const void *b)
@@ -327,7 +327,7 @@ int BLI_ghashutil_paircmp(const void *a, const void *b)
 
        int cmp = BLI_ghashutil_ptrcmp(A->first, B->first);
        if (cmp == 0)
-               return BLI_ghashutil_ptrcmp(A->second, B->second);
+               return BLI_ghashutil_intcmp(SET_INT_IN_POINTER(A->second), SET_INT_IN_POINTER(B->second));
        return cmp;
 }
 
diff --git a/source/blender/blenlib/intern/lasso.c b/source/blender/blenlib/intern/lasso.c
deleted file mode 100644 (file)
index 29b967f..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- *
- */
-
-/** \file blender/blenlib/intern/lasso.c
- *  \ingroup bli
- */
-
-#include "DNA_vec_types.h"
-
-#include "BLI_math.h"
-#include "BLI_rect.h"
-
-#include "BLI_lasso.h" /* own include */
-
-void BLI_lasso_boundbox(rcti *rect, int mcords[][2], short moves)
-{
-       short a;
-
-       rect->xmin = rect->xmax = mcords[0][0];
-       rect->ymin = rect->ymax = mcords[0][1];
-
-       for (a = 1; a < moves; a++) {
-               if      (mcords[a][0] < rect->xmin) rect->xmin = mcords[a][0];
-               else if (mcords[a][0] > rect->xmax) rect->xmax = mcords[a][0];
-               if      (mcords[a][1] < rect->ymin) rect->ymin = mcords[a][1];
-               else if (mcords[a][1] > rect->ymax) rect->ymax = mcords[a][1];
-       }
-}
-
-
-int BLI_lasso_is_point_inside(int mcords[][2], short moves,
-                              const int sx, const int sy,
-                              const int error_value)
-{
-       /* we do the angle rule, define that all added angles should be about zero or (2 * PI) */
-       float angletot = 0.0, dot, ang, cross, fp1[2], fp2[2];
-       int a;
-       int *p1, *p2;
-
-       if (sx == error_value) {
-               return 0;
-       }
-
-       p1 = mcords[moves - 1];
-       p2 = mcords[0];
-
-       /* first vector */
-       fp1[0] = (float)(p1[0] - sx);
-       fp1[1] = (float)(p1[1] - sy);
-       normalize_v2(fp1);
-
-       for (a = 0; a < moves; a++) {
-               /* second vector */
-               fp2[0] = (float)(p2[0] - sx);
-               fp2[1] = (float)(p2[1] - sy);
-               normalize_v2(fp2);
-
-               /* dot and angle and cross */
-               dot = fp1[0] * fp2[0] + fp1[1] * fp2[1];
-               ang = fabs(saacos(dot));
-
-               cross = (float)((p1[1] - p2[1]) * (p1[0] - sx) + (p2[0] - p1[0]) * (p1[1] - sy));
-
-               if (cross < 0.0f) angletot -= ang;
-               else angletot += ang;
-
-               /* circulate */
-               fp1[0] = fp2[0]; fp1[1] = fp2[1];
-               p1 = p2;
-               p2 = mcords[a + 1];
-       }
-
-       if (fabs(angletot) > 4.0) return 1;
-       return 0;
-}
-
-/* edge version for lasso select. we assume boundbox check was done */
-int BLI_lasso_is_edge_inside(int mcords[][2], short moves,
-                             int x0, int y0, int x1, int y1,
-                             const int error_value)
-{
-       int v1[2], v2[2];
-       int a;
-
-       if (x0 == error_value || x1 == error_value) {
-               return 0;
-       }
-
-       v1[0] = x0, v1[1] = y0;
-       v2[0] = x1, v2[1] = y1;
-
-       /* check points in lasso */
-       if (BLI_lasso_is_point_inside(mcords, moves, v1[0], v1[1], error_value)) return 1;
-       if (BLI_lasso_is_point_inside(mcords, moves, v2[0], v2[1], error_value)) return 1;
-
-       /* no points in lasso, so we have to intersect with lasso edge */
-
-       if (isect_line_line_v2_int(mcords[0], mcords[moves - 1], v1, v2) > 0) return 1;
-       for (a = 0; a < moves - 1; a++) {
-               if (isect_line_line_v2_int(mcords[a], mcords[a + 1], v1, v2) > 0) return 1;
-       }
-
-       return 0;
-}
index a630084e79d0eb85fad90ae2e8a17b2cf70bab5f..31229c76869409dc9439b080fb1e28831054923e 100644 (file)
@@ -138,7 +138,7 @@ ProjCameraInfo *BLI_uvproject_camera_info(Object *ob, float(*rotmat)[4], float w
        ProjCameraInfo uci;
        Camera *camera = ob->data;
 
-       uci.do_pano = (camera->type == CAM_PANO);
+       uci.do_pano = (camera->flag & CAM_PANORAMA);
        uci.do_persp = (camera->type == CAM_PERSP);
 
        uci.camangle = focallength_to_fov(camera->lens, camera->sensor_x) / 2.0f;
index a0fe042e7fbe88256f479365488eb9f9e618c53e..35271f7b873afb3038e95f82d0fafd2d1edf7ecf 100644 (file)
@@ -44,8 +44,6 @@ set(SRC
        intern/readfile.c
        intern/runtime.c
        intern/undofile.c
-       intern/versioning_250.c
-       intern/versioning_legacy.c
        intern/writefile.c
 
        BLO_readfile.h
index 7e27106a82f8d614c243de13e8b74d9ec0f965eb..04585b726f3b755df31ff5aa4073ad1f746e099b 100644 (file)
@@ -328,11 +328,6 @@ static void oldnewmap_insert(OldNewMap *onm, void *oldaddr, void *newaddr, int n
        entry->nr= nr;
 }
 
-void blo_do_versions_oldnewmap_insert(OldNewMap *onm, void *oldaddr, void *newaddr, int nr)
-{
-       oldnewmap_insert(onm, oldaddr, newaddr, nr);
-}
-
 static void *oldnewmap_lookup_and_inc(OldNewMap *onm, void *addr) 
 {
        int i;
@@ -1182,11 +1177,6 @@ static void *newlibadr(FileData *fd, void *lib, void *adr)               /* only lib data */
        return oldnewmap_liblookup(fd->libmap, adr, lib);
 }
 
-void *blo_do_versions_newlibadr(FileData *fd, void *lib, void *adr)            /* only lib data */
-{
-       return newlibadr(fd, lib, adr);
-}
-
 static void *newlibadr_us(FileData *fd, void *lib, void *adr)  /* increases user number */
 {
        ID *id= newlibadr(fd, lib, adr);
@@ -1197,11 +1187,6 @@ static void *newlibadr_us(FileData *fd, void *lib, void *adr)    /* increases user
        return id;
 }
 
-void *blo_do_versions_newlibadr_us(FileData *fd, void *lib, void *adr) /* increases user number */
-{
-       return newlibadr_us(fd, lib, adr);
-}
-
 static void change_idid_adr_fd(FileData *fd, void *old, void *new)
 {
        int i;
@@ -2217,7 +2202,7 @@ static void do_versions_socket_default_value(bNodeSocket *sock)
        }
 }
 
-void blo_do_versions_nodetree_default_value(bNodeTree *ntree)
+static void do_versions_nodetree_default_value(bNodeTree *ntree)
 {
        bNode *node;
        bNodeSocket *sock;
@@ -2240,7 +2225,7 @@ static void lib_nodetree_init_types_cb(void *UNUSED(data), ID *UNUSED(id), bNode
        ntreeInitTypes(ntree);
 
        /* need to do this here instead of in do_versions, otherwise next function can crash */
-       blo_do_versions_nodetree_default_value(ntree);
+       do_versions_nodetree_default_value(ntree);
        
        /* XXX could be replaced by do_versions for new nodes */
        for (node=ntree->nodes.first; node; node=node->next)
@@ -5737,7 +5722,7 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype)
 
 /* for the saved 2.50 files without regiondata */
 /* and as patch for 2.48 and older */
-void blo_do_versions_view3d_split_250(View3D *v3d, ListBase *regions)
+static void view3d_split_250(View3D *v3d, ListBase *regions)
 {
        ARegion *ar;
        
@@ -5823,7 +5808,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
                }
                /* add local view3d too */
                else if (sa->spacetype==SPACE_VIEW3D)
-                       blo_do_versions_view3d_split_250(sa->spacedata.first, &sa->regionbase);
+                       view3d_split_250(sa->spacedata.first, &sa->regionbase);
                
                for (sl= sa->spacedata.first; sl; sl= sl->next) {
                        link_list(fd, &(sl->regionbase));
@@ -5863,7 +5848,7 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
                                if (v3d->drawtype == OB_RENDER)
                                        v3d->drawtype = OB_WIRE;
                                
-                               blo_do_versions_view3d_split_250(v3d, &sl->regionbase);
+                               view3d_split_250(v3d, &sl->regionbase);
                        }
                        else if (sl->spacetype==SPACE_IPO) {
                                SpaceIpo *sipo= (SpaceIpo*)sl;
@@ -6194,6 +6179,20 @@ static void direct_link_movieTracks(FileData *fd, ListBase *tracksbase)
        }
 }
 
+static void direct_link_movieDopesheet(FileData *fd, MovieTrackingDopesheet *dopesheet)
+{
+       MovieTrackingDopesheetChannel *channel;
+
+       link_list(fd, &dopesheet->channels);
+
+       channel = dopesheet->channels.first;
+       while (channel) {
+               channel->track = newdataadr(fd, channel->track);
+
+               channel = channel->next;
+       }
+}
+
 static void direct_link_movieclip(FileData *fd, MovieClip *clip)
 {
        MovieTracking *tracking= &clip->tracking;
@@ -6220,9 +6219,6 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip)
        clip->tracking.stabilization.scaleibuf= NULL;
        clip->tracking.stabilization.rot_track= newdataadr(fd, clip->tracking.stabilization.rot_track);
 
-       clip->tracking.dopesheet.ok = 0;
-       clip->tracking.dopesheet.channels.first = clip->tracking.dopesheet.channels.last = NULL;
-
        link_list(fd, &tracking->objects);
 
        object= tracking->objects.first;
@@ -6232,6 +6228,8 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip)
 
                object= object->next;
        }
+
+       direct_link_movieDopesheet(fd, &clip->tracking.dopesheet);
 }
 
 static void lib_link_movieclip(FileData *fd, Main *main)
@@ -6518,306 +6516,6292 @@ static void link_global(FileData *fd, BlendFileData *bfd)
        }
 }
 
-/* deprecated, only keep this for readfile.c */
-void convert_tface_mt(FileData *fd, Main *main)
+static void vcol_to_fcol(Mesh *me)
 {
-       Main *gmain;
+       MFace *mface;
+       unsigned int *mcol, *mcoln, *mcolmain;
+       int a;
 
-       /* this is a delayed do_version (so it can create new materials) */
-       if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 3)) {
+       if (me->totface==0 || me->mcol==NULL) return;
 
-               //XXX hack, material.c uses G.main all over the place, instead of main
-               // temporarily set G.main to the current main
-               gmain = G.main;
-               G.main = main;
+       mcoln= mcolmain= MEM_mallocN(4*sizeof(int)*me->totface, "mcoln");
+       mcol = (unsigned int *)me->mcol;
+       mface= me->mface;
+       for (a=me->totface; a>0; a--, mface++) {
+               mcoln[0]= mcol[mface->v1];
+               mcoln[1]= mcol[mface->v2];
+               mcoln[2]= mcol[mface->v3];
+               mcoln[3]= mcol[mface->v4];
+               mcoln+= 4;
+       }
 
-               if (!(do_version_tface(main, 1))) {
-                       BKE_report(fd->reports, RPT_WARNING, "Texface conversion problem. Error in console");
-               }
+       MEM_freeN(me->mcol);
+       me->mcol= (MCol *)mcolmain;
+}
 
-               //XXX hack, material.c uses G.main allover the place, instead of main
-               G.main = gmain;
+static int map_223_keybd_code_to_224_keybd_code(int code)
+{
+       switch (code) {
+               case 312:       return 311; /* F12KEY */
+               case 159:       return 161; /* PADSLASHKEY */
+               case 161:       return 150; /* PAD0 */
+               case 154:       return 151; /* PAD1 */
+               case 150:       return 152; /* PAD2 */
+               case 155:       return 153; /* PAD3 */
+               case 151:       return 154; /* PAD4 */
+               case 156:       return 155; /* PAD5 */
+               case 152:       return 156; /* PAD6 */
+               case 157:       return 157; /* PAD7 */
+               case 153:       return 158; /* PAD8 */
+               case 158:       return 159; /* PAD9 */
+               default: return code;
        }
 }
 
-static void do_versions_nodetree_image_default_alpha_output(bNodeTree *ntree)
+static void do_version_bone_head_tail_237(Bone *bone)
 {
-       bNode *node;
-       bNodeSocket *sock;
-       for (node=ntree->nodes.first; node; node=node->next) {
-               if (ELEM(node->type, CMP_NODE_IMAGE, CMP_NODE_R_LAYERS)) {
-                       /* default Image output value should have 0 alpha */
-                       sock = node->outputs.first;
-                       ((bNodeSocketValueRGBA*)sock->default_value)->value[3] = 0.0f;
+       Bone *child;
+       float vec[3];
+
+       /* head */
+       copy_v3_v3(bone->arm_head, bone->arm_mat[3]);
+
+       /* tail is in current local coord system */
+       copy_v3_v3(vec, bone->arm_mat[1]);
+       mul_v3_fl(vec, bone->length);
+       add_v3_v3v3(bone->arm_tail, bone->arm_head, vec);
+
+       for (child= bone->childbase.first; child; child= child->next)
+               do_version_bone_head_tail_237(child);
+}
+
+static void bone_version_238(ListBase *lb)
+{
+       Bone *bone;
+       
+       for (bone= lb->first; bone; bone= bone->next) {
+               if (bone->rad_tail==0.0f && bone->rad_head==0.0f) {
+                       bone->rad_head= 0.25f*bone->length;
+                       bone->rad_tail= 0.1f*bone->length;
+                       
+                       bone->dist-= bone->rad_head;
+                       if (bone->dist<=0.0f) bone->dist= 0.0f;
                }
+               bone_version_238(&bone->childbase);
        }
 }
 
-static void do_version_ntree_tex_mapping_260(void *UNUSED(data), ID *UNUSED(id), bNodeTree *ntree)
+static void bone_version_239(ListBase *lb)
 {
-       bNode *node;
-
-       for (node=ntree->nodes.first; node; node=node->next) {
-               if (node->type == SH_NODE_MAPPING) {
-                       TexMapping *tex_mapping;
+       Bone *bone;
+       
+       for (bone= lb->first; bone; bone= bone->next) {
+               if (bone->layer==0)
+                       bone->layer= 1;
+               bone_version_239(&bone->childbase);
+       }
+}
 
-                       tex_mapping= node->storage;
-                       tex_mapping->projx= PROJ_X;
-                       tex_mapping->projy= PROJ_Y;
-                       tex_mapping->projz= PROJ_Z;
+static void ntree_version_241(bNodeTree *ntree)
+{
+       bNode *node;
+       
+       if (ntree->type==NTREE_COMPOSIT) {
+               for (node= ntree->nodes.first; node; node= node->next) {
+                       if (node->type==CMP_NODE_BLUR) {
+                               if (node->storage==NULL) {
+                                       NodeBlurData *nbd= MEM_callocN(sizeof(NodeBlurData), "node blur patch");
+                                       nbd->sizex= node->custom1;
+                                       nbd->sizey= node->custom2;
+                                       nbd->filtertype= R_FILTER_QUAD;
+                                       node->storage= nbd;
+                               }
+                       }
+                       else if (node->type==CMP_NODE_VECBLUR) {
+                               if (node->storage==NULL) {
+                                       NodeBlurData *nbd= MEM_callocN(sizeof(NodeBlurData), "node blur patch");
+                                       nbd->samples= node->custom1;
+                                       nbd->maxspeed= node->custom2;
+                                       nbd->fac= 1.0f;
+                                       node->storage= nbd;
+                               }
+                       }
                }
        }
 }
 
-static void do_versions_nodetree_convert_angle(bNodeTree *ntree)
+static void ntree_version_242(bNodeTree *ntree)
 {
        bNode *node;
-       for (node=ntree->nodes.first; node; node=node->next) {
-               if (node->type == CMP_NODE_ROTATE) {
-                       /* Convert degrees to radians. */
-                       bNodeSocket *sock = ((bNodeSocket*)node->inputs.first)->next;
-                       ((bNodeSocketValueFloat*)sock->default_value)->value = DEG2RADF(((bNodeSocketValueFloat*)sock->default_value)->value);
-               }
-               else if (node->type == CMP_NODE_DBLUR) {
-                       /* Convert degrees to radians. */
-                       NodeDBlurData *ndbd= node->storage;
-                       ndbd->angle = DEG2RADF(ndbd->angle);
-                       ndbd->spin = DEG2RADF(ndbd->spin);
-               }
-               else if (node->type == CMP_NODE_DEFOCUS) {
-                       /* Convert degrees to radians. */
-                       NodeDefocus *nqd = node->storage;
-                       /* XXX DNA char to float conversion seems to map the char value into the [0.0f, 1.0f] range... */
-                       nqd->rotation = DEG2RADF(nqd->rotation*255.0f);
-               }
-               else if (node->type == CMP_NODE_CHROMA_MATTE) {
-                       /* Convert degrees to radians. */
-                       NodeChroma *ndc = node->storage;
-                       ndc->t1 = DEG2RADF(ndc->t1);
-                       ndc->t2 = DEG2RADF(ndc->t2);
-               }
-               else if (node->type == CMP_NODE_GLARE) {
-                       /* Convert degrees to radians. */
-                       NodeGlare* ndg = node->storage;
-                       /* XXX DNA char to float conversion seems to map the char value into the [0.0f, 1.0f] range... */
-                       ndg->angle_ofs = DEG2RADF(ndg->angle_ofs*255.0f);
-               }
-               /* XXX TexMapping struct is used by other nodes too (at least node_composite_mapValue),
-                *     but not the rot part...
-                */
-               else if (node->type == SH_NODE_MAPPING) {
-                       /* Convert degrees to radians. */
-                       TexMapping* tmap = node->storage;
-                       tmap->rot[0] = DEG2RADF(tmap->rot[0]);
-                       tmap->rot[1] = DEG2RADF(tmap->rot[1]);
-                       tmap->rot[2] = DEG2RADF(tmap->rot[2]);
+       
+       if (ntree->type==NTREE_COMPOSIT) {
+               for (node= ntree->nodes.first; node; node= node->next) {
+                       if (node->type==CMP_NODE_HUE_SAT) {
+                               if (node->storage) {
+                                       NodeHueSat *nhs= node->storage;
+                                       if (nhs->val==0.0f) nhs->val= 1.0f;
+                               }
+                       }
                }
        }
+       else if (ntree->type==NTREE_SHADER) {
+               for (node= ntree->nodes.first; node; node= node->next)
+                       if (node->type == SH_NODE_GEOMETRY && node->storage == NULL)
+                               node->storage= MEM_callocN(sizeof(NodeGeometry), "NodeGeometry");
+       }
+       
 }
 
-void do_versions_image_settings_2_60(Scene *sce)
+static void customdata_version_242(Mesh *me)
 {
-       /* note: rd->subimtype is moved into individual settings now and no longer
-        * exists */
-       RenderData *rd= &sce->r;
-       ImageFormatData *imf= &sce->r.im_format;
+       CustomDataLayer *layer;
+       MTFace *mtf;
+       MCol *mcol;
+       TFace *tf;
+       int a, mtfacen, mcoln;
 
-       /* we know no data loss happens here, the old values were in char range */
-       imf->imtype=   (char)rd->imtype;
-       imf->planes=   (char)rd->planes;
-       imf->compress= (char)rd->quality;
-       imf->quality=  (char)rd->quality;
+       if (!me->vdata.totlayer) {
+               CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, me->mvert, me->totvert);
 
-       /* default, was stored in multiple places, may override later */
-       imf->depth= R_IMF_CHAN_DEPTH_8;
+               if (me->msticky)
+                       CustomData_add_layer(&me->vdata, CD_MSTICKY, CD_ASSIGN, me->msticky, me->totvert);
+               if (me->dvert)
+                       CustomData_add_layer(&me->vdata, CD_MDEFORMVERT, CD_ASSIGN, me->dvert, me->totvert);
+       }
 
-       /* openexr */
-       imf->exr_codec = rd->quality & 7; /* strange but true! 0-4 are valid values, OPENEXR_COMPRESS */
+       if (!me->edata.totlayer)
+               CustomData_add_layer(&me->edata, CD_MEDGE, CD_ASSIGN, me->medge, me->totedge);
+       
+       if (!me->fdata.totlayer) {
+               CustomData_add_layer(&me->fdata, CD_MFACE, CD_ASSIGN, me->mface, me->totface);
 
-       switch (imf->imtype) {
-       case R_IMF_IMTYPE_OPENEXR:
-               imf->depth=  (rd->subimtype & R_OPENEXR_HALF) ? R_IMF_CHAN_DEPTH_16 : R_IMF_CHAN_DEPTH_32;
-               if (rd->subimtype & R_PREVIEW_JPG) {
-                       imf->flag |= R_IMF_FLAG_PREVIEW_JPG;
-               }
-               if (rd->subimtype & R_OPENEXR_ZBUF) {
-                       imf->flag |= R_IMF_FLAG_ZBUF;
-               }
-               break;
-       case R_IMF_IMTYPE_TIFF:
-               if (rd->subimtype & R_TIFF_16BIT) {
-                       imf->depth= R_IMF_CHAN_DEPTH_16;
-               }
-               break;
-       case R_IMF_IMTYPE_JP2:
-               if (rd->subimtype & R_JPEG2K_16BIT) {
-                       imf->depth= R_IMF_CHAN_DEPTH_16;
-               }
-               else if (rd->subimtype & R_JPEG2K_12BIT) {
-                       imf->depth= R_IMF_CHAN_DEPTH_12;
-               }
+               if (me->tface) {
+                       if (me->mcol)
+                               MEM_freeN(me->mcol);
 
-               if (rd->subimtype & R_JPEG2K_YCC) {
-                       imf->jp2_flag |= R_IMF_JP2_FLAG_YCC;
+                       me->mcol= CustomData_add_layer(&me->fdata, CD_MCOL, CD_CALLOC, NULL, me->totface);
+                       me->mtface= CustomData_add_layer(&me->fdata, CD_MTFACE, CD_CALLOC, NULL, me->totface);
+
+                       mtf= me->mtface;
+                       mcol= me->mcol;
+                       tf= me->tface;
+
+                       for (a=0; a < me->totface; a++, mtf++, tf++, mcol+=4) {
+                               memcpy(mcol, tf->col, sizeof(tf->col));
+                               memcpy(mtf->uv, tf->uv, sizeof(tf->uv));
+
+                               mtf->flag= tf->flag;
+                               mtf->unwrap= tf->unwrap;
+                               mtf->mode= tf->mode;
+                               mtf->tile= tf->tile;
+                               mtf->tpage= tf->tpage;
+                               mtf->transp= tf->transp;
+                       }
+
+                       MEM_freeN(me->tface);
+                       me->tface= NULL;
                }
-               if (rd->subimtype & R_JPEG2K_CINE_PRESET) {
-                       imf->jp2_flag |= R_IMF_JP2_FLAG_CINE_PRESET;
+               else if (me->mcol) {
+                       me->mcol= CustomData_add_layer(&me->fdata, CD_MCOL, CD_ASSIGN, me->mcol, me->totface);
                }
-               if (rd->subimtype & R_JPEG2K_CINE_48FPS) {
-                       imf->jp2_flag |= R_IMF_JP2_FLAG_CINE_48;
+       }
+
+       if (me->tface) {
+               MEM_freeN(me->tface);
+               me->tface= NULL;
+       }
+
+       for (a=0, mtfacen=0, mcoln=0; a < me->fdata.totlayer; a++) {
+               layer= &me->fdata.layers[a];
+
+               if (layer->type == CD_MTFACE) {
+                       if (layer->name[0] == 0) {
+                               if (mtfacen == 0) strcpy(layer->name, "UVMap");
+                               else BLI_snprintf(layer->name, sizeof(layer->name), "UVMap.%.3d", mtfacen);
+                       }
+                       mtfacen++;
                }
-               break;
-       case R_IMF_IMTYPE_CINEON:
-       case R_IMF_IMTYPE_DPX:
-               if (rd->subimtype & R_CINEON_LOG) {
-                       imf->cineon_flag |= R_IMF_CINEON_FLAG_LOG;
+               else if (layer->type == CD_MCOL) {
+                       if (layer->name[0] == 0) {
+                               if (mcoln == 0) strcpy(layer->name, "Col");
+                               else BLI_snprintf(layer->name, sizeof(layer->name), "Col.%.3d", mcoln);
+                       }
+                       mcoln++;
                }
-               break;
        }
 
+       mesh_update_customdata_pointers(me, TRUE);
 }
 
-/* socket use flags were only temporary before */
-static void do_versions_nodetree_socket_use_flags_2_62(bNodeTree *ntree)
+/*only copy render texface layer from active*/
+static void customdata_version_243(Mesh *me)
 {
-       bNode *node;
-       bNodeSocket *sock;
-       bNodeLink *link;
-       
-       for (node=ntree->nodes.first; node; node=node->next) {
-               for (sock=node->inputs.first; sock; sock=sock->next)
-                       sock->flag &= ~SOCK_IN_USE;
-               for (sock=node->outputs.first; sock; sock=sock->next)
-                       sock->flag &= ~SOCK_IN_USE;
-       }
-       for (sock=ntree->inputs.first; sock; sock=sock->next)
-               sock->flag &= ~SOCK_IN_USE;
-       for (sock=ntree->outputs.first; sock; sock=sock->next)
-               sock->flag &= ~SOCK_IN_USE;
-       
-       for (link=ntree->links.first; link; link=link->next) {
-               link->fromsock->flag |= SOCK_IN_USE;
-               link->tosock->flag |= SOCK_IN_USE;
+       CustomDataLayer *layer;
+       int a;
+
+       for (a=0; a < me->fdata.totlayer; a++) {
+               layer= &me->fdata.layers[a];
+               layer->active_rnd = layer->active;
        }
 }
 
-static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNodeTree *ntree)
+/* struct NodeImageAnim moved to ImageUser, and we make it default available */
+static void do_version_ntree_242_2(bNodeTree *ntree)
 {
        bNode *node;
-       bNodeSocket *sock;
        
-       for (node=ntree->nodes.first; node; node=node->next) {
-               if (node->type==CMP_NODE_OUTPUT_FILE) {
-                       /* previous CMP_NODE_OUTPUT_FILE nodes get converted to multi-file outputs */
-                       NodeImageFile *old_data = node->storage;
-                       NodeImageMultiFile *nimf= MEM_callocN(sizeof(NodeImageMultiFile), "node image multi file");
-                       bNodeSocket *old_image = BLI_findlink(&node->inputs, 0);
-                       bNodeSocket *old_z = BLI_findlink(&node->inputs, 1);
-                       bNodeSocket *sock;
-                       
-                       node->storage= nimf;
-                       
-                       BLI_strncpy(nimf->base_path, old_data->name, sizeof(nimf->base_path));
-                       nimf->format = old_data->im_format;
-                       
-                       /* if z buffer is saved, change the image type to multilayer exr.
-                        * XXX this is slightly messy, Z buffer was ignored before for anything but EXR and IRIS ...
-                        * i'm just assuming here that IRIZ means IRIS with z buffer ...
-                        */
-                       if (ELEM(old_data->im_format.imtype, R_IMF_IMTYPE_IRIZ, R_IMF_IMTYPE_OPENEXR)) {
-                               nimf->format.imtype = R_IMF_IMTYPE_MULTILAYER;
-                               sock = ntreeCompositOutputFileAddSocket(ntree, node, old_image->name, &nimf->format);
-                               if (old_image->link) {
-                                       old_image->link->tosock = sock;
-                                       sock->link = old_image->link;
+       if (ntree->type==NTREE_COMPOSIT) {
+               for (node= ntree->nodes.first; node; node= node->next) {
+                       if (ELEM3(node->type, CMP_NODE_IMAGE, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
+                               /* only image had storage */
+                               if (node->storage) {
+                                       NodeImageAnim *nia= node->storage;
+                                       ImageUser *iuser= MEM_callocN(sizeof(ImageUser), "ima user node");
+
+                                       iuser->frames= nia->frames;
+                                       iuser->sfra= nia->sfra;
+                                       iuser->offset= nia->nr-1;
+                                       iuser->cycl= nia->cyclic;
+                                       iuser->fie_ima= 2;
+                                       iuser->ok= 1;
+                                       
+                                       node->storage= iuser;
+                                       MEM_freeN(nia);
                                }
-                               sock = ntreeCompositOutputFileAddSocket(ntree, node, old_z->name, &nimf->format);
-                               if (old_z->link) {
-                                       old_z->link->tosock = sock;
-                                       sock->link = old_z->link;
+                               else {
+                                       ImageUser *iuser= node->storage= MEM_callocN(sizeof(ImageUser), "node image user");
+                                       iuser->sfra= 1;
+                                       iuser->fie_ima= 2;
+                                       iuser->ok= 1;
                                }
                        }
-                       else {
-                               /* saves directly to base path, which is the old image output path */
-                               sock = ntreeCompositOutputFileAddSocket(ntree, node, "", &nimf->format);
-                               if (old_image->link) {
-                                       old_image->link->tosock = sock;
-                                       sock->link = old_image->link;
+               }
+       }
+}
+
+static void ntree_version_245(FileData *fd, Library *lib, bNodeTree *ntree)
+{
+       bNode *node;
+       NodeTwoFloats *ntf;
+       ID *nodeid;
+       Image *image;
+       ImageUser *iuser;
+
+       if (ntree->type==NTREE_COMPOSIT) {
+               for (node= ntree->nodes.first; node; node= node->next) {
+                       if (node->type == CMP_NODE_ALPHAOVER) {
+                               if (!node->storage) {
+                                       ntf= MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats");
+                                       node->storage= ntf;
+                                       if (node->custom1)
+                                               ntf->x= 1.0f;
                                }
                        }
                        
-                       nodeRemoveSocket(ntree, node, old_image);
-                       nodeRemoveSocket(ntree, node, old_z);
+                       /* fix for temporary flag changes during 245 cycle */
+                       nodeid= newlibadr(fd, lib, node->id);
+                       if (node->storage && nodeid && GS(nodeid->name) == ID_IM) {
+                               image= (Image*)nodeid;
+                               iuser= node->storage;
+                               if (iuser->flag & IMA_OLD_PREMUL) {
+                                       iuser->flag &= ~IMA_OLD_PREMUL;
+                                       iuser->flag |= IMA_DO_PREMUL;
+                               }
+                               if (iuser->flag & IMA_DO_PREMUL) {
+                                       image->flag &= ~IMA_OLD_PREMUL;
+                                       image->flag |= IMA_DO_PREMUL;
+                               }
+                       }
+               }
+       }
+}
+
+static void idproperties_fix_groups_lengths_recurse(IDProperty *prop)
+{
+       IDProperty *loop;
+       int i;
+       
+       for (loop=prop->data.group.first, i=0; loop; loop=loop->next, i++) {
+               if (loop->type == IDP_GROUP) idproperties_fix_groups_lengths_recurse(loop);
+       }
+       
+       if (prop->len != i) {
+               printf("Found and fixed bad id property group length.\n");
+               prop->len = i;
+       }
+}
+
+static void idproperties_fix_group_lengths(ListBase idlist)
+{
+       ID *id;
+       
+       for (id=idlist.first; id; id=id->next) {
+               if (id->properties) {
+                       idproperties_fix_groups_lengths_recurse(id->properties);
+               }
+       }
+}
+
+static void alphasort_version_246(FileData *fd, Library *lib, Mesh *me)
+{
+       Material *ma;
+       MFace *mf;
+       MTFace *tf;
+       int a, b, texalpha;
+
+       /* verify we have a tface layer */
+       for (b=0; b<me->fdata.totlayer; b++)
+               if (me->fdata.layers[b].type == CD_MTFACE)
+                       break;
+       
+       if (b == me->fdata.totlayer)
+               return;
+
+       /* if we do, set alpha sort if the game engine did it before */
+       for (a=0, mf=me->mface; a<me->totface; a++, mf++) {
+               if (mf->mat_nr < me->totcol) {
+                       ma= newlibadr(fd, lib, me->mat[mf->mat_nr]);
+                       texalpha = 0;
+
+                       /* we can't read from this if it comes from a library,
+                        * because direct_link might not have happened on it,
+                        * so ma->mtex is not pointing to valid memory yet */
+                       if (ma && ma->id.lib)
+                               ma= NULL;
+
+                       for (b=0; ma && b<MAX_MTEX; b++)
+                               if (ma->mtex && ma->mtex[b] && ma->mtex[b]->mapto & MAP_ALPHA)
+                                       texalpha = 1;
+               }
+               else {
+                       ma= NULL;
+                       texalpha = 0;
+               }
+
+               for (b=0; b<me->fdata.totlayer; b++) {
+                       if (me->fdata.layers[b].type == CD_MTFACE) {
+                               tf = ((MTFace*)me->fdata.layers[b].data) + a;
+
+                               tf->mode &= ~TF_ALPHASORT;
+                               if (ma && (ma->mode & MA_ZTRANSP))
+                                       if (ELEM(tf->transp, TF_ALPHA, TF_ADD) || (texalpha && (tf->transp != TF_CLIP)))
+                                               tf->mode |= TF_ALPHASORT;
+                       }
+               }
+       }
+}
+
+/* 2.50 patch */
+static void area_add_header_region(ScrArea *sa, ListBase *lb)
+{
+       ARegion *ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
+       
+       BLI_addtail(lb, ar);
+       ar->regiontype= RGN_TYPE_HEADER;
+       if (sa->headertype==HEADERDOWN)
+               ar->alignment= RGN_ALIGN_BOTTOM;
+       else
+               ar->alignment= RGN_ALIGN_TOP;
+       
+       /* initialize view2d data for header region, to allow panning */
+       /* is copy from ui_view2d.c */
+       ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
+       ar->v2d.keepofs = V2D_LOCKOFS_Y;
+       ar->v2d.keeptot = V2D_KEEPTOT_STRICT; 
+       ar->v2d.align = V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y;
+       ar->v2d.flag = (V2D_PIXELOFS_X|V2D_PIXELOFS_Y);
+}
+
+static void sequencer_init_preview_region(ARegion* ar)
+{
+       // XXX a bit ugly still, copied from space_sequencer
+       /* NOTE: if you change values here, also change them in space_sequencer.c, sequencer_new */
+       ar->regiontype= RGN_TYPE_PREVIEW;
+       ar->alignment= RGN_ALIGN_TOP;
+       ar->flag |= RGN_FLAG_HIDDEN;
+       ar->v2d.keepzoom= V2D_KEEPASPECT | V2D_KEEPZOOM;
+       ar->v2d.minzoom= 0.00001f;
+       ar->v2d.maxzoom= 100000.0f;
+       ar->v2d.tot.xmin = -960.0f; /* 1920 width centered */
+       ar->v2d.tot.ymin = -540.0f; /* 1080 height centered */
+       ar->v2d.tot.xmax = 960.0f;
+       ar->v2d.tot.ymax = 540.0f;
+       ar->v2d.min[0]= 0.0f;
+       ar->v2d.min[1]= 0.0f;
+       ar->v2d.max[0]= 12000.0f;
+       ar->v2d.max[1]= 12000.0f;
+       ar->v2d.cur= ar->v2d.tot;
+       ar->v2d.align= V2D_ALIGN_FREE; // (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y);
+       ar->v2d.keeptot= V2D_KEEPTOT_FREE;
+}
+
+/* 2.50 patch */
+static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
+{
+       ARegion *ar;
+       ARegion *ar_main;
+
+       if (sl) {
+               /* first channels for ipo action nla... */
+               switch (sl->spacetype) {
+                       case SPACE_IPO:
+                               ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
+                               BLI_addtail(lb, ar);
+                               ar->regiontype= RGN_TYPE_CHANNELS;
+                               ar->alignment= RGN_ALIGN_LEFT; 
+                               ar->v2d.scroll= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
+                               
+                                       // for some reason, this doesn't seem to go auto like for NLA...
+                               ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
+                               BLI_addtail(lb, ar);
+                               ar->regiontype= RGN_TYPE_UI;
+                               ar->alignment= RGN_ALIGN_RIGHT;
+                               ar->v2d.scroll= V2D_SCROLL_RIGHT;
+                               ar->v2d.flag = RGN_FLAG_HIDDEN;
+                               break;
+                               
+                       case SPACE_ACTION:
+                               ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
+                               BLI_addtail(lb, ar);
+                               ar->regiontype= RGN_TYPE_CHANNELS;
+                               ar->alignment= RGN_ALIGN_LEFT;
+                               ar->v2d.scroll= V2D_SCROLL_BOTTOM;
+                               ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
+                               break;
+                               
+                       case SPACE_NLA:
+                               ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
+                               BLI_addtail(lb, ar);
+                               ar->regiontype= RGN_TYPE_CHANNELS;
+                               ar->alignment= RGN_ALIGN_LEFT;
+                               ar->v2d.scroll= V2D_SCROLL_BOTTOM;
+                               ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
+                               
+                                       // for some reason, some files still don't get this auto
+                               ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
+                               BLI_addtail(lb, ar);
+                               ar->regiontype= RGN_TYPE_UI;
+                               ar->alignment= RGN_ALIGN_RIGHT;
+                               ar->v2d.scroll= V2D_SCROLL_RIGHT;
+                               ar->v2d.flag = RGN_FLAG_HIDDEN;
+                               break;
+                               
+                       case SPACE_NODE:
+                               ar= MEM_callocN(sizeof(ARegion), "nodetree area for node");
+                               BLI_addtail(lb, ar);
+                               ar->regiontype= RGN_TYPE_UI;
+                               ar->alignment= RGN_ALIGN_LEFT;
+                               ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
+                               ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
+                               /* temporarily hide it */
+                               ar->flag = RGN_FLAG_HIDDEN;
+                               break;
+                       case SPACE_FILE:
+                               ar= MEM_callocN(sizeof(ARegion), "nodetree area for node");
+                               BLI_addtail(lb, ar);
+                               ar->regiontype= RGN_TYPE_CHANNELS;
+                               ar->alignment= RGN_ALIGN_LEFT;
+
+                               ar= MEM_callocN(sizeof(ARegion), "ui area for file");
+                               BLI_addtail(lb, ar);
+