Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/python_api/examples/bpy.ops.2.py18
-rw-r--r--doc/python_api/examples/bpy.ops.3.py18
-rw-r--r--extern/libmv/libmv/simple_pipeline/modal_solver.cc126
-rw-r--r--extern/libmv/libmv/simple_pipeline/modal_solver.h48
-rw-r--r--intern/cycles/app/cycles_xml.cpp18
-rw-r--r--intern/cycles/blender/addon/enums.py6
-rw-r--r--intern/cycles/blender/addon/properties.py19
-rw-r--r--intern/cycles/blender/blender_camera.cpp50
-rw-r--r--intern/cycles/bvh/bvh_binning.cpp224
-rw-r--r--intern/cycles/bvh/bvh_binning.h86
-rw-r--r--intern/cycles/bvh/bvh_split.cpp293
-rw-r--r--intern/cycles/bvh/bvh_split.h110
-rw-r--r--intern/cycles/device/device_cuda.cpp32
-rw-r--r--intern/cycles/kernel/kernel_camera.h10
-rw-r--r--intern/cycles/kernel/kernel_path.h7
-rw-r--r--intern/cycles/kernel/kernel_shader.h3
-rw-r--r--intern/cycles/kernel/kernel_types.h21
-rw-r--r--intern/cycles/render/camera.cpp22
-rw-r--r--intern/cycles/render/camera.h9
-rw-r--r--intern/cycles/util/util_task.cpp274
-rw-r--r--intern/cycles/util/util_task.h126
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.cpp2
-rw-r--r--intern/guardedalloc/cpp/mallocn.cpp4
-rw-r--r--release/scripts/presets/tracking_settings/blurry_movie.py11
-rw-r--r--release/scripts/startup/bl_operators/image.py26
-rw-r--r--release/scripts/startup/bl_ui/properties_data_camera.py14
-rw-r--r--release/scripts/startup/bl_ui/properties_data_curve.py8
-rw-r--r--release/scripts/startup/bl_ui/space_clip.py38
-rw-r--r--release/scripts/startup/bl_ui/space_text.py5
-rw-r--r--source/blender/blenfont/intern/blf_internal_types.h2
-rw-r--r--source/blender/blenkernel/BKE_DerivedMesh.h8
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/BKE_paint.h4
-rw-r--r--source/blender/blenkernel/BKE_text.h9
-rw-r--r--source/blender/blenkernel/BKE_tracking.h10
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c30
-rw-r--r--source/blender/blenkernel/intern/camera.c2
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c20
-rw-r--r--source/blender/blenkernel/intern/curve.c2
-rw-r--r--source/blender/blenkernel/intern/customdata.c4
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c5
-rw-r--r--source/blender/blenkernel/intern/displist.c67
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c229
-rw-r--r--source/blender/blenkernel/intern/fluidsim.c4
-rw-r--r--source/blender/blenkernel/intern/mesh.c116
-rw-r--r--source/blender/blenkernel/intern/movieclip.c30
-rw-r--r--source/blender/blenkernel/intern/object.c3
-rw-r--r--source/blender/blenkernel/intern/particle_system.c1
-rw-r--r--source/blender/blenkernel/intern/scene.c2
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c20
-rw-r--r--source/blender/blenkernel/intern/text.c83
-rw-r--r--source/blender/blenkernel/intern/tracking.c268
-rw-r--r--source/blender/blenlib/BLI_ghash.h4
-rw-r--r--source/blender/blenlib/BLI_lasso.h41
-rw-r--r--source/blender/blenlib/intern/BLI_ghash.c6
-rw-r--r--source/blender/blenlib/intern/lasso.c129
-rw-r--r--source/blender/blenlib/intern/uvproject.c2
-rw-r--r--source/blender/blenloader/CMakeLists.txt2
-rw-r--r--source/blender/blenloader/intern/readfile.c6056
-rw-r--r--source/blender/blenloader/intern/readfile.h18
-rw-r--r--source/blender/blenloader/intern/versioning_250.c2676
-rw-r--r--source/blender/blenloader/intern/versioning_legacy.c3560
-rw-r--r--source/blender/blenloader/intern/writefile.c14
-rw-r--r--source/blender/bmesh/intern/bmesh_construct.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_interp.c35
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.c12
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_validate.c6
-rw-r--r--source/blender/bmesh/intern/bmesh_mods.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_opdefines.c1
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.c6
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.h2
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.c2
-rw-r--r--source/blender/bmesh/operators/bmo_bevel.c18
-rw-r--r--source/blender/bmesh/operators/bmo_create.c2
-rw-r--r--source/blender/bmesh/operators/bmo_dissolve.c46
-rw-r--r--source/blender/bmesh/operators/bmo_extrude.c2
-rw-r--r--source/blender/bmesh/operators/bmo_hull.c758
-rw-r--r--source/blender/bmesh/operators/bmo_inset.c3
-rw-r--r--source/blender/bmesh/operators/bmo_removedoubles.c2
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide.c35
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide.h1
-rw-r--r--source/blender/bmesh/operators/bmo_triangulate.c10
-rw-r--r--source/blender/bmesh/operators/bmo_wireframe.c404
-rw-r--r--source/blender/bmesh/tools/BME_bevel.c30
-rw-r--r--source/blender/collada/AnimationImporter.cpp19
-rw-r--r--source/blender/collada/AnimationImporter.h1
-rw-r--r--source/blender/collada/ArmatureImporter.cpp4
-rw-r--r--source/blender/collada/CameraExporter.cpp16
-rw-r--r--source/blender/collada/DocumentImporter.cpp14
-rw-r--r--source/blender/collada/MeshImporter.cpp24
-rw-r--r--source/blender/collada/SkinInfo.cpp2
-rw-r--r--source/blender/collada/collada_utils.cpp2
-rw-r--r--source/blender/collada/collada_utils.h2
-rw-r--r--source/blender/editors/animation/keyframing.c1
-rw-r--r--source/blender/editors/animation/keyingsets.c3
-rw-r--r--source/blender/editors/armature/editarmature.c2
-rw-r--r--source/blender/editors/curve/editcurve.c20
-rw-r--r--source/blender/editors/curve/editfont.c1
-rw-r--r--source/blender/editors/include/BIF_glutil.h23
-rw-r--r--source/blender/editors/include/ED_clip.h5
-rw-r--r--source/blender/editors/include/ED_sculpt.h2
-rw-r--r--source/blender/editors/interface/interface_draw.c19
-rw-r--r--source/blender/editors/mesh/editmesh_add.c2
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c5
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c2
-rw-r--r--source/blender/editors/mesh/editmesh_select.c4
-rw-r--r--source/blender/editors/mesh/editmesh_slide.c2
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c58
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c2
-rw-r--r--source/blender/editors/mesh/mesh_data.c6
-rw-r--r--source/blender/editors/object/object_add.c4
-rw-r--r--source/blender/editors/object/object_hook.c3
-rw-r--r--source/blender/editors/object/object_intern.h1
-rw-r--r--source/blender/editors/object/object_ops.c1
-rw-r--r--source/blender/editors/object/object_vgroup.c282
-rw-r--r--source/blender/editors/physics/particle_boids.c2
-rw-r--r--source/blender/editors/render/render_opengl.c7
-rw-r--r--source/blender/editors/screen/area.c4
-rw-r--r--source/blender/editors/screen/glutil.c8
-rw-r--r--source/blender/editors/sculpt_paint/paint_intern.h5
-rw-r--r--source/blender/editors/sculpt_paint/paint_ops.c3
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c86
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c125
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_uv.c12
-rw-r--r--source/blender/editors/space_clip/clip_buttons.c14
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_draw.c356
-rw-r--r--source/blender/editors/space_clip/clip_dopesheet_ops.c139
-rw-r--r--source/blender/editors/space_clip/clip_draw.c40
-rw-r--r--source/blender/editors/space_clip/clip_editor.c25
-rw-r--r--source/blender/editors/space_clip/clip_graph_draw.c8
-rw-r--r--source/blender/editors/space_clip/clip_graph_ops.c16
-rw-r--r--source/blender/editors/space_clip/clip_ops.c53
-rw-r--r--source/blender/editors/space_clip/clip_utils.c6
-rw-r--r--source/blender/editors/space_clip/space_clip.c19
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c51
-rw-r--r--source/blender/editors/space_image/image_ops.c18
-rw-r--r--source/blender/editors/space_info/info_ops.c7
-rw-r--r--source/blender/editors/space_node/node_edit.c31
-rw-r--r--source/blender/editors/space_text/space_text.c7
-rw-r--r--source/blender/editors/space_text/text_intern.h2
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c6
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c37
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c4
-rw-r--r--source/blender/editors/transform/transform.c2
-rw-r--r--source/blender/editors/transform/transform_conversions.c4
-rw-r--r--source/blender/editors/transform/transform_generics.c16
-rw-r--r--source/blender/editors/transform/transform_input.c6
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c2
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c4
-rw-r--r--source/blender/editors/uvedit/uvedit_smart_stitch.c30
-rw-r--r--source/blender/editors/uvedit/uvedit_unwrap_ops.c4
-rw-r--r--source/blender/gpu/intern/gpu_draw.c4
-rw-r--r--source/blender/imbuf/intern/moviecache.c8
-rw-r--r--source/blender/imbuf/intern/tiff.c27
-rw-r--r--source/blender/makesdna/DNA_ID.h6
-rw-r--r--source/blender/makesdna/DNA_camera_types.h5
-rw-r--r--source/blender/makesdna/DNA_curve_types.h2
-rw-r--r--source/blender/makesdna/DNA_image_types.h5
-rw-r--r--source/blender/makesdna/DNA_space_types.h15
-rw-r--r--source/blender/makesdna/DNA_tracking_types.h16
-rw-r--r--source/blender/makesdna/intern/makesdna.c2
-rw-r--r--source/blender/makesrna/intern/rna_camera.c7
-rw-r--r--source/blender/makesrna/intern/rna_curve.c12
-rw-r--r--source/blender/makesrna/intern/rna_space.c21
-rw-r--r--source/blender/makesrna/intern/rna_tracking.c2
-rw-r--r--source/blender/modifiers/intern/MOD_boolean_util.c10
-rw-r--r--source/blender/modifiers/intern/MOD_cloth.c2
-rw-r--r--source/blender/modifiers/intern/MOD_collision.c6
-rw-r--r--source/blender/modifiers/intern/MOD_decimate.c4
-rw-r--r--source/blender/modifiers/intern/MOD_displace.c2
-rw-r--r--source/blender/modifiers/intern/MOD_edgesplit.c2
-rw-r--r--source/blender/modifiers/intern/MOD_hook.c16
-rw-r--r--source/blender/modifiers/intern/MOD_mask.c4
-rw-r--r--source/blender/modifiers/intern/MOD_meshdeform.c36
-rw-r--r--source/blender/modifiers/intern/MOD_mirror.c6
-rw-r--r--source/blender/modifiers/intern/MOD_solidify.c21
-rw-r--r--source/blender/modifiers/intern/MOD_uvproject.c2
-rw-r--r--source/blender/modifiers/intern/MOD_warp.c9
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgproximity.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_blur.c1
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_moviedistortion.c6
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_common.c6
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_common.c6
-rw-r--r--source/blender/python/intern/bpy_props.c4
-rw-r--r--source/blender/render/intern/include/strand.h2
-rw-r--r--source/blender/render/intern/source/strand.c64
-rw-r--r--source/blender/render/intern/source/zbuf.c4
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c2
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c12
-rw-r--r--source/blender/windowmanager/intern/wm_subwindow.c2
-rw-r--r--source/gameengine/GamePlayer/common/GPC_Canvas.cpp6
195 files changed, 7297 insertions, 11234 deletions
diff --git a/doc/python_api/examples/bpy.ops.2.py b/doc/python_api/examples/bpy.ops.2.py
deleted file mode 100644
index 86b7438888c..00000000000
--- a/doc/python_api/examples/bpy.ops.2.py
+++ /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
index 0b5bcafe5be..00000000000
--- a/doc/python_api/examples/bpy.ops.3.py
+++ /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
index bb49b30dbce..00000000000
--- a/extern/libmv/libmv/simple_pipeline/modal_solver.cc
+++ /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
index 560b37c2987..00000000000
--- a/extern/libmv/libmv/simple_pipeline/modal_solver.h
+++ /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_
diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp
index db3592f1227..82f1338d86b 100644
--- a/intern/cycles/app/cycles_xml.cpp
+++ b/intern/cycles/app/cycles_xml.cpp
@@ -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;
diff --git a/intern/cycles/blender/addon/enums.py b/intern/cycles/blender/addon/enums.py
index 6cc3010eb0e..b4b1646c10d 100644
--- a/intern/cycles/blender/addon/enums.py
+++ b/intern/cycles/blender/addon/enums.py
@@ -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"),
- )
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index fb066a3a939..35f97bf629f 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -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):
diff --git a/intern/cycles/blender/blender_camera.cpp b/intern/cycles/blender/blender_camera.cpp
index bdd02bb5086..55a32d8fc10 100644
--- a/intern/cycles/blender/blender_camera.cpp
+++ b/intern/cycles/blender/blender_camera.cpp
@@ -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
index e4b88584a33..00000000000
--- a/intern/cycles/bvh/bvh_binning.cpp
+++ /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
index 60742157055..00000000000
--- a/intern/cycles/bvh/bvh_binning.h
+++ /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
index 263c5834428..00000000000
--- a/intern/cycles/bvh/bvh_split.cpp
+++ /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
index 1f4befbe8e2..00000000000
--- a/intern/cycles/bvh/bvh_split.h
+++ /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__ */
-
diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp
index 0a780e5f576..0c08baae3ff 100644
--- a/intern/cycles/device/device_cuda.cpp
+++ b/intern/cycles/device/device_cuda.cpp
@@ -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);
diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h
index 220ebec13ce..aed26f5e852 100644
--- a/intern/cycles/kernel/kernel_camera.h
+++ b/intern/cycles/kernel/kernel_camera.h
@@ -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
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index d53951a1f34..87d996ef9e2 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -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);
diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h
index 2138038e49d..af821bad868 100644
--- a/intern/cycles/kernel/kernel_shader.h
+++ b/intern/cycles/kernel/kernel_shader.h
@@ -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 */
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index 25ff7f73888..85ee16fc5c6 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -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;
diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp
index 95405519cc0..f0b77871130 100644
--- a/intern/cycles/render/camera.cpp
+++ b/intern/cycles/render/camera.cpp
@@ -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()
diff --git a/intern/cycles/render/camera.h b/intern/cycles/render/camera.h
index 7a09b5981e4..935489711c8 100644
--- a/intern/cycles/render/camera.h
+++ b/intern/cycles/render/camera.h
@@ -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
index fc806275ea4..00000000000
--- a/intern/cycles/util/util_task.cpp
+++ /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
index 6b7562c2267..00000000000
--- a/intern/cycles/util/util_task.h
+++ /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
-
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index 3715da12cd6..9d105748095 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -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
diff --git a/intern/guardedalloc/cpp/mallocn.cpp b/intern/guardedalloc/cpp/mallocn.cpp
index 130fcb6960b..97e68d06ace 100644
--- a/intern/guardedalloc/cpp/mallocn.cpp
+++ b/intern/guardedalloc/cpp/mallocn.cpp
@@ -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
index 8a503bec9bd..00000000000
--- a/release/scripts/presets/tracking_settings/blurry_movie.py
+++ /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
diff --git a/release/scripts/startup/bl_operators/image.py b/release/scripts/startup/bl_operators/image.py
index 6af6488e86b..1b7d5e3a40d 100644
--- a/release/scripts/startup/bl_operators/image.py
+++ b/release/scripts/startup/bl_operators/image.py
@@ -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'}
diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py
index 49457b8e569..5da41a668f6 100644
--- a/release/scripts/startup/bl_ui/properties_data_camera.py
+++ b/release/scripts/startup/bl_ui/properties_data_camera.py
@@ -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()
diff --git a/release/scripts/startup/bl_ui/properties_data_curve.py b/release/scripts/startup/bl_ui/properties_data_curve.py
index 6a7415f7cec..b8a37e38a17 100644
--- a/release/scripts/startup/bl_ui/properties_data_curve.py
+++ b/release/scripts/startup/bl_ui/properties_data_curve.py
@@ -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):
diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index bd3f087e38a..0b96ec772c8 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -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")
diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py
index dd752431df9..a40e08c2e5c 100644
--- a/release/scripts/startup/bl_ui/space_text.py
+++ b/release/scripts/startup/bl_ui/space_text.py
@@ -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")
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
index bf9b9858348..cbe7975fdd6 100644
--- a/source/blender/blenfont/intern/blf_internal_types.h
+++ b/source/blender/blenfont/intern/blf_internal_types.h
@@ -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. */
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index a15192f156a..3a28af97166 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -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;
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index 62f1dbc5867..4ea38628001 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -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
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index bd31a62abf9..acf39d83370 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -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);
diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h
index 875903f2e20..592b3d1d2e0 100644
--- a/source/blender/blenkernel/BKE_text.h
+++ b/source/blender/blenkernel/BKE_text.h
@@ -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 */
diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h
index 817cb477aba..3b1a5dbfc8a 100644
--- a/source/blender/blenkernel/BKE_tracking.h
+++ b/source/blender/blenkernel/BKE_tracking.h
@@ -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
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 2024a5ce091..c0bf798478c 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -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;
}
}
}
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index efede6bbae7..6aff331e1b4 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -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;
}
}
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 15db0df1bad..6fdaa3043cb 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -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++;
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 0f12b79e05d..771ba5e98a0 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -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();
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index e32182ed36e..a6666bf4fae 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -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)
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 54655cf8582..45298aa0b3b 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -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) {
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 04e559388ca..e7226a403bb 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -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);
}
}
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index 428dc176e1d..34794bd5b1f 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -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;
}
/**
diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c
index 9be599ac66c..9f7d76d251d 100644
--- a/source/blender/blenkernel/intern/fluidsim.c
+++ b/source/blender/blenkernel/intern/fluidsim.c
@@ -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);
}
-
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index ffc33e3b86a..f431b21b78c 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -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,
diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c
index 849dbd83366..964a20659e0 100644
--- a/source/blender/blenkernel/intern/movieclip.c
+++ b/source/blender/blenkernel/intern/movieclip.c
@@ -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);
}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 1057b027d1b..fae96a732a7 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -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 */
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 950298f3824..2af1645bba5 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -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;
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 37d7cc06fe7..2526bd05857 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -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;
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 857a0c86349..99880cd659f 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -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); \
} \
}
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index e3e4f663e27..b4b4e0f623c 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -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;
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index b68102885ea..760743aafeb 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -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);
}
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h
index b178538edf2..02042fbfb95 100644
--- a/source/blender/blenlib/BLI_ghash.h
+++ b/source/blender/blenlib/BLI_ghash.h
@@ -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
index 2360173c3b8..00000000000
--- a/source/blender/blenlib/BLI_lasso.h
+++ /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
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index 4dba726cb61..28b4794ed1b 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -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
index 29b967fcd37..00000000000
--- a/source/blender/blenlib/intern/lasso.c
+++ /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;
-}
diff --git a/source/blender/blenlib/intern/uvproject.c b/source/blender/blenlib/intern/uvproject.c
index a630084e79d..31229c76869 100644
--- a/source/blender/blenlib/intern/uvproject.c
+++ b/source/blender/blenlib/intern/uvproject.c
@@ -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;
diff --git a/source/blender/blenloader/CMakeLists.txt b/source/blender/blenloader/CMakeLists.txt
index a0fe042e7fb..35271f7b873 100644
--- a/source/blender/blenloader/CMakeLists.txt
+++ b/source/blender/blenloader/CMakeLists.txt
@@ -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
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 7e27106a82f..04585b726f3 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -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,7 +6516,1012 @@ static void link_global(FileData *fd, BlendFileData *bfd)
}
}
+static void vcol_to_fcol(Mesh *me)
+{
+ MFace *mface;
+ unsigned int *mcol, *mcoln, *mcolmain;
+ int a;
+
+ if (me->totface==0 || me->mcol==NULL) return;
+
+ 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;
+ }
+
+ MEM_freeN(me->mcol);
+ me->mcol= (MCol *)mcolmain;
+}
+
+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_version_bone_head_tail_237(Bone *bone)
+{
+ 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 bone_version_239(ListBase *lb)
+{
+ Bone *bone;
+
+ for (bone= lb->first; bone; bone= bone->next) {
+ if (bone->layer==0)
+ bone->layer= 1;
+ bone_version_239(&bone->childbase);
+ }
+}
+
+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 ntree_version_242(bNodeTree *ntree)
+{
+ bNode *node;
+
+ 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");
+ }
+
+}
+
+static void customdata_version_242(Mesh *me)
+{
+ CustomDataLayer *layer;
+ MTFace *mtf;
+ MCol *mcol;
+ TFace *tf;
+ int a, mtfacen, mcoln;
+
+ if (!me->vdata.totlayer) {
+ CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, me->mvert, me->totvert);
+
+ 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);
+ }
+
+ 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);
+
+ if (me->tface) {
+ if (me->mcol)
+ MEM_freeN(me->mcol);
+
+ 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;
+ }
+ else if (me->mcol) {
+ me->mcol= CustomData_add_layer(&me->fdata, CD_MCOL, CD_ASSIGN, me->mcol, me->totface);
+ }
+ }
+
+ 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++;
+ }
+ 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++;
+ }
+ }
+
+ mesh_update_customdata_pointers(me, TRUE);
+}
+
+/*only copy render texface layer from active*/
+static void customdata_version_243(Mesh *me)
+{
+ CustomDataLayer *layer;
+ int a;
+
+ for (a=0; a < me->fdata.totlayer; a++) {
+ layer= &me->fdata.layers[a];
+ layer->active_rnd = layer->active;
+ }
+}
+
+/* struct NodeImageAnim moved to ImageUser, and we make it default available */
+static void do_version_ntree_242_2(bNodeTree *ntree)
+{
+ bNode *node;
+
+ 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);
+ }
+ else {
+ ImageUser *iuser= node->storage= MEM_callocN(sizeof(ImageUser), "node image user");
+ iuser->sfra= 1;
+ iuser->fie_ima= 2;
+ iuser->ok= 1;
+ }
+ }
+ }
+ }
+}
+
+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;
+ }
+ }
+
+ /* 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);
+ ar->regiontype= RGN_TYPE_UI;
+ ar->alignment= RGN_ALIGN_TOP;
+ break;
+ case SPACE_SEQ:
+ ar_main = (ARegion*)lb->first;
+ for (; ar_main; ar_main = ar_main->next) {
+ if (ar_main->regiontype == RGN_TYPE_WINDOW)
+ break;
+ }
+ ar= MEM_callocN(sizeof(ARegion), "preview area for sequencer");
+ BLI_insertlinkbefore(lb, ar_main, ar);
+ sequencer_init_preview_region(ar);
+ break;
+ case SPACE_VIEW3D:
+ /* toolbar */
+ ar= MEM_callocN(sizeof(ARegion), "toolbar for view3d");
+
+ BLI_addtail(lb, ar);
+ ar->regiontype= RGN_TYPE_TOOLS;
+ ar->alignment= RGN_ALIGN_LEFT;
+ ar->flag = RGN_FLAG_HIDDEN;
+
+ /* tool properties */
+ ar= MEM_callocN(sizeof(ARegion), "tool properties for view3d");
+
+ BLI_addtail(lb, ar);
+ ar->regiontype= RGN_TYPE_TOOL_PROPS;
+ ar->alignment= RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV;
+ ar->flag = RGN_FLAG_HIDDEN;
+
+ /* buttons/list view */
+ ar= MEM_callocN(sizeof(ARegion), "buttons for view3d");
+
+ BLI_addtail(lb, ar);
+ ar->regiontype= RGN_TYPE_UI;
+ ar->alignment= RGN_ALIGN_RIGHT;
+ ar->flag = RGN_FLAG_HIDDEN;
+#if 0
+ case SPACE_BUTS:
+ /* context UI region */
+ ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
+ BLI_addtail(lb, ar);
+ ar->regiontype= RGN_TYPE_UI;
+ ar->alignment= RGN_ALIGN_RIGHT;
+
+ break;
+#endif
+ }
+ }
+
+ /* main region */
+ ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
+
+ BLI_addtail(lb, ar);
+ ar->winrct= sa->totrct;
+
+ ar->regiontype= RGN_TYPE_WINDOW;
+
+ if (sl) {
+ /* if active spacetype has view2d data, copy that over to main region */
+ /* and we split view3d */
+ switch (sl->spacetype) {
+ case SPACE_VIEW3D:
+ view3d_split_250((View3D *)sl, lb);
+ break;
+
+ case SPACE_OUTLINER:
+ {
+ SpaceOops *soops= (SpaceOops *)sl;
+
+ memcpy(&ar->v2d, &soops->v2d, sizeof(View2D));
+
+ ar->v2d.scroll &= ~V2D_SCROLL_LEFT;
+ ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM_O);
+ ar->v2d.align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
+ ar->v2d.keepzoom |= (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPASPECT);
+ ar->v2d.keeptot = V2D_KEEPTOT_STRICT;
+ ar->v2d.minzoom= ar->v2d.maxzoom= 1.0f;
+ //ar->v2d.flag |= V2D_IS_INITIALISED;
+ }
+ break;
+ case SPACE_TIME:
+ {
+ SpaceTime *stime= (SpaceTime *)sl;
+ memcpy(&ar->v2d, &stime->v2d, sizeof(View2D));
+
+ ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
+ ar->v2d.align |= V2D_ALIGN_NO_NEG_Y;
+ ar->v2d.keepofs |= V2D_LOCKOFS_Y;
+ ar->v2d.keepzoom |= V2D_LOCKZOOM_Y;
+ ar->v2d.tot.ymin = ar->v2d.cur.ymin = -10.0;
+ ar->v2d.min[1]= ar->v2d.max[1]= 20.0;
+ }
+ break;
+ case SPACE_IPO:
+ {
+ SpaceIpo *sipo= (SpaceIpo *)sl;
+ memcpy(&ar->v2d, &sipo->v2d, sizeof(View2D));
+
+ /* init mainarea view2d */
+ ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
+ ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
+
+ ar->v2d.min[0]= FLT_MIN;
+ ar->v2d.min[1]= FLT_MIN;
+
+ ar->v2d.max[0]= MAXFRAMEF;
+ ar->v2d.max[1]= FLT_MAX;
+
+ //ar->v2d.flag |= V2D_IS_INITIALISED;
+ break;
+ }
+ case SPACE_NLA:
+ {
+ SpaceNla *snla= (SpaceNla *)sl;
+ memcpy(&ar->v2d, &snla->v2d, sizeof(View2D));
+
+ ar->v2d.tot.ymin = (float)(-sa->winy)/3.0f;
+ ar->v2d.tot.ymax = 0.0f;
+
+ ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
+ ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
+ ar->v2d.align = V2D_ALIGN_NO_POS_Y;
+ ar->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL;
+ break;
+ }
+ case SPACE_ACTION:
+ {
+ SpaceAction *saction= (SpaceAction *)sl;
+
+ /* we totally reinit the view for the Action Editor, as some old instances had some weird cruft set */
+ ar->v2d.tot.xmin = -20.0f;
+ ar->v2d.tot.ymin = (float)(-sa->winy)/3.0f;
+ ar->v2d.tot.xmax = (float)((sa->winx > 120)? (sa->winx) : 120);
+ ar->v2d.tot.ymax = 0.0f;
+
+ ar->v2d.cur= ar->v2d.tot;
+
+ ar->v2d.min[0]= 0.0f;
+ ar->v2d.min[1]= 0.0f;
+
+ ar->v2d.max[0]= MAXFRAMEF;
+ ar->v2d.max[1]= FLT_MAX;
+
+ ar->v2d.minzoom= 0.01f;
+ ar->v2d.maxzoom= 50;
+ ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
+ ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
+ ar->v2d.keepzoom= V2D_LOCKZOOM_Y;
+ ar->v2d.align= V2D_ALIGN_NO_POS_Y;
+ ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
+
+ /* for old files with ShapeKey editors open + an action set, clear the action as
+ * it doesn't make sense in the new system (i.e. violates concept that ShapeKey edit
+ * only shows ShapeKey-rooted actions only)
+ */
+ if (saction->mode == SACTCONT_SHAPEKEY)
+ saction->action = NULL;
+ break;
+ }
+ case SPACE_SEQ:
+ {
+ SpaceSeq *sseq= (SpaceSeq *)sl;
+ memcpy(&ar->v2d, &sseq->v2d, sizeof(View2D));
+
+ ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
+ ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
+ ar->v2d.align= V2D_ALIGN_NO_NEG_Y;
+ ar->v2d.flag |= V2D_IS_INITIALISED;
+ break;
+ }
+ case SPACE_NODE:
+ {
+ SpaceNode *snode= (SpaceNode *)sl;
+ memcpy(&ar->v2d, &snode->v2d, sizeof(View2D));
+
+ ar->v2d.scroll= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
+ ar->v2d.keepzoom= V2D_LIMITZOOM|V2D_KEEPASPECT;
+ break;
+ }
+ case SPACE_BUTS:
+ {
+ SpaceButs *sbuts= (SpaceButs *)sl;
+ memcpy(&ar->v2d, &sbuts->v2d, sizeof(View2D));
+
+ ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
+ break;
+ }
+ case SPACE_FILE:
+ {
+ // SpaceFile *sfile= (SpaceFile *)sl;
+ ar->v2d.tot.xmin = ar->v2d.tot.ymin = 0;
+ ar->v2d.tot.xmax = ar->winx;
+ ar->v2d.tot.ymax = ar->winy;
+ ar->v2d.cur = ar->v2d.tot;
+ ar->regiontype= RGN_TYPE_WINDOW;
+ ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM_O);
+ ar->v2d.align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
+ ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
+ break;
+ }
+ case SPACE_TEXT:
+ {
+ SpaceText *st= (SpaceText *)sl;
+ st->flags |= ST_FIND_WRAP;
+ }
+ //case SPACE_XXX: // FIXME... add other ones
+ // memcpy(&ar->v2d, &((SpaceXxx *)sl)->v2d, sizeof(View2D));
+ // break;
+ }
+ }
+}
+
+static void do_versions_windowmanager_2_50(bScreen *screen)
+{
+ ScrArea *sa;
+ SpaceLink *sl;
+
+ /* add regions */
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
+
+ /* we keep headertype variable to convert old files only */
+ if (sa->headertype)
+ area_add_header_region(sa, &sa->regionbase);
+
+ area_add_window_regions(sa, sa->spacedata.first, &sa->regionbase);
+
+ /* space imageselect is deprecated */
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_IMASEL)
+ sl->spacetype= SPACE_EMPTY; /* spacedata then matches */
+ }
+
+ /* space sound is deprecated */
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_SOUND)
+ sl->spacetype= SPACE_EMPTY; /* spacedata then matches */
+ }
+
+ /* it seems to be possible in 2.5 to have this saved, filewindow probably */
+ sa->butspacetype= sa->spacetype;
+
+ /* pushed back spaces also need regions! */
+ if (sa->spacedata.first) {
+ sl= sa->spacedata.first;
+ for (sl= sl->next; sl; sl= sl->next) {
+ if (sa->headertype)
+ area_add_header_region(sa, &sl->regionbase);
+ area_add_window_regions(sa, sl, &sl->regionbase);
+ }
+ }
+ }
+}
+
+static void versions_gpencil_add_main(ListBase *lb, ID *id, const char *name)
+{
+
+ BLI_addtail(lb, id);
+ id->us= 1;
+ id->flag= LIB_FAKEUSER;
+ *( (short *)id->name )= ID_GD;
+
+ new_id(lb, id, name);
+ /* alphabetic insterion: is in new_id */
+
+ if (G.debug & G_DEBUG)
+ printf("Converted GPencil to ID: %s\n", id->name+2);
+}
+
+static void do_versions_gpencil_2_50(Main *main, bScreen *screen)
+{
+ ScrArea *sa;
+ SpaceLink *sl;
+
+ /* add regions */
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_VIEW3D) {
+ View3D *v3d= (View3D*) sl;
+ if (v3d->gpd) {
+ versions_gpencil_add_main(&main->gpencil, (ID *)v3d->gpd, "GPencil View3D");
+ v3d->gpd= NULL;
+ }
+ }
+ else if (sl->spacetype==SPACE_NODE) {
+ SpaceNode *snode= (SpaceNode *)sl;
+ if (snode->gpd) {
+ versions_gpencil_add_main(&main->gpencil, (ID *)snode->gpd, "GPencil Node");
+ snode->gpd= NULL;
+ }
+ }
+ else if (sl->spacetype==SPACE_SEQ) {
+ SpaceSeq *sseq= (SpaceSeq *)sl;
+ if (sseq->gpd) {
+ versions_gpencil_add_main(&main->gpencil, (ID *)sseq->gpd, "GPencil Node");
+ sseq->gpd= NULL;
+ }
+ }
+ else if (sl->spacetype==SPACE_IMAGE) {
+ SpaceImage *sima= (SpaceImage *)sl;
+#if 0 /* see comment on r28002 */
+ if (sima->gpd) {
+ versions_gpencil_add_main(&main->gpencil, (ID *)sima->gpd, "GPencil Image");
+ sima->gpd= NULL;
+ }
+#else
+ sima->gpd= NULL;
+#endif
+ }
+ }
+ }
+}
+
/* deprecated, only keep this for readfile.c */
+static PartEff *do_version_give_parteff_245(Object *ob)
+{
+ PartEff *paf;
+
+ paf= ob->effect.first;
+ while (paf) {
+ if (paf->type==EFF_PARTICLE) return paf;
+ paf= paf->next;
+ }
+ return NULL;
+}
+static void do_version_free_effect_245(Effect *eff)
+{
+ PartEff *paf;
+
+ if (eff->type==EFF_PARTICLE) {
+ paf= (PartEff *)eff;
+ if (paf->keys) MEM_freeN(paf->keys);
+ }
+ MEM_freeN(eff);
+}
+static void do_version_free_effects_245(ListBase *lb)
+{
+ Effect *eff;
+
+ eff= lb->first;
+ while (eff) {
+ BLI_remlink(lb, eff);
+ do_version_free_effect_245(eff);
+ eff= lb->first;
+ }
+}
+
+static void do_version_mtex_factor_2_50(MTex **mtex_array, short idtype)
+{
+ MTex *mtex;
+ float varfac, colfac;
+ int a, neg;
+
+ if (!mtex_array)
+ return;
+
+ for (a=0; a<MAX_MTEX; a++) {
+ if (mtex_array[a]) {
+ mtex= mtex_array[a];
+
+ neg= mtex->maptoneg;
+ varfac= mtex->varfac;
+ colfac= mtex->colfac;
+
+ if (neg & MAP_DISP) mtex->dispfac= -mtex->dispfac;
+ if (neg & MAP_NORM) mtex->norfac= -mtex->norfac;
+ if (neg & MAP_WARP) mtex->warpfac= -mtex->warpfac;
+
+ mtex->colspecfac= (neg & MAP_COLSPEC)? -colfac: colfac;
+ mtex->mirrfac= (neg & MAP_COLMIR)? -colfac: colfac;
+ mtex->alphafac= (neg & MAP_ALPHA)? -varfac: varfac;
+ mtex->difffac= (neg & MAP_REF)? -varfac: varfac;
+ mtex->specfac= (neg & MAP_SPEC)? -varfac: varfac;
+ mtex->emitfac= (neg & MAP_EMIT)? -varfac: varfac;
+ mtex->hardfac= (neg & MAP_HAR)? -varfac: varfac;
+ mtex->raymirrfac= (neg & MAP_RAYMIRR)? -varfac: varfac;
+ mtex->translfac= (neg & MAP_TRANSLU)? -varfac: varfac;
+ mtex->ambfac= (neg & MAP_AMB)? -varfac: varfac;
+ mtex->colemitfac= (neg & MAP_EMISSION_COL)? -colfac: colfac;
+ mtex->colreflfac= (neg & MAP_REFLECTION_COL)? -colfac: colfac;
+ mtex->coltransfac= (neg & MAP_TRANSMISSION_COL)? -colfac: colfac;
+ mtex->densfac= (neg & MAP_DENSITY)? -varfac: varfac;
+ mtex->scatterfac= (neg & MAP_SCATTERING)? -varfac: varfac;
+ mtex->reflfac= (neg & MAP_REFLECTION)? -varfac: varfac;
+
+ mtex->timefac= (neg & MAP_PA_TIME)? -varfac: varfac;
+ mtex->lengthfac= (neg & MAP_PA_LENGTH)? -varfac: varfac;
+ mtex->clumpfac= (neg & MAP_PA_CLUMP)? -varfac: varfac;
+ mtex->kinkfac= (neg & MAP_PA_KINK)? -varfac: varfac;
+ mtex->roughfac= (neg & MAP_PA_ROUGH)? -varfac: varfac;
+ mtex->padensfac= (neg & MAP_PA_DENS)? -varfac: varfac;
+ mtex->lifefac= (neg & MAP_PA_LIFE)? -varfac: varfac;
+ mtex->sizefac= (neg & MAP_PA_SIZE)? -varfac: varfac;
+ mtex->ivelfac= (neg & MAP_PA_IVEL)? -varfac: varfac;
+
+ mtex->shadowfac= (neg & LAMAP_SHAD)? -colfac: colfac;
+
+ mtex->zenupfac= (neg & WOMAP_ZENUP)? -colfac: colfac;
+ mtex->zendownfac= (neg & WOMAP_ZENDOWN)? -colfac: colfac;
+ mtex->blendfac= (neg & WOMAP_BLEND)? -varfac: varfac;
+
+ if (idtype == ID_MA)
+ mtex->colfac= (neg & MAP_COL)? -colfac: colfac;
+ else if (idtype == ID_LA)
+ mtex->colfac= (neg & LAMAP_COL)? -colfac: colfac;
+ else if (idtype == ID_WO)
+ mtex->colfac= (neg & WOMAP_HORIZ)? -colfac: colfac;
+ }
+ }
+}
+
+static void do_version_mdef_250(Main *main)
+{
+ Object *ob;
+ ModifierData *md;
+ MeshDeformModifierData *mmd;
+
+ for (ob= main->object.first; ob; ob=ob->id.next) {
+ for (md=ob->modifiers.first; md; md=md->next) {
+ if (md->type == eModifierType_MeshDeform) {
+ mmd= (MeshDeformModifierData*)md;
+
+ if (mmd->bindcos) {
+ /* make bindcos NULL in order to trick older versions
+ * into thinking that the mesh was not bound yet */
+ mmd->bindcagecos= mmd->bindcos;
+ mmd->bindcos= NULL;
+
+ modifier_mdef_compact_influences(md);
+ }
+ }
+ }
+ }
+}
+
+static void do_version_constraints_radians_degrees_250(ListBase *lb)
+{
+ bConstraint *con;
+
+ for (con=lb->first; con; con=con->next) {
+ if (con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) {
+ bRigidBodyJointConstraint *data = con->data;
+ data->axX *= (float)(M_PI/180.0);
+ data->axY *= (float)(M_PI/180.0);
+ data->axZ *= (float)(M_PI/180.0);
+ }
+ else if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
+ bKinematicConstraint *data = con->data;
+ data->poleangle *= (float)(M_PI/180.0);
+ }
+ else if (con->type==CONSTRAINT_TYPE_ROTLIMIT) {
+ bRotLimitConstraint *data = con->data;
+
+ data->xmin *= (float)(M_PI/180.0);
+ data->xmax *= (float)(M_PI/180.0);
+ data->ymin *= (float)(M_PI/180.0);
+ data->ymax *= (float)(M_PI/180.0);
+ data->zmin *= (float)(M_PI/180.0);
+ data->zmax *= (float)(M_PI/180.0);
+ }
+ }
+}
+
+/* NOTE: this version patch is intended for versions < 2.52.2, but was initially introduced in 2.27 already */
+static void do_version_old_trackto_to_constraints(Object *ob)
+{
+ /* create new trackto constraint from the relationship */
+ if (ob->track) {
+ bConstraint *con= add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_TRACKTO);
+ bTrackToConstraint *data = con->data;
+
+ /* copy tracking settings from the object */
+ data->tar = ob->track;
+ data->reserved1 = ob->trackflag;
+ data->reserved2 = ob->upflag;
+ }
+
+ /* clear old track setting */
+ ob->track = NULL;
+}
+
+static void do_versions_seq_unique_name_all_strips(
+ Scene * sce, ListBase *seqbasep)
+{
+ Sequence * seq = seqbasep->first;
+
+ while (seq) {
+ seqbase_unique_name_recursive(&sce->ed->seqbase, seq);
+ if (seq->seqbase.first) {
+ do_versions_seq_unique_name_all_strips(
+ sce, &seq->seqbase);
+ }
+ seq=seq->next;
+ }
+}
+
+
+static void do_version_bone_roll_256(Bone *bone)
+{
+ Bone *child;
+ float submat[3][3];
+
+ copy_m3_m4(submat, bone->arm_mat);
+ mat3_to_vec_roll(submat, NULL, &bone->arm_roll);
+
+ for (child = bone->childbase.first; child; child = child->next)
+ do_version_bone_roll_256(child);
+}
+
+static void do_versions_nodetree_dynamic_sockets(bNodeTree *ntree)
+{
+ bNodeSocket *sock;
+ for (sock=ntree->inputs.first; sock; sock=sock->next)
+ sock->flag |= SOCK_DYNAMIC;
+ for (sock=ntree->outputs.first; sock; sock=sock->next)
+ sock->flag |= SOCK_DYNAMIC;
+}
+
void convert_tface_mt(FileData *fd, Main *main)
{
Main *gmain;
@@ -6815,9 +7818,4990 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if (G.debug & G_DEBUG)
printf("read file %s\n Version %d sub %d svn r%d\n", fd->relabase, main->versionfile, main->subversionfile, main->revision);
+
+ if (main->versionfile == 100) {
+ /* tex->extend and tex->imageflag have changed: */
+ Tex *tex = main->tex.first;
+ while (tex) {
+ if (tex->id.flag & LIB_NEEDLINK) {
+
+ if (tex->extend==0) {
+ if (tex->xrepeat || tex->yrepeat) tex->extend= TEX_REPEAT;
+ else {
+ tex->extend= TEX_EXTEND;
+ tex->xrepeat= tex->yrepeat= 1;
+ }
+ }
+
+ }
+ tex= tex->id.next;
+ }
+ }
+ if (main->versionfile <= 101) {
+ /* frame mapping */
+ Scene *sce = main->scene.first;
+ while (sce) {
+ sce->r.framapto= 100;
+ sce->r.images= 100;
+ sce->r.framelen= 1.0;
+ sce= sce->id.next;
+ }
+ }
+ if (main->versionfile <= 102) {
+ /* init halo's at 1.0 */
+ Material *ma = main->mat.first;
+ while (ma) {
+ ma->add= 1.0;
+ ma= ma->id.next;
+ }
+ }
+ if (main->versionfile <= 103) {
+ /* new variable in object: colbits */
+ Object *ob = main->object.first;
+ int a;
+ while (ob) {
+ ob->colbits= 0;
+ if (ob->totcol) {
+ for (a=0; a<ob->totcol; a++) {
+ if (ob->mat[a]) ob->colbits |= (1<<a);
+ }
+ }
+ ob= ob->id.next;
+ }
+ }
+ if (main->versionfile <= 104) {
+ /* timeoffs moved */
+ Object *ob = main->object.first;
+ while (ob) {
+ if (ob->transflag & 1) {
+ ob->transflag -= 1;
+ //ob->ipoflag |= OB_OFFS_OB;
+ }
+ ob= ob->id.next;
+ }
+ }
+ if (main->versionfile <= 105) {
+ Object *ob = main->object.first;
+ while (ob) {
+ ob->dupon= 1; ob->dupoff= 0;
+ ob->dupsta= 1; ob->dupend= 100;
+ ob= ob->id.next;
+ }
+ }
+ if (main->versionfile <= 106) {
+ /* mcol changed */
+ Mesh *me = main->mesh.first;
+ while (me) {
+ if (me->mcol) vcol_to_fcol(me);
+ me= me->id.next;
+ }
+
+ }
+ if (main->versionfile <= 107) {
+ Object *ob;
+ Scene *sce = main->scene.first;
+ while (sce) {
+ sce->r.mode |= R_GAMMA;
+ sce= sce->id.next;
+ }
+ ob= main->object.first;
+ while (ob) {
+ //ob->ipoflag |= OB_OFFS_PARENT;
+ if (ob->dt==0) ob->dt= OB_SOLID;
+ ob= ob->id.next;
+ }
+
+ }
+ if (main->versionfile <= 109) {
+ /* new variable: gridlines */
+ bScreen *sc = main->screen.first;
+ while (sc) {
+ ScrArea *sa= sc->areabase.first;
+ while (sa) {
+ SpaceLink *sl= sa->spacedata.first;
+ while (sl) {
+ if (sl->spacetype==SPACE_VIEW3D) {
+ View3D *v3d= (View3D*) sl;
+
+ if (v3d->gridlines==0) v3d->gridlines= 20;
+ }
+ sl= sl->next;
+ }
+ sa= sa->next;
+ }
+ sc= sc->id.next;
+ }
+ }
+ if (main->versionfile <= 113) {
+ Material *ma = main->mat.first;
+ while (ma) {
+ if (ma->flaresize==0.0f) ma->flaresize= 1.0f;
+ ma->subsize= 1.0f;
+ ma->flareboost= 1.0f;
+ ma= ma->id.next;
+ }
+ }
+
+ if (main->versionfile <= 134) {
+ Tex *tex = main->tex.first;
+ while (tex) {
+ if ((tex->rfac == 0.0f) &&
+ (tex->gfac == 0.0f) &&
+ (tex->bfac == 0.0f)) {
+ tex->rfac = 1.0f;
+ tex->gfac = 1.0f;
+ tex->bfac = 1.0f;
+ tex->filtersize = 1.0f;
+ }
+ tex = tex->id.next;
+ }
+ }
+ if (main->versionfile <= 140) {
+ /* r-g-b-fac in texture */
+ Tex *tex = main->tex.first;
+ while (tex) {
+ if ((tex->rfac == 0.0f) &&
+ (tex->gfac == 0.0f) &&
+ (tex->bfac == 0.0f)) {
+ tex->rfac = 1.0f;
+ tex->gfac = 1.0f;
+ tex->bfac = 1.0f;
+ tex->filtersize = 1.0f;
+ }
+ tex = tex->id.next;
+ }
+ }
+ if (main->versionfile <= 153) {
+ Scene *sce = main->scene.first;
+ while (sce) {
+ if (sce->r.blurfac==0.0f) sce->r.blurfac= 1.0f;
+ sce= sce->id.next;
+ }
+ }
+ if (main->versionfile <= 163) {
+ Scene *sce = main->scene.first;
+ while (sce) {
+ if (sce->r.frs_sec==0) sce->r.frs_sec= 25;
+ sce= sce->id.next;
+ }
+ }
+ if (main->versionfile <= 164) {
+ Mesh *me= main->mesh.first;
+ while (me) {
+ me->smoothresh= 30;
+ me= me->id.next;
+ }
+ }
+ if (main->versionfile <= 165) {
+ Mesh *me= main->mesh.first;
+ TFace *tface;
+ int nr;
+ char *cp;
+
+ while (me) {
+ if (me->tface) {
+ nr= me->totface;
+ tface= me->tface;
+ while (nr--) {
+ cp= (char *)&tface->col[0];
+ if (cp[1]>126) cp[1]= 255; else cp[1]*=2;
+ if (cp[2]>126) cp[2]= 255; else cp[2]*=2;
+ if (cp[3]>126) cp[3]= 255; else cp[3]*=2;
+ cp= (char *)&tface->col[1];
+ if (cp[1]>126) cp[1]= 255; else cp[1]*=2;
+ if (cp[2]>126) cp[2]= 255; else cp[2]*=2;
+ if (cp[3]>126) cp[3]= 255; else cp[3]*=2;
+ cp= (char *)&tface->col[2];
+ if (cp[1]>126) cp[1]= 255; else cp[1]*=2;
+ if (cp[2]>126) cp[2]= 255; else cp[2]*=2;
+ if (cp[3]>126) cp[3]= 255; else cp[3]*=2;
+ cp= (char *)&tface->col[3];
+ if (cp[1]>126) cp[1]= 255; else cp[1]*=2;
+ if (cp[2]>126) cp[2]= 255; else cp[2]*=2;
+ if (cp[3]>126) cp[3]= 255; else cp[3]*=2;
+
+ tface++;
+ }
+ }
+ me= me->id.next;
+ }
+ }
+
+ if (main->versionfile <= 169) {
+ Mesh *me= main->mesh.first;
+ while (me) {
+ if (me->subdiv==0) me->subdiv= 1;
+ me= me->id.next;
+ }
+ }
+
+ if (main->versionfile <= 169) {
+ bScreen *sc= main->screen.first;
+ while (sc) {
+ ScrArea *sa= sc->areabase.first;
+ while (sa) {
+ SpaceLink *sl= sa->spacedata.first;
+ while (sl) {
+ if (sl->spacetype==SPACE_IPO) {
+ SpaceIpo *sipo= (SpaceIpo*) sl;
+ sipo->v2d.max[0]= 15000.0;
+ }
+ sl= sl->next;
+ }
+ sa= sa->next;
+ }
+ sc= sc->id.next;
+ }
+ }
+
+ if (main->versionfile <= 170) {
+ Object *ob = main->object.first;
+ PartEff *paf;
+ while (ob) {
+ paf = do_version_give_parteff_245(ob);
+ if (paf) {
+ if (paf->staticstep == 0) {
+ paf->staticstep= 5;
+ }
+ }
+ ob = ob->id.next;
+ }
+ }
+
+ if (main->versionfile <= 171) {
+ bScreen *sc= main->screen.first;
+ while (sc) {
+ ScrArea *sa= sc->areabase.first;
+ while (sa) {
+ SpaceLink *sl= sa->spacedata.first;
+ while (sl) {
+ if (sl->spacetype==SPACE_TEXT) {
+ SpaceText *st= (SpaceText*) sl;
+ st->lheight= 12;
+ }
+ sl= sl->next;
+ }
+ sa= sa->next;
+ }
+ sc= sc->id.next;
+ }
+ }
+
+ if (main->versionfile <= 173) {
+ int a, b;
+ Mesh *me= main->mesh.first;
+ while (me) {
+ if (me->tface) {
+ TFace *tface= me->tface;
+ for (a=0; a<me->totface; a++, tface++) {
+ for (b=0; b<4; b++) {
+ tface->uv[b][0]/= 32767.0f;
+ tface->uv[b][1]/= 32767.0f;
+ }
+ }
+ }
+ me= me->id.next;
+ }
+ }
+
+ if (main->versionfile <= 191) {
+ Object *ob= main->object.first;
+ Material *ma = main->mat.first;
+
+ /* let faces have default add factor of 0.0 */
+ while (ma) {
+ if (!(ma->mode & MA_HALO)) ma->add = 0.0;
+ ma = ma->id.next;
+ }
+
+ while (ob) {
+ ob->mass= 1.0f;
+ ob->damping= 0.1f;
+ /*ob->quat[1]= 1.0f;*/ /* quats arnt used yet */
+ ob= ob->id.next;
+ }
+ }
+
+ if (main->versionfile <= 193) {
+ Object *ob= main->object.first;
+ while (ob) {
+ ob->inertia= 1.0f;
+ ob->rdamping= 0.1f;
+ ob= ob->id.next;
+ }
+ }
+
+ if (main->versionfile <= 196) {
+ Mesh *me= main->mesh.first;
+ int a, b;
+ while (me) {
+ if (me->tface) {
+ TFace *tface= me->tface;
+ for (a=0; a<me->totface; a++, tface++) {
+ for (b=0; b<4; b++) {
+ tface->mode |= TF_DYNAMIC;
+ tface->mode &= ~TF_INVISIBLE;
+ }
+ }
+ }
+ me= me->id.next;
+ }
+ }
+
+ if (main->versionfile <= 200) {
+ Object *ob= main->object.first;
+ while (ob) {
+ ob->scaflag = ob->gameflag & (OB_DO_FH|OB_ROT_FH|OB_ANISOTROPIC_FRICTION|OB_GHOST|OB_RIGID_BODY|OB_BOUNDS);
+ /* 64 is do_fh */
+ ob->gameflag &= ~(OB_ROT_FH|OB_ANISOTROPIC_FRICTION|OB_GHOST|OB_RIGID_BODY|OB_BOUNDS);
+ ob = ob->id.next;
+ }
+ }
+
+ if (main->versionfile <= 201) {
+ /* add-object + end-object are joined to edit-object actuator */
+ Object *ob = main->object.first;
+ bProperty *prop;
+ bActuator *act;
+ bIpoActuator *ia;
+ bEditObjectActuator *eoa;
+ bAddObjectActuator *aoa;
+ while (ob) {
+ act = ob->actuators.first;
+ while (act) {
+ if (act->type==ACT_IPO) {
+ ia= act->data;
+ prop= get_ob_property(ob, ia->name);
+ if (prop) {
+ ia->type= ACT_IPO_FROM_PROP;
+ }
+ }
+ else if (act->type==ACT_ADD_OBJECT) {
+ aoa= act->data;
+ eoa= MEM_callocN(sizeof(bEditObjectActuator), "edit ob act");
+ eoa->type= ACT_EDOB_ADD_OBJECT;
+ eoa->ob= aoa->ob;
+ eoa->time= aoa->time;
+ MEM_freeN(aoa);
+ act->data= eoa;
+ act->type= act->otype= ACT_EDIT_OBJECT;
+ }
+ else if (act->type==ACT_END_OBJECT) {
+ eoa= MEM_callocN(sizeof(bEditObjectActuator), "edit ob act");
+ eoa->type= ACT_EDOB_END_OBJECT;
+ act->data= eoa;
+ act->type= act->otype= ACT_EDIT_OBJECT;
+ }
+ act= act->next;
+ }
+ ob = ob->id.next;
+ }
+ }
+
+ if (main->versionfile <= 202) {
+ /* add-object and end-object are joined to edit-object
+ * actuator */
+ Object *ob= main->object.first;
+ bActuator *act;
+ bObjectActuator *oa;
+ while (ob) {
+ act= ob->actuators.first;
+ while (act) {
+ if (act->type==ACT_OBJECT) {
+ oa= act->data;
+ oa->flag &= ~(ACT_TORQUE_LOCAL|ACT_DROT_LOCAL); /* this actuator didn't do local/glob rot before */
+ }
+ act= act->next;
+ }
+ ob= ob->id.next;
+ }
+ }
+
+ if (main->versionfile <= 204) {
+ /* patches for new physics */
+ Object *ob= main->object.first;
+ bActuator *act;
+ bObjectActuator *oa;
+ bSound *sound;
+ while (ob) {
+
+ /* please check this for demo20 files like
+ * original Egypt levels etc. converted
+ * rotation factor of 50 is not workable */
+ act= ob->actuators.first;
+ while (act) {
+ if (act->type==ACT_OBJECT) {
+ oa= act->data;
+
+ oa->forceloc[0]*= 25.0f;
+ oa->forceloc[1]*= 25.0f;
+ oa->forceloc[2]*= 25.0f;
+
+ oa->forcerot[0]*= 10.0f;
+ oa->forcerot[1]*= 10.0f;
+ oa->forcerot[2]*= 10.0f;
+ }
+ act= act->next;
+ }
+ ob= ob->id.next;
+ }
+
+ sound = main->sound.first;
+ while (sound) {
+ if (sound->volume < 0.01f) {
+ sound->volume = 1.0f;
+ }
+ sound = sound->id.next;
+ }
+ }
+
+ if (main->versionfile <= 205) {
+ /* patches for new physics */
+ Object *ob= main->object.first;
+ bActuator *act;
+ bSensor *sens;
+ bEditObjectActuator *oa;
+ bRaySensor *rs;
+ bCollisionSensor *cs;
+ while (ob) {
+ /* Set anisotropic friction off for old objects,
+ * values to 1.0. */
+ ob->gameflag &= ~OB_ANISOTROPIC_FRICTION;
+ ob->anisotropicFriction[0] = 1.0;
+ ob->anisotropicFriction[1] = 1.0;
+ ob->anisotropicFriction[2] = 1.0;
+
+ act= ob->actuators.first;
+ while (act) {
+ if (act->type==ACT_EDIT_OBJECT) {
+ /* Zero initial velocity for newly
+ * added objects */
+ oa= act->data;
+ oa->linVelocity[0] = 0.0;
+ oa->linVelocity[1] = 0.0;
+ oa->linVelocity[2] = 0.0;
+ oa->localflag = 0;
+ }
+ act= act->next;
+ }
+
+ sens= ob->sensors.first;
+ while (sens) {
+ /* Extra fields for radar sensors. */
+ if (sens->type == SENS_RADAR) {
+ bRadarSensor *s = sens->data;
+ s->range = 10000.0;
+ }
+
+ /* Pulsing: defaults for new sensors. */
+ if (sens->type != SENS_ALWAYS) {
+ sens->pulse = 0;
+ sens->freq = 0;
+ }
+ else {
+ sens->pulse = 1;
+ }
+
+ /* Invert: off. */
+ sens->invert = 0;
+
+ /* Collision and ray: default = trigger
+ * on property. The material field can
+ * remain empty. */
+ if (sens->type == SENS_COLLISION) {
+ cs = (bCollisionSensor*) sens->data;
+ cs->mode = 0;
+ }
+ if (sens->type == SENS_RAY) {
+ rs = (bRaySensor*) sens->data;
+ rs->mode = 0;
+ }
+ sens = sens->next;
+ }
+ ob= ob->id.next;
+ }
+ /* have to check the exact multiplier */
+ }
+
+ if (main->versionfile <= 211) {
+ /* Render setting: per scene, the applicable gamma value
+ * can be set. Default is 1.0, which means no
+ * correction. */
+ bActuator *act;
+ bObjectActuator *oa;
+ Object *ob;
+
+ /* added alpha in obcolor */
+ ob= main->object.first;
+ while (ob) {
+ ob->col[3]= 1.0;
+ ob= ob->id.next;
+ }
+
+ /* added alpha in obcolor */
+ ob= main->object.first;
+ while (ob) {
+ act= ob->actuators.first;
+ while (act) {
+ if (act->type==ACT_OBJECT) {
+ /* multiply velocity with 50 in old files */
+ oa= act->data;
+ if (fabsf(oa->linearvelocity[0]) >= 0.01f)
+ oa->linearvelocity[0] *= 50.0f;
+ if (fabsf(oa->linearvelocity[1]) >= 0.01f)
+ oa->linearvelocity[1] *= 50.0f;
+ if (fabsf(oa->linearvelocity[2]) >= 0.01f)
+ oa->linearvelocity[2] *= 50.0f;
+ if (fabsf(oa->angularvelocity[0])>=0.01f)
+ oa->angularvelocity[0] *= 50.0f;
+ if (fabsf(oa->angularvelocity[1])>=0.01f)
+ oa->angularvelocity[1] *= 50.0f;
+ if (fabsf(oa->angularvelocity[2])>=0.01f)
+ oa->angularvelocity[2] *= 50.0f;
+ }
+ act= act->next;
+ }
+ ob= ob->id.next;
+ }
+ }
+
+ if (main->versionfile <= 212) {
+
+ bSound* sound;
+ bProperty *prop;
+ Object *ob;
+ Mesh *me;
+
+ sound = main->sound.first;
+ while (sound) {
+ sound->max_gain = 1.0;
+ sound->min_gain = 0.0;
+ sound->distance = 1.0;
+
+ if (sound->attenuation > 0.0f)
+ sound->flags |= SOUND_FLAGS_3D;
+ else
+ sound->flags &= ~SOUND_FLAGS_3D;
+
+ sound = sound->id.next;
+ }
+
+ ob = main->object.first;
+
+ while (ob) {
+ prop= ob->prop.first;
+ while (prop) {
+ if (prop->type == GPROP_TIME) {
+ // convert old GPROP_TIME values from int to float
+ *((float *)&prop->data) = (float) prop->data;
+ }
+
+ prop= prop->next;
+ }
+ ob = ob->id.next;
+ }
+
+ /* me->subdiv changed to reflect the actual reparametization
+ * better, and smeshes were removed - if it was a smesh make
+ * it a subsurf, and reset the subdiv level because subsurf
+ * takes a lot more work to calculate.
+ */
+ for (me= main->mesh.first; me; me= me->id.next) {
+ if (me->flag&ME_SMESH) {
+ me->flag&= ~ME_SMESH;
+ me->flag|= ME_SUBSURF;
+
+ me->subdiv= 1;
+ }
+ else {
+ if (me->subdiv<2)
+ me->subdiv= 1;
+ else
+ me->subdiv--;
+ }
+ }
+ }
+
+ if (main->versionfile <= 220) {
+ Object *ob;
+ Mesh *me;
+
+ ob = main->object.first;
+
+ /* adapt form factor in order to get the 'old' physics
+ * behavior back...*/
+
+ while (ob) {
+ /* in future, distinguish between different
+ * object bounding shapes */
+ ob->formfactor = 0.4f;
+ /* patch form factor, note that inertia equiv radius
+ * of a rotation symmetrical obj */
+ if (ob->inertia != 1.0f) {
+ ob->formfactor /= ob->inertia * ob->inertia;
+ }
+ ob = ob->id.next;
+ }
+
+ /* Began using alpha component of vertex colors, but
+ * old file vertex colors are undefined, reset them
+ * to be fully opaque. -zr
+ */
+ for (me= main->mesh.first; me; me= me->id.next) {
+ if (me->mcol) {
+ int i;
+
+ for (i=0; i<me->totface*4; i++) {
+ MCol *mcol= &me->mcol[i];
+ mcol->a= 255;
+ }
+ }
+ if (me->tface) {
+ int i, j;
+
+ for (i=0; i<me->totface; i++) {
+ TFace *tf= &((TFace*) me->tface)[i];
+
+ for (j=0; j<4; j++) {
+ char *col= (char*) &tf->col[j];
+
+ col[0]= 255;
+ }
+ }
+ }
+ }
+ }
+ if (main->versionfile <= 221) {
+ Scene *sce= main->scene.first;
+
+ // new variables for std-alone player and runtime
+ while (sce) {
+
+ sce->r.xplay= 640;
+ sce->r.yplay= 480;
+ sce->r.freqplay= 60;
+
+ sce= sce->id.next;
+ }
+
+ }
+ if (main->versionfile <= 222) {
+ Scene *sce= main->scene.first;
+
+ // new variables for std-alone player and runtime
+ while (sce) {
+
+ sce->r.depth= 32;
+
+ sce= sce->id.next;
+ }
+ }
+
+
+ if (main->versionfile <= 223) {
+ VFont *vf;
+ Image *ima;
+ Object *ob;
+
+ for (vf= main->vfont.first; vf; vf= vf->id.next) {
+ if (strcmp(vf->name+strlen(vf->name)-6, ".Bfont")==0) {
+ strcpy(vf->name, FO_BUILTIN_NAME);
+ }
+ }
+
+ /* Old textures animate at 25 FPS */
+ for (ima = main->image.first; ima; ima=ima->id.next) {
+ ima->animspeed = 25;
+ }
+
+ /* Zr remapped some keyboard codes to be linear (stupid zr) */
+ for (ob= main->object.first; ob; ob= ob->id.next) {
+ bSensor *sens;
+
+ for (sens= ob->sensors.first; sens; sens= sens->next) {
+ if (sens->type==SENS_KEYBOARD) {
+ bKeyboardSensor *ks= sens->data;
+
+ ks->key= map_223_keybd_code_to_224_keybd_code(ks->key);
+ ks->qual= map_223_keybd_code_to_224_keybd_code(ks->qual);
+ ks->qual2= map_223_keybd_code_to_224_keybd_code(ks->qual2);
+ }
+ }
+ }
+ }
+ if (main->versionfile <= 224) {
+ bSound* sound;
+ Scene *sce;
+ Mesh *me;
+ bScreen *sc;
+
+ for (sound=main->sound.first; sound; sound=sound->id.next) {
+ if (sound->packedfile) {
+ if (sound->newpackedfile == NULL) {
+ sound->newpackedfile = sound->packedfile;
+ }
+ sound->packedfile = NULL;
+ }
+ }
+ /* Make sure that old subsurf meshes don't have zero subdivision level for rendering */
+ for (me=main->mesh.first; me; me=me->id.next) {
+ if ((me->flag & ME_SUBSURF) && (me->subdivr==0))
+ me->subdivr=me->subdiv;
+ }
+
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ sce->r.stereomode = 1; // no stereo
+ }
+
+ /* some oldfile patch, moved from set_func_space */
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ ScrArea *sa;
+
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ SpaceLink *sl;
+
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_IPO) {
+ SpaceSeq *sseq= (SpaceSeq*) sl;
+ sseq->v2d.keeptot= 0;
+ }
+ }
+ }
+ }
+
+ }
+
+
+ if (main->versionfile <= 225) {
+ World *wo;
+ /* Use Sumo for old games */
+ for (wo = main->world.first; wo; wo= wo->id.next) {
+ wo->physicsEngine = 2;
+ }
+ }
+
+ if (main->versionfile <= 227) {
+ Scene *sce;
+ Material *ma;
+ bScreen *sc;
+ Object *ob;
+
+ /* As of now, this insures that the transition from the old Track system
+ * to the new full constraint Track is painless for everyone. - theeth
+ */
+ ob = main->object.first;
+
+ while (ob) {
+ ListBase *list;
+ list = &ob->constraints;
+
+ /* check for already existing TrackTo constraint
+ * set their track and up flag correctly */
+
+ if (list) {
+ bConstraint *curcon;
+ for (curcon = list->first; curcon; curcon=curcon->next) {
+ if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
+ bTrackToConstraint *data = curcon->data;
+ data->reserved1 = ob->trackflag;
+ data->reserved2 = ob->upflag;
+ }
+ }
+ }
+
+ if (ob->type == OB_ARMATURE) {
+ if (ob->pose) {
+ bConstraint *curcon;
+ bPoseChannel *pchan;
+ for (pchan = ob->pose->chanbase.first;
+ pchan; pchan=pchan->next) {
+ for (curcon = pchan->constraints.first;
+ curcon; curcon=curcon->next) {
+ if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
+ bTrackToConstraint *data = curcon->data;
+ data->reserved1 = ob->trackflag;
+ data->reserved2 = ob->upflag;
+ }
+ }
+ }
+ }
+ }
+
+ /* Change Ob->Track in real TrackTo constraint */
+ do_version_old_trackto_to_constraints(ob);
+
+ ob = ob->id.next;
+ }
+
+
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ sce->audio.mixrate = 44100;
+ sce->audio.flag |= AUDIO_SCRUB;
+ sce->r.mode |= R_ENVMAP;
+ }
+ // init new shader vars
+ for (ma= main->mat.first; ma; ma= ma->id.next) {
+ ma->refrac= 4.0f;
+ ma->roughness= 0.5f;
+ ma->param[0]= 0.5f;
+ ma->param[1]= 0.1f;
+ ma->param[2]= 0.1f;
+ ma->param[3]= 0.05f;
+ }
+ // patch for old wrong max view2d settings, allows zooming out more
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ ScrArea *sa;
+
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ SpaceLink *sl;
+
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_ACTION) {
+ SpaceAction *sac= (SpaceAction *) sl;
+ sac->v2d.max[0]= 32000;
+ }
+ else if (sl->spacetype==SPACE_NLA) {
+ SpaceNla *sla= (SpaceNla *) sl;
+ sla->v2d.max[0]= 32000;
+ }
+ }
+ }
+ }
+ }
+ if (main->versionfile <= 228) {
+ Scene *sce;
+ bScreen *sc;
+ Object *ob;
+
+
+ /* As of now, this insures that the transition from the old Track system
+ * to the new full constraint Track is painless for everyone.*/
+ ob = main->object.first;
+
+ while (ob) {
+ ListBase *list;
+ list = &ob->constraints;
+
+ /* check for already existing TrackTo constraint
+ * set their track and up flag correctly */
+
+ if (list) {
+ bConstraint *curcon;
+ for (curcon = list->first; curcon; curcon=curcon->next) {
+ if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
+ bTrackToConstraint *data = curcon->data;
+ data->reserved1 = ob->trackflag;
+ data->reserved2 = ob->upflag;
+ }
+ }
+ }
+
+ if (ob->type == OB_ARMATURE) {
+ if (ob->pose) {
+ bConstraint *curcon;
+ bPoseChannel *pchan;
+ for (pchan = ob->pose->chanbase.first;
+ pchan; pchan=pchan->next) {
+ for (curcon = pchan->constraints.first;
+ curcon; curcon=curcon->next) {
+ if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
+ bTrackToConstraint *data = curcon->data;
+ data->reserved1 = ob->trackflag;
+ data->reserved2 = ob->upflag;
+ }
+ }
+ }
+ }
+ }
+
+ ob = ob->id.next;
+ }
+
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ sce->r.mode |= R_ENVMAP;
+ }
+
+ // convert old mainb values for new button panels
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ ScrArea *sa;
+
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ SpaceLink *sl;
+
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_BUTS) {
+ SpaceButs *sbuts= (SpaceButs *) sl;
+
+ sbuts->v2d.maxzoom= 1.2f;
+ sbuts->align= 1; /* horizontal default */
+
+ if (sbuts->mainb==BUTS_LAMP) {
+ sbuts->mainb= CONTEXT_SHADING;
+ //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
+ }
+ else if (sbuts->mainb==BUTS_MAT) {
+ sbuts->mainb= CONTEXT_SHADING;
+ //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
+ }
+ else if (sbuts->mainb==BUTS_TEX) {
+ sbuts->mainb= CONTEXT_SHADING;
+ //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_TEX;
+ }
+ else if (sbuts->mainb==BUTS_ANIM) {
+ sbuts->mainb= CONTEXT_OBJECT;
+ }
+ else if (sbuts->mainb==BUTS_WORLD) {
+ sbuts->mainb= CONTEXT_SCENE;
+ //sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_WORLD;
+ }
+ else if (sbuts->mainb==BUTS_RENDER) {
+ sbuts->mainb= CONTEXT_SCENE;
+ //sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_RENDER;
+ }
+ else if (sbuts->mainb==BUTS_GAME) {
+ sbuts->mainb= CONTEXT_LOGIC;
+ }
+ else if (sbuts->mainb==BUTS_FPAINT) {
+ sbuts->mainb= CONTEXT_EDITING;
+ }
+ else if (sbuts->mainb==BUTS_RADIO) {
+ sbuts->mainb= CONTEXT_SHADING;
+ //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_RAD;
+ }
+ else if (sbuts->mainb==BUTS_CONSTRAINT) {
+ sbuts->mainb= CONTEXT_OBJECT;
+ }
+ else if (sbuts->mainb==BUTS_SCRIPT) {
+ sbuts->mainb= CONTEXT_OBJECT;
+ }
+ else if (sbuts->mainb==BUTS_EDIT) {
+ sbuts->mainb= CONTEXT_EDITING;
+ }
+ else sbuts->mainb= CONTEXT_SCENE;
+ }
+ }
+ }
+ }
+ }
+ /* ton: made this 230 instead of 229,
+ * to be sure (tuho files) and this is a reliable check anyway
+ * nevertheless, we might need to think over a fitness (initialize)
+ * check apart from the do_versions() */
+
+ if (main->versionfile <= 230) {
+ bScreen *sc;
+
+ // new variable blockscale, for panels in any area
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ ScrArea *sa;
+
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ SpaceLink *sl;
+
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->blockscale==0.0f) sl->blockscale= 0.7f;
+ /* added: 5x better zoom in for action */
+ if (sl->spacetype==SPACE_ACTION) {
+ SpaceAction *sac= (SpaceAction *)sl;
+ sac->v2d.maxzoom= 50;
+ }
+ }
+ }
+ }
+ }
+ if (main->versionfile <= 231) {
+ /* new bit flags for showing/hiding grid floor and axes */
+ bScreen *sc = main->screen.first;
+ while (sc) {
+ ScrArea *sa= sc->areabase.first;
+ while (sa) {
+ SpaceLink *sl= sa->spacedata.first;
+ while (sl) {
+ if (sl->spacetype==SPACE_VIEW3D) {
+ View3D *v3d= (View3D*) sl;
+
+ if (v3d->gridflag==0) {
+ v3d->gridflag |= V3D_SHOW_X;
+ v3d->gridflag |= V3D_SHOW_Y;
+ v3d->gridflag |= V3D_SHOW_FLOOR;
+ v3d->gridflag &= ~V3D_SHOW_Z;
+ }
+ }
+ sl= sl->next;
+ }
+ sa= sa->next;
+ }
+ sc= sc->id.next;
+ }
+ }
+ if (main->versionfile <= 231) {
+ Material *ma= main->mat.first;
+ bScreen *sc = main->screen.first;
+ Scene *sce;
+ Lamp *la;
+ World *wrld;
+
+ /* introduction of raytrace */
+ while (ma) {
+ if (ma->fresnel_tra_i==0.0f) ma->fresnel_tra_i= 1.25f;
+ if (ma->fresnel_mir_i==0.0f) ma->fresnel_mir_i= 1.25f;
+
+ ma->ang= 1.0;
+ ma->ray_depth= 2;
+ ma->ray_depth_tra= 2;
+ ma->fresnel_tra= 0.0;
+ ma->fresnel_mir= 0.0;
+
+ ma= ma->id.next;
+ }
+ sce= main->scene.first;
+ while (sce) {
+ if (sce->r.gauss==0.0f) sce->r.gauss= 1.0f;
+ sce= sce->id.next;
+ }
+ la= main->lamp.first;
+ while (la) {
+ if (la->k==0.0f) la->k= 1.0;
+ if (la->ray_samp==0) la->ray_samp= 1;
+ if (la->ray_sampy==0) la->ray_sampy= 1;
+ if (la->ray_sampz==0) la->ray_sampz= 1;
+ if (la->area_size==0.0f) la->area_size= 1.0f;
+ if (la->area_sizey==0.0f) la->area_sizey= 1.0f;
+ if (la->area_sizez==0.0f) la->area_sizez= 1.0f;
+ la= la->id.next;
+ }
+ wrld= main->world.first;
+ while (wrld) {
+ if (wrld->range==0.0f) {
+ wrld->range= 1.0f/wrld->exposure;
+ }
+ wrld= wrld->id.next;
+ }
+
+ /* new bit flags for showing/hiding grid floor and axes */
+
+ while (sc) {
+ ScrArea *sa= sc->areabase.first;
+ while (sa) {
+ SpaceLink *sl= sa->spacedata.first;
+ while (sl) {
+ if (sl->spacetype==SPACE_VIEW3D) {
+ View3D *v3d= (View3D*) sl;
+
+ if (v3d->gridflag==0) {
+ v3d->gridflag |= V3D_SHOW_X;
+ v3d->gridflag |= V3D_SHOW_Y;
+ v3d->gridflag |= V3D_SHOW_FLOOR;
+ v3d->gridflag &= ~V3D_SHOW_Z;
+ }
+ }
+ sl= sl->next;
+ }
+ sa= sa->next;
+ }
+ sc= sc->id.next;
+ }
+ }
+ if (main->versionfile <= 232) {
+ Tex *tex= main->tex.first;
+ World *wrld= main->world.first;
+ bScreen *sc;
+ Scene *sce;
+
+ while (tex) {
+ if ((tex->flag & (TEX_CHECKER_ODD+TEX_CHECKER_EVEN))==0) {
+ tex->flag |= TEX_CHECKER_ODD;
+ }
+ /* copied from kernel texture.c */
+ if (tex->ns_outscale==0.0f) {
+ /* musgrave */
+ tex->mg_H = 1.0f;
+ tex->mg_lacunarity = 2.0f;
+ tex->mg_octaves = 2.0f;
+ tex->mg_offset = 1.0f;
+ tex->mg_gain = 1.0f;
+ tex->ns_outscale = 1.0f;
+ /* distnoise */
+ tex->dist_amount = 1.0f;
+ /* voronoi */
+ tex->vn_w1 = 1.0f;
+ tex->vn_mexp = 2.5f;
+ }
+ tex= tex->id.next;
+ }
+
+ while (wrld) {
+ if (wrld->aodist==0.0f) {
+ wrld->aodist= 10.0f;
+ wrld->aobias= 0.05f;
+ }
+ if (wrld->aosamp==0) wrld->aosamp= 5;
+ if (wrld->aoenergy==0.0f) wrld->aoenergy= 1.0f;
+ wrld= wrld->id.next;
+ }
+
+
+ // new variable blockscale, for panels in any area, do again because new
+ // areas didnt initialize it to 0.7 yet
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ ScrArea *sa;
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ SpaceLink *sl;
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->blockscale==0.0f) sl->blockscale= 0.7f;
+
+ /* added: 5x better zoom in for nla */
+ if (sl->spacetype==SPACE_NLA) {
+ SpaceNla *snla= (SpaceNla *)sl;
+ snla->v2d.maxzoom= 50;
+ }
+ }
+ }
+ }
+ sce= main->scene.first;
+ while (sce) {
+ if (sce->r.ocres==0) sce->r.ocres= 64;
+ sce= sce->id.next;
+ }
+
+ }
+ if (main->versionfile <= 233) {
+ bScreen *sc;
+ Material *ma= main->mat.first;
+ /* Object *ob= main->object.first; */
+
+ while (ma) {
+ if (ma->rampfac_col==0.0f) ma->rampfac_col= 1.0;
+ if (ma->rampfac_spec==0.0f) ma->rampfac_spec= 1.0;
+ if (ma->pr_lamp==0) ma->pr_lamp= 3;
+ ma= ma->id.next;
+ }
+
+ /* this should have been done loooong before! */
+#if 0 /* deprecated in 2.5+ */
+ while (ob) {
+ if (ob->ipowin==0) ob->ipowin= ID_OB;
+ ob= ob->id.next;
+ }
+#endif
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ ScrArea *sa;
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ SpaceLink *sl;
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_VIEW3D) {
+ View3D *v3d= (View3D *)sl;
+ v3d->flag |= V3D_SELECT_OUTLINE;
+ }
+ }
+ }
+ }
+ }
+
+
+
+
+ if (main->versionfile <= 234) {
+ World *wo;
+ bScreen *sc;
+
+ // force sumo engine to be active
+ for (wo = main->world.first; wo; wo= wo->id.next) {
+ if (wo->physicsEngine==0) wo->physicsEngine = 2;
+ }
+
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ ScrArea *sa;
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ SpaceLink *sl;
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_VIEW3D) {
+ View3D *v3d= (View3D *)sl;
+ v3d->flag |= V3D_ZBUF_SELECT;
+ }
+ else if (sl->spacetype==SPACE_TEXT) {
+ SpaceText *st= (SpaceText *)sl;
+ if (st->tabnumber==0) st->tabnumber= 2;
+ }
+ }
+ }
+ }
+ }
+ if (main->versionfile <= 235) {
+ Tex *tex= main->tex.first;
+ Scene *sce= main->scene.first;
+ Sequence *seq;
+ Editing *ed;
+
+ while (tex) {
+ if (tex->nabla==0.0f) tex->nabla= 0.025f;
+ tex= tex->id.next;
+ }
+ while (sce) {
+ ed= sce->ed;
+ if (ed) {
+ SEQ_BEGIN (sce->ed, seq)
+ {
+ if (seq->type==SEQ_IMAGE || seq->type==SEQ_MOVIE)
+ seq->flag |= SEQ_MAKE_PREMUL;
+ }
+ SEQ_END
+ }
+
+ sce= sce->id.next;
+ }
+ }
+ if (main->versionfile <= 236) {
+ Object *ob;
+ Camera *cam= main->camera.first;
+ Material *ma;
+ bScreen *sc;
+
+ while (cam) {
+ if (cam->ortho_scale==0.0f) {
+ cam->ortho_scale= 256.0f/cam->lens;
+ if (cam->type==CAM_ORTHO) printf("NOTE: ortho render has changed, tweak new Camera 'scale' value.\n");
+ }
+ cam= cam->id.next;
+ }
+ /* set manipulator type */
+ /* force oops draw if depgraph was set*/
+ /* set time line var */
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ ScrArea *sa;
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ SpaceLink *sl;
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_VIEW3D) {
+ View3D *v3d= (View3D *)sl;
+ if (v3d->twtype==0) v3d->twtype= V3D_MANIP_TRANSLATE;
+ }
+ }
+ }
+ }
+ // init new shader vars
+ for (ma= main->mat.first; ma; ma= ma->id.next) {
+ if (ma->darkness==0.0f) {
+ ma->rms=0.1f;
+ ma->darkness=1.0f;
+ }
+ }
+
+ /* softbody init new vars */
+ for (ob= main->object.first; ob; ob= ob->id.next) {
+ if (ob->soft) {
+ if (ob->soft->defgoal==0.0f) ob->soft->defgoal= 0.7f;
+ if (ob->soft->physics_speed==0.0f) ob->soft->physics_speed= 1.0f;
+
+ if (ob->soft->interval==0) {
+ ob->soft->interval= 2;
+ ob->soft->sfra= 1;
+ ob->soft->efra= 100;
+ }
+ }
+ if (ob->soft && ob->soft->vertgroup==0) {
+ bDeformGroup *locGroup = defgroup_find_name(ob, "SOFTGOAL");
+ if (locGroup) {
+ /* retrieve index for that group */
+ ob->soft->vertgroup = 1 + BLI_findindex(&ob->defbase, locGroup);
+ }
+ }
+ }
+ }
+ if (main->versionfile <= 237) {
+ bArmature *arm;
+ bConstraint *con;
+ Object *ob;
+ Bone *bone;
+
+ // armature recode checks
+ for (arm= main->armature.first; arm; arm= arm->id.next) {
+ where_is_armature(arm);
+
+ for (bone= arm->bonebase.first; bone; bone= bone->next)
+ do_version_bone_head_tail_237(bone);
+ }
+ for (ob= main->object.first; ob; ob= ob->id.next) {
+ if (ob->parent) {
+ Object *parent= newlibadr(fd, lib, ob->parent);
+ if (parent && parent->type==OB_LATTICE)
+ ob->partype = PARSKEL;
+ }
+
+ // btw. armature_rebuild_pose is further only called on leave editmode
+ if (ob->type==OB_ARMATURE) {
+ if (ob->pose)
+ ob->pose->flag |= POSE_RECALC;
+ ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME; // cannot call stuff now (pointers!), done in setup_app_data
+
+ /* new generic xray option */
+ arm= newlibadr(fd, lib, ob->data);
+ if (arm->flag & ARM_DRAWXRAY) {
+ ob->dtx |= OB_DRAWXRAY;
+ }
+ }
+ else if (ob->type==OB_MESH) {
+ Mesh *me = newlibadr(fd, lib, ob->data);
+
+ if ((me->flag&ME_SUBSURF)) {
+ SubsurfModifierData *smd = (SubsurfModifierData*) modifier_new(eModifierType_Subsurf);
+
+ smd->levels = MAX2(1, me->subdiv);
+ smd->renderLevels = MAX2(1, me->subdivr);
+ smd->subdivType = me->subsurftype;
+
+ smd->modifier.mode = 0;
+ if (me->subdiv!=0)
+ smd->modifier.mode |= 1;
+ if (me->subdivr!=0)
+ smd->modifier.mode |= 2;
+ if (me->flag&ME_OPT_EDGES)
+ smd->flags |= eSubsurfModifierFlag_ControlEdges;
+
+ BLI_addtail(&ob->modifiers, smd);
+
+ modifier_unique_name(&ob->modifiers, (ModifierData*)smd);
+ }
+ }
+
+ // follow path constraint needs to set the 'path' option in curves...
+ for (con=ob->constraints.first; con; con= con->next) {
+ if (con->type==CONSTRAINT_TYPE_FOLLOWPATH) {
+ bFollowPathConstraint *data = con->data;
+ Object *obc= newlibadr(fd, lib, data->tar);
+
+ if (obc && obc->type==OB_CURVE) {
+ Curve *cu= newlibadr(fd, lib, obc->data);
+ if (cu) cu->flag |= CU_PATH;
+ }
+ }
+ }
+ }
+ }
+ if (main->versionfile <= 238) {
+ Lattice *lt;
+ Object *ob;
+ bArmature *arm;
+ Mesh *me;
+ Key *key;
+ Scene *sce= main->scene.first;
+
+ while (sce) {
+ if (sce->toolsettings == NULL) {
+ sce->toolsettings = MEM_callocN(sizeof(struct ToolSettings), "Tool Settings Struct");
+ sce->toolsettings->cornertype=0;
+ sce->toolsettings->degr = 90;
+ sce->toolsettings->step = 9;
+ sce->toolsettings->turn = 1;
+ sce->toolsettings->extr_offs = 1;
+ sce->toolsettings->doublimit = 0.001f;
+ sce->toolsettings->segments = 32;
+ sce->toolsettings->rings = 32;
+ sce->toolsettings->vertices = 32;
+ }
+ sce= sce->id.next;
+ }
+
+ for (lt=main->latt.first; lt; lt=lt->id.next) {
+ if (lt->fu==0.0f && lt->fv==0.0f && lt->fw==0.0f) {
+ calc_lat_fudu(lt->flag, lt->pntsu, &lt->fu, &lt->du);
+ calc_lat_fudu(lt->flag, lt->pntsv, &lt->fv, &lt->dv);
+ calc_lat_fudu(lt->flag, lt->pntsw, &lt->fw, &lt->dw);
+ }
+ }
+
+ for (ob=main->object.first; ob; ob= ob->id.next) {
+ ModifierData *md;
+ PartEff *paf;
+
+ for (md=ob->modifiers.first; md; md=md->next) {
+ if (md->type==eModifierType_Subsurf) {
+ SubsurfModifierData *smd = (SubsurfModifierData*) md;
+
+ smd->flags &= ~(eSubsurfModifierFlag_Incremental|eSubsurfModifierFlag_DebugIncr);
+ }
+ }
+
+ if ((ob->softflag&OB_SB_ENABLE) && !modifiers_findByType(ob, eModifierType_Softbody)) {
+ if (ob->softflag&OB_SB_POSTDEF) {
+ md = ob->modifiers.first;
+
+ while (md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform) {
+ md = md->next;
+ }
+
+ BLI_insertlinkbefore(&ob->modifiers, md, modifier_new(eModifierType_Softbody));
+ }
+ else {
+ BLI_addhead(&ob->modifiers, modifier_new(eModifierType_Softbody));
+ }
+
+ ob->softflag &= ~OB_SB_ENABLE;
+ }
+ if (ob->pose) {
+ bPoseChannel *pchan;
+ bConstraint *con;
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ // note, pchan->bone is also lib-link stuff
+ if (pchan->limitmin[0] == 0.0f && pchan->limitmax[0] == 0.0f) {
+ pchan->limitmin[0]= pchan->limitmin[1]= pchan->limitmin[2]= -180.0f;
+ pchan->limitmax[0]= pchan->limitmax[1]= pchan->limitmax[2]= 180.0f;
+
+ for (con= pchan->constraints.first; con; con= con->next) {
+ if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
+ bKinematicConstraint *data = (bKinematicConstraint*)con->data;
+ data->weight = 1.0f;
+ data->orientweight = 1.0f;
+ data->flag &= ~CONSTRAINT_IK_ROT;
+
+ /* enforce conversion from old IK_TOPARENT to rootbone index */
+ data->rootbone= -1;
+
+ /* update_pose_etc handles rootbone==-1 */
+ ob->pose->flag |= POSE_RECALC;
+ }
+ }
+ }
+ }
+ }
+
+ paf = do_version_give_parteff_245(ob);
+ if (paf) {
+ if (paf->disp == 0)
+ paf->disp = 100;
+ if (paf->speedtex == 0)
+ paf->speedtex = 8;
+ if (paf->omat == 0)
+ paf->omat = 1;
+ }
+ }
+
+ for (arm=main->armature.first; arm; arm= arm->id.next) {
+ bone_version_238(&arm->bonebase);
+ arm->deformflag |= ARM_DEF_VGROUP;
+ }
+
+ for (me=main->mesh.first; me; me= me->id.next) {
+ if (!me->medge) {
+ make_edges(me, 1); /* 1 = use mface->edcode */
+ }
+ else {
+ mesh_strip_loose_faces(me);
+ }
+ }
+
+ for (key= main->key.first; key; key= key->id.next) {
+ KeyBlock *kb;
+ int index = 1;
+
+ for (kb= key->block.first; kb; kb= kb->next) {
+ if (kb==key->refkey) {
+ if (kb->name[0]==0)
+ strcpy(kb->name, "Basis");
+ }
+ else {
+ if (kb->name[0]==0) {
+ BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", index);
+ }
+ index++;
+ }
+ }
+ }
+ }
+ if (main->versionfile <= 239) {
+ bArmature *arm;
+ Object *ob;
+ Scene *sce= main->scene.first;
+ Camera *cam= main->camera.first;
+ Material *ma= main->mat.first;
+ int set_passepartout= 0;
+
+ /* deformflag is local in modifier now */
+ for (ob=main->object.first; ob; ob= ob->id.next) {
+ ModifierData *md;
+
+ for (md=ob->modifiers.first; md; md=md->next) {
+ if (md->type==eModifierType_Armature) {
+ ArmatureModifierData *amd = (ArmatureModifierData*) md;
+ if (amd->object && amd->deformflag==0) {
+ Object *oba= newlibadr(fd, lib, amd->object);
+ arm= newlibadr(fd, lib, oba->data);
+ amd->deformflag= arm->deformflag;
+ }
+ }
+ }
+ }
+
+ /* updating stepsize for ghost drawing */
+ for (arm= main->armature.first; arm; arm= arm->id.next) {
+ if (arm->ghostsize==0) arm->ghostsize=1;
+ bone_version_239(&arm->bonebase);
+ if (arm->layer==0) arm->layer= 1;
+ }
+
+ for (;sce;sce= sce->id.next) {
+ /* make 'innervert' the default subdivide type, for backwards compat */
+ sce->toolsettings->cornertype=1;
+
+ if (sce->r.scemode & R_PASSEPARTOUT) {
+ set_passepartout= 1;
+ sce->r.scemode &= ~R_PASSEPARTOUT;
+ }
+ /* gauss is filter variable now */
+ if (sce->r.mode & R_GAUSS) {
+ sce->r.filtertype= R_FILTER_GAUSS;
+ sce->r.mode &= ~R_GAUSS;
+ }
+ }
+
+ for (;cam; cam= cam->id.next) {
+ if (set_passepartout)
+ cam->flag |= CAM_SHOWPASSEPARTOUT;
+
+ /* make sure old cameras have title safe on */
+ if (!(cam->flag & CAM_SHOWTITLESAFE))
+ cam->flag |= CAM_SHOWTITLESAFE;
+
+ /* set an appropriate camera passepartout alpha */
+ if (!(cam->passepartalpha)) cam->passepartalpha = 0.2f;
+ }
+
+ for (; ma; ma= ma->id.next) {
+ if (ma->strand_sta==0.0f) {
+ ma->strand_sta= ma->strand_end= 1.0f;
+ ma->mode |= MA_TANGENT_STR;
+ }
+ if (ma->mode & MA_TRACEBLE) ma->mode |= MA_SHADBUF;
+ }
+ }
+
+ if (main->versionfile <= 241) {
+ Object *ob;
+ Tex *tex;
+ Scene *sce;
+ World *wo;
+ Lamp *la;
+ Material *ma;
+ bArmature *arm;
+ bNodeTree *ntree;
+
+ for (wo = main->world.first; wo; wo= wo->id.next) {
+ /* Migrate to Bullet for games, except for the NaN versions */
+ /* People can still explicitly choose for Sumo (after 2.42 is out) */
+ if (main->versionfile > 225)
+ wo->physicsEngine = WOPHY_BULLET;
+ if (WO_AODIST == wo->aomode)
+ wo->aocolor= WO_AOPLAIN;
+ }
+
+ /* updating layers still */
+ for (arm= main->armature.first; arm; arm= arm->id.next) {
+ bone_version_239(&arm->bonebase);
+ if (arm->layer==0) arm->layer= 1;
+ }
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ if (sce->audio.mixrate==0) sce->audio.mixrate= 44100;
+
+ if (sce->r.xparts<2) sce->r.xparts= 4;
+ if (sce->r.yparts<2) sce->r.yparts= 4;
+ /* adds default layer */
+ if (sce->r.layers.first==NULL)
+ scene_add_render_layer(sce, NULL);
+ else {
+ SceneRenderLayer *srl;
+ /* new layer flag for sky, was default for solid */
+ for (srl= sce->r.layers.first; srl; srl= srl->next) {
+ if (srl->layflag & SCE_LAY_SOLID)
+ srl->layflag |= SCE_LAY_SKY;
+ srl->passflag &= (SCE_PASS_COMBINED|SCE_PASS_Z|SCE_PASS_NORMAL|SCE_PASS_VECTOR);
+ }
+ }
+
+ /* node version changes */
+ if (sce->nodetree)
+ ntree_version_241(sce->nodetree);
+
+ /* uv calculation options moved to toolsettings */
+ if (sce->toolsettings->uvcalc_radius == 0.0f) {
+ sce->toolsettings->uvcalc_radius = 1.0f;
+ sce->toolsettings->uvcalc_cubesize = 1.0f;
+ sce->toolsettings->uvcalc_mapdir = 1;
+ sce->toolsettings->uvcalc_mapalign = 1;
+ sce->toolsettings->uvcalc_flag = UVCALC_FILLHOLES;
+ sce->toolsettings->unwrapper = 1;
+ }
+
+ if (sce->r.mode & R_PANORAMA) {
+ /* all these checks to ensure saved files with svn version keep working... */
+ if (sce->r.xsch < sce->r.ysch) {
+ Object *obc= newlibadr(fd, lib, sce->camera);
+ if (obc && obc->type==OB_CAMERA) {
+ Camera *cam= newlibadr(fd, lib, obc->data);
+ if (cam->lens>=10.0f) {
+ sce->r.xsch*= sce->r.xparts;
+ cam->lens*= (float)sce->r.ysch/(float)sce->r.xsch;
+ }
+ }
+ }
+ }
+ }
+
+ for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
+ ntree_version_241(ntree);
+
+ for (la= main->lamp.first; la; la= la->id.next)
+ if (la->buffers==0)
+ la->buffers= 1;
+
+ for (tex= main->tex.first; tex; tex= tex->id.next) {
+ if (tex->env && tex->env->viewscale==0.0f)
+ tex->env->viewscale= 1.0f;
+// tex->imaflag |= TEX_GAUSS_MIP;
+ }
+
+ /* for empty drawsize and drawtype */
+ for (ob=main->object.first; ob; ob= ob->id.next) {
+ if (ob->empty_drawsize==0.0f) {
+ ob->empty_drawtype = OB_ARROWS;
+ ob->empty_drawsize = 1.0;
+ }
+ }
+
+ for (ma= main->mat.first; ma; ma= ma->id.next) {
+ /* stucci returns intensity from now on */
+ int a;
+ for (a=0; a<MAX_MTEX; a++) {
+ if (ma->mtex[a] && ma->mtex[a]->tex) {
+ tex= newlibadr(fd, lib, ma->mtex[a]->tex);
+ if (tex && tex->type==TEX_STUCCI)
+ ma->mtex[a]->mapto &= ~(MAP_COL|MAP_SPEC|MAP_REF);
+ }
+ }
+ /* transmissivity defaults */
+ if (ma->tx_falloff==0.0f) ma->tx_falloff= 1.0f;
+ }
+
+ /* during 2.41 images with this name were used for viewer node output, lets fix that */
+ if (main->versionfile == 241) {
+ Image *ima;
+ for (ima= main->image.first; ima; ima= ima->id.next)
+ if (strcmp(ima->name, "Compositor")==0) {
+ strcpy(ima->id.name+2, "Viewer Node");
+ strcpy(ima->name, "Viewer Node");
+ }
+ }
+ }
+
+ if (main->versionfile <= 242) {
+ Scene *sce;
+ bScreen *sc;
+ Object *ob;
+ Curve *cu;
+ Material *ma;
+ Mesh *me;
+ Group *group;
+ Nurb *nu;
+ BezTriple *bezt;
+ BPoint *bp;
+ bNodeTree *ntree;
+ int a;
+
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ ScrArea *sa;
+ sa= sc->areabase.first;
+ while (sa) {
+ SpaceLink *sl;
+
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_VIEW3D) {
+ View3D *v3d= (View3D*) sl;
+ if (v3d->gridsubdiv == 0)
+ v3d->gridsubdiv = 10;
+ }
+ }
+ sa = sa->next;
+ }
+ }
+
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ if (sce->toolsettings->select_thresh == 0.0f)
+ sce->toolsettings->select_thresh= 0.01f;
+ if (sce->toolsettings->clean_thresh == 0.0f)
+ sce->toolsettings->clean_thresh = 0.1f;
+
+ if (sce->r.threads==0) {
+ if (sce->r.mode & R_THREADS)
+ sce->r.threads= 2;
+ else
+ sce->r.threads= 1;
+ }
+ if (sce->nodetree)
+ ntree_version_242(sce->nodetree);
+ }
+
+ for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
+ ntree_version_242(ntree);
+
+ /* add default radius values to old curve points */
+ for (cu= main->curve.first; cu; cu= cu->id.next) {
+ for (nu= cu->nurb.first; nu; nu= nu->next) {
+ if (nu) {
+ if (nu->bezt) {
+ for (bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++) {
+ if (!bezt->radius) bezt->radius= 1.0;
+ }
+ }
+ else if (nu->bp) {
+ for (bp=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
+ if (!bp->radius) bp->radius= 1.0;
+ }
+ }
+ }
+ }
+ }
+
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ ModifierData *md;
+ ListBase *list;
+ list = &ob->constraints;
+
+ /* check for already existing MinMax (floor) constraint
+ * and update the sticky flagging */
+
+ if (list) {
+ bConstraint *curcon;
+ for (curcon = list->first; curcon; curcon=curcon->next) {
+ switch (curcon->type) {
+ case CONSTRAINT_TYPE_MINMAX:
+ {
+ bMinMaxConstraint *data = curcon->data;
+ if (data->sticky==1)
+ data->flag |= MINMAX_STICKY;
+ else
+ data->flag &= ~MINMAX_STICKY;
+ }
+ break;
+ case CONSTRAINT_TYPE_ROTLIKE:
+ {
+ bRotateLikeConstraint *data = curcon->data;
+
+ /* version patch from buttons_object.c */
+ if (data->flag==0)
+ data->flag = ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z;
+ }
+ break;
+ }
+ }
+ }
+
+ if (ob->type == OB_ARMATURE) {
+ if (ob->pose) {
+ bConstraint *curcon;
+ bPoseChannel *pchan;
+ for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) {
+ for (curcon = pchan->constraints.first; curcon; curcon=curcon->next) {
+ switch (curcon->type) {
+ case CONSTRAINT_TYPE_MINMAX:
+ {
+ bMinMaxConstraint *data = curcon->data;
+ if (data->sticky==1)
+ data->flag |= MINMAX_STICKY;
+ else
+ data->flag &= ~MINMAX_STICKY;
+ }
+ break;
+ case CONSTRAINT_TYPE_KINEMATIC:
+ {
+ bKinematicConstraint *data = curcon->data;
+ if (!(data->flag & CONSTRAINT_IK_POS)) {
+ data->flag |= CONSTRAINT_IK_POS;
+ data->flag |= CONSTRAINT_IK_STRETCH;
+ }
+ }
+ break;
+ case CONSTRAINT_TYPE_ROTLIKE:
+ {
+ bRotateLikeConstraint *data = curcon->data;
+
+ /* version patch from buttons_object.c */
+ if (data->flag==0)
+ data->flag = ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z;
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ /* copy old object level track settings to curve modifers */
+ for (md=ob->modifiers.first; md; md=md->next) {
+ if (md->type==eModifierType_Curve) {
+ CurveModifierData *cmd = (CurveModifierData*) md;
+
+ if (cmd->defaxis == 0) cmd->defaxis = ob->trackflag+1;
+ }
+ }
+
+ }
+
+ for (ma = main->mat.first; ma; ma= ma->id.next) {
+ if (ma->shad_alpha==0.0f)
+ ma->shad_alpha= 1.0f;
+ if (ma->nodetree)
+ ntree_version_242(ma->nodetree);
+ }
+
+ for (me=main->mesh.first; me; me=me->id.next)
+ customdata_version_242(me);
+
+ for (group= main->group.first; group; group= group->id.next)
+ if (group->layer==0)
+ group->layer= (1<<20)-1;
+
+ /* now, subversion control! */
+ if (main->subversionfile < 3) {
+ Image *ima;
+ Tex *tex;
+
+ /* Image refactor initialize */
+ for (ima= main->image.first; ima; ima= ima->id.next) {
+ ima->source= IMA_SRC_FILE;
+ ima->type= IMA_TYPE_IMAGE;
+
+ ima->gen_x= 256; ima->gen_y= 256;
+ ima->gen_type= 1;
+
+ if (0==strncmp(ima->id.name+2, "Viewer Node", sizeof(ima->id.name)-2)) {
+ ima->source= IMA_SRC_VIEWER;
+ ima->type= IMA_TYPE_COMPOSITE;
+ }
+ if (0==strncmp(ima->id.name+2, "Render Result", sizeof(ima->id.name)-2)) {
+ ima->source= IMA_SRC_VIEWER;
+ ima->type= IMA_TYPE_R_RESULT;
+ }
+
+ }
+ for (tex= main->tex.first; tex; tex= tex->id.next) {
+ if (tex->type==TEX_IMAGE && tex->ima) {
+ ima= newlibadr(fd, lib, tex->ima);
+ if (tex->imaflag & TEX_ANIM5_)
+ ima->source= IMA_SRC_MOVIE;
+ if (tex->imaflag & TEX_FIELDS_)
+ ima->flag |= IMA_FIELDS;
+ if (tex->imaflag & TEX_STD_FIELD_)
+ ima->flag |= IMA_STD_FIELD;
+ }
+ tex->iuser.frames= tex->frames;
+ tex->iuser.fie_ima= (char)tex->fie_ima;
+ tex->iuser.offset= tex->offset;
+ tex->iuser.sfra= tex->sfra;
+ tex->iuser.cycl= (tex->imaflag & TEX_ANIMCYCLIC_)!=0;
+ }
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ if (sce->nodetree)
+ do_version_ntree_242_2(sce->nodetree);
+ }
+ for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
+ do_version_ntree_242_2(ntree);
+ for (ma = main->mat.first; ma; ma= ma->id.next)
+ if (ma->nodetree)
+ do_version_ntree_242_2(ma->nodetree);
+
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ ScrArea *sa;
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ SpaceLink *sl;
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_IMAGE)
+ ((SpaceImage *)sl)->iuser.fie_ima= 2;
+ else if (sl->spacetype==SPACE_VIEW3D) {
+ View3D *v3d= (View3D *)sl;
+ BGpic *bgpic;
+ for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next)
+ bgpic->iuser.fie_ima= 2;
+ }
+ }
+ }
+ }
+ }
+
+ if (main->subversionfile < 4) {
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ sce->r.bake_mode= 1; /* prevent to include render stuff here */
+ sce->r.bake_filter= 2;
+ sce->r.bake_osa= 5;
+ sce->r.bake_flag= R_BAKE_CLEAR;
+ }
+ }
+
+ if (main->subversionfile < 5) {
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ /* improved triangle to quad conversion settings */
+ if (sce->toolsettings->jointrilimit==0.0f)
+ sce->toolsettings->jointrilimit= 0.8f;
+ }
+ }
+ }
+ if (main->versionfile <= 243) {
+ Object *ob= main->object.first;
+ Material *ma;
+
+ for (ma=main->mat.first; ma; ma= ma->id.next) {
+ if (ma->sss_scale==0.0f) {
+ ma->sss_radius[0]= 1.0f;
+ ma->sss_radius[1]= 1.0f;
+ ma->sss_radius[2]= 1.0f;
+ ma->sss_col[0]= 0.8f;
+ ma->sss_col[1]= 0.8f;
+ ma->sss_col[2]= 0.8f;
+ ma->sss_error= 0.05f;
+ ma->sss_scale= 0.1f;
+ ma->sss_ior= 1.3f;
+ ma->sss_colfac= 1.0f;
+ ma->sss_texfac= 0.0f;
+ }
+ if (ma->sss_front==0 && ma->sss_back==0) {
+ ma->sss_front= 1.0f;
+ ma->sss_back= 1.0f;
+ }
+ if (ma->sss_col[0]==0 && ma->sss_col[1]==0 && ma->sss_col[2]==0) {
+ ma->sss_col[0]= ma->r;
+ ma->sss_col[1]= ma->g;
+ ma->sss_col[2]= ma->b;
+ }
+ }
+
+ for (; ob; ob= ob->id.next) {
+ bDeformGroup *curdef;
+
+ for (curdef= ob->defbase.first; curdef; curdef=curdef->next) {
+ /* replace an empty-string name with unique name */
+ if (curdef->name[0] == '\0') {
+ defgroup_unique_name(curdef, ob);
+ }
+ }
+
+ if (main->versionfile < 243 || main->subversionfile < 1) {
+ ModifierData *md;
+
+ /* translate old mirror modifier axis values to new flags */
+ for (md=ob->modifiers.first; md; md=md->next) {
+ if (md->type==eModifierType_Mirror) {
+ MirrorModifierData *mmd = (MirrorModifierData*) md;
+
+ switch (mmd->axis) {
+ case 0:
+ mmd->flag |= MOD_MIR_AXIS_X;
+ break;
+ case 1:
+ mmd->flag |= MOD_MIR_AXIS_Y;
+ break;
+ case 2:
+ mmd->flag |= MOD_MIR_AXIS_Z;
+ break;
+ }
+
+ mmd->axis = 0;
+ }
+ }
+ }
+ }
+
+ /* render layer added, this is not the active layer */
+ if (main->versionfile <= 243 || main->subversionfile < 2) {
+ Mesh *me;
+ for (me=main->mesh.first; me; me=me->id.next)
+ customdata_version_243(me);
+ }
+
+ }
+
+ if (main->versionfile <= 244) {
+ Scene *sce;
+ bScreen *sc;
+ Lamp *la;
+ World *wrld;
+
+ if (main->versionfile != 244 || main->subversionfile < 2) {
+ for (sce= main->scene.first; sce; sce= sce->id.next)
+ sce->r.mode |= R_SSS;
+
+ /* correct older action editors - incorrect scrolling */
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ ScrArea *sa;
+ sa= sc->areabase.first;
+ while (sa) {
+ SpaceLink *sl;
+
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_ACTION) {
+ SpaceAction *saction= (SpaceAction*) sl;
+
+ saction->v2d.tot.ymin = -1000.0;
+ saction->v2d.tot.ymax = 0.0;
+
+ saction->v2d.cur.ymin = -75.0;
+ saction->v2d.cur.ymax = 5.0;
+ }
+ }
+ sa = sa->next;
+ }
+ }
+ }
+ if (main->versionfile != 244 || main->subversionfile < 3) {
+ /* constraints recode version patch used to be here. Moved to 245 now... */
+
+
+ for (wrld=main->world.first; wrld; wrld= wrld->id.next) {
+ if (wrld->mode & WO_AMB_OCC)
+ wrld->ao_samp_method = WO_AOSAMP_CONSTANT;
+ else
+ wrld->ao_samp_method = WO_AOSAMP_HAMMERSLEY;
+
+ wrld->ao_adapt_thresh = 0.005f;
+ }
+
+ for (la=main->lamp.first; la; la= la->id.next) {
+ if (la->type == LA_AREA)
+ la->ray_samp_method = LA_SAMP_CONSTANT;
+ else
+ la->ray_samp_method = LA_SAMP_HALTON;
+
+ la->adapt_thresh = 0.001f;
+ }
+ }
+ }
+ if (main->versionfile <= 245) {
+ Scene *sce;
+ Object *ob;
+ Image *ima;
+ Lamp *la;
+ Material *ma;
+ ParticleSettings *part;
+ World *wrld;
+ Mesh *me;
+ bNodeTree *ntree;
+ Tex *tex;
+ ModifierData *md;
+ ParticleSystem *psys;
+
+ /* unless the file was created 2.44.3 but not 2.45, update the constraints */
+ if ( !(main->versionfile==244 && main->subversionfile==3) &&
+ ((main->versionfile<245) || (main->versionfile==245 && main->subversionfile==0)) )
+ {
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ ListBase *list;
+ list = &ob->constraints;
+
+ /* fix up constraints due to constraint recode changes (originally at 2.44.3) */
+ if (list) {
+ bConstraint *curcon;
+ for (curcon = list->first; curcon; curcon=curcon->next) {
+ /* old CONSTRAINT_LOCAL check -> convert to CONSTRAINT_SPACE_LOCAL */
+ if (curcon->flag & 0x20) {
+ curcon->ownspace = CONSTRAINT_SPACE_LOCAL;
+ curcon->tarspace = CONSTRAINT_SPACE_LOCAL;
+ }
+
+ switch (curcon->type) {
+ case CONSTRAINT_TYPE_LOCLIMIT:
+ {
+ bLocLimitConstraint *data= (bLocLimitConstraint *)curcon->data;
+
+ /* old limit without parent option for objects */
+ if (data->flag2)
+ curcon->ownspace = CONSTRAINT_SPACE_LOCAL;
+ }
+ break;
+ }
+ }
+ }
+
+ /* correctly initialize constinv matrix */
+ unit_m4(ob->constinv);
+
+ if (ob->type == OB_ARMATURE) {
+ if (ob->pose) {
+ bConstraint *curcon;
+ bPoseChannel *pchan;
+
+ for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) {
+ /* make sure constraints are all up to date */
+ for (curcon = pchan->constraints.first; curcon; curcon=curcon->next) {
+ /* old CONSTRAINT_LOCAL check -> convert to CONSTRAINT_SPACE_LOCAL */
+ if (curcon->flag & 0x20) {
+ curcon->ownspace = CONSTRAINT_SPACE_LOCAL;
+ curcon->tarspace = CONSTRAINT_SPACE_LOCAL;
+ }
+
+ switch (curcon->type) {
+ case CONSTRAINT_TYPE_ACTION:
+ {
+ bActionConstraint *data= (bActionConstraint *)curcon->data;
+
+ /* 'data->local' used to mean that target was in local-space */
+ if (data->local)
+ curcon->tarspace = CONSTRAINT_SPACE_LOCAL;
+ }
+ break;
+ }
+ }
+
+ /* correctly initialize constinv matrix */
+ unit_m4(pchan->constinv);
+ }
+ }
+ }
+ }
+ }
+
+ /* fix all versions before 2.45 */
+ if (main->versionfile != 245) {
+
+ /* repair preview from 242 - 244*/
+ for (ima= main->image.first; ima; ima= ima->id.next) {
+ ima->preview = NULL;
+ }
+ }
+
+ /* add point caches */
+ for (ob=main->object.first; ob; ob=ob->id.next) {
+ if (ob->soft && !ob->soft->pointcache)
+ ob->soft->pointcache= BKE_ptcache_add(&ob->soft->ptcaches);
+
+ for (psys=ob->particlesystem.first; psys; psys=psys->next) {
+ if (psys->pointcache) {
+ if (psys->pointcache->flag & PTCACHE_BAKED && (psys->pointcache->flag & PTCACHE_DISK_CACHE)==0) {
+ printf("Old memory cache isn't supported for particles, so re-bake the simulation!\n");
+ psys->pointcache->flag &= ~PTCACHE_BAKED;
+ }
+ }
+ else
+ psys->pointcache= BKE_ptcache_add(&psys->ptcaches);
+ }
+
+ for (md=ob->modifiers.first; md; md=md->next) {
+ if (md->type==eModifierType_Cloth) {
+ ClothModifierData *clmd = (ClothModifierData*) md;
+ if (!clmd->point_cache)
+ clmd->point_cache= BKE_ptcache_add(&clmd->ptcaches);
+ }
+ }
+ }
+
+ /* Copy over old per-level multires vertex data
+ * into a single vertex array in struct Multires */
+ for (me = main->mesh.first; me; me=me->id.next) {
+ if (me->mr && !me->mr->verts) {
+ MultiresLevel *lvl = me->mr->levels.last;
+ if (lvl) {
+ me->mr->verts = lvl->verts;
+ lvl->verts = NULL;
+ /* Don't need the other vert arrays */
+ for (lvl = lvl->prev; lvl; lvl = lvl->prev) {
+ MEM_freeN(lvl->verts);
+ lvl->verts = NULL;
+ }
+ }
+ }
+ }
+
+ if (main->versionfile != 245 || main->subversionfile < 1) {
+ for (la=main->lamp.first; la; la= la->id.next) {
+ if (la->mode & LA_QUAD) la->falloff_type = LA_FALLOFF_SLIDERS;
+ else la->falloff_type = LA_FALLOFF_INVLINEAR;
+
+ if (la->curfalloff == NULL) {
+ la->curfalloff = curvemapping_add(1, 0.0f, 1.0f, 1.0f, 0.0f);
+ curvemapping_initialize(la->curfalloff);
+ }
+ }
+ }
+
+ for (ma=main->mat.first; ma; ma= ma->id.next) {
+ if (ma->samp_gloss_mir == 0) {
+ ma->gloss_mir = ma->gloss_tra= 1.0f;
+ ma->aniso_gloss_mir = 1.0f;
+ ma->samp_gloss_mir = ma->samp_gloss_tra= 18;
+ ma->adapt_thresh_mir = ma->adapt_thresh_tra = 0.005f;
+ ma->dist_mir = 0.0f;
+ ma->fadeto_mir = MA_RAYMIR_FADETOSKY;
+ }
+
+ if (ma->strand_min == 0.0f)
+ ma->strand_min= 1.0f;
+ }
+
+ for (part=main->particle.first; part; part=part->id.next) {
+ if (part->ren_child_nbr==0)
+ part->ren_child_nbr= part->child_nbr;
+
+ if (part->simplify_refsize==0) {
+ part->simplify_refsize= 1920;
+ part->simplify_rate= 1.0f;
+ part->simplify_transition= 0.1f;
+ part->simplify_viewport= 0.8f;
+ }
+ }
+
+ for (wrld=main->world.first; wrld; wrld= wrld->id.next) {
+ if (wrld->ao_approx_error == 0.0f)
+ wrld->ao_approx_error= 0.25f;
+ }
+
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ if (sce->nodetree)
+ ntree_version_245(fd, lib, sce->nodetree);
+
+ if (sce->r.simplify_shadowsamples == 0) {
+ sce->r.simplify_subsurf= 6;
+ sce->r.simplify_particles= 1.0f;
+ sce->r.simplify_shadowsamples= 16;
+ sce->r.simplify_aosss= 1.0f;
+ }
+
+ if (sce->r.cineongamma == 0) {
+ sce->r.cineonblack= 95;
+ sce->r.cineonwhite= 685;
+ sce->r.cineongamma= 1.7f;
+ }
+ }
+
+ for (ntree=main->nodetree.first; ntree; ntree= ntree->id.next)
+ ntree_version_245(fd, lib, ntree);
+
+ /* fix for temporary flag changes during 245 cycle */
+ for (ima= main->image.first; ima; ima= ima->id.next) {
+ if (ima->flag & IMA_OLD_PREMUL) {
+ ima->flag &= ~IMA_OLD_PREMUL;
+ ima->flag |= IMA_DO_PREMUL;
+ }
+ }
+
+ for (tex=main->tex.first; tex; tex=tex->id.next) {
+ if (tex->iuser.flag & IMA_OLD_PREMUL) {
+ tex->iuser.flag &= ~IMA_OLD_PREMUL;
+ tex->iuser.flag |= IMA_DO_PREMUL;
+
+ }
+
+ ima= newlibadr(fd, lib, tex->ima);
+ if (ima && (tex->iuser.flag & IMA_DO_PREMUL)) {
+ ima->flag &= ~IMA_OLD_PREMUL;
+ ima->flag |= IMA_DO_PREMUL;
+ }
+ }
+ }
+
+ /* sanity check for skgen
+ * */
+ {
+ Scene *sce;
+ for (sce=main->scene.first; sce; sce = sce->id.next) {
+ if (sce->toolsettings->skgen_subdivisions[0] == sce->toolsettings->skgen_subdivisions[1] ||
+ sce->toolsettings->skgen_subdivisions[0] == sce->toolsettings->skgen_subdivisions[2] ||
+ sce->toolsettings->skgen_subdivisions[1] == sce->toolsettings->skgen_subdivisions[2])
+ {
+ sce->toolsettings->skgen_subdivisions[0] = SKGEN_SUB_CORRELATION;
+ sce->toolsettings->skgen_subdivisions[1] = SKGEN_SUB_LENGTH;
+ sce->toolsettings->skgen_subdivisions[2] = SKGEN_SUB_ANGLE;
+ }
+ }
+ }
+
+
+ if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 2)) {
+ Image *ima;
+
+ /* initialize 1:1 Aspect */
+ for (ima= main->image.first; ima; ima= ima->id.next) {
+ ima->aspx = ima->aspy = 1.0f;
+ }
+
+ }
+
+ if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 4)) {
+ bArmature *arm;
+ ModifierData *md;
+ Object *ob;
+
+ for (arm= main->armature.first; arm; arm= arm->id.next)
+ arm->deformflag |= ARM_DEF_B_BONE_REST;
+
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ for (md=ob->modifiers.first; md; md=md->next) {
+ if (md->type==eModifierType_Armature)
+ ((ArmatureModifierData*)md)->deformflag |= ARM_DEF_B_BONE_REST;
+ }
+ }
+ }
+
+ if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 5)) {
+ /* foreground color needs to be something other then black */
+ Scene *sce;
+ for (sce= main->scene.first; sce; sce=sce->id.next) {
+ sce->r.fg_stamp[0] = sce->r.fg_stamp[1] = sce->r.fg_stamp[2] = 0.8f;
+ sce->r.fg_stamp[3] = 1.0f; /* don't use text alpha yet */
+ sce->r.bg_stamp[3] = 0.25f; /* make sure the background has full alpha */
+ }
+ }
+
+
+ if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 6)) {
+ Scene *sce;
+ /* fix frs_sec_base */
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ if (sce->r.frs_sec_base == 0) {
+ sce->r.frs_sec_base = 1;
+ }
+ }
+ }
+
+ if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 7)) {
+ Object *ob;
+ bPoseChannel *pchan;
+ bConstraint *con;
+ bConstraintTarget *ct;
+
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ if (ob->pose) {
+ for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
+ for (con=pchan->constraints.first; con; con=con->next) {
+ if (con->type == CONSTRAINT_TYPE_PYTHON) {
+ bPythonConstraint *data= (bPythonConstraint *)con->data;
+ if (data->tar) {
+ /* version patching needs to be done */
+ ct= MEM_callocN(sizeof(bConstraintTarget), "PyConTarget");
+
+ ct->tar = data->tar;
+ BLI_strncpy(ct->subtarget, data->subtarget, sizeof(ct->subtarget));
+ ct->space = con->tarspace;
+
+ BLI_addtail(&data->targets, ct);
+ data->tarnum++;
+
+ /* clear old targets to avoid problems */
+ data->tar = NULL;
+ data->subtarget[0]= '\0';
+ }
+ }
+ else if (con->type == CONSTRAINT_TYPE_LOCLIKE) {
+ bLocateLikeConstraint *data= (bLocateLikeConstraint *)con->data;
+
+ /* new headtail functionality makes Bone-Tip function obsolete */
+ if (data->flag & LOCLIKE_TIP)
+ con->headtail = 1.0f;
+ }
+ }
+ }
+ }
+
+ for (con=ob->constraints.first; con; con=con->next) {
+ if (con->type==CONSTRAINT_TYPE_PYTHON) {
+ bPythonConstraint *data= (bPythonConstraint *)con->data;
+ if (data->tar) {
+ /* version patching needs to be done */
+ ct= MEM_callocN(sizeof(bConstraintTarget), "PyConTarget");
+
+ ct->tar = data->tar;
+ BLI_strncpy(ct->subtarget, data->subtarget, sizeof(ct->subtarget));
+ ct->space = con->tarspace;
+
+ BLI_addtail(&data->targets, ct);
+ data->tarnum++;
+
+ /* clear old targets to avoid problems */
+ data->tar = NULL;
+ data->subtarget[0]= '\0';
+ }
+ }
+ else if (con->type == CONSTRAINT_TYPE_LOCLIKE) {
+ bLocateLikeConstraint *data= (bLocateLikeConstraint *)con->data;
+
+ /* new headtail functionality makes Bone-Tip function obsolete */
+ if (data->flag & LOCLIKE_TIP)
+ con->headtail = 1.0f;
+ }
+ }
+
+ if (ob->soft && ob->soft->keys) {
+ SoftBody *sb = ob->soft;
+ int k;
+
+ for (k=0; k<sb->totkey; k++) {
+ if (sb->keys[k])
+ MEM_freeN(sb->keys[k]);
+ }
+
+ MEM_freeN(sb->keys);
+
+ sb->keys = NULL;
+ sb->totkey = 0;
+ }
+ }
+ }
+
+ if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 8)) {
+ Scene *sce;
+ Object *ob;
+ PartEff *paf=NULL;
+
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ if (ob->soft && ob->soft->keys) {
+ SoftBody *sb = ob->soft;
+ int k;
+
+ for (k=0; k<sb->totkey; k++) {
+ if (sb->keys[k])
+ MEM_freeN(sb->keys[k]);
+ }
+
+ MEM_freeN(sb->keys);
+
+ sb->keys = NULL;
+ sb->totkey = 0;
+ }
+
+ /* convert old particles to new system */
+ if ((paf = do_version_give_parteff_245(ob))) {
+ ParticleSystem *psys;
+ ModifierData *md;
+ ParticleSystemModifierData *psmd;
+ ParticleSettings *part;
+
+ /* create new particle system */
+ psys = MEM_callocN(sizeof(ParticleSystem), "particle_system");
+ psys->pointcache = BKE_ptcache_add(&psys->ptcaches);
+
+ part = psys->part = psys_new_settings("ParticleSettings", main);
+
+ /* needed for proper libdata lookup */
+ oldnewmap_insert(fd->libmap, psys->part, psys->part, 0);
+ part->id.lib= ob->id.lib;
+
+ part->id.us--;
+ part->id.flag |= (ob->id.flag & LIB_NEEDLINK);
+
+ psys->totpart=0;
+ psys->flag= PSYS_ENABLED|PSYS_CURRENT;
+
+ BLI_addtail(&ob->particlesystem, psys);
+
+ md= modifier_new(eModifierType_ParticleSystem);
+ BLI_snprintf(md->name, sizeof(md->name), "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
+ psmd= (ParticleSystemModifierData*) md;
+ psmd->psys=psys;
+ BLI_addtail(&ob->modifiers, md);
+
+ /* convert settings from old particle system */
+ /* general settings */
+ part->totpart = MIN2(paf->totpart, 100000);
+ part->sta = paf->sta;
+ part->end = paf->end;
+ part->lifetime = paf->lifetime;
+ part->randlife = paf->randlife;
+ psys->seed = paf->seed;
+ part->disp = paf->disp;
+ part->omat = paf->mat[0];
+ part->hair_step = paf->totkey;
+
+ part->eff_group = paf->group;
+
+ /* old system didn't interpolate between keypoints at render time */
+ part->draw_step = part->ren_step = 0;
+
+ /* physics */
+ part->normfac = paf->normfac * 25.0f;
+ part->obfac = paf->obfac;
+ part->randfac = paf->randfac * 25.0f;
+ part->dampfac = paf->damp;
+ copy_v3_v3(part->acc, paf->force);
+
+ /* flags */
+ if (paf->stype & PAF_VECT) {
+ if (paf->flag & PAF_STATIC) {
+ /* new hair lifetime is always 100.0f */
+ float fac = paf->lifetime / 100.0f;
+
+ part->draw_as = PART_DRAW_PATH;
+ part->type = PART_HAIR;
+ psys->recalc |= PSYS_RECALC_REDO;
+
+ part->normfac *= fac;
+ part->randfac *= fac;
+ }
+ else {
+ part->draw_as = PART_DRAW_LINE;
+ part->draw |= PART_DRAW_VEL_LENGTH;
+ part->draw_line[1] = 0.04f;
+ }
+ }
+
+ part->rotmode = PART_ROT_VEL;
+
+ part->flag |= (paf->flag & PAF_BSPLINE) ? PART_HAIR_BSPLINE : 0;
+ part->flag |= (paf->flag & PAF_TRAND) ? PART_TRAND : 0;
+ part->flag |= (paf->flag & PAF_EDISTR) ? PART_EDISTR : 0;
+ part->flag |= (paf->flag & PAF_UNBORN) ? PART_UNBORN : 0;
+ part->flag |= (paf->flag & PAF_DIED) ? PART_DIED : 0;
+ part->from |= (paf->flag & PAF_FACE) ? PART_FROM_FACE : 0;
+ part->draw |= (paf->flag & PAF_SHOWE) ? PART_DRAW_EMITTER : 0;
+
+ psys->vgroup[PSYS_VG_DENSITY] = paf->vertgroup;
+ psys->vgroup[PSYS_VG_VEL] = paf->vertgroup_v;
+ psys->vgroup[PSYS_VG_LENGTH] = paf->vertgroup_v;
+
+ /* dupliobjects */
+ if (ob->transflag & OB_DUPLIVERTS) {
+ Object *dup = main->object.first;
+
+ for (; dup; dup= dup->id.next) {
+ if (ob == newlibadr(fd, lib, dup->parent)) {
+ part->dup_ob = dup;
+ ob->transflag |= OB_DUPLIPARTS;
+ ob->transflag &= ~OB_DUPLIVERTS;
+
+ part->draw_as = PART_DRAW_OB;
+
+ /* needed for proper libdata lookup */
+ oldnewmap_insert(fd->libmap, dup, dup, 0);
+ }
+ }
+ }
+
+
+ {
+ FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
+ if (fluidmd && fluidmd->fss && fluidmd->fss->type == OB_FLUIDSIM_PARTICLE)
+ part->type = PART_FLUID;
+ }
+
+ do_version_free_effects_245(&ob->effect);
+
+ printf("Old particle system converted to new system.\n");
+ }
+ }
+
+ for (sce= main->scene.first; sce; sce=sce->id.next) {
+ ParticleEditSettings *pset= &sce->toolsettings->particle;
+ int a;
+
+ if (pset->brush[0].size == 0) {
+ pset->flag= PE_KEEP_LENGTHS|PE_LOCK_FIRST|PE_DEFLECT_EMITTER;
+ pset->emitterdist= 0.25f;
+ pset->totrekey= 5;
+ pset->totaddkey= 5;
+ pset->brushtype= PE_BRUSH_NONE;
+
+ for (a=0; a<PE_TOT_BRUSH; a++) {
+ pset->brush[a].strength= 50;
+ pset->brush[a].size= 50;
+ pset->brush[a].step= 10;
+ }
+
+ pset->brush[PE_BRUSH_CUT].strength= 100;
+ }
+ }
+ }
+ if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 9)) {
+ Material *ma;
+ int a;
+
+ for (ma=main->mat.first; ma; ma= ma->id.next)
+ if (ma->mode & MA_NORMAP_TANG)
+ for (a=0; a<MAX_MTEX; a++)
+ if (ma->mtex[a] && ma->mtex[a]->tex)
+ ma->mtex[a]->normapspace = MTEX_NSPACE_TANGENT;
+ }
+
+ if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 10)) {
+ Object *ob;
+
+ /* dupliface scale */
+ for (ob= main->object.first; ob; ob= ob->id.next)
+ ob->dupfacesca = 1.0f;
+ }
+
+ if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 11)) {
+ Object *ob;
+ bActionStrip *strip;
+
+ /* nla-strips - scale */
+ for (ob= main->object.first; ob; ob= ob->id.next) {
+ for (strip= ob->nlastrips.first; strip; strip= strip->next) {
+ float length, actlength, repeat;
+
+ if (strip->flag & ACTSTRIP_USESTRIDE)
+ repeat= 1.0f;
+ else
+ repeat= strip->repeat;
+
+ length = strip->end-strip->start;
+ if (length == 0.0f) length= 1.0f;
+ actlength = strip->actend-strip->actstart;
+
+ strip->scale = length / (repeat * actlength);
+ if (strip->scale == 0.0f) strip->scale= 1.0f;
+ }
+ if (ob->soft) {
+ ob->soft->inpush = ob->soft->inspring;
+ ob->soft->shearstiff = 1.0f;
+ }
+ }
+ }
+
+ if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 14)) {
+ Scene *sce;
+ Sequence *seq;
+
+ for (sce=main->scene.first; sce; sce=sce->id.next) {
+ SEQ_BEGIN (sce->ed, seq)
+ {
+ if (seq->blend_mode == 0)
+ seq->blend_opacity = 100.0f;
+ }
+ SEQ_END
+ }
+ }
+
+ /*fix broken group lengths in id properties*/
+ if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 15)) {
+ idproperties_fix_group_lengths(main->scene);
+ idproperties_fix_group_lengths(main->library);
+ idproperties_fix_group_lengths(main->object);
+ idproperties_fix_group_lengths(main->mesh);
+ idproperties_fix_group_lengths(main->curve);
+ idproperties_fix_group_lengths(main->mball);
+ idproperties_fix_group_lengths(main->mat);
+ idproperties_fix_group_lengths(main->tex);
+ idproperties_fix_group_lengths(main->image);
+ idproperties_fix_group_lengths(main->latt);
+ idproperties_fix_group_lengths(main->lamp);
+ idproperties_fix_group_lengths(main->camera);
+ idproperties_fix_group_lengths(main->ipo);
+ idproperties_fix_group_lengths(main->key);
+ idproperties_fix_group_lengths(main->world);
+ idproperties_fix_group_lengths(main->screen);
+ idproperties_fix_group_lengths(main->script);
+ idproperties_fix_group_lengths(main->vfont);
+ idproperties_fix_group_lengths(main->text);
+ idproperties_fix_group_lengths(main->sound);
+ idproperties_fix_group_lengths(main->group);
+ idproperties_fix_group_lengths(main->armature);
+ idproperties_fix_group_lengths(main->action);
+ idproperties_fix_group_lengths(main->nodetree);
+ idproperties_fix_group_lengths(main->brush);
+ idproperties_fix_group_lengths(main->particle);
+ }
+
+ /* sun/sky */
+ if (main->versionfile < 246) {
+ Object *ob;
+ bActuator *act;
+
+ /* dRot actuator change direction in 2.46 */
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ for (act= ob->actuators.first; act; act= act->next) {
+ if (act->type == ACT_OBJECT) {
+ bObjectActuator *ba= act->data;
+
+ ba->drot[0] = -ba->drot[0];
+ ba->drot[1] = -ba->drot[1];
+ ba->drot[2] = -ba->drot[2];
+ }
+ }
+ }
+ }
+
+ // convert fluids to modifier
+ if (main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)) {
+ Object *ob;
+
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ if (ob->fluidsimSettings) {
+ FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifier_new(eModifierType_Fluidsim);
+ BLI_addhead(&ob->modifiers, (ModifierData *)fluidmd);
+
+ MEM_freeN(fluidmd->fss);
+ fluidmd->fss = MEM_dupallocN(ob->fluidsimSettings);
+ fluidmd->fss->ipo = newlibadr_us(fd, ob->id.lib, ob->fluidsimSettings->ipo);
+ MEM_freeN(ob->fluidsimSettings);
+
+ fluidmd->fss->lastgoodframe = INT_MAX;
+ fluidmd->fss->flag = 0;
+ fluidmd->fss->meshVelocities = NULL;
+ }
+ }
+ }
+
+
+ if (main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)) {
+ Mesh *me;
+
+ for (me=main->mesh.first; me; me= me->id.next)
+ alphasort_version_246(fd, lib, me);
+ }
+
+ if (main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)) {
+ Object *ob;
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ if (ob->pd && (ob->pd->forcefield == PFIELD_WIND))
+ ob->pd->f_noise = 0.0f;
+ }
+ }
+
+ if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 2)) {
+ Object *ob;
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ ob->gameflag |= OB_COLLISION;
+ ob->margin = 0.06f;
+ }
+ }
+
+ if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 3)) {
+ Object *ob;
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ // Starting from subversion 3, ACTOR is a separate feature.
+ // Before it was conditioning all the other dynamic flags
+ if (!(ob->gameflag & OB_ACTOR))
+ ob->gameflag &= ~(OB_GHOST|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_COLLISION_RESPONSE);
+ /* suitable default for older files */
+ }
+ }
+
+ if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 5)) {
+ Lamp *la= main->lamp.first;
+ for (; la; la= la->id.next) {
+ la->skyblendtype= MA_RAMP_ADD;
+ la->skyblendfac= 1.0f;
+ }
+ }
+
+ /* set the curve radius interpolation to 2.47 default - easy */
+ if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 6)) {
+ Curve *cu;
+ Nurb *nu;
+
+ for (cu= main->curve.first; cu; cu= cu->id.next) {
+ for (nu= cu->nurb.first; nu; nu= nu->next) {
+ if (nu) {
+ nu->radius_interp = 3;
+
+ /* resolu and resolv are now used differently for surfaces
+ * rather than using the resolution to define the entire number of divisions,
+ * use it for the number of divisions per segment
+ */
+ if (nu->pntsv > 1) {
+ nu->resolu = MAX2( 1, (int)(((float)nu->resolu / (float)nu->pntsu)+0.5f) );
+ nu->resolv = MAX2( 1, (int)(((float)nu->resolv / (float)nu->pntsv)+0.5f) );
+ }
+ }
+ }
+ }
+ }
+ /* direction constraint actuators were always local in previous version */
+ if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 7)) {
+ bActuator *act;
+ Object *ob;
+
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ for (act= ob->actuators.first; act; act= act->next) {
+ if (act->type == ACT_CONSTRAINT) {
+ bConstraintActuator *coa = act->data;
+ if (coa->type == ACT_CONST_TYPE_DIST) {
+ coa->flag |= ACT_CONST_LOCAL;
+ }
+ }
+ }
+ }
+ }
+
+ if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 9)) {
+ Lamp *la= main->lamp.first;
+ for (; la; la= la->id.next) {
+ la->sky_exposure= 1.0f;
+ }
+ }
+
+ /* BGE message actuators needed OB prefix, very confusing */
+ if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 10)) {
+ bActuator *act;
+ Object *ob;
+
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ for (act= ob->actuators.first; act; act= act->next) {
+ if (act->type == ACT_MESSAGE) {
+ bMessageActuator *msgAct = (bMessageActuator *) act->data;
+ if (BLI_strnlen(msgAct->toPropName, 3) > 2) {
+ /* strip first 2 chars, would have only worked if these were OB anyway */
+ memmove(msgAct->toPropName, msgAct->toPropName + 2, sizeof(msgAct->toPropName) - 2);
+ }
+ else {
+ msgAct->toPropName[0] = '\0';
+ }
+ }
+ }
+ }
+ }
+
+ if (main->versionfile < 248) {
+ Lamp *la;
+
+ for (la=main->lamp.first; la; la= la->id.next) {
+ if (la->atm_turbidity == 0.0f) {
+ la->sun_effect_type = 0;
+ la->horizon_brightness = 1.0f;
+ la->spread = 1.0f;
+ la->sun_brightness = 1.0f;
+ la->sun_size = 1.0f;
+ la->backscattered_light = 1.0f;
+ la->atm_turbidity = 2.0f;
+ la->atm_inscattering_factor = 1.0f;
+ la->atm_extinction_factor = 1.0f;
+ la->atm_distance_factor = 1.0f;
+ la->sun_intensity = 1.0f;
+ }
+ }
+ }
+
+ if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 2)) {
+ Scene *sce;
+
+ /* Note, these will need to be added for painting */
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ sce->toolsettings->imapaint.seam_bleed = 2;
+ sce->toolsettings->imapaint.normal_angle = 80;
+
+ /* initialize skeleton generation toolsettings */
+ sce->toolsettings->skgen_resolution = 250;
+ sce->toolsettings->skgen_threshold_internal = 0.1f;
+ sce->toolsettings->skgen_threshold_external = 0.1f;
+ sce->toolsettings->skgen_angle_limit = 30.0f;
+ sce->toolsettings->skgen_length_ratio = 1.3f;
+ sce->toolsettings->skgen_length_limit = 1.5f;
+ sce->toolsettings->skgen_correlation_limit = 0.98f;
+ sce->toolsettings->skgen_symmetry_limit = 0.1f;
+ sce->toolsettings->skgen_postpro = SKGEN_SMOOTH;
+ sce->toolsettings->skgen_postpro_passes = 3;
+ sce->toolsettings->skgen_options = SKGEN_FILTER_INTERNAL|SKGEN_FILTER_EXTERNAL|SKGEN_FILTER_SMART|SKGEN_SUB_CORRELATION|SKGEN_HARMONIC;
+ sce->toolsettings->skgen_subdivisions[0] = SKGEN_SUB_CORRELATION;
+ sce->toolsettings->skgen_subdivisions[1] = SKGEN_SUB_LENGTH;
+ sce->toolsettings->skgen_subdivisions[2] = SKGEN_SUB_ANGLE;
+
+
+ sce->toolsettings->skgen_retarget_angle_weight = 1.0f;
+ sce->toolsettings->skgen_retarget_length_weight = 1.0f;
+ sce->toolsettings->skgen_retarget_distance_weight = 1.0f;
+
+ /* Skeleton Sketching */
+ sce->toolsettings->bone_sketching = 0;
+ sce->toolsettings->skgen_retarget_roll = SK_RETARGET_ROLL_VIEW;
+ }
+ }
+ if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 3)) {
+ bScreen *sc;
+
+ /* adjust default settings for Animation Editors */
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ ScrArea *sa;
+
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ SpaceLink *sl;
+
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ switch (sl->spacetype) {
+ case SPACE_ACTION:
+ {
+ SpaceAction *sact= (SpaceAction *)sl;
+
+ sact->mode= SACTCONT_DOPESHEET;
+ sact->autosnap= SACTSNAP_FRAME;
+ }
+ break;
+ case SPACE_IPO:
+ {
+ SpaceIpo *sipo= (SpaceIpo *)sl;
+ sipo->autosnap= SACTSNAP_FRAME;
+ }
+ break;
+ case SPACE_NLA:
+ {
+ SpaceNla *snla= (SpaceNla *)sl;
+ snla->autosnap= SACTSNAP_FRAME;
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
- blo_do_versions_pre250(fd, lib, main);
- blo_do_versions_250(fd, lib, main);
+ if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 3)) {
+ Object *ob;
+
+ /* Adjustments needed after Bullets update */
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ ob->damping *= 0.635f;
+ ob->rdamping = 0.1f + (0.8f * ob->rdamping);
+ }
+ }
+
+ if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 4)) {
+ Scene *sce;
+ World *wrld;
+
+ /* Dome (Fisheye) default parameters */
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ sce->r.domeangle = 180;
+ sce->r.domemode = 1;
+ sce->r.domeres = 4;
+ sce->r.domeresbuf = 1.0f;
+ sce->r.dometilt = 0;
+ }
+ /* DBVT culling by default */
+ for (wrld=main->world.first; wrld; wrld= wrld->id.next) {
+ wrld->mode |= WO_DBVT_CULLING;
+ wrld->occlusionRes = 128;
+ }
+ }
+
+ if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 5)) {
+ Object *ob;
+ World *wrld;
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ ob->m_contactProcessingThreshold = 1.0f; //pad3 is used for m_contactProcessingThreshold
+ if (ob->parent) {
+ /* check if top parent has compound shape set and if yes, set this object
+ * to compound shaper as well (was the behavior before, now it's optional) */
+ Object *parent= newlibadr(fd, lib, ob->parent);
+ while (parent && parent != ob && parent->parent != NULL) {
+ parent = newlibadr(fd, lib, parent->parent);
+ }
+ if (parent) {
+ if (parent->gameflag & OB_CHILD)
+ ob->gameflag |= OB_CHILD;
+ }
+ }
+ }
+ for (wrld=main->world.first; wrld; wrld= wrld->id.next) {
+ wrld->ticrate = 60;
+ wrld->maxlogicstep = 5;
+ wrld->physubstep = 1;
+ wrld->maxphystep = 5;
+ }
+ }
+
+ // correct introduce of seed for wind force
+ if (main->versionfile < 249 && main->subversionfile < 1) {
+ Object *ob;
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ if (ob->pd)
+ ob->pd->seed = ((unsigned int)(ceil(PIL_check_seconds_timer()))+1) % 128;
+ }
+
+ }
+
+ if (main->versionfile < 249 && main->subversionfile < 2) {
+ Scene *sce= main->scene.first;
+ Sequence *seq;
+ Editing *ed;
+
+ while (sce) {
+ ed= sce->ed;
+ if (ed) {
+ SEQP_BEGIN (ed, seq)
+ {
+ if (seq->strip && seq->strip->proxy) {
+ seq->strip->proxy->quality =90;
+ }
+ }
+ SEQ_END
+ }
+
+ sce= sce->id.next;
+ }
+
+ }
+
+ if (main->versionfile < 250) {
+ bScreen *screen;
+ Scene *scene;
+ Base *base;
+ Material *ma;
+ Camera *cam;
+ Mesh *me;
+ Curve *cu;
+ Scene *sce;
+ Tex *tx;
+ ParticleSettings *part;
+ Object *ob;
+ //PTCacheID *pid;
+ //ListBase pidlist;
+
+ bSound *sound;
+ Sequence *seq;
+ bActuator *act;
+ int a;
+
+ for (sound = main->sound.first; sound; sound = sound->id.next) {
+ if (sound->newpackedfile) {
+ sound->packedfile = sound->newpackedfile;
+ sound->newpackedfile = NULL;
+ }
+ }
+
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ for (act= ob->actuators.first; act; act= act->next) {
+ if (act->type == ACT_SOUND) {
+ bSoundActuator *sAct = (bSoundActuator*) act->data;
+ if (sAct->sound) {
+ sound = newlibadr(fd, lib, sAct->sound);
+ sAct->flag = sound->flags & SOUND_FLAGS_3D ? ACT_SND_3D_SOUND : 0;
+ sAct->pitch = sound->pitch;
+ sAct->volume = sound->volume;
+ sAct->sound3D.reference_distance = sound->distance;
+ sAct->sound3D.max_gain = sound->max_gain;
+ sAct->sound3D.min_gain = sound->min_gain;
+ sAct->sound3D.rolloff_factor = sound->attenuation;
+ }
+ else {
+ sAct->sound3D.reference_distance = 1.0f;
+ sAct->volume = 1.0f;
+ sAct->sound3D.max_gain = 1.0f;
+ sAct->sound3D.rolloff_factor = 1.0f;
+ }
+ sAct->sound3D.cone_inner_angle = 360.0f;
+ sAct->sound3D.cone_outer_angle = 360.0f;
+ sAct->sound3D.max_distance = FLT_MAX;
+ }
+ }
+ }
+
+ for (scene = main->scene.first; scene; scene = scene->id.next) {
+ if (scene->ed && scene->ed->seqbasep) {
+ SEQ_BEGIN (scene->ed, seq)
+ {
+ if (seq->type == SEQ_HD_SOUND) {
+ char str[FILE_MAX];
+ BLI_join_dirfile(str, sizeof(str), seq->strip->dir, seq->strip->stripdata->name);
+ BLI_path_abs(str, main->name);
+ seq->sound = sound_new_file(main, str);
+ }
+ /* don't know, if anybody used that
+ * this way, but just in case, upgrade
+ * to new way... */
+ if ((seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) &&
+ !(seq->flag & SEQ_USE_PROXY_CUSTOM_DIR))
+ {
+
+ BLI_snprintf(seq->strip->proxy->dir,
+ FILE_MAXDIR, "%s/BL_proxy",
+ seq->strip->dir);
+ }
+ }
+ SEQ_END
+ }
+ }
+
+ for (screen= main->screen.first; screen; screen= screen->id.next) {
+ do_versions_windowmanager_2_50(screen);
+ do_versions_gpencil_2_50(main, screen);
+ }
+
+ /* shader, composite and texture node trees have id.name empty, put something in
+ * to have them show in RNA viewer and accessible otherwise.
+ */
+ for (ma= main->mat.first; ma; ma= ma->id.next) {
+ if (ma->nodetree && ma->nodetree->id.name[0] == '\0')
+ strcpy(ma->nodetree->id.name, "NTShader Nodetree");
+
+ /* which_output 0 is now "not specified" */
+ for (a=0; a<MAX_MTEX; a++) {
+ if (ma->mtex[a]) {
+ tx= newlibadr(fd, lib, ma->mtex[a]->tex);
+ if (tx && tx->use_nodes)
+ ma->mtex[a]->which_output++;
+ }
+ }
+ }
+ /* and composite trees */
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ if (sce->nodetree && sce->nodetree->id.name[0] == '\0')
+ strcpy(sce->nodetree->id.name, "NTCompositing Nodetree");
+
+ /* move to cameras */
+ if (sce->r.mode & R_PANORAMA) {
+ for (base=sce->base.first; base; base=base->next) {
+ ob= newlibadr(fd, lib, base->object);
+
+ if (ob->type == OB_CAMERA && !ob->id.lib) {
+ cam= newlibadr(fd, lib, ob->data);
+ cam->flag |= CAM_PANORAMA;
+ }
+ }
+
+ sce->r.mode &= ~R_PANORAMA;
+ }
+ }
+ /* and texture trees */
+ for (tx= main->tex.first; tx; tx= tx->id.next) {
+ bNode *node;
+
+ if (tx->nodetree) {
+ if (tx->nodetree->id.name[0] == '\0')
+ strcpy(tx->nodetree->id.name, "NTTexture Nodetree");
+
+ /* which_output 0 is now "not specified" */
+ for (node=tx->nodetree->nodes.first; node; node=node->next)
+ if (node->type == TEX_NODE_OUTPUT)
+ node->custom1++;
+ }
+ }
+
+ /* copy standard draw flag to meshes(used to be global, is not available here) */
+ for (me= main->mesh.first; me; me= me->id.next) {
+ me->drawflag= ME_DRAWEDGES|ME_DRAWFACES|ME_DRAWCREASES;
+ }
+
+ /* particle draw and render types */
+ for (part= main->particle.first; part; part= part->id.next) {
+ if (part->draw_as) {
+ if (part->draw_as == PART_DRAW_DOT) {
+ part->ren_as = PART_DRAW_HALO;
+ part->draw_as = PART_DRAW_REND;
+ }
+ else if (part->draw_as <= PART_DRAW_AXIS) {
+ part->ren_as = PART_DRAW_HALO;
+ }
+ else {
+ part->ren_as = part->draw_as;
+ part->draw_as = PART_DRAW_REND;
+ }
+ }
+ part->path_end = 1.0f;
+ part->clength = 1.0f;
+ }
+ /* set old pointcaches to have disk cache flag */
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+
+ //BKE_ptcache_ids_from_object(&pidlist, ob);
+
+ //for (pid=pidlist.first; pid; pid=pid->next)
+ // pid->cache->flag |= PTCACHE_DISK_CACHE;
+
+ //BLI_freelistN(&pidlist);
+ }
+
+ /* type was a mixed flag & enum. move the 2d flag elsewhere */
+ for (cu = main->curve.first; cu; cu= cu->id.next) {
+ Nurb *nu;
+
+ for (nu= cu->nurb.first; nu; nu= nu->next) {
+ nu->flag |= (nu->type & CU_2D);
+ nu->type &= CU_TYPE;
+ }
+ }
+ }
+
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 1)) {
+ Object *ob;
+ Material *ma;
+ Tex *tex;
+ Scene *sce;
+ ToolSettings *ts;
+ //PTCacheID *pid;
+ //ListBase pidlist;
+
+ for (ob = main->object.first; ob; ob = ob->id.next) {
+ //BKE_ptcache_ids_from_object(&pidlist, ob);
+
+ //for (pid=pidlist.first; pid; pid=pid->next) {
+ // if (pid->ptcaches->first == NULL)
+ // pid->ptcaches->first = pid->ptcaches->last = pid->cache;
+ //}
+
+ //BLI_freelistN(&pidlist);
+
+ if (ob->type == OB_MESH) {
+ Mesh *me = newlibadr(fd, lib, ob->data);
+ void *olddata = ob->data;
+ ob->data = me;
+
+ /* XXX - library meshes crash on loading most yoFrankie levels,
+ * the multires pointer gets invalid - Campbell */
+ if (me && me->id.lib==NULL && me->mr && me->mr->level_count > 1) {
+ multires_load_old(ob, me);
+ }
+
+ ob->data = olddata;
+ }
+
+ if (ob->totcol && ob->matbits == NULL) {
+ int a;
+
+ ob->matbits= MEM_callocN(sizeof(char)*ob->totcol, "ob->matbits");
+ for (a=0; a<ob->totcol; a++)
+ ob->matbits[a]= ob->colbits & (1<<a);
+ }
+ }
+
+ /* texture filter */
+ for (tex = main->tex.first; tex; tex = tex->id.next) {
+ if (tex->afmax == 0)
+ tex->afmax= 8;
+ }
+
+ for (ma = main->mat.first; ma; ma = ma->id.next) {
+ int a;
+ if (ma->mode & MA_WIRE) {
+ ma->material_type= MA_TYPE_WIRE;
+ ma->mode &= ~MA_WIRE;
+ }
+ if (ma->mode & MA_HALO) {
+ ma->material_type= MA_TYPE_HALO;
+ ma->mode &= ~MA_HALO;
+ }
+
+ if (ma->mode & (MA_ZTRANSP|MA_RAYTRANSP)) {
+ ma->mode |= MA_TRANSP;
+ }
+ else {
+ /* ma->mode |= MA_ZTRANSP; */ /* leave ztransp as is even if its not used [#28113] */
+ ma->mode &= ~MA_TRANSP;
+ }
+
+ /* set new bump for unused slots */
+ for (a=0; a<MAX_MTEX; a++) {
+ if (ma->mtex[a]) {
+ tex= ma->mtex[a]->tex;
+ if (!tex) {
+ ma->mtex[a]->texflag |= MTEX_3TAP_BUMP;
+ ma->mtex[a]->texflag |= MTEX_BUMP_OBJECTSPACE;
+ }
+ else {
+ tex= (Tex*)newlibadr(fd, ma->id.lib, tex);
+ if (tex && tex->type == 0) { /* invalid type */
+ ma->mtex[a]->texflag |= MTEX_3TAP_BUMP;
+ ma->mtex[a]->texflag |= MTEX_BUMP_OBJECTSPACE;
+ }
+ }
+ }
+ }
+
+ /* volume rendering settings */
+ if (ma->vol.stepsize < 0.0001f) {
+ ma->vol.density = 1.0f;
+ ma->vol.emission = 0.0f;
+ ma->vol.scattering = 1.0f;
+ ma->vol.emission_col[0] = ma->vol.emission_col[1] = ma->vol.emission_col[2] = 1.0f;
+ ma->vol.density_scale = 1.0f;
+ ma->vol.depth_cutoff = 0.01f;
+ ma->vol.stepsize_type = MA_VOL_STEP_RANDOMIZED;
+ ma->vol.stepsize = 0.2f;
+ ma->vol.shade_type = MA_VOL_SHADE_SHADED;
+ ma->vol.shadeflag |= MA_VOL_PRECACHESHADING;
+ ma->vol.precache_resolution = 50;
+ }
+ }
+
+ for (sce = main->scene.first; sce; sce = sce->id.next) {
+ ts= sce->toolsettings;
+ if (ts->normalsize == 0.0f || !ts->uv_selectmode || ts->vgroup_weight == 0.0f) {
+ ts->normalsize= 0.1f;
+ ts->selectmode= SCE_SELECT_VERTEX;
+
+ /* autokeying - setting should be taken from the user-prefs
+ * but the userprefs version may not have correct flags set
+ * (i.e. will result in blank box when enabled)
+ */
+ ts->autokey_mode= U.autokey_mode;
+ if (ts->autokey_mode == 0)
+ ts->autokey_mode= 2; /* 'add/replace' but not on */
+ ts->uv_selectmode= UV_SELECT_VERTEX;
+ ts->vgroup_weight= 1.0f;
+ }
+
+ /* Game Settings */
+ //Dome
+ sce->gm.dome.angle = sce->r.domeangle;
+ sce->gm.dome.mode = sce->r.domemode;
+ sce->gm.dome.res = sce->r.domeres;
+ sce->gm.dome.resbuf = sce->r.domeresbuf;
+ sce->gm.dome.tilt = sce->r.dometilt;
+ sce->gm.dome.warptext = sce->r.dometext;
+
+ //Stand Alone
+ sce->gm.playerflag |= (sce->r.fullscreen?GAME_PLAYER_FULLSCREEN:0);
+ sce->gm.xplay = sce->r.xplay;
+ sce->gm.yplay = sce->r.yplay;
+ sce->gm.freqplay = sce->r.freqplay;
+ sce->gm.depth = sce->r.depth;
+ sce->gm.attrib = sce->r.attrib;
+
+ //Stereo
+ sce->gm.stereomode = sce->r.stereomode;
+ /* reassigning stereomode NO_STEREO and DOME to a separeted flag*/
+ if (sce->gm.stereomode == 1) { //1 = STEREO_NOSTEREO
+ sce->gm.stereoflag = STEREO_NOSTEREO;
+ sce->gm.stereomode = STEREO_ANAGLYPH;
+ }
+ else if (sce->gm.stereomode == 8) { //8 = STEREO_DOME
+ sce->gm.stereoflag = STEREO_DOME;
+ sce->gm.stereomode = STEREO_ANAGLYPH;
+ }
+ else
+ sce->gm.stereoflag = STEREO_ENABLED;
+
+ //Framing
+ sce->gm.framing = sce->framing;
+ sce->gm.xplay = sce->r.xplay;
+ sce->gm.yplay = sce->r.yplay;
+ sce->gm.freqplay= sce->r.freqplay;
+ sce->gm.depth= sce->r.depth;
+
+ //Physic (previously stored in world)
+ sce->gm.gravity =9.8f;
+ sce->gm.physicsEngine= WOPHY_BULLET;// Bullet by default
+ sce->gm.mode = WO_DBVT_CULLING; // DBVT culling by default
+ sce->gm.occlusionRes = 128;
+ sce->gm.ticrate = 60;
+ sce->gm.maxlogicstep = 5;
+ sce->gm.physubstep = 1;
+ sce->gm.maxphystep = 5;
+ }
+ }
+
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 2)) {
+ Scene *sce;
+ Object *ob;
+
+ for (sce = main->scene.first; sce; sce = sce->id.next) {
+ if (fd->fileflags & G_FILE_ENABLE_ALL_FRAMES)
+ sce->gm.flag |= GAME_ENABLE_ALL_FRAMES;
+ if (fd->fileflags & G_FILE_SHOW_DEBUG_PROPS)
+ sce->gm.flag |= GAME_SHOW_DEBUG_PROPS;
+ if (fd->fileflags & G_FILE_SHOW_FRAMERATE)
+ sce->gm.flag |= GAME_SHOW_FRAMERATE;
+ if (fd->fileflags & G_FILE_SHOW_PHYSICS)
+ sce->gm.flag |= GAME_SHOW_PHYSICS;
+ if (fd->fileflags & G_FILE_GLSL_NO_SHADOWS)
+ sce->gm.flag |= GAME_GLSL_NO_SHADOWS;
+ if (fd->fileflags & G_FILE_GLSL_NO_SHADERS)
+ sce->gm.flag |= GAME_GLSL_NO_SHADERS;
+ if (fd->fileflags & G_FILE_GLSL_NO_RAMPS)
+ sce->gm.flag |= GAME_GLSL_NO_RAMPS;
+ if (fd->fileflags & G_FILE_GLSL_NO_NODES)
+ sce->gm.flag |= GAME_GLSL_NO_NODES;
+ if (fd->fileflags & G_FILE_GLSL_NO_EXTRA_TEX)
+ sce->gm.flag |= GAME_GLSL_NO_EXTRA_TEX;
+ if (fd->fileflags & G_FILE_IGNORE_DEPRECATION_WARNINGS)
+ sce->gm.flag |= GAME_IGNORE_DEPRECATION_WARNINGS;
+
+ if (fd->fileflags & G_FILE_GAME_MAT_GLSL)
+ sce->gm.matmode= GAME_MAT_GLSL;
+ else if (fd->fileflags & G_FILE_GAME_MAT)
+ sce->gm.matmode= GAME_MAT_MULTITEX;
+ else
+ sce->gm.matmode= GAME_MAT_TEXFACE;
+
+ sce->gm.flag |= GAME_DISPLAY_LISTS;
+ }
+
+ for (ob = main->object.first; ob; ob = ob->id.next) {
+ if (ob->flag & 8192) // OB_POSEMODE = 8192
+ ob->mode |= OB_MODE_POSE;
+ }
+ }
+
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 4)) {
+ Scene *sce;
+ Object *ob;
+ Material *ma;
+ Lamp *la;
+ World *wo;
+ Tex *tex;
+ ParticleSettings *part;
+ int do_gravity = 0;
+
+ for (sce = main->scene.first; sce; sce = sce->id.next)
+ if (sce->unit.scale_length == 0.0f)
+ sce->unit.scale_length= 1.0f;
+
+ for (ob = main->object.first; ob; ob = ob->id.next) {
+ /* fluid-sim stuff */
+ FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
+ if (fluidmd) fluidmd->fss->fmd = fluidmd;
+
+ /* rotation modes were added, but old objects would now default to being 'quaternion based' */
+ ob->rotmode= ROT_MODE_EUL;
+ }
+
+ for (ma = main->mat.first; ma; ma=ma->id.next) {
+ if (ma->vol.reflection == 0.f) {
+ ma->vol.reflection = 1.f;
+ ma->vol.transmission_col[0] = ma->vol.transmission_col[1] = ma->vol.transmission_col[2] = 1.0f;
+ ma->vol.reflection_col[0] = ma->vol.reflection_col[1] = ma->vol.reflection_col[2] = 1.0f;
+ }
+
+ do_version_mtex_factor_2_50(ma->mtex, ID_MA);
+ }
+
+ for (la = main->lamp.first; la; la=la->id.next)
+ do_version_mtex_factor_2_50(la->mtex, ID_LA);
+
+ for (wo = main->world.first; wo; wo=wo->id.next)
+ do_version_mtex_factor_2_50(wo->mtex, ID_WO);
+
+ for (tex = main->tex.first; tex; tex=tex->id.next)
+ if (tex->vd)
+ if (tex->vd->extend == 0)
+ tex->vd->extend = TEX_CLIP;
+
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ if (sce->audio.main == 0.0f)
+ sce->audio.main = 1.0f;
+
+ sce->r.ffcodecdata.audio_mixrate = sce->audio.mixrate;
+ sce->r.ffcodecdata.audio_volume = sce->audio.main;
+ sce->audio.distance_model = 2;
+ sce->audio.doppler_factor = 1.0f;
+ sce->audio.speed_of_sound = 343.3f;
+ }
+
+ /* Add default gravity to scenes */
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ if ((sce->physics_settings.flag & PHYS_GLOBAL_GRAVITY) == 0 &&
+ len_v3(sce->physics_settings.gravity) == 0.0f)
+ {
+ sce->physics_settings.gravity[0] = sce->physics_settings.gravity[1] = 0.0f;
+ sce->physics_settings.gravity[2] = -9.81f;
+ sce->physics_settings.flag = PHYS_GLOBAL_GRAVITY;
+ do_gravity = 1;
+ }
+ }
+
+ /* Assign proper global gravity weights for dynamics (only z-coordinate is taken into account) */
+ if (do_gravity) for (part= main->particle.first; part; part= part->id.next)
+ part->effector_weights->global_gravity = part->acc[2]/-9.81f;
+
+ for (ob = main->object.first; ob; ob = ob->id.next) {
+ ModifierData *md;
+
+ if (do_gravity) {
+ for (md= ob->modifiers.first; md; md= md->next) {
+ ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
+ if (clmd)
+ clmd->sim_parms->effector_weights->global_gravity = clmd->sim_parms->gravity[2]/-9.81f;
+ }
+
+ if (ob->soft)
+ ob->soft->effector_weights->global_gravity = ob->soft->grav/9.81f;
+ }
+
+ /* Normal wind shape is plane */
+ if (ob->pd) {
+ if (ob->pd->forcefield == PFIELD_WIND)
+ ob->pd->shape = PFIELD_SHAPE_PLANE;
+
+ if (ob->pd->flag & PFIELD_PLANAR)
+ ob->pd->shape = PFIELD_SHAPE_PLANE;
+ else if (ob->pd->flag & PFIELD_SURFACE)
+ ob->pd->shape = PFIELD_SHAPE_SURFACE;
+
+ ob->pd->flag |= PFIELD_DO_LOCATION;
+ }
+ }
+ }
+
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 6)) {
+ Object *ob;
+ Lamp *la;
+
+ /* New variables for axis-angle rotations and/or quaternion rotations were added, and need proper initialization */
+ for (ob= main->object.first; ob; ob= ob->id.next) {
+ /* new variables for all objects */
+ ob->quat[0]= 1.0f;
+ ob->rotAxis[1]= 1.0f;
+
+ /* bones */
+ if (ob->pose) {
+ bPoseChannel *pchan;
+
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ /* just need to initalise rotation axis properly... */
+ pchan->rotAxis[1]= 1.0f;
+ }
+ }
+ }
+
+ for (la = main->lamp.first; la; la=la->id.next)
+ la->compressthresh= 0.05f;
+ }
+
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 7)) {
+ Mesh *me;
+ Nurb *nu;
+ Lattice *lt;
+ Curve *cu;
+ Key *key;
+ float *data;
+ int a, tot;
+
+ /* shape keys are no longer applied to the mesh itself, but rather
+ * to the derivedmesh/displist, so here we ensure that the basis
+ * shape key is always set in the mesh coordinates. */
+
+ for (me= main->mesh.first; me; me= me->id.next) {
+ if ((key = newlibadr(fd, lib, me->key)) && key->refkey) {
+ data= key->refkey->data;
+ tot= MIN2(me->totvert, key->refkey->totelem);
+
+ for (a=0; a<tot; a++, data+=3)
+ copy_v3_v3(me->mvert[a].co, data);
+ }
+ }
+
+ for (lt= main->latt.first; lt; lt= lt->id.next) {
+ if ((key = newlibadr(fd, lib, lt->key)) && key->refkey) {
+ data= key->refkey->data;
+ tot= MIN2(lt->pntsu*lt->pntsv*lt->pntsw, key->refkey->totelem);
+
+ for (a=0; a<tot; a++, data+=3)
+ copy_v3_v3(lt->def[a].vec, data);
+ }
+ }
+
+ for (cu= main->curve.first; cu; cu= cu->id.next) {
+ if ((key = newlibadr(fd, lib, cu->key)) && key->refkey) {
+ data= key->refkey->data;
+
+ for (nu=cu->nurb.first; nu; nu=nu->next) {
+ if (nu->bezt) {
+ BezTriple *bezt = nu->bezt;
+
+ for (a=0; a<nu->pntsu; a++, bezt++) {
+ copy_v3_v3(bezt->vec[0], data); data+=3;
+ copy_v3_v3(bezt->vec[1], data); data+=3;
+ copy_v3_v3(bezt->vec[2], data); data+=3;
+ bezt->alfa= *data; data++;
+ }
+ }
+ else if (nu->bp) {
+ BPoint *bp = nu->bp;
+
+ for (a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
+ copy_v3_v3(bp->vec, data); data+=3;
+ bp->alfa= *data; data++;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 8)) {
+ {
+ Scene *sce= main->scene.first;
+ while (sce) {
+ if (sce->r.frame_step==0)
+ sce->r.frame_step= 1;
+ if (sce->r.mblur_samples==0)
+ sce->r.mblur_samples = sce->r.osa;
+
+ if (sce->ed && sce->ed->seqbase.first) {
+ do_versions_seq_unique_name_all_strips(
+ sce, &sce->ed->seqbase);
+ }
+
+ sce= sce->id.next;
+ }
+ }
+ {
+ /* ensure all nodes have unique names */
+ bNodeTree *ntree= main->nodetree.first;
+ while (ntree) {
+ bNode *node=ntree->nodes.first;
+
+ while (node) {
+ nodeUniqueName(ntree, node);
+ node= node->next;
+ }
+
+ ntree= ntree->id.next;
+ }
+ }
+ {
+ Object *ob=main->object.first;
+ while (ob) {
+ /* shaded mode disabled for now */
+ if (ob->dt == OB_MATERIAL) ob->dt = OB_TEXTURE;
+ ob=ob->id.next;
+ }
+ }
+
+ {
+ bScreen *screen;
+ ScrArea *sa;
+ SpaceLink *sl;
+
+ for (screen= main->screen.first; screen; screen= screen->id.next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
+ if (v3d->drawtype == OB_MATERIAL) v3d->drawtype = OB_SOLID;
+ }
+ }
+ }
+ }
+ }
+
+ /* only convert old 2.50 files with color management */
+ if (main->versionfile == 250) {
+ Scene *sce=main->scene.first;
+ Material *ma=main->mat.first;
+ World *wo=main->world.first;
+ Tex *tex=main->tex.first;
+ int i, convert=0;
+
+ /* convert to new color management system:
+ * while previously colors were stored as srgb,
+ * now they are stored as linear internally,
+ * with screen gamma correction in certain places in the UI. */
+
+ /* don't know what scene is active, so we'll convert if any scene has it enabled... */
+ while (sce) {
+ if (sce->r.color_mgt_flag & R_COLOR_MANAGEMENT)
+ convert=1;
+ sce=sce->id.next;
+ }
+
+ if (convert) {
+ while (ma) {
+ if (ma->ramp_col) {
+ ColorBand *band = (ColorBand *)ma->ramp_col;
+ for (i=0; i<band->tot; i++) {
+ CBData *data = band->data + i;
+ srgb_to_linearrgb_v3_v3(&data->r, &data->r);
+ }
+ }
+ if (ma->ramp_spec) {
+ ColorBand *band = (ColorBand *)ma->ramp_spec;
+ for (i=0; i<band->tot; i++) {
+ CBData *data = band->data + i;
+ srgb_to_linearrgb_v3_v3(&data->r, &data->r);
+ }
+ }
+
+ srgb_to_linearrgb_v3_v3(&ma->r, &ma->r);
+ srgb_to_linearrgb_v3_v3(&ma->specr, &ma->specr);
+ srgb_to_linearrgb_v3_v3(&ma->mirr, &ma->mirr);
+ srgb_to_linearrgb_v3_v3(ma->sss_col, ma->sss_col);
+ ma=ma->id.next;
+ }
+
+ while (tex) {
+ if (tex->coba) {
+ ColorBand *band = (ColorBand *)tex->coba;
+ for (i=0; i<band->tot; i++) {
+ CBData *data = band->data + i;
+ srgb_to_linearrgb_v3_v3(&data->r, &data->r);
+ }
+ }
+ tex=tex->id.next;
+ }
+
+ while (wo) {
+ srgb_to_linearrgb_v3_v3(&wo->ambr, &wo->ambr);
+ srgb_to_linearrgb_v3_v3(&wo->horr, &wo->horr);
+ srgb_to_linearrgb_v3_v3(&wo->zenr, &wo->zenr);
+ wo=wo->id.next;
+ }
+ }
+ }
+ }
+
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 9)) {
+ Scene *sce;
+ Mesh *me;
+ Object *ob;
+
+ for (sce=main->scene.first; sce; sce=sce->id.next)
+ if (!sce->toolsettings->particle.selectmode)
+ sce->toolsettings->particle.selectmode= SCE_SELECT_PATH;
+
+ if (main->versionfile == 250 && main->subversionfile > 1) {
+ for (me=main->mesh.first; me; me=me->id.next)
+ multires_load_old_250(me);
+
+ for (ob=main->object.first; ob; ob=ob->id.next) {
+ MultiresModifierData *mmd = (MultiresModifierData *)modifiers_findByType(ob, eModifierType_Multires);
+
+ if (mmd) {
+ mmd->totlvl--;
+ mmd->lvl--;
+ mmd->sculptlvl= mmd->lvl;
+ mmd->renderlvl= mmd->lvl;
+ }
+ }
+ }
+ }
+
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 10)) {
+ Object *ob;
+
+ /* properly initialize hair clothsim data on old files */
+ for (ob = main->object.first; ob; ob = ob->id.next) {
+ ModifierData *md;
+ for (md= ob->modifiers.first; md; md= md->next) {
+ if (md->type == eModifierType_Cloth) {
+ ClothModifierData *clmd = (ClothModifierData *)md;
+ if (clmd->sim_parms->velocity_smooth < 0.01f)
+ clmd->sim_parms->velocity_smooth = 0.f;
+ }
+ }
+ }
+ }
+
+ /* fix bad area setup in subversion 10 */
+ if (main->versionfile == 250 && main->subversionfile == 10) {
+ /* fix for new view type in sequencer */
+ bScreen *screen;
+ ScrArea *sa;
+ SpaceLink *sl;
+
+
+ /* remove all preview window in wrong spaces */
+ for (screen= main->screen.first; screen; screen= screen->id.next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype!=SPACE_SEQ) {
+ ARegion *ar;
+ ListBase *regionbase;
+
+ if (sl == sa->spacedata.first) {
+ regionbase = &sa->regionbase;
+ }
+ else {
+ regionbase = &sl->regionbase;
+ }
+
+
+ for ( ar = regionbase->first; ar; ar = ar->next) {
+ if (ar->regiontype == RGN_TYPE_PREVIEW)
+ break;
+ }
+
+ if (ar && (ar->regiontype == RGN_TYPE_PREVIEW)) {
+ SpaceType *st= BKE_spacetype_from_id(SPACE_SEQ);
+ BKE_area_region_free(st, ar);
+ BLI_freelinkN(regionbase, ar);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 11)) {
+ {
+ /* fix for new view type in sequencer */
+ bScreen *screen;
+ ScrArea *sa;
+ SpaceLink *sl;
+
+
+ for (screen= main->screen.first; screen; screen= screen->id.next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_SEQ) {
+ ARegion *ar;
+ ARegion *ar_main;
+ ListBase *regionbase;
+ SpaceSeq *sseq = (SpaceSeq *)sl;
+
+ if (sl == sa->spacedata.first) {
+ regionbase = &sa->regionbase;
+ }
+ else {
+ regionbase = &sl->regionbase;
+ }
+
+ if (sseq->view == 0) sseq->view = SEQ_VIEW_SEQUENCE;
+ if (sseq->mainb == 0) sseq->mainb = SEQ_DRAW_IMG_IMBUF;
+
+ ar_main = (ARegion*)regionbase->first;
+ for (; ar_main; ar_main = ar_main->next) {
+ if (ar_main->regiontype == RGN_TYPE_WINDOW)
+ break;
+ }
+ ar= MEM_callocN(sizeof(ARegion), "preview area for sequencer");
+ BLI_insertlinkbefore(regionbase, ar_main, ar);
+ sequencer_init_preview_region(ar);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 12)) {
+ Scene *sce;
+ Object *ob;
+ Brush *brush;
+ Material *ma;
+
+ /* game engine changes */
+ for (sce = main->scene.first; sce; sce = sce->id.next) {
+ sce->gm.eyeseparation = 0.10f;
+ }
+
+ /* anim viz changes */
+ for (ob= main->object.first; ob; ob= ob->id.next) {
+ /* initialize object defaults */
+ animviz_settings_init(&ob->avs);
+
+ /* if armature, copy settings for pose from armature data
+ * performing initialization where appropriate
+ */
+ if (ob->pose && ob->data) {
+ bArmature *arm= newlibadr(fd, lib, ob->data);
+ if (arm) { /* XXX - why does this fail in some cases? */
+ bAnimVizSettings *avs= &ob->pose->avs;
+
+ /* ghosting settings ---------------- */
+ /* ranges */
+ avs->ghost_bc= avs->ghost_ac= arm->ghostep;
+
+ avs->ghost_sf= arm->ghostsf;
+ avs->ghost_ef= arm->ghostef;
+ if ((avs->ghost_sf == avs->ghost_ef) && (avs->ghost_sf == 0)) {
+ avs->ghost_sf= 1;
+ avs->ghost_ef= 100;
+ }
+
+ /* type */
+ if (arm->ghostep == 0)
+ avs->ghost_type= GHOST_TYPE_NONE;
+ else
+ avs->ghost_type= arm->ghosttype + 1;
+
+ /* stepsize */
+ avs->ghost_step= arm->ghostsize;
+ if (avs->ghost_step == 0)
+ avs->ghost_step= 1;
+
+ /* path settings --------------------- */
+ /* ranges */
+ avs->path_bc= arm->pathbc;
+ avs->path_ac= arm->pathac;
+ if ((avs->path_bc == avs->path_ac) && (avs->path_bc == 0))
+ avs->path_bc= avs->path_ac= 10;
+
+ avs->path_sf= arm->pathsf;
+ avs->path_ef= arm->pathef;
+ if ((avs->path_sf == avs->path_ef) && (avs->path_sf == 0)) {
+ avs->path_sf= 1;
+ avs->path_ef= 250;
+ }
+
+ /* flags */
+ if (arm->pathflag & ARM_PATH_FNUMS)
+ avs->path_viewflag |= MOTIONPATH_VIEW_FNUMS;
+ if (arm->pathflag & ARM_PATH_KFRAS)
+ avs->path_viewflag |= MOTIONPATH_VIEW_KFRAS;
+ if (arm->pathflag & ARM_PATH_KFNOS)
+ avs->path_viewflag |= MOTIONPATH_VIEW_KFNOS;
+
+ /* bake flags */
+ if (arm->pathflag & ARM_PATH_HEADS)
+ avs->path_bakeflag |= MOTIONPATH_BAKE_HEADS;
+
+ /* type */
+ if (arm->pathflag & ARM_PATH_ACFRA)
+ avs->path_type = MOTIONPATH_TYPE_ACFRA;
+
+ /* stepsize */
+ avs->path_step= arm->pathsize;
+ if (avs->path_step == 0)
+ avs->path_step= 1;
+ }
+ else
+ animviz_settings_init(&ob->pose->avs);
+ }
+ }
+
+ /* brush texture changes */
+ for (brush= main->brush.first; brush; brush= brush->id.next) {
+ default_mtex(&brush->mtex);
+ }
+
+ for (ma= main->mat.first; ma; ma= ma->id.next) {
+ if (ma->vol.ms_spread < 0.0001f) {
+ ma->vol.ms_spread = 0.2f;
+ ma->vol.ms_diff = 1.f;
+ ma->vol.ms_intensity = 1.f;
+ }
+ }
+ }
+
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 13)) {
+ /* NOTE: if you do more conversion, be sure to do it outside of this and
+ * increase subversion again, otherwise it will not be correct */
+ Object *ob;
+
+ /* convert degrees to radians for internal use */
+ for (ob=main->object.first; ob; ob=ob->id.next) {
+ bPoseChannel *pchan;
+
+ do_version_constraints_radians_degrees_250(&ob->constraints);
+
+ if (ob->pose) {
+ for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
+ pchan->limitmin[0] *= (float)(M_PI/180.0);
+ pchan->limitmin[1] *= (float)(M_PI/180.0);
+ pchan->limitmin[2] *= (float)(M_PI/180.0);
+ pchan->limitmax[0] *= (float)(M_PI/180.0);
+ pchan->limitmax[1] *= (float)(M_PI/180.0);
+ pchan->limitmax[2] *= (float)(M_PI/180.0);
+
+ do_version_constraints_radians_degrees_250(&pchan->constraints);
+ }
+ }
+ }
+ }
+
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 14)) {
+ /* fix for bad View2D extents for Animation Editors */
+ bScreen *screen;
+ ScrArea *sa;
+ SpaceLink *sl;
+
+ for (screen= main->screen.first; screen; screen= screen->id.next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ ListBase *regionbase;
+ ARegion *ar;
+
+ if (sl == sa->spacedata.first)
+ regionbase = &sa->regionbase;
+ else
+ regionbase = &sl->regionbase;
+
+ if (ELEM(sl->spacetype, SPACE_ACTION, SPACE_NLA)) {
+ for (ar = (ARegion*)regionbase->first; ar; ar = ar->next) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
+ ar->v2d.cur.ymax = ar->v2d.tot.ymax = 0.0f;
+ ar->v2d.cur.ymin = ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 15)) {
+ World *wo;
+ Material *ma;
+
+ /* ambient default from 0.5f to 1.0f */
+ for (ma= main->mat.first; ma; ma=ma->id.next)
+ ma->amb *= 2.0f;
+
+ for (wo= main->world.first; wo; wo=wo->id.next) {
+ /* ao splitting into ao/env/indirect */
+ wo->ao_env_energy= wo->aoenergy;
+ wo->aoenergy= 1.0f;
+
+ if (wo->ao_indirect_bounces == 0)
+ wo->ao_indirect_bounces= 1;
+ else
+ wo->mode |= WO_INDIRECT_LIGHT;
+
+ if (wo->aomix == WO_AOSUB)
+ wo->ao_env_energy= -wo->ao_env_energy;
+ else if (wo->aomix == WO_AOADDSUB)
+ wo->mode |= WO_AMB_OCC;
+
+ wo->aomix= WO_AOMUL;
+
+ /* ambient default from 0.5f to 1.0f */
+ mul_v3_fl(&wo->ambr, 0.5f);
+ wo->ao_env_energy *= 0.5f;
+ }
+ }
+
+ if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 17)) {
+ Scene *sce;
+ Sequence *seq;
+ Material *ma;
+
+ /* initialize to sane default so toggling on border shows something */
+ for (sce = main->scene.first; sce; sce = sce->id.next) {
+ if (sce->r.border.xmin == 0.0f && sce->r.border.ymin == 0.0f &&
+ sce->r.border.xmax == 0.0f && sce->r.border.ymax == 0.0f) {
+ sce->r.border.xmin = 0.0f;
+ sce->r.border.ymin = 0.0f;
+ sce->r.border.xmax = 1.0f;
+ sce->r.border.ymax = 1.0f;
+ }
+
+ if ((sce->r.ffcodecdata.flags & FFMPEG_MULTIPLEX_AUDIO) == 0)
+ sce->r.ffcodecdata.audio_codec = 0x0; // CODEC_ID_NONE
+
+ SEQ_BEGIN (sce->ed, seq)
+ {
+ seq->volume = 1.0f;
+ }
+ SEQ_END
+ }
+
+ /* particle brush strength factor was changed from int to float */
+ for (sce= main->scene.first; sce; sce=sce->id.next) {
+ ParticleEditSettings *pset= &sce->toolsettings->particle;
+ int a;
+
+ for (a=0; a<PE_TOT_BRUSH; a++)
+ pset->brush[a].strength /= 100.0f;
+ }
+
+ for (ma = main->mat.first; ma; ma=ma->id.next)
+ if (ma->mode & MA_TRACEBLE)
+ ma->shade_flag |= MA_APPROX_OCCLUSION;
+
+ /* sequencer changes */
+ {
+ bScreen *screen;
+ ScrArea *sa;
+ SpaceLink *sl;
+
+ for (screen= main->screen.first; screen; screen= screen->id.next) {
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_SEQ) {
+ ARegion *ar_preview;
+ ListBase *regionbase;
+
+ if (sl == sa->spacedata.first) {
+ regionbase = &sa->regionbase;
+ }
+ else {
+ regionbase = &sl->regionbase;
+ }
+
+ ar_preview = (ARegion*)regionbase->first;
+ for (; ar_preview; ar_preview = ar_preview->next) {
+ if (ar_preview->regiontype == RGN_TYPE_PREVIEW)
+ break;
+ }
+ if (ar_preview && (ar_preview->regiontype == RGN_TYPE_PREVIEW)) {
+ sequencer_init_preview_region(ar_preview);
+ }
+ }
+ }
+ }
+ }
+ } /* sequencer changes */
+ }
+
+ if (main->versionfile <= 251) { /* 2.5.1 had no subversions */
+ bScreen *sc;
+
+ /* Blender 2.5.2 - subversion 0 introduced a new setting: V3D_RENDER_OVERRIDE.
+ * This bit was used in the past for V3D_TRANSFORM_SNAP, which is now deprecated.
+ * Here we clear it for old files so they don't come in with V3D_RENDER_OVERRIDE set,
+ * which would cause cameras, lamps, etc to become invisible */
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ ScrArea *sa;
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ SpaceLink *sl;
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_VIEW3D) {
+ View3D* v3d = (View3D *)sl;
+ v3d->flag2 &= ~V3D_RENDER_OVERRIDE;
+ }
+ }
+ }
+ }
+ }
+
+ if (main->versionfile < 252 || (main->versionfile == 252 && main->subversionfile < 1)) {
+ Brush *brush;
+ Object *ob;
+ Scene *scene;
+ bNodeTree *ntree;
+
+ for (brush= main->brush.first; brush; brush= brush->id.next) {
+ if (brush->curve) brush->curve->preset = CURVE_PRESET_SMOOTH;
+ }
+
+ /* properly initialize active flag for fluidsim modifiers */
+ for (ob = main->object.first; ob; ob = ob->id.next) {
+ ModifierData *md;
+ for (md= ob->modifiers.first; md; md= md->next) {
+ if (md->type == eModifierType_Fluidsim) {
+ FluidsimModifierData *fmd = (FluidsimModifierData *)md;
+ fmd->fss->flag |= OB_FLUIDSIM_ACTIVE;
+ fmd->fss->flag |= OB_FLUIDSIM_OVERRIDE_TIME;
+ }
+ }
+ }
+
+ /* adjustment to color balance node values */
+ for (scene= main->scene.first; scene; scene= scene->id.next) {
+ if (scene->nodetree) {
+ bNode *node=scene->nodetree->nodes.first;
+
+ while (node) {
+ if (node->type == CMP_NODE_COLORBALANCE) {
+ NodeColorBalance *n= (NodeColorBalance *)node->storage;
+ n->lift[0] += 1.f;
+ n->lift[1] += 1.f;
+ n->lift[2] += 1.f;
+ }
+ node= node->next;
+ }
+ }
+ }
+ /* check inside node groups too */
+ for (ntree= main->nodetree.first; ntree; ntree=ntree->id.next) {
+ bNode *node=ntree->nodes.first;
+
+ while (node) {
+ if (node->type == CMP_NODE_COLORBALANCE) {
+ NodeColorBalance *n= (NodeColorBalance *)node->storage;
+ n->lift[0] += 1.f;
+ n->lift[1] += 1.f;
+ n->lift[2] += 1.f;
+ }
+ node= node->next;
+ }
+ }
+ }
+
+ /* old-track -> constraints (this time we're really doing it!) */
+ if (main->versionfile < 252 || (main->versionfile == 252 && main->subversionfile < 2)) {
+ Object *ob;
+
+ for (ob = main->object.first; ob; ob = ob->id.next)
+ do_version_old_trackto_to_constraints(ob);
+ }
+
+ if (main->versionfile < 252 || (main->versionfile == 252 && main->subversionfile < 5)) {
+ bScreen *sc;
+
+ /* Image editor scopes */
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ ScrArea *sa;
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ SpaceLink *sl;
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_IMAGE) {
+ SpaceImage *sima = (SpaceImage *)sl;
+ scopes_new(&sima->scopes);
+ }
+ }
+ }
+ }
+ }
+
+
+ if (main->versionfile < 253) {
+ Object *ob;
+ Scene *scene;
+ bScreen *sc;
+ Tex *tex;
+ Brush *brush;
+
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ ScrArea *sa;
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ SpaceLink *sl;
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype == SPACE_NODE) {
+ SpaceNode *snode= (SpaceNode *)sl;
+ ListBase *regionbase;
+ ARegion *ar;
+
+ if (sl == sa->spacedata.first)
+ regionbase = &sa->regionbase;
+ else
+ regionbase = &sl->regionbase;
+
+ if (snode->v2d.minzoom > 0.09f)
+ snode->v2d.minzoom= 0.09f;
+ if (snode->v2d.maxzoom < 2.31f)
+ snode->v2d.maxzoom= 2.31f;
+
+ for (ar= regionbase->first; ar; ar= ar->next) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
+ if (ar->v2d.minzoom > 0.09f)
+ ar->v2d.minzoom= 0.09f;
+ if (ar->v2d.maxzoom < 2.31f)
+ ar->v2d.maxzoom= 2.31f;
+ }
+ }
+ }
+ else if (sl->spacetype == SPACE_TIME) {
+ SpaceTime *stime= (SpaceTime *)sl;
+
+ /* enable all cache display */
+ stime->cache_display |= TIME_CACHE_DISPLAY;
+ stime->cache_display |= (TIME_CACHE_SOFTBODY|TIME_CACHE_PARTICLES);
+ stime->cache_display |= (TIME_CACHE_CLOTH|TIME_CACHE_SMOKE|TIME_CACHE_DYNAMICPAINT);
+ }
+ }
+ }
+ }
+
+ do_version_mdef_250(main);
+
+ /* parent type to modifier */
+ for (ob = main->object.first; ob; ob = ob->id.next) {
+ if (ob->parent) {
+ Object *parent= (Object *)newlibadr(fd, lib, ob->parent);
+ if (parent) { /* parent may not be in group */
+ if (parent->type==OB_ARMATURE && ob->partype==PARSKEL) {
+ ArmatureModifierData *amd;
+ bArmature *arm= (bArmature *)newlibadr(fd, lib, parent->data);
+
+ amd = (ArmatureModifierData*) modifier_new(eModifierType_Armature);
+ amd->object = ob->parent;
+ BLI_addtail((ListBase*)&ob->modifiers, amd);
+ amd->deformflag= arm->deformflag;
+ ob->partype = PAROBJECT;
+ }
+ else if (parent->type==OB_LATTICE && ob->partype==PARSKEL) {
+ LatticeModifierData *lmd;
+
+ lmd = (LatticeModifierData*) modifier_new(eModifierType_Lattice);
+ lmd->object = ob->parent;
+ BLI_addtail((ListBase*)&ob->modifiers, lmd);
+ ob->partype = PAROBJECT;
+ }
+ else if (parent->type==OB_CURVE && ob->partype==PARCURVE) {
+ CurveModifierData *cmd;
+
+ cmd = (CurveModifierData*) modifier_new(eModifierType_Curve);
+ cmd->object = ob->parent;
+ BLI_addtail((ListBase*)&ob->modifiers, cmd);
+ ob->partype = PAROBJECT;
+ }
+ }
+ }
+ }
+
+ /* initialize scene active layer */
+ for (scene= main->scene.first; scene; scene=scene->id.next) {
+ int i;
+ for (i=0; i<20; i++) {
+ if (scene->lay & (1<<i)) {
+ scene->layact= 1<<i;
+ break;
+ }
+ }
+ }
+
+ for (tex= main->tex.first; tex; tex= tex->id.next) {
+ /* if youre picky, this isn't correct until we do a version bump
+ * since you could set saturation to be 0.0*/
+ if (tex->saturation==0.0f)
+ tex->saturation= 1.0f;
+ }
+
+ {
+ Curve *cu;
+ for (cu= main->curve.first; cu; cu= cu->id.next) {
+ cu->smallcaps_scale= 0.75f;
+ }
+ }
+
+ for (scene= main->scene.first; scene; scene=scene->id.next) {
+ if (scene) {
+ Sequence *seq;
+ SEQ_BEGIN (scene->ed, seq)
+ {
+ if (seq->sat==0.0f) {
+ seq->sat= 1.0f;
+ }
+ }
+ SEQ_END
+ }
+ }
+
+ /* GSOC 2010 Sculpt - New settings for Brush */
+
+ for (brush= main->brush.first; brush; brush= brush->id.next) {
+ /* Sanity Check */
+
+ // infinite number of dabs
+ if (brush->spacing == 0)
+ brush->spacing = 10;
+
+ // will have no effect
+ if (brush->alpha == 0)
+ brush->alpha = 0.5f;
+
+ // bad radius
+ if (brush->unprojected_radius == 0)
+ brush->unprojected_radius = 0.125f;
+
+ // unusable size
+ if (brush->size == 0)
+ brush->size = 35;
+
+ // can't see overlay
+ if (brush->texture_overlay_alpha == 0)
+ brush->texture_overlay_alpha = 33;
+
+ // same as draw brush
+ if (brush->crease_pinch_factor == 0)
+ brush->crease_pinch_factor = 0.5f;
+
+ // will sculpt no vertexes
+ if (brush->plane_trim == 0)
+ brush->plane_trim = 0.5f;
+
+ // same as smooth stroke off
+ if (brush->smooth_stroke_radius == 0)
+ brush->smooth_stroke_radius= 75;
+
+ // will keep cursor in one spot
+ if (brush->smooth_stroke_radius == 1)
+ brush->smooth_stroke_factor= 0.9f;
+
+ // same as dots
+ if (brush->rate == 0)
+ brush->rate = 0.1f;
+
+ /* New Settings */
+ if (main->versionfile < 252 || (main->versionfile == 252 && main->subversionfile < 5)) {
+ brush->flag |= BRUSH_SPACE_ATTEN; // explicitly enable adaptive space
+
+ // spacing was originally in pixels, convert it to percentage for new version
+ // size should not be zero due to sanity check above
+ brush->spacing = (int)(100*((float)brush->spacing) / ((float)brush->size));
+
+ if (brush->add_col[0] == 0 &&
+ brush->add_col[1] == 0 &&
+ brush->add_col[2] == 0)
+ {
+ brush->add_col[0] = 1.00f;
+ brush->add_col[1] = 0.39f;
+ brush->add_col[2] = 0.39f;
+ }
+
+ if (brush->sub_col[0] == 0 &&
+ brush->sub_col[1] == 0 &&
+ brush->sub_col[2] == 0)
+ {
+ brush->sub_col[0] = 0.39f;
+ brush->sub_col[1] = 0.39f;
+ brush->sub_col[2] = 1.00f;
+ }
+ }
+ }
+ }
+
+ /* GSOC Sculpt 2010 - Sanity check on Sculpt/Paint settings */
+ if (main->versionfile < 253) {
+ Scene *sce;
+ for (sce= main->scene.first; sce; sce= sce->id.next) {
+ if (sce->toolsettings->sculpt_paint_unified_alpha == 0)
+ sce->toolsettings->sculpt_paint_unified_alpha = 0.5f;
+
+ if (sce->toolsettings->sculpt_paint_unified_unprojected_radius == 0)
+ sce->toolsettings->sculpt_paint_unified_unprojected_radius = 0.125f;
+
+ if (sce->toolsettings->sculpt_paint_unified_size == 0)
+ sce->toolsettings->sculpt_paint_unified_size = 35;
+ }
+ }
+
+ if (main->versionfile < 253 || (main->versionfile == 253 && main->subversionfile < 1)) {
+ Object *ob;
+
+ for (ob = main->object.first; ob; ob = ob->id.next) {
+ ModifierData *md;
+ for (md= ob->modifiers.first; md; md= md->next) {
+ if (md->type == eModifierType_Smoke) {
+ SmokeModifierData *smd = (SmokeModifierData *)md;
+
+ if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) {
+ smd->domain->vorticity = 2.0f;
+ smd->domain->time_scale = 1.0f;
+
+ if (!(smd->domain->flags & (1<<4)))
+ continue;
+
+ /* delete old MOD_SMOKE_INITVELOCITY flag */
+ smd->domain->flags &= ~(1<<4);
+
+ /* for now just add it to all flow objects in the scene */
+ {
+ Object *ob2;
+ for (ob2 = main->object.first; ob2; ob2 = ob2->id.next) {
+ ModifierData *md2;
+ for (md2= ob2->modifiers.first; md2; md2= md2->next) {
+ if (md2->type == eModifierType_Smoke) {
+ SmokeModifierData *smd2 = (SmokeModifierData *)md2;
+
+ if ((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow) {
+ smd2->flow->flags |= MOD_SMOKE_FLOW_INITVELOCITY;
+ }
+ }
+ }
+ }
+ }
+
+ }
+ else if ((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow) {
+ smd->flow->vel_multi = 1.0f;
+ }
+
+ }
+ }
+ }
+ }
+
+ if (main->versionfile < 255 || (main->versionfile == 255 && main->subversionfile < 1)) {
+ Brush *br;
+ ParticleSettings *part;
+ bScreen *sc;
+ Object *ob;
+
+ for (br= main->brush.first; br; br= br->id.next) {
+ if (br->ob_mode==0)
+ br->ob_mode= OB_MODE_ALL_PAINT;
+ }
+
+ for (part = main->particle.first; part; part = part->id.next) {
+ if (part->boids)
+ part->boids->pitch = 1.0f;
+
+ part->flag &= ~PART_HAIR_REGROW; /* this was a deprecated flag before */
+ part->kink_amp_clump = 1.f; /* keep old files looking similar */
+ }
+
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ ScrArea *sa;
+ for (sa= sc->areabase.first; sa; sa= sa->next) {
+ SpaceLink *sl;
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype == SPACE_INFO) {
+ SpaceInfo *sinfo= (SpaceInfo *)sl;
+ ARegion *ar;
+
+ sinfo->rpt_mask= INFO_RPT_OP;
+
+ for (ar= sa->regionbase.first; ar; ar= ar->next) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
+ ar->v2d.scroll = (V2D_SCROLL_RIGHT);
+ ar->v2d.align = V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y; /* align bottom left */
+ ar->v2d.keepofs = V2D_LOCKOFS_X;
+ ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
+ ar->v2d.keeptot= V2D_KEEPTOT_BOUNDS;
+ ar->v2d.minzoom= ar->v2d.maxzoom= 1.0f;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* fix rotation actuators for objects so they use real angles (radians)
+ * since before blender went opensource this strange scalar was used: (1 / 0.02) * 2 * math.pi/360 */
+ for (ob= main->object.first; ob; ob= ob->id.next) {
+ bActuator *act= ob->actuators.first;
+ while (act) {
+ if (act->type==ACT_OBJECT) {
+ /* multiply velocity with 50 in old files */
+ bObjectActuator *oa= act->data;
+ mul_v3_fl(oa->drot, 0.8726646259971648f);
+ }
+ act= act->next;
+ }
+ }
+ }
+
+ // init facing axis property of steering actuators
+ {
+ Object *ob;
+ for (ob = main->object.first; ob; ob = ob->id.next) {
+ bActuator *act;
+ for (act= ob->actuators.first; act; act= act->next) {
+ if (act->type==ACT_STEERING) {
+ bSteeringActuator* stact = act->data;
+ if (stact->facingaxis==0) {
+ stact->facingaxis=1;
+ }
+ }
+ }
+ }
+ }
+
+ if (main->versionfile < 255 || (main->versionfile == 255 && main->subversionfile < 3)) {
+ Object *ob;
+
+ /* ocean res is now squared, reset old ones - will be massive */
+ for (ob = main->object.first; ob; ob = ob->id.next) {
+ ModifierData *md;
+ for (md= ob->modifiers.first; md; md= md->next) {
+ if (md->type == eModifierType_Ocean) {
+ OceanModifierData *omd = (OceanModifierData *)md;
+ omd->resolution = 7;
+ omd->oceancache = NULL;
+ }
+ }
+ }
+ }
+
+ if (main->versionfile < 256) {
+ bScreen *sc;
+ ScrArea *sa;
+ Key *key;
+
+ /* Fix for sample line scope initializing with no height */
+ for (sc= main->screen.first; sc; sc= sc->id.next) {
+ sa= sc->areabase.first;
+ while (sa) {
+ SpaceLink *sl;
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_IMAGE) {
+ SpaceImage *sima= (SpaceImage *)sl;
+ if (sima->sample_line_hist.height == 0 )
+ sima->sample_line_hist.height = 100;
+ }
+ }
+ sa= sa->next;
+ }
+ }
+
+ /* old files could have been saved with slidermin = slidermax = 0.0, but the UI in
+ * 2.4x would never reveal this to users as a dummy value always ended up getting used
+ * instead
+ */
+ for (key = main->key.first; key; key = key->id.next) {
+ KeyBlock *kb;
+
+ for (kb = key->block.first; kb; kb = kb->next) {
+ if (IS_EQF(kb->slidermin, kb->slidermax) && IS_EQ(kb->slidermax, 0))
+ kb->slidermax = kb->slidermin + 1.0f;
+ }
+ }
+ }
+
+ if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 1)) {
+ /* fix for bones that didn't have arm_roll before */
+ bArmature* arm;
+ Bone* bone;
+ Object *ob;
+
+ for (arm = main->armature.first; arm; arm = arm->id.next)
+ for (bone = arm->bonebase.first; bone; bone = bone->next)
+ do_version_bone_roll_256(bone);
+
+ /* fix for objects which have zero dquat's
+ * since this is multiplied with the quat rather than added */
+ for (ob= main->object.first; ob; ob= ob->id.next) {
+ if (is_zero_v4(ob->dquat)) {
+ unit_qt(ob->dquat);
+ }
+ if (is_zero_v3(ob->drotAxis) && ob->drotAngle == 0.0f) {
+ unit_axis_angle(ob->drotAxis, &ob->drotAngle);
+ }
+ }
+ }
+
+ if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 2)) {
+ bNodeTree *ntree;
+
+ /* node sockets are not exposed automatically any more,
+ * this mimics the old behavior by adding all unlinked sockets to groups.
+ */
+ for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) {
+ /* XXX Only setting a flag here. Actual adding of group sockets
+ * is done in lib_verify_nodetree, because at this point the internal
+ * nodes may not be up-to-date! (missing lib-link)
+ */
+ ntree->flag |= NTREE_DO_VERSIONS_GROUP_EXPOSE;
+ }
+ }
+
+ if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile <3)) {
+ bScreen *sc;
+ Brush *brush;
+ Object *ob;
+ ParticleSettings *part;
+ Material *mat;
+ int tex_nr, transp_tex;
+
+ for (mat = main->mat.first; mat; mat = mat->id.next) {
+ if (!(mat->mode & MA_TRANSP) && !(mat->material_type & MA_TYPE_VOLUME)) {
+
+ transp_tex= 0;
+
+ for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
+ if (!mat->mtex[tex_nr]) continue;
+ if (mat->mtex[tex_nr]->mapto & MAP_ALPHA) transp_tex= 1;
+ }
+
+ /* weak! material alpha could be animated */
+ if (mat->alpha < 1.0f || mat->fresnel_tra > 0.0f || transp_tex) {
+ mat->mode |= MA_TRANSP;
+ mat->mode &= ~(MA_ZTRANSP|MA_RAYTRANSP);
+ }
+ }
+ }
+
+ /* redraws flag in SpaceTime has been moved to Screen level */
+ for (sc = main->screen.first; sc; sc= sc->id.next) {
+ if (sc->redraws_flag == 0) {
+ /* just initialize to default? */
+ // XXX: we could also have iterated through areas, and taken them from the first timeline available...
+ sc->redraws_flag = TIME_ALL_3D_WIN|TIME_ALL_ANIM_WIN;
+ }
+ }
+
+ for (brush= main->brush.first; brush; brush= brush->id.next) {
+ if (brush->height == 0)
+ brush->height= 0.4f;
+ }
+
+ /* replace 'rim material' option for in offset*/
+ for (ob = main->object.first; ob; ob = ob->id.next) {
+ ModifierData *md;
+ for (md= ob->modifiers.first; md; md= md->next) {
+ if (md->type == eModifierType_Solidify) {
+ SolidifyModifierData *smd = (SolidifyModifierData *)md;
+ if (smd->flag & MOD_SOLIDIFY_RIM_MATERIAL) {
+ smd->mat_ofs_rim= 1;
+ smd->flag &= ~MOD_SOLIDIFY_RIM_MATERIAL;
+ }
+ }
+ }
+ }
+
+ /* particle draw color from material */
+ for (part = main->particle.first; part; part = part->id.next) {
+ if (part->draw & PART_DRAW_MAT_COL)
+ part->draw_col = PART_DRAW_COL_MAT;
+ }
+ }
+
+ if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 6)) {
+ Mesh *me;
+
+ for (me= main->mesh.first; me; me= me->id.next)
+ mesh_calc_normals_tessface(me->mvert, me->totvert, me->mface, me->totface, NULL);
+ }
+
+ if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 2)) {
+ /* update blur area sizes from 0..1 range to 0..100 percentage */
+ Scene *scene;
+ bNode *node;
+ for (scene=main->scene.first; scene; scene=scene->id.next)
+ if (scene->nodetree)
+ for (node=scene->nodetree->nodes.first; node; node=node->next)
+ if (node->type==CMP_NODE_BLUR) {
+ NodeBlurData *nbd= node->storage;
+ nbd->percentx *= 100.0f;
+ nbd->percenty *= 100.0f;
+ }
+ }
+
+ if (main->versionfile < 258 || (main->versionfile == 258 && main->subversionfile < 1)) {
+ /* screen view2d settings were not properly initialized [#27164]
+ * v2d->scroll caused the bug but best reset other values too which are in old blend files only.
+ * need to make less ugly - possibly an iterator? */
+ bScreen *screen;
+ for (screen= main->screen.first; screen; screen= screen->id.next) {
+ ScrArea *sa;
+ /* add regions */
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
+ SpaceLink *sl= sa->spacedata.first;
+ if (sl->spacetype==SPACE_IMAGE) {
+ ARegion *ar;
+ for (ar=sa->regionbase.first; ar; ar= ar->next) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
+ View2D *v2d= &ar->v2d;
+ v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0;
+ }
+ }
+ }
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_IMAGE) {
+ ARegion *ar;
+ for (ar=sl->regionbase.first; ar; ar= ar->next) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
+ View2D *v2d= &ar->v2d;
+ v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ {
+ /* Initialize texture point density curve falloff */
+ Tex *tex;
+ for (tex= main->tex.first; tex; tex= tex->id.next) {
+ if (tex->pd) {
+ if (tex->pd->falloff_speed_scale == 0.0f)
+ tex->pd->falloff_speed_scale = 100.0f;
+
+ if (!tex->pd->falloff_curve) {
+ tex->pd->falloff_curve = curvemapping_add(1, 0, 0, 1, 1);
+
+ tex->pd->falloff_curve->preset = CURVE_PRESET_LINE;
+ tex->pd->falloff_curve->cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
+ curvemap_reset(tex->pd->falloff_curve->cm, &tex->pd->falloff_curve->clipr, tex->pd->falloff_curve->preset, CURVEMAP_SLOPE_POSITIVE);
+ curvemapping_changed(tex->pd->falloff_curve, 0);
+ }
+ }
+ }
+ }
+
+ {
+ /* add default value for behind strength of camera actuator */
+ Object *ob;
+ bActuator *act;
+ for (ob = main->object.first; ob; ob= ob->id.next) {
+ for (act= ob->actuators.first; act; act= act->next) {
+ if (act->type == ACT_CAMERA) {
+ bCameraActuator *ba= act->data;
+
+ ba->damping = 1.0/32.0;
+ }
+ }
+ }
+ }
+
+ {
+ ParticleSettings *part;
+ for (part = main->particle.first; part; part = part->id.next) {
+ /* Initialize particle billboard scale */
+ part->bb_size[0] = part->bb_size[1] = 1.0f;
+ }
+ }
+ }
+
+ if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 1)) {
+ {
+ Scene *scene;
+ Sequence *seq;
+
+ for (scene=main->scene.first; scene; scene=scene->id.next) {
+ scene->r.ffcodecdata.audio_channels = 2;
+ scene->audio.volume = 1.0f;
+ SEQ_BEGIN (scene->ed, seq)
+ {
+ seq->pitch = 1.0f;
+ }
+ SEQ_END
+ }
+ }
+ {
+ bScreen *screen;
+ for (screen= main->screen.first; screen; screen= screen->id.next) {
+ ScrArea *sa;
+ /* add regions */
+ for (sa= screen->areabase.first; sa; sa= sa->next) {
+ SpaceLink *sl= sa->spacedata.first;
+ if (sl->spacetype==SPACE_SEQ) {
+ ARegion *ar;
+ for (ar=sa->regionbase.first; ar; ar= ar->next) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
+ if (ar->v2d.min[1] == 4.0f)
+ ar->v2d.min[1]= 0.5f;
+ }
+ }
+ }
+ for (sl= sa->spacedata.first; sl; sl= sl->next) {
+ if (sl->spacetype==SPACE_SEQ) {
+ ARegion *ar;
+ for (ar=sl->regionbase.first; ar; ar= ar->next) {
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
+ if (ar->v2d.min[1] == 4.0f)
+ ar->v2d.min[1]= 0.5f;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ {
+ /* Make "auto-clamped" handles a per-keyframe setting instead of per-FCurve
+ *
+ * We're only patching F-Curves in Actions here, since it is assumed that most
+ * drivers out there won't be using this (and if they are, they're in the minority).
+ * While we should aim to fix everything ideally, in practice it's far too hard
+ * to get to every animdata block, not to mention the performance hit that'd have
+ */
+ bAction *act;
+ FCurve *fcu;
+
+ for (act = main->action.first; act; act = act->id.next) {
+ for (fcu = act->curves.first; fcu; fcu = fcu->next) {
+ BezTriple *bezt;
+ unsigned int i = 0;
+
+ /* only need to touch curves that had this flag set */
+ if ((fcu->flag & FCURVE_AUTO_HANDLES) == 0)
+ continue;
+ if ((fcu->totvert == 0) || (fcu->bezt == NULL))
+ continue;
+
+ /* only change auto-handles to auto-clamped */
+ for (bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
+ if (bezt->h1 == HD_AUTO) bezt->h1 = HD_AUTO_ANIM;
+ if (bezt->h2 == HD_AUTO) bezt->h2 = HD_AUTO_ANIM;
+ }
+
+ fcu->flag &= ~FCURVE_AUTO_HANDLES;
+ }
+ }
+ }
+ {
+ /* convert fcurve and shape action actuators to action actuators */
+ Object *ob;
+ bActuator *act;
+ bIpoActuator *ia;
+ bActionActuator *aa;
+
+ for (ob= main->object.first; ob; ob= ob->id.next) {
+ for (act= ob->actuators.first; act; act= act->next) {
+ if (act->type == ACT_IPO) {
+ // Create the new actuator
+ ia= act->data;
+ aa= MEM_callocN(sizeof(bActionActuator), "fcurve -> action actuator do_version");
+
+ // Copy values
+ aa->type = ia->type;
+ aa->flag = ia->flag;
+ aa->sta = ia->sta;
+ aa->end = ia->end;
+ BLI_strncpy(aa->name, ia->name, sizeof(aa->name));
+ BLI_strncpy(aa->frameProp, ia->frameProp, sizeof(aa->frameProp));
+ if (ob->adt)
+ aa->act = ob->adt->action;
+
+ // Get rid of the old actuator
+ MEM_freeN(ia);
+
+ // Assign the new actuator
+ act->data = aa;
+ act->type= act->otype= ACT_ACTION;
+
+ }
+ else if (act->type == ACT_SHAPEACTION) {
+ act->type = act->otype = ACT_ACTION;
+ }
+ }
+ }
+ }
+ }
+
+ if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 2)) {
+ {
+ /* Convert default socket values from bNodeStack */
+ Scene *sce;
+ Material *mat;
+ Tex *tex;
+ bNodeTree *ntree;
+ for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) {
+ do_versions_nodetree_default_value(ntree);
+ ntree->update |= NTREE_UPDATE;
+ }
+ for (sce=main->scene.first; sce; sce=sce->id.next)
+ if (sce->nodetree) {
+ do_versions_nodetree_default_value(sce->nodetree);
+ sce->nodetree->update |= NTREE_UPDATE;
+ }
+ for (mat=main->mat.first; mat; mat=mat->id.next)
+ if (mat->nodetree) {
+ do_versions_nodetree_default_value(mat->nodetree);
+ mat->nodetree->update |= NTREE_UPDATE;
+ }
+ for (tex=main->tex.first; tex; tex=tex->id.next)
+ if (tex->nodetree) {
+ do_versions_nodetree_default_value(tex->nodetree);
+ tex->nodetree->update |= NTREE_UPDATE;
+ }
+ }
+
+ /* add SOCK_DYNAMIC flag to existing group sockets */
+ {
+ bNodeTree *ntree;
+ /* only need to do this for trees in main, local trees are not used as groups */
+ for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) {
+ do_versions_nodetree_dynamic_sockets(ntree);
+ ntree->update |= NTREE_UPDATE;
+ }
+ }
+
+ {
+ /* Initialize group tree nodetypes.
+ * These are used to distinguish tree types and
+ * associate them with specific node types for polling.
+ */
+ bNodeTree *ntree;
+ /* all node trees in main->nodetree are considered groups */
+ for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next)
+ ntree->nodetype = NODE_GROUP;
+ }
+ }
+
+ if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 4)) {
+ {
+ /* Adaptive time step for particle systems */
+ ParticleSettings *part;
+ for (part = main->particle.first; part; part = part->id.next) {
+ part->courant_target = 0.2f;
+ part->time_flag &= ~PART_TIME_AUTOSF;
+ }
+ }
+
+ {
+ /* set defaults for obstacle avoidance, recast data */
+ Scene *sce;
+ for (sce = main->scene.first; sce; sce = sce->id.next) {
+ if (sce->gm.levelHeight == 0.f)
+ sce->gm.levelHeight = 2.f;
+
+ if (sce->gm.recastData.cellsize == 0.0f)
+ sce->gm.recastData.cellsize = 0.3f;
+ if (sce->gm.recastData.cellheight == 0.0f)
+ sce->gm.recastData.cellheight = 0.2f;
+ if (sce->gm.recastData.agentmaxslope == 0.0f)
+ sce->gm.recastData.agentmaxslope = (float)M_PI/4;
+ if (sce->gm.recastData.agentmaxclimb == 0.0f)
+ sce->gm.recastData.agentmaxclimb = 0.9f;
+ if (sce->gm.recastData.agentheight == 0.0f)
+ sce->gm.recastData.agentheight = 2.0f;
+ if (sce->gm.recastData.agentradius == 0.0f)
+ sce->gm.recastData.agentradius = 0.6f;
+ if (sce->gm.recastData.edgemaxlen == 0.0f)
+ sce->gm.recastData.edgemaxlen = 12.0f;
+ if (sce->gm.recastData.edgemaxerror == 0.0f)
+ sce->gm.recastData.edgemaxerror = 1.3f;
+ if (sce->gm.recastData.regionminsize == 0.0f)
+ sce->gm.recastData.regionminsize = 8.f;
+ if (sce->gm.recastData.regionmergesize == 0.0f)
+ sce->gm.recastData.regionmergesize = 20.f;
+ if (sce->gm.recastData.vertsperpoly<3)
+ sce->gm.recastData.vertsperpoly = 6;
+ if (sce->gm.recastData.detailsampledist == 0.0f)
+ sce->gm.recastData.detailsampledist = 6.0f;
+ if (sce->gm.recastData.detailsamplemaxerror == 0.0f)
+ sce->gm.recastData.detailsamplemaxerror = 1.0f;
+ }
+ }
+ }
if (main->versionfile < 260) {
{
@@ -7399,32 +13383,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
- if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 4))
{
Lamp *la;
- Camera *cam;
- Curve *cu;
-
for (la= main->lamp.first; la; la= la->id.next) {
if (la->shadow_frustum_size == 0.0f)
la->shadow_frustum_size= 10.0f;
}
-
- for (cam = main->camera.first; cam; cam = cam->id.next) {
- if (cam->flag & CAM_PANORAMA) {
- cam->type = CAM_PANO;
- cam->flag &= ~CAM_PANORAMA;
- }
- }
-
- for(cu= main->curve.first; cu; cu= cu->id.next) {
- if(cu->bevfac2 == 0.0f) {
- cu->bevfac1 = 0.0f;
- cu->bevfac2 = 1.0f;
- }
- }
}
-
+
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
@@ -8241,7 +14207,7 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob)
expand_doit(fd, mainvar, ob->mat[a]);
}
- paf = blo_do_version_give_parteff_245(ob);
+ paf = do_version_give_parteff_245(ob);
if (paf && paf->group)
expand_doit(fd, mainvar, paf->group);
diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h
index 9be375977e9..511ded0ecdc 100644
--- a/source/blender/blenloader/intern/readfile.h
+++ b/source/blender/blenloader/intern/readfile.h
@@ -39,10 +39,6 @@ struct OldNewMap;
struct MemFile;
struct bheadsort;
struct ReportList;
-struct Object;
-struct PartEff;
-struct View3D;
-struct bNodeTree;
typedef struct FileData {
// linked list of BHeadN's
@@ -137,19 +133,5 @@ BHead *blo_prevbhead(FileData *fd, BHead *thisblock);
char *bhead_id_name(FileData *fd, BHead *bhead);
-/* do versions stuff */
-
-void blo_do_versions_oldnewmap_insert(struct OldNewMap *onm, void *oldaddr, void *newaddr, int nr);
-void *blo_do_versions_newlibadr(struct FileData *fd, void *lib, void *adr);
-void *blo_do_versions_newlibadr_us(struct FileData *fd, void *lib, void *adr);
-
-struct PartEff *blo_do_version_give_parteff_245(struct Object *ob);
-void blo_do_version_old_trackto_to_constraints(struct Object *ob);
-void blo_do_versions_view3d_split_250(struct View3D *v3d, struct ListBase *regions);
-void blo_do_versions_nodetree_default_value(struct bNodeTree *ntree);
-
-void blo_do_versions_pre250(struct FileData *fd, struct Library *lib, struct Main *main);
-void blo_do_versions_250(struct FileData *fd, struct Library *lib, struct Main *main);
-
#endif
diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c
deleted file mode 100644
index ebbfbd32cb5..00000000000
--- a/source/blender/blenloader/intern/versioning_250.c
+++ /dev/null
@@ -1,2676 +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.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- *
- */
-
-/** \file blender/blenloader/intern/readfile_250.c
- * \ingroup blenloader
- */
-
-#include "zlib.h"
-
-#ifndef WIN32
-# include <unistd.h> // for read close
-#else
-# include <io.h> // for open close read
-# include "winsock2.h"
-# include "BLI_winstuff.h"
-#endif
-
-/* allow readfile to use deprecated functionality */
-#define DNA_DEPRECATED_ALLOW
-
-#include "DNA_anim_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_actuator_types.h"
-#include "DNA_brush_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_cloth_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_key_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_node_types.h"
-#include "DNA_object_fluidsim.h" // NT
-#include "DNA_object_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_sdna_types.h"
-#include "DNA_sequence_types.h"
-#include "DNA_smoke_types.h"
-#include "DNA_sound_types.h"
-#include "DNA_space_types.h"
-#include "DNA_world_types.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_utildefines.h"
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-#include "BLI_edgehash.h"
-
-#include "BKE_anim.h"
-#include "BKE_armature.h"
-#include "BKE_colortools.h"
-#include "BKE_global.h" // for G
-#include "BKE_library.h" // for which_libbase
-#include "BKE_main.h" // for Main
-#include "BKE_mesh.h" // for ME_ defines (patching)
-#include "BKE_modifier.h"
-#include "BKE_multires.h"
-#include "BKE_particle.h"
-#include "BKE_pointcache.h"
-#include "BKE_screen.h"
-#include "BKE_sequencer.h"
-#include "BKE_texture.h" // for open_plugin_tex
-#include "BKE_utildefines.h" // SWITCH_INT DATA ENDB DNA1 O_BINARY GLOB USER TEST REND
-#include "BKE_sound.h"
-
-#include "NOD_socket.h"
-
-//XXX #include "BIF_butspace.h" // badlevel, for do_versions, patching event codes
-//XXX #include "BIF_filelist.h" // badlevel too, where to move this? - elubie
-//XXX #include "BIF_previewrender.h" // bedlelvel, for struct RenderInfo
-#include "BLO_readfile.h"
-#include "BLO_undofile.h"
-
-#include "RE_engine.h"
-
-#include "readfile.h"
-
-#include "PIL_time.h"
-
-#include <errno.h>
-
-/* 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;
-}
-
-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);
- ar->regiontype= RGN_TYPE_UI;
- ar->alignment= RGN_ALIGN_TOP;
- break;
- case SPACE_SEQ:
- ar_main = (ARegion*)lb->first;
- for (; ar_main; ar_main = ar_main->next) {
- if (ar_main->regiontype == RGN_TYPE_WINDOW)
- break;
- }
- ar= MEM_callocN(sizeof(ARegion), "preview area for sequencer");
- BLI_insertlinkbefore(lb, ar_main, ar);
- sequencer_init_preview_region(ar);
- break;
- case SPACE_VIEW3D:
- /* toolbar */
- ar= MEM_callocN(sizeof(ARegion), "toolbar for view3d");
-
- BLI_addtail(lb, ar);
- ar->regiontype= RGN_TYPE_TOOLS;
- ar->alignment= RGN_ALIGN_LEFT;
- ar->flag = RGN_FLAG_HIDDEN;
-
- /* tool properties */
- ar= MEM_callocN(sizeof(ARegion), "tool properties for view3d");
-
- BLI_addtail(lb, ar);
- ar->regiontype= RGN_TYPE_TOOL_PROPS;
- ar->alignment= RGN_ALIGN_BOTTOM|RGN_SPLIT_PREV;
- ar->flag = RGN_FLAG_HIDDEN;
-
- /* buttons/list view */
- ar= MEM_callocN(sizeof(ARegion), "buttons for view3d");
-
- BLI_addtail(lb, ar);
- ar->regiontype= RGN_TYPE_UI;
- ar->alignment= RGN_ALIGN_RIGHT;
- ar->flag = RGN_FLAG_HIDDEN;
-#if 0
- case SPACE_BUTS:
- /* context UI region */
- ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
- BLI_addtail(lb, ar);
- ar->regiontype= RGN_TYPE_UI;
- ar->alignment= RGN_ALIGN_RIGHT;
-
- break;
-#endif
- }
- }
-
- /* main region */
- ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");
-
- BLI_addtail(lb, ar);
- ar->winrct= sa->totrct;
-
- ar->regiontype= RGN_TYPE_WINDOW;
-
- if (sl) {
- /* if active spacetype has view2d data, copy that over to main region */
- /* and we split view3d */
- switch (sl->spacetype) {
- case SPACE_VIEW3D:
- blo_do_versions_view3d_split_250((View3D *)sl, lb);
- break;
-
- case SPACE_OUTLINER:
- {
- SpaceOops *soops= (SpaceOops *)sl;
-
- memcpy(&ar->v2d, &soops->v2d, sizeof(View2D));
-
- ar->v2d.scroll &= ~V2D_SCROLL_LEFT;
- ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM_O);
- ar->v2d.align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
- ar->v2d.keepzoom |= (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_KEEPASPECT);
- ar->v2d.keeptot = V2D_KEEPTOT_STRICT;
- ar->v2d.minzoom= ar->v2d.maxzoom= 1.0f;
- //ar->v2d.flag |= V2D_IS_INITIALISED;
- }
- break;
- case SPACE_TIME:
- {
- SpaceTime *stime= (SpaceTime *)sl;
- memcpy(&ar->v2d, &stime->v2d, sizeof(View2D));
-
- ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
- ar->v2d.align |= V2D_ALIGN_NO_NEG_Y;
- ar->v2d.keepofs |= V2D_LOCKOFS_Y;
- ar->v2d.keepzoom |= V2D_LOCKZOOM_Y;
- ar->v2d.tot.ymin = ar->v2d.cur.ymin = -10.0;
- ar->v2d.min[1]= ar->v2d.max[1]= 20.0;
- }
- break;
- case SPACE_IPO:
- {
- SpaceIpo *sipo= (SpaceIpo *)sl;
- memcpy(&ar->v2d, &sipo->v2d, sizeof(View2D));
-
- /* init mainarea view2d */
- ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
- ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
-
- ar->v2d.min[0]= FLT_MIN;
- ar->v2d.min[1]= FLT_MIN;
-
- ar->v2d.max[0]= MAXFRAMEF;
- ar->v2d.max[1]= FLT_MAX;
-
- //ar->v2d.flag |= V2D_IS_INITIALISED;
- break;
- }
- case SPACE_NLA:
- {
- SpaceNla *snla= (SpaceNla *)sl;
- memcpy(&ar->v2d, &snla->v2d, sizeof(View2D));
-
- ar->v2d.tot.ymin = (float)(-sa->winy)/3.0f;
- ar->v2d.tot.ymax = 0.0f;
-
- ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
- ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
- ar->v2d.align = V2D_ALIGN_NO_POS_Y;
- ar->v2d.flag |= V2D_VIEWSYNC_AREA_VERTICAL;
- break;
- }
- case SPACE_ACTION:
- {
- SpaceAction *saction= (SpaceAction *)sl;
-
- /* we totally reinit the view for the Action Editor, as some old instances had some weird cruft set */
- ar->v2d.tot.xmin = -20.0f;
- ar->v2d.tot.ymin = (float)(-sa->winy)/3.0f;
- ar->v2d.tot.xmax = (float)((sa->winx > 120)? (sa->winx) : 120);
- ar->v2d.tot.ymax = 0.0f;
-
- ar->v2d.cur= ar->v2d.tot;
-
- ar->v2d.min[0]= 0.0f;
- ar->v2d.min[1]= 0.0f;
-
- ar->v2d.max[0]= MAXFRAMEF;
- ar->v2d.max[1]= FLT_MAX;
-
- ar->v2d.minzoom= 0.01f;
- ar->v2d.maxzoom= 50;
- ar->v2d.scroll = (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
- ar->v2d.scroll |= (V2D_SCROLL_RIGHT);
- ar->v2d.keepzoom= V2D_LOCKZOOM_Y;
- ar->v2d.align= V2D_ALIGN_NO_POS_Y;
- ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
-
- /* for old files with ShapeKey editors open + an action set, clear the action as
- * it doesn't make sense in the new system (i.e. violates concept that ShapeKey edit
- * only shows ShapeKey-rooted actions only)
- */
- if (saction->mode == SACTCONT_SHAPEKEY)
- saction->action = NULL;
- break;
- }
- case SPACE_SEQ:
- {
- SpaceSeq *sseq= (SpaceSeq *)sl;
- memcpy(&ar->v2d, &sseq->v2d, sizeof(View2D));
-
- ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
- ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
- ar->v2d.align= V2D_ALIGN_NO_NEG_Y;
- ar->v2d.flag |= V2D_IS_INITIALISED;
- break;
- }
- case SPACE_NODE:
- {
- SpaceNode *snode= (SpaceNode *)sl;
- memcpy(&ar->v2d, &snode->v2d, sizeof(View2D));
-
- ar->v2d.scroll= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
- ar->v2d.keepzoom= V2D_LIMITZOOM|V2D_KEEPASPECT;
- break;
- }
- case SPACE_BUTS:
- {
- SpaceButs *sbuts= (SpaceButs *)sl;
- memcpy(&ar->v2d, &sbuts->v2d, sizeof(View2D));
-
- ar->v2d.scroll |= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
- break;
- }
- case SPACE_FILE:
- {
- // SpaceFile *sfile= (SpaceFile *)sl;
- ar->v2d.tot.xmin = ar->v2d.tot.ymin = 0;
- ar->v2d.tot.xmax = ar->winx;
- ar->v2d.tot.ymax = ar->winy;
- ar->v2d.cur = ar->v2d.tot;
- ar->regiontype= RGN_TYPE_WINDOW;
- ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM_O);
- ar->v2d.align = (V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_POS_Y);
- ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
- break;
- }
- case SPACE_TEXT:
- {
- SpaceText *st= (SpaceText *)sl;
- st->flags |= ST_FIND_WRAP;
- }
- //case SPACE_XXX: // FIXME... add other ones
- // memcpy(&ar->v2d, &((SpaceXxx *)sl)->v2d, sizeof(View2D));
- // break;
- }
- }
-}
-
-static void do_versions_windowmanager_2_50(bScreen *screen)
-{
- ScrArea *sa;
- SpaceLink *sl;
-
- /* add regions */
- for (sa= screen->areabase.first; sa; sa= sa->next) {
-
- /* we keep headertype variable to convert old files only */
- if (sa->headertype)
- area_add_header_region(sa, &sa->regionbase);
-
- area_add_window_regions(sa, sa->spacedata.first, &sa->regionbase);
-
- /* space imageselect is deprecated */
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_IMASEL)
- sl->spacetype= SPACE_EMPTY; /* spacedata then matches */
- }
-
- /* space sound is deprecated */
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_SOUND)
- sl->spacetype= SPACE_EMPTY; /* spacedata then matches */
- }
-
- /* it seems to be possible in 2.5 to have this saved, filewindow probably */
- sa->butspacetype= sa->spacetype;
-
- /* pushed back spaces also need regions! */
- if (sa->spacedata.first) {
- sl= sa->spacedata.first;
- for (sl= sl->next; sl; sl= sl->next) {
- if (sa->headertype)
- area_add_header_region(sa, &sl->regionbase);
- area_add_window_regions(sa, sl, &sl->regionbase);
- }
- }
- }
-}
-
-static void versions_gpencil_add_main(ListBase *lb, ID *id, const char *name)
-{
-
- BLI_addtail(lb, id);
- id->us= 1;
- id->flag= LIB_FAKEUSER;
- *( (short *)id->name )= ID_GD;
-
- new_id(lb, id, name);
- /* alphabetic insterion: is in new_id */
-
- if (G.debug & G_DEBUG)
- printf("Converted GPencil to ID: %s\n", id->name+2);
-}
-
-static void do_versions_gpencil_2_50(Main *main, bScreen *screen)
-{
- ScrArea *sa;
- SpaceLink *sl;
-
- /* add regions */
- for (sa= screen->areabase.first; sa; sa= sa->next) {
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_VIEW3D) {
- View3D *v3d= (View3D*) sl;
- if (v3d->gpd) {
- versions_gpencil_add_main(&main->gpencil, (ID *)v3d->gpd, "GPencil View3D");
- v3d->gpd= NULL;
- }
- }
- else if (sl->spacetype==SPACE_NODE) {
- SpaceNode *snode= (SpaceNode *)sl;
- if (snode->gpd) {
- versions_gpencil_add_main(&main->gpencil, (ID *)snode->gpd, "GPencil Node");
- snode->gpd= NULL;
- }
- }
- else if (sl->spacetype==SPACE_SEQ) {
- SpaceSeq *sseq= (SpaceSeq *)sl;
- if (sseq->gpd) {
- versions_gpencil_add_main(&main->gpencil, (ID *)sseq->gpd, "GPencil Node");
- sseq->gpd= NULL;
- }
- }
- else if (sl->spacetype==SPACE_IMAGE) {
- SpaceImage *sima= (SpaceImage *)sl;
-#if 0 /* see comment on r28002 */
- if (sima->gpd) {
- versions_gpencil_add_main(&main->gpencil, (ID *)sima->gpd, "GPencil Image");
- sima->gpd= NULL;
- }
-#else
- sima->gpd= NULL;
-#endif
- }
- }
- }
-}
-
-static void do_version_mtex_factor_2_50(MTex **mtex_array, short idtype)
-{
- MTex *mtex;
- float varfac, colfac;
- int a, neg;
-
- if (!mtex_array)
- return;
-
- for (a=0; a<MAX_MTEX; a++) {
- if (mtex_array[a]) {
- mtex= mtex_array[a];
-
- neg= mtex->maptoneg;
- varfac= mtex->varfac;
- colfac= mtex->colfac;
-
- if (neg & MAP_DISP) mtex->dispfac= -mtex->dispfac;
- if (neg & MAP_NORM) mtex->norfac= -mtex->norfac;
- if (neg & MAP_WARP) mtex->warpfac= -mtex->warpfac;
-
- mtex->colspecfac= (neg & MAP_COLSPEC)? -colfac: colfac;
- mtex->mirrfac= (neg & MAP_COLMIR)? -colfac: colfac;
- mtex->alphafac= (neg & MAP_ALPHA)? -varfac: varfac;
- mtex->difffac= (neg & MAP_REF)? -varfac: varfac;
- mtex->specfac= (neg & MAP_SPEC)? -varfac: varfac;
- mtex->emitfac= (neg & MAP_EMIT)? -varfac: varfac;
- mtex->hardfac= (neg & MAP_HAR)? -varfac: varfac;
- mtex->raymirrfac= (neg & MAP_RAYMIRR)? -varfac: varfac;
- mtex->translfac= (neg & MAP_TRANSLU)? -varfac: varfac;
- mtex->ambfac= (neg & MAP_AMB)? -varfac: varfac;
- mtex->colemitfac= (neg & MAP_EMISSION_COL)? -colfac: colfac;
- mtex->colreflfac= (neg & MAP_REFLECTION_COL)? -colfac: colfac;
- mtex->coltransfac= (neg & MAP_TRANSMISSION_COL)? -colfac: colfac;
- mtex->densfac= (neg & MAP_DENSITY)? -varfac: varfac;
- mtex->scatterfac= (neg & MAP_SCATTERING)? -varfac: varfac;
- mtex->reflfac= (neg & MAP_REFLECTION)? -varfac: varfac;
-
- mtex->timefac= (neg & MAP_PA_TIME)? -varfac: varfac;
- mtex->lengthfac= (neg & MAP_PA_LENGTH)? -varfac: varfac;
- mtex->clumpfac= (neg & MAP_PA_CLUMP)? -varfac: varfac;
- mtex->kinkfac= (neg & MAP_PA_KINK)? -varfac: varfac;
- mtex->roughfac= (neg & MAP_PA_ROUGH)? -varfac: varfac;
- mtex->padensfac= (neg & MAP_PA_DENS)? -varfac: varfac;
- mtex->lifefac= (neg & MAP_PA_LIFE)? -varfac: varfac;
- mtex->sizefac= (neg & MAP_PA_SIZE)? -varfac: varfac;
- mtex->ivelfac= (neg & MAP_PA_IVEL)? -varfac: varfac;
-
- mtex->shadowfac= (neg & LAMAP_SHAD)? -colfac: colfac;
-
- mtex->zenupfac= (neg & WOMAP_ZENUP)? -colfac: colfac;
- mtex->zendownfac= (neg & WOMAP_ZENDOWN)? -colfac: colfac;
- mtex->blendfac= (neg & WOMAP_BLEND)? -varfac: varfac;
-
- if (idtype == ID_MA)
- mtex->colfac= (neg & MAP_COL)? -colfac: colfac;
- else if (idtype == ID_LA)
- mtex->colfac= (neg & LAMAP_COL)? -colfac: colfac;
- else if (idtype == ID_WO)
- mtex->colfac= (neg & WOMAP_HORIZ)? -colfac: colfac;
- }
- }
-}
-
-static void do_version_mdef_250(Main *main)
-{
- Object *ob;
- ModifierData *md;
- MeshDeformModifierData *mmd;
-
- for (ob= main->object.first; ob; ob=ob->id.next) {
- for (md=ob->modifiers.first; md; md=md->next) {
- if (md->type == eModifierType_MeshDeform) {
- mmd= (MeshDeformModifierData*)md;
-
- if (mmd->bindcos) {
- /* make bindcos NULL in order to trick older versions
- * into thinking that the mesh was not bound yet */
- mmd->bindcagecos= mmd->bindcos;
- mmd->bindcos= NULL;
-
- modifier_mdef_compact_influences(md);
- }
- }
- }
- }
-}
-
-static void do_version_constraints_radians_degrees_250(ListBase *lb)
-{
- bConstraint *con;
-
- for (con=lb->first; con; con=con->next) {
- if (con->type==CONSTRAINT_TYPE_RIGIDBODYJOINT) {
- bRigidBodyJointConstraint *data = con->data;
- data->axX *= (float)(M_PI/180.0);
- data->axY *= (float)(M_PI/180.0);
- data->axZ *= (float)(M_PI/180.0);
- }
- else if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
- bKinematicConstraint *data = con->data;
- data->poleangle *= (float)(M_PI/180.0);
- }
- else if (con->type==CONSTRAINT_TYPE_ROTLIMIT) {
- bRotLimitConstraint *data = con->data;
-
- data->xmin *= (float)(M_PI/180.0);
- data->xmax *= (float)(M_PI/180.0);
- data->ymin *= (float)(M_PI/180.0);
- data->ymax *= (float)(M_PI/180.0);
- data->zmin *= (float)(M_PI/180.0);
- data->zmax *= (float)(M_PI/180.0);
- }
- }
-}
-
-/* NOTE: this version patch is intended for versions < 2.52.2, but was initially introduced in 2.27 already */
-static void do_versions_seq_unique_name_all_strips(
- Scene * sce, ListBase *seqbasep)
-{
- Sequence * seq = seqbasep->first;
-
- while (seq) {
- seqbase_unique_name_recursive(&sce->ed->seqbase, seq);
- if (seq->seqbase.first) {
- do_versions_seq_unique_name_all_strips(
- sce, &seq->seqbase);
- }
- seq=seq->next;
- }
-}
-
-static void do_version_bone_roll_256(Bone *bone)
-{
- Bone *child;
- float submat[3][3];
-
- copy_m3_m4(submat, bone->arm_mat);
- mat3_to_vec_roll(submat, NULL, &bone->arm_roll);
-
- for (child = bone->childbase.first; child; child = child->next)
- do_version_bone_roll_256(child);
-}
-
-static void do_versions_nodetree_dynamic_sockets(bNodeTree *ntree)
-{
- bNodeSocket *sock;
- for (sock=ntree->inputs.first; sock; sock=sock->next)
- sock->flag |= SOCK_DYNAMIC;
- for (sock=ntree->outputs.first; sock; sock=sock->next)
- sock->flag |= SOCK_DYNAMIC;
-}
-
-void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
-{
- /* WATCH IT!!!: pointers from libdata have not been converted */
-
- if (main->versionfile < 250) {
- bScreen *screen;
- Scene *scene;
- Base *base;
- Material *ma;
- Camera *cam;
- Mesh *me;
- Curve *cu;
- Scene *sce;
- Tex *tx;
- ParticleSettings *part;
- Object *ob;
- //PTCacheID *pid;
- //ListBase pidlist;
-
- bSound *sound;
- Sequence *seq;
- bActuator *act;
- int a;
-
- for (sound = main->sound.first; sound; sound = sound->id.next) {
- if (sound->newpackedfile) {
- sound->packedfile = sound->newpackedfile;
- sound->newpackedfile = NULL;
- }
- }
-
- for (ob = main->object.first; ob; ob= ob->id.next) {
- for (act= ob->actuators.first; act; act= act->next) {
- if (act->type == ACT_SOUND) {
- bSoundActuator *sAct = (bSoundActuator*) act->data;
- if (sAct->sound) {
- sound = blo_do_versions_newlibadr(fd, lib, sAct->sound);
- sAct->flag = sound->flags & SOUND_FLAGS_3D ? ACT_SND_3D_SOUND : 0;
- sAct->pitch = sound->pitch;
- sAct->volume = sound->volume;
- sAct->sound3D.reference_distance = sound->distance;
- sAct->sound3D.max_gain = sound->max_gain;
- sAct->sound3D.min_gain = sound->min_gain;
- sAct->sound3D.rolloff_factor = sound->attenuation;
- }
- else {
- sAct->sound3D.reference_distance = 1.0f;
- sAct->volume = 1.0f;
- sAct->sound3D.max_gain = 1.0f;
- sAct->sound3D.rolloff_factor = 1.0f;
- }
- sAct->sound3D.cone_inner_angle = 360.0f;
- sAct->sound3D.cone_outer_angle = 360.0f;
- sAct->sound3D.max_distance = FLT_MAX;
- }
- }
- }
-
- for (scene = main->scene.first; scene; scene = scene->id.next) {
- if (scene->ed && scene->ed->seqbasep) {
- SEQ_BEGIN (scene->ed, seq)
- {
- if (seq->type == SEQ_HD_SOUND) {
- char str[FILE_MAX];
- BLI_join_dirfile(str, sizeof(str), seq->strip->dir, seq->strip->stripdata->name);
- BLI_path_abs(str, main->name);
- seq->sound = sound_new_file(main, str);
- }
- /* don't know, if anybody used that
- * this way, but just in case, upgrade
- * to new way... */
- if ((seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) &&
- !(seq->flag & SEQ_USE_PROXY_CUSTOM_DIR))
- {
-
- BLI_snprintf(seq->strip->proxy->dir,
- FILE_MAXDIR, "%s/BL_proxy",
- seq->strip->dir);
- }
- }
- SEQ_END
- }
- }
-
- for (screen= main->screen.first; screen; screen= screen->id.next) {
- do_versions_windowmanager_2_50(screen);
- do_versions_gpencil_2_50(main, screen);
- }
-
- /* shader, composite and texture node trees have id.name empty, put something in
- * to have them show in RNA viewer and accessible otherwise.
- */
- for (ma= main->mat.first; ma; ma= ma->id.next) {
- if (ma->nodetree && ma->nodetree->id.name[0] == '\0')
- strcpy(ma->nodetree->id.name, "NTShader Nodetree");
-
- /* which_output 0 is now "not specified" */
- for (a=0; a<MAX_MTEX; a++) {
- if (ma->mtex[a]) {
- tx= blo_do_versions_newlibadr(fd, lib, ma->mtex[a]->tex);
- if (tx && tx->use_nodes)
- ma->mtex[a]->which_output++;
- }
- }
- }
- /* and composite trees */
- for (sce= main->scene.first; sce; sce= sce->id.next) {
- if (sce->nodetree && sce->nodetree->id.name[0] == '\0')
- strcpy(sce->nodetree->id.name, "NTCompositing Nodetree");
-
- /* move to cameras */
- if (sce->r.mode & R_PANORAMA) {
- for (base=sce->base.first; base; base=base->next) {
- ob= blo_do_versions_newlibadr(fd, lib, base->object);
-
- if (ob->type == OB_CAMERA && !ob->id.lib) {
- cam= blo_do_versions_newlibadr(fd, lib, ob->data);
- cam->flag |= CAM_PANORAMA;
- }
- }
-
- sce->r.mode &= ~R_PANORAMA;
- }
- }
- /* and texture trees */
- for (tx= main->tex.first; tx; tx= tx->id.next) {
- bNode *node;
-
- if (tx->nodetree) {
- if (tx->nodetree->id.name[0] == '\0')
- strcpy(tx->nodetree->id.name, "NTTexture Nodetree");
-
- /* which_output 0 is now "not specified" */
- for (node=tx->nodetree->nodes.first; node; node=node->next)
- if (node->type == TEX_NODE_OUTPUT)
- node->custom1++;
- }
- }
-
- /* copy standard draw flag to meshes(used to be global, is not available here) */
- for (me= main->mesh.first; me; me= me->id.next) {
- me->drawflag= ME_DRAWEDGES|ME_DRAWFACES|ME_DRAWCREASES;
- }
-
- /* particle draw and render types */
- for (part= main->particle.first; part; part= part->id.next) {
- if (part->draw_as) {
- if (part->draw_as == PART_DRAW_DOT) {
- part->ren_as = PART_DRAW_HALO;
- part->draw_as = PART_DRAW_REND;
- }
- else if (part->draw_as <= PART_DRAW_AXIS) {
- part->ren_as = PART_DRAW_HALO;
- }
- else {
- part->ren_as = part->draw_as;
- part->draw_as = PART_DRAW_REND;
- }
- }
- part->path_end = 1.0f;
- part->clength = 1.0f;
- }
- /* set old pointcaches to have disk cache flag */
- for (ob = main->object.first; ob; ob= ob->id.next) {
-
- //BKE_ptcache_ids_from_object(&pidlist, ob);
-
- //for (pid=pidlist.first; pid; pid=pid->next)
- // pid->cache->flag |= PTCACHE_DISK_CACHE;
-
- //BLI_freelistN(&pidlist);
- }
-
- /* type was a mixed flag & enum. move the 2d flag elsewhere */
- for (cu = main->curve.first; cu; cu= cu->id.next) {
- Nurb *nu;
-
- for (nu= cu->nurb.first; nu; nu= nu->next) {
- nu->flag |= (nu->type & CU_2D);
- nu->type &= CU_TYPE;
- }
- }
- }
-
- if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 1)) {
- Object *ob;
- Material *ma;
- Tex *tex;
- Scene *sce;
- ToolSettings *ts;
- //PTCacheID *pid;
- //ListBase pidlist;
-
- for (ob = main->object.first; ob; ob = ob->id.next) {
- //BKE_ptcache_ids_from_object(&pidlist, ob);
-
- //for (pid=pidlist.first; pid; pid=pid->next) {
- // if (pid->ptcaches->first == NULL)
- // pid->ptcaches->first = pid->ptcaches->last = pid->cache;
- //}
-
- //BLI_freelistN(&pidlist);
-
- if (ob->type == OB_MESH) {
- Mesh *me = blo_do_versions_newlibadr(fd, lib, ob->data);
- void *olddata = ob->data;
- ob->data = me;
-
- /* XXX - library meshes crash on loading most yoFrankie levels,
- * the multires pointer gets invalid - Campbell */
- if (me && me->id.lib==NULL && me->mr && me->mr->level_count > 1) {
- multires_load_old(ob, me);
- }
-
- ob->data = olddata;
- }
-
- if (ob->totcol && ob->matbits == NULL) {
- int a;
-
- ob->matbits= MEM_callocN(sizeof(char)*ob->totcol, "ob->matbits");
- for (a=0; a<ob->totcol; a++)
- ob->matbits[a]= ob->colbits & (1<<a);
- }
- }
-
- /* texture filter */
- for (tex = main->tex.first; tex; tex = tex->id.next) {
- if (tex->afmax == 0)
- tex->afmax= 8;
- }
-
- for (ma = main->mat.first; ma; ma = ma->id.next) {
- int a;
- if (ma->mode & MA_WIRE) {
- ma->material_type= MA_TYPE_WIRE;
- ma->mode &= ~MA_WIRE;
- }
- if (ma->mode & MA_HALO) {
- ma->material_type= MA_TYPE_HALO;
- ma->mode &= ~MA_HALO;
- }
-
- if (ma->mode & (MA_ZTRANSP|MA_RAYTRANSP)) {
- ma->mode |= MA_TRANSP;
- }
- else {
- /* ma->mode |= MA_ZTRANSP; */ /* leave ztransp as is even if its not used [#28113] */
- ma->mode &= ~MA_TRANSP;
- }
-
- /* set new bump for unused slots */
- for (a=0; a<MAX_MTEX; a++) {
- if (ma->mtex[a]) {
- tex= ma->mtex[a]->tex;
- if (!tex) {
- ma->mtex[a]->texflag |= MTEX_3TAP_BUMP;
- ma->mtex[a]->texflag |= MTEX_BUMP_OBJECTSPACE;
- }
- else {
- tex= (Tex*)blo_do_versions_newlibadr(fd, ma->id.lib, tex);
- if (tex && tex->type == 0) { /* invalid type */
- ma->mtex[a]->texflag |= MTEX_3TAP_BUMP;
- ma->mtex[a]->texflag |= MTEX_BUMP_OBJECTSPACE;
- }
- }
- }
- }
-
- /* volume rendering settings */
- if (ma->vol.stepsize < 0.0001f) {
- ma->vol.density = 1.0f;
- ma->vol.emission = 0.0f;
- ma->vol.scattering = 1.0f;
- ma->vol.emission_col[0] = ma->vol.emission_col[1] = ma->vol.emission_col[2] = 1.0f;
- ma->vol.density_scale = 1.0f;
- ma->vol.depth_cutoff = 0.01f;
- ma->vol.stepsize_type = MA_VOL_STEP_RANDOMIZED;
- ma->vol.stepsize = 0.2f;
- ma->vol.shade_type = MA_VOL_SHADE_SHADED;
- ma->vol.shadeflag |= MA_VOL_PRECACHESHADING;
- ma->vol.precache_resolution = 50;
- }
- }
-
- for (sce = main->scene.first; sce; sce = sce->id.next) {
- ts= sce->toolsettings;
- if (ts->normalsize == 0.0f || !ts->uv_selectmode || ts->vgroup_weight == 0.0f) {
- ts->normalsize= 0.1f;
- ts->selectmode= SCE_SELECT_VERTEX;
-
- /* autokeying - setting should be taken from the user-prefs
- * but the userprefs version may not have correct flags set
- * (i.e. will result in blank box when enabled)
- */
- ts->autokey_mode= U.autokey_mode;
- if (ts->autokey_mode == 0)
- ts->autokey_mode= 2; /* 'add/replace' but not on */
- ts->uv_selectmode= UV_SELECT_VERTEX;
- ts->vgroup_weight= 1.0f;
- }
-
- /* Game Settings */
- //Dome
- sce->gm.dome.angle = sce->r.domeangle;
- sce->gm.dome.mode = sce->r.domemode;
- sce->gm.dome.res = sce->r.domeres;
- sce->gm.dome.resbuf = sce->r.domeresbuf;
- sce->gm.dome.tilt = sce->r.dometilt;
- sce->gm.dome.warptext = sce->r.dometext;
-
- //Stand Alone
- sce->gm.playerflag |= (sce->r.fullscreen?GAME_PLAYER_FULLSCREEN:0);
- sce->gm.xplay = sce->r.xplay;
- sce->gm.yplay = sce->r.yplay;
- sce->gm.freqplay = sce->r.freqplay;
- sce->gm.depth = sce->r.depth;
- sce->gm.attrib = sce->r.attrib;
-
- //Stereo
- sce->gm.stereomode = sce->r.stereomode;
- /* reassigning stereomode NO_STEREO and DOME to a separeted flag*/
- if (sce->gm.stereomode == 1) { //1 = STEREO_NOSTEREO
- sce->gm.stereoflag = STEREO_NOSTEREO;
- sce->gm.stereomode = STEREO_ANAGLYPH;
- }
- else if (sce->gm.stereomode == 8) { //8 = STEREO_DOME
- sce->gm.stereoflag = STEREO_DOME;
- sce->gm.stereomode = STEREO_ANAGLYPH;
- }
- else
- sce->gm.stereoflag = STEREO_ENABLED;
-
- //Framing
- sce->gm.framing = sce->framing;
- sce->gm.xplay = sce->r.xplay;
- sce->gm.yplay = sce->r.yplay;
- sce->gm.freqplay= sce->r.freqplay;
- sce->gm.depth= sce->r.depth;
-
- //Physic (previously stored in world)
- sce->gm.gravity =9.8f;
- sce->gm.physicsEngine= WOPHY_BULLET;// Bullet by default
- sce->gm.mode = WO_DBVT_CULLING; // DBVT culling by default
- sce->gm.occlusionRes = 128;
- sce->gm.ticrate = 60;
- sce->gm.maxlogicstep = 5;
- sce->gm.physubstep = 1;
- sce->gm.maxphystep = 5;
- }
- }
-
- if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 2)) {
- Scene *sce;
- Object *ob;
-
- for (sce = main->scene.first; sce; sce = sce->id.next) {
- if (fd->fileflags & G_FILE_ENABLE_ALL_FRAMES)
- sce->gm.flag |= GAME_ENABLE_ALL_FRAMES;
- if (fd->fileflags & G_FILE_SHOW_DEBUG_PROPS)
- sce->gm.flag |= GAME_SHOW_DEBUG_PROPS;
- if (fd->fileflags & G_FILE_SHOW_FRAMERATE)
- sce->gm.flag |= GAME_SHOW_FRAMERATE;
- if (fd->fileflags & G_FILE_SHOW_PHYSICS)
- sce->gm.flag |= GAME_SHOW_PHYSICS;
- if (fd->fileflags & G_FILE_GLSL_NO_SHADOWS)
- sce->gm.flag |= GAME_GLSL_NO_SHADOWS;
- if (fd->fileflags & G_FILE_GLSL_NO_SHADERS)
- sce->gm.flag |= GAME_GLSL_NO_SHADERS;
- if (fd->fileflags & G_FILE_GLSL_NO_RAMPS)
- sce->gm.flag |= GAME_GLSL_NO_RAMPS;
- if (fd->fileflags & G_FILE_GLSL_NO_NODES)
- sce->gm.flag |= GAME_GLSL_NO_NODES;
- if (fd->fileflags & G_FILE_GLSL_NO_EXTRA_TEX)
- sce->gm.flag |= GAME_GLSL_NO_EXTRA_TEX;
- if (fd->fileflags & G_FILE_IGNORE_DEPRECATION_WARNINGS)
- sce->gm.flag |= GAME_IGNORE_DEPRECATION_WARNINGS;
-
- if (fd->fileflags & G_FILE_GAME_MAT_GLSL)
- sce->gm.matmode= GAME_MAT_GLSL;
- else if (fd->fileflags & G_FILE_GAME_MAT)
- sce->gm.matmode= GAME_MAT_MULTITEX;
- else
- sce->gm.matmode= GAME_MAT_TEXFACE;
-
- sce->gm.flag |= GAME_DISPLAY_LISTS;
- }
-
- for (ob = main->object.first; ob; ob = ob->id.next) {
- if (ob->flag & 8192) // OB_POSEMODE = 8192
- ob->mode |= OB_MODE_POSE;
- }
- }
-
- if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 4)) {
- Scene *sce;
- Object *ob;
- Material *ma;
- Lamp *la;
- World *wo;
- Tex *tex;
- ParticleSettings *part;
- int do_gravity = 0;
-
- for (sce = main->scene.first; sce; sce = sce->id.next)
- if (sce->unit.scale_length == 0.0f)
- sce->unit.scale_length= 1.0f;
-
- for (ob = main->object.first; ob; ob = ob->id.next) {
- /* fluid-sim stuff */
- FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
- if (fluidmd) fluidmd->fss->fmd = fluidmd;
-
- /* rotation modes were added, but old objects would now default to being 'quaternion based' */
- ob->rotmode= ROT_MODE_EUL;
- }
-
- for (ma = main->mat.first; ma; ma=ma->id.next) {
- if (ma->vol.reflection == 0.f) {
- ma->vol.reflection = 1.f;
- ma->vol.transmission_col[0] = ma->vol.transmission_col[1] = ma->vol.transmission_col[2] = 1.0f;
- ma->vol.reflection_col[0] = ma->vol.reflection_col[1] = ma->vol.reflection_col[2] = 1.0f;
- }
-
- do_version_mtex_factor_2_50(ma->mtex, ID_MA);
- }
-
- for (la = main->lamp.first; la; la=la->id.next)
- do_version_mtex_factor_2_50(la->mtex, ID_LA);
-
- for (wo = main->world.first; wo; wo=wo->id.next)
- do_version_mtex_factor_2_50(wo->mtex, ID_WO);
-
- for (tex = main->tex.first; tex; tex=tex->id.next)
- if (tex->vd)
- if (tex->vd->extend == 0)
- tex->vd->extend = TEX_CLIP;
-
- for (sce= main->scene.first; sce; sce= sce->id.next) {
- if (sce->audio.main == 0.0f)
- sce->audio.main = 1.0f;
-
- sce->r.ffcodecdata.audio_mixrate = sce->audio.mixrate;
- sce->r.ffcodecdata.audio_volume = sce->audio.main;
- sce->audio.distance_model = 2;
- sce->audio.doppler_factor = 1.0f;
- sce->audio.speed_of_sound = 343.3f;
- }
-
- /* Add default gravity to scenes */
- for (sce= main->scene.first; sce; sce= sce->id.next) {
- if ((sce->physics_settings.flag & PHYS_GLOBAL_GRAVITY) == 0 &&
- len_v3(sce->physics_settings.gravity) == 0.0f)
- {
- sce->physics_settings.gravity[0] = sce->physics_settings.gravity[1] = 0.0f;
- sce->physics_settings.gravity[2] = -9.81f;
- sce->physics_settings.flag = PHYS_GLOBAL_GRAVITY;
- do_gravity = 1;
- }
- }
-
- /* Assign proper global gravity weights for dynamics (only z-coordinate is taken into account) */
- if (do_gravity) for (part= main->particle.first; part; part= part->id.next)
- part->effector_weights->global_gravity = part->acc[2]/-9.81f;
-
- for (ob = main->object.first; ob; ob = ob->id.next) {
- ModifierData *md;
-
- if (do_gravity) {
- for (md= ob->modifiers.first; md; md= md->next) {
- ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
- if (clmd)
- clmd->sim_parms->effector_weights->global_gravity = clmd->sim_parms->gravity[2]/-9.81f;
- }
-
- if (ob->soft)
- ob->soft->effector_weights->global_gravity = ob->soft->grav/9.81f;
- }
-
- /* Normal wind shape is plane */
- if (ob->pd) {
- if (ob->pd->forcefield == PFIELD_WIND)
- ob->pd->shape = PFIELD_SHAPE_PLANE;
-
- if (ob->pd->flag & PFIELD_PLANAR)
- ob->pd->shape = PFIELD_SHAPE_PLANE;
- else if (ob->pd->flag & PFIELD_SURFACE)
- ob->pd->shape = PFIELD_SHAPE_SURFACE;
-
- ob->pd->flag |= PFIELD_DO_LOCATION;
- }
- }
- }
-
- if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 6)) {
- Object *ob;
- Lamp *la;
-
- /* New variables for axis-angle rotations and/or quaternion rotations were added, and need proper initialization */
- for (ob= main->object.first; ob; ob= ob->id.next) {
- /* new variables for all objects */
- ob->quat[0]= 1.0f;
- ob->rotAxis[1]= 1.0f;
-
- /* bones */
- if (ob->pose) {
- bPoseChannel *pchan;
-
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- /* just need to initalise rotation axis properly... */
- pchan->rotAxis[1]= 1.0f;
- }
- }
- }
-
- for (la = main->lamp.first; la; la=la->id.next)
- la->compressthresh= 0.05f;
- }
-
- if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 7)) {
- Mesh *me;
- Nurb *nu;
- Lattice *lt;
- Curve *cu;
- Key *key;
- float *data;
- int a, tot;
-
- /* shape keys are no longer applied to the mesh itself, but rather
- * to the derivedmesh/displist, so here we ensure that the basis
- * shape key is always set in the mesh coordinates. */
-
- for (me= main->mesh.first; me; me= me->id.next) {
- if ((key = blo_do_versions_newlibadr(fd, lib, me->key)) && key->refkey) {
- data= key->refkey->data;
- tot= MIN2(me->totvert, key->refkey->totelem);
-
- for (a=0; a<tot; a++, data+=3)
- copy_v3_v3(me->mvert[a].co, data);
- }
- }
-
- for (lt= main->latt.first; lt; lt= lt->id.next) {
- if ((key = blo_do_versions_newlibadr(fd, lib, lt->key)) && key->refkey) {
- data= key->refkey->data;
- tot= MIN2(lt->pntsu*lt->pntsv*lt->pntsw, key->refkey->totelem);
-
- for (a=0; a<tot; a++, data+=3)
- copy_v3_v3(lt->def[a].vec, data);
- }
- }
-
- for (cu= main->curve.first; cu; cu= cu->id.next) {
- if ((key = blo_do_versions_newlibadr(fd, lib, cu->key)) && key->refkey) {
- data= key->refkey->data;
-
- for (nu=cu->nurb.first; nu; nu=nu->next) {
- if (nu->bezt) {
- BezTriple *bezt = nu->bezt;
-
- for (a=0; a<nu->pntsu; a++, bezt++) {
- copy_v3_v3(bezt->vec[0], data); data+=3;
- copy_v3_v3(bezt->vec[1], data); data+=3;
- copy_v3_v3(bezt->vec[2], data); data+=3;
- bezt->alfa= *data; data++;
- }
- }
- else if (nu->bp) {
- BPoint *bp = nu->bp;
-
- for (a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
- copy_v3_v3(bp->vec, data); data+=3;
- bp->alfa= *data; data++;
- }
- }
- }
- }
- }
- }
-
- if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 8)) {
- {
- Scene *sce= main->scene.first;
- while (sce) {
- if (sce->r.frame_step==0)
- sce->r.frame_step= 1;
- if (sce->r.mblur_samples==0)
- sce->r.mblur_samples = sce->r.osa;
-
- if (sce->ed && sce->ed->seqbase.first) {
- do_versions_seq_unique_name_all_strips(
- sce, &sce->ed->seqbase);
- }
-
- sce= sce->id.next;
- }
- }
- {
- /* ensure all nodes have unique names */
- bNodeTree *ntree= main->nodetree.first;
- while (ntree) {
- bNode *node=ntree->nodes.first;
-
- while (node) {
- nodeUniqueName(ntree, node);
- node= node->next;
- }
-
- ntree= ntree->id.next;
- }
- }
- {
- Object *ob=main->object.first;
- while (ob) {
- /* shaded mode disabled for now */
- if (ob->dt == OB_MATERIAL) ob->dt = OB_TEXTURE;
- ob=ob->id.next;
- }
- }
-
- {
- bScreen *screen;
- ScrArea *sa;
- SpaceLink *sl;
-
- for (screen= main->screen.first; screen; screen= screen->id.next) {
- for (sa= screen->areabase.first; sa; sa= sa->next) {
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_VIEW3D) {
- View3D *v3d = (View3D *)sl;
- if (v3d->drawtype == OB_MATERIAL) v3d->drawtype = OB_SOLID;
- }
- }
- }
- }
- }
-
- /* only convert old 2.50 files with color management */
- if (main->versionfile == 250) {
- Scene *sce=main->scene.first;
- Material *ma=main->mat.first;
- World *wo=main->world.first;
- Tex *tex=main->tex.first;
- int i, convert=0;
-
- /* convert to new color management system:
- * while previously colors were stored as srgb,
- * now they are stored as linear internally,
- * with screen gamma correction in certain places in the UI. */
-
- /* don't know what scene is active, so we'll convert if any scene has it enabled... */
- while (sce) {
- if (sce->r.color_mgt_flag & R_COLOR_MANAGEMENT)
- convert=1;
- sce=sce->id.next;
- }
-
- if (convert) {
- while (ma) {
- if (ma->ramp_col) {
- ColorBand *band = (ColorBand *)ma->ramp_col;
- for (i=0; i<band->tot; i++) {
- CBData *data = band->data + i;
- srgb_to_linearrgb_v3_v3(&data->r, &data->r);
- }
- }
- if (ma->ramp_spec) {
- ColorBand *band = (ColorBand *)ma->ramp_spec;
- for (i=0; i<band->tot; i++) {
- CBData *data = band->data + i;
- srgb_to_linearrgb_v3_v3(&data->r, &data->r);
- }
- }
-
- srgb_to_linearrgb_v3_v3(&ma->r, &ma->r);
- srgb_to_linearrgb_v3_v3(&ma->specr, &ma->specr);
- srgb_to_linearrgb_v3_v3(&ma->mirr, &ma->mirr);
- srgb_to_linearrgb_v3_v3(ma->sss_col, ma->sss_col);
- ma=ma->id.next;
- }
-
- while (tex) {
- if (tex->coba) {
- ColorBand *band = (ColorBand *)tex->coba;
- for (i=0; i<band->tot; i++) {
- CBData *data = band->data + i;
- srgb_to_linearrgb_v3_v3(&data->r, &data->r);
- }
- }
- tex=tex->id.next;
- }
-
- while (wo) {
- srgb_to_linearrgb_v3_v3(&wo->ambr, &wo->ambr);
- srgb_to_linearrgb_v3_v3(&wo->horr, &wo->horr);
- srgb_to_linearrgb_v3_v3(&wo->zenr, &wo->zenr);
- wo=wo->id.next;
- }
- }
- }
- }
-
- if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 9)) {
- Scene *sce;
- Mesh *me;
- Object *ob;
-
- for (sce=main->scene.first; sce; sce=sce->id.next)
- if (!sce->toolsettings->particle.selectmode)
- sce->toolsettings->particle.selectmode= SCE_SELECT_PATH;
-
- if (main->versionfile == 250 && main->subversionfile > 1) {
- for (me=main->mesh.first; me; me=me->id.next)
- multires_load_old_250(me);
-
- for (ob=main->object.first; ob; ob=ob->id.next) {
- MultiresModifierData *mmd = (MultiresModifierData *)modifiers_findByType(ob, eModifierType_Multires);
-
- if (mmd) {
- mmd->totlvl--;
- mmd->lvl--;
- mmd->sculptlvl= mmd->lvl;
- mmd->renderlvl= mmd->lvl;
- }
- }
- }
- }
-
- if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 10)) {
- Object *ob;
-
- /* properly initialize hair clothsim data on old files */
- for (ob = main->object.first; ob; ob = ob->id.next) {
- ModifierData *md;
- for (md= ob->modifiers.first; md; md= md->next) {
- if (md->type == eModifierType_Cloth) {
- ClothModifierData *clmd = (ClothModifierData *)md;
- if (clmd->sim_parms->velocity_smooth < 0.01f)
- clmd->sim_parms->velocity_smooth = 0.f;
- }
- }
- }
- }
-
- /* fix bad area setup in subversion 10 */
- if (main->versionfile == 250 && main->subversionfile == 10) {
- /* fix for new view type in sequencer */
- bScreen *screen;
- ScrArea *sa;
- SpaceLink *sl;
-
-
- /* remove all preview window in wrong spaces */
- for (screen= main->screen.first; screen; screen= screen->id.next) {
- for (sa= screen->areabase.first; sa; sa= sa->next) {
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype!=SPACE_SEQ) {
- ARegion *ar;
- ListBase *regionbase;
-
- if (sl == sa->spacedata.first) {
- regionbase = &sa->regionbase;
- }
- else {
- regionbase = &sl->regionbase;
- }
-
-
- for ( ar = regionbase->first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_PREVIEW)
- break;
- }
-
- if (ar && (ar->regiontype == RGN_TYPE_PREVIEW)) {
- SpaceType *st= BKE_spacetype_from_id(SPACE_SEQ);
- BKE_area_region_free(st, ar);
- BLI_freelinkN(regionbase, ar);
- }
- }
- }
- }
- }
- }
-
- if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 11)) {
- {
- /* fix for new view type in sequencer */
- bScreen *screen;
- ScrArea *sa;
- SpaceLink *sl;
-
-
- for (screen= main->screen.first; screen; screen= screen->id.next) {
- for (sa= screen->areabase.first; sa; sa= sa->next) {
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_SEQ) {
- ARegion *ar;
- ARegion *ar_main;
- ListBase *regionbase;
- SpaceSeq *sseq = (SpaceSeq *)sl;
-
- if (sl == sa->spacedata.first) {
- regionbase = &sa->regionbase;
- }
- else {
- regionbase = &sl->regionbase;
- }
-
- if (sseq->view == 0) sseq->view = SEQ_VIEW_SEQUENCE;
- if (sseq->mainb == 0) sseq->mainb = SEQ_DRAW_IMG_IMBUF;
-
- ar_main = (ARegion*)regionbase->first;
- for (; ar_main; ar_main = ar_main->next) {
- if (ar_main->regiontype == RGN_TYPE_WINDOW)
- break;
- }
- ar= MEM_callocN(sizeof(ARegion), "preview area for sequencer");
- BLI_insertlinkbefore(regionbase, ar_main, ar);
- sequencer_init_preview_region(ar);
- }
- }
- }
- }
- }
- }
-
- if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 12)) {
- Scene *sce;
- Object *ob;
- Brush *brush;
- Material *ma;
-
- /* game engine changes */
- for (sce = main->scene.first; sce; sce = sce->id.next) {
- sce->gm.eyeseparation = 0.10f;
- }
-
- /* anim viz changes */
- for (ob= main->object.first; ob; ob= ob->id.next) {
- /* initialize object defaults */
- animviz_settings_init(&ob->avs);
-
- /* if armature, copy settings for pose from armature data
- * performing initialization where appropriate
- */
- if (ob->pose && ob->data) {
- bArmature *arm= blo_do_versions_newlibadr(fd, lib, ob->data);
- if (arm) { /* XXX - why does this fail in some cases? */
- bAnimVizSettings *avs= &ob->pose->avs;
-
- /* ghosting settings ---------------- */
- /* ranges */
- avs->ghost_bc= avs->ghost_ac= arm->ghostep;
-
- avs->ghost_sf= arm->ghostsf;
- avs->ghost_ef= arm->ghostef;
- if ((avs->ghost_sf == avs->ghost_ef) && (avs->ghost_sf == 0)) {
- avs->ghost_sf= 1;
- avs->ghost_ef= 100;
- }
-
- /* type */
- if (arm->ghostep == 0)
- avs->ghost_type= GHOST_TYPE_NONE;
- else
- avs->ghost_type= arm->ghosttype + 1;
-
- /* stepsize */
- avs->ghost_step= arm->ghostsize;
- if (avs->ghost_step == 0)
- avs->ghost_step= 1;
-
- /* path settings --------------------- */
- /* ranges */
- avs->path_bc= arm->pathbc;
- avs->path_ac= arm->pathac;
- if ((avs->path_bc == avs->path_ac) && (avs->path_bc == 0))
- avs->path_bc= avs->path_ac= 10;
-
- avs->path_sf= arm->pathsf;
- avs->path_ef= arm->pathef;
- if ((avs->path_sf == avs->path_ef) && (avs->path_sf == 0)) {
- avs->path_sf= 1;
- avs->path_ef= 250;
- }
-
- /* flags */
- if (arm->pathflag & ARM_PATH_FNUMS)
- avs->path_viewflag |= MOTIONPATH_VIEW_FNUMS;
- if (arm->pathflag & ARM_PATH_KFRAS)
- avs->path_viewflag |= MOTIONPATH_VIEW_KFRAS;
- if (arm->pathflag & ARM_PATH_KFNOS)
- avs->path_viewflag |= MOTIONPATH_VIEW_KFNOS;
-
- /* bake flags */
- if (arm->pathflag & ARM_PATH_HEADS)
- avs->path_bakeflag |= MOTIONPATH_BAKE_HEADS;
-
- /* type */
- if (arm->pathflag & ARM_PATH_ACFRA)
- avs->path_type = MOTIONPATH_TYPE_ACFRA;
-
- /* stepsize */
- avs->path_step= arm->pathsize;
- if (avs->path_step == 0)
- avs->path_step= 1;
- }
- else
- animviz_settings_init(&ob->pose->avs);
- }
- }
-
- /* brush texture changes */
- for (brush= main->brush.first; brush; brush= brush->id.next) {
- default_mtex(&brush->mtex);
- }
-
- for (ma= main->mat.first; ma; ma= ma->id.next) {
- if (ma->vol.ms_spread < 0.0001f) {
- ma->vol.ms_spread = 0.2f;
- ma->vol.ms_diff = 1.f;
- ma->vol.ms_intensity = 1.f;
- }
- }
- }
-
- if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 13)) {
- /* NOTE: if you do more conversion, be sure to do it outside of this and
- * increase subversion again, otherwise it will not be correct */
- Object *ob;
-
- /* convert degrees to radians for internal use */
- for (ob=main->object.first; ob; ob=ob->id.next) {
- bPoseChannel *pchan;
-
- do_version_constraints_radians_degrees_250(&ob->constraints);
-
- if (ob->pose) {
- for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
- pchan->limitmin[0] *= (float)(M_PI/180.0);
- pchan->limitmin[1] *= (float)(M_PI/180.0);
- pchan->limitmin[2] *= (float)(M_PI/180.0);
- pchan->limitmax[0] *= (float)(M_PI/180.0);
- pchan->limitmax[1] *= (float)(M_PI/180.0);
- pchan->limitmax[2] *= (float)(M_PI/180.0);
-
- do_version_constraints_radians_degrees_250(&pchan->constraints);
- }
- }
- }
- }
-
- if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 14)) {
- /* fix for bad View2D extents for Animation Editors */
- bScreen *screen;
- ScrArea *sa;
- SpaceLink *sl;
-
- for (screen= main->screen.first; screen; screen= screen->id.next) {
- for (sa= screen->areabase.first; sa; sa= sa->next) {
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- ListBase *regionbase;
- ARegion *ar;
-
- if (sl == sa->spacedata.first)
- regionbase = &sa->regionbase;
- else
- regionbase = &sl->regionbase;
-
- if (ELEM(sl->spacetype, SPACE_ACTION, SPACE_NLA)) {
- for (ar = (ARegion*)regionbase->first; ar; ar = ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- ar->v2d.cur.ymax = ar->v2d.tot.ymax = 0.0f;
- ar->v2d.cur.ymin = ar->v2d.tot.ymin = (float)(-sa->winy) / 3.0f;
- }
- }
- }
- }
- }
- }
- }
-
- if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 15)) {
- World *wo;
- Material *ma;
-
- /* ambient default from 0.5f to 1.0f */
- for (ma= main->mat.first; ma; ma=ma->id.next)
- ma->amb *= 2.0f;
-
- for (wo= main->world.first; wo; wo=wo->id.next) {
- /* ao splitting into ao/env/indirect */
- wo->ao_env_energy= wo->aoenergy;
- wo->aoenergy= 1.0f;
-
- if (wo->ao_indirect_bounces == 0)
- wo->ao_indirect_bounces= 1;
- else
- wo->mode |= WO_INDIRECT_LIGHT;
-
- if (wo->aomix == WO_AOSUB)
- wo->ao_env_energy= -wo->ao_env_energy;
- else if (wo->aomix == WO_AOADDSUB)
- wo->mode |= WO_AMB_OCC;
-
- wo->aomix= WO_AOMUL;
-
- /* ambient default from 0.5f to 1.0f */
- mul_v3_fl(&wo->ambr, 0.5f);
- wo->ao_env_energy *= 0.5f;
- }
- }
-
- if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 17)) {
- Scene *sce;
- Sequence *seq;
- Material *ma;
-
- /* initialize to sane default so toggling on border shows something */
- for (sce = main->scene.first; sce; sce = sce->id.next) {
- if (sce->r.border.xmin == 0.0f && sce->r.border.ymin == 0.0f &&
- sce->r.border.xmax == 0.0f && sce->r.border.ymax == 0.0f) {
- sce->r.border.xmin = 0.0f;
- sce->r.border.ymin = 0.0f;
- sce->r.border.xmax = 1.0f;
- sce->r.border.ymax = 1.0f;
- }
-
- if ((sce->r.ffcodecdata.flags & FFMPEG_MULTIPLEX_AUDIO) == 0)
- sce->r.ffcodecdata.audio_codec = 0x0; // CODEC_ID_NONE
-
- SEQ_BEGIN (sce->ed, seq)
- {
- seq->volume = 1.0f;
- }
- SEQ_END
- }
-
- /* particle brush strength factor was changed from int to float */
- for (sce= main->scene.first; sce; sce=sce->id.next) {
- ParticleEditSettings *pset= &sce->toolsettings->particle;
- int a;
-
- for (a=0; a<PE_TOT_BRUSH; a++)
- pset->brush[a].strength /= 100.0f;
- }
-
- for (ma = main->mat.first; ma; ma=ma->id.next)
- if (ma->mode & MA_TRACEBLE)
- ma->shade_flag |= MA_APPROX_OCCLUSION;
-
- /* sequencer changes */
- {
- bScreen *screen;
- ScrArea *sa;
- SpaceLink *sl;
-
- for (screen= main->screen.first; screen; screen= screen->id.next) {
- for (sa= screen->areabase.first; sa; sa= sa->next) {
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_SEQ) {
- ARegion *ar_preview;
- ListBase *regionbase;
-
- if (sl == sa->spacedata.first) {
- regionbase = &sa->regionbase;
- }
- else {
- regionbase = &sl->regionbase;
- }
-
- ar_preview = (ARegion*)regionbase->first;
- for (; ar_preview; ar_preview = ar_preview->next) {
- if (ar_preview->regiontype == RGN_TYPE_PREVIEW)
- break;
- }
- if (ar_preview && (ar_preview->regiontype == RGN_TYPE_PREVIEW)) {
- sequencer_init_preview_region(ar_preview);
- }
- }
- }
- }
- }
- } /* sequencer changes */
- }
-
- if (main->versionfile <= 251) { /* 2.5.1 had no subversions */
- bScreen *sc;
-
- /* Blender 2.5.2 - subversion 0 introduced a new setting: V3D_RENDER_OVERRIDE.
- * This bit was used in the past for V3D_TRANSFORM_SNAP, which is now deprecated.
- * Here we clear it for old files so they don't come in with V3D_RENDER_OVERRIDE set,
- * which would cause cameras, lamps, etc to become invisible */
- for (sc= main->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa;
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- SpaceLink *sl;
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_VIEW3D) {
- View3D* v3d = (View3D *)sl;
- v3d->flag2 &= ~V3D_RENDER_OVERRIDE;
- }
- }
- }
- }
- }
-
- if (main->versionfile < 252 || (main->versionfile == 252 && main->subversionfile < 1)) {
- Brush *brush;
- Object *ob;
- Scene *scene;
- bNodeTree *ntree;
-
- for (brush= main->brush.first; brush; brush= brush->id.next) {
- if (brush->curve) brush->curve->preset = CURVE_PRESET_SMOOTH;
- }
-
- /* properly initialize active flag for fluidsim modifiers */
- for (ob = main->object.first; ob; ob = ob->id.next) {
- ModifierData *md;
- for (md= ob->modifiers.first; md; md= md->next) {
- if (md->type == eModifierType_Fluidsim) {
- FluidsimModifierData *fmd = (FluidsimModifierData *)md;
- fmd->fss->flag |= OB_FLUIDSIM_ACTIVE;
- fmd->fss->flag |= OB_FLUIDSIM_OVERRIDE_TIME;
- }
- }
- }
-
- /* adjustment to color balance node values */
- for (scene= main->scene.first; scene; scene= scene->id.next) {
- if (scene->nodetree) {
- bNode *node=scene->nodetree->nodes.first;
-
- while (node) {
- if (node->type == CMP_NODE_COLORBALANCE) {
- NodeColorBalance *n= (NodeColorBalance *)node->storage;
- n->lift[0] += 1.f;
- n->lift[1] += 1.f;
- n->lift[2] += 1.f;
- }
- node= node->next;
- }
- }
- }
- /* check inside node groups too */
- for (ntree= main->nodetree.first; ntree; ntree=ntree->id.next) {
- bNode *node=ntree->nodes.first;
-
- while (node) {
- if (node->type == CMP_NODE_COLORBALANCE) {
- NodeColorBalance *n= (NodeColorBalance *)node->storage;
- n->lift[0] += 1.f;
- n->lift[1] += 1.f;
- n->lift[2] += 1.f;
- }
- node= node->next;
- }
- }
- }
-
- /* old-track -> constraints (this time we're really doing it!) */
- if (main->versionfile < 252 || (main->versionfile == 252 && main->subversionfile < 2)) {
- Object *ob;
-
- for (ob = main->object.first; ob; ob = ob->id.next)
- blo_do_version_old_trackto_to_constraints(ob);
- }
-
- if (main->versionfile < 252 || (main->versionfile == 252 && main->subversionfile < 5)) {
- bScreen *sc;
-
- /* Image editor scopes */
- for (sc= main->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa;
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- SpaceLink *sl;
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_IMAGE) {
- SpaceImage *sima = (SpaceImage *)sl;
- scopes_new(&sima->scopes);
- }
- }
- }
- }
- }
-
-
- if (main->versionfile < 253) {
- Object *ob;
- Scene *scene;
- bScreen *sc;
- Tex *tex;
- Brush *brush;
-
- for (sc= main->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa;
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- SpaceLink *sl;
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype == SPACE_NODE) {
- SpaceNode *snode= (SpaceNode *)sl;
- ListBase *regionbase;
- ARegion *ar;
-
- if (sl == sa->spacedata.first)
- regionbase = &sa->regionbase;
- else
- regionbase = &sl->regionbase;
-
- if (snode->v2d.minzoom > 0.09f)
- snode->v2d.minzoom= 0.09f;
- if (snode->v2d.maxzoom < 2.31f)
- snode->v2d.maxzoom= 2.31f;
-
- for (ar= regionbase->first; ar; ar= ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- if (ar->v2d.minzoom > 0.09f)
- ar->v2d.minzoom= 0.09f;
- if (ar->v2d.maxzoom < 2.31f)
- ar->v2d.maxzoom= 2.31f;
- }
- }
- }
- else if (sl->spacetype == SPACE_TIME) {
- SpaceTime *stime= (SpaceTime *)sl;
-
- /* enable all cache display */
- stime->cache_display |= TIME_CACHE_DISPLAY;
- stime->cache_display |= (TIME_CACHE_SOFTBODY|TIME_CACHE_PARTICLES);
- stime->cache_display |= (TIME_CACHE_CLOTH|TIME_CACHE_SMOKE|TIME_CACHE_DYNAMICPAINT);
- }
- }
- }
- }
-
- do_version_mdef_250(main);
-
- /* parent type to modifier */
- for (ob = main->object.first; ob; ob = ob->id.next) {
- if (ob->parent) {
- Object *parent= (Object *)blo_do_versions_newlibadr(fd, lib, ob->parent);
- if (parent) { /* parent may not be in group */
- if (parent->type==OB_ARMATURE && ob->partype==PARSKEL) {
- ArmatureModifierData *amd;
- bArmature *arm= (bArmature *)blo_do_versions_newlibadr(fd, lib, parent->data);
-
- amd = (ArmatureModifierData*) modifier_new(eModifierType_Armature);
- amd->object = ob->parent;
- BLI_addtail((ListBase*)&ob->modifiers, amd);
- amd->deformflag= arm->deformflag;
- ob->partype = PAROBJECT;
- }
- else if (parent->type==OB_LATTICE && ob->partype==PARSKEL) {
- LatticeModifierData *lmd;
-
- lmd = (LatticeModifierData*) modifier_new(eModifierType_Lattice);
- lmd->object = ob->parent;
- BLI_addtail((ListBase*)&ob->modifiers, lmd);
- ob->partype = PAROBJECT;
- }
- else if (parent->type==OB_CURVE && ob->partype==PARCURVE) {
- CurveModifierData *cmd;
-
- cmd = (CurveModifierData*) modifier_new(eModifierType_Curve);
- cmd->object = ob->parent;
- BLI_addtail((ListBase*)&ob->modifiers, cmd);
- ob->partype = PAROBJECT;
- }
- }
- }
- }
-
- /* initialize scene active layer */
- for (scene= main->scene.first; scene; scene=scene->id.next) {
- int i;
- for (i=0; i<20; i++) {
- if (scene->lay & (1<<i)) {
- scene->layact= 1<<i;
- break;
- }
- }
- }
-
- for (tex= main->tex.first; tex; tex= tex->id.next) {
- /* if youre picky, this isn't correct until we do a version bump
- * since you could set saturation to be 0.0*/
- if (tex->saturation==0.0f)
- tex->saturation= 1.0f;
- }
-
- {
- Curve *cu;
- for (cu= main->curve.first; cu; cu= cu->id.next) {
- cu->smallcaps_scale= 0.75f;
- }
- }
-
- for (scene= main->scene.first; scene; scene=scene->id.next) {
- if (scene) {
- Sequence *seq;
- SEQ_BEGIN (scene->ed, seq)
- {
- if (seq->sat==0.0f) {
- seq->sat= 1.0f;
- }
- }
- SEQ_END
- }
- }
-
- /* GSOC 2010 Sculpt - New settings for Brush */
-
- for (brush= main->brush.first; brush; brush= brush->id.next) {
- /* Sanity Check */
-
- // infinite number of dabs
- if (brush->spacing == 0)
- brush->spacing = 10;
-
- // will have no effect
- if (brush->alpha == 0)
- brush->alpha = 0.5f;
-
- // bad radius
- if (brush->unprojected_radius == 0)
- brush->unprojected_radius = 0.125f;
-
- // unusable size
- if (brush->size == 0)
- brush->size = 35;
-
- // can't see overlay
- if (brush->texture_overlay_alpha == 0)
- brush->texture_overlay_alpha = 33;
-
- // same as draw brush
- if (brush->crease_pinch_factor == 0)
- brush->crease_pinch_factor = 0.5f;
-
- // will sculpt no vertexes
- if (brush->plane_trim == 0)
- brush->plane_trim = 0.5f;
-
- // same as smooth stroke off
- if (brush->smooth_stroke_radius == 0)
- brush->smooth_stroke_radius= 75;
-
- // will keep cursor in one spot
- if (brush->smooth_stroke_radius == 1)
- brush->smooth_stroke_factor= 0.9f;
-
- // same as dots
- if (brush->rate == 0)
- brush->rate = 0.1f;
-
- /* New Settings */
- if (main->versionfile < 252 || (main->versionfile == 252 && main->subversionfile < 5)) {
- brush->flag |= BRUSH_SPACE_ATTEN; // explicitly enable adaptive space
-
- // spacing was originally in pixels, convert it to percentage for new version
- // size should not be zero due to sanity check above
- brush->spacing = (int)(100*((float)brush->spacing) / ((float)brush->size));
-
- if (brush->add_col[0] == 0 &&
- brush->add_col[1] == 0 &&
- brush->add_col[2] == 0)
- {
- brush->add_col[0] = 1.00f;
- brush->add_col[1] = 0.39f;
- brush->add_col[2] = 0.39f;
- }
-
- if (brush->sub_col[0] == 0 &&
- brush->sub_col[1] == 0 &&
- brush->sub_col[2] == 0)
- {
- brush->sub_col[0] = 0.39f;
- brush->sub_col[1] = 0.39f;
- brush->sub_col[2] = 1.00f;
- }
- }
- }
- }
-
- /* GSOC Sculpt 2010 - Sanity check on Sculpt/Paint settings */
- if (main->versionfile < 253) {
- Scene *sce;
- for (sce= main->scene.first; sce; sce= sce->id.next) {
- if (sce->toolsettings->sculpt_paint_unified_alpha == 0)
- sce->toolsettings->sculpt_paint_unified_alpha = 0.5f;
-
- if (sce->toolsettings->sculpt_paint_unified_unprojected_radius == 0)
- sce->toolsettings->sculpt_paint_unified_unprojected_radius = 0.125f;
-
- if (sce->toolsettings->sculpt_paint_unified_size == 0)
- sce->toolsettings->sculpt_paint_unified_size = 35;
- }
- }
-
- if (main->versionfile < 253 || (main->versionfile == 253 && main->subversionfile < 1)) {
- Object *ob;
-
- for (ob = main->object.first; ob; ob = ob->id.next) {
- ModifierData *md;
- for (md= ob->modifiers.first; md; md= md->next) {
- if (md->type == eModifierType_Smoke) {
- SmokeModifierData *smd = (SmokeModifierData *)md;
-
- if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) {
- smd->domain->vorticity = 2.0f;
- smd->domain->time_scale = 1.0f;
-
- if (!(smd->domain->flags & (1<<4)))
- continue;
-
- /* delete old MOD_SMOKE_INITVELOCITY flag */
- smd->domain->flags &= ~(1<<4);
-
- /* for now just add it to all flow objects in the scene */
- {
- Object *ob2;
- for (ob2 = main->object.first; ob2; ob2 = ob2->id.next) {
- ModifierData *md2;
- for (md2= ob2->modifiers.first; md2; md2= md2->next) {
- if (md2->type == eModifierType_Smoke) {
- SmokeModifierData *smd2 = (SmokeModifierData *)md2;
-
- if ((smd2->type & MOD_SMOKE_TYPE_FLOW) && smd2->flow) {
- smd2->flow->flags |= MOD_SMOKE_FLOW_INITVELOCITY;
- }
- }
- }
- }
- }
-
- }
- else if ((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow) {
- smd->flow->vel_multi = 1.0f;
- }
-
- }
- }
- }
- }
-
- if (main->versionfile < 255 || (main->versionfile == 255 && main->subversionfile < 1)) {
- Brush *br;
- ParticleSettings *part;
- bScreen *sc;
- Object *ob;
-
- for (br= main->brush.first; br; br= br->id.next) {
- if (br->ob_mode==0)
- br->ob_mode= OB_MODE_ALL_PAINT;
- }
-
- for (part = main->particle.first; part; part = part->id.next) {
- if (part->boids)
- part->boids->pitch = 1.0f;
-
- part->flag &= ~PART_HAIR_REGROW; /* this was a deprecated flag before */
- part->kink_amp_clump = 1.f; /* keep old files looking similar */
- }
-
- for (sc= main->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa;
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- SpaceLink *sl;
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype == SPACE_INFO) {
- SpaceInfo *sinfo= (SpaceInfo *)sl;
- ARegion *ar;
-
- sinfo->rpt_mask= INFO_RPT_OP;
-
- for (ar= sa->regionbase.first; ar; ar= ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- ar->v2d.scroll = (V2D_SCROLL_RIGHT);
- ar->v2d.align = V2D_ALIGN_NO_NEG_X|V2D_ALIGN_NO_NEG_Y; /* align bottom left */
- ar->v2d.keepofs = V2D_LOCKOFS_X;
- ar->v2d.keepzoom = (V2D_LOCKZOOM_X|V2D_LOCKZOOM_Y|V2D_LIMITZOOM|V2D_KEEPASPECT);
- ar->v2d.keeptot= V2D_KEEPTOT_BOUNDS;
- ar->v2d.minzoom= ar->v2d.maxzoom= 1.0f;
- }
- }
- }
- }
- }
- }
-
- /* fix rotation actuators for objects so they use real angles (radians)
- * since before blender went opensource this strange scalar was used: (1 / 0.02) * 2 * math.pi/360 */
- for (ob= main->object.first; ob; ob= ob->id.next) {
- bActuator *act= ob->actuators.first;
- while (act) {
- if (act->type==ACT_OBJECT) {
- /* multiply velocity with 50 in old files */
- bObjectActuator *oa= act->data;
- mul_v3_fl(oa->drot, 0.8726646259971648f);
- }
- act= act->next;
- }
- }
- }
-
- // init facing axis property of steering actuators
- {
- Object *ob;
- for (ob = main->object.first; ob; ob = ob->id.next) {
- bActuator *act;
- for (act= ob->actuators.first; act; act= act->next) {
- if (act->type==ACT_STEERING) {
- bSteeringActuator* stact = act->data;
- if (stact->facingaxis==0) {
- stact->facingaxis=1;
- }
- }
- }
- }
- }
-
- if (main->versionfile < 255 || (main->versionfile == 255 && main->subversionfile < 3)) {
- Object *ob;
-
- /* ocean res is now squared, reset old ones - will be massive */
- for (ob = main->object.first; ob; ob = ob->id.next) {
- ModifierData *md;
- for (md= ob->modifiers.first; md; md= md->next) {
- if (md->type == eModifierType_Ocean) {
- OceanModifierData *omd = (OceanModifierData *)md;
- omd->resolution = 7;
- omd->oceancache = NULL;
- }
- }
- }
- }
-
- if (main->versionfile < 256) {
- bScreen *sc;
- ScrArea *sa;
- Key *key;
-
- /* Fix for sample line scope initializing with no height */
- for (sc= main->screen.first; sc; sc= sc->id.next) {
- sa= sc->areabase.first;
- while (sa) {
- SpaceLink *sl;
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_IMAGE) {
- SpaceImage *sima= (SpaceImage *)sl;
- if (sima->sample_line_hist.height == 0 )
- sima->sample_line_hist.height = 100;
- }
- }
- sa= sa->next;
- }
- }
-
- /* old files could have been saved with slidermin = slidermax = 0.0, but the UI in
- * 2.4x would never reveal this to users as a dummy value always ended up getting used
- * instead
- */
- for (key = main->key.first; key; key = key->id.next) {
- KeyBlock *kb;
-
- for (kb = key->block.first; kb; kb = kb->next) {
- if (IS_EQF(kb->slidermin, kb->slidermax) && IS_EQ(kb->slidermax, 0))
- kb->slidermax = kb->slidermin + 1.0f;
- }
- }
- }
-
- if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 1)) {
- /* fix for bones that didn't have arm_roll before */
- bArmature* arm;
- Bone* bone;
- Object *ob;
-
- for (arm = main->armature.first; arm; arm = arm->id.next)
- for (bone = arm->bonebase.first; bone; bone = bone->next)
- do_version_bone_roll_256(bone);
-
- /* fix for objects which have zero dquat's
- * since this is multiplied with the quat rather than added */
- for (ob= main->object.first; ob; ob= ob->id.next) {
- if (is_zero_v4(ob->dquat)) {
- unit_qt(ob->dquat);
- }
- if (is_zero_v3(ob->drotAxis) && ob->drotAngle == 0.0f) {
- unit_axis_angle(ob->drotAxis, &ob->drotAngle);
- }
- }
- }
-
- if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 2)) {
- bNodeTree *ntree;
-
- /* node sockets are not exposed automatically any more,
- * this mimics the old behavior by adding all unlinked sockets to groups.
- */
- for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) {
- /* XXX Only setting a flag here. Actual adding of group sockets
- * is done in lib_verify_nodetree, because at this point the internal
- * nodes may not be up-to-date! (missing lib-link)
- */
- ntree->flag |= NTREE_DO_VERSIONS_GROUP_EXPOSE;
- }
- }
-
- if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile <3)) {
- bScreen *sc;
- Brush *brush;
- Object *ob;
- ParticleSettings *part;
- Material *mat;
- int tex_nr, transp_tex;
-
- for (mat = main->mat.first; mat; mat = mat->id.next) {
- if (!(mat->mode & MA_TRANSP) && !(mat->material_type & MA_TYPE_VOLUME)) {
-
- transp_tex= 0;
-
- for (tex_nr=0; tex_nr<MAX_MTEX; tex_nr++) {
- if (!mat->mtex[tex_nr]) continue;
- if (mat->mtex[tex_nr]->mapto & MAP_ALPHA) transp_tex= 1;
- }
-
- /* weak! material alpha could be animated */
- if (mat->alpha < 1.0f || mat->fresnel_tra > 0.0f || transp_tex) {
- mat->mode |= MA_TRANSP;
- mat->mode &= ~(MA_ZTRANSP|MA_RAYTRANSP);
- }
- }
- }
-
- /* redraws flag in SpaceTime has been moved to Screen level */
- for (sc = main->screen.first; sc; sc= sc->id.next) {
- if (sc->redraws_flag == 0) {
- /* just initialize to default? */
- // XXX: we could also have iterated through areas, and taken them from the first timeline available...
- sc->redraws_flag = TIME_ALL_3D_WIN|TIME_ALL_ANIM_WIN;
- }
- }
-
- for (brush= main->brush.first; brush; brush= brush->id.next) {
- if (brush->height == 0)
- brush->height= 0.4f;
- }
-
- /* replace 'rim material' option for in offset*/
- for (ob = main->object.first; ob; ob = ob->id.next) {
- ModifierData *md;
- for (md= ob->modifiers.first; md; md= md->next) {
- if (md->type == eModifierType_Solidify) {
- SolidifyModifierData *smd = (SolidifyModifierData *)md;
- if (smd->flag & MOD_SOLIDIFY_RIM_MATERIAL) {
- smd->mat_ofs_rim= 1;
- smd->flag &= ~MOD_SOLIDIFY_RIM_MATERIAL;
- }
- }
- }
- }
-
- /* particle draw color from material */
- for (part = main->particle.first; part; part = part->id.next) {
- if (part->draw & PART_DRAW_MAT_COL)
- part->draw_col = PART_DRAW_COL_MAT;
- }
- }
-
- if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 6)) {
- Mesh *me;
-
- for (me = main->mesh.first; me; me = me->id.next)
- BKE_mesh_calc_normals_tessface(me->mvert, me->totvert, me->mface, me->totface, NULL);
- }
-
- if (main->versionfile < 256 || (main->versionfile == 256 && main->subversionfile < 2)) {
- /* update blur area sizes from 0..1 range to 0..100 percentage */
- Scene *scene;
- bNode *node;
- for (scene=main->scene.first; scene; scene=scene->id.next)
- if (scene->nodetree)
- for (node=scene->nodetree->nodes.first; node; node=node->next)
- if (node->type==CMP_NODE_BLUR) {
- NodeBlurData *nbd= node->storage;
- nbd->percentx *= 100.0f;
- nbd->percenty *= 100.0f;
- }
- }
-
- if (main->versionfile < 258 || (main->versionfile == 258 && main->subversionfile < 1)) {
- /* screen view2d settings were not properly initialized [#27164]
- * v2d->scroll caused the bug but best reset other values too which are in old blend files only.
- * need to make less ugly - possibly an iterator? */
- bScreen *screen;
- for (screen= main->screen.first; screen; screen= screen->id.next) {
- ScrArea *sa;
- /* add regions */
- for (sa= screen->areabase.first; sa; sa= sa->next) {
- SpaceLink *sl= sa->spacedata.first;
- if (sl->spacetype==SPACE_IMAGE) {
- ARegion *ar;
- for (ar=sa->regionbase.first; ar; ar= ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- View2D *v2d= &ar->v2d;
- v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0;
- }
- }
- }
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_IMAGE) {
- ARegion *ar;
- for (ar=sl->regionbase.first; ar; ar= ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- View2D *v2d= &ar->v2d;
- v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0;
- }
- }
- }
- }
- }
- }
-
- {
- /* Initialize texture point density curve falloff */
- Tex *tex;
- for (tex= main->tex.first; tex; tex= tex->id.next) {
- if (tex->pd) {
- if (tex->pd->falloff_speed_scale == 0.0f)
- tex->pd->falloff_speed_scale = 100.0f;
-
- if (!tex->pd->falloff_curve) {
- tex->pd->falloff_curve = curvemapping_add(1, 0, 0, 1, 1);
-
- tex->pd->falloff_curve->preset = CURVE_PRESET_LINE;
- tex->pd->falloff_curve->cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
- curvemap_reset(tex->pd->falloff_curve->cm, &tex->pd->falloff_curve->clipr, tex->pd->falloff_curve->preset, CURVEMAP_SLOPE_POSITIVE);
- curvemapping_changed(tex->pd->falloff_curve, 0);
- }
- }
- }
- }
-
- {
- /* add default value for behind strength of camera actuator */
- Object *ob;
- bActuator *act;
- for (ob = main->object.first; ob; ob= ob->id.next) {
- for (act= ob->actuators.first; act; act= act->next) {
- if (act->type == ACT_CAMERA) {
- bCameraActuator *ba= act->data;
-
- ba->damping = 1.0/32.0;
- }
- }
- }
- }
-
- {
- ParticleSettings *part;
- for (part = main->particle.first; part; part = part->id.next) {
- /* Initialize particle billboard scale */
- part->bb_size[0] = part->bb_size[1] = 1.0f;
- }
- }
- }
-
- if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 1)) {
- {
- Scene *scene;
- Sequence *seq;
-
- for (scene=main->scene.first; scene; scene=scene->id.next) {
- scene->r.ffcodecdata.audio_channels = 2;
- scene->audio.volume = 1.0f;
- SEQ_BEGIN (scene->ed, seq)
- {
- seq->pitch = 1.0f;
- }
- SEQ_END
- }
- }
- {
- bScreen *screen;
- for (screen= main->screen.first; screen; screen= screen->id.next) {
- ScrArea *sa;
- /* add regions */
- for (sa= screen->areabase.first; sa; sa= sa->next) {
- SpaceLink *sl= sa->spacedata.first;
- if (sl->spacetype==SPACE_SEQ) {
- ARegion *ar;
- for (ar=sa->regionbase.first; ar; ar= ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- if (ar->v2d.min[1] == 4.0f)
- ar->v2d.min[1]= 0.5f;
- }
- }
- }
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_SEQ) {
- ARegion *ar;
- for (ar=sl->regionbase.first; ar; ar= ar->next) {
- if (ar->regiontype == RGN_TYPE_WINDOW) {
- if (ar->v2d.min[1] == 4.0f)
- ar->v2d.min[1]= 0.5f;
- }
- }
- }
- }
- }
- }
- }
- {
- /* Make "auto-clamped" handles a per-keyframe setting instead of per-FCurve
- *
- * We're only patching F-Curves in Actions here, since it is assumed that most
- * drivers out there won't be using this (and if they are, they're in the minority).
- * While we should aim to fix everything ideally, in practice it's far too hard
- * to get to every animdata block, not to mention the performance hit that'd have
- */
- bAction *act;
- FCurve *fcu;
-
- for (act = main->action.first; act; act = act->id.next) {
- for (fcu = act->curves.first; fcu; fcu = fcu->next) {
- BezTriple *bezt;
- unsigned int i = 0;
-
- /* only need to touch curves that had this flag set */
- if ((fcu->flag & FCURVE_AUTO_HANDLES) == 0)
- continue;
- if ((fcu->totvert == 0) || (fcu->bezt == NULL))
- continue;
-
- /* only change auto-handles to auto-clamped */
- for (bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
- if (bezt->h1 == HD_AUTO) bezt->h1 = HD_AUTO_ANIM;
- if (bezt->h2 == HD_AUTO) bezt->h2 = HD_AUTO_ANIM;
- }
-
- fcu->flag &= ~FCURVE_AUTO_HANDLES;
- }
- }
- }
- {
- /* convert fcurve and shape action actuators to action actuators */
- Object *ob;
- bActuator *act;
- bIpoActuator *ia;
- bActionActuator *aa;
-
- for (ob= main->object.first; ob; ob= ob->id.next) {
- for (act= ob->actuators.first; act; act= act->next) {
- if (act->type == ACT_IPO) {
- // Create the new actuator
- ia= act->data;
- aa= MEM_callocN(sizeof(bActionActuator), "fcurve -> action actuator do_version");
-
- // Copy values
- aa->type = ia->type;
- aa->flag = ia->flag;
- aa->sta = ia->sta;
- aa->end = ia->end;
- BLI_strncpy(aa->name, ia->name, sizeof(aa->name));
- BLI_strncpy(aa->frameProp, ia->frameProp, sizeof(aa->frameProp));
- if (ob->adt)
- aa->act = ob->adt->action;
-
- // Get rid of the old actuator
- MEM_freeN(ia);
-
- // Assign the new actuator
- act->data = aa;
- act->type= act->otype= ACT_ACTION;
-
- }
- else if (act->type == ACT_SHAPEACTION) {
- act->type = act->otype = ACT_ACTION;
- }
- }
- }
- }
- }
-
- if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 2)) {
- {
- /* Convert default socket values from bNodeStack */
- Scene *sce;
- Material *mat;
- Tex *tex;
- bNodeTree *ntree;
- for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) {
- blo_do_versions_nodetree_default_value(ntree);
- ntree->update |= NTREE_UPDATE;
- }
- for (sce=main->scene.first; sce; sce=sce->id.next)
- if (sce->nodetree) {
- blo_do_versions_nodetree_default_value(sce->nodetree);
- sce->nodetree->update |= NTREE_UPDATE;
- }
- for (mat=main->mat.first; mat; mat=mat->id.next)
- if (mat->nodetree) {
- blo_do_versions_nodetree_default_value(mat->nodetree);
- mat->nodetree->update |= NTREE_UPDATE;
- }
- for (tex=main->tex.first; tex; tex=tex->id.next)
- if (tex->nodetree) {
- blo_do_versions_nodetree_default_value(tex->nodetree);
- tex->nodetree->update |= NTREE_UPDATE;
- }
- }
-
- /* add SOCK_DYNAMIC flag to existing group sockets */
- {
- bNodeTree *ntree;
- /* only need to do this for trees in main, local trees are not used as groups */
- for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next) {
- do_versions_nodetree_dynamic_sockets(ntree);
- ntree->update |= NTREE_UPDATE;
- }
- }
-
- {
- /* Initialize group tree nodetypes.
- * These are used to distinguish tree types and
- * associate them with specific node types for polling.
- */
- bNodeTree *ntree;
- /* all node trees in main->nodetree are considered groups */
- for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next)
- ntree->nodetype = NODE_GROUP;
- }
- }
-
- if (main->versionfile < 259 || (main->versionfile == 259 && main->subversionfile < 4)) {
- {
- /* Adaptive time step for particle systems */
- ParticleSettings *part;
- for (part = main->particle.first; part; part = part->id.next) {
- part->courant_target = 0.2f;
- part->time_flag &= ~PART_TIME_AUTOSF;
- }
- }
-
- {
- /* set defaults for obstacle avoidance, recast data */
- Scene *sce;
- for (sce = main->scene.first; sce; sce = sce->id.next) {
- if (sce->gm.levelHeight == 0.f)
- sce->gm.levelHeight = 2.f;
-
- if (sce->gm.recastData.cellsize == 0.0f)
- sce->gm.recastData.cellsize = 0.3f;
- if (sce->gm.recastData.cellheight == 0.0f)
- sce->gm.recastData.cellheight = 0.2f;
- if (sce->gm.recastData.agentmaxslope == 0.0f)
- sce->gm.recastData.agentmaxslope = (float)M_PI/4;
- if (sce->gm.recastData.agentmaxclimb == 0.0f)
- sce->gm.recastData.agentmaxclimb = 0.9f;
- if (sce->gm.recastData.agentheight == 0.0f)
- sce->gm.recastData.agentheight = 2.0f;
- if (sce->gm.recastData.agentradius == 0.0f)
- sce->gm.recastData.agentradius = 0.6f;
- if (sce->gm.recastData.edgemaxlen == 0.0f)
- sce->gm.recastData.edgemaxlen = 12.0f;
- if (sce->gm.recastData.edgemaxerror == 0.0f)
- sce->gm.recastData.edgemaxerror = 1.3f;
- if (sce->gm.recastData.regionminsize == 0.0f)
- sce->gm.recastData.regionminsize = 8.f;
- if (sce->gm.recastData.regionmergesize == 0.0f)
- sce->gm.recastData.regionmergesize = 20.f;
- if (sce->gm.recastData.vertsperpoly<3)
- sce->gm.recastData.vertsperpoly = 6;
- if (sce->gm.recastData.detailsampledist == 0.0f)
- sce->gm.recastData.detailsampledist = 6.0f;
- if (sce->gm.recastData.detailsamplemaxerror == 0.0f)
- sce->gm.recastData.detailsamplemaxerror = 1.0f;
- }
- }
- }
-
- /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
- /* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
-
- /* don't forget to set version number in blender.c! */
-}
diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c
deleted file mode 100644
index 759a2ea595f..00000000000
--- a/source/blender/blenloader/intern/versioning_legacy.c
+++ /dev/null
@@ -1,3560 +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.
- *
- *
- * Contributor(s): Blender Foundation
- *
- * ***** END GPL LICENSE BLOCK *****
- *
- */
-
-/** \file blender/blenloader/intern/readfile_pre250.c
- * \ingroup blenloader
- */
-
-
-#include "zlib.h"
-
-#include <limits.h>
-
-#ifndef WIN32
-# include <unistd.h> // for read close
-#else
-# include <io.h> // for open close read
-# include "winsock2.h"
-# include "BLI_winstuff.h"
-#endif
-
-/* allow readfile to use deprecated functionality */
-#define DNA_DEPRECATED_ALLOW
-
-#include "DNA_armature_types.h"
-#include "DNA_actuator_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_effect_types.h"
-#include "DNA_group_types.h"
-#include "DNA_key_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_nla_types.h"
-#include "DNA_node_types.h"
-#include "DNA_object_fluidsim.h" // NT
-#include "DNA_object_types.h"
-#include "DNA_property_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_sensor_types.h"
-#include "DNA_sdna_types.h"
-#include "DNA_sequence_types.h"
-#include "DNA_sound_types.h"
-#include "DNA_space_types.h"
-#include "DNA_vfont_types.h"
-#include "DNA_world_types.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_utildefines.h"
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-#include "BLI_edgehash.h"
-
-#include "BKE_armature.h"
-#include "BKE_colortools.h"
-#include "BKE_constraint.h"
-#include "BKE_deform.h"
-#include "BKE_fcurve.h"
-#include "BKE_global.h" // for G
-#include "BKE_image.h"
-#include "BKE_lattice.h"
-#include "BKE_main.h" // for Main
-#include "BKE_mesh.h" // for ME_ defines (patching)
-#include "BKE_modifier.h"
-#include "BKE_particle.h"
-#include "BKE_pointcache.h"
-#include "BKE_property.h" // for get_ob_property
-#include "BKE_scene.h"
-#include "BKE_sequencer.h"
-#include "BKE_utildefines.h" // SWITCH_INT DATA ENDB DNA1 O_BINARY GLOB USER TEST REND
-
-#include "IMB_imbuf.h" // for proxy / timecode versioning stuff
-
-#include "NOD_socket.h"
-
-//XXX #include "BIF_butspace.h" // badlevel, for do_versions, patching event codes
-//XXX #include "BIF_filelist.h" // badlevel too, where to move this? - elubie
-//XXX #include "BIF_previewrender.h" // bedlelvel, for struct RenderInfo
-#include "BLO_readfile.h"
-#include "BLO_undofile.h"
-
-#include "RE_engine.h"
-
-#include "readfile.h"
-
-#include "PIL_time.h"
-
-#include <errno.h>
-
-static void vcol_to_fcol(Mesh *me)
-{
- MFace *mface;
- unsigned int *mcol, *mcoln, *mcolmain;
- int a;
-
- if (me->totface==0 || me->mcol==NULL) return;
-
- 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;
- }
-
- MEM_freeN(me->mcol);
- me->mcol= (MCol *)mcolmain;
-}
-
-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_version_bone_head_tail_237(Bone *bone)
-{
- 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 bone_version_239(ListBase *lb)
-{
- Bone *bone;
-
- for (bone= lb->first; bone; bone= bone->next) {
- if (bone->layer==0)
- bone->layer= 1;
- bone_version_239(&bone->childbase);
- }
-}
-
-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 ntree_version_242(bNodeTree *ntree)
-{
- bNode *node;
-
- 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");
- }
-
-}
-
-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;
- }
- }
-
- /* fix for temporary flag changes during 245 cycle */
- nodeid= blo_do_versions_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= blo_do_versions_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;
- }
- }
- }
-}
-
-static void customdata_version_242(Mesh *me)
-{
- CustomDataLayer *layer;
- MTFace *mtf;
- MCol *mcol;
- TFace *tf;
- int a, mtfacen, mcoln;
-
- if (!me->vdata.totlayer) {
- CustomData_add_layer(&me->vdata, CD_MVERT, CD_ASSIGN, me->mvert, me->totvert);
-
- 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);
- }
-
- 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);
-
- if (me->tface) {
- if (me->mcol)
- MEM_freeN(me->mcol);
-
- 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;
- }
- else if (me->mcol) {
- me->mcol= CustomData_add_layer(&me->fdata, CD_MCOL, CD_ASSIGN, me->mcol, me->totface);
- }
- }
-
- 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++;
- }
- 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++;
- }
- }
-
- mesh_update_customdata_pointers(me, TRUE);
-}
-
-/*only copy render texface layer from active*/
-static void customdata_version_243(Mesh *me)
-{
- CustomDataLayer *layer;
- int a;
-
- for (a=0; a < me->fdata.totlayer; a++) {
- layer= &me->fdata.layers[a];
- layer->active_rnd = layer->active;
- }
-}
-
-/* struct NodeImageAnim moved to ImageUser, and we make it default available */
-static void do_version_ntree_242_2(bNodeTree *ntree)
-{
- bNode *node;
-
- 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);
- }
- else {
- ImageUser *iuser= node->storage= MEM_callocN(sizeof(ImageUser), "node image user");
- iuser->sfra= 1;
- iuser->fie_ima= 2;
- iuser->ok= 1;
- }
- }
- }
- }
-}
-
-static void do_version_free_effect_245(Effect *eff)
-{
- PartEff *paf;
-
- if (eff->type==EFF_PARTICLE) {
- paf= (PartEff *)eff;
- if (paf->keys) MEM_freeN(paf->keys);
- }
- MEM_freeN(eff);
-}
-
-static void do_version_free_effects_245(ListBase *lb)
-{
- Effect *eff;
-
- eff= lb->first;
- while (eff) {
- BLI_remlink(lb, eff);
- do_version_free_effect_245(eff);
- eff= lb->first;
- }
-}
-
-PartEff *blo_do_version_give_parteff_245(Object *ob)
-{
- PartEff *paf;
-
- paf= ob->effect.first;
- while (paf) {
- if (paf->type==EFF_PARTICLE) return paf;
- paf= paf->next;
- }
- return NULL;
-}
-
-/* NOTE: this version patch is intended for versions < 2.52.2, but was initially introduced in 2.27 already */
-void blo_do_version_old_trackto_to_constraints(Object *ob)
-{
- /* create new trackto constraint from the relationship */
- if (ob->track) {
- bConstraint *con= add_ob_constraint(ob, "AutoTrack", CONSTRAINT_TYPE_TRACKTO);
- bTrackToConstraint *data = con->data;
-
- /* copy tracking settings from the object */
- data->tar = ob->track;
- data->reserved1 = ob->trackflag;
- data->reserved2 = ob->upflag;
- }
-
- /* clear old track setting */
- ob->track = NULL;
-}
-
-void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
-{
- /* WATCH IT!!!: pointers from libdata have not been converted */
-
- if (main->versionfile == 100) {
- /* tex->extend and tex->imageflag have changed: */
- Tex *tex = main->tex.first;
- while (tex) {
- if (tex->id.flag & LIB_NEEDLINK) {
-
- if (tex->extend==0) {
- if (tex->xrepeat || tex->yrepeat) tex->extend= TEX_REPEAT;
- else {
- tex->extend= TEX_EXTEND;
- tex->xrepeat= tex->yrepeat= 1;
- }
- }
-
- }
- tex= tex->id.next;
- }
- }
- if (main->versionfile <= 101) {
- /* frame mapping */
- Scene *sce = main->scene.first;
- while (sce) {
- sce->r.framapto= 100;
- sce->r.images= 100;
- sce->r.framelen= 1.0;
- sce= sce->id.next;
- }
- }
- if (main->versionfile <= 102) {
- /* init halo's at 1.0 */
- Material *ma = main->mat.first;
- while (ma) {
- ma->add= 1.0;
- ma= ma->id.next;
- }
- }
- if (main->versionfile <= 103) {
- /* new variable in object: colbits */
- Object *ob = main->object.first;
- int a;
- while (ob) {
- ob->colbits= 0;
- if (ob->totcol) {
- for (a=0; a<ob->totcol; a++) {
- if (ob->mat[a]) ob->colbits |= (1<<a);
- }
- }
- ob= ob->id.next;
- }
- }
- if (main->versionfile <= 104) {
- /* timeoffs moved */
- Object *ob = main->object.first;
- while (ob) {
- if (ob->transflag & 1) {
- ob->transflag -= 1;
- //ob->ipoflag |= OB_OFFS_OB;
- }
- ob= ob->id.next;
- }
- }
- if (main->versionfile <= 105) {
- Object *ob = main->object.first;
- while (ob) {
- ob->dupon= 1; ob->dupoff= 0;
- ob->dupsta= 1; ob->dupend= 100;
- ob= ob->id.next;
- }
- }
- if (main->versionfile <= 106) {
- /* mcol changed */
- Mesh *me = main->mesh.first;
- while (me) {
- if (me->mcol) vcol_to_fcol(me);
- me= me->id.next;
- }
-
- }
- if (main->versionfile <= 107) {
- Object *ob;
- Scene *sce = main->scene.first;
- while (sce) {
- sce->r.mode |= R_GAMMA;
- sce= sce->id.next;
- }
- ob= main->object.first;
- while (ob) {
- //ob->ipoflag |= OB_OFFS_PARENT;
- if (ob->dt==0) ob->dt= OB_SOLID;
- ob= ob->id.next;
- }
-
- }
- if (main->versionfile <= 109) {
- /* new variable: gridlines */
- bScreen *sc = main->screen.first;
- while (sc) {
- ScrArea *sa= sc->areabase.first;
- while (sa) {
- SpaceLink *sl= sa->spacedata.first;
- while (sl) {
- if (sl->spacetype==SPACE_VIEW3D) {
- View3D *v3d= (View3D*) sl;
-
- if (v3d->gridlines==0) v3d->gridlines= 20;
- }
- sl= sl->next;
- }
- sa= sa->next;
- }
- sc= sc->id.next;
- }
- }
- if (main->versionfile <= 113) {
- Material *ma = main->mat.first;
- while (ma) {
- if (ma->flaresize==0.0f) ma->flaresize= 1.0f;
- ma->subsize= 1.0f;
- ma->flareboost= 1.0f;
- ma= ma->id.next;
- }
- }
-
- if (main->versionfile <= 134) {
- Tex *tex = main->tex.first;
- while (tex) {
- if ((tex->rfac == 0.0f) &&
- (tex->gfac == 0.0f) &&
- (tex->bfac == 0.0f)) {
- tex->rfac = 1.0f;
- tex->gfac = 1.0f;
- tex->bfac = 1.0f;
- tex->filtersize = 1.0f;
- }
- tex = tex->id.next;
- }
- }
- if (main->versionfile <= 140) {
- /* r-g-b-fac in texture */
- Tex *tex = main->tex.first;
- while (tex) {
- if ((tex->rfac == 0.0f) &&
- (tex->gfac == 0.0f) &&
- (tex->bfac == 0.0f)) {
- tex->rfac = 1.0f;
- tex->gfac = 1.0f;
- tex->bfac = 1.0f;
- tex->filtersize = 1.0f;
- }
- tex = tex->id.next;
- }
- }
- if (main->versionfile <= 153) {
- Scene *sce = main->scene.first;
- while (sce) {
- if (sce->r.blurfac==0.0f) sce->r.blurfac= 1.0f;
- sce= sce->id.next;
- }
- }
- if (main->versionfile <= 163) {
- Scene *sce = main->scene.first;
- while (sce) {
- if (sce->r.frs_sec==0) sce->r.frs_sec= 25;
- sce= sce->id.next;
- }
- }
- if (main->versionfile <= 164) {
- Mesh *me= main->mesh.first;
- while (me) {
- me->smoothresh= 30;
- me= me->id.next;
- }
- }
- if (main->versionfile <= 165) {
- Mesh *me= main->mesh.first;
- TFace *tface;
- int nr;
- char *cp;
-
- while (me) {
- if (me->tface) {
- nr= me->totface;
- tface= me->tface;
- while (nr--) {
- cp= (char *)&tface->col[0];
- if (cp[1]>126) cp[1]= 255; else cp[1]*=2;
- if (cp[2]>126) cp[2]= 255; else cp[2]*=2;
- if (cp[3]>126) cp[3]= 255; else cp[3]*=2;
- cp= (char *)&tface->col[1];
- if (cp[1]>126) cp[1]= 255; else cp[1]*=2;
- if (cp[2]>126) cp[2]= 255; else cp[2]*=2;
- if (cp[3]>126) cp[3]= 255; else cp[3]*=2;
- cp= (char *)&tface->col[2];
- if (cp[1]>126) cp[1]= 255; else cp[1]*=2;
- if (cp[2]>126) cp[2]= 255; else cp[2]*=2;
- if (cp[3]>126) cp[3]= 255; else cp[3]*=2;
- cp= (char *)&tface->col[3];
- if (cp[1]>126) cp[1]= 255; else cp[1]*=2;
- if (cp[2]>126) cp[2]= 255; else cp[2]*=2;
- if (cp[3]>126) cp[3]= 255; else cp[3]*=2;
-
- tface++;
- }
- }
- me= me->id.next;
- }
- }
-
- if (main->versionfile <= 169) {
- Mesh *me= main->mesh.first;
- while (me) {
- if (me->subdiv==0) me->subdiv= 1;
- me= me->id.next;
- }
- }
-
- if (main->versionfile <= 169) {
- bScreen *sc= main->screen.first;
- while (sc) {
- ScrArea *sa= sc->areabase.first;
- while (sa) {
- SpaceLink *sl= sa->spacedata.first;
- while (sl) {
- if (sl->spacetype==SPACE_IPO) {
- SpaceIpo *sipo= (SpaceIpo*) sl;
- sipo->v2d.max[0]= 15000.0;
- }
- sl= sl->next;
- }
- sa= sa->next;
- }
- sc= sc->id.next;
- }
- }
-
- if (main->versionfile <= 170) {
- Object *ob = main->object.first;
- PartEff *paf;
- while (ob) {
- paf = blo_do_version_give_parteff_245(ob);
- if (paf) {
- if (paf->staticstep == 0) {
- paf->staticstep= 5;
- }
- }
- ob = ob->id.next;
- }
- }
-
- if (main->versionfile <= 171) {
- bScreen *sc= main->screen.first;
- while (sc) {
- ScrArea *sa= sc->areabase.first;
- while (sa) {
- SpaceLink *sl= sa->spacedata.first;
- while (sl) {
- if (sl->spacetype==SPACE_TEXT) {
- SpaceText *st= (SpaceText*) sl;
- st->lheight= 12;
- }
- sl= sl->next;
- }
- sa= sa->next;
- }
- sc= sc->id.next;
- }
- }
-
- if (main->versionfile <= 173) {
- int a, b;
- Mesh *me= main->mesh.first;
- while (me) {
- if (me->tface) {
- TFace *tface= me->tface;
- for (a=0; a<me->totface; a++, tface++) {
- for (b=0; b<4; b++) {
- tface->uv[b][0]/= 32767.0f;
- tface->uv[b][1]/= 32767.0f;
- }
- }
- }
- me= me->id.next;
- }
- }
-
- if (main->versionfile <= 191) {
- Object *ob= main->object.first;
- Material *ma = main->mat.first;
-
- /* let faces have default add factor of 0.0 */
- while (ma) {
- if (!(ma->mode & MA_HALO)) ma->add = 0.0;
- ma = ma->id.next;
- }
-
- while (ob) {
- ob->mass= 1.0f;
- ob->damping= 0.1f;
- /*ob->quat[1]= 1.0f;*/ /* quats arnt used yet */
- ob= ob->id.next;
- }
- }
-
- if (main->versionfile <= 193) {
- Object *ob= main->object.first;
- while (ob) {
- ob->inertia= 1.0f;
- ob->rdamping= 0.1f;
- ob= ob->id.next;
- }
- }
-
- if (main->versionfile <= 196) {
- Mesh *me= main->mesh.first;
- int a, b;
- while (me) {
- if (me->tface) {
- TFace *tface= me->tface;
- for (a=0; a<me->totface; a++, tface++) {
- for (b=0; b<4; b++) {
- tface->mode |= TF_DYNAMIC;
- tface->mode &= ~TF_INVISIBLE;
- }
- }
- }
- me= me->id.next;
- }
- }
-
- if (main->versionfile <= 200) {
- Object *ob= main->object.first;
- while (ob) {
- ob->scaflag = ob->gameflag & (OB_DO_FH|OB_ROT_FH|OB_ANISOTROPIC_FRICTION|OB_GHOST|OB_RIGID_BODY|OB_BOUNDS);
- /* 64 is do_fh */
- ob->gameflag &= ~(OB_ROT_FH|OB_ANISOTROPIC_FRICTION|OB_GHOST|OB_RIGID_BODY|OB_BOUNDS);
- ob = ob->id.next;
- }
- }
-
- if (main->versionfile <= 201) {
- /* add-object + end-object are joined to edit-object actuator */
- Object *ob = main->object.first;
- bProperty *prop;
- bActuator *act;
- bIpoActuator *ia;
- bEditObjectActuator *eoa;
- bAddObjectActuator *aoa;
- while (ob) {
- act = ob->actuators.first;
- while (act) {
- if (act->type==ACT_IPO) {
- ia= act->data;
- prop= get_ob_property(ob, ia->name);
- if (prop) {
- ia->type= ACT_IPO_FROM_PROP;
- }
- }
- else if (act->type==ACT_ADD_OBJECT) {
- aoa= act->data;
- eoa= MEM_callocN(sizeof(bEditObjectActuator), "edit ob act");
- eoa->type= ACT_EDOB_ADD_OBJECT;
- eoa->ob= aoa->ob;
- eoa->time= aoa->time;
- MEM_freeN(aoa);
- act->data= eoa;
- act->type= act->otype= ACT_EDIT_OBJECT;
- }
- else if (act->type==ACT_END_OBJECT) {
- eoa= MEM_callocN(sizeof(bEditObjectActuator), "edit ob act");
- eoa->type= ACT_EDOB_END_OBJECT;
- act->data= eoa;
- act->type= act->otype= ACT_EDIT_OBJECT;
- }
- act= act->next;
- }
- ob = ob->id.next;
- }
- }
-
- if (main->versionfile <= 202) {
- /* add-object and end-object are joined to edit-object
- * actuator */
- Object *ob= main->object.first;
- bActuator *act;
- bObjectActuator *oa;
- while (ob) {
- act= ob->actuators.first;
- while (act) {
- if (act->type==ACT_OBJECT) {
- oa= act->data;
- oa->flag &= ~(ACT_TORQUE_LOCAL|ACT_DROT_LOCAL); /* this actuator didn't do local/glob rot before */
- }
- act= act->next;
- }
- ob= ob->id.next;
- }
- }
-
- if (main->versionfile <= 204) {
- /* patches for new physics */
- Object *ob= main->object.first;
- bActuator *act;
- bObjectActuator *oa;
- bSound *sound;
- while (ob) {
-
- /* please check this for demo20 files like
- * original Egypt levels etc. converted
- * rotation factor of 50 is not workable */
- act= ob->actuators.first;
- while (act) {
- if (act->type==ACT_OBJECT) {
- oa= act->data;
-
- oa->forceloc[0]*= 25.0f;
- oa->forceloc[1]*= 25.0f;
- oa->forceloc[2]*= 25.0f;
-
- oa->forcerot[0]*= 10.0f;
- oa->forcerot[1]*= 10.0f;
- oa->forcerot[2]*= 10.0f;
- }
- act= act->next;
- }
- ob= ob->id.next;
- }
-
- sound = main->sound.first;
- while (sound) {
- if (sound->volume < 0.01f) {
- sound->volume = 1.0f;
- }
- sound = sound->id.next;
- }
- }
-
- if (main->versionfile <= 205) {
- /* patches for new physics */
- Object *ob= main->object.first;
- bActuator *act;
- bSensor *sens;
- bEditObjectActuator *oa;
- bRaySensor *rs;
- bCollisionSensor *cs;
- while (ob) {
- /* Set anisotropic friction off for old objects,
- * values to 1.0. */
- ob->gameflag &= ~OB_ANISOTROPIC_FRICTION;
- ob->anisotropicFriction[0] = 1.0;
- ob->anisotropicFriction[1] = 1.0;
- ob->anisotropicFriction[2] = 1.0;
-
- act= ob->actuators.first;
- while (act) {
- if (act->type==ACT_EDIT_OBJECT) {
- /* Zero initial velocity for newly
- * added objects */
- oa= act->data;
- oa->linVelocity[0] = 0.0;
- oa->linVelocity[1] = 0.0;
- oa->linVelocity[2] = 0.0;
- oa->localflag = 0;
- }
- act= act->next;
- }
-
- sens= ob->sensors.first;
- while (sens) {
- /* Extra fields for radar sensors. */
- if (sens->type == SENS_RADAR) {
- bRadarSensor *s = sens->data;
- s->range = 10000.0;
- }
-
- /* Pulsing: defaults for new sensors. */
- if (sens->type != SENS_ALWAYS) {
- sens->pulse = 0;
- sens->freq = 0;
- }
- else {
- sens->pulse = 1;
- }
-
- /* Invert: off. */
- sens->invert = 0;
-
- /* Collision and ray: default = trigger
- * on property. The material field can
- * remain empty. */
- if (sens->type == SENS_COLLISION) {
- cs = (bCollisionSensor*) sens->data;
- cs->mode = 0;
- }
- if (sens->type == SENS_RAY) {
- rs = (bRaySensor*) sens->data;
- rs->mode = 0;
- }
- sens = sens->next;
- }
- ob= ob->id.next;
- }
- /* have to check the exact multiplier */
- }
-
- if (main->versionfile <= 211) {
- /* Render setting: per scene, the applicable gamma value
- * can be set. Default is 1.0, which means no
- * correction. */
- bActuator *act;
- bObjectActuator *oa;
- Object *ob;
-
- /* added alpha in obcolor */
- ob= main->object.first;
- while (ob) {
- ob->col[3]= 1.0;
- ob= ob->id.next;
- }
-
- /* added alpha in obcolor */
- ob= main->object.first;
- while (ob) {
- act= ob->actuators.first;
- while (act) {
- if (act->type==ACT_OBJECT) {
- /* multiply velocity with 50 in old files */
- oa= act->data;
- if (fabsf(oa->linearvelocity[0]) >= 0.01f)
- oa->linearvelocity[0] *= 50.0f;
- if (fabsf(oa->linearvelocity[1]) >= 0.01f)
- oa->linearvelocity[1] *= 50.0f;
- if (fabsf(oa->linearvelocity[2]) >= 0.01f)
- oa->linearvelocity[2] *= 50.0f;
- if (fabsf(oa->angularvelocity[0])>=0.01f)
- oa->angularvelocity[0] *= 50.0f;
- if (fabsf(oa->angularvelocity[1])>=0.01f)
- oa->angularvelocity[1] *= 50.0f;
- if (fabsf(oa->angularvelocity[2])>=0.01f)
- oa->angularvelocity[2] *= 50.0f;
- }
- act= act->next;
- }
- ob= ob->id.next;
- }
- }
-
- if (main->versionfile <= 212) {
-
- bSound* sound;
- bProperty *prop;
- Object *ob;
- Mesh *me;
-
- sound = main->sound.first;
- while (sound) {
- sound->max_gain = 1.0;
- sound->min_gain = 0.0;
- sound->distance = 1.0;
-
- if (sound->attenuation > 0.0f)
- sound->flags |= SOUND_FLAGS_3D;
- else
- sound->flags &= ~SOUND_FLAGS_3D;
-
- sound = sound->id.next;
- }
-
- ob = main->object.first;
-
- while (ob) {
- prop= ob->prop.first;
- while (prop) {
- if (prop->type == GPROP_TIME) {
- // convert old GPROP_TIME values from int to float
- *((float *)&prop->data) = (float) prop->data;
- }
-
- prop= prop->next;
- }
- ob = ob->id.next;
- }
-
- /* me->subdiv changed to reflect the actual reparametization
- * better, and smeshes were removed - if it was a smesh make
- * it a subsurf, and reset the subdiv level because subsurf
- * takes a lot more work to calculate.
- */
- for (me= main->mesh.first; me; me= me->id.next) {
- if (me->flag&ME_SMESH) {
- me->flag&= ~ME_SMESH;
- me->flag|= ME_SUBSURF;
-
- me->subdiv= 1;
- }
- else {
- if (me->subdiv<2)
- me->subdiv= 1;
- else
- me->subdiv--;
- }
- }
- }
-
- if (main->versionfile <= 220) {
- Object *ob;
- Mesh *me;
-
- ob = main->object.first;
-
- /* adapt form factor in order to get the 'old' physics
- * behavior back...*/
-
- while (ob) {
- /* in future, distinguish between different
- * object bounding shapes */
- ob->formfactor = 0.4f;
- /* patch form factor, note that inertia equiv radius
- * of a rotation symmetrical obj */
- if (ob->inertia != 1.0f) {
- ob->formfactor /= ob->inertia * ob->inertia;
- }
- ob = ob->id.next;
- }
-
- /* Began using alpha component of vertex colors, but
- * old file vertex colors are undefined, reset them
- * to be fully opaque. -zr
- */
- for (me= main->mesh.first; me; me= me->id.next) {
- if (me->mcol) {
- int i;
-
- for (i=0; i<me->totface*4; i++) {
- MCol *mcol= &me->mcol[i];
- mcol->a= 255;
- }
- }
- if (me->tface) {
- int i, j;
-
- for (i=0; i<me->totface; i++) {
- TFace *tf= &((TFace*) me->tface)[i];
-
- for (j=0; j<4; j++) {
- char *col= (char*) &tf->col[j];
-
- col[0]= 255;
- }
- }
- }
- }
- }
- if (main->versionfile <= 221) {
- Scene *sce= main->scene.first;
-
- // new variables for std-alone player and runtime
- while (sce) {
-
- sce->r.xplay= 640;
- sce->r.yplay= 480;
- sce->r.freqplay= 60;
-
- sce= sce->id.next;
- }
-
- }
- if (main->versionfile <= 222) {
- Scene *sce= main->scene.first;
-
- // new variables for std-alone player and runtime
- while (sce) {
-
- sce->r.depth= 32;
-
- sce= sce->id.next;
- }
- }
-
-
- if (main->versionfile <= 223) {
- VFont *vf;
- Image *ima;
- Object *ob;
-
- for (vf= main->vfont.first; vf; vf= vf->id.next) {
- if (strcmp(vf->name+strlen(vf->name)-6, ".Bfont")==0) {
- strcpy(vf->name, FO_BUILTIN_NAME);
- }
- }
-
- /* Old textures animate at 25 FPS */
- for (ima = main->image.first; ima; ima=ima->id.next) {
- ima->animspeed = 25;
- }
-
- /* Zr remapped some keyboard codes to be linear (stupid zr) */
- for (ob= main->object.first; ob; ob= ob->id.next) {
- bSensor *sens;
-
- for (sens= ob->sensors.first; sens; sens= sens->next) {
- if (sens->type==SENS_KEYBOARD) {
- bKeyboardSensor *ks= sens->data;
-
- ks->key= map_223_keybd_code_to_224_keybd_code(ks->key);
- ks->qual= map_223_keybd_code_to_224_keybd_code(ks->qual);
- ks->qual2= map_223_keybd_code_to_224_keybd_code(ks->qual2);
- }
- }
- }
- }
- if (main->versionfile <= 224) {
- bSound* sound;
- Scene *sce;
- Mesh *me;
- bScreen *sc;
-
- for (sound=main->sound.first; sound; sound=sound->id.next) {
- if (sound->packedfile) {
- if (sound->newpackedfile == NULL) {
- sound->newpackedfile = sound->packedfile;
- }
- sound->packedfile = NULL;
- }
- }
- /* Make sure that old subsurf meshes don't have zero subdivision level for rendering */
- for (me=main->mesh.first; me; me=me->id.next) {
- if ((me->flag & ME_SUBSURF) && (me->subdivr==0))
- me->subdivr=me->subdiv;
- }
-
- for (sce= main->scene.first; sce; sce= sce->id.next) {
- sce->r.stereomode = 1; // no stereo
- }
-
- /* some oldfile patch, moved from set_func_space */
- for (sc= main->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa;
-
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- SpaceLink *sl;
-
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_IPO) {
- SpaceSeq *sseq= (SpaceSeq*) sl;
- sseq->v2d.keeptot= 0;
- }
- }
- }
- }
-
- }
-
-
- if (main->versionfile <= 225) {
- World *wo;
- /* Use Sumo for old games */
- for (wo = main->world.first; wo; wo= wo->id.next) {
- wo->physicsEngine = 2;
- }
- }
-
- if (main->versionfile <= 227) {
- Scene *sce;
- Material *ma;
- bScreen *sc;
- Object *ob;
-
- /* As of now, this insures that the transition from the old Track system
- * to the new full constraint Track is painless for everyone. - theeth
- */
- ob = main->object.first;
-
- while (ob) {
- ListBase *list;
- list = &ob->constraints;
-
- /* check for already existing TrackTo constraint
- * set their track and up flag correctly */
-
- if (list) {
- bConstraint *curcon;
- for (curcon = list->first; curcon; curcon=curcon->next) {
- if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
- bTrackToConstraint *data = curcon->data;
- data->reserved1 = ob->trackflag;
- data->reserved2 = ob->upflag;
- }
- }
- }
-
- if (ob->type == OB_ARMATURE) {
- if (ob->pose) {
- bConstraint *curcon;
- bPoseChannel *pchan;
- for (pchan = ob->pose->chanbase.first;
- pchan; pchan=pchan->next) {
- for (curcon = pchan->constraints.first;
- curcon; curcon=curcon->next) {
- if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
- bTrackToConstraint *data = curcon->data;
- data->reserved1 = ob->trackflag;
- data->reserved2 = ob->upflag;
- }
- }
- }
- }
- }
-
- /* Change Ob->Track in real TrackTo constraint */
- blo_do_version_old_trackto_to_constraints(ob);
-
- ob = ob->id.next;
- }
-
-
- for (sce= main->scene.first; sce; sce= sce->id.next) {
- sce->audio.mixrate = 44100;
- sce->audio.flag |= AUDIO_SCRUB;
- sce->r.mode |= R_ENVMAP;
- }
- // init new shader vars
- for (ma= main->mat.first; ma; ma= ma->id.next) {
- ma->refrac= 4.0f;
- ma->roughness= 0.5f;
- ma->param[0]= 0.5f;
- ma->param[1]= 0.1f;
- ma->param[2]= 0.1f;
- ma->param[3]= 0.05f;
- }
- // patch for old wrong max view2d settings, allows zooming out more
- for (sc= main->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa;
-
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- SpaceLink *sl;
-
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_ACTION) {
- SpaceAction *sac= (SpaceAction *) sl;
- sac->v2d.max[0]= 32000;
- }
- else if (sl->spacetype==SPACE_NLA) {
- SpaceNla *sla= (SpaceNla *) sl;
- sla->v2d.max[0]= 32000;
- }
- }
- }
- }
- }
- if (main->versionfile <= 228) {
- Scene *sce;
- bScreen *sc;
- Object *ob;
-
-
- /* As of now, this insures that the transition from the old Track system
- * to the new full constraint Track is painless for everyone.*/
- ob = main->object.first;
-
- while (ob) {
- ListBase *list;
- list = &ob->constraints;
-
- /* check for already existing TrackTo constraint
- * set their track and up flag correctly */
-
- if (list) {
- bConstraint *curcon;
- for (curcon = list->first; curcon; curcon=curcon->next) {
- if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
- bTrackToConstraint *data = curcon->data;
- data->reserved1 = ob->trackflag;
- data->reserved2 = ob->upflag;
- }
- }
- }
-
- if (ob->type == OB_ARMATURE) {
- if (ob->pose) {
- bConstraint *curcon;
- bPoseChannel *pchan;
- for (pchan = ob->pose->chanbase.first;
- pchan; pchan=pchan->next) {
- for (curcon = pchan->constraints.first;
- curcon; curcon=curcon->next) {
- if (curcon->type == CONSTRAINT_TYPE_TRACKTO) {
- bTrackToConstraint *data = curcon->data;
- data->reserved1 = ob->trackflag;
- data->reserved2 = ob->upflag;
- }
- }
- }
- }
- }
-
- ob = ob->id.next;
- }
-
- for (sce= main->scene.first; sce; sce= sce->id.next) {
- sce->r.mode |= R_ENVMAP;
- }
-
- // convert old mainb values for new button panels
- for (sc= main->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa;
-
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- SpaceLink *sl;
-
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_BUTS) {
- SpaceButs *sbuts= (SpaceButs *) sl;
-
- sbuts->v2d.maxzoom= 1.2f;
- sbuts->align= 1; /* horizontal default */
-
- if (sbuts->mainb==BUTS_LAMP) {
- sbuts->mainb= CONTEXT_SHADING;
- //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
- }
- else if (sbuts->mainb==BUTS_MAT) {
- sbuts->mainb= CONTEXT_SHADING;
- //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
- }
- else if (sbuts->mainb==BUTS_TEX) {
- sbuts->mainb= CONTEXT_SHADING;
- //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_TEX;
- }
- else if (sbuts->mainb==BUTS_ANIM) {
- sbuts->mainb= CONTEXT_OBJECT;
- }
- else if (sbuts->mainb==BUTS_WORLD) {
- sbuts->mainb= CONTEXT_SCENE;
- //sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_WORLD;
- }
- else if (sbuts->mainb==BUTS_RENDER) {
- sbuts->mainb= CONTEXT_SCENE;
- //sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_RENDER;
- }
- else if (sbuts->mainb==BUTS_GAME) {
- sbuts->mainb= CONTEXT_LOGIC;
- }
- else if (sbuts->mainb==BUTS_FPAINT) {
- sbuts->mainb= CONTEXT_EDITING;
- }
- else if (sbuts->mainb==BUTS_RADIO) {
- sbuts->mainb= CONTEXT_SHADING;
- //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_RAD;
- }
- else if (sbuts->mainb==BUTS_CONSTRAINT) {
- sbuts->mainb= CONTEXT_OBJECT;
- }
- else if (sbuts->mainb==BUTS_SCRIPT) {
- sbuts->mainb= CONTEXT_OBJECT;
- }
- else if (sbuts->mainb==BUTS_EDIT) {
- sbuts->mainb= CONTEXT_EDITING;
- }
- else sbuts->mainb= CONTEXT_SCENE;
- }
- }
- }
- }
- }
- /* ton: made this 230 instead of 229,
- * to be sure (tuho files) and this is a reliable check anyway
- * nevertheless, we might need to think over a fitness (initialize)
- * check apart from the do_versions() */
-
- if (main->versionfile <= 230) {
- bScreen *sc;
-
- // new variable blockscale, for panels in any area
- for (sc= main->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa;
-
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- SpaceLink *sl;
-
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->blockscale==0.0f) sl->blockscale= 0.7f;
- /* added: 5x better zoom in for action */
- if (sl->spacetype==SPACE_ACTION) {
- SpaceAction *sac= (SpaceAction *)sl;
- sac->v2d.maxzoom= 50;
- }
- }
- }
- }
- }
- if (main->versionfile <= 231) {
- /* new bit flags for showing/hiding grid floor and axes */
- bScreen *sc = main->screen.first;
- while (sc) {
- ScrArea *sa= sc->areabase.first;
- while (sa) {
- SpaceLink *sl= sa->spacedata.first;
- while (sl) {
- if (sl->spacetype==SPACE_VIEW3D) {
- View3D *v3d= (View3D*) sl;
-
- if (v3d->gridflag==0) {
- v3d->gridflag |= V3D_SHOW_X;
- v3d->gridflag |= V3D_SHOW_Y;
- v3d->gridflag |= V3D_SHOW_FLOOR;
- v3d->gridflag &= ~V3D_SHOW_Z;
- }
- }
- sl= sl->next;
- }
- sa= sa->next;
- }
- sc= sc->id.next;
- }
- }
- if (main->versionfile <= 231) {
- Material *ma= main->mat.first;
- bScreen *sc = main->screen.first;
- Scene *sce;
- Lamp *la;
- World *wrld;
-
- /* introduction of raytrace */
- while (ma) {
- if (ma->fresnel_tra_i==0.0f) ma->fresnel_tra_i= 1.25f;
- if (ma->fresnel_mir_i==0.0f) ma->fresnel_mir_i= 1.25f;
-
- ma->ang= 1.0;
- ma->ray_depth= 2;
- ma->ray_depth_tra= 2;
- ma->fresnel_tra= 0.0;
- ma->fresnel_mir= 0.0;
-
- ma= ma->id.next;
- }
- sce= main->scene.first;
- while (sce) {
- if (sce->r.gauss==0.0f) sce->r.gauss= 1.0f;
- sce= sce->id.next;
- }
- la= main->lamp.first;
- while (la) {
- if (la->k==0.0f) la->k= 1.0;
- if (la->ray_samp==0) la->ray_samp= 1;
- if (la->ray_sampy==0) la->ray_sampy= 1;
- if (la->ray_sampz==0) la->ray_sampz= 1;
- if (la->area_size==0.0f) la->area_size= 1.0f;
- if (la->area_sizey==0.0f) la->area_sizey= 1.0f;
- if (la->area_sizez==0.0f) la->area_sizez= 1.0f;
- la= la->id.next;
- }
- wrld= main->world.first;
- while (wrld) {
- if (wrld->range==0.0f) {
- wrld->range= 1.0f/wrld->exposure;
- }
- wrld= wrld->id.next;
- }
-
- /* new bit flags for showing/hiding grid floor and axes */
-
- while (sc) {
- ScrArea *sa= sc->areabase.first;
- while (sa) {
- SpaceLink *sl= sa->spacedata.first;
- while (sl) {
- if (sl->spacetype==SPACE_VIEW3D) {
- View3D *v3d= (View3D*) sl;
-
- if (v3d->gridflag==0) {
- v3d->gridflag |= V3D_SHOW_X;
- v3d->gridflag |= V3D_SHOW_Y;
- v3d->gridflag |= V3D_SHOW_FLOOR;
- v3d->gridflag &= ~V3D_SHOW_Z;
- }
- }
- sl= sl->next;
- }
- sa= sa->next;
- }
- sc= sc->id.next;
- }
- }
- if (main->versionfile <= 232) {
- Tex *tex= main->tex.first;
- World *wrld= main->world.first;
- bScreen *sc;
- Scene *sce;
-
- while (tex) {
- if ((tex->flag & (TEX_CHECKER_ODD+TEX_CHECKER_EVEN))==0) {
- tex->flag |= TEX_CHECKER_ODD;
- }
- /* copied from kernel texture.c */
- if (tex->ns_outscale==0.0f) {
- /* musgrave */
- tex->mg_H = 1.0f;
- tex->mg_lacunarity = 2.0f;
- tex->mg_octaves = 2.0f;
- tex->mg_offset = 1.0f;
- tex->mg_gain = 1.0f;
- tex->ns_outscale = 1.0f;
- /* distnoise */
- tex->dist_amount = 1.0f;
- /* voronoi */
- tex->vn_w1 = 1.0f;
- tex->vn_mexp = 2.5f;
- }
- tex= tex->id.next;
- }
-
- while (wrld) {
- if (wrld->aodist==0.0f) {
- wrld->aodist= 10.0f;
- wrld->aobias= 0.05f;
- }
- if (wrld->aosamp==0) wrld->aosamp= 5;
- if (wrld->aoenergy==0.0f) wrld->aoenergy= 1.0f;
- wrld= wrld->id.next;
- }
-
-
- // new variable blockscale, for panels in any area, do again because new
- // areas didnt initialize it to 0.7 yet
- for (sc= main->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa;
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- SpaceLink *sl;
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->blockscale==0.0f) sl->blockscale= 0.7f;
-
- /* added: 5x better zoom in for nla */
- if (sl->spacetype==SPACE_NLA) {
- SpaceNla *snla= (SpaceNla *)sl;
- snla->v2d.maxzoom= 50;
- }
- }
- }
- }
- sce= main->scene.first;
- while (sce) {
- if (sce->r.ocres==0) sce->r.ocres= 64;
- sce= sce->id.next;
- }
-
- }
- if (main->versionfile <= 233) {
- bScreen *sc;
- Material *ma= main->mat.first;
- /* Object *ob= main->object.first; */
-
- while (ma) {
- if (ma->rampfac_col==0.0f) ma->rampfac_col= 1.0;
- if (ma->rampfac_spec==0.0f) ma->rampfac_spec= 1.0;
- if (ma->pr_lamp==0) ma->pr_lamp= 3;
- ma= ma->id.next;
- }
-
- /* this should have been done loooong before! */
-#if 0 /* deprecated in 2.5+ */
- while (ob) {
- if (ob->ipowin==0) ob->ipowin= ID_OB;
- ob= ob->id.next;
- }
-#endif
- for (sc= main->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa;
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- SpaceLink *sl;
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_VIEW3D) {
- View3D *v3d= (View3D *)sl;
- v3d->flag |= V3D_SELECT_OUTLINE;
- }
- }
- }
- }
- }
-
-
-
-
- if (main->versionfile <= 234) {
- World *wo;
- bScreen *sc;
-
- // force sumo engine to be active
- for (wo = main->world.first; wo; wo= wo->id.next) {
- if (wo->physicsEngine==0) wo->physicsEngine = 2;
- }
-
- for (sc= main->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa;
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- SpaceLink *sl;
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_VIEW3D) {
- View3D *v3d= (View3D *)sl;
- v3d->flag |= V3D_ZBUF_SELECT;
- }
- else if (sl->spacetype==SPACE_TEXT) {
- SpaceText *st= (SpaceText *)sl;
- if (st->tabnumber==0) st->tabnumber= 2;
- }
- }
- }
- }
- }
- if (main->versionfile <= 235) {
- Tex *tex= main->tex.first;
- Scene *sce= main->scene.first;
- Sequence *seq;
- Editing *ed;
-
- while (tex) {
- if (tex->nabla==0.0f) tex->nabla= 0.025f;
- tex= tex->id.next;
- }
- while (sce) {
- ed= sce->ed;
- if (ed) {
- SEQ_BEGIN (sce->ed, seq)
- {
- if (seq->type==SEQ_IMAGE || seq->type==SEQ_MOVIE)
- seq->flag |= SEQ_MAKE_PREMUL;
- }
- SEQ_END
- }
-
- sce= sce->id.next;
- }
- }
- if (main->versionfile <= 236) {
- Object *ob;
- Camera *cam= main->camera.first;
- Material *ma;
- bScreen *sc;
-
- while (cam) {
- if (cam->ortho_scale==0.0f) {
- cam->ortho_scale= 256.0f/cam->lens;
- if (cam->type==CAM_ORTHO) printf("NOTE: ortho render has changed, tweak new Camera 'scale' value.\n");
- }
- cam= cam->id.next;
- }
- /* set manipulator type */
- /* force oops draw if depgraph was set*/
- /* set time line var */
- for (sc= main->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa;
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- SpaceLink *sl;
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_VIEW3D) {
- View3D *v3d= (View3D *)sl;
- if (v3d->twtype==0) v3d->twtype= V3D_MANIP_TRANSLATE;
- }
- }
- }
- }
- // init new shader vars
- for (ma= main->mat.first; ma; ma= ma->id.next) {
- if (ma->darkness==0.0f) {
- ma->rms=0.1f;
- ma->darkness=1.0f;
- }
- }
-
- /* softbody init new vars */
- for (ob= main->object.first; ob; ob= ob->id.next) {
- if (ob->soft) {
- if (ob->soft->defgoal==0.0f) ob->soft->defgoal= 0.7f;
- if (ob->soft->physics_speed==0.0f) ob->soft->physics_speed= 1.0f;
-
- if (ob->soft->interval==0) {
- ob->soft->interval= 2;
- ob->soft->sfra= 1;
- ob->soft->efra= 100;
- }
- }
- if (ob->soft && ob->soft->vertgroup==0) {
- bDeformGroup *locGroup = defgroup_find_name(ob, "SOFTGOAL");
- if (locGroup) {
- /* retrieve index for that group */
- ob->soft->vertgroup = 1 + BLI_findindex(&ob->defbase, locGroup);
- }
- }
- }
- }
- if (main->versionfile <= 237) {
- bArmature *arm;
- bConstraint *con;
- Object *ob;
- Bone *bone;
-
- // armature recode checks
- for (arm= main->armature.first; arm; arm= arm->id.next) {
- BKE_armature_where_is(arm);
-
- for (bone= arm->bonebase.first; bone; bone= bone->next)
- do_version_bone_head_tail_237(bone);
- }
- for (ob= main->object.first; ob; ob= ob->id.next) {
- if (ob->parent) {
- Object *parent= blo_do_versions_newlibadr(fd, lib, ob->parent);
- if (parent && parent->type==OB_LATTICE)
- ob->partype = PARSKEL;
- }
-
- // btw. BKE_pose_rebuild is further only called on leave editmode
- if (ob->type==OB_ARMATURE) {
- if (ob->pose)
- ob->pose->flag |= POSE_RECALC;
- ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME; // cannot call stuff now (pointers!), done in setup_app_data
-
- /* new generic xray option */
- arm= blo_do_versions_newlibadr(fd, lib, ob->data);
- if (arm->flag & ARM_DRAWXRAY) {
- ob->dtx |= OB_DRAWXRAY;
- }
- }
- else if (ob->type==OB_MESH) {
- Mesh *me = blo_do_versions_newlibadr(fd, lib, ob->data);
-
- if ((me->flag&ME_SUBSURF)) {
- SubsurfModifierData *smd = (SubsurfModifierData*) modifier_new(eModifierType_Subsurf);
-
- smd->levels = MAX2(1, me->subdiv);
- smd->renderLevels = MAX2(1, me->subdivr);
- smd->subdivType = me->subsurftype;
-
- smd->modifier.mode = 0;
- if (me->subdiv!=0)
- smd->modifier.mode |= 1;
- if (me->subdivr!=0)
- smd->modifier.mode |= 2;
- if (me->flag&ME_OPT_EDGES)
- smd->flags |= eSubsurfModifierFlag_ControlEdges;
-
- BLI_addtail(&ob->modifiers, smd);
-
- modifier_unique_name(&ob->modifiers, (ModifierData*)smd);
- }
- }
-
- // follow path constraint needs to set the 'path' option in curves...
- for (con=ob->constraints.first; con; con= con->next) {
- if (con->type==CONSTRAINT_TYPE_FOLLOWPATH) {
- bFollowPathConstraint *data = con->data;
- Object *obc= blo_do_versions_newlibadr(fd, lib, data->tar);
-
- if (obc && obc->type==OB_CURVE) {
- Curve *cu= blo_do_versions_newlibadr(fd, lib, obc->data);
- if (cu) cu->flag |= CU_PATH;
- }
- }
- }
- }
- }
- if (main->versionfile <= 238) {
- Lattice *lt;
- Object *ob;
- bArmature *arm;
- Mesh *me;
- Key *key;
- Scene *sce= main->scene.first;
-
- while (sce) {
- if (sce->toolsettings == NULL) {
- sce->toolsettings = MEM_callocN(sizeof(struct ToolSettings), "Tool Settings Struct");
- sce->toolsettings->cornertype=0;
- sce->toolsettings->degr = 90;
- sce->toolsettings->step = 9;
- sce->toolsettings->turn = 1;
- sce->toolsettings->extr_offs = 1;
- sce->toolsettings->doublimit = 0.001f;
- sce->toolsettings->segments = 32;
- sce->toolsettings->rings = 32;
- sce->toolsettings->vertices = 32;
- }
- sce= sce->id.next;
- }
-
- for (lt=main->latt.first; lt; lt=lt->id.next) {
- if (lt->fu==0.0f && lt->fv==0.0f && lt->fw==0.0f) {
- calc_lat_fudu(lt->flag, lt->pntsu, &lt->fu, &lt->du);
- calc_lat_fudu(lt->flag, lt->pntsv, &lt->fv, &lt->dv);
- calc_lat_fudu(lt->flag, lt->pntsw, &lt->fw, &lt->dw);
- }
- }
-
- for (ob=main->object.first; ob; ob= ob->id.next) {
- ModifierData *md;
- PartEff *paf;
-
- for (md=ob->modifiers.first; md; md=md->next) {
- if (md->type==eModifierType_Subsurf) {
- SubsurfModifierData *smd = (SubsurfModifierData*) md;
-
- smd->flags &= ~(eSubsurfModifierFlag_Incremental|eSubsurfModifierFlag_DebugIncr);
- }
- }
-
- if ((ob->softflag&OB_SB_ENABLE) && !modifiers_findByType(ob, eModifierType_Softbody)) {
- if (ob->softflag&OB_SB_POSTDEF) {
- md = ob->modifiers.first;
-
- while (md && modifierType_getInfo(md->type)->type==eModifierTypeType_OnlyDeform) {
- md = md->next;
- }
-
- BLI_insertlinkbefore(&ob->modifiers, md, modifier_new(eModifierType_Softbody));
- }
- else {
- BLI_addhead(&ob->modifiers, modifier_new(eModifierType_Softbody));
- }
-
- ob->softflag &= ~OB_SB_ENABLE;
- }
- if (ob->pose) {
- bPoseChannel *pchan;
- bConstraint *con;
- for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
- // note, pchan->bone is also lib-link stuff
- if (pchan->limitmin[0] == 0.0f && pchan->limitmax[0] == 0.0f) {
- pchan->limitmin[0]= pchan->limitmin[1]= pchan->limitmin[2]= -180.0f;
- pchan->limitmax[0]= pchan->limitmax[1]= pchan->limitmax[2]= 180.0f;
-
- for (con= pchan->constraints.first; con; con= con->next) {
- if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
- bKinematicConstraint *data = (bKinematicConstraint*)con->data;
- data->weight = 1.0f;
- data->orientweight = 1.0f;
- data->flag &= ~CONSTRAINT_IK_ROT;
-
- /* enforce conversion from old IK_TOPARENT to rootbone index */
- data->rootbone= -1;
-
- /* update_pose_etc handles rootbone==-1 */
- ob->pose->flag |= POSE_RECALC;
- }
- }
- }
- }
- }
-
- paf = blo_do_version_give_parteff_245(ob);
- if (paf) {
- if (paf->disp == 0)
- paf->disp = 100;
- if (paf->speedtex == 0)
- paf->speedtex = 8;
- if (paf->omat == 0)
- paf->omat = 1;
- }
- }
-
- for (arm=main->armature.first; arm; arm= arm->id.next) {
- bone_version_238(&arm->bonebase);
- arm->deformflag |= ARM_DEF_VGROUP;
- }
-
- for (me=main->mesh.first; me; me= me->id.next) {
- if (!me->medge) {
- BKE_mesh_make_edges(me, 1); /* 1 = use mface->edcode */
- }
- else {
- BKE_mesh_strip_loose_faces(me);
- }
- }
-
- for (key= main->key.first; key; key= key->id.next) {
- KeyBlock *kb;
- int index = 1;
-
- for (kb= key->block.first; kb; kb= kb->next) {
- if (kb==key->refkey) {
- if (kb->name[0]==0)
- strcpy(kb->name, "Basis");
- }
- else {
- if (kb->name[0]==0) {
- BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", index);
- }
- index++;
- }
- }
- }
- }
- if (main->versionfile <= 239) {
- bArmature *arm;
- Object *ob;
- Scene *sce= main->scene.first;
- Camera *cam= main->camera.first;
- Material *ma= main->mat.first;
- int set_passepartout= 0;
-
- /* deformflag is local in modifier now */
- for (ob=main->object.first; ob; ob= ob->id.next) {
- ModifierData *md;
-
- for (md=ob->modifiers.first; md; md=md->next) {
- if (md->type==eModifierType_Armature) {
- ArmatureModifierData *amd = (ArmatureModifierData*) md;
- if (amd->object && amd->deformflag==0) {
- Object *oba= blo_do_versions_newlibadr(fd, lib, amd->object);
- arm= blo_do_versions_newlibadr(fd, lib, oba->data);
- amd->deformflag= arm->deformflag;
- }
- }
- }
- }
-
- /* updating stepsize for ghost drawing */
- for (arm= main->armature.first; arm; arm= arm->id.next) {
- if (arm->ghostsize==0) arm->ghostsize=1;
- bone_version_239(&arm->bonebase);
- if (arm->layer==0) arm->layer= 1;
- }
-
- for (;sce;sce= sce->id.next) {
- /* make 'innervert' the default subdivide type, for backwards compat */
- sce->toolsettings->cornertype=1;
-
- if (sce->r.scemode & R_PASSEPARTOUT) {
- set_passepartout= 1;
- sce->r.scemode &= ~R_PASSEPARTOUT;
- }
- /* gauss is filter variable now */
- if (sce->r.mode & R_GAUSS) {
- sce->r.filtertype= R_FILTER_GAUSS;
- sce->r.mode &= ~R_GAUSS;
- }
- }
-
- for (;cam; cam= cam->id.next) {
- if (set_passepartout)
- cam->flag |= CAM_SHOWPASSEPARTOUT;
-
- /* make sure old cameras have title safe on */
- if (!(cam->flag & CAM_SHOWTITLESAFE))
- cam->flag |= CAM_SHOWTITLESAFE;
-
- /* set an appropriate camera passepartout alpha */
- if (!(cam->passepartalpha)) cam->passepartalpha = 0.2f;
- }
-
- for (; ma; ma= ma->id.next) {
- if (ma->strand_sta==0.0f) {
- ma->strand_sta= ma->strand_end= 1.0f;
- ma->mode |= MA_TANGENT_STR;
- }
- if (ma->mode & MA_TRACEBLE) ma->mode |= MA_SHADBUF;
- }
- }
-
- if (main->versionfile <= 241) {
- Object *ob;
- Tex *tex;
- Scene *sce;
- World *wo;
- Lamp *la;
- Material *ma;
- bArmature *arm;
- bNodeTree *ntree;
-
- for (wo = main->world.first; wo; wo= wo->id.next) {
- /* Migrate to Bullet for games, except for the NaN versions */
- /* People can still explicitly choose for Sumo (after 2.42 is out) */
- if (main->versionfile > 225)
- wo->physicsEngine = WOPHY_BULLET;
- if (WO_AODIST == wo->aomode)
- wo->aocolor= WO_AOPLAIN;
- }
-
- /* updating layers still */
- for (arm= main->armature.first; arm; arm= arm->id.next) {
- bone_version_239(&arm->bonebase);
- if (arm->layer==0) arm->layer= 1;
- }
- for (sce= main->scene.first; sce; sce= sce->id.next) {
- if (sce->audio.mixrate==0) sce->audio.mixrate= 44100;
-
- if (sce->r.xparts<2) sce->r.xparts= 4;
- if (sce->r.yparts<2) sce->r.yparts= 4;
- /* adds default layer */
- if (sce->r.layers.first==NULL)
- BKE_scene_add_render_layer(sce, NULL);
- else {
- SceneRenderLayer *srl;
- /* new layer flag for sky, was default for solid */
- for (srl= sce->r.layers.first; srl; srl= srl->next) {
- if (srl->layflag & SCE_LAY_SOLID)
- srl->layflag |= SCE_LAY_SKY;
- srl->passflag &= (SCE_PASS_COMBINED|SCE_PASS_Z|SCE_PASS_NORMAL|SCE_PASS_VECTOR);
- }
- }
-
- /* node version changes */
- if (sce->nodetree)
- ntree_version_241(sce->nodetree);
-
- /* uv calculation options moved to toolsettings */
- if (sce->toolsettings->uvcalc_radius == 0.0f) {
- sce->toolsettings->uvcalc_radius = 1.0f;
- sce->toolsettings->uvcalc_cubesize = 1.0f;
- sce->toolsettings->uvcalc_mapdir = 1;
- sce->toolsettings->uvcalc_mapalign = 1;
- sce->toolsettings->uvcalc_flag = UVCALC_FILLHOLES;
- sce->toolsettings->unwrapper = 1;
- }
-
- if (sce->r.mode & R_PANORAMA) {
- /* all these checks to ensure saved files with svn version keep working... */
- if (sce->r.xsch < sce->r.ysch) {
- Object *obc= blo_do_versions_newlibadr(fd, lib, sce->camera);
- if (obc && obc->type==OB_CAMERA) {
- Camera *cam= blo_do_versions_newlibadr(fd, lib, obc->data);
- if (cam->lens>=10.0f) {
- sce->r.xsch*= sce->r.xparts;
- cam->lens*= (float)sce->r.ysch/(float)sce->r.xsch;
- }
- }
- }
- }
- }
-
- for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
- ntree_version_241(ntree);
-
- for (la= main->lamp.first; la; la= la->id.next)
- if (la->buffers==0)
- la->buffers= 1;
-
- for (tex= main->tex.first; tex; tex= tex->id.next) {
- if (tex->env && tex->env->viewscale==0.0f)
- tex->env->viewscale= 1.0f;
-// tex->imaflag |= TEX_GAUSS_MIP;
- }
-
- /* for empty drawsize and drawtype */
- for (ob=main->object.first; ob; ob= ob->id.next) {
- if (ob->empty_drawsize==0.0f) {
- ob->empty_drawtype = OB_ARROWS;
- ob->empty_drawsize = 1.0;
- }
- }
-
- for (ma= main->mat.first; ma; ma= ma->id.next) {
- /* stucci returns intensity from now on */
- int a;
- for (a=0; a<MAX_MTEX; a++) {
- if (ma->mtex[a] && ma->mtex[a]->tex) {
- tex= blo_do_versions_newlibadr(fd, lib, ma->mtex[a]->tex);
- if (tex && tex->type==TEX_STUCCI)
- ma->mtex[a]->mapto &= ~(MAP_COL|MAP_SPEC|MAP_REF);
- }
- }
- /* transmissivity defaults */
- if (ma->tx_falloff==0.0f) ma->tx_falloff= 1.0f;
- }
-
- /* during 2.41 images with this name were used for viewer node output, lets fix that */
- if (main->versionfile == 241) {
- Image *ima;
- for (ima= main->image.first; ima; ima= ima->id.next)
- if (strcmp(ima->name, "Compositor")==0) {
- strcpy(ima->id.name+2, "Viewer Node");
- strcpy(ima->name, "Viewer Node");
- }
- }
- }
-
- if (main->versionfile <= 242) {
- Scene *sce;
- bScreen *sc;
- Object *ob;
- Curve *cu;
- Material *ma;
- Mesh *me;
- Group *group;
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
- bNodeTree *ntree;
- int a;
-
- for (sc= main->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa;
- sa= sc->areabase.first;
- while (sa) {
- SpaceLink *sl;
-
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_VIEW3D) {
- View3D *v3d= (View3D*) sl;
- if (v3d->gridsubdiv == 0)
- v3d->gridsubdiv = 10;
- }
- }
- sa = sa->next;
- }
- }
-
- for (sce= main->scene.first; sce; sce= sce->id.next) {
- if (sce->toolsettings->select_thresh == 0.0f)
- sce->toolsettings->select_thresh= 0.01f;
- if (sce->toolsettings->clean_thresh == 0.0f)
- sce->toolsettings->clean_thresh = 0.1f;
-
- if (sce->r.threads==0) {
- if (sce->r.mode & R_THREADS)
- sce->r.threads= 2;
- else
- sce->r.threads= 1;
- }
- if (sce->nodetree)
- ntree_version_242(sce->nodetree);
- }
-
- for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
- ntree_version_242(ntree);
-
- /* add default radius values to old curve points */
- for (cu= main->curve.first; cu; cu= cu->id.next) {
- for (nu= cu->nurb.first; nu; nu= nu->next) {
- if (nu) {
- if (nu->bezt) {
- for (bezt=nu->bezt, a=0; a<nu->pntsu; a++, bezt++) {
- if (!bezt->radius) bezt->radius= 1.0;
- }
- }
- else if (nu->bp) {
- for (bp=nu->bp, a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
- if (!bp->radius) bp->radius= 1.0;
- }
- }
- }
- }
- }
-
- for (ob = main->object.first; ob; ob= ob->id.next) {
- ModifierData *md;
- ListBase *list;
- list = &ob->constraints;
-
- /* check for already existing MinMax (floor) constraint
- * and update the sticky flagging */
-
- if (list) {
- bConstraint *curcon;
- for (curcon = list->first; curcon; curcon=curcon->next) {
- switch (curcon->type) {
- case CONSTRAINT_TYPE_MINMAX:
- {
- bMinMaxConstraint *data = curcon->data;
- if (data->sticky==1)
- data->flag |= MINMAX_STICKY;
- else
- data->flag &= ~MINMAX_STICKY;
- }
- break;
- case CONSTRAINT_TYPE_ROTLIKE:
- {
- bRotateLikeConstraint *data = curcon->data;
-
- /* version patch from buttons_object.c */
- if (data->flag==0)
- data->flag = ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z;
- }
- break;
- }
- }
- }
-
- if (ob->type == OB_ARMATURE) {
- if (ob->pose) {
- bConstraint *curcon;
- bPoseChannel *pchan;
- for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) {
- for (curcon = pchan->constraints.first; curcon; curcon=curcon->next) {
- switch (curcon->type) {
- case CONSTRAINT_TYPE_MINMAX:
- {
- bMinMaxConstraint *data = curcon->data;
- if (data->sticky==1)
- data->flag |= MINMAX_STICKY;
- else
- data->flag &= ~MINMAX_STICKY;
- }
- break;
- case CONSTRAINT_TYPE_KINEMATIC:
- {
- bKinematicConstraint *data = curcon->data;
- if (!(data->flag & CONSTRAINT_IK_POS)) {
- data->flag |= CONSTRAINT_IK_POS;
- data->flag |= CONSTRAINT_IK_STRETCH;
- }
- }
- break;
- case CONSTRAINT_TYPE_ROTLIKE:
- {
- bRotateLikeConstraint *data = curcon->data;
-
- /* version patch from buttons_object.c */
- if (data->flag==0)
- data->flag = ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z;
- }
- break;
- }
- }
- }
- }
- }
-
- /* copy old object level track settings to curve modifers */
- for (md=ob->modifiers.first; md; md=md->next) {
- if (md->type==eModifierType_Curve) {
- CurveModifierData *cmd = (CurveModifierData*) md;
-
- if (cmd->defaxis == 0) cmd->defaxis = ob->trackflag+1;
- }
- }
-
- }
-
- for (ma = main->mat.first; ma; ma= ma->id.next) {
- if (ma->shad_alpha==0.0f)
- ma->shad_alpha= 1.0f;
- if (ma->nodetree)
- ntree_version_242(ma->nodetree);
- }
-
- for (me=main->mesh.first; me; me=me->id.next)
- customdata_version_242(me);
-
- for (group= main->group.first; group; group= group->id.next)
- if (group->layer==0)
- group->layer= (1<<20)-1;
-
- /* now, subversion control! */
- if (main->subversionfile < 3) {
- Image *ima;
- Tex *tex;
-
- /* Image refactor initialize */
- for (ima= main->image.first; ima; ima= ima->id.next) {
- ima->source= IMA_SRC_FILE;
- ima->type= IMA_TYPE_IMAGE;
-
- ima->gen_x= 256; ima->gen_y= 256;
- ima->gen_type= 1;
-
- if (0==strncmp(ima->id.name+2, "Viewer Node", sizeof(ima->id.name)-2)) {
- ima->source= IMA_SRC_VIEWER;
- ima->type= IMA_TYPE_COMPOSITE;
- }
- if (0==strncmp(ima->id.name+2, "Render Result", sizeof(ima->id.name)-2)) {
- ima->source= IMA_SRC_VIEWER;
- ima->type= IMA_TYPE_R_RESULT;
- }
-
- }
- for (tex= main->tex.first; tex; tex= tex->id.next) {
- if (tex->type==TEX_IMAGE && tex->ima) {
- ima= blo_do_versions_newlibadr(fd, lib, tex->ima);
- if (tex->imaflag & TEX_ANIM5_)
- ima->source= IMA_SRC_MOVIE;
- if (tex->imaflag & TEX_FIELDS_)
- ima->flag |= IMA_FIELDS;
- if (tex->imaflag & TEX_STD_FIELD_)
- ima->flag |= IMA_STD_FIELD;
- }
- tex->iuser.frames= tex->frames;
- tex->iuser.fie_ima= (char)tex->fie_ima;
- tex->iuser.offset= tex->offset;
- tex->iuser.sfra= tex->sfra;
- tex->iuser.cycl= (tex->imaflag & TEX_ANIMCYCLIC_)!=0;
- }
- for (sce= main->scene.first; sce; sce= sce->id.next) {
- if (sce->nodetree)
- do_version_ntree_242_2(sce->nodetree);
- }
- for (ntree= main->nodetree.first; ntree; ntree= ntree->id.next)
- do_version_ntree_242_2(ntree);
- for (ma = main->mat.first; ma; ma= ma->id.next)
- if (ma->nodetree)
- do_version_ntree_242_2(ma->nodetree);
-
- for (sc= main->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa;
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- SpaceLink *sl;
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_IMAGE)
- ((SpaceImage *)sl)->iuser.fie_ima= 2;
- else if (sl->spacetype==SPACE_VIEW3D) {
- View3D *v3d= (View3D *)sl;
- BGpic *bgpic;
- for (bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next)
- bgpic->iuser.fie_ima= 2;
- }
- }
- }
- }
- }
-
- if (main->subversionfile < 4) {
- for (sce= main->scene.first; sce; sce= sce->id.next) {
- sce->r.bake_mode= 1; /* prevent to include render stuff here */
- sce->r.bake_filter= 2;
- sce->r.bake_osa= 5;
- sce->r.bake_flag= R_BAKE_CLEAR;
- }
- }
-
- if (main->subversionfile < 5) {
- for (sce= main->scene.first; sce; sce= sce->id.next) {
- /* improved triangle to quad conversion settings */
- if (sce->toolsettings->jointrilimit==0.0f)
- sce->toolsettings->jointrilimit= 0.8f;
- }
- }
- }
- if (main->versionfile <= 243) {
- Object *ob= main->object.first;
- Material *ma;
-
- for (ma=main->mat.first; ma; ma= ma->id.next) {
- if (ma->sss_scale==0.0f) {
- ma->sss_radius[0]= 1.0f;
- ma->sss_radius[1]= 1.0f;
- ma->sss_radius[2]= 1.0f;
- ma->sss_col[0]= 0.8f;
- ma->sss_col[1]= 0.8f;
- ma->sss_col[2]= 0.8f;
- ma->sss_error= 0.05f;
- ma->sss_scale= 0.1f;
- ma->sss_ior= 1.3f;
- ma->sss_colfac= 1.0f;
- ma->sss_texfac= 0.0f;
- }
- if (ma->sss_front==0 && ma->sss_back==0) {
- ma->sss_front= 1.0f;
- ma->sss_back= 1.0f;
- }
- if (ma->sss_col[0]==0 && ma->sss_col[1]==0 && ma->sss_col[2]==0) {
- ma->sss_col[0]= ma->r;
- ma->sss_col[1]= ma->g;
- ma->sss_col[2]= ma->b;
- }
- }
-
- for (; ob; ob= ob->id.next) {
- bDeformGroup *curdef;
-
- for (curdef= ob->defbase.first; curdef; curdef=curdef->next) {
- /* replace an empty-string name with unique name */
- if (curdef->name[0] == '\0') {
- defgroup_unique_name(curdef, ob);
- }
- }
-
- if (main->versionfile < 243 || main->subversionfile < 1) {
- ModifierData *md;
-
- /* translate old mirror modifier axis values to new flags */
- for (md=ob->modifiers.first; md; md=md->next) {
- if (md->type==eModifierType_Mirror) {
- MirrorModifierData *mmd = (MirrorModifierData*) md;
-
- switch (mmd->axis) {
- case 0:
- mmd->flag |= MOD_MIR_AXIS_X;
- break;
- case 1:
- mmd->flag |= MOD_MIR_AXIS_Y;
- break;
- case 2:
- mmd->flag |= MOD_MIR_AXIS_Z;
- break;
- }
-
- mmd->axis = 0;
- }
- }
- }
- }
-
- /* render layer added, this is not the active layer */
- if (main->versionfile <= 243 || main->subversionfile < 2) {
- Mesh *me;
- for (me=main->mesh.first; me; me=me->id.next)
- customdata_version_243(me);
- }
-
- }
-
- if (main->versionfile <= 244) {
- Scene *sce;
- bScreen *sc;
- Lamp *la;
- World *wrld;
-
- if (main->versionfile != 244 || main->subversionfile < 2) {
- for (sce= main->scene.first; sce; sce= sce->id.next)
- sce->r.mode |= R_SSS;
-
- /* correct older action editors - incorrect scrolling */
- for (sc= main->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa;
- sa= sc->areabase.first;
- while (sa) {
- SpaceLink *sl;
-
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- if (sl->spacetype==SPACE_ACTION) {
- SpaceAction *saction= (SpaceAction*) sl;
-
- saction->v2d.tot.ymin = -1000.0;
- saction->v2d.tot.ymax = 0.0;
-
- saction->v2d.cur.ymin = -75.0;
- saction->v2d.cur.ymax = 5.0;
- }
- }
- sa = sa->next;
- }
- }
- }
- if (main->versionfile != 244 || main->subversionfile < 3) {
- /* constraints recode version patch used to be here. Moved to 245 now... */
-
-
- for (wrld=main->world.first; wrld; wrld= wrld->id.next) {
- if (wrld->mode & WO_AMB_OCC)
- wrld->ao_samp_method = WO_AOSAMP_CONSTANT;
- else
- wrld->ao_samp_method = WO_AOSAMP_HAMMERSLEY;
-
- wrld->ao_adapt_thresh = 0.005f;
- }
-
- for (la=main->lamp.first; la; la= la->id.next) {
- if (la->type == LA_AREA)
- la->ray_samp_method = LA_SAMP_CONSTANT;
- else
- la->ray_samp_method = LA_SAMP_HALTON;
-
- la->adapt_thresh = 0.001f;
- }
- }
- }
- if (main->versionfile <= 245) {
- Scene *sce;
- Object *ob;
- Image *ima;
- Lamp *la;
- Material *ma;
- ParticleSettings *part;
- World *wrld;
- Mesh *me;
- bNodeTree *ntree;
- Tex *tex;
- ModifierData *md;
- ParticleSystem *psys;
-
- /* unless the file was created 2.44.3 but not 2.45, update the constraints */
- if ( !(main->versionfile==244 && main->subversionfile==3) &&
- ((main->versionfile<245) || (main->versionfile==245 && main->subversionfile==0)) )
- {
- for (ob = main->object.first; ob; ob= ob->id.next) {
- ListBase *list;
- list = &ob->constraints;
-
- /* fix up constraints due to constraint recode changes (originally at 2.44.3) */
- if (list) {
- bConstraint *curcon;
- for (curcon = list->first; curcon; curcon=curcon->next) {
- /* old CONSTRAINT_LOCAL check -> convert to CONSTRAINT_SPACE_LOCAL */
- if (curcon->flag & 0x20) {
- curcon->ownspace = CONSTRAINT_SPACE_LOCAL;
- curcon->tarspace = CONSTRAINT_SPACE_LOCAL;
- }
-
- switch (curcon->type) {
- case CONSTRAINT_TYPE_LOCLIMIT:
- {
- bLocLimitConstraint *data= (bLocLimitConstraint *)curcon->data;
-
- /* old limit without parent option for objects */
- if (data->flag2)
- curcon->ownspace = CONSTRAINT_SPACE_LOCAL;
- }
- break;
- }
- }
- }
-
- /* correctly initialize constinv matrix */
- unit_m4(ob->constinv);
-
- if (ob->type == OB_ARMATURE) {
- if (ob->pose) {
- bConstraint *curcon;
- bPoseChannel *pchan;
-
- for (pchan = ob->pose->chanbase.first; pchan; pchan=pchan->next) {
- /* make sure constraints are all up to date */
- for (curcon = pchan->constraints.first; curcon; curcon=curcon->next) {
- /* old CONSTRAINT_LOCAL check -> convert to CONSTRAINT_SPACE_LOCAL */
- if (curcon->flag & 0x20) {
- curcon->ownspace = CONSTRAINT_SPACE_LOCAL;
- curcon->tarspace = CONSTRAINT_SPACE_LOCAL;
- }
-
- switch (curcon->type) {
- case CONSTRAINT_TYPE_ACTION:
- {
- bActionConstraint *data= (bActionConstraint *)curcon->data;
-
- /* 'data->local' used to mean that target was in local-space */
- if (data->local)
- curcon->tarspace = CONSTRAINT_SPACE_LOCAL;
- }
- break;
- }
- }
-
- /* correctly initialize constinv matrix */
- unit_m4(pchan->constinv);
- }
- }
- }
- }
- }
-
- /* fix all versions before 2.45 */
- if (main->versionfile != 245) {
-
- /* repair preview from 242 - 244*/
- for (ima= main->image.first; ima; ima= ima->id.next) {
- ima->preview = NULL;
- }
- }
-
- /* add point caches */
- for (ob=main->object.first; ob; ob=ob->id.next) {
- if (ob->soft && !ob->soft->pointcache)
- ob->soft->pointcache= BKE_ptcache_add(&ob->soft->ptcaches);
-
- for (psys=ob->particlesystem.first; psys; psys=psys->next) {
- if (psys->pointcache) {
- if (psys->pointcache->flag & PTCACHE_BAKED && (psys->pointcache->flag & PTCACHE_DISK_CACHE)==0) {
- printf("Old memory cache isn't supported for particles, so re-bake the simulation!\n");
- psys->pointcache->flag &= ~PTCACHE_BAKED;
- }
- }
- else
- psys->pointcache= BKE_ptcache_add(&psys->ptcaches);
- }
-
- for (md=ob->modifiers.first; md; md=md->next) {
- if (md->type==eModifierType_Cloth) {
- ClothModifierData *clmd = (ClothModifierData*) md;
- if (!clmd->point_cache)
- clmd->point_cache= BKE_ptcache_add(&clmd->ptcaches);
- }
- }
- }
-
- /* Copy over old per-level multires vertex data
- * into a single vertex array in struct Multires */
- for (me = main->mesh.first; me; me=me->id.next) {
- if (me->mr && !me->mr->verts) {
- MultiresLevel *lvl = me->mr->levels.last;
- if (lvl) {
- me->mr->verts = lvl->verts;
- lvl->verts = NULL;
- /* Don't need the other vert arrays */
- for (lvl = lvl->prev; lvl; lvl = lvl->prev) {
- MEM_freeN(lvl->verts);
- lvl->verts = NULL;
- }
- }
- }
- }
-
- if (main->versionfile != 245 || main->subversionfile < 1) {
- for (la=main->lamp.first; la; la= la->id.next) {
- if (la->mode & LA_QUAD) la->falloff_type = LA_FALLOFF_SLIDERS;
- else la->falloff_type = LA_FALLOFF_INVLINEAR;
-
- if (la->curfalloff == NULL) {
- la->curfalloff = curvemapping_add(1, 0.0f, 1.0f, 1.0f, 0.0f);
- curvemapping_initialize(la->curfalloff);
- }
- }
- }
-
- for (ma=main->mat.first; ma; ma= ma->id.next) {
- if (ma->samp_gloss_mir == 0) {
- ma->gloss_mir = ma->gloss_tra= 1.0f;
- ma->aniso_gloss_mir = 1.0f;
- ma->samp_gloss_mir = ma->samp_gloss_tra= 18;
- ma->adapt_thresh_mir = ma->adapt_thresh_tra = 0.005f;
- ma->dist_mir = 0.0f;
- ma->fadeto_mir = MA_RAYMIR_FADETOSKY;
- }
-
- if (ma->strand_min == 0.0f)
- ma->strand_min= 1.0f;
- }
-
- for (part=main->particle.first; part; part=part->id.next) {
- if (part->ren_child_nbr==0)
- part->ren_child_nbr= part->child_nbr;
-
- if (part->simplify_refsize==0) {
- part->simplify_refsize= 1920;
- part->simplify_rate= 1.0f;
- part->simplify_transition= 0.1f;
- part->simplify_viewport= 0.8f;
- }
- }
-
- for (wrld=main->world.first; wrld; wrld= wrld->id.next) {
- if (wrld->ao_approx_error == 0.0f)
- wrld->ao_approx_error= 0.25f;
- }
-
- for (sce= main->scene.first; sce; sce= sce->id.next) {
- if (sce->nodetree)
- ntree_version_245(fd, lib, sce->nodetree);
-
- if (sce->r.simplify_shadowsamples == 0) {
- sce->r.simplify_subsurf= 6;
- sce->r.simplify_particles= 1.0f;
- sce->r.simplify_shadowsamples= 16;
- sce->r.simplify_aosss= 1.0f;
- }
-
- if (sce->r.cineongamma == 0) {
- sce->r.cineonblack= 95;
- sce->r.cineonwhite= 685;
- sce->r.cineongamma= 1.7f;
- }
- }
-
- for (ntree=main->nodetree.first; ntree; ntree= ntree->id.next)
- ntree_version_245(fd, lib, ntree);
-
- /* fix for temporary flag changes during 245 cycle */
- for (ima= main->image.first; ima; ima= ima->id.next) {
- if (ima->flag & IMA_OLD_PREMUL) {
- ima->flag &= ~IMA_OLD_PREMUL;
- ima->flag |= IMA_DO_PREMUL;
- }
- }
-
- for (tex=main->tex.first; tex; tex=tex->id.next) {
- if (tex->iuser.flag & IMA_OLD_PREMUL) {
- tex->iuser.flag &= ~IMA_OLD_PREMUL;
- tex->iuser.flag |= IMA_DO_PREMUL;
-
- }
-
- ima= blo_do_versions_newlibadr(fd, lib, tex->ima);
- if (ima && (tex->iuser.flag & IMA_DO_PREMUL)) {
- ima->flag &= ~IMA_OLD_PREMUL;
- ima->flag |= IMA_DO_PREMUL;
- }
- }
- }
-
- /* sanity check for skgen
- * */
- {
- Scene *sce;
- for (sce=main->scene.first; sce; sce = sce->id.next) {
- if (sce->toolsettings->skgen_subdivisions[0] == sce->toolsettings->skgen_subdivisions[1] ||
- sce->toolsettings->skgen_subdivisions[0] == sce->toolsettings->skgen_subdivisions[2] ||
- sce->toolsettings->skgen_subdivisions[1] == sce->toolsettings->skgen_subdivisions[2])
- {
- sce->toolsettings->skgen_subdivisions[0] = SKGEN_SUB_CORRELATION;
- sce->toolsettings->skgen_subdivisions[1] = SKGEN_SUB_LENGTH;
- sce->toolsettings->skgen_subdivisions[2] = SKGEN_SUB_ANGLE;
- }
- }
- }
-
-
- if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 2)) {
- Image *ima;
-
- /* initialize 1:1 Aspect */
- for (ima= main->image.first; ima; ima= ima->id.next) {
- ima->aspx = ima->aspy = 1.0f;
- }
-
- }
-
- if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 4)) {
- bArmature *arm;
- ModifierData *md;
- Object *ob;
-
- for (arm= main->armature.first; arm; arm= arm->id.next)
- arm->deformflag |= ARM_DEF_B_BONE_REST;
-
- for (ob = main->object.first; ob; ob= ob->id.next) {
- for (md=ob->modifiers.first; md; md=md->next) {
- if (md->type==eModifierType_Armature)
- ((ArmatureModifierData*)md)->deformflag |= ARM_DEF_B_BONE_REST;
- }
- }
- }
-
- if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 5)) {
- /* foreground color needs to be something other then black */
- Scene *sce;
- for (sce= main->scene.first; sce; sce=sce->id.next) {
- sce->r.fg_stamp[0] = sce->r.fg_stamp[1] = sce->r.fg_stamp[2] = 0.8f;
- sce->r.fg_stamp[3] = 1.0f; /* don't use text alpha yet */
- sce->r.bg_stamp[3] = 0.25f; /* make sure the background has full alpha */
- }
- }
-
-
- if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 6)) {
- Scene *sce;
- /* fix frs_sec_base */
- for (sce= main->scene.first; sce; sce= sce->id.next) {
- if (sce->r.frs_sec_base == 0) {
- sce->r.frs_sec_base = 1;
- }
- }
- }
-
- if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 7)) {
- Object *ob;
- bPoseChannel *pchan;
- bConstraint *con;
- bConstraintTarget *ct;
-
- for (ob = main->object.first; ob; ob= ob->id.next) {
- if (ob->pose) {
- for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
- for (con=pchan->constraints.first; con; con=con->next) {
- if (con->type == CONSTRAINT_TYPE_PYTHON) {
- bPythonConstraint *data= (bPythonConstraint *)con->data;
- if (data->tar) {
- /* version patching needs to be done */
- ct= MEM_callocN(sizeof(bConstraintTarget), "PyConTarget");
-
- ct->tar = data->tar;
- BLI_strncpy(ct->subtarget, data->subtarget, sizeof(ct->subtarget));
- ct->space = con->tarspace;
-
- BLI_addtail(&data->targets, ct);
- data->tarnum++;
-
- /* clear old targets to avoid problems */
- data->tar = NULL;
- data->subtarget[0]= '\0';
- }
- }
- else if (con->type == CONSTRAINT_TYPE_LOCLIKE) {
- bLocateLikeConstraint *data= (bLocateLikeConstraint *)con->data;
-
- /* new headtail functionality makes Bone-Tip function obsolete */
- if (data->flag & LOCLIKE_TIP)
- con->headtail = 1.0f;
- }
- }
- }
- }
-
- for (con=ob->constraints.first; con; con=con->next) {
- if (con->type==CONSTRAINT_TYPE_PYTHON) {
- bPythonConstraint *data= (bPythonConstraint *)con->data;
- if (data->tar) {
- /* version patching needs to be done */
- ct= MEM_callocN(sizeof(bConstraintTarget), "PyConTarget");
-
- ct->tar = data->tar;
- BLI_strncpy(ct->subtarget, data->subtarget, sizeof(ct->subtarget));
- ct->space = con->tarspace;
-
- BLI_addtail(&data->targets, ct);
- data->tarnum++;
-
- /* clear old targets to avoid problems */
- data->tar = NULL;
- data->subtarget[0]= '\0';
- }
- }
- else if (con->type == CONSTRAINT_TYPE_LOCLIKE) {
- bLocateLikeConstraint *data= (bLocateLikeConstraint *)con->data;
-
- /* new headtail functionality makes Bone-Tip function obsolete */
- if (data->flag & LOCLIKE_TIP)
- con->headtail = 1.0f;
- }
- }
-
- if (ob->soft && ob->soft->keys) {
- SoftBody *sb = ob->soft;
- int k;
-
- for (k=0; k<sb->totkey; k++) {
- if (sb->keys[k])
- MEM_freeN(sb->keys[k]);
- }
-
- MEM_freeN(sb->keys);
-
- sb->keys = NULL;
- sb->totkey = 0;
- }
- }
- }
-
- if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 8)) {
- Scene *sce;
- Object *ob;
- PartEff *paf=NULL;
-
- for (ob = main->object.first; ob; ob= ob->id.next) {
- if (ob->soft && ob->soft->keys) {
- SoftBody *sb = ob->soft;
- int k;
-
- for (k=0; k<sb->totkey; k++) {
- if (sb->keys[k])
- MEM_freeN(sb->keys[k]);
- }
-
- MEM_freeN(sb->keys);
-
- sb->keys = NULL;
- sb->totkey = 0;
- }
-
- /* convert old particles to new system */
- if ((paf = blo_do_version_give_parteff_245(ob))) {
- ParticleSystem *psys;
- ModifierData *md;
- ParticleSystemModifierData *psmd;
- ParticleSettings *part;
-
- /* create new particle system */
- psys = MEM_callocN(sizeof(ParticleSystem), "particle_system");
- psys->pointcache = BKE_ptcache_add(&psys->ptcaches);
-
- part = psys->part = psys_new_settings("ParticleSettings", main);
-
- /* needed for proper libdata lookup */
- blo_do_versions_oldnewmap_insert(fd->libmap, psys->part, psys->part, 0);
- part->id.lib= ob->id.lib;
-
- part->id.us--;
- part->id.flag |= (ob->id.flag & LIB_NEEDLINK);
-
- psys->totpart=0;
- psys->flag= PSYS_ENABLED|PSYS_CURRENT;
-
- BLI_addtail(&ob->particlesystem, psys);
-
- md= modifier_new(eModifierType_ParticleSystem);
- BLI_snprintf(md->name, sizeof(md->name), "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
- psmd= (ParticleSystemModifierData*) md;
- psmd->psys=psys;
- BLI_addtail(&ob->modifiers, md);
-
- /* convert settings from old particle system */
- /* general settings */
- part->totpart = MIN2(paf->totpart, 100000);
- part->sta = paf->sta;
- part->end = paf->end;
- part->lifetime = paf->lifetime;
- part->randlife = paf->randlife;
- psys->seed = paf->seed;
- part->disp = paf->disp;
- part->omat = paf->mat[0];
- part->hair_step = paf->totkey;
-
- part->eff_group = paf->group;
-
- /* old system didn't interpolate between keypoints at render time */
- part->draw_step = part->ren_step = 0;
-
- /* physics */
- part->normfac = paf->normfac * 25.0f;
- part->obfac = paf->obfac;
- part->randfac = paf->randfac * 25.0f;
- part->dampfac = paf->damp;
- copy_v3_v3(part->acc, paf->force);
-
- /* flags */
- if (paf->stype & PAF_VECT) {
- if (paf->flag & PAF_STATIC) {
- /* new hair lifetime is always 100.0f */
- float fac = paf->lifetime / 100.0f;
-
- part->draw_as = PART_DRAW_PATH;
- part->type = PART_HAIR;
- psys->recalc |= PSYS_RECALC_REDO;
-
- part->normfac *= fac;
- part->randfac *= fac;
- }
- else {
- part->draw_as = PART_DRAW_LINE;
- part->draw |= PART_DRAW_VEL_LENGTH;
- part->draw_line[1] = 0.04f;
- }
- }
-
- part->rotmode = PART_ROT_VEL;
-
- part->flag |= (paf->flag & PAF_BSPLINE) ? PART_HAIR_BSPLINE : 0;
- part->flag |= (paf->flag & PAF_TRAND) ? PART_TRAND : 0;
- part->flag |= (paf->flag & PAF_EDISTR) ? PART_EDISTR : 0;
- part->flag |= (paf->flag & PAF_UNBORN) ? PART_UNBORN : 0;
- part->flag |= (paf->flag & PAF_DIED) ? PART_DIED : 0;
- part->from |= (paf->flag & PAF_FACE) ? PART_FROM_FACE : 0;
- part->draw |= (paf->flag & PAF_SHOWE) ? PART_DRAW_EMITTER : 0;
-
- psys->vgroup[PSYS_VG_DENSITY] = paf->vertgroup;
- psys->vgroup[PSYS_VG_VEL] = paf->vertgroup_v;
- psys->vgroup[PSYS_VG_LENGTH] = paf->vertgroup_v;
-
- /* dupliobjects */
- if (ob->transflag & OB_DUPLIVERTS) {
- Object *dup = main->object.first;
-
- for (; dup; dup= dup->id.next) {
- if (ob == blo_do_versions_newlibadr(fd, lib, dup->parent)) {
- part->dup_ob = dup;
- ob->transflag |= OB_DUPLIPARTS;
- ob->transflag &= ~OB_DUPLIVERTS;
-
- part->draw_as = PART_DRAW_OB;
-
- /* needed for proper libdata lookup */
- blo_do_versions_oldnewmap_insert(fd->libmap, dup, dup, 0);
- }
- }
- }
-
-
- {
- FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
- if (fluidmd && fluidmd->fss && fluidmd->fss->type == OB_FLUIDSIM_PARTICLE)
- part->type = PART_FLUID;
- }
-
- do_version_free_effects_245(&ob->effect);
-
- printf("Old particle system converted to new system.\n");
- }
- }
-
- for (sce= main->scene.first; sce; sce=sce->id.next) {
- ParticleEditSettings *pset= &sce->toolsettings->particle;
- int a;
-
- if (pset->brush[0].size == 0) {
- pset->flag= PE_KEEP_LENGTHS|PE_LOCK_FIRST|PE_DEFLECT_EMITTER;
- pset->emitterdist= 0.25f;
- pset->totrekey= 5;
- pset->totaddkey= 5;
- pset->brushtype= PE_BRUSH_NONE;
-
- for (a=0; a<PE_TOT_BRUSH; a++) {
- pset->brush[a].strength= 50;
- pset->brush[a].size= 50;
- pset->brush[a].step= 10;
- }
-
- pset->brush[PE_BRUSH_CUT].strength= 100;
- }
- }
- }
- if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 9)) {
- Material *ma;
- int a;
-
- for (ma=main->mat.first; ma; ma= ma->id.next)
- if (ma->mode & MA_NORMAP_TANG)
- for (a=0; a<MAX_MTEX; a++)
- if (ma->mtex[a] && ma->mtex[a]->tex)
- ma->mtex[a]->normapspace = MTEX_NSPACE_TANGENT;
- }
-
- if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 10)) {
- Object *ob;
-
- /* dupliface scale */
- for (ob= main->object.first; ob; ob= ob->id.next)
- ob->dupfacesca = 1.0f;
- }
-
- if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 11)) {
- Object *ob;
- bActionStrip *strip;
-
- /* nla-strips - scale */
- for (ob= main->object.first; ob; ob= ob->id.next) {
- for (strip= ob->nlastrips.first; strip; strip= strip->next) {
- float length, actlength, repeat;
-
- if (strip->flag & ACTSTRIP_USESTRIDE)
- repeat= 1.0f;
- else
- repeat= strip->repeat;
-
- length = strip->end-strip->start;
- if (length == 0.0f) length= 1.0f;
- actlength = strip->actend-strip->actstart;
-
- strip->scale = length / (repeat * actlength);
- if (strip->scale == 0.0f) strip->scale= 1.0f;
- }
- if (ob->soft) {
- ob->soft->inpush = ob->soft->inspring;
- ob->soft->shearstiff = 1.0f;
- }
- }
- }
-
- if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 14)) {
- Scene *sce;
- Sequence *seq;
-
- for (sce=main->scene.first; sce; sce=sce->id.next) {
- SEQ_BEGIN (sce->ed, seq)
- {
- if (seq->blend_mode == 0)
- seq->blend_opacity = 100.0f;
- }
- SEQ_END
- }
- }
-
- /*fix broken group lengths in id properties*/
- if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 15)) {
- idproperties_fix_group_lengths(main->scene);
- idproperties_fix_group_lengths(main->library);
- idproperties_fix_group_lengths(main->object);
- idproperties_fix_group_lengths(main->mesh);
- idproperties_fix_group_lengths(main->curve);
- idproperties_fix_group_lengths(main->mball);
- idproperties_fix_group_lengths(main->mat);
- idproperties_fix_group_lengths(main->tex);
- idproperties_fix_group_lengths(main->image);
- idproperties_fix_group_lengths(main->latt);
- idproperties_fix_group_lengths(main->lamp);
- idproperties_fix_group_lengths(main->camera);
- idproperties_fix_group_lengths(main->ipo);
- idproperties_fix_group_lengths(main->key);
- idproperties_fix_group_lengths(main->world);
- idproperties_fix_group_lengths(main->screen);
- idproperties_fix_group_lengths(main->script);
- idproperties_fix_group_lengths(main->vfont);
- idproperties_fix_group_lengths(main->text);
- idproperties_fix_group_lengths(main->sound);
- idproperties_fix_group_lengths(main->group);
- idproperties_fix_group_lengths(main->armature);
- idproperties_fix_group_lengths(main->action);
- idproperties_fix_group_lengths(main->nodetree);
- idproperties_fix_group_lengths(main->brush);
- idproperties_fix_group_lengths(main->particle);
- }
-
- /* sun/sky */
- if (main->versionfile < 246) {
- Object *ob;
- bActuator *act;
-
- /* dRot actuator change direction in 2.46 */
- for (ob = main->object.first; ob; ob= ob->id.next) {
- for (act= ob->actuators.first; act; act= act->next) {
- if (act->type == ACT_OBJECT) {
- bObjectActuator *ba= act->data;
-
- ba->drot[0] = -ba->drot[0];
- ba->drot[1] = -ba->drot[1];
- ba->drot[2] = -ba->drot[2];
- }
- }
- }
- }
-
- // convert fluids to modifier
- if (main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)) {
- Object *ob;
-
- for (ob = main->object.first; ob; ob= ob->id.next) {
- if (ob->fluidsimSettings) {
- FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifier_new(eModifierType_Fluidsim);
- BLI_addhead(&ob->modifiers, (ModifierData *)fluidmd);
-
- MEM_freeN(fluidmd->fss);
- fluidmd->fss = MEM_dupallocN(ob->fluidsimSettings);
- fluidmd->fss->ipo = blo_do_versions_newlibadr_us(fd, ob->id.lib, ob->fluidsimSettings->ipo);
- MEM_freeN(ob->fluidsimSettings);
-
- fluidmd->fss->lastgoodframe = INT_MAX;
- fluidmd->fss->flag = 0;
- fluidmd->fss->meshVelocities = NULL;
- }
- }
- }
-
-
- if (main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)) {
- Mesh *me;
-
- for (me=main->mesh.first; me; me= me->id.next)
- alphasort_version_246(fd, lib, me);
- }
-
- if (main->versionfile < 246 || (main->versionfile == 246 && main->subversionfile < 1)) {
- Object *ob;
- for (ob = main->object.first; ob; ob= ob->id.next) {
- if (ob->pd && (ob->pd->forcefield == PFIELD_WIND))
- ob->pd->f_noise = 0.0f;
- }
- }
-
- if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 2)) {
- Object *ob;
- for (ob = main->object.first; ob; ob= ob->id.next) {
- ob->gameflag |= OB_COLLISION;
- ob->margin = 0.06f;
- }
- }
-
- if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 3)) {
- Object *ob;
- for (ob = main->object.first; ob; ob= ob->id.next) {
- // Starting from subversion 3, ACTOR is a separate feature.
- // Before it was conditioning all the other dynamic flags
- if (!(ob->gameflag & OB_ACTOR))
- ob->gameflag &= ~(OB_GHOST|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_COLLISION_RESPONSE);
- /* suitable default for older files */
- }
- }
-
- if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 5)) {
- Lamp *la= main->lamp.first;
- for (; la; la= la->id.next) {
- la->skyblendtype= MA_RAMP_ADD;
- la->skyblendfac= 1.0f;
- }
- }
-
- /* set the curve radius interpolation to 2.47 default - easy */
- if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 6)) {
- Curve *cu;
- Nurb *nu;
-
- for (cu= main->curve.first; cu; cu= cu->id.next) {
- for (nu= cu->nurb.first; nu; nu= nu->next) {
- if (nu) {
- nu->radius_interp = 3;
-
- /* resolu and resolv are now used differently for surfaces
- * rather than using the resolution to define the entire number of divisions,
- * use it for the number of divisions per segment
- */
- if (nu->pntsv > 1) {
- nu->resolu = MAX2( 1, (int)(((float)nu->resolu / (float)nu->pntsu)+0.5f) );
- nu->resolv = MAX2( 1, (int)(((float)nu->resolv / (float)nu->pntsv)+0.5f) );
- }
- }
- }
- }
- }
- /* direction constraint actuators were always local in previous version */
- if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 7)) {
- bActuator *act;
- Object *ob;
-
- for (ob = main->object.first; ob; ob= ob->id.next) {
- for (act= ob->actuators.first; act; act= act->next) {
- if (act->type == ACT_CONSTRAINT) {
- bConstraintActuator *coa = act->data;
- if (coa->type == ACT_CONST_TYPE_DIST) {
- coa->flag |= ACT_CONST_LOCAL;
- }
- }
- }
- }
- }
-
- if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 9)) {
- Lamp *la= main->lamp.first;
- for (; la; la= la->id.next) {
- la->sky_exposure= 1.0f;
- }
- }
-
- /* BGE message actuators needed OB prefix, very confusing */
- if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 10)) {
- bActuator *act;
- Object *ob;
-
- for (ob = main->object.first; ob; ob= ob->id.next) {
- for (act= ob->actuators.first; act; act= act->next) {
- if (act->type == ACT_MESSAGE) {
- bMessageActuator *msgAct = (bMessageActuator *) act->data;
- if (BLI_strnlen(msgAct->toPropName, 3) > 2) {
- /* strip first 2 chars, would have only worked if these were OB anyway */
- memmove(msgAct->toPropName, msgAct->toPropName + 2, sizeof(msgAct->toPropName) - 2);
- }
- else {
- msgAct->toPropName[0] = '\0';
- }
- }
- }
- }
- }
-
- if (main->versionfile < 248) {
- Lamp *la;
-
- for (la=main->lamp.first; la; la= la->id.next) {
- if (la->atm_turbidity == 0.0f) {
- la->sun_effect_type = 0;
- la->horizon_brightness = 1.0f;
- la->spread = 1.0f;
- la->sun_brightness = 1.0f;
- la->sun_size = 1.0f;
- la->backscattered_light = 1.0f;
- la->atm_turbidity = 2.0f;
- la->atm_inscattering_factor = 1.0f;
- la->atm_extinction_factor = 1.0f;
- la->atm_distance_factor = 1.0f;
- la->sun_intensity = 1.0f;
- }
- }
- }
-
- if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 2)) {
- Scene *sce;
-
- /* Note, these will need to be added for painting */
- for (sce= main->scene.first; sce; sce= sce->id.next) {
- sce->toolsettings->imapaint.seam_bleed = 2;
- sce->toolsettings->imapaint.normal_angle = 80;
-
- /* initialize skeleton generation toolsettings */
- sce->toolsettings->skgen_resolution = 250;
- sce->toolsettings->skgen_threshold_internal = 0.1f;
- sce->toolsettings->skgen_threshold_external = 0.1f;
- sce->toolsettings->skgen_angle_limit = 30.0f;
- sce->toolsettings->skgen_length_ratio = 1.3f;
- sce->toolsettings->skgen_length_limit = 1.5f;
- sce->toolsettings->skgen_correlation_limit = 0.98f;
- sce->toolsettings->skgen_symmetry_limit = 0.1f;
- sce->toolsettings->skgen_postpro = SKGEN_SMOOTH;
- sce->toolsettings->skgen_postpro_passes = 3;
- sce->toolsettings->skgen_options = SKGEN_FILTER_INTERNAL|SKGEN_FILTER_EXTERNAL|SKGEN_FILTER_SMART|SKGEN_SUB_CORRELATION|SKGEN_HARMONIC;
- sce->toolsettings->skgen_subdivisions[0] = SKGEN_SUB_CORRELATION;
- sce->toolsettings->skgen_subdivisions[1] = SKGEN_SUB_LENGTH;
- sce->toolsettings->skgen_subdivisions[2] = SKGEN_SUB_ANGLE;
-
-
- sce->toolsettings->skgen_retarget_angle_weight = 1.0f;
- sce->toolsettings->skgen_retarget_length_weight = 1.0f;
- sce->toolsettings->skgen_retarget_distance_weight = 1.0f;
-
- /* Skeleton Sketching */
- sce->toolsettings->bone_sketching = 0;
- sce->toolsettings->skgen_retarget_roll = SK_RETARGET_ROLL_VIEW;
- }
- }
- if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 3)) {
- bScreen *sc;
-
- /* adjust default settings for Animation Editors */
- for (sc= main->screen.first; sc; sc= sc->id.next) {
- ScrArea *sa;
-
- for (sa= sc->areabase.first; sa; sa= sa->next) {
- SpaceLink *sl;
-
- for (sl= sa->spacedata.first; sl; sl= sl->next) {
- switch (sl->spacetype) {
- case SPACE_ACTION:
- {
- SpaceAction *sact= (SpaceAction *)sl;
-
- sact->mode= SACTCONT_DOPESHEET;
- sact->autosnap= SACTSNAP_FRAME;
- }
- break;
- case SPACE_IPO:
- {
- SpaceIpo *sipo= (SpaceIpo *)sl;
- sipo->autosnap= SACTSNAP_FRAME;
- }
- break;
- case SPACE_NLA:
- {
- SpaceNla *snla= (SpaceNla *)sl;
- snla->autosnap= SACTSNAP_FRAME;
- }
- break;
- }
- }
- }
- }
- }
-
- if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 3)) {
- Object *ob;
-
- /* Adjustments needed after Bullets update */
- for (ob = main->object.first; ob; ob= ob->id.next) {
- ob->damping *= 0.635f;
- ob->rdamping = 0.1f + (0.8f * ob->rdamping);
- }
- }
-
- if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 4)) {
- Scene *sce;
- World *wrld;
-
- /* Dome (Fisheye) default parameters */
- for (sce= main->scene.first; sce; sce= sce->id.next) {
- sce->r.domeangle = 180;
- sce->r.domemode = 1;
- sce->r.domeres = 4;
- sce->r.domeresbuf = 1.0f;
- sce->r.dometilt = 0;
- }
- /* DBVT culling by default */
- for (wrld=main->world.first; wrld; wrld= wrld->id.next) {
- wrld->mode |= WO_DBVT_CULLING;
- wrld->occlusionRes = 128;
- }
- }
-
- if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 5)) {
- Object *ob;
- World *wrld;
- for (ob = main->object.first; ob; ob= ob->id.next) {
- ob->m_contactProcessingThreshold = 1.0f; //pad3 is used for m_contactProcessingThreshold
- if (ob->parent) {
- /* check if top parent has compound shape set and if yes, set this object
- * to compound shaper as well (was the behavior before, now it's optional) */
- Object *parent= blo_do_versions_newlibadr(fd, lib, ob->parent);
- while (parent && parent != ob && parent->parent != NULL) {
- parent = blo_do_versions_newlibadr(fd, lib, parent->parent);
- }
- if (parent) {
- if (parent->gameflag & OB_CHILD)
- ob->gameflag |= OB_CHILD;
- }
- }
- }
- for (wrld=main->world.first; wrld; wrld= wrld->id.next) {
- wrld->ticrate = 60;
- wrld->maxlogicstep = 5;
- wrld->physubstep = 1;
- wrld->maxphystep = 5;
- }
- }
-
- // correct introduce of seed for wind force
- if (main->versionfile < 249 && main->subversionfile < 1) {
- Object *ob;
- for (ob = main->object.first; ob; ob= ob->id.next) {
- if (ob->pd)
- ob->pd->seed = ((unsigned int)(ceil(PIL_check_seconds_timer()))+1) % 128;
- }
-
- }
-
- if (main->versionfile < 249 && main->subversionfile < 2) {
- Scene *sce= main->scene.first;
- Sequence *seq;
- Editing *ed;
-
- while (sce) {
- ed= sce->ed;
- if (ed) {
- SEQP_BEGIN (ed, seq)
- {
- if (seq->strip && seq->strip->proxy) {
- seq->strip->proxy->quality =90;
- }
- }
- SEQ_END
- }
-
- sce= sce->id.next;
- }
-
- }
-
- /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
- /* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
-
- /* don't forget to set version number in blender.c! */
-}
-
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index dcae11ff2e1..0c44c631511 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2679,6 +2679,18 @@ static void write_movieTracks(WriteData *wd, ListBase *tracks)
}
}
+static void write_movieDopesheet(WriteData *wd, MovieTrackingDopesheet *dopesheet)
+{
+ MovieTrackingDopesheetChannel *channel;
+
+ channel = dopesheet->channels.first;
+ while (channel) {
+ writestruct(wd, DATA, "MovieTrackingDopesheetChannel", 1, channel);
+
+ channel = channel->next;
+ }
+}
+
static void write_movieReconstruction(WriteData *wd, MovieTrackingReconstruction *reconstruction)
{
if (reconstruction->camnr)
@@ -2711,6 +2723,8 @@ static void write_movieclips(WriteData *wd, ListBase *idbase)
object= object->next;
}
+
+ write_movieDopesheet(wd, &tracking->dopesheet);
}
clip= clip->id.next;
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c
index 0169caa8f61..c2d5d93cbc3 100644
--- a/source/blender/bmesh/intern/bmesh_construct.c
+++ b/source/blender/bmesh/intern/bmesh_construct.c
@@ -384,7 +384,7 @@ BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int totv, int n
/* more of a weight then a distance */
far_cross_dist = (/* first we want to have a value close to zero mapped to 1 */
- 1.0f - fabsf(dot_v3v3(far_vec, far_cross_vec)) *
+ 1.0 - fabsf(dot_v3v3(far_vec, far_cross_vec)) *
/* second we multiply by the distance
* so points close to the center are not preferred */
diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c
index f64b55193c5..c774880332b 100644
--- a/source/blender/bmesh/intern/bmesh_interp.c
+++ b/source/blender/bmesh/intern/bmesh_interp.c
@@ -78,7 +78,7 @@ void BM_data_interp_from_verts(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v, con
src[0] = v1->head.data;
src[1] = v2->head.data;
- w[0] = 1.0f - fac;
+ w[0] = 1.0f-fac;
w[1] = fac;
CustomData_bmesh_interp(&bm->vdata, src, w, NULL, 2, v->head.data);
}
@@ -198,11 +198,20 @@ void BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source)
static int compute_mdisp_quad(BMLoop *l, float v1[3], float v2[3], float v3[3], float v4[3],
float e1[3], float e2[3])
{
- float cent[3], n[3], p[3];
-
+ float cent[3] = {0.0f, 0.0f, 0.0f}, n[3], p[3];
+ BMLoop *l_first;
+ BMLoop *l_iter;
+
/* computer center */
- BM_face_calc_center_mean(l->f, cent);
-
+ l_iter = l_first = BM_FACE_FIRST_LOOP(l->f);
+ do {
+ cent[0] += (float)l_iter->v->co[0];
+ cent[1] += (float)l_iter->v->co[1];
+ cent[2] += (float)l_iter->v->co[2];
+ } while ((l_iter = l_iter->next) != l_first);
+
+ mul_v3_fl(cent, (1.0 / (float)l->f->len));
+
add_v3_v3v3(p, l->prev->v->co, l->v->co);
mul_v3_fl(p, 0.5);
add_v3_v3v3(n, l->next->v->co, l->v->co);
@@ -231,8 +240,8 @@ static float quad_coord(float aa[3], float bb[3], float cc[3], float dd[3], int
if (fabsf(2.0f * (x - y + z)) > FLT_EPSILON * 10.0f) {
float f2;
- f1 = ( sqrtf(y * y - 4.0f * x * z) - y + 2.0f * z) / (2.0f * (x - y + z));
- f2 = (-sqrtf(y * y - 4.0f * x * z) - y + 2.0f * z) / (2.0f * (x - y + z));
+ f1 = (sqrt(y * y - 4.0 * x * z) - y + 2.0 * z) / (2.0 * (x - y + z));
+ f2 = (-sqrt(y * y - 4.0 * x * z) - y + 2.0 * z) / (2.0 * (x - y + z));
f1 = fabsf(f1);
f2 = fabsf(f2);
@@ -243,7 +252,7 @@ static float quad_coord(float aa[3], float bb[3], float cc[3], float dd[3], int
f1 = -z / (y - 2 * z);
CLAMP(f1, 0.0f, 1.0f + FLT_EPSILON);
- if (isnan(f1) || f1 > 1.0f || f1 < 0.0f) {
+ if (isnan(f1) || f1 > 1.0 || f1 < 0.0f) {
int i;
for (i = 0; i < 2; i++) {
@@ -336,8 +345,8 @@ static int mdisp_in_mdispquad(BMLoop *l, BMLoop *tl, float p[3], float *x, float
sub_v3_v3(v1, c); sub_v3_v3(v2, c);
sub_v3_v3(v3, c); sub_v3_v3(v4, c);
- mul_v3_fl(v1, 1.0f + eps); mul_v3_fl(v2, 1.0f + eps);
- mul_v3_fl(v3, 1.0f + eps); mul_v3_fl(v4, 1.0f + eps);
+ mul_v3_fl(v1, 1.0 + eps); mul_v3_fl(v2, 1.0 + eps);
+ mul_v3_fl(v3, 1.0 + eps); mul_v3_fl(v4, 1.0 + eps);
add_v3_v3(v1, c); add_v3_v3(v2, c);
add_v3_v3(v3, c); add_v3_v3(v4, c);
@@ -383,9 +392,9 @@ static void bm_loop_flip_disp(float source_axis_x[3], float source_axis_y[3],
d = bm_loop_flip_equotion(mat, b, target_axis_x, target_axis_y, coord, 0, 1);
- if (fabsf(d) < 1e-4f) {
+ if (fabsf(d) < 1e-4) {
d = bm_loop_flip_equotion(mat, b, target_axis_x, target_axis_y, coord, 0, 2);
- if (fabsf(d) < 1e-4f)
+ if (fabsf(d) < 1e-4)
d = bm_loop_flip_equotion(mat, b, target_axis_x, target_axis_y, coord, 1, 2);
}
@@ -430,7 +439,7 @@ static void bm_loop_interp_mdisps(BMesh *bm, BMLoop *target, BMFace *source)
mdisp_axis_from_quad(v1, v2, v3, v4, axis_x, axis_y);
res = (int)sqrt(mdisps->totdisp);
- d = 1.0f / (float)(res - 1);
+ d = 1.0 / (float)(res - 1);
for (x = 0.0f, ix = 0; ix < res; x += d, ix++) {
for (y = 0.0f, iy = 0; iy < res; y += d, iy++) {
float co1[3], co2[3], co[3];
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index fe94983dc88..cb66486cd9e 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -47,14 +47,10 @@ BMAllocTemplate bm_mesh_chunksize_default = {512, 1024, 2048, 512};
static void bm_mempool_init(BMesh *bm, const BMAllocTemplate *allocsize)
{
- bm->vpool = BLI_mempool_create(sizeof(BMVert), allocsize->totvert,
- bm_mesh_chunksize_default.totvert, BLI_MEMPOOL_ALLOW_ITER);
- bm->epool = BLI_mempool_create(sizeof(BMEdge), allocsize->totedge,
- bm_mesh_chunksize_default.totedge, BLI_MEMPOOL_ALLOW_ITER);
- bm->lpool = BLI_mempool_create(sizeof(BMLoop), allocsize->totloop,
- bm_mesh_chunksize_default.totloop, 0);
- bm->fpool = BLI_mempool_create(sizeof(BMFace), allocsize->totface,
- bm_mesh_chunksize_default.totface, BLI_MEMPOOL_ALLOW_ITER);
+ bm->vpool = BLI_mempool_create(sizeof(BMVert), allocsize->totvert, bm_mesh_chunksize_default.totvert, BLI_MEMPOOL_ALLOW_ITER);
+ bm->epool = BLI_mempool_create(sizeof(BMEdge), allocsize->totedge, bm_mesh_chunksize_default.totedge, BLI_MEMPOOL_ALLOW_ITER);
+ bm->lpool = BLI_mempool_create(sizeof(BMLoop), allocsize->totloop, bm_mesh_chunksize_default.totloop, 0);
+ bm->fpool = BLI_mempool_create(sizeof(BMFace), allocsize->totface, bm_mesh_chunksize_default.totface, BLI_MEMPOOL_ALLOW_ITER);
#ifdef USE_BMESH_HOLES
bm->looplistpool = BLI_mempool_create(sizeof(BMLoopList), allocsize[3], allocsize[3], FALSE, FALSE);
diff --git a/source/blender/bmesh/intern/bmesh_mesh_validate.c b/source/blender/bmesh/intern/bmesh_mesh_validate.c
index 8ab5f10361f..3ec3b84c120 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_validate.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_validate.c
@@ -107,12 +107,10 @@ int BM_mesh_validate(BMesh *bm)
ERRMSG("edge %d: has invalid loop, loop is of face %d", i, BM_elem_index_get(l_iter->f));
}
else if (BM_vert_in_edge(e, l_iter->v) == FALSE) {
- ERRMSG("edge %d: has invalid loop with vert not in edge, loop is of face %d",
- i, BM_elem_index_get(l_iter->f));
+ ERRMSG("edge %d: has invalid loop with vert not in edge, loop is of face %d", i, BM_elem_index_get(l_iter->f));
}
else if (BM_vert_in_edge(e, l_iter->next->v) == FALSE) {
- ERRMSG("edge %d: has invalid loop with next vert not in edge, loop is of face %d",
- i, BM_elem_index_get(l_iter->f));
+ ERRMSG("edge %d: has invalid loop with next vert not in edge, loop is of face %d", i, BM_elem_index_get(l_iter->f));
}
} while ((l_iter = l_iter->radial_next) != l_first);
}
diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c
index c4cbb19eef7..5f3836cc413 100644
--- a/source/blender/bmesh/intern/bmesh_mods.c
+++ b/source/blender/bmesh/intern/bmesh_mods.c
@@ -1053,7 +1053,7 @@ BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_
/* first create the new edge, this is so we can copy the customdata from the old one
* if splice if disabled, always add in a new edge even if theres one there. */
- e_new = BM_edge_create(bm, v1, v2, e, (check_flag & BM_EDGEROT_CHECK_SPLICE) != 0);
+ e_new = BM_edge_create(bm, v1, v2, e, (check_flag & BM_EDGEROT_CHECK_SPLICE)!=0);
f_hflag_prev_1 = l1->f->head.hflag;
f_hflag_prev_2 = l2->f->head.hflag;
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index b5e6d7e1f68..2ff28aee191 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -696,7 +696,6 @@ static BMOpDefine bmo_esubd_def = {
{{BMO_OP_SLOT_ELEMENT_BUF, "edges"},
{BMO_OP_SLOT_FLT, "smooth"},
{BMO_OP_SLOT_FLT, "fractal"},
- {BMO_OP_SLOT_FLT, "along_normal"},
{BMO_OP_SLOT_INT, "numcuts"},
{BMO_OP_SLOT_INT, "seed"},
{BMO_OP_SLOT_MAPPING, "custompatterns"},
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index 97347f841c8..dce491efe72 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -1054,7 +1054,7 @@ static void bmo_flag_layer_alloc(BMesh *bm)
BM_elem_index_set(ele, i); /* set_inline */
}
- bm->elem_index_dirty &= ~(BM_VERT | BM_EDGE | BM_FACE);
+ bm->elem_index_dirty &= ~(BM_VERT|BM_EDGE|BM_FACE);
BLI_mempool_destroy(oldpool);
}
@@ -1099,7 +1099,7 @@ static void bmo_flag_layer_free(BMesh *bm)
BM_elem_index_set(ele, i); /* set_inline */
}
- bm->elem_index_dirty &= ~(BM_VERT | BM_EDGE | BM_FACE);
+ bm->elem_index_dirty &= ~(BM_VERT|BM_EDGE|BM_FACE);
BLI_mempool_destroy(oldpool);
}
@@ -1128,7 +1128,7 @@ static void bmo_flag_layer_clear(BMesh *bm)
BM_elem_index_set(ele, i); /* set_inline */
}
- bm->elem_index_dirty &= ~(BM_VERT | BM_EDGE | BM_FACE);
+ bm->elem_index_dirty &= ~(BM_VERT|BM_EDGE|BM_FACE);
}
void *BMO_slot_buffer_elem_first(BMOperator *op, const char *slotname)
diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h
index b0a647b7009..f4db13e2777 100644
--- a/source/blender/bmesh/intern/bmesh_operators.h
+++ b/source/blender/bmesh/intern/bmesh_operators.h
@@ -98,7 +98,7 @@ extern int bmesh_total_ops;
struct Object;
void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
- float smooth, float fractal, float along_normal,
+ float smooth, float fractal,
int numcuts,
int seltype, int cornertype,
const short use_singleedge, const short use_gridfill,
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index 8628ed7f9a1..e9a35ff70a2 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -900,7 +900,7 @@ float BM_vert_calc_edge_angle(BMVert *v)
BMVert *v1 = BM_edge_other_vert(e1, v);
BMVert *v2 = BM_edge_other_vert(e2, v);
- return (float)M_PI - angle_v3v3v3(v1->co, v->co, v2->co);
+ return M_PI - angle_v3v3v3(v1->co, v->co, v2->co);
}
else {
return DEG2RADF(90.0f);
diff --git a/source/blender/bmesh/operators/bmo_bevel.c b/source/blender/bmesh/operators/bmo_bevel.c
index f02b88c5b05..b6b54b82f3d 100644
--- a/source/blender/bmesh/operators/bmo_bevel.c
+++ b/source/blender/bmesh/operators/bmo_bevel.c
@@ -151,10 +151,10 @@ static void calc_corner_co(BMLoop *l, const float fac, float r_co[3],
/* done */
if (do_even) {
- mul_v3_fl(co_ofs, (fac * 0.5f) * shell_angle_to_dist(0.5f * angle));
+ mul_v3_fl(co_ofs, (fac * 0.5) * shell_angle_to_dist(0.5f * angle));
}
else {
- mul_v3_fl(co_ofs, fac * 0.5f);
+ mul_v3_fl(co_ofs, fac * 0.5);
}
}
@@ -208,9 +208,9 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
BLI_smallhash_init(&hash);
BMO_ITER (e, &siter, bm, op, "geom", BM_EDGE) {
- BMO_elem_flag_enable(bm, e, BEVEL_FLAG | BEVEL_DEL);
- BMO_elem_flag_enable(bm, e->v1, BEVEL_FLAG | BEVEL_DEL);
- BMO_elem_flag_enable(bm, e->v2, BEVEL_FLAG | BEVEL_DEL);
+ BMO_elem_flag_enable(bm, e, BEVEL_FLAG|BEVEL_DEL);
+ BMO_elem_flag_enable(bm, e->v1, BEVEL_FLAG|BEVEL_DEL);
+ BMO_elem_flag_enable(bm, e->v2, BEVEL_FLAG|BEVEL_DEL);
if (BM_edge_face_count(e) < 2) {
BMO_elem_flag_disable(bm, e, BEVEL_DEL);
@@ -281,8 +281,8 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
BMLoop *l;
BMIter liter;
- BMO_elem_flag_enable(bm, e->v1, BEVEL_FLAG | BEVEL_DEL);
- BMO_elem_flag_enable(bm, e->v2, BEVEL_FLAG | BEVEL_DEL);
+ BMO_elem_flag_enable(bm, e->v1, BEVEL_FLAG|BEVEL_DEL);
+ BMO_elem_flag_enable(bm, e->v2, BEVEL_FLAG|BEVEL_DEL);
if (BM_edge_face_count(e) < 2) {
BMO_elem_flag_disable(bm, e, BEVEL_DEL);
@@ -597,7 +597,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
continue;
}
- BMO_elem_flag_enable(bm, f, FACE_NEW | FACE_SPAN);
+ BMO_elem_flag_enable(bm, f, FACE_NEW|FACE_SPAN);
/* un-tag edges in f for deletio */
BM_ITER_ELEM (l2, &liter2, f, BM_LOOPS_OF_FACE) {
@@ -775,7 +775,7 @@ void bmo_bevel_exec(BMesh *bm, BMOperator *op)
fprintf(stderr, "%s: in bevel vert fill! (bmesh internal error)\n", __func__);
}
else {
- BMO_elem_flag_enable(bm, f, FACE_NEW | FACE_HOLE);
+ BMO_elem_flag_enable(bm, f, FACE_NEW|FACE_HOLE);
}
}
BLI_smallhash_release(&tmphash);
diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c
index 85aed6141bb..6f08ab421f3 100644
--- a/source/blender/bmesh/operators/bmo_create.c
+++ b/source/blender/bmesh/operators/bmo_create.c
@@ -1285,7 +1285,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
const short use_smooth = BMO_slot_bool_get(op, "use_smooth");
/* count number of each element type we were passe */
- BMO_ITER (h, &oiter, bm, op, "geom", BM_VERT | BM_EDGE | BM_FACE) {
+ BMO_ITER (h, &oiter, bm, op, "geom", BM_VERT|BM_EDGE|BM_FACE) {
switch (h->htype) {
case BM_VERT: totv++; break;
case BM_EDGE: tote++; break;
diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c
index ae1773af05e..8e7723fefdd 100644
--- a/source/blender/bmesh/operators/bmo_dissolve.c
+++ b/source/blender/bmesh/operators/bmo_dissolve.c
@@ -478,8 +478,8 @@ void dummy_exec(BMesh *bm, BMOperator *op)
/* Limited Dissolve */
-#define UNIT_TO_ANGLE DEG2RADF(90.0f)
-#define ANGLE_TO_UNIT (1.0f / UNIT_TO_ANGLE)
+#define UNIT_TO_ANGLE DEG2RADF(90.0)
+#define ANGLE_TO_UNIT (1.0 / UNIT_TO_ANGLE)
/* multiply vertex edge angle by face angle
* this means we are not left with sharp corners between _almost_ planer faces
@@ -523,17 +523,8 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
sizeof(DissolveElemWeight), __func__);
int i, tot_found;
- BMIter iter;
- BMEdge *e_iter;
- BMEdge **earray;
-
/* --- first edges --- */
- /* wire -> tag */
- BM_ITER_MESH(e_iter, &iter, bm, BM_EDGES_OF_MESH) {
- BM_elem_flag_set(e_iter, BM_ELEM_TAG, BM_edge_is_wire(e_iter));
- }
-
/* go through and split edge */
for (i = 0, tot_found = 0; i < einput->len; i++) {
BMEdge *e = ((BMEdge **)einput->data.p)[i];
@@ -571,6 +562,18 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
}
}
}
+
+ /* remove all edges/verts left behind from dissolving */
+ for (i = 0; i < einput->len; i++) {
+ BMEdge *e = (BMEdge *)weight_elems[i].ele;
+ if (BM_edge_is_wire(e)) {
+ BMVert *v1 = e->v1;
+ BMVert *v2 = e->v2;
+ BM_edge_kill(bm, e);
+ if (v1->e == NULL) BM_vert_kill(bm, v1);
+ if (v2->e == NULL) BM_vert_kill(bm, v2);
+ }
+ }
}
/* --- second verts --- */
@@ -609,25 +612,4 @@ void bmo_dissolve_limit_exec(BMesh *bm, BMOperator *op)
}
MEM_freeN(weight_elems);
-
- /* --- cleanup --- */
- earray = MEM_mallocN(sizeof(BMEdge *) * bm->totedge, __func__);
- BM_ITER_MESH_INDEX(e_iter, &iter, bm, BM_EDGES_OF_MESH, i) {
- earray[i] = e_iter;
- }
- /* remove all edges/verts left behind from dissolving */
- for (i = bm->totedge - 1; i != -1; i--) {
- e_iter = earray[i];
-
- if (BM_edge_is_wire(e_iter) && (BM_elem_flag_test(e_iter, BM_ELEM_TAG) == FALSE)) {
- /* edge has become wire */
- BMVert *v1 = e_iter->v1;
- BMVert *v2 = e_iter->v2;
- BM_edge_kill(bm, e_iter);
- if (v1->e == NULL) BM_vert_kill(bm, v1);
- if (v2->e == NULL) BM_vert_kill(bm, v2);
- }
- }
-
- MEM_freeN(earray);
}
diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c
index 4bac54794bf..4fced09c588 100644
--- a/source/blender/bmesh/operators/bmo_extrude.c
+++ b/source/blender/bmesh/operators/bmo_extrude.c
@@ -251,7 +251,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
/* initialize our sub-operators */
BMO_op_init(bm, &dupeop, "dupe");
- BMO_slot_buffer_flag_enable(bm, op, "edgefacein", BM_EDGE | BM_FACE, EXT_INPUT);
+ BMO_slot_buffer_flag_enable(bm, op, "edgefacein", BM_EDGE|BM_FACE, EXT_INPUT);
/* if one flagged face is bordered by an un-flagged face, then we delete
* original geometry unless caller explicitly asked to keep it. */
diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c
deleted file mode 100644
index 1cd095f72e4..00000000000
--- a/source/blender/bmesh/operators/bmo_hull.c
+++ /dev/null
@@ -1,758 +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.
- *
- * Contributor(s): Nicholas Bishop
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/bmesh/operators/bmo_hull.c
- * \ingroup bmesh
- */
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_ghash.h"
-#include "BLI_listbase.h"
-#include "BLI_math.h"
-#include "BLI_utildefines.h"
-
-/* XXX: using 128 for totelem and pchunk of mempool, no idea what good
- * values would be though */
-#include "BLI_mempool.h"
-
-#include "bmesh.h"
-
-/* Internal operator flags */
-typedef enum {
- HULL_FLAG_INPUT = (1 << 0),
- HULL_FLAG_TETRA_VERT = (1 << 1),
-
- HULL_FLAG_INTERIOR_ELE = (1 << 2),
- HULL_FLAG_OUTPUT_GEOM = (1 << 3),
-
- HULL_FLAG_DEL = (1 << 4),
- HULL_FLAG_HOLE = (1 << 5)
-} HullFlags;
-
-/* Store hull triangles seperate from BMesh faces until the end; this
- * way we don't have to worry about cleaning up extraneous edges or
- * incorrectly deleting existing geometry. */
-typedef struct HullTriangle {
- BMVert *v[3];
- float no[3];
- int skip;
-} HullTriangle;
-
-/* These edges define the hole created in the hull by deleting faces
- * that can "see" a new vertex (the boundary edges then form the edge
- * of a new triangle fan that has the new vertex as its center) */
-typedef struct HullBoundaryEdge {
- struct HullBoundaryEdge *next, *prev;
- BMVert *v[2];
-} HullBoundaryEdge;
-
-
-
-/*************************** Boundary Edges ***************************/
-
-static int edge_match(BMVert *e1_0, BMVert *e1_1, BMVert *e2[2])
-{
- return (e1_0 == e2[0] && e1_1 == e2[1]) ||
- (e1_0 == e2[1] && e1_1 == e2[0]);
-}
-
-/* Returns true if the edge (e1, e2) is already in edges; that edge is
- * deleted here as well. if not found just returns 0 */
-static int check_for_dup(ListBase *edges, BLI_mempool *pool,
- BMVert *e1, BMVert *e2)
-{
- HullBoundaryEdge *e, *next;
-
- for (e = edges->first; e; e = next) {
- next = e->next;
-
- if (edge_match(e1, e2, e->v)) {
- /* remove the interior edge */
- BLI_remlink(edges, e);
- BLI_mempool_free(pool, e);
- return 1;
- }
- }
-
- return 0;
-}
-
-static void expand_boundary_edges(ListBase *edges, BLI_mempool *edge_pool,
- const HullTriangle *t)
-{
- HullBoundaryEdge *new;
- int i;
-
- /* Insert each triangle edge into the boundary list; if any of
- * its edges are already in there, remove the edge entirely */
- for (i = 0; i < 3; i++) {
- if (!check_for_dup(edges, edge_pool, t->v[i], t->v[(i + 1) % 3])) {
- new = BLI_mempool_calloc(edge_pool);
- new->v[0] = t->v[i];
- new->v[1] = t->v[(i + 1) % 3];
- BLI_addtail(edges, new);
- }
- }
-}
-
-
-
-/*************************** Hull Triangles ***************************/
-
-static void hull_add_triangle(GHash *hull_triangles, BLI_mempool *pool,
- BMVert *v1, BMVert *v2, BMVert *v3)
-{
- HullTriangle *t;
-
- t = BLI_mempool_calloc(pool);
- t->v[0] = v1;
- t->v[1] = v2;
- t->v[2] = v3;
-
- BLI_ghash_insert(hull_triangles, t, NULL);
- normal_tri_v3(t->no, v1->co, v2->co, v3->co);
-}
-
-static int hull_point_tri_side(const HullTriangle *t, const float co[3])
-{
- float p[3], d;
- sub_v3_v3v3(p, co, t->v[0]->co);
- d = dot_v3v3(t->no, p);
- if (d < 0) return -1;
- else if (d > 0) return 1;
- else return 0;
-}
-
-/* Get all hull triangles that vertex 'v' is outside of */
-static GHash *hull_triangles_v_outside(GHash *hull_triangles, const BMVert *v)
-{
- GHash *outside;
- GHashIterator iter;
-
- outside = BLI_ghash_new(BLI_ghashutil_ptrhash,
- BLI_ghashutil_ptrcmp,
- "outside");
-
- GHASH_ITER (iter, hull_triangles) {
- HullTriangle *t = BLI_ghashIterator_getKey(&iter);
-
- if (hull_point_tri_side(t, v->co) >= 0)
- BLI_ghash_insert(outside, t, NULL);
- }
-
- return outside;
-}
-
-/* Similar to above, but just get true/false rather than triangles */
-static int hull_test_v_outside(GHash *hull_triangles, const BMVert *v)
-{
- GHashIterator iter;
-
- GHASH_ITER (iter, hull_triangles) {
- HullTriangle *t = BLI_ghashIterator_getKey(&iter);
-
- if (hull_point_tri_side(t, v->co) >= 0)
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-/* For vertex 'v', find which triangles must be deleted to extend the
- * hull; find the boundary edges of that hole so that it can be filled
- * with connections to the new vertex, and update the hull_triangles
- * to delete the marked triangles */
-static void add_point(GHash *hull_triangles, BLI_mempool *hull_pool,
- BLI_mempool *edge_pool, GHash *outside, BMVert *v)
-{
- ListBase edges = {NULL, NULL};
- HullBoundaryEdge *e, *next;
- GHashIterator iter;
-
- GHASH_ITER (iter, outside) {
- HullTriangle *t = BLI_ghashIterator_getKey(&iter);
- expand_boundary_edges(&edges, edge_pool, t);
-
- /* Delete the triangle */
- BLI_ghash_remove(hull_triangles, t, NULL, NULL);
- BLI_mempool_free(hull_pool, t);
- }
-
- /* Fill hole boundary with triangles to new point */
- for (e = edges.first; e; e = next) {
- next = e->next;
- hull_add_triangle(hull_triangles, hull_pool, e->v[0], e->v[1], v);
- BLI_mempool_free(edge_pool, e);
- }
-}
-
-static BMFace *hull_find_example_face(BMesh *bm, BMEdge *e)
-{
- BMIter iter;
- BMFace *f;
-
- BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
- if (BMO_elem_flag_test(bm, f, HULL_FLAG_INPUT) ||
- !BMO_elem_flag_test(bm, f, HULL_FLAG_OUTPUT_GEOM))
- {
- return f;
- }
- }
-
- return NULL;
-}
-
-static void hull_output_triangles(BMesh *bm, GHash *hull_triangles)
-{
- GHashIterator iter;
-
- GHASH_ITER (iter, hull_triangles) {
- HullTriangle *t = BLI_ghashIterator_getKey(&iter);
-
- if (!t->skip) {
- BMEdge *edges[3] = {
- BM_edge_create(bm, t->v[0], t->v[1], NULL, TRUE),
- BM_edge_create(bm, t->v[1], t->v[2], NULL, TRUE),
- BM_edge_create(bm, t->v[2], t->v[0], NULL, TRUE)
- };
- BMFace *f, *example = NULL;
- int i;
-
- /* Look for an adjacent face that existed before the hull */
- for (i = 0; i < 3; i++) {
- if (!example)
- example = hull_find_example_face(bm, edges[i]);
- }
-
- f = BM_face_create_quad_tri_v(bm, t->v, 3, example, FALSE);
- BM_face_copy_shared(bm, f);
-
- /* Mark face/verts/edges for 'geomout' slot and select */
- BMO_elem_flag_enable(bm, f, HULL_FLAG_OUTPUT_GEOM);
- BM_face_select_set(bm, f, TRUE);
- for (i = 0; i < 3; i++) {
- BMO_elem_flag_enable(bm, t->v[i], HULL_FLAG_OUTPUT_GEOM);
- BMO_elem_flag_enable(bm, edges[i], HULL_FLAG_OUTPUT_GEOM);
- }
- }
- }
-}
-
-
-
-/***************************** Final Edges ****************************/
-
-typedef struct {
- GHash *edges;
- BLI_mempool *base_pool, *link_pool;
-} HullFinalEdges;
-
-static LinkData *final_edges_find_link(ListBase *adj, BMVert *v)
-{
- LinkData *link;
-
- for (link = adj->first; link; link = link->next) {
- if (link->data == v)
- return link;
- }
-
- return NULL;
-}
-
-static int hull_final_edges_lookup(HullFinalEdges *final_edges,
- BMVert *v1, BMVert *v2)
-{
- ListBase *adj;
-
- /* Use lower vertex pointer for hash key */
- if (v1 > v2)
- SWAP(BMVert *, v1, v2);
-
- adj = BLI_ghash_lookup(final_edges->edges, v1);
- if (!adj)
- return FALSE;
-
- return !!final_edges_find_link(adj, v2);
-}
-
-/* Used for checking whether a pre-existing edge lies on the hull */
-static HullFinalEdges *hull_final_edges(GHash *hull_triangles)
-{
- HullFinalEdges *final_edges;
- GHashIterator iter;
-
- final_edges = MEM_callocN(sizeof(HullFinalEdges), "HullFinalEdges");
- final_edges->edges = BLI_ghash_new(BLI_ghashutil_ptrhash,
- BLI_ghashutil_ptrcmp,
- "final edges ghash");
- final_edges->base_pool = BLI_mempool_create(sizeof(ListBase), 128, 128, 0);
- final_edges->link_pool = BLI_mempool_create(sizeof(LinkData), 128, 128, 0);
-
- GHASH_ITER (iter, hull_triangles) {
- LinkData *link;
- int i;
-
- for (i = 0; i < 3; i++) {
- HullTriangle *t = BLI_ghashIterator_getKey(&iter);
- BMVert *v1 = t->v[i];
- BMVert *v2 = t->v[(i + 1) % 3];
- ListBase *adj;
-
- /* Use lower vertex pointer for hash key */
- if (v1 > v2)
- SWAP(BMVert *, v1, v2);
-
- adj = BLI_ghash_lookup(final_edges->edges, v1);
- if (!adj) {
- adj = BLI_mempool_calloc(final_edges->base_pool);
- BLI_ghash_insert(final_edges->edges, v1, adj);
- }
-
- if (!final_edges_find_link(adj, v2)) {
- link = BLI_mempool_calloc(final_edges->link_pool);
- link->data = v2;
- BLI_addtail(adj, link);
- }
- }
- }
-
- return final_edges;
-}
-
-static void hull_final_edges_free(HullFinalEdges *final_edges)
-{
- BLI_ghash_free(final_edges->edges, NULL, NULL);
- BLI_mempool_destroy(final_edges->base_pool);
- BLI_mempool_destroy(final_edges->link_pool);
- MEM_freeN(final_edges);
-}
-
-
-
-/************************* Initial Tetrahedron ************************/
-
-static void hull_add_tetrahedron(GHash *hull_triangles, BLI_mempool *pool,
- BMVert *tetra[4])
-{
- float center[3];
- int i, indices[4][3] = {
- {0, 1, 2},
- {0, 2, 3},
- {1, 0, 3},
- {2, 1, 3}};
-
- /* Calculate center */
- zero_v3(center);
- for (i = 0; i < 4; i++)
- add_v3_v3(center, tetra[i]->co);
- mul_v3_fl(center, 0.25f);
-
- for (i = 0; i < 4; i++) {
- BMVert *v1 = tetra[indices[i][0]];
- BMVert *v2 = tetra[indices[i][1]];
- BMVert *v3 = tetra[indices[i][2]];
- float no[3], d[3];
-
- normal_tri_v3(no, v1->co, v2->co, v3->co);
- sub_v3_v3v3(d, center, v1->co);
- if (dot_v3v3(no, d) > 0)
- SWAP(BMVert *, v1, v3);
-
- hull_add_triangle(hull_triangles, pool, v1, v2, v3);
- }
-}
-
-/* For each axis, get the minimum and maximum input vertices */
-static void hull_get_min_max(BMesh *bm, BMOperator *op,
- BMVert *min[3], BMVert *max[3])
-{
- BMOIter oiter;
- BMVert *v;
-
- min[0] = min[1] = min[2] = NULL;
- max[0] = max[1] = max[2] = NULL;
-
- BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) {
- int i;
-
- for (i = 0; i < 3; i++) {
- if (!min[i] || v->co[i] < min[i]->co[i])
- min[i] = v;
- if (!max[i] || v->co[i] > max[i]->co[i])
- max[i] = v;
- }
- }
-}
-
-/* Returns true if input is coplanar */
-static int hull_find_large_tetrahedron(BMesh *bm, BMOperator *op,
- BMVert *tetra[4])
-{
- BMVert *min[3], *max[3], *v;
- BMOIter oiter;
- float widest_axis_len, largest_dist, plane_normal[3];
- int i, j, widest_axis;
-
- tetra[0] = tetra[1] = tetra[2] = tetra[3] = NULL;
- hull_get_min_max(bm, op, min, max);
-
- /* Check for flat axis */
- for (i = 0; i < 3; i++) {
- if (min[i] == max[i]) {
- return TRUE;
- }
- }
-
- /* Find widest axis */
- widest_axis_len = 0.0f;
- widest_axis = 0; /* set here in the unlikey case this isn't set below */
- for (i = 0; i < 3; i++) {
- float len = (max[i]->co[i] - min[i]->co[i]);
- if (len >= widest_axis_len) {
- widest_axis_len = len;
- widest_axis = i;
- }
- }
-
- /* Use widest axis for first two points */
- tetra[0] = min[widest_axis];
- tetra[1] = max[widest_axis];
- BMO_elem_flag_enable(bm, tetra[0], HULL_FLAG_TETRA_VERT);
- BMO_elem_flag_enable(bm, tetra[1], HULL_FLAG_TETRA_VERT);
-
- /* Choose third vertex farthest from existing line segment */
- largest_dist = 0;
- for (i = 0; i < 3; i++) {
- BMVert *v;
- float dist;
-
- if (i == widest_axis)
- continue;
-
- v = min[i];
- for (j = 0; j < 2; j++) {
- dist = dist_to_line_segment_v3(v->co, tetra[0]->co, tetra[1]->co);
- if (dist > largest_dist) {
- largest_dist = dist;
- tetra[2] = v;
- }
-
- v = max[i];
- }
- }
-
- if (tetra[2]) {
- BMO_elem_flag_enable(bm, tetra[2], HULL_FLAG_TETRA_VERT);
- }
- else {
- return TRUE;
- }
-
- /* Check for colinear vertices */
- if (largest_dist < 0.0001f)
- return TRUE;
-
- /* Choose fourth point farthest from existing plane */
- largest_dist = 0;
- normal_tri_v3(plane_normal, tetra[0]->co, tetra[1]->co, tetra[2]->co);
- BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) {
- if (!BMO_elem_flag_test(bm, v, HULL_FLAG_TETRA_VERT)) {
- float dist = fabsf(dist_to_plane_v3(v->co, tetra[0]->co, plane_normal));
- if (dist > largest_dist) {
- largest_dist = dist;
- tetra[3] = v;
- }
- }
- }
-
- if (tetra[3]) {
- BMO_elem_flag_enable(bm, tetra[3], HULL_FLAG_TETRA_VERT);
- }
- else {
- return TRUE;
- }
-
- if (largest_dist < 0.0001f)
- return TRUE;
-
- return FALSE;
-}
-
-
-
-/**************************** Final Output ****************************/
-
-static void hull_remove_overlapping(BMesh *bm, GHash *hull_triangles,
- HullFinalEdges *final_edges)
-{
- GHashIterator hull_iter;
-
- GHASH_ITER (hull_iter, hull_triangles) {
- HullTriangle *t = BLI_ghashIterator_getKey(&hull_iter);
- BMIter bm_iter1, bm_iter2;
- BMFace *f;
- int f_on_hull;
-
- BM_ITER_ELEM (f, &bm_iter1, t->v[0], BM_FACES_OF_VERT) {
- BMEdge *e;
-
- /* Check that all the face's edges are on the hull,
- otherwise can't reuse it */
- f_on_hull = TRUE;
- BM_ITER_ELEM (e, &bm_iter2, f, BM_EDGES_OF_FACE) {
- if (!hull_final_edges_lookup(final_edges, e->v1, e->v2)) {
- f_on_hull = FALSE;
- break;
- }
- }
-
- /* Note: can't change ghash while iterating, so mark
- with 'skip' flag rather than deleting triangles */
- if (BM_vert_in_face(f, t->v[1]) &&
- BM_vert_in_face(f, t->v[2]) && f_on_hull) {
- t->skip = TRUE;
- BMO_elem_flag_disable(bm, f, HULL_FLAG_INTERIOR_ELE);
- BMO_elem_flag_enable(bm, f, HULL_FLAG_HOLE);
- }
- }
- }
-}
-
-static void hull_mark_interior_elements(BMesh *bm, BMOperator *op,
- GHash *hull_triangles,
- HullFinalEdges *final_edges)
-{
- BMVert *v;
- BMEdge *e;
- BMFace *f;
- BMOIter oiter;
-
- /* Check all input vertices again to see if they are actually part
- of the hull */
- BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) {
- if (!hull_test_v_outside(hull_triangles, v)) {
- /* Mark for 'interior_verts' slot */
- BMO_elem_flag_enable(bm, v, HULL_FLAG_INTERIOR_ELE);
- }
- }
-
- /* Check for interior edges too */
- BMO_ITER (e, &oiter, bm, op, "input", BM_EDGE) {
- if (!hull_final_edges_lookup(final_edges, e->v1, e->v2))
- BMO_elem_flag_enable(bm, e, HULL_FLAG_INTERIOR_ELE);
- }
-
- /* Mark all input faces as interior, some may be unmarked in
- hull_remove_overlapping() */
- BMO_ITER (f, &oiter, bm, op, "input", BM_FACE) {
- BMO_elem_flag_enable(bm, f, HULL_FLAG_INTERIOR_ELE);
- }
-}
-
-static void hull_tag_unused(BMesh *bm, BMOperator *op)
-{
- BMIter iter;
- BMOIter oiter;
- BMVert *v;
- BMEdge *e;
- BMFace *f;
-
- /* Mark vertices, edges, and faces that are already marked
- interior (i.e. were already part of the input, but not part of
- the hull), but that aren't also used by elements outside the
- input set */
- BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) {
- if (BMO_elem_flag_test(bm, v, HULL_FLAG_INTERIOR_ELE)) {
- int del = TRUE;
-
- BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
- if (!BMO_elem_flag_test(bm, e, HULL_FLAG_INPUT)) {
- del = FALSE;
- break;
- }
- }
-
- BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) {
- if (!BMO_elem_flag_test(bm, f, HULL_FLAG_INPUT)) {
- del = FALSE;
- break;
- }
- }
-
- if (del)
- BMO_elem_flag_enable(bm, v, HULL_FLAG_DEL);
- }
- }
-
- BMO_ITER (e, &oiter, bm, op, "input", BM_EDGE) {
- if (BMO_elem_flag_test(bm, e, HULL_FLAG_INTERIOR_ELE)) {
- int del = TRUE;
-
- BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
- if (!BMO_elem_flag_test(bm, f, HULL_FLAG_INPUT)) {
- del = FALSE;
- break;
- }
- }
-
- if (del)
- BMO_elem_flag_enable(bm, e, HULL_FLAG_DEL);
- }
- }
-
- BMO_ITER (f, &oiter, bm, op, "input", BM_FACE) {
- if (BMO_elem_flag_test(bm, f, HULL_FLAG_INTERIOR_ELE))
- BMO_elem_flag_enable(bm, f, HULL_FLAG_DEL);
- }
-}
-
-void hull_tag_holes(BMesh *bm, BMOperator *op)
-{
- BMIter iter;
- BMOIter oiter;
- BMFace *f;
- BMEdge *e;
-
- /* Unmark any hole faces if they are isolated or part of a
- * border */
- BMO_ITER (f, &oiter, bm, op, "input", BM_FACE) {
- if (BMO_elem_flag_test(bm, f, HULL_FLAG_HOLE)) {
- BM_ITER_ELEM (e, &iter, f, BM_EDGES_OF_FACE) {
- if (BM_edge_face_count(e) == 1) {
- BMO_elem_flag_disable(bm, f, HULL_FLAG_HOLE);
- break;
- }
- }
- }
- }
-
- /* Mark edges too if all adjacent faces are holes */
- BMO_ITER (e, &oiter, bm, op, "input", BM_EDGE) {
- int hole = TRUE;
-
- BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
- if (!BMO_elem_flag_test(bm, f, HULL_FLAG_HOLE)) {
- hole = FALSE;
- break;
- }
- }
-
- if (hole)
- BMO_elem_flag_enable(bm, e, HULL_FLAG_HOLE);
- }
-}
-
-void bmo_convex_hull_exec(BMesh *bm, BMOperator *op)
-{
- HullFinalEdges *final_edges;
- BLI_mempool *hull_pool, *edge_pool;
- BMVert *v, *tetra[4];
- BMElemF *ele;
- BMOIter oiter;
- GHash *hull_triangles;
-
- /* Verify that at least four verts in the input */
- if (BMO_slot_get(op, "input")->len < 4) {
- BMO_error_raise(bm, op, BMERR_CONVEX_HULL_FAILED,
- "Requires at least four vertices");
- return;
- }
-
- /* Initialize the convex hull by building a tetrahedron. A
- * degenerate tetrahedron can cause problems, so report error and
- * fail if the result is coplanar */
- if (hull_find_large_tetrahedron(bm, op, tetra)) {
- BMO_error_raise(bm, op, BMERR_CONVEX_HULL_FAILED,
- "Input vertices are coplanar");
- return;
- }
-
- /* Tag input elements */
- BMO_ITER (ele, &oiter, bm, op, "input", BM_ALL)
- BMO_elem_flag_enable(bm, ele, HULL_FLAG_INPUT);
-
- edge_pool = BLI_mempool_create(sizeof(HullBoundaryEdge), 128, 128, 0);
- hull_pool = BLI_mempool_create(sizeof(HullTriangle), 128, 128, 0);
- hull_triangles = BLI_ghash_new(BLI_ghashutil_ptrhash,
- BLI_ghashutil_ptrcmp,
- "hull_triangles");
-
- /* Add tetrahedron triangles */
- hull_add_tetrahedron(hull_triangles, hull_pool, tetra);
-
- /* Expand hull to cover new vertices outside the existing hull */
- BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) {
- if (!BMO_elem_flag_test(bm, v, HULL_FLAG_TETRA_VERT)) {
- GHash *outside = hull_triangles_v_outside(hull_triangles, v);
- if (BLI_ghash_size(outside)) {
- /* Expand hull and delete interior triangles */
- add_point(hull_triangles, hull_pool, edge_pool, outside, v);
- }
- BLI_ghash_free(outside, NULL, NULL);
- }
- }
-
- BLI_mempool_destroy(edge_pool);
- final_edges = hull_final_edges(hull_triangles);
-
- hull_mark_interior_elements(bm, op, hull_triangles, final_edges);
-
- /* Remove hull triangles covered by an existing face */
- if (BMO_slot_bool_get(op, "use_existing_faces")) {
- hull_remove_overlapping(bm, hull_triangles, final_edges);
-
- hull_tag_holes(bm, op);
- }
-
- /* Done with edges */
- hull_final_edges_free(final_edges);
-
- /* Convert hull triangles to BMesh faces */
- hull_output_triangles(bm, hull_triangles);
- BLI_mempool_destroy(hull_pool);
-
- BLI_ghash_free(hull_triangles, NULL, NULL);
-
- hull_tag_unused(bm, op);
-
- /* Output slot of input elements that ended up inside the hull
- * rather than part of it */
- BMO_slot_buffer_from_enabled_flag(bm, op, "interior_geom", BM_ALL,
- HULL_FLAG_INTERIOR_ELE);
-
- /* Output slot of input elements that ended up inside the hull and
- * are are unused by other geometry. */
- BMO_slot_buffer_from_enabled_flag(bm, op, "unused_geom", BM_ALL,
- HULL_FLAG_DEL);
-
- /* Output slot of faces and edges that were in the input and on
- * the hull (useful for cases like bridging where you want to
- * delete some input geometry) */
- BMO_slot_buffer_from_enabled_flag(bm, op, "holes_geom", BM_ALL,
- HULL_FLAG_HOLE);
-
- /* Output slot of all hull vertices, faces, and edges */
- BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL,
- HULL_FLAG_OUTPUT_GEOM);
-}
diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c
index 26197c43bd0..e08f08baacd 100644
--- a/source/blender/bmesh/operators/bmo_inset.c
+++ b/source/blender/bmesh/operators/bmo_inset.c
@@ -313,8 +313,7 @@ void bmo_inset_exec(BMesh *bm, BMOperator *op)
/* scale by edge angle */
if (use_even_offset) {
- mul_v3_fl(tvec, shell_angle_to_dist(angle_normalized_v3v3(e_info_a->no,
- e_info_b->no) / 2.0f));
+ mul_v3_fl(tvec, shell_angle_to_dist(angle_normalized_v3v3(e_info_a->no, e_info_b->no) / 2.0f));
}
/* scale relative to edge lengths */
diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c
index 8060c3b5142..70dcc6fa3ae 100644
--- a/source/blender/bmesh/operators/bmo_removedoubles.c
+++ b/source/blender/bmesh/operators/bmo_removedoubles.c
@@ -147,7 +147,7 @@ void bmo_weldverts_exec(BMesh *bm, BMOperator *op)
BM_elem_index_set(f, 0); /* set_dirty! */
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
if (BMO_elem_flag_test(bm, l->v, ELE_DEL)) {
- BMO_elem_flag_enable(bm, f, FACE_MARK | ELE_DEL);
+ BMO_elem_flag_enable(bm, f, FACE_MARK|ELE_DEL);
}
if (BMO_elem_flag_test(bm, l->e, EDGE_COL)) {
BM_elem_index_set(f, BM_elem_index_get(f) + 1); /* set_dirty! */
diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c
index 03a691e3e9c..d96d0f6c74d 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.c
+++ b/source/blender/bmesh/operators/bmo_subdivide.c
@@ -132,7 +132,7 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const SubDPar
madd_v3_v3fl(tvec, nor2, fac);
/* falloff for multi subdivide */
- smooth *= sqrtf(fabsf(1.0f - 2.0f * fabsf(0.5f - perc)));
+ smooth *= sqrtf(fabsf(1.0f - 2.0f * fabsf(0.5f-perc)));
mul_v3_fl(tvec, smooth * len);
@@ -141,24 +141,23 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const SubDPar
if (params->use_fractal) {
float len = len_v3v3(vsta->co, vend->co);
- float normal[3] = {0.0f, 0.0f, 0.0f}, co2[3], base1[3], base2[3];
+ float vec2[3] = {0.0f, 0.0f, 0.0f}, co2[3];
fac = params->fractal * len;
- mid_v3_v3v3(normal, vsta->no, vend->no);
- ortho_basis_v3v3_v3(base1, base2, normal);
+ add_v3_v3(vec2, vsta->no);
+ add_v3_v3(vec2, vend->no);
+ mul_v3_fl(vec2, 0.5f);
add_v3_v3v3(co2, v->co, params->off);
- mul_v3_fl(co2, 10.0f);
+ tvec[0] = fac * (BLI_gTurbulence(1.0, co2[0], co2[1], co2[2], 15, 0, 1) - 0.5f);
+ tvec[1] = fac * (BLI_gTurbulence(1.0, co2[0], co2[1], co2[2], 15, 0, 1) - 0.5f);
+ tvec[2] = fac * (BLI_gTurbulence(1.0, co2[0], co2[1], co2[2], 15, 0, 1) - 0.5f);
- tvec[0] = fac * (BLI_gTurbulence(1.0, co2[0], co2[1], co2[2], 15, 0, 2) - 0.5f);
- tvec[1] = fac * (BLI_gTurbulence(1.0, co2[1], co2[0], co2[2], 15, 0, 2) - 0.5f);
- tvec[2] = fac * (BLI_gTurbulence(1.0, co2[1], co2[2], co2[0], 15, 0, 2) - 0.5f);
+ mul_v3_v3(vec2, tvec);
/* add displacement */
- madd_v3_v3fl(co, normal, tvec[0]);
- madd_v3_v3fl(co, base1, tvec[1] * (1.0f - params->along_normal));
- madd_v3_v3fl(co, base2, tvec[2] * (1.0f - params->along_normal));
+ add_v3_v3v3(co, co, vec2);
}
/* apply the new difference to the rest of the shape keys,
@@ -225,7 +224,7 @@ static BMVert *subdivideedgenum(BMesh *bm, BMEdge *edge, BMEdge *oedge,
if (BMO_elem_flag_test(bm, edge, EDGE_PERCENT) && totpoint == 1)
percent = BMO_slot_map_float_get(bm, params->op, "edgepercents", edge);
else {
- percent = 1.0f / (float)(totpoint + 1 - curpoint);
+ percent = 1.0f / (float)(totpoint + 1-curpoint);
percent2 = (float)(curpoint + 1) / (float)(totpoint + 1);
}
@@ -688,7 +687,7 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
BLI_array_declare(facedata);
BLI_array_declare(edges);
BLI_array_declare(verts);
- float smooth, fractal, along_normal;
+ float smooth, fractal;
int use_sphere, cornertype, use_singleedge, use_gridfill;
int skey, seed, i, j, matched, a, b, numcuts, totesel;
@@ -698,7 +697,6 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
seed = BMO_slot_int_get(op, "seed");
smooth = BMO_slot_float_get(op, "smooth");
fractal = BMO_slot_float_get(op, "fractal");
- along_normal = BMO_slot_float_get(op, "along_normal");
cornertype = BMO_slot_int_get(op, "quadcornertype");
use_singleedge = BMO_slot_bool_get(op, "use_singleedge");
@@ -756,7 +754,6 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
params.smooth = smooth;
params.seed = seed;
params.fractal = fractal;
- params.along_normal = along_normal;
params.use_smooth = (smooth != 0.0f);
params.use_fractal = (fractal != 0.0f);
params.use_sphere = use_sphere;
@@ -1023,12 +1020,12 @@ void bmo_esubd_exec(BMesh *bm, BMOperator *op)
BMO_slot_buffer_from_enabled_flag(bm, op, "outinner", BM_ALL, ELE_INNER);
BMO_slot_buffer_from_enabled_flag(bm, op, "outsplit", BM_ALL, ELE_SPLIT);
- BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL, ELE_INNER | ELE_SPLIT | SUBD_SPLIT);
+ BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL, ELE_INNER|ELE_SPLIT|SUBD_SPLIT);
}
/* editmesh-emulating function */
void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
- float smooth, float fractal, float along_normal,
+ float smooth, float fractal,
int numcuts,
int seltype, int cornertype,
const short use_singleedge, const short use_gridfill,
@@ -1039,13 +1036,13 @@ void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
/* use_sphere isnt exposed here since its only used for new primitives */
BMO_op_initf(bm, &op,
"esubd edges=%he "
- "smooth=%f fractal=%f along_normal=%f "
+ "smooth=%f fractal=%f "
"numcuts=%i "
"quadcornertype=%i "
"use_singleedge=%b use_gridfill=%b "
"seed=%i",
edge_hflag,
- smooth, fractal, along_normal,
+ smooth, fractal,
numcuts,
cornertype,
use_singleedge, use_gridfill,
diff --git a/source/blender/bmesh/operators/bmo_subdivide.h b/source/blender/bmesh/operators/bmo_subdivide.h
index d4b926b9275..cc6ced8bfaa 100644
--- a/source/blender/bmesh/operators/bmo_subdivide.h
+++ b/source/blender/bmesh/operators/bmo_subdivide.h
@@ -31,7 +31,6 @@ typedef struct SubDParams {
int numcuts;
float smooth;
float fractal;
- float along_normal;
//int beauty;
short use_smooth;
short use_sphere;
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index afc60d844db..2fe94a01368 100644
--- a/source/blender/bmesh/operators/bmo_triangulate.c
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -143,8 +143,8 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
if (e) {
BMO_elem_flag_enable(bm, e, ELE_NEW);
- BMO_elem_flag_enable(bm, e->l->f, FACE_MARK | ELE_NEW);
- BMO_elem_flag_enable(bm, e->l->radial_next->f, FACE_MARK | ELE_NEW);
+ BMO_elem_flag_enable(bm, e->l->f, FACE_MARK|ELE_NEW);
+ BMO_elem_flag_enable(bm, e->l->radial_next->f, FACE_MARK|ELE_NEW);
stop = 0;
}
}
@@ -152,7 +152,7 @@ void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
}
}
- BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_EDGE | BM_FACE, ELE_NEW);
+ BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_EDGE|BM_FACE, ELE_NEW);
}
void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
@@ -214,8 +214,8 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
/* clean up fill */
BMO_op_initf(bm, &bmop, "beautify_fill faces=%ff constrain_edges=%fe", ELE_NEW, EDGE_MARK);
BMO_op_exec(bm, &bmop);
- BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_FACE | BM_EDGE, ELE_NEW);
+ BMO_slot_buffer_flag_enable(bm, &bmop, "geomout", BM_FACE|BM_EDGE, ELE_NEW);
BMO_op_finish(bm, &bmop);
- BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_EDGE | BM_FACE, ELE_NEW);
+ BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_EDGE|BM_FACE, ELE_NEW);
}
diff --git a/source/blender/bmesh/operators/bmo_wireframe.c b/source/blender/bmesh/operators/bmo_wireframe.c
deleted file mode 100644
index e0dc5cf48c7..00000000000
--- a/source/blender/bmesh/operators/bmo_wireframe.c
+++ /dev/null
@@ -1,404 +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.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/bmesh/operators/bmo_wireframe.c
- * \ingroup bmesh
- */
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_math.h"
-
-#include "BKE_customdata.h"
-
-#include "bmesh.h"
-
-#include "intern/bmesh_operators_private.h" /* own include */
-
-BMLoop *bm_edge_tag_faceloop(BMEdge *e)
-{
- BMLoop *l, *l_first;
-
- l = l_first = e->l;
- do {
- if (BM_elem_flag_test(l->f, BM_ELEM_TAG)) {
- return l;
- }
- } while ((l = l->radial_next) != l_first);
-
- /* in the case this is used, we know this will never happen */
- return NULL;
-}
-
-static void bm_vert_boundary_tangent(BMVert *v, float r_no[3], float r_no_face[3],
- BMVert **r_va_other, BMVert **r_vb_other)
-{
- BMIter iter;
- BMEdge *e_iter;
-
- BMEdge *e_a = NULL, *e_b = NULL;
- BMVert *v_a, *v_b;
-
- BMLoop *l_a, *l_b;
-
- float no_face[3], no_edge[3];
- float tvec_a[3], tvec_b[3];
-
- /* get 2 boundary edges, there should only _be_ 2,
- * in case there are more - results wont be valid of course */
- BM_ITER_ELEM (e_iter, &iter, v, BM_EDGES_OF_VERT) {
- if (BM_elem_flag_test(e_iter, BM_ELEM_TAG)) {
- if (e_a == NULL) {
- e_a = e_iter;
- }
- else {
- e_b = e_iter;
- break;
- }
- }
- }
-
- l_a = bm_edge_tag_faceloop(e_a);
- l_b = bm_edge_tag_faceloop(e_b);
-
- /* average edge face normal */
- add_v3_v3v3(no_face, l_a->f->no, l_b->f->no);
-
- /* average edge direction */
- v_a = BM_edge_other_vert(e_a, v);
- v_b = BM_edge_other_vert(e_b, v);
-
- sub_v3_v3v3(tvec_a, v->co, v_a->co);
- sub_v3_v3v3(tvec_b, v_b->co, v->co);
- normalize_v3(tvec_a);
- normalize_v3(tvec_b);
- add_v3_v3v3(no_edge, tvec_a, tvec_b); /* not unit length but this is ok */
-
-
- /* find the normal */
- cross_v3_v3v3(r_no, no_edge, no_face);
- normalize_v3(r_no);
-
- /* check are we flipped the right way */
- BM_edge_calc_face_tangent(e_a, l_a, tvec_a);
- BM_edge_calc_face_tangent(e_b, l_b, tvec_b);
- add_v3_v3(tvec_a, tvec_b);
-
- if (dot_v3v3(r_no, tvec_a) > 0.0f) {
- negate_v3(r_no);
- }
-
- copy_v3_v3(r_no_face, no_face);
- *r_va_other = v_a;
- *r_vb_other = v_b;
-}
-
-/* check if we are the only tagged loop-face around this edge */
-static int bm_loop_is_radial_boundary(BMLoop *l_first)
-{
- BMLoop *l = l_first->radial_next;
-
- if (l == l_first) {
- return TRUE; /* a real boundary */
- }
- else {
- do {
- if (BM_elem_flag_test(l->f, BM_ELEM_TAG)) {
- return FALSE;
- }
- } while ((l = l->radial_next) != l_first);
- }
- return TRUE;
-}
-
-extern float BM_vert_calc_mean_tagged_edge_length(BMVert *v);
-
-void bmo_wireframe_exec(BMesh *bm, BMOperator *op)
-{
- const int use_boundary = BMO_slot_bool_get(op, "use_boundary");
- const int use_even_offset = BMO_slot_bool_get(op, "use_even_offset");
- const int use_relative_offset = BMO_slot_bool_get(op, "use_relative_offset");
- const int use_crease = (BMO_slot_bool_get(op, "use_crease") &&
- CustomData_has_layer(&bm->edata, CD_CREASE));
- const float depth = BMO_slot_float_get(op, "thickness");
- const float inset = depth;
-
- const int totvert_orig = bm->totvert;
-
- BMOIter oiter;
- BMIter iter;
- BMIter itersub;
-
- /* filled only with boundary verts */
- BMVert **verts_src = MEM_mallocN(sizeof(BMVert **) * totvert_orig, __func__);
- BMVert **verts_neg = MEM_mallocN(sizeof(BMVert **) * totvert_orig, __func__);
- BMVert **verts_pos = MEM_mallocN(sizeof(BMVert **) * totvert_orig, __func__);
-
- /* will over-alloc, but makes for easy lookups by index to keep aligned */
- BMVert **verts_boundary = use_boundary ?
- MEM_mallocN(sizeof(BMVert **) * totvert_orig, __func__) : NULL;
-
- float *verts_relfac = use_relative_offset ?
- MEM_mallocN(sizeof(float) * totvert_orig, __func__) : NULL;
-
- /* may over-alloc if not all faces have wire */
- BMVert **verts_loop;
- int verts_loop_tot = 0;
-
- BMVert *v_src;
-
- BMFace *f_src;
- BMLoop *l;
-
- float tvec[3];
- float fac;
-
- int i;
-
- BM_mesh_elem_index_ensure(bm, BM_VERT);
-
- BM_ITER_MESH_INDEX (v_src, &iter, bm, BM_VERTS_OF_MESH, i) {
- BM_elem_flag_disable(v_src, BM_ELEM_TAG);
- verts_src[i] = v_src;
- }
-
- /* setup tags, all faces and verts will be tagged which will be duplicated */
- BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, FALSE);
-
- BMO_ITER (f_src, &oiter, bm, op, "faces", BM_FACE) {
- verts_loop_tot += f_src->len;
- BM_elem_flag_enable(f_src, BM_ELEM_TAG);
- BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
- BM_elem_flag_enable(l->v, BM_ELEM_TAG);
-
- /* also tag boundary edges */
- BM_elem_flag_set(l->e, BM_ELEM_TAG, bm_loop_is_radial_boundary(l));
- }
- }
-
- /* duplicate tagged verts */
- for (i = 0, v_src = verts_src[i]; i < totvert_orig; i++, v_src = verts_src[i]) {
- if (BM_elem_flag_test(v_src, BM_ELEM_TAG)) {
- fac = depth;
-
- if (use_relative_offset) {
- verts_relfac[i] = BM_vert_calc_mean_tagged_edge_length(v_src);
- fac *= verts_relfac[i];
- }
-
- madd_v3_v3v3fl(tvec, v_src->co, v_src->no, -fac);
- verts_neg[i] = BM_vert_create(bm, tvec, v_src);
- madd_v3_v3v3fl(tvec, v_src->co, v_src->no, fac);
- verts_pos[i] = BM_vert_create(bm, tvec, v_src);
- }
- else {
- /* could skip this */
- verts_src[i] = NULL;
- verts_neg[i] = NULL;
- verts_pos[i] = NULL;
- }
-
- /* conflicts with BM_vert_calc_mean_tagged_edge_length */
- if (use_relative_offset == FALSE) {
- BM_elem_flag_disable(v_src, BM_ELEM_TAG);
- }
- }
-
- if (use_relative_offset) {
- BM_mesh_elem_hflag_disable_all(bm, BM_VERT, BM_ELEM_TAG, FALSE);
- }
-
- verts_loop = MEM_mallocN(sizeof(BMVert **) * verts_loop_tot, __func__);
- verts_loop_tot = 0; /* count up again */
-
- BMO_ITER (f_src, &oiter, bm, op, "faces", BM_FACE) {
- BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
- BM_elem_index_set(l, verts_loop_tot); /* set_loop */
-
- BM_loop_calc_face_tangent(l, tvec);
-
- /* create offset vert */
- fac = inset;
- if (use_even_offset) {
- fac *= shell_angle_to_dist(((float)M_PI - BM_loop_calc_face_angle(l)) * 0.5f);
- }
- if (use_relative_offset) {
- fac *= verts_relfac[BM_elem_index_get(l->v)];
- }
-
- madd_v3_v3v3fl(tvec, l->v->co, tvec, fac);
- verts_loop[verts_loop_tot] = BM_vert_create(bm, tvec, l->v);
-
-
- if (use_boundary) {
- if (BM_elem_flag_test(l->e, BM_ELEM_TAG)) { /* is this a boundary? */
-
- BMLoop *l_pair[2] = {l, l->next};
-
- BM_elem_flag_enable(l->e, BM_ELEM_TAG);
- for (i = 0; i < 2; i++) {
- if (!BM_elem_flag_test(l_pair[i]->v, BM_ELEM_TAG)) {
- float no_face[3];
- BMVert *va_other;
- BMVert *vb_other;
-
- BM_elem_flag_enable(l_pair[i]->v, BM_ELEM_TAG);
-
- bm_vert_boundary_tangent(l_pair[i]->v, tvec, no_face, &va_other, &vb_other);
-
- /* create offset vert */
- /* similar to code above but different angle calc */
- fac = inset;
- if (use_even_offset) {
- fac *= shell_angle_to_dist(((float)M_PI - angle_on_axis_v3v3v3_v3(va_other->co,
- l_pair[i]->v->co,
- vb_other->co,
- no_face)) * 0.5f);
- }
- if (use_relative_offset) {
- fac *= verts_relfac[BM_elem_index_get(l_pair[i]->v)];
- }
- madd_v3_v3v3fl(tvec, l_pair[i]->v->co, tvec, fac);
- verts_boundary[BM_elem_index_get(l_pair[i]->v)] = BM_vert_create(bm, tvec, l_pair[i]->v);
- }
- }
- }
- }
-
- verts_loop_tot++;
- }
- }
-
- BMO_ITER (f_src, &oiter, bm, op, "faces", BM_FACE) {
- BM_elem_flag_disable(f_src, BM_ELEM_TAG);
- BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
- BMFace *f_new;
- BMLoop *l_new;
- BMLoop *l_next = l->next;
- BMVert *v_l1 = verts_loop[BM_elem_index_get(l)];
- BMVert *v_l2 = verts_loop[BM_elem_index_get(l_next)];
-
- BMVert *v_src_l1 = l->v;
- BMVert *v_src_l2 = l_next->v;
-
- const int i_1 = BM_elem_index_get(v_src_l1);
- const int i_2 = BM_elem_index_get(v_src_l2);
-
- BMVert *v_neg1 = verts_neg[i_1];
- BMVert *v_neg2 = verts_neg[i_2];
-
- BMVert *v_pos1 = verts_pos[i_1];
- BMVert *v_pos2 = verts_pos[i_2];
-
- f_new = BM_face_create_quad_tri(bm, v_l1, v_l2, v_neg2, v_neg1, f_src, FALSE);
- BM_elem_flag_enable(f_new, BM_ELEM_TAG);
- l_new = BM_FACE_FIRST_LOOP(f_new);
-
- BM_elem_attrs_copy(bm, bm, l, l_new);
- BM_elem_attrs_copy(bm, bm, l, l_new->prev);
- BM_elem_attrs_copy(bm, bm, l_next, l_new->next);
- BM_elem_attrs_copy(bm, bm, l_next, l_new->next->next);
-
- f_new = BM_face_create_quad_tri(bm, v_l2, v_l1, v_pos1, v_pos2, f_src, FALSE);
- BM_elem_flag_enable(f_new, BM_ELEM_TAG);
- l_new = BM_FACE_FIRST_LOOP(f_new);
-
- BM_elem_attrs_copy(bm, bm, l_next, l_new);
- BM_elem_attrs_copy(bm, bm, l_next, l_new->prev);
- BM_elem_attrs_copy(bm, bm, l, l_new->next);
- BM_elem_attrs_copy(bm, bm, l, l_new->next->next);
-
- if (use_boundary) {
- if (BM_elem_flag_test(l->e, BM_ELEM_TAG)) {
- /* we know its a boundary and this is the only face user (which is being wire'd) */
- /* we know we only touch this edge/face once */
- BMVert *v_b1 = verts_boundary[i_1];
- BMVert *v_b2 = verts_boundary[i_2];
-
- f_new = BM_face_create_quad_tri(bm, v_b2, v_b1, v_neg1, v_neg2, f_src, FALSE);
- BM_elem_flag_enable(f_new, BM_ELEM_TAG);
- l_new = BM_FACE_FIRST_LOOP(f_new);
-
- BM_elem_attrs_copy(bm, bm, l_next, l_new);
- BM_elem_attrs_copy(bm, bm, l_next, l_new->prev);
- BM_elem_attrs_copy(bm, bm, l, l_new->next);
- BM_elem_attrs_copy(bm, bm, l, l_new->next->next);
-
- f_new = BM_face_create_quad_tri(bm, v_b1, v_b2, v_pos2, v_pos1, f_src, FALSE);
- BM_elem_flag_enable(f_new, BM_ELEM_TAG);
- l_new = BM_FACE_FIRST_LOOP(f_new);
-
- BM_elem_attrs_copy(bm, bm, l, l_new);
- BM_elem_attrs_copy(bm, bm, l, l_new->prev);
- BM_elem_attrs_copy(bm, bm, l_next, l_new->next);
- BM_elem_attrs_copy(bm, bm, l_next, l_new->next->next);
-
- if (use_crease) {
- BMEdge *e_new;
- e_new = BM_edge_exists(v_pos1, v_b1);
- BM_elem_float_data_set(&bm->edata, e_new, CD_CREASE, 1.0f);
-
- e_new = BM_edge_exists(v_pos2, v_b2);
- BM_elem_float_data_set(&bm->edata, e_new, CD_CREASE, 1.0f);
-
- e_new = BM_edge_exists(v_neg1, v_b1);
- BM_elem_float_data_set(&bm->edata, e_new, CD_CREASE, 1.0f);
-
- e_new = BM_edge_exists(v_neg2, v_b2);
- BM_elem_float_data_set(&bm->edata, e_new, CD_CREASE, 1.0f);
- }
- }
- }
-
- if (use_crease) {
- BMEdge *e_new;
- e_new = BM_edge_exists(v_pos1, v_l1);
- BM_elem_float_data_set(&bm->edata, e_new, CD_CREASE, 1.0f);
-
- e_new = BM_edge_exists(v_pos2, v_l2);
- BM_elem_float_data_set(&bm->edata, e_new, CD_CREASE, 1.0f);
-
- e_new = BM_edge_exists(v_neg1, v_l1);
- BM_elem_float_data_set(&bm->edata, e_new, CD_CREASE, 1.0f);
-
- e_new = BM_edge_exists(v_neg2, v_l2);
- BM_elem_float_data_set(&bm->edata, e_new, CD_CREASE, 1.0f);
- }
-
- }
- }
-
- if (use_boundary) {
- MEM_freeN(verts_boundary);
- }
-
- if (use_relative_offset) {
- MEM_freeN(verts_relfac);
- }
-
- MEM_freeN(verts_src);
- MEM_freeN(verts_neg);
- MEM_freeN(verts_pos);
- MEM_freeN(verts_loop);
-
- BMO_slot_buffer_from_enabled_hflag(bm, op, "faceout", BM_FACE, BM_ELEM_TAG);
-}
diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c
index e03df77a290..a357767e1d8 100644
--- a/source/blender/bmesh/tools/BME_bevel.c
+++ b/source/blender/bmesh/tools/BME_bevel.c
@@ -234,8 +234,7 @@ static int BME_bevel_get_vec(float *vec, BMVert *v1, BMVert *v2, BME_TransData_H
* vec2 is the direction of projection (pointing away from vec1)
* up_vec is used for orientation (expected to be normalized)
* returns the length of the projected vector that lies along vec1 */
-static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec,
- int is_forward, BME_TransData_Head *UNUSED(td))
+static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int is_forward, BME_TransData_Head *UNUSED(td))
{
float factor, vec3[3], tmp[3], c1, c2;
@@ -265,8 +264,7 @@ static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec,
* using the vert and the loop passed, get or make the split vert, set its coordinates
* and transform properties, and set the max limits.
* Finally, return the split vert. */
-static BMVert *BME_bevel_split_edge(BMesh *bm, BMVert *v, BMVert *v1, BMLoop *l,
- float *up_vec, float value, BME_TransData_Head *td)
+static BMVert *BME_bevel_split_edge(BMesh *bm, BMVert *v, BMVert *v1, BMLoop *l, float *up_vec, float value, BME_TransData_Head *td)
{
BME_TransData *vtd, *vtd1, *vtd2;
BMVert *sv, *v2, *v3, *ov;
@@ -498,8 +496,7 @@ static BMVert *BME_bevel_wire(BMesh *bm, BMVert *v, float value, int res, int UN
}
#endif
-static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int UNUSED(options),
- float *up_vec, BME_TransData_Head *td)
+static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int UNUSED(options), float *up_vec, BME_TransData_Head *td)
{
BMVert *v1, *v2, *kv;
BMLoop *kl = NULL, *nl;
@@ -620,8 +617,7 @@ static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int UNUSED(opti
return l;
}
-static BMLoop *BME_bevel_vert(BMesh *bm, BMLoop *l, float value, int UNUSED(options),
- float up_vec[3], BME_TransData_Head *td)
+static BMLoop *BME_bevel_vert(BMesh *bm, BMLoop *l, float value, int UNUSED(options), float *up_vec, BME_TransData_Head *td)
{
BMVert *v1, *v2;
/* BMFace *f; */ /* UNUSED */
@@ -814,7 +810,7 @@ static float BME_bevel_get_angle_vert(BMVert *v)
}
/* return cosf(angle_diff + 0.001f); */ /* compare with dot product */
- return (angle_diff / tot_angle) * (float)(M_PI / 2.0);
+ return (angle_diff / tot_angle) * (M_PI / 2);
}
static void BME_bevel_add_vweight(BME_TransData_Head *td, BMesh *bm, BMVert *v, float weight, float factor, int options)
@@ -898,7 +894,7 @@ static void bevel_init_edges(BMesh *bm, int options, float angle, BME_TransData_
int count;
float weight;
BMIter iter;
- const float threshold = (options & BME_BEVEL_ANGLE) ? cosf(angle + 0.001f) : 0.0f;
+ const float threshold = (options & BME_BEVEL_ANGLE) ? cosf(angle + 0.001) : 0.0f;
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
weight = 0.0f;
@@ -949,8 +945,7 @@ static void bevel_init_edges(BMesh *bm, int options, float angle, BME_TransData_
}
}
-static BMesh *BME_bevel_initialize(BMesh *bm, int options,
- int UNUSED(defgrp_index), float angle, BME_TransData_Head *td)
+static BMesh *BME_bevel_initialize(BMesh *bm, int options, int UNUSED(defgrp_index), float angle, BME_TransData_Head *td)
{
BMVert *v /*, *v2 */;
BMEdge *e /*, *curedg */;
@@ -1042,8 +1037,7 @@ static BMesh *BME_bevel_reinitialize(BMesh *bm)
* A BMesh pointer to the BM passed as a parameter.
*/
-static BMesh *BME_bevel_mesh(BMesh *bm, float value, int UNUSED(res), int options,
- int UNUSED(defgrp_index), BME_TransData_Head *td)
+static BMesh *BME_bevel_mesh(BMesh *bm, float value, int UNUSED(res), int options, int UNUSED(defgrp_index), BME_TransData_Head *td)
{
BMVert *v;
BMEdge *e, *curedge;
@@ -1108,14 +1102,14 @@ BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_i
BME_TransData_Head *td;
BME_TransData *vtd;
int i;
- double fac = 1.0, d;
+ double fac = 1, d;
td = BME_init_transdata(BLI_MEMARENA_STD_BUFSIZE);
/* recursion math courtesy of Martin Poirier (theeth) */
for (i = 0; i < res - 1; i++) {
- if (i == 0) fac += 1.0 / 3.0; else fac += 1.0 / (3.0 * i * 2.0);
+ if (i == 0) fac += 1.0f / 3.0f; else fac += 1.0f / (3 * i * 2.0f);
}
- d = 1.0 / fac;
+ d = 1.0f / fac;
for (i = 0; i < res || (res == 0 && i == 0); i++) {
BMO_push(bm, NULL);
@@ -1149,7 +1143,7 @@ BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_i
else {
d = value;
}
- madd_v3_v3v3fl(v->co, vtd->org, vtd->vec, vtd->factor * (float)d);
+ madd_v3_v3v3fl(v->co, vtd->org, vtd->vec, vtd->factor * d);
}
}
diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp
index 195057817dd..3180245eac1 100644
--- a/source/blender/collada/AnimationImporter.cpp
+++ b/source/blender/collada/AnimationImporter.cpp
@@ -438,16 +438,6 @@ void AnimationImporter::modify_fcurve(std::vector<FCurve*>* curves, const char*
}
}
-void AnimationImporter::unused_fcurve(std::vector<FCurve*>* curves)
-{
- // when an error happens and we can't actually use curve remove it from unused_curves
- std::vector<FCurve*>::iterator it;
- for (it = curves->begin(); it != curves->end(); it++) {
- FCurve *fcu = *it;
- unused_curves.erase(std::remove(unused_curves.begin(), unused_curves.end(), fcu), unused_curves.end());
- }
-}
-
void AnimationImporter::find_frames( std::vector<float>* frames, std::vector<FCurve*>* curves)
{
std::vector<FCurve*>::iterator iter;
@@ -509,7 +499,6 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation *
modify_fcurve(curves, rna_path, -1 );
break;
default:
- unused_fcurve(curves);
fprintf(stderr, "AnimationClass %d is not supported for %s.\n",
binding->animationClass, loc ? "TRANSLATE" : "SCALE");
}
@@ -545,13 +534,10 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation *
else if (COLLADABU::Math::Vector3::UNIT_Z == axis) {
modify_fcurve(curves, rna_path, 2 );
}
- else
- unused_fcurve(curves);
break;
case COLLADAFW::AnimationList::AXISANGLE:
// TODO convert axis-angle to quat? or XYZ?
default:
- unused_fcurve(curves);
fprintf(stderr, "AnimationClass %d is not supported for ROTATE transformation.\n",
binding->animationClass);
}
@@ -567,11 +553,9 @@ void AnimationImporter:: Assign_transform_animations(COLLADAFW::Transformation *
}
}*/
- unused_fcurve(curves);
break;
case COLLADAFW::Transformation::SKEW:
case COLLADAFW::Transformation::LOOKAT:
- unused_fcurve(curves);
fprintf(stderr, "Animation of SKEW and LOOKAT transformations is not supported yet.\n");
break;
}
@@ -607,7 +591,6 @@ void AnimationImporter:: Assign_color_animations(const COLLADAFW::UniqueId& list
break;
default:
- unused_fcurve(&animcurves);
fprintf(stderr, "AnimationClass %d is not supported for %s.\n",
bindings[j].animationClass, "COLOR" );
}
@@ -1770,7 +1753,7 @@ bool AnimationImporter::calc_joint_parent_mat_rest(float mat[4][4], float par[4]
Object *AnimationImporter::get_joint_object(COLLADAFW::Node *root, COLLADAFW::Node *node, Object *par_job)
{
if (joint_objects.find(node->getUniqueId()) == joint_objects.end()) {
- Object *job = bc_add_object(scene, OB_EMPTY, (char*)get_joint_name(node));
+ Object *job = add_object(scene, OB_EMPTY);
job->lay = BKE_scene_base_find(scene, job)->lay = 2;
diff --git a/source/blender/collada/AnimationImporter.h b/source/blender/collada/AnimationImporter.h
index 6324853d91c..362b288dbb4 100644
--- a/source/blender/collada/AnimationImporter.h
+++ b/source/blender/collada/AnimationImporter.h
@@ -165,7 +165,6 @@ public:
int setAnimType ( const COLLADAFW::Animatable * prop, int type, int addition);
void modify_fcurve(std::vector<FCurve*>* curves, const char* rna_path, int array_index );
- void unused_fcurve(std::vector<FCurve*>* curves );
// prerequisites:
// animlist_map - map animlist id -> animlist
// curve_map - map anim id -> curve(s)
diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp
index 97de7590d07..e0bb9840925 100644
--- a/source/blender/collada/ArmatureImporter.cpp
+++ b/source/blender/collada/ArmatureImporter.cpp
@@ -367,7 +367,7 @@ Object *ArmatureImporter::get_empty_for_leaves()
{
if (empty) return empty;
- empty = bc_add_object(scene, OB_EMPTY, NULL);
+ empty = add_object(scene, OB_EMPTY);
empty->empty_drawtype = OB_EMPTY_SPHERE;
return empty;
@@ -412,7 +412,7 @@ void ArmatureImporter::create_armature_bones( )
if ( get_armature_for_joint(*ri) != NULL ) continue;
//add armature object for current joint
- //Object *ob_arm = bc_add_object(scene, OB_ARMATURE, NULL);
+ //Object *ob_arm = add_object(scene, OB_ARMATURE);
Object *ob_arm = joint_parent_map[(*ri)->getUniqueId()];
diff --git a/source/blender/collada/CameraExporter.cpp b/source/blender/collada/CameraExporter.cpp
index ce46c681c8c..c3614ac49a2 100644
--- a/source/blender/collada/CameraExporter.cpp
+++ b/source/blender/collada/CameraExporter.cpp
@@ -67,10 +67,8 @@ void CamerasExporter::operator()(Object *ob, Scene *sce)
Camera *cam = (Camera*)ob->data;
std::string cam_id(get_camera_id(ob));
std::string cam_name(id_name(cam));
-
- switch (cam->type) {
- case CAM_PANO:
- case CAM_PERSP: {
+
+ if (cam->type == CAM_PERSP) {
COLLADASW::PerspectiveOptic persp(mSW);
persp.setXFov(RAD2DEGF(focallength_to_fov(cam->lens, cam->sensor_x)), "xfov");
persp.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch), false, "aspect_ratio");
@@ -78,11 +76,8 @@ void CamerasExporter::operator()(Object *ob, Scene *sce)
persp.setZNear(cam->clipsta, false, "znear");
COLLADASW::Camera ccam(mSW, &persp, cam_id, cam_name);
addCamera(ccam);
- break;
}
- case CAM_ORTHO:
- default:
- {
+ else {
COLLADASW::OrthographicOptic ortho(mSW);
ortho.setXMag(cam->ortho_scale, "xmag");
ortho.setAspectRatio((float)(sce->r.xsch)/(float)(sce->r.ysch), false, "aspect_ratio");
@@ -90,6 +85,5 @@ void CamerasExporter::operator()(Object *ob, Scene *sce)
ortho.setZNear(cam->clipsta, false, "znear");
COLLADASW::Camera ccam(mSW, &ortho, cam_id, cam_name);
addCamera(ccam);
- break;
- }}
-}
+ }
+}
diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp
index 6dca7828cc2..c8f617ff1d9 100644
--- a/source/blender/collada/DocumentImporter.cpp
+++ b/source/blender/collada/DocumentImporter.cpp
@@ -162,9 +162,7 @@ void DocumentImporter::cancel(const COLLADAFW::String& errorMessage)
// The latter sounds better.
}
-void DocumentImporter::start()
-{
-}
+void DocumentImporter::start() {}
void DocumentImporter::finish()
{
@@ -305,8 +303,7 @@ Object* DocumentImporter::create_camera_object(COLLADAFW::InstanceCamera *camera
fprintf(stderr, "Couldn't find camera by UID.\n");
return NULL;
}
-
- Object *ob = bc_add_object(sce, OB_CAMERA, NULL);
+ Object *ob = add_object(sce, OB_CAMERA);
Camera *cam = uid_camera_map[cam_uid];
Camera *old_cam = (Camera*)ob->data;
ob->data = cam;
@@ -323,8 +320,7 @@ Object* DocumentImporter::create_lamp_object(COLLADAFW::InstanceLight *lamp, Sce
fprintf(stderr, "Couldn't find lamp by UID.\n");
return NULL;
}
-
- Object *ob = bc_add_object(sce, OB_LAMP, NULL);
+ Object *ob = add_object(sce, OB_LAMP);
Lamp *la = uid_lamp_map[lamp_uid];
Lamp *old_lamp = (Lamp*)ob->data;
ob->data = la;
@@ -407,7 +403,7 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren
if (is_joint) {
if ( par ) {
Object * empty = par;
- par = bc_add_object(sce, OB_ARMATURE, NULL);
+ par = add_object(sce, OB_ARMATURE);
bc_set_parent(par, empty->parent, mContext);
//remove empty : todo
object_map.insert(std::make_pair<COLLADAFW::UniqueId, Object *>(parent_node->getUniqueId(), par));
@@ -474,7 +470,7 @@ void DocumentImporter::write_node (COLLADAFW::Node *node, COLLADAFW::Node *paren
// if node is empty - create empty object
// XXX empty node may not mean it is empty object, not sure about this
if ( (geom_done + camera_done + lamp_done + controller_done + inst_done) < 1) {
- ob = bc_add_object(sce, OB_EMPTY, NULL);
+ ob = add_object(sce, OB_EMPTY);
objects_done->push_back(ob);
}
diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp
index 9ce0ce6c3a2..f59dfbc5d30 100644
--- a/source/blender/collada/MeshImporter.cpp
+++ b/source/blender/collada/MeshImporter.cpp
@@ -855,10 +855,10 @@ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmateri
for (it = prims.begin(); it != prims.end(); it++) {
Primitive& prim = *it;
- MFace *mface = prim.mface;
-
- for (i = 0; i < prim.totface; i++, mface++) {
- mface->mat_nr = mat_index;
+ i = 0;
+ while (i++ < prim.totface) {
+ prim.mface->mat_nr = mat_index;
+ prim.mface++;
// bind texture images to faces
if (texture_face && (*color_texture)) {
texture_face->tpage = (Image*)(*color_texture)->tex->ima;
@@ -871,6 +871,7 @@ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmateri
return texture_face;
}
+
Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::InstanceGeometry *geom,
bool isController,
std::map<COLLADAFW::UniqueId, Material*>& uid_material_map,
@@ -899,16 +900,16 @@ Object *MeshImporter::create_mesh_object(COLLADAFW::Node *node, COLLADAFW::Insta
}
if (!uid_mesh_map[*geom_uid]) return NULL;
- // name Object
- const std::string& id = node->getName().size() ? node->getName() : node->getOriginalId();
- const char *name = (id.length())? id.c_str(): NULL;
-
- // add object
- Object *ob = bc_add_object(scene, OB_MESH, name);
+ Object *ob = add_object(scene, OB_MESH);
// store object pointer for ArmatureImporter
uid_object_map[*geom_uid] = ob;
+ // name Object
+ const std::string& id = node->getName().size() ? node->getName() : node->getOriginalId();
+ if (id.length())
+ rename_id(&ob->id, (char*)id.c_str());
+
// replace ob->data freeing the old one
Mesh *old_mesh = (Mesh*)ob->data;
@@ -963,7 +964,6 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry* geom)
const std::string& str_geom_id = mesh->getName().size() ? mesh->getName() : mesh->getOriginalId();
Mesh *me = BKE_mesh_add((char*)str_geom_id.c_str());
- me->id.us--; // is already 1 here, but will be set later in set_mesh
// store the Mesh pointer to link it later with an Object
this->uid_mesh_map[mesh->getUniqueId()] = me;
@@ -978,5 +978,7 @@ bool MeshImporter::write_geometry(const COLLADAFW::Geometry* geom)
BKE_mesh_make_edges(me, 0);
+ mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL);
+
return true;
}
diff --git a/source/blender/collada/SkinInfo.cpp b/source/blender/collada/SkinInfo.cpp
index edc8981deab..eaabecda216 100644
--- a/source/blender/collada/SkinInfo.cpp
+++ b/source/blender/collada/SkinInfo.cpp
@@ -151,7 +151,7 @@ void SkinInfo::set_controller(const COLLADAFW::SkinController* co)
// called from write_controller
Object *SkinInfo::create_armature(Scene *scene)
{
- ob_arm = bc_add_object(scene, OB_ARMATURE, NULL);
+ ob_arm = add_object(scene, OB_ARMATURE);
return ob_arm;
}
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index 8b7a28e5fbe..015a48d4bc7 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -34,7 +34,6 @@
#include "DNA_customdata_types.h"
#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
#include "BLI_math.h"
@@ -42,7 +41,6 @@
#include "BKE_customdata.h"
#include "BKE_depsgraph.h"
#include "BKE_object.h"
-#include "BKE_scene.h"
#include "WM_api.h" // XXX hrm, see if we can do without this
#include "WM_types.h"
diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h
index 1f5d2b1d8da..b0c24152652 100644
--- a/source/blender/collada/collada_utils.h
+++ b/source/blender/collada/collada_utils.h
@@ -39,7 +39,6 @@
#include "DNA_customdata_types.h"
#include "DNA_texture_types.h"
#include "BKE_context.h"
-#include "DNA_scene_types.h"
typedef std::map<COLLADAFW::TextureMapId, std::vector<MTex*> > TexIndexTextureArrayMap;
@@ -49,6 +48,5 @@ extern int bc_test_parent_loop(Object *par, Object *ob);
extern int bc_set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space=true);
extern char *bc_CustomData_get_layer_name(const CustomData *data, int type, int n);
extern char *bc_CustomData_get_active_layer_name(const CustomData *data, int type);
-extern Object *bc_add_object(Scene *scene, int type, const char *name);
#endif
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index bcd0feb36cf..4563768728c 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1552,7 +1552,6 @@ void ANIM_OT_keyframe_delete_button(wmOperatorType *ot)
/* identifiers */
ot->name = "Delete Keyframe (Buttons)";
ot->idname = "ANIM_OT_keyframe_delete_button";
- ot->description = "Delete current keyframe of current UI-active property";
/* callbacks */
ot->exec = delete_key_button_exec;
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index 8f2a228ffef..2933fb649c9 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -373,7 +373,6 @@ void ANIM_OT_keyingset_button_add(wmOperatorType *ot)
/* identifiers */
ot->name = "Add to Keying Set";
ot->idname = "ANIM_OT_keyingset_button_add";
- ot->description = "Add current UI-active property to current keying set";
/* callbacks */
ot->exec = add_keyingset_button_exec;
@@ -453,7 +452,6 @@ void ANIM_OT_keyingset_button_remove(wmOperatorType *ot)
/* identifiers */
ot->name = "Remove from Keying Set";
ot->idname = "ANIM_OT_keyingset_button_remove";
- ot->description = "Remove current UI-active property from current keying set";
/* callbacks */
ot->exec = remove_keyingset_button_exec;
@@ -503,7 +501,6 @@ void ANIM_OT_keying_set_active_set(wmOperatorType *ot)
/* identifiers */
ot->name = "Set Active Keying Set";
ot->idname = "ANIM_OT_keying_set_active_set";
- ot->description = "Select a new keying set as the active one";
/* callbacks */
ot->invoke = keyingset_active_menu_invoke;
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 44dfcaacbfc..8c9a8472c54 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -4096,7 +4096,7 @@ static void select_similar_direction(bArmature *arm, EditBone *ebone_act, const
float dir[3];
sub_v3_v3v3(dir, ebone->head, ebone->tail);
- if (angle_v3v3(dir_act, dir) / (float)M_PI < thresh) {
+ if (angle_v3v3(dir_act, dir) / M_PI < thresh) {
ED_armature_edit_bone_select(ebone);
}
}
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 09c01c2bf8c..58c091dec11 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -1416,7 +1416,6 @@ void CURVE_OT_separate(wmOperatorType *ot)
/* identifiers */
ot->name = "Separate";
ot->idname = "CURVE_OT_separate";
- ot->description = "Separate (partly) selected curves or surfaces into a new object";
/* api callbacks */
ot->exec = separate_exec;
@@ -2533,7 +2532,6 @@ void CURVE_OT_de_select_first(wmOperatorType *ot)
/* identifiers */
ot->name = "(De)select First";
ot->idname = "CURVE_OT_de_select_first";
- ot->description = "(De)select first of visible part of each Nurb";
/* api cfirstbacks */
ot->exec = de_select_first_exec;
@@ -2558,7 +2556,6 @@ void CURVE_OT_de_select_last(wmOperatorType *ot)
/* identifiers */
ot->name = "(De)select Last";
ot->idname = "CURVE_OT_de_select_last";
- ot->description = "(De)select last of visible part of each Nurb";
/* api clastbacks */
ot->exec = de_select_last_exec;
@@ -2640,7 +2637,6 @@ void CURVE_OT_select_all(wmOperatorType *ot)
/* identifiers */
ot->name = "(De)select All";
ot->idname = "CURVE_OT_select_all";
- ot->description = "(De)select all control points";
/* api callbacks */
ot->exec = de_select_all_exec;
@@ -2715,7 +2711,6 @@ void CURVE_OT_hide(wmOperatorType *ot)
/* identifiers */
ot->name = "Hide Selected";
ot->idname = "CURVE_OT_hide";
- ot->description = "Hide (un)selected control points";
/* api callbacks */
ot->exec = hide_exec;
@@ -2776,7 +2771,6 @@ void CURVE_OT_reveal(wmOperatorType *ot)
/* identifiers */
ot->name = "Reveal Hidden";
ot->idname = "CURVE_OT_reveal";
- ot->description = "Show again hidden control points";
/* api callbacks */
ot->exec = reveal_exec;
@@ -4124,7 +4118,6 @@ void CURVE_OT_make_segment(wmOperatorType *ot)
/* identifiers */
ot->name = "Make Segment";
ot->idname = "CURVE_OT_make_segment";
- ot->description = "Join two curves by their selected ends";
/* api callbacks */
ot->exec = make_segment_exec;
@@ -4360,7 +4353,6 @@ void CURVE_OT_spin(wmOperatorType *ot)
/* identifiers */
ot->name = "Spin";
ot->idname = "CURVE_OT_spin";
- ot->description = "Extrude selected boundary row around pivot point and current view axis";
/* api callbacks */
ot->exec = spin_exec;
@@ -4695,7 +4687,6 @@ void CURVE_OT_vertex_add(wmOperatorType *ot)
/* identifiers */
ot->name = "Add Vertex";
ot->idname = "CURVE_OT_vertex_add";
- ot->description = "Add a new control point (linked to only selected end-curve one, if any)";
/* api callbacks */
ot->exec = add_vertex_exec;
@@ -4949,7 +4940,6 @@ void CURVE_OT_select_linked(wmOperatorType *ot)
/* identifiers */
ot->name = "Select Linked All";
ot->idname = "CURVE_OT_select_linked";
- ot->description = "Select all control points linked to active one";
/* api callbacks */
ot->exec = select_linked_exec;
@@ -5010,7 +5000,6 @@ void CURVE_OT_select_linked_pick(wmOperatorType *ot)
/* identifiers */
ot->name = "Select Linked";
ot->idname = "CURVE_OT_select_linked_pick";
- ot->description = "Select all control points linked to already selected ones";
/* api callbacks */
ot->invoke = select_linked_pick_invoke;
@@ -5089,7 +5078,6 @@ void CURVE_OT_select_row(wmOperatorType *ot)
/* identifiers */
ot->name = "Select Control Point Row";
ot->idname = "CURVE_OT_select_row";
- ot->description = "Select a row of control points including active one";
/* api callbacks */
ot->exec = select_row_exec;
@@ -5117,7 +5105,6 @@ void CURVE_OT_select_next(wmOperatorType *ot)
/* identifiers */
ot->name = "Select Next";
ot->idname = "CURVE_OT_select_next";
- ot->description = "Select control points following already selected ones along the curves";
/* api callbacks */
ot->exec = select_next_exec;
@@ -5145,7 +5132,6 @@ void CURVE_OT_select_previous(wmOperatorType *ot)
/* identifiers */
ot->name = "Select Previous";
ot->idname = "CURVE_OT_select_previous";
- ot->description = "Select control points preceding already selected ones along the curves";
/* api callbacks */
ot->exec = select_previous_exec;
@@ -5233,7 +5219,6 @@ void CURVE_OT_select_more(wmOperatorType *ot)
/* identifiers */
ot->name = "Select More";
ot->idname = "CURVE_OT_select_more";
- ot->description = "Select control points linked to already selected ones";
/* api callbacks */
ot->exec = select_more_exec;
@@ -5395,7 +5380,6 @@ void CURVE_OT_select_less(wmOperatorType *ot)
/* identifiers */
ot->name = "Select Less";
ot->idname = "CURVE_OT_select_less";
- ot->description = "Reduce current selection by deselecting boundary elements";
/* api callbacks */
ot->exec = select_less_exec;
@@ -5459,7 +5443,6 @@ void CURVE_OT_select_random(wmOperatorType *ot)
/* identifiers */
ot->name = "Select Random";
ot->idname = "CURVE_OT_select_random";
- ot->description = "Randomly select some control points";
/* api callbacks */
ot->exec = select_random_exec;
@@ -6045,7 +6028,6 @@ void CURVE_OT_shade_smooth(wmOperatorType *ot)
/* identifiers */
ot->name = "Shade Smooth";
ot->idname = "CURVE_OT_shade_smooth";
- ot->description = "Set shading to smooth";
/* api callbacks */
ot->exec = shade_smooth_exec;
@@ -6060,7 +6042,6 @@ void CURVE_OT_shade_flat(wmOperatorType *ot)
/* identifiers */
ot->name = "Shade Flat";
ot->idname = "CURVE_OT_shade_flat";
- ot->description = "Set shading to flat";
/* api callbacks */
ot->exec = shade_smooth_exec;
@@ -6933,7 +6914,6 @@ void CURVE_OT_tilt_clear(wmOperatorType *ot)
/* identifiers */
ot->name = "Clear Tilt";
ot->idname = "CURVE_OT_tilt_clear";
- ot->description = "Clear the tilt of selected control points";
/* api callbacks */
ot->exec = clear_tilt_exec;
diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c
index 05dc2d1c04e..51be7dcc600 100644
--- a/source/blender/editors/curve/editfont.c
+++ b/source/blender/editors/curve/editfont.c
@@ -1696,7 +1696,6 @@ void FONT_OT_open(wmOperatorType *ot)
/* identifiers */
ot->name = "Open Font";
ot->idname = "FONT_OT_open";
- ot->description = "Load a new font from a file";
/* api callbacks */
ot->exec = font_open_exec;
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
index 2172aa82acf..44195988c40 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -49,8 +49,7 @@ void fdrawXORcirc(float xofs, float yofs, float rad);
void fdrawcheckerboard(float x1, float y1, float x2, float y2);
-/* OpenGL stipple defines */
-/* OpenGL stipple defines */
+/* glStipple defines */
extern unsigned char stipple_halftone[128];
extern unsigned char stipple_quarttone[128];
extern unsigned char stipple_diag_stripes_pos[128];
@@ -148,14 +147,13 @@ void glaDrawPixelsTexScaled(float x, float y, int img_w, int img_h, int format,
/* 2D Drawing Assistance */
/** Define a 2D area (viewport, scissor, matrices) for OpenGL rendering.
- *
- * glwDefine2DArea and glaBegin2DDraw set up an OpenGL state appropriate
- * for drawing using both vertice (Vertex, etc) and raster (RasterPos, Rect)
- * commands. All coordinates should be at integer positions. There is little
- * to no reason to use glVertex2f etc. functions during 2D rendering, and
+ * This routine sets up an OpenGL state appropriate for drawing using
+ * both vertice (glVertex, etc) and raster (glRasterPos, glRect) commands.
+ * All coordinates should be at integer positions. There is little to
+ * no reason to use glVertex2f etc. functions during 2D rendering, and
* thus no reason to +-0.5 the coordinates or perform other silly
* tricks.
- *
+ *
* \param screen_rect The screen rectangle to be defined for 2D drawing.
*/
void glaDefine2DArea (struct rcti *screen_rect);
@@ -167,8 +165,13 @@ typedef struct gla2DDrawInfo gla2DDrawInfo;
* to free it and to return OpenGL to its previous state. The
* scissor rectangle is set to match the viewport.
*
- * See glaDefine2DArea for an explanation of why this function uses integers.
- *
+ * This routine sets up an OpenGL state appropriate for drawing using
+ * both vertice (glVertex, etc) and raster (glRasterPos, glRect) commands.
+ * All coordinates should be at integer positions. There is little to
+ * no reason to use glVertex2f etc. functions during 2D rendering, and
+ * thus no reason to +-0.5 the coordinates or perform other silly
+ * tricks.
+ *
* \param screen_rect The screen rectangle to be used for 2D drawing.
* \param world_rect The world rectangle that the 2D area represented
* by \a screen_rect is supposed to represent. If NULL it is assumed the
diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h
index 302c2940fef..db6d9bbd013 100644
--- a/source/blender/editors/include/ED_clip.h
+++ b/source/blender/editors/include/ED_clip.h
@@ -42,9 +42,6 @@ struct wmEvent;
/* clip_editor.c */
int ED_space_clip_poll(struct bContext *C);
-
-int ED_space_clip_view_clip_poll(struct bContext *C);
-
int ED_space_clip_tracking_poll(struct bContext *C);
int ED_space_clip_tracking_size_poll(struct bContext *C);
int ED_space_clip_tracking_frame_poll(struct bContext *C);
@@ -72,6 +69,8 @@ void ED_space_clip_free_texture_buffer(struct SpaceClip *sc);
int ED_space_clip_show_trackedit(struct SpaceClip *sc);
+void ED_space_clip_update_dopesheet(struct SpaceClip *sc);
+
/* clip_ops.c */
void ED_operatormacros_clip(void);
diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h
index 2df699255be..9cb32c31f5b 100644
--- a/source/blender/editors/include/ED_sculpt.h
+++ b/source/blender/editors/include/ED_sculpt.h
@@ -42,8 +42,6 @@ void ED_operatortypes_sculpt(void);
void sculpt_get_redraw_planes(float planes[4][4], struct ARegion *ar,
struct RegionView3D *rv3d, struct Object *ob);
void ED_sculpt_force_update(struct bContext *C);
-float *ED_sculpt_get_last_stroke(struct Object *ob);
-int ED_sculpt_minmax(struct bContext *C, float *min, float *max);
/* paint_ops.c */
void ED_operatortypes_paint(void);
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 8c5913e23fb..91d3c890df3 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1196,7 +1196,7 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
ui_get_but_vectorf(but, dir);
- dir[3] = 0.0f; /* glLightfv needs 4 args, 0.0 is sun */
+ dir[3] = 0.0f; /* glLight needs 4 args, 0.0 is sun */
glLightfv(GL_LIGHT7, GL_POSITION, dir);
glLightfv(GL_LIGHT7, GL_DIFFUSE, diffn);
glLightfv(GL_LIGHT7, GL_SPECULAR, vec0);
@@ -1281,7 +1281,7 @@ static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float o
}
-static void gl_shaded_color(unsigned char *col, int shade)
+static void glColor3ubvShade(unsigned char *col, int shade)
{
glColor3ub(col[0] - shade > 0 ? col[0] - shade : 0,
col[1] - shade > 0 ? col[1] - shade : 0,
@@ -1318,7 +1318,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
/* backdrop */
if (cumap->flag & CUMA_DO_CLIP) {
- gl_shaded_color((unsigned char *)wcol->inner, -20);
+ glColor3ubvShade((unsigned char *)wcol->inner, -20);
glRectf(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
glColor3ubv((unsigned char *)wcol->inner);
glRectf(rect->xmin + zoomx * (cumap->clipr.xmin - offsx),
@@ -1332,13 +1332,13 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
}
/* grid, every .25 step */
- gl_shaded_color((unsigned char *)wcol->inner, -16);
+ glColor3ubvShade((unsigned char *)wcol->inner, -16);
ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 0.25f);
/* grid, every 1.0 step */
- gl_shaded_color((unsigned char *)wcol->inner, -24);
+ glColor3ubvShade((unsigned char *)wcol->inner, -24);
ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 1.0f);
/* axes */
- gl_shaded_color((unsigned char *)wcol->inner, -50);
+ glColor3ubvShade((unsigned char *)wcol->inner, -50);
glBegin(GL_LINES);
glVertex2f(rect->xmin, rect->ymin + zoomy * (-offsy));
glVertex2f(rect->xmax, rect->ymin + zoomy * (-offsy));
@@ -1469,11 +1469,8 @@ static ImBuf *scale_trackpreview_ibuf(ImBuf *ibuf, float track_pos[2], int width
ImBuf *scaleibuf;
const float scalex = ((float)ibuf->x - 2 * margin) / width;
const float scaley = ((float)ibuf->y - 2 * margin) / height;
- /* NOTE: 1.0f = 0.5f for integer coordinate coorrection (center of pixel vs. left bottom corner of bixel)
- * and 0.5f for centering image in preview (cross is draving at exact center of widget so image
- * should be shifted by half of pixel for correct centering) - sergey */
- float off_x = (int)track_pos[0] - track_pos[0] + 1.0f;
- float off_y = (int)track_pos[1] - track_pos[1] + 1.0f;
+ float off_x = (int)track_pos[0] - track_pos[0] + 0.5f;
+ float off_y = (int)track_pos[1] - track_pos[1] + 0.5f;
int x, y;
scaleibuf = IMB_allocImBuf(width, height, 32, IB_rect);
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index 60c0ebbc7b3..c2a97b3ea70 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -475,7 +475,7 @@ static int add_primitive_monkey_exec(bContext *C, wmOperator *op)
ED_object_add_generic_get_opts(C, op, loc, rot, &enter_editmode, &layer, &view_aligned);
if (!view_aligned)
- rot[0] += (float)M_PI / 2.0f;
+ rot[0] += M_PI / 2.0f;
make_prim_init(C, "Monkey", &dia, mat, &state, loc, rot, layer);
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 57d7869d3db..1c04a7ff32e 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1412,7 +1412,7 @@ static KnifeEdge *knife_find_closest_edge(KnifeTool_OpData *kcd, float p[3], flo
float co[3], cageco[3], sco[3], maxdist = knife_snap_size(kcd, kcd->ethresh);
if (kcd->ignore_vert_snapping)
- maxdist *= 0.5f;
+ maxdist *= 0.5;
f = knife_find_closest_face(kcd, co, cageco, NULL);
*is_space = !f;
@@ -1502,7 +1502,7 @@ static KnifeVert *knife_find_closest_vert(KnifeTool_OpData *kcd, float p[3], flo
float co[3], cageco[3], sco[3], maxdist = knife_snap_size(kcd, kcd->vthresh);
if (kcd->ignore_vert_snapping)
- maxdist *= 0.5f;
+ maxdist *= 0.5;
f = knife_find_closest_face(kcd, co, cageco, is_space);
@@ -2684,7 +2684,6 @@ static void knifetool_finish(bContext *C, wmOperator *op)
knife_make_cuts(kcd);
#endif
- EDBM_mesh_normals_update(kcd->em);
EDBM_update_generic(C, kcd->em, TRUE);
}
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index 0b65cce20d7..beb5345ca9b 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -314,7 +314,7 @@ static void ringsel_finish(bContext *C, wmOperator *op)
if (lcd->do_cut) {
BM_mesh_esubdivide(em->bm, BM_ELEM_SELECT,
- 0.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f,
cuts,
SUBDIV_SELECT_LOOPCUT, SUBD_PATH, 0, FALSE, 0);
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index d38ec6436b9..32e70e798fe 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -1129,7 +1129,7 @@ static float edgetag_cut_cost(BMEditMesh *UNUSED(em), BMEdge *e1, BMEdge *e2, BM
/* but is biased to give higher values to sharp turns, so that it will take
* paths with fewer "turns" when selecting between equal-weighted paths between
* the two edges */
- cost = cost + 0.5f * cost * (2.0f - sqrtf(fabsf(dot_v3v3(d1, d2))));
+ cost = cost + 0.5f * cost * (2.0f - sqrt(fabs(dot_v3v3(d1, d2))));
return cost;
}
@@ -2294,7 +2294,7 @@ static int edbm_select_linked_flat_faces_exec(bContext *C, wmOperator *op)
float sharp = RNA_float_get(op->ptr, "sharpness");
int i;
- sharp = (sharp * (float)M_PI) / 180.0f;
+ sharp = (sharp * M_PI) / 180.0;
BM_ITER_MESH (f, &iter, em->bm, BM_FACES_OF_MESH) {
BM_elem_flag_disable(f, BM_ELEM_TAG);
diff --git a/source/blender/editors/mesh/editmesh_slide.c b/source/blender/editors/mesh/editmesh_slide.c
index a86a274eb70..36ce610c64b 100644
--- a/source/blender/editors/mesh/editmesh_slide.c
+++ b/source/blender/editors/mesh/editmesh_slide.c
@@ -279,7 +279,7 @@ static void vtx_slide_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
/* Get 3d view */
View3D *view3d = CTX_wm_view3d(C);
const float outline_w = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.8f;
- const float pt_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) + 1.5f;
+ const float pt_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) + 1.5;
int i = 0;
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 9c7ef756147..2052e2833da 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -87,7 +87,6 @@ static int edbm_subdivide_exec(bContext *C, wmOperator *op)
int cuts = RNA_int_get(op->ptr, "number_cuts");
float smooth = 0.292f * RNA_float_get(op->ptr, "smoothness");
float fractal = RNA_float_get(op->ptr, "fractal") / 2.5f;
- float along_normal = RNA_float_get(op->ptr, "fractal_along_normal");
if (RNA_boolean_get(op->ptr, "quadtri") &&
RNA_enum_get(op->ptr, "quadcorner") == SUBD_STRAIGHT_CUT)
@@ -96,7 +95,7 @@ static int edbm_subdivide_exec(bContext *C, wmOperator *op)
}
BM_mesh_esubdivide(em->bm, BM_ELEM_SELECT,
- smooth, fractal, along_normal,
+ smooth, fractal,
cuts,
SUBDIV_SELECT_ORIG, RNA_enum_get(op->ptr, "quadcorner"),
RNA_boolean_get(op->ptr, "quadtri"), TRUE,
@@ -144,7 +143,6 @@ void MESH_OT_subdivide(wmOperatorType *ot)
"Quad Corner Type", "How to subdivide quad corners (anything other than Straight Cut will prevent ngons)");
RNA_def_float(ot->srna, "fractal", 0.0f, 0.0f, FLT_MAX, "Fractal", "Fractal randomness factor", 0.0f, 1000.0f);
- RNA_def_float(ot->srna, "fractal_along_normal", 0.0f, 0.0f, 1.0f, "Along Normal", "Apply fractal displacement along normal only", 0.0f, 1.0f);
RNA_def_int(ot->srna, "seed", 0, 0, 10000, "Random Seed", "Seed for the random number generator", 0, 50);
}
@@ -2347,7 +2345,7 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op)
if (!BM_elem_flag_test(ev, BM_ELEM_HIDDEN)) {
switch (mode) {
case -1: /* aligned */
- if (fabsf(ev->co[axis] - value) < limit)
+ if (fabs(ev->co[axis] - value) < limit)
BM_vert_select_set(em->bm, ev, TRUE);
break;
case 0: /* neg */
@@ -2594,21 +2592,21 @@ static float bm_edge_seg_isect(BMEdge *e, CutCurve *c, int len, char mode,
m1 = MAXSLOPE;
b1 = x12;
}
- x2max = MAX2(x21, x22) + 0.001f; /* prevent missed edges */
- x2min = MIN2(x21, x22) - 0.001f; /* due to round off error */
- y2max = MAX2(y21, y22) + 0.001f;
- y2min = MIN2(y21, y22) - 0.001f;
+ x2max = MAX2(x21, x22) + 0.001; /* prevent missed edges */
+ x2min = MIN2(x21, x22) - 0.001; /* due to round off error */
+ y2max = MAX2(y21, y22) + 0.001;
+ y2min = MIN2(y21, y22) - 0.001;
/* Found an intersect, calc intersect point */
if (m1 == m2) { /* co-incident lines */
/* cut at 50% of overlap area */
x1max = MAX2(x11, x12);
x1min = MIN2(x11, x12);
- xi = (MIN2(x2max, x1max) + MAX2(x2min, x1min)) / 2.0f;
+ xi = (MIN2(x2max, x1max) + MAX2(x2min, x1min)) / 2.0;
y1max = MAX2(y11, y12);
y1min = MIN2(y11, y12);
- yi = (MIN2(y2max, y1max) + MAX2(y2min, y1min)) / 2.0f;
+ yi = (MIN2(y2max, y1max) + MAX2(y2min, y1min)) / 2.0;
}
else if (m2 == MAXSLOPE) {
xi = x22;
@@ -3207,45 +3205,11 @@ static int edbm_dissolve_limited_exec(bContext *C, wmOperator *op)
{
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
- BMesh *bm = em->bm;
float angle_limit = RNA_float_get(op->ptr, "angle_limit");
- char dissolve_flag;
-
- if (em->selectmode == SCE_SELECT_FACE) {
- /* flush selection to tags and untag edges/verts with partially selected faces */
- BMIter iter;
- BMIter liter;
-
- BMElem *ele;
- BMFace *f;
- BMLoop *l;
-
- BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) {
- BM_elem_flag_set(ele, BM_ELEM_TAG, BM_elem_flag_test(ele, BM_ELEM_SELECT));
- }
- BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) {
- BM_elem_flag_set(ele, BM_ELEM_TAG, BM_elem_flag_test(ele, BM_ELEM_SELECT));
- }
-
- BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
- if (!BM_elem_flag_test(f, BM_ELEM_SELECT)) {
- BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
- BM_elem_flag_disable(l->v, BM_ELEM_TAG);
- BM_elem_flag_disable(l->e, BM_ELEM_TAG);
- }
- }
- }
-
- dissolve_flag = BM_ELEM_TAG;
- }
- else {
- dissolve_flag = BM_ELEM_SELECT;
- }
-
if (!EDBM_op_callf(em, op,
"dissolve_limit edges=%he verts=%hv angle_limit=%f",
- dissolve_flag, dissolve_flag, angle_limit))
+ BM_ELEM_SELECT, BM_ELEM_SELECT, angle_limit))
{
return OPERATOR_CANCELLED;
}
@@ -4070,7 +4034,7 @@ static int edbm_noise_exec(bContext *C, wmOperator *op)
if (tex->type == TEX_STUCCI) {
float b2, vec[3];
- float ofs = tex->turbul / 200.0f;
+ float ofs = tex->turbul / 200.0;
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
b2 = BLI_hnoise(tex->noisesize, eve->co[0], eve->co[1], eve->co[2]);
@@ -4157,7 +4121,7 @@ static int edbm_bevel_exec(bContext *C, wmOperator *op)
w[i] = s;
ftot += s;
- df *= 2.0f;
+ df *= 2.0;
}
mul_vn_fl(w, recursion, 1.0f / (float)ftot);
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index 533ead1ff29..b465e729ea2 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -671,7 +671,7 @@ UvVertMap *EDBM_uv_vert_map_create(BMEditMesh *em, int selected, int do_face_idx
sub_v2_v2v2(uvdiff, uv2, uv);
- if (fabsf(uvdiff[0]) < limit[0] && fabsf(uvdiff[1]) < limit[1]) {
+ if (fabs(uvdiff[0]) < limit[0] && fabs(uvdiff[1]) < limit[1]) {
if (lastv) lastv->next = next;
else vlist = next;
iterv->next = newvlist;
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index bc11a627be6..a303c49147f 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -275,11 +275,11 @@ int ED_mesh_uv_loop_reset_ex(struct bContext *C, struct Mesh *me, const int laye
else if (len > 2) {
float fac = 0.0f, dfac = 1.0f / (float)len;
- dfac *= (float)M_PI * 2.0f;
+ dfac *= M_PI * 2;
for (i = 0; i < len; i++) {
- fuvs[i][0] = 0.5f * sinf(fac) + 0.5f;
- fuvs[i][1] = 0.5f * cosf(fac) + 0.5f;
+ fuvs[i][0] = 0.5f * sin(fac) + 0.5f;
+ fuvs[i][1] = 0.5f * cos(fac) + 0.5f;
fac += dfac;
}
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 9506836ab82..42aa2af11f1 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1102,7 +1102,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
if (dupli_gh)
BLI_ghash_insert(dupli_gh, dob, ob);
if (parent_gh)
- BLI_ghash_insert(parent_gh, BLI_ghashutil_pairalloc(dob->ob, SET_INT_IN_POINTER(dob->index)), ob);
+ BLI_ghash_insert(parent_gh, BLI_ghashutil_pairalloc(dob->ob, dob->index), ob);
}
if (use_hierarchy) {
@@ -1116,7 +1116,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
/* find parent that was also made real */
if (ob_src_par) {
- GHashPair *pair = BLI_ghashutil_pairalloc(ob_src_par, SET_INT_IN_POINTER(dob->index));
+ GHashPair *pair = BLI_ghashutil_pairalloc(ob_src_par, dob->index);
ob_dst_par = BLI_ghash_lookup(parent_gh, pair);
BLI_ghashutil_pairfree(pair);
}
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index e9341d90e86..71db051a6e1 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -313,9 +313,6 @@ static int object_hook_index_array(Scene *scene, Object *obedit, int *tot, int *
em = me->edit_btmesh;
- EDBM_mesh_normals_update(em);
- BMEdit_RecalcTessellation(em);
-
/* check selected vertices first */
if (return_editmesh_indexar(em, tot, indexar, cent_r)) {
return 1;
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index e834c93b0d8..e29ab687fff 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -197,6 +197,7 @@ void OBJECT_OT_vertex_group_select(struct wmOperatorType *ot);
void OBJECT_OT_vertex_group_deselect(struct wmOperatorType *ot);
void OBJECT_OT_vertex_group_copy_to_linked(struct wmOperatorType *ot);
void OBJECT_OT_vertex_group_copy_to_selected(struct wmOperatorType *ot);
+void OBJECT_OT_vertex_group_copy_to_selected_single(struct wmOperatorType *ot);
void OBJECT_OT_vertex_group_copy(struct wmOperatorType *ot);
void OBJECT_OT_vertex_group_normalize(struct wmOperatorType *ot);
void OBJECT_OT_vertex_group_normalize_all(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index b7dc3fd7bea..9f5ae7e255f 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -171,6 +171,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_vertex_group_deselect);
WM_operatortype_append(OBJECT_OT_vertex_group_copy_to_linked);
WM_operatortype_append(OBJECT_OT_vertex_group_copy_to_selected);
+ WM_operatortype_append(OBJECT_OT_vertex_group_copy_to_selected_single);
WM_operatortype_append(OBJECT_OT_vertex_group_copy);
WM_operatortype_append(OBJECT_OT_vertex_group_normalize);
WM_operatortype_append(OBJECT_OT_vertex_group_normalize_all);
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 0c0611d3d33..652b7c04b2e 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -20,7 +20,7 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): Ove M Henriksen
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -75,6 +75,7 @@
#include "UI_resources.h"
#include "object_intern.h"
+#include <stdio.h> /*only for development purposes, remove*/
/************************ Exported Functions **********************/
static void vgroup_remap_update_users(Object *ob, int *map);
@@ -311,18 +312,17 @@ int ED_vgroup_give_array(ID *id, MDeformVert **dvert_arr, int *dvert_tot)
return FALSE;
}
-/* matching index only */
+/*Copy all vertex groups to target, overwriting existing. matching index only*/
int ED_vgroup_copy_array(Object *ob, Object *ob_from)
{
MDeformVert **dvert_array_from, **dvf;
MDeformVert **dvert_array, **dv;
- int dvert_tot_from;
- int dvert_tot;
- int i;
+ int dvert_tot_from, dvert_tot, i;
int defbase_tot_from = BLI_countlist(&ob_from->defbase);
int defbase_tot = BLI_countlist(&ob->defbase);
short new_vgroup = FALSE;
+ /*get vertex groups arrays*/
ED_vgroup_give_parray(ob_from->data, &dvert_array_from, &dvert_tot_from, FALSE);
ED_vgroup_give_parray(ob->data, &dvert_array, &dvert_tot, FALSE);
@@ -376,6 +376,209 @@ int ED_vgroup_copy_array(Object *ob, Object *ob_from)
return 1;
}
+/*Copy a single vertex group from source to destination with weights*/
+int ED_vgroup_copy_single(Object *ob_dst, const Object *ob_src)
+{
+ MDeformVert **dv_array_src;
+ MDeformVert **dv_array_dst;
+ MDeformWeight *dw_dst, *dw_src;
+ int dv_tot_src, dv_tot_dst;
+ int i, index_src, index_dst;
+ bDeformGroup *dg_src, *dg_dst;
+
+ /*get source deform group*/
+ dg_src= BLI_findlink(&ob_src->defbase, (ob_src->actdef-1));
+
+ /*Create new and overwrite vertex group on destination without data*/
+ ED_vgroup_delete(ob_dst, defgroup_find_name(ob_dst, dg_src->name));
+ ED_vgroup_add_name(ob_dst, dg_src->name);
+
+ /*get destination deformgroup*/
+ dg_dst= defgroup_find_name(ob_dst, dg_src->name);
+
+ /*get vertex group arrays*/
+ ED_vgroup_give_parray(ob_src->data, &dv_array_src, &dv_tot_src, FALSE);
+ ED_vgroup_give_parray(ob_dst->data, &dv_array_dst, &dv_tot_dst, FALSE);
+
+ /*get indexes of vertex groups*/
+ index_src= BLI_findindex(&ob_src->defbase, dg_src);
+ index_dst= BLI_findindex(&ob_dst->defbase, dg_dst);
+
+ /*Check if indices are matching, delete and return if not*/
+ if (ob_dst == ob_src || dv_tot_dst == 0 || (dv_tot_dst != dv_tot_src) || dv_array_src == NULL || dv_array_dst == NULL) {
+ ED_vgroup_delete(ob_dst, defgroup_find_name(ob_dst, dg_dst->name));
+ return 0;
+ }
+
+ /* Loop through the vertices and copy weight*/
+ for(i=0; i<dv_tot_dst; i++, dv_array_src++, dv_array_dst++) {
+ dw_src= defvert_verify_index(*dv_array_src, index_src);
+ dw_dst= defvert_verify_index(*dv_array_dst, index_dst);
+ dw_dst->weight= dw_src->weight;
+ }
+
+ return 1;
+}
+
+/*Copy a single vertex group from source to destination with weights by nearest weight*/
+int ED_vgroup_copy_by_nearest_vertex_single(Object *ob_dst, Object *ob_src)
+{
+ bDeformGroup *dg_src, *dg_dst;
+ MDeformVert **dv_array_src, **dv_array_dst;
+ MDeformWeight *dw_dst, *dw_src;
+ MVert *mv_dst;
+ Mesh *me_dst;
+ BVHTreeFromMesh tree_mesh_src;
+ BVHTreeNearest nearest;
+ DerivedMesh *dmesh_src;
+ int dv_tot_src, dv_tot_dst, i, index_dst, index_src;
+ float tmp_co[3], tmp_mat[4][4];
+
+ /*get source deform group*/
+ dg_src= BLI_findlink(&ob_src->defbase, (ob_src->actdef-1));
+
+ /*Create new and overwrite vertex group on destination without data*/
+ ED_vgroup_delete(ob_dst, defgroup_find_name(ob_dst, dg_src->name));
+ ED_vgroup_add_name(ob_dst, dg_src->name);
+
+ /*get destination deformgroup*/
+ dg_dst= defgroup_find_name(ob_dst, dg_src->name);
+
+ /*get meshes*/
+ me_dst= ob_dst->data;
+ dmesh_src= ob_src->derivedDeform;
+
+ /*make node tree*/
+ bvhtree_from_mesh_verts(&tree_mesh_src, dmesh_src, 0.0, 2, 6);
+
+ /*get vertex group arrays*/
+ ED_vgroup_give_parray(ob_src->data, &dv_array_src, &dv_tot_src, FALSE);
+ ED_vgroup_give_parray(ob_dst->data, &dv_array_dst, &dv_tot_dst, FALSE);
+
+ /*get indexes of vertex groups*/
+ index_src= BLI_findindex(&ob_src->defbase, dg_src);
+ index_dst= BLI_findindex(&ob_dst->defbase, dg_dst);
+
+ /*get vertices*/
+ mv_dst= me_dst->mvert;
+
+ /*Prepearing transformation matrix*/
+ /*This can be excluded to make a lazy feature that works better when object centers relative to mesh is the same*/
+ invert_m4_m4(ob_src->imat, ob_src->obmat);
+ mult_m4_m4m4(tmp_mat, ob_src->imat, ob_dst->obmat);
+
+ /* Loop through the vertices and copy weight from nearest weight*/
+ for(i=0; i < me_dst->totvert; i++, mv_dst++, dv_array_dst++){
+
+ /*Reset nearest*/
+ nearest.index= -1;
+ nearest.dist= FLT_MAX;
+
+ /*Transforming into target space*/
+ mul_v3_m4v3(tmp_co, tmp_mat, mv_dst->co);
+
+ /*Node tree accelerated search for closest vetex*/
+ BLI_bvhtree_find_nearest(tree_mesh_src.tree, tmp_co, &nearest, tree_mesh_src.nearest_callback, &tree_mesh_src);
+
+ /*copy weight*/
+ dw_src= defvert_verify_index(dv_array_src[nearest.index], index_src);
+ dw_dst= defvert_verify_index(*dv_array_dst, index_dst);
+ dw_dst->weight= dw_src->weight;
+ }
+
+ /*free memory and return*/
+ free_bvhtree_from_mesh(&tree_mesh_src);
+ return 1;
+}
+
+/*Copy a single vertex group from source to destination with weights by nearest weight*/
+/*TODO: transform into target space as in by_vertex function. postphoned due to easier testing during development*/
+int ED_vgroup_copy_by_nearest_face_single(Object *ob_dst, Object *ob_src)
+{
+ bDeformGroup *dg_src, *dg_dst;
+ MDeformVert **dv_array_src, **dv_array_dst;
+ MDeformWeight *dw_dst, *dw_src;
+ MVert *mv_dst;
+ MFace *mface_src;
+ Mesh *me_dst, *me_src;
+ BVHTreeFromMesh tree_mesh_faces_src;
+ BVHTreeNearest nearest;
+ DerivedMesh *dmesh_src;
+ int dv_tot_src, dv_tot_dst, i, index_dst, index_src;
+ float weight/*, tot_dist*/;
+
+ /*get source deform group*/
+ dg_src= BLI_findlink(&ob_src->defbase, (ob_src->actdef-1));
+
+ /*Create new and overwrite vertex group on destination without data*/
+ ED_vgroup_delete(ob_dst, defgroup_find_name(ob_dst, dg_src->name));
+ ED_vgroup_add_name(ob_dst, dg_src->name);
+
+ /*get destination deformgroup*/
+ dg_dst= defgroup_find_name(ob_dst, dg_src->name);
+
+ /*get meshes*/
+ me_dst= ob_dst->data;
+ me_src= ob_src->data;
+ dmesh_src= ob_src->derivedDeform; /*sergey- : this might easily be null?? (using ob_src.deriveddeform*/
+
+ /*make node tree*/
+ DM_ensure_tessface(dmesh_src);
+ bvhtree_from_mesh_faces(&tree_mesh_faces_src, dmesh_src, 0.0, 2, 6);
+
+
+ /*get vertex group arrays*/
+ ED_vgroup_give_parray(ob_src->data, &dv_array_src, &dv_tot_src, FALSE);
+ ED_vgroup_give_parray(ob_dst->data, &dv_array_dst, &dv_tot_dst, FALSE);
+
+ /*get indexes of vertex groups*/
+ index_src= BLI_findindex(&ob_src->defbase, dg_src);
+ index_dst= BLI_findindex(&ob_dst->defbase, dg_dst);
+
+ /*get vertices*/
+ mv_dst= me_dst->mvert;
+
+ /* Loop through the vertices and copy weight from nearest weight*/
+ for(i=0; i < me_dst->totvert; i++, mv_dst++, dv_array_dst++){
+
+ /*Reset nearest*/
+ nearest.index= -1;
+ nearest.dist= FLT_MAX;
+
+ /*Node tree accelerated search for closest face*/
+ BLI_bvhtree_find_nearest(tree_mesh_faces_src.tree, mv_dst->co, &nearest, tree_mesh_faces_src.nearest_callback, &tree_mesh_faces_src);
+
+ /*get weight*/
+ mface_src= me_src->mface + nearest.index;
+ /*tot_dist= ()+()+(); use a comparable distance
+ if(mface_src->v4){
+ tot_dist+= ();
+ }*/
+ dw_src= defvert_verify_index(dv_array_src[mface_src->v1], index_src);
+ weight= dw_src->weight;
+ dw_src= defvert_verify_index(dv_array_src[mface_src->v2], index_src);
+ weight+= dw_src->weight;
+ dw_src= defvert_verify_index(dv_array_src[mface_src->v3], index_src);
+ weight+= dw_src->weight;
+ if(mface_src->v4){
+ dw_src= defvert_verify_index(dv_array_src[mface_src->v4], index_src);
+ weight+= dw_src->weight;
+ weight/=4;
+ }
+ else{
+ weight/=3;
+ }
+
+
+ /*copy weight*/
+ dw_dst= defvert_verify_index(*dv_array_dst, index_dst);
+ dw_dst->weight= weight;
+ }
+
+ /*free memory and return*/
+ free_bvhtree_from_mesh(&tree_mesh_faces_src);
+ return 1;
+}
/* for Mesh in Object mode */
/* allows editmode for Lattice */
@@ -1178,7 +1381,6 @@ static void vgroup_normalize_all(Object *ob, int lock_active)
}
}
-
static void vgroup_lock_all(Object *ob, int action)
{
bDeformGroup *dg;
@@ -1257,7 +1459,7 @@ static void vgroup_blend(Object *ob, const float fac)
int i, dvert_tot = 0;
const int def_nr = ob->actdef - 1;
- BLI_assert(fac >= 0.0f && fac <= 1.0f);
+ BLI_assert(fac >= 0.0 && fac <= 1.0f);
if (ob->type != OB_MESH) {
return;
@@ -2301,6 +2503,7 @@ void OBJECT_OT_vertex_group_deselect(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
+/*Adds a copy of selected vertex group from source object to source object*/
static int vertex_group_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = ED_object_context(C);
@@ -2720,6 +2923,7 @@ void OBJECT_OT_vertex_group_copy_to_linked(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
+/*Copy vertex groups from source to target*/ /*warning! overwrites list*/
static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op)
{
Object *obact = ED_object_context(C);
@@ -2744,22 +2948,74 @@ static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-
+/* Transfer all vertex groups with weight to selected*/
void OBJECT_OT_vertex_group_copy_to_selected(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Copy Vertex Group to Selected";
- ot->idname = "OBJECT_OT_vertex_group_copy_to_selected";
- ot->description = "Copy Vertex Groups to other selected objects with matching indices";
+ ot->name= "Copy Vertex Group to Selected";
+ ot->idname= "OBJECT_OT_vertex_group_copy_to_selected";
+ ot->description= "Copy Vertex Groups to other selected objects with matching indices";
/* api callbacks */
- ot->poll = vertex_group_poll;
- ot->exec = vertex_group_copy_to_selected_exec;
+ ot->poll= vertex_group_poll;
+ ot->exec= vertex_group_copy_to_selected_exec;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
+static int vertex_group_copy_to_selected_single_exec(bContext *C, wmOperator *op)
+{
+ Object *obact= CTX_data_active_object(C);
+ int change= 0;
+ int fail= 0;
+
+ /*Macro to loop through selected objects and perform operation*/
+ CTX_DATA_BEGIN(C, Object*, obslc, selected_editable_objects)
+ {
+ if(obact != obslc) {
+ /*Try function for matching number of vertices*/
+ if(ED_vgroup_copy_single(obslc, obact)) change++;
+ /*Try function for get weight from closest vertex*/
+ /*TODO: try this function*/
+ /*Try function for get weight from closest face*/
+ else if(ED_vgroup_copy_by_nearest_face_single(obslc, obact)) change++;
+ /*Trigger error message*/
+ else fail++;
+ /*Event notifiers for correct display of data*/
+ DAG_id_tag_update(&obslc->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obslc);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obslc->data);
+ }
+ }
+ CTX_DATA_END;
+
+ /*Report error when task can not be completed with available functions.*/
+ if((change == 0 && fail == 0) || fail) {
+ BKE_reportf(op->reports, RPT_ERROR,
+ "Copy to VGroups to Selected warning done %d, failed %d, All functions failed!",
+ change, fail);
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+/*Transfer vertex group with weight to selected*/
+void OBJECT_OT_vertex_group_copy_to_selected_single(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Copy a Vertex Group to Selected";
+ ot->idname= "OBJECT_OT_vertex_group_copy_to_selected_single";
+ ot->description= "Copy a vertex group to other selected objects with matching indices";
+
+ /* api callbacks */
+ ot->poll= vertex_group_poll;
+ ot->exec= vertex_group_copy_to_selected_single_exec;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
static EnumPropertyItem vgroup_items[] = {
{0, NULL, 0, NULL, NULL}
};
diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c
index 23ce4776b73..7a7c16b23ff 100644
--- a/source/blender/editors/physics/particle_boids.c
+++ b/source/blender/editors/physics/particle_boids.c
@@ -145,7 +145,6 @@ void BOID_OT_rule_del(wmOperatorType *ot)
/* identifiers */
ot->name = "Remove Boid Rule";
ot->idname = "BOID_OT_rule_del";
- ot->description = "Delete current boid rule";
/* api callbacks */
ot->exec = rule_del_exec;
@@ -319,7 +318,6 @@ void BOID_OT_state_del(wmOperatorType *ot)
/* identifiers */
ot->name = "Remove Boid State";
ot->idname = "BOID_OT_state_del";
- ot->description = "Delete current boid state";
/* api callbacks */
ot->exec = state_del_exec;
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index b106bd8754a..86f6ce6d56a 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -146,13 +146,6 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
BLI_assert((oglrender->sizex == ibuf->x) && (oglrender->sizey == ibuf->y));
if (ibuf->rect_float == NULL) {
- /* internally sequencer working in sRGB space and stores both bytes and float
- * buffers in sRGB space, but if byte->float onversion doesn't happen in sequencer
- * (e.g. when adding image sequence/movie into sequencer) there'll be only
- * byte buffer and profile will still indicate sRGB->linear space conversion is needed
- * here we're ensure there'll be no conversion happen and float buffer would store
- * linear frame (sergey) */
- ibuf->profile = IB_PROFILE_NONE;
IMB_float_from_rect(ibuf);
}
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 2fa1e759e21..772c114e6d6 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -172,8 +172,8 @@ static void area_draw_azone(short x1, short y1, short x2, short y2)
int dx = x2 - x1;
int dy = y2 - y1;
- dx = copysign(ceilf(0.3f * fabsf(dx)), dx);
- dy = copysign(ceilf(0.3f * fabsf(dy)), dy);
+ dx= copysign(ceil(0.3f*fabs(dx)), dx);
+ dy= copysign(ceil(0.3f*fabs(dy)), dy);
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 69db65fda1c..50430399f09 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -297,13 +297,13 @@ void setlinestyle(int nr)
/* Invert line handling */
-#define gl_toggle(mode, onoff) (((onoff)?glEnable:glDisable)(mode))
+#define glToggle(mode, onoff) (((onoff)?glEnable:glDisable)(mode))
void set_inverted_drawing(int enable)
{
glLogicOp(enable?GL_INVERT:GL_COPY);
- gl_toggle(GL_COLOR_LOGIC_OP, enable);
- gl_toggle(GL_DITHER, !enable);
+ glToggle(GL_COLOR_LOGIC_OP, enable);
+ glToggle(GL_DITHER, !enable);
}
void sdrawXORline(int x0, int y0, int x1, int y1)
@@ -781,7 +781,7 @@ void glaEnd2DDraw(gla2DDrawInfo *di)
}
#endif
-/* **************** GL_POINT hack ************************ */
+/* **************** glPoint hack ************************ */
static int curmode=0;
static int pointhack=0;
diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h
index 65fb65c1553..200fd8e65c7 100644
--- a/source/blender/editors/sculpt_paint/paint_intern.h
+++ b/source/blender/editors/sculpt_paint/paint_intern.h
@@ -53,16 +53,15 @@ struct wmOperatorType;
typedef int (*StrokeGetLocation)(struct bContext *C, float location[3], float mouse[2]);
typedef int (*StrokeTestStart)(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
typedef void (*StrokeUpdateStep)(struct bContext *C, struct PaintStroke *stroke, struct PointerRNA *itemptr);
-typedef void (*StrokeDone)(const struct bContext *C, struct PaintStroke *stroke);
+typedef void (*StrokeDone)(struct bContext *C, struct PaintStroke *stroke);
struct PaintStroke *paint_stroke_new(struct bContext *C,
StrokeGetLocation get_location, StrokeTestStart test_start,
StrokeUpdateStep update_step, StrokeDone done, int event_type);
-void paint_stroke_data_free(struct wmOperator *op);
+void paint_stroke_free(struct PaintStroke *stroke);
int paint_space_stroke_enabled(struct Brush *br);
-struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf);
int paint_stroke_modal(struct bContext *C, struct wmOperator *op, struct wmEvent *event);
int paint_stroke_exec(struct bContext *C, struct wmOperator *op);
int paint_stroke_cancel(struct bContext *C, struct wmOperator *op);
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index c42f0e03d79..bf01c91171b 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -713,7 +713,4 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_uv_sculpt_tool_set", PKEY, KM_PRESS, 0, 0)->ptr, "tool", UV_SCULPT_TOOL_PINCH);
RNA_enum_set(WM_keymap_add_item(keymap, "BRUSH_OT_uv_sculpt_tool_set", GKEY, KM_PRESS, 0, 0)->ptr, "tool", UV_SCULPT_TOOL_GRAB);
- /* paint stroke */
- keymap = paint_stroke_modal_keymap(keyconf);
- WM_modalkeymap_assign(keymap, "SCULPT_OT_brush_stroke");
}
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index fe228839c47..7471787eb95 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -276,30 +276,9 @@ PaintStroke *paint_stroke_new(bContext *C,
return stroke;
}
-void paint_stroke_data_free(struct wmOperator *op)
+void paint_stroke_free(PaintStroke *stroke)
{
- MEM_freeN(op->customdata);
- op->customdata= NULL;
-}
-
-static void stroke_done(struct bContext *C, struct wmOperator *op)
-{
- struct PaintStroke *stroke = op->customdata;
-
- if (stroke->stroke_started && stroke->done)
- stroke->done(C, stroke);
-
- if (stroke->timer) {
- WM_event_remove_timer(
- CTX_wm_manager(C),
- CTX_wm_window(C),
- stroke->timer);
- }
-
- if (stroke->smooth_stroke_cursor)
- WM_paint_cursor_end(CTX_wm_manager(C), stroke->smooth_stroke_cursor);
-
- paint_stroke_data_free(op);
+ MEM_freeN(stroke);
}
/* Returns zero if the stroke dots should not be spaced, non-zero otherwise */
@@ -310,35 +289,6 @@ int paint_space_stroke_enabled(Brush *br)
!ELEM4(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE, SCULPT_TOOL_SNAKE_HOOK);
}
-#define PAINT_STROKE_MODAL_CANCEL 1
-
-/* called in paint_ops.c, on each regeneration of keymaps */
-struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf)
-{
- static struct EnumPropertyItem modal_items[] = {
- {PAINT_STROKE_MODAL_CANCEL, "CANCEL", 0,
- "Cancel",
- "Cancel and undo a stroke in progress"},
-
- { 0 }
- };
-
- static const char *name= "Paint Stroke Modal";
-
- struct wmKeyMap *keymap= WM_modalkeymap_get(keyconf, name);
-
- /* this function is called for each spacetype, only needs to add map once */
- if (!keymap) {
- keymap= WM_modalkeymap_add(keyconf, name, modal_items);
-
- /* items for modal map */
- WM_modalkeymap_add_item(
- keymap, ESCKEY, KM_PRESS, KM_ANY, 0, PAINT_STROKE_MODAL_CANCEL);
- }
-
- return keymap;
-}
-
int paint_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
{
PaintStroke *stroke = op->customdata;
@@ -369,16 +319,16 @@ int paint_stroke_modal(bContext *C, wmOperator *op, wmEvent *event)
//ED_region_tag_redraw(ar);
}
- /* Cancel */
- if (event->type == EVT_MODAL_MAP && event->val == PAINT_STROKE_MODAL_CANCEL) {
- if (op->type->cancel)
- return op->type->cancel(C, op);
- else
- return paint_stroke_cancel(C, op);
- }
-
if (event->type == stroke->event_type && event->val == KM_RELEASE) {
- stroke_done(C, op);
+ /* exit stroke, free data */
+ if (stroke->smooth_stroke_cursor)
+ WM_paint_cursor_end(CTX_wm_manager(C), stroke->smooth_stroke_cursor);
+
+ if (stroke->timer)
+ WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), stroke->timer);
+
+ stroke->done(C, stroke);
+ MEM_freeN(stroke);
return OPERATOR_FINISHED;
}
else if ((first) ||
@@ -433,14 +383,24 @@ int paint_stroke_exec(bContext *C, wmOperator *op)
}
RNA_END;
- stroke_done(C, op);
+ stroke->done(C, stroke);
+
+ MEM_freeN(stroke);
+ op->customdata = NULL;
return OPERATOR_FINISHED;
}
int paint_stroke_cancel(bContext *C, wmOperator *op)
{
- stroke_done(C, op);
+ PaintStroke *stroke = op->customdata;
+
+ if (stroke->done)
+ stroke->done(C, stroke);
+
+ MEM_freeN(stroke);
+ op->customdata = NULL;
+
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 9a572a24847..9d7b7c75837 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -2424,7 +2424,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
ED_region_tag_redraw(vc->ar);
}
-static void wpaint_stroke_done(const bContext *C, struct PaintStroke *stroke)
+static void wpaint_stroke_done(bContext *C, struct PaintStroke *stroke)
{
ToolSettings *ts = CTX_data_tool_settings(C);
Object *ob = CTX_data_active_object(C);
@@ -2951,7 +2951,7 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
}
}
-static void vpaint_stroke_done(const bContext *C, struct PaintStroke *stroke)
+static void vpaint_stroke_done(bContext *C, struct PaintStroke *stroke)
{
ToolSettings *ts = CTX_data_tool_settings(C);
struct VPaintData *vpd = paint_stroke_mode_data(stroke);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index cbebbff621f..bb7789c5843 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -101,26 +101,6 @@ void ED_sculpt_force_update(bContext *C)
multires_force_update(ob);
}
-float *ED_sculpt_get_last_stroke(struct Object *ob)
-{
- return (ob && ob->sculpt && ob->sculpt->last_stroke_valid) ? ob->sculpt->last_stroke : NULL;
-}
-
-int ED_sculpt_minmax(bContext *C, float *min, float *max)
-{
- Object *ob= CTX_data_active_object(C);
-
- if (ob && ob->sculpt && ob->sculpt->last_stroke_valid) {
- copy_v3_v3(min, ob->sculpt->last_stroke);
- copy_v3_v3(max, ob->sculpt->last_stroke);
-
- return 1;
- }
- else {
- return 0;
- }
-}
-
/* Sculpt mode handles multires differently from regular meshes, but only if
* it's the last modifier on the stack and it is not on the first level */
struct MultiresModifierData *sculpt_multires_active(Scene *scene, Object *ob)
@@ -264,54 +244,6 @@ typedef struct StrokeCache {
rcti previous_r; /* previous redraw rectangle */
} StrokeCache;
-
-/*** paint mesh ***/
-
-static void paint_mesh_restore_co(Sculpt *sd, SculptSession *ss)
-{
- StrokeCache *cache = ss->cache;
- int i;
-
- PBVHNode **nodes;
- int n, totnode;
-
-#ifndef _OPENMP
- (void)sd; /* quied unused warning */
-#endif
-
- BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
-
- #pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
- for (n = 0; n < totnode; n++) {
- SculptUndoNode *unode;
-
- unode = sculpt_undo_get_node(nodes[n]);
- if (unode) {
- PBVHVertexIter vd;
-
- BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
- copy_v3_v3(vd.co, unode->co[vd.i]);
- if (vd.no) copy_v3_v3_short(vd.no, unode->no[vd.i]);
- else normal_short_to_float_v3(vd.fno, unode->no[vd.i]);
-
- if (vd.mvert) vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
- }
- BLI_pbvh_vertex_iter_end;
-
- BLI_pbvh_node_mark_update(nodes[n]);
- }
- }
-
- if (ss->face_normals) {
- float *fn = ss->face_normals;
- for (i = 0; i < ss->totpoly; ++i, fn += 3)
- copy_v3_v3(fn, cache->face_norms[i]);
- }
-
- if (nodes)
- MEM_freeN(nodes);
-}
-
/*** BVH Tree ***/
/* Get a screen-space rectangle of the modified area */
@@ -425,11 +357,11 @@ static int sculpt_brush_test_cube(SculptBrushTest *test, float co[3], float loca
local_co[2] = fabs(local_co[2]);
if (local_co[0] <= side && local_co[1] <= side && local_co[2] <= side) {
- float p = 4.0f;
+ float p = 4;
test->dist = ((powf(local_co[0], p) +
powf(local_co[1], p) +
- powf(local_co[2], p)) / powf(side, p));
+ powf(local_co[2], p)) / pow(side, p));
return 1;
}
@@ -3241,7 +3173,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
sd->special_rotation = cache->special_rotation;
}
-static void sculpt_stroke_modifiers_check(const bContext *C, Object *ob)
+static void sculpt_stroke_modifiers_check(bContext *C, Object *ob)
{
SculptSession *ss = ob->sculpt;
@@ -3377,7 +3309,43 @@ static void sculpt_restore_mesh(Sculpt *sd, SculptSession *ss)
BKE_brush_use_size_pressure(ss->cache->vc->scene, brush)) ||
(brush->flag & BRUSH_RESTORE_MESH))
{
- paint_mesh_restore_co(sd, ss);
+ StrokeCache *cache = ss->cache;
+ int i;
+
+ PBVHNode **nodes;
+ int n, totnode;
+
+ BLI_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
+
+ #pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP)
+ for (n = 0; n < totnode; n++) {
+ SculptUndoNode *unode;
+
+ unode = sculpt_undo_get_node(nodes[n]);
+ if (unode) {
+ PBVHVertexIter vd;
+
+ BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) {
+ copy_v3_v3(vd.co, unode->co[vd.i]);
+ if (vd.no) copy_v3_v3_short(vd.no, unode->no[vd.i]);
+ else normal_short_to_float_v3(vd.fno, unode->no[vd.i]);
+
+ if (vd.mvert) vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+ }
+ BLI_pbvh_vertex_iter_end;
+
+ BLI_pbvh_node_mark_update(nodes[n]);
+ }
+ }
+
+ if (ss->face_normals) {
+ float *fn = ss->face_normals;
+ for (i = 0; i < ss->totpoly; ++i, fn += 3)
+ copy_v3_v3(fn, cache->face_norms[i]);
+ }
+
+ if (nodes)
+ MEM_freeN(nodes);
}
}
@@ -3487,7 +3455,7 @@ static void sculpt_brush_exit_tex(Sculpt *sd)
ntreeTexEndExecTree(mtex->tex->nodetree->execdata, 1);
}
-static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(stroke))
+static void sculpt_stroke_done(bContext *C, struct PaintStroke *UNUSED(stroke))
{
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
@@ -3514,11 +3482,6 @@ static void sculpt_stroke_done(const bContext *C, struct PaintStroke *UNUSED(str
}
}
- /* update last stroke position */
- ob->sculpt->last_stroke_valid= 1;
- copy_v3_v3(ob->sculpt->last_stroke, ss->cache->true_location);
- mul_m4_v3(ob->obmat, ob->sculpt->last_stroke);
-
sculpt_cache_free(ss->cache);
ss->cache = NULL;
@@ -3563,7 +3526,7 @@ static int sculpt_brush_stroke_invoke(bContext *C, wmOperator *op, wmEvent *even
"ignore_background_click");
if (ignore_background_click && !over_mesh(C, op, event->x, event->y)) {
- paint_stroke_data_free(op);
+ paint_stroke_free(stroke);
return OPERATOR_PASS_THROUGH;
}
@@ -3595,10 +3558,6 @@ static int sculpt_brush_stroke_cancel(bContext *C, wmOperator *op)
SculptSession *ss = ob->sculpt;
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
- if (ss->cache) {
- paint_mesh_restore_co(sd, ss);
- }
-
paint_stroke_cancel(C, op);
if (ss->cache) {
diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c
index 95441600d77..5d2791daf87 100644
--- a/source/blender/editors/sculpt_paint/sculpt_uv.c
+++ b/source/blender/editors/sculpt_paint/sculpt_uv.c
@@ -207,8 +207,8 @@ void HC_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *sculptdata, float
float strength;
strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root);
- sculptdata->uv[i].uv[0] = (1.0f - strength) * sculptdata->uv[i].uv[0] + strength * (tmp_uvdata[i].p[0] - 0.5f * (tmp_uvdata[i].b[0] + tmp_uvdata[i].sum_b[0] / tmp_uvdata[i].ncounter));
- sculptdata->uv[i].uv[1] = (1.0f - strength) * sculptdata->uv[i].uv[1] + strength * (tmp_uvdata[i].p[1] - 0.5f * (tmp_uvdata[i].b[1] + tmp_uvdata[i].sum_b[1] / tmp_uvdata[i].ncounter));
+ sculptdata->uv[i].uv[0] = (1.0 - strength) * sculptdata->uv[i].uv[0] + strength * (tmp_uvdata[i].p[0] - 0.5f * (tmp_uvdata[i].b[0] + tmp_uvdata[i].sum_b[0] / tmp_uvdata[i].ncounter));
+ sculptdata->uv[i].uv[1] = (1.0 - strength) * sculptdata->uv[i].uv[1] + strength * (tmp_uvdata[i].p[1] - 0.5f * (tmp_uvdata[i].b[1] + tmp_uvdata[i].sum_b[1] / tmp_uvdata[i].ncounter));
for (element = sculptdata->uv[i].element; element; element = element->next) {
MLoopUV *luv;
@@ -271,8 +271,8 @@ static void laplacian_relaxation_iteration_uv(BMEditMesh *em, UvSculptData *scul
float strength;
strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root);
- sculptdata->uv[i].uv[0] = (1.0f - strength) * sculptdata->uv[i].uv[0] + strength * tmp_uvdata[i].p[0];
- sculptdata->uv[i].uv[1] = (1.0f - strength) * sculptdata->uv[i].uv[1] + strength * tmp_uvdata[i].p[1];
+ sculptdata->uv[i].uv[0] = (1.0 - strength) * sculptdata->uv[i].uv[0] + strength * tmp_uvdata[i].p[0];
+ sculptdata->uv[i].uv[1] = (1.0 - strength) * sculptdata->uv[i].uv[1] + strength * tmp_uvdata[i].p[1];
for (element = sculptdata->uv[i].element; element; element = element->next) {
MLoopUV *luv;
@@ -347,8 +347,8 @@ static void uv_sculpt_stroke_apply(bContext *C, wmOperator *op, wmEvent *event,
strength = alpha * BKE_brush_curve_strength(brush, sqrt(dist), radius_root);
normalize_v2(diff);
- sculptdata->uv[i].uv[0] -= strength * diff[0] * 0.001f;
- sculptdata->uv[i].uv[1] -= strength * diff[1] * 0.001f;
+ sculptdata->uv[i].uv[0] -= strength * diff[0] * 0.001;
+ sculptdata->uv[i].uv[1] -= strength * diff[1] * 0.001;
for (element = sculptdata->uv[i].element; element; element = element->next) {
MLoopUV *luv;
diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c
index 5761a285d72..df6d713d82d 100644
--- a/source/blender/editors/space_clip/clip_buttons.c
+++ b/source/blender/editors/space_clip/clip_buttons.c
@@ -371,9 +371,9 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
block = uiLayoutGetBlock(layout);
if (cb->marker_flag & MARKER_DISABLED)
- tip = "Marker is disabled at current frame";
+ tip= "Marker is disabled at current frame";
else
- tip = "Marker is enabled at current frame";
+ tip= "Marker is enabled at current frame";
bt = uiDefIconButBitI(block, TOGN, MARKER_DISABLED, 0, ICON_RESTRICT_VIEW_OFF, 0, 0, 20, 20, &cb->marker_flag, 0, 0, 1, 0, tip);
uiButSetNFunc(bt, marker_update_cb, cb, NULL);
@@ -393,7 +393,7 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
return;
}
- step = 100;
+ step= 100;
digits = 2;
sub_v2_v2v2(pat_dim, track->pat_max, track->pat_min);
@@ -413,20 +413,20 @@ void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, P
cb->marker_flag = marker->flag;
- block = uiLayoutAbsoluteBlock(layout);
+ block= uiLayoutAbsoluteBlock(layout);
uiBlockSetHandleFunc(block, marker_block_handler, cb);
uiBlockSetNFunc(block, marker_update_cb, cb, NULL);
if (cb->marker_flag & MARKER_DISABLED)
- tip = "Marker is disabled at current frame";
+ tip= "Marker is disabled at current frame";
else
- tip = "Marker is enabled at current frame";
+ tip= "Marker is enabled at current frame";
uiDefButBitI(block, OPTIONN, MARKER_DISABLED, B_MARKER_FLAG, "Enabled", 10, 190, 145, 19, &cb->marker_flag,
0, 0, 0, 0, tip);
col = uiLayoutColumn(layout, 1);
- uiLayoutSetActive(col, (cb->marker_flag & MARKER_DISABLED) == 0);
+ uiLayoutSetActive(col, (cb->marker_flag&MARKER_DISABLED)==0);
block = uiLayoutAbsoluteBlock(col);
uiBlockBeginAlign(block);
diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c
deleted file mode 100644
index 574eb5b2570..00000000000
--- a/source/blender/editors/space_clip/clip_dopesheet_draw.c
+++ /dev/null
@@ -1,356 +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) 2012 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/space_clip/clip_graph_draw.c
- * \ingroup spclip
- */
-
-#include "DNA_movieclip_types.h"
-#include "DNA_object_types.h" /* SELECT */
-#include "DNA_scene_types.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BKE_context.h"
-#include "BKE_movieclip.h"
-#include "BKE_tracking.h"
-
-#include "BLI_utildefines.h"
-#include "BLI_math.h"
-#include "BLI_string.h"
-#include "BLI_listbase.h"
-#include "BLI_math.h"
-
-#include "ED_screen.h"
-#include "ED_clip.h"
-
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
-
-#include "WM_types.h"
-
-#include "UI_interface.h"
-#include "UI_resources.h"
-#include "UI_view2d.h"
-
-#include "BLF_api.h"
-
-#include "RNA_access.h"
-
-#include "clip_intern.h" // own include
-
-static void track_channel_color(MovieTrackingTrack *track, float default_color[3], float color[3])
-{
- if (track->flag & TRACK_CUSTOMCOLOR) {
- float bg[3];
- UI_GetThemeColor3fv(TH_HEADER, bg);
-
- interp_v3_v3v3(color, track->color, bg, 0.5);
- }
- else {
- if (default_color)
- copy_v3_v3(color, default_color);
- else
- UI_GetThemeColor3fv(TH_HEADER, color);
- }
-}
-
-static void draw_keyframe_shape(float x, float y, float xscale, float yscale, short sel, float alpha)
-{
- /* coordinates for diamond shape */
- static const float _unit_diamond_shape[4][2] = {
- {0.0f, 1.0f}, /* top vert */
- {1.0f, 0.0f}, /* mid-right */
- {0.0f, -1.0f}, /* bottom vert */
- {-1.0f, 0.0f} /* mid-left */
- };
- static GLuint displist1 = 0;
- static GLuint displist2 = 0;
- int hsize = STRIP_HEIGHT_HALF;
-
- /* initialize 2 display lists for diamond shape - one empty, one filled */
- if (displist1 == 0) {
- displist1 = glGenLists(1);
- glNewList(displist1, GL_COMPILE);
-
- glBegin(GL_LINE_LOOP);
- glVertex2fv(_unit_diamond_shape[0]);
- glVertex2fv(_unit_diamond_shape[1]);
- glVertex2fv(_unit_diamond_shape[2]);
- glVertex2fv(_unit_diamond_shape[3]);
- glEnd();
- glEndList();
- }
- if (displist2 == 0) {
- displist2 = glGenLists(1);
- glNewList(displist2, GL_COMPILE);
-
- glBegin(GL_QUADS);
- glVertex2fv(_unit_diamond_shape[0]);
- glVertex2fv(_unit_diamond_shape[1]);
- glVertex2fv(_unit_diamond_shape[2]);
- glVertex2fv(_unit_diamond_shape[3]);
- glEnd();
- glEndList();
- }
-
- glPushMatrix();
-
- /* adjust view transform before starting */
- glTranslatef(x, y, 0.0f);
- glScalef(1.0f/xscale*hsize, 1.0f/yscale*hsize, 1.0f);
-
- /* anti-aliased lines for more consistent appearance */
- glEnable(GL_LINE_SMOOTH);
-
- if (sel)
- UI_ThemeColorShadeAlpha(TH_STRIP_SELECT, 50, -255*(1.0f-alpha));
- else
- glColor4f(0.91f, 0.91f, 0.91f, alpha);
-
- glCallList(displist2);
-
- /* exterior - black frame */
- glColor4f(0.0f, 0.0f, 0.0f, alpha);
- glCallList(displist1);
-
- glDisable(GL_LINE_SMOOTH);
-
- /* restore view transform */
- glPopMatrix();
-}
-
-void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
-{
- MovieClip *clip = ED_space_clip(sc);
- View2D *v2d = &ar->v2d;
-
- /* frame range */
- clip_draw_sfra_efra(v2d, scene);
-
- if (clip) {
- MovieTracking *tracking = &clip->tracking;
- MovieTrackingDopesheet *dopesheet = &tracking->dopesheet;
- MovieTrackingDopesheetChannel *channel;
- float y, xscale, yscale;
- float strip[4], selected_strip[4];
-
- y = (float) CHANNEL_FIRST;
-
- UI_view2d_getscale(v2d, &xscale, &yscale);
-
- /* setup colors for regular and selected strips */
- UI_GetThemeColor3fv(TH_STRIP, strip);
- UI_GetThemeColor3fv(TH_STRIP_SELECT, selected_strip);
-
- strip[3] = 0.5f;
- selected_strip[3] = 1.0f;
-
- glEnable(GL_BLEND);
-
- for (channel = dopesheet->channels.first; channel; channel = channel->next) {
- float yminc = (float) (y - CHANNEL_HEIGHT_HALF);
- float ymaxc = (float) (y + CHANNEL_HEIGHT_HALF);
-
- /* check if visible */
- if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
- IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax))
- {
- MovieTrackingTrack *track = channel->track;
- float alpha;
- int i, sel = track->flag & TRACK_DOPE_SEL;
-
- /* selection background */
- if (sel) {
- float color[4] = {0.0f, 0.0f, 0.0f, 0.3f};
- float default_color[4] = {0.8f, 0.93f, 0.8f, 0.3f};
-
- track_channel_color(track, default_color, color);
- glColor4fv(color);
-
- glRectf(v2d->cur.xmin, (float) y - CHANNEL_HEIGHT_HALF,
- v2d->cur.xmax + EXTRA_SCROLL_PAD, (float) y + CHANNEL_HEIGHT_HALF);
- }
-
- alpha = (track->flag & TRACK_LOCKED) ? 0.5f : 1.0f;
-
- /* tracked segments */
- for (i = 0; i < channel->tot_segment; i++) {
- int start_frame = channel->segments[2 * i];
- int end_frame = channel->segments[2 * i + 1];
-
- if (sel)
- glColor4fv(selected_strip);
- else
- glColor4fv(strip);
-
- if (start_frame != end_frame) {
- glRectf(start_frame, (float) y - STRIP_HEIGHT_HALF,
- end_frame, (float) y + STRIP_HEIGHT_HALF);
- draw_keyframe_shape(start_frame, y, xscale, yscale, sel, alpha);
- draw_keyframe_shape(end_frame, y, xscale, yscale, sel, alpha);
- }
- else {
- draw_keyframe_shape(start_frame, y, xscale, yscale, sel, alpha);
- }
- }
-
- /* keyframes */
- i = 0;
- while (i < track->markersnr) {
- MovieTrackingMarker *marker = &track->markers[i];
-
- if ((marker->flag & (MARKER_DISABLED | MARKER_TRACKED)) == 0)
- draw_keyframe_shape(marker->framenr, y, xscale, yscale, sel, alpha);
-
- i++;
- }
- }
-
- /* adjust y-position for next one */
- y -= CHANNEL_STEP;
- }
-
- glDisable(GL_BLEND);
- }
-
- /* current frame */
- clip_draw_cfra(sc, ar, scene);
-}
-
-void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar)
-{
- ScrArea *sa = CTX_wm_area(C);
- SpaceClip *sc = CTX_wm_space_clip(C);
- View2D *v2d = &ar->v2d;
- MovieClip *clip = ED_space_clip(sc);
- MovieTracking *tracking;
- MovieTrackingDopesheet *dopesheet;
- MovieTrackingDopesheetChannel *channel;
- uiStyle *style = UI_GetStyle();
- uiBlock *block;
- int fontid = style->widget.uifont_id;
- int height;
- float y;
-
- if (!clip)
- return;
-
- tracking = &clip->tracking;
- dopesheet = &tracking->dopesheet;
- height = (dopesheet->tot_channel * CHANNEL_STEP) + (CHANNEL_HEIGHT * 2);
-
- if (height > (v2d->mask.ymax - v2d->mask.ymin)) {
- /* don't use totrect set, as the width stays the same
- * (NOTE: this is ok here, the configuration is pretty straightforward)
- */
- v2d->tot.ymin = (float)(-height);
- }
-
- /* need to do a view-sync here, so that the keys area doesn't jump around (it must copy this) */
- UI_view2d_sync(NULL, sa, v2d, V2D_LOCK_COPY);
-
- /* loop through channels, and set up drawing depending on their type
- * first pass: just the standard GL-drawing for backdrop + text
- */
- y = (float) CHANNEL_FIRST;
-
- BLF_size(fontid, 11.0f, U.dpi);
-
- for (channel = dopesheet->channels.first; channel; channel = channel->next) {
- float yminc = (float) (y - CHANNEL_HEIGHT_HALF);
- float ymaxc = (float) (y + CHANNEL_HEIGHT_HALF);
-
- /* check if visible */
- if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
- IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax))
- {
- MovieTrackingTrack *track = channel->track;
- float font_height, color[3];
- int sel = track->flag & TRACK_DOPE_SEL;
-
- track_channel_color(track, NULL, color);
- glColor3fv(color);
-
- glRectf(v2d->cur.xmin, (float) y - CHANNEL_HEIGHT_HALF,
- v2d->cur.xmax + EXTRA_SCROLL_PAD, (float) y + CHANNEL_HEIGHT_HALF);
-
- if (sel)
- UI_ThemeColor(TH_TEXT_HI);
- else
- UI_ThemeColor(TH_TEXT);
-
- font_height = BLF_height(fontid, track->name);
- BLF_position(fontid, v2d->cur.xmin + CHANNEL_PAD,
- y - font_height / 2.0f, 0.0f);
- BLF_draw(fontid, track->name, strlen(track->name));
- }
-
- /* adjust y-position for next one */
- y -= CHANNEL_STEP;
- }
-
- /* second pass: widgets */
- block = uiBeginBlock(C, ar, __func__, UI_EMBOSS);
- y = (float) CHANNEL_FIRST;
-
- glEnable(GL_BLEND);
- for (channel = dopesheet->channels.first; channel; channel = channel->next) {
- float yminc = (float)(y - CHANNEL_HEIGHT_HALF);
- float ymaxc = (float)(y + CHANNEL_HEIGHT_HALF);
-
- /* check if visible */
- if (IN_RANGE(yminc, v2d->cur.ymin, v2d->cur.ymax) ||
- IN_RANGE(ymaxc, v2d->cur.ymin, v2d->cur.ymax))
- {
- MovieTrackingTrack *track = channel->track;
- uiBut *but;
- PointerRNA ptr;
- int icon;
-
- RNA_pointer_create(&clip->id, &RNA_MovieTrackingTrack, track, &ptr);
-
- if (track->flag & TRACK_LOCKED)
- icon = ICON_LOCKED;
- else
- icon = ICON_UNLOCKED;
-
- uiBlockSetEmboss(block, UI_EMBOSSN);
- but = uiDefIconButR(block, ICONTOG, 1, icon,
- v2d->cur.xmax - UI_UNIT_X - CHANNEL_PAD, y - UI_UNIT_Y / 2.0f,
- UI_UNIT_X, UI_UNIT_Y, &ptr, "lock", 0, 0, 0, 0, 0, NULL);
- uiBlockSetEmboss(block, UI_EMBOSS);
- }
-
- /* adjust y-position for next one */
- y -= CHANNEL_STEP;
- }
- glDisable(GL_BLEND);
-
- uiEndBlock(C, block);
- uiDrawBlock(C, block);
-}
diff --git a/source/blender/editors/space_clip/clip_dopesheet_ops.c b/source/blender/editors/space_clip/clip_dopesheet_ops.c
deleted file mode 100644
index 9b9190e3e05..00000000000
--- a/source/blender/editors/space_clip/clip_dopesheet_ops.c
+++ /dev/null
@@ -1,139 +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) 2012 Blender Foundation.
- * All rights reserved.
- *
- *
- * Contributor(s): Blender Foundation,
- * Sergey Sharybin
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/editors/space_clip/clip_graph_ops.c
- * \ingroup spclip
- */
-
-#include "DNA_object_types.h" /* SELECT */
-#include "DNA_scene_types.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_utildefines.h"
-#include "BLI_math.h"
-#include "BLI_listbase.h"
-#include "BLI_rect.h"
-
-#include "BKE_context.h"
-#include "BKE_movieclip.h"
-#include "BKE_tracking.h"
-#include "BKE_depsgraph.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "ED_screen.h"
-#include "ED_clip.h"
-
-#include "UI_interface.h"
-
-#include "RNA_access.h"
-#include "RNA_define.h"
-
-#include "UI_view2d.h"
-
-#include "clip_intern.h" // own include
-
-/********************** select channel operator *********************/
-
-static int dopesheet_select_channel_poll(bContext *C)
-{
- SpaceClip *sc = CTX_wm_space_clip(C);
-
- if (sc && sc->clip)
- return sc->view == SC_VIEW_DOPESHEET;
-
- return FALSE;
-}
-
-static int dopesheet_select_channel_exec(bContext *C, wmOperator *op)
-{
- SpaceClip *sc = CTX_wm_space_clip(C);
- MovieClip *clip = ED_space_clip(sc);
- MovieTracking *tracking = &clip->tracking;
- MovieTrackingDopesheet *dopesheet = &tracking->dopesheet;
- MovieTrackingDopesheetChannel *channel;
- float location[2];
- int extend = RNA_boolean_get(op->ptr, "extend");
- int current_channel_index = 0, channel_index;
-
- RNA_float_get_array(op->ptr, "location", location);
- channel_index = -(location[1] - (CHANNEL_FIRST + CHANNEL_HEIGHT_HALF)) / CHANNEL_STEP;
-
- for (channel = dopesheet->channels.first; channel; channel = channel->next) {
- MovieTrackingTrack *track = channel->track;
-
- if (current_channel_index == channel_index) {
- if (extend)
- track->flag ^= TRACK_DOPE_SEL;
- else
- track->flag |= TRACK_DOPE_SEL;
- }
- else if (!extend)
- track->flag &= ~TRACK_DOPE_SEL;
-
- current_channel_index++;
- }
-
- WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
-
- return OPERATOR_FINISHED;
-}
-
-static int dopesheet_select_channel_invoke(bContext *C, wmOperator *op, wmEvent *event)
-{
- ARegion *ar = CTX_wm_region(C);
- float location[2];
-
- UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
- RNA_float_set_array(op->ptr, "location", location);
-
- return dopesheet_select_channel_exec(C, op);
-}
-
-void CLIP_OT_dopesheet_select_channel(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name = "Select Channel";
- ot->description = "Select movie tracking channel";
- ot->idname = "CLIP_OT_dopesheet_select_channel";
-
- /* api callbacks */
- ot->invoke = dopesheet_select_channel_invoke;
- ot->exec = dopesheet_select_channel_exec;
- ot->poll = dopesheet_select_channel_poll;
-
- /* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
-
- /* properties */
- RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX,
- "Location", "Mouse location to select channel", -100.0f, 100.0f);
- RNA_def_boolean(ot->srna, "extend", 0,
- "Extend", "Extend selection rather than clearing the existing selection");
-}
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index 33bc67db8e4..0d519f36ba3 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -310,7 +310,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
int count = sc->path_length;
int i, a, b, curindex = -1;
float path[102][2];
- int tiny = sc->flag & SC_SHOW_TINY_MARKER, framenr;
+ int tiny = sc->flag&SC_SHOW_TINY_MARKER, framenr;
MovieTrackingMarker *marker;
if (count == 0)
@@ -354,7 +354,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
if (marker->framenr == i) {
if (marker->framenr == sc->user.framenr)
- curindex = b;
+ curindex= b;
add_v2_v2v2(path[b++], marker->pos, track->offset);
ED_clip_point_undistorted_pos(sc, path[b-1], path[b-1]);
@@ -416,7 +416,7 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, float marker_pos[2], int width, int height)
{
- int tiny = sc->flag & SC_SHOW_TINY_MARKER;
+ int tiny = sc->flag&SC_SHOW_TINY_MARKER;
int show_search = FALSE;
float px[2];
@@ -515,8 +515,8 @@ static void track_colors(MovieTrackingTrack *track, int act, float col[3], float
static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker, float marker_pos[2], int width, int height, int act, int sel)
{
- int tiny = sc->flag & SC_SHOW_TINY_MARKER;
- int show_search = 0;
+ int tiny= sc->flag&SC_SHOW_TINY_MARKER;
+ int show_search= 0;
float col[3], scol[3], px[2];
track_colors(track, act, col, scol);
@@ -525,7 +525,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
px[1]= 1.0f / height / sc->zoom;
/* marker position and offset position */
- if ((track->flag & SELECT) == sel && (marker->flag & MARKER_DISABLED) == 0) {
+ if ((track->flag&SELECT) == sel && (marker->flag & MARKER_DISABLED) == 0) {
float pos[2];
rctf r;
@@ -716,7 +716,7 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
float marker_pos[2], int outline, int sel, int act, int width, int height)
{
float x, y, dx, dy, patdx, patdy, searchdx, searchdy, tdx, tdy;
- int tiny = sc->flag & SC_SHOW_TINY_MARKER;
+ int tiny = sc->flag&SC_SHOW_TINY_MARKER;
float col[3], scol[3], px[2];
if ((tiny && outline) || (marker->flag & MARKER_DISABLED))
@@ -849,7 +849,7 @@ static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTra
int width, int height, float zoomx, float zoomy)
{
char str[128] = {0}, state[64] = {0};
- float dx = 0.0f, dy = 0.0f, fontsize, pos[3];
+ float dx= 0.0f, dy = 0.0f, fontsize, pos[3];
uiStyle *style = U.uistyles.first;
int fontid = style->widget.uifont_id;
@@ -974,7 +974,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
if ((track->flag & TRACK_HIDDEN)==0) {
marker = BKE_tracking_get_marker(track, framenr);
- if (MARKER_VISIBLE(sc, track, marker))
+ if (MARKER_VISIBLE(sc, marker))
count++;
}
@@ -991,7 +991,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
if ((track->flag & TRACK_HIDDEN)==0) {
marker = BKE_tracking_get_marker(track, framenr);
- if (MARKER_VISIBLE(sc, track, marker)) {
+ if (MARKER_VISIBLE(sc, marker)) {
ED_clip_point_undistorted_pos(sc, marker->pos, fp);
if (track == act_track)
@@ -1023,7 +1023,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
if ((track->flag & TRACK_HIDDEN)==0) {
marker = BKE_tracking_get_marker(track, framenr);
- if (MARKER_VISIBLE(sc, track, marker)) {
+ if (MARKER_VISIBLE(sc, marker)) {
copy_v2_v2(cur_pos, fp ? fp : marker->pos);
draw_marker_outline(sc, track, marker, cur_pos, width, height);
@@ -1048,7 +1048,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
int act = track == act_track;
marker = BKE_tracking_get_marker(track, framenr);
- if (MARKER_VISIBLE(sc, track, marker)) {
+ if (MARKER_VISIBLE(sc, marker)) {
if (!act) {
copy_v2_v2(cur_pos, fp ? fp : marker->pos);
@@ -1069,7 +1069,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
if ((act_track->flag & TRACK_HIDDEN)==0) {
marker = BKE_tracking_get_marker(act_track, framenr);
- if (MARKER_VISIBLE(sc, act_track, marker)) {
+ if (MARKER_VISIBLE(sc, marker)) {
copy_v2_v2(cur_pos, active_pos ? active_pos : marker->pos);
draw_marker_areas(sc, act_track, marker, cur_pos, width, height, 1, 1);
@@ -1091,9 +1091,9 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
track = tracksbase->first;
while (track) {
if ((track->flag & TRACK_HIDDEN) == 0 && track->flag & TRACK_HAS_BUNDLE) {
- marker = BKE_tracking_get_marker(track, framenr);
+ marker= BKE_tracking_get_marker(track, framenr);
- if (MARKER_VISIBLE(sc, track, marker)) {
+ if (MARKER_VISIBLE(sc, marker)) {
float npos[2];
copy_v4_v4(vec, track->bundle_pos);
vec[3]=1;
@@ -1143,7 +1143,7 @@ static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip,
if ((track->flag & TRACK_HIDDEN) == 0) {
marker = BKE_tracking_get_marker(track, framenr);
- if (MARKER_VISIBLE(sc, track, marker)) {
+ if (MARKER_VISIBLE(sc, marker)) {
int act = track == act_track;
copy_v2_v2(cur_pos, fp ? fp : marker->pos);
@@ -1216,7 +1216,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
if (a<2)
ok = tpos[a%2] < val[a][a%2];
else
- ok = tpos[a%2] > val[a][a%2];
+ ok= tpos[a%2] > val[a][a%2];
if (ok) {
copy_v2_v2(val[a], tpos);
@@ -1282,7 +1282,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
}
if (sc->flag & SC_MANUAL_CALIBRATION && clip->gpd) {
- bGPDlayer *layer = clip->gpd->layers.first;
+ bGPDlayer *layer= clip->gpd->layers.first;
while (layer) {
bGPDframe *frame = layer->frames.first;
@@ -1314,7 +1314,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
npos[1] = stroke->points[i+1].y * height * aspy;
len = len_v2v2(pos, npos);
- steps = ceil(len/5.0f);
+ steps= ceil(len/5.0f);
/* we want to distort only long straight lines */
if (stroke->totpoints == 2) {
@@ -1359,7 +1359,7 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip, int wid
void clip_draw_main(SpaceClip *sc, ARegion *ar, Scene *scene)
{
- MovieClip *clip = ED_space_clip(sc);
+ MovieClip *clip= ED_space_clip(sc);
ImBuf *ibuf;
int width, height;
float zoomx, zoomy;
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index bd34a51819c..443cb8f7ef4 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -73,20 +73,9 @@ int ED_space_clip_poll(bContext *C)
return FALSE;
}
-int ED_space_clip_view_clip_poll(bContext *C)
-{
- SpaceClip *sc = CTX_wm_space_clip(C);
-
- if (sc && sc->clip) {
- return sc->view == SC_VIEW_CLIP;
- }
-
- return FALSE;
-}
-
int ED_space_clip_tracking_poll(bContext *C)
{
- SpaceClip *sc = CTX_wm_space_clip(C);
+ SpaceClip *sc= CTX_wm_space_clip(C);
if (sc && sc->clip)
return ED_space_clip_show_trackedit(sc);
@@ -139,7 +128,7 @@ void ED_space_clip_set(bContext *C, bScreen *screen, SpaceClip *sc, MovieClip *c
old_clip = sc->clip;
sc->clip = clip;
- if (sc->clip && sc->clip->id.us == 0)
+ if (sc->clip && sc->clip->id.us==0)
sc->clip->id.us = 1;
if (screen) {
@@ -262,7 +251,7 @@ static int selected_boundbox(SpaceClip *sc, float min[2], float max[2])
MovieClip *clip = ED_space_clip(sc);
MovieTrackingTrack *track;
int width, height, ok = FALSE;
- ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
+ ListBase *tracksbase= BKE_tracking_get_tracks(&clip->tracking);
INIT_MINMAX2(min, max);
@@ -552,3 +541,11 @@ int ED_space_clip_show_trackedit(SpaceClip *sc)
return FALSE;
}
+
+void ED_space_clip_update_dopesheet(SpaceClip *sc)
+{
+ MovieClip *clip = sc->clip;
+ MovieTracking *tracking = &clip->tracking;
+
+ BKE_tracking_update_dopesheet(tracking);
+}
diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c
index 9f9bdcb6cd2..4825403fb4a 100644
--- a/source/blender/editors/space_clip/clip_graph_draw.c
+++ b/source/blender/editors/space_clip/clip_graph_draw.c
@@ -61,7 +61,7 @@
static void draw_curve_knot(float x, float y, float xscale, float yscale, float hsize)
{
- static GLuint displist = 0;
+ static GLuint displist=0;
/* initialize round circle shape */
if (displist == 0) {
@@ -101,7 +101,7 @@ void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track, int co
copy_v3_v3(col, colors[coord]);
- if (track == userdata) {
+ if (track==userdata) {
col[3] = 1.0f;
glLineWidth(2.0f);
}
@@ -126,7 +126,7 @@ static void tracking_segment_knot_cb(void *userdata, MovieTrackingTrack *track,
MovieTrackingMarker *marker, int coord, float val)
{
struct { MovieTrackingTrack *act_track; int sel; float xscale, yscale, hsize; } *data = userdata;
- int sel = 0, sel_flag;
+ int sel= 0, sel_flag;
if (track != data->act_track)
return;
@@ -170,7 +170,7 @@ static void draw_tracks_curves(View2D *v2d, SpaceClip *sc)
glDisable(GL_BLEND);
/* selected knot handles on top of curves */
- userdata.sel = TRUE;
+ userdata.sel= TRUE;
clip_graph_tracking_values_iterate(sc, &userdata, tracking_segment_knot_cb, NULL, NULL);
}
diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c
index efe48cd4b36..03557a0b264 100644
--- a/source/blender/editors/space_clip/clip_graph_ops.c
+++ b/source/blender/editors/space_clip/clip_graph_ops.c
@@ -66,7 +66,11 @@ static int ED_space_clip_graph_poll(bContext *C)
if (ED_space_clip_tracking_poll(C)) {
SpaceClip *sc = CTX_wm_space_clip(C);
- return sc->view == SC_VIEW_GRAPH;
+ if (sc->view == SC_VIEW_GRAPH) {
+ ARegion *ar = CTX_wm_region(C);
+
+ return ar->regiontype == RGN_TYPE_PREVIEW;
+ }
}
return FALSE;
@@ -165,7 +169,7 @@ static void mouse_select_init_data(MouseSelectUserData *userdata, float *co)
static int mouse_select_knot(bContext *C, float co[2], int extend)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- MovieClip *clip = ED_space_clip(sc);
+ MovieClip *clip= ED_space_clip(sc);
ARegion *ar = CTX_wm_region(C);
View2D *v2d = &ar->v2d;
MovieTracking *tracking = &clip->tracking;
@@ -328,7 +332,7 @@ static void border_select_cb(void *userdata, MovieTrackingTrack *UNUSED(track),
data->change = TRUE;
}
else if (!data->extend) {
- marker->flag &= ~MARKER_GRAPH_SEL;
+ marker->flag&= ~MARKER_GRAPH_SEL;
}
}
@@ -489,7 +493,7 @@ void CLIP_OT_graph_delete_curve(wmOperatorType *ot)
static int delete_knot_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceClip *sc = CTX_wm_space_clip(C);
- MovieClip *clip = ED_space_clip(sc);
+ MovieClip *clip= ED_space_clip(sc);
MovieTracking *tracking = &clip->tracking;
ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
MovieTrackingTrack *act_track = BKE_tracking_active_track(tracking);
@@ -651,9 +655,9 @@ static int graph_disable_markers_exec(bContext *C, wmOperator *op)
marker = &act_track->markers[a];
if (marker->flag & MARKER_GRAPH_SEL) {
- if (action == 0)
+ if (action==0)
marker->flag |= MARKER_DISABLED;
- else if (action == 1)
+ else if (action==1)
marker->flag &= ~MARKER_DISABLED;
else
marker->flag ^= MARKER_DISABLED;
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 485830dbe6c..fa7b534fa2f 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -287,14 +287,14 @@ static void view_pan_init(bContext *C, wmOperator *op, wmEvent *event)
vpd->y = event->y;
if (sc->flag & SC_LOCK_SELECTION)
- vpd->vec = &sc->xlockof;
+ vpd->vec= &sc->xlockof;
else
- vpd->vec = &sc->xof;
+ vpd->vec= &sc->xof;
copy_v2_v2(&vpd->xof, vpd->vec);
copy_v2_v2(&vpd->xorig, &vpd->xof);
- vpd->event_type = event->type;
+ vpd->event_type= event->type;
WM_event_add_modal_handler(C, op);
}
@@ -402,14 +402,13 @@ void CLIP_OT_view_pan(wmOperatorType *ot)
/* identifiers */
ot->name = "View Pan";
ot->idname = "CLIP_OT_view_pan";
- ot->description = "Pan the view";
/* api callbacks */
ot->exec = view_pan_exec;
ot->invoke = view_pan_invoke;
ot->modal = view_pan_modal;
ot->cancel = view_pan_cancel;
- ot->poll = ED_space_clip_view_clip_poll;
+ ot->poll = ED_space_clip_poll;
/* flags */
ot->flag = OPTYPE_BLOCKING;
@@ -433,7 +432,7 @@ static void view_zoom_init(bContext *C, wmOperator *op, wmEvent *event)
SpaceClip *sc = CTX_wm_space_clip(C);
ViewZoomData *vpd;
- op->customdata = vpd = MEM_callocN(sizeof(ViewZoomData), "ClipViewZoomData");
+ op->customdata= vpd= MEM_callocN(sizeof(ViewZoomData), "ClipViewZoomData");
WM_cursor_modal(CTX_wm_window(C), BC_NSEW_SCROLLCURSOR);
vpd->x = event->x;
@@ -529,14 +528,13 @@ void CLIP_OT_view_zoom(wmOperatorType *ot)
/* identifiers */
ot->name = "View Zoom";
ot->idname = "CLIP_OT_view_zoom";
- ot->description = "Zoom on/out the view";
/* api callbacks */
ot->exec = view_zoom_exec;
ot->invoke = view_zoom_invoke;
ot->modal = view_zoom_modal;
ot->cancel = view_zoom_cancel;
- ot->poll = ED_space_clip_view_clip_poll;
+ ot->poll = ED_space_clip_poll;
/* flags */
ot->flag = OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER;
@@ -578,12 +576,11 @@ void CLIP_OT_view_zoom_in(wmOperatorType *ot)
/* identifiers */
ot->name = "View Zoom In";
ot->idname = "CLIP_OT_view_zoom_in";
- ot->description = "Zoom in the view";
/* api callbacks */
ot->exec = view_zoom_in_exec;
ot->invoke = view_zoom_in_invoke;
- ot->poll = ED_space_clip_view_clip_poll;
+ ot->poll = ED_space_clip_poll;
/* properties */
RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in screen coordinates", -10.0f, 10.0f);
@@ -619,12 +616,11 @@ void CLIP_OT_view_zoom_out(wmOperatorType *ot)
/* identifiers */
ot->name = "View Zoom Out";
ot->idname = "CLIP_OT_view_zoom_out";
- ot->description = "Zoom out the view";
/* api callbacks */
ot->exec = view_zoom_out_exec;
ot->invoke = view_zoom_out_invoke;
- ot->poll = ED_space_clip_view_clip_poll;
+ ot->poll = ED_space_clip_poll;
/* properties */
RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in normalised (0.0-1.0) coordinates", -10.0f, 10.0f);
@@ -640,8 +636,8 @@ static int view_zoom_ratio_exec(bContext *C, wmOperator *op)
sclip_zoom_set(sc, ar, RNA_float_get(op->ptr, "ratio"), NULL);
/* ensure pixel exact locations for draw */
- sc->xof = (int) sc->xof;
- sc->yof = (int) sc->yof;
+ sc->xof= (int) sc->xof;
+ sc->yof= (int) sc->yof;
ED_region_tag_redraw(CTX_wm_region(C));
@@ -653,11 +649,10 @@ void CLIP_OT_view_zoom_ratio(wmOperatorType *ot)
/* identifiers */
ot->name = "View Zoom Ratio";
ot->idname = "CLIP_OT_view_zoom_ratio";
- ot->description = "Set the zoom ratio (based on clip size)";
/* api callbacks */
ot->exec = view_zoom_ratio_exec;
- ot->poll = ED_space_clip_view_clip_poll;
+ ot->poll = ED_space_clip_poll;
/* properties */
RNA_def_float(ot->srna, "ratio", 0.0f, 0.0f, FLT_MAX,
@@ -672,7 +667,7 @@ static int view_all_exec(bContext *C, wmOperator *op)
ARegion *ar;
int w, h, width, height;
float aspx, aspy;
- int fit_view = RNA_boolean_get(op->ptr, "fit_view");
+ int fit_view= RNA_boolean_get(op->ptr, "fit_view");
float zoomx, zoomy;
/* retrieve state */
@@ -685,25 +680,25 @@ static int view_all_exec(bContext *C, wmOperator *op)
w = w * aspx;
h = h * aspy;
- /* check if the image will fit in the image with zoom == 1 */
+ /* check if the image will fit in the image with zoom==1 */
width = ar->winrct.xmax - ar->winrct.xmin + 1;
height = ar->winrct.ymax - ar->winrct.ymin + 1;
if (fit_view) {
const int margin = 5; /* margin from border */
- zoomx = (float) width / (w + 2 * margin);
- zoomy = (float) height / (h + 2 * margin);
+ zoomx= (float) width / (w + 2 * margin);
+ zoomy= (float) height / (h + 2 * margin);
sclip_zoom_set(sc, ar, MIN2(zoomx, zoomy), NULL);
}
else {
if ((w >= width || h >= height) && (width > 0 && height > 0)) {
- zoomx = (float) width / w;
- zoomy = (float) height / h;
+ zoomx= (float) width / w;
+ zoomy= (float) height / h;
/* find the zoom value that will fit the image in the image space */
- sclip_zoom_set(sc, ar, 1.0f / power_of_2(1.0f / MIN2(zoomx, zoomy)), NULL);
+ sclip_zoom_set(sc, ar, 1.0f/power_of_2(1/MIN2(zoomx, zoomy)), NULL);
}
else
sclip_zoom_set(sc, ar, 1.0f, NULL);
@@ -721,11 +716,10 @@ void CLIP_OT_view_all(wmOperatorType *ot)
/* identifiers */
ot->name = "View All";
ot->idname = "CLIP_OT_view_all";
- ot->description = "View whole image with markers";
/* api callbacks */
ot->exec = view_all_exec;
- ot->poll = ED_space_clip_view_clip_poll;
+ ot->poll = ED_space_clip_poll;
/* properties */
RNA_def_boolean(ot->srna, "fit_view", 0, "Fit View", "Fit frame to the viewport");
@@ -752,11 +746,10 @@ void CLIP_OT_view_selected(wmOperatorType *ot)
/* identifiers */
ot->name = "View Selected";
ot->idname = "CLIP_OT_view_selected";
- ot->description = "View all selected elements";
/* api callbacks */
ot->exec = view_selected_exec;
- ot->poll = ED_space_clip_view_clip_poll;
+ ot->poll = ED_space_clip_poll;
}
/********************** change frame operator *********************/
@@ -807,7 +800,7 @@ static int frame_from_event(bContext *C, wmEvent *event)
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
- framenr = (int) floor(viewx + 0.5f);
+ framenr= (int) floor(viewx + 0.5f);
}
return framenr;
@@ -885,7 +878,7 @@ typedef struct ProxyBuildJob {
static void proxy_freejob(void *pjv)
{
- ProxyJob *pj = pjv;
+ ProxyJob *pj= pjv;
MEM_freeN(pj);
}
@@ -964,7 +957,7 @@ static void proxy_startjob(void *pjv, short *stop, short *do_update, float *prog
break;
*do_update = TRUE;
- *progress = ((float) cfra) / (efra - sfra);
+ *progress= ((float) cfra) / (efra - sfra);
}
if (distortion)
diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c
index 2545106d132..c8ba8be7eae 100644
--- a/source/blender/editors/space_clip/clip_utils.c
+++ b/source/blender/editors/space_clip/clip_utils.c
@@ -174,7 +174,7 @@ void clip_delete_track(bContext *C, MovieClip *clip, ListBase *tracksbase, Movie
int has_bundle = FALSE, update_stab = FALSE;
- if (track == act_track)
+ if (track==act_track)
tracking->act_track = NULL;
if (track == stab->rot_track) {
@@ -194,11 +194,11 @@ void clip_delete_track(bContext *C, MovieClip *clip, ListBase *tracksbase, Movie
if (update_stab) {
tracking->stabilization.ok = FALSE;
+
+ DAG_id_tag_update(&clip->id, 0);
WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip);
}
- DAG_id_tag_update(&clip->id, 0);
-
if (has_bundle)
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, NULL);
}
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 1c0d2db91a9..4543876ffe5 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -984,11 +984,11 @@ static void movieclip_main_area_set_view2d(SpaceClip *sc, ARegion *ar)
ar->v2d.mask.ymax = winy;
/* which part of the image space do we see? */
- x1 = ar->winrct.xmin + (winx-sc->zoom * w) / 2.0f;
- y1 = ar->winrct.ymin + (winy-sc->zoom * h) / 2.0f;
+ x1= ar->winrct.xmin + (winx-sc->zoom * w) / 2.0f;
+ y1= ar->winrct.ymin + (winy-sc->zoom * h) / 2.0f;
- x1 -= sc->zoom * sc->xof;
- y1 -= sc->zoom * sc->yof;
+ x1-= sc->zoom * sc->xof;
+ y1-= sc->zoom * sc->yof;
/* relative display right */
ar->v2d.cur.xmin = (ar->winrct.xmin - (float)x1) / sc->zoom;
@@ -1129,15 +1129,11 @@ static void dopesheet_area_draw(const bContext *C, ARegion *ar)
{
Scene *scene = CTX_data_scene(C);
SpaceClip *sc = CTX_wm_space_clip(C);
- MovieClip *clip = ED_space_clip(sc);
View2D *v2d = &ar->v2d;
View2DGrid *grid;
View2DScrollers *scrollers;
short unit = 0;
- if (clip)
- BKE_tracking_dopesheet_update(&clip->tracking, sc->dope_sort, sc->dope_flag & SC_DOPE_SORT_INVERSE);
-
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
@@ -1157,7 +1153,7 @@ static void dopesheet_area_draw(const bContext *C, ARegion *ar)
UI_view2d_view_restore(C);
/* scrollers */
- scrollers = UI_view2d_scrollers_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
+ scrollers= UI_view2d_scrollers_calc(C, v2d, unit, V2D_GRID_CLAMP, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
UI_view2d_scrollers_draw(C, v2d, scrollers);
UI_view2d_scrollers_free(scrollers);
}
@@ -1190,14 +1186,9 @@ static void clip_channels_area_init(wmWindowManager *wm, ARegion *ar)
static void clip_channels_area_draw(const bContext *C, ARegion *ar)
{
- SpaceClip *sc = CTX_wm_space_clip(C);
- MovieClip *clip = ED_space_clip(sc);
View2D *v2d = &ar->v2d;
View2DScrollers *scrollers;
- if (clip)
- BKE_tracking_dopesheet_update(&clip->tracking, sc->dope_sort, sc->dope_flag & SC_DOPE_SORT_INVERSE);
-
/* clear and setup matrix */
UI_ThemeClearColor(TH_BACK);
glClear(GL_COLOR_BUFFER_BIT);
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 56f50d41a12..ea92366f0cb 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -95,6 +95,8 @@ static void add_marker(SpaceClip *sc, float x, float y)
BKE_tracking_select_track(tracksbase, track, TRACK_AREA_ALL, 0);
clip->tracking.act_track = track;
+
+ ED_space_clip_update_dopesheet(sc);
}
static int add_marker_exec(bContext *C, wmOperator *op)
@@ -174,6 +176,8 @@ static int delete_track_exec(bContext *C, wmOperator *UNUSED(op))
/* nothing selected now, unlock view so it can be scrolled nice again */
sc->flag &= ~SC_LOCK_SELECTION;
+ ED_space_clip_update_dopesheet(sc);
+
return OPERATOR_FINISHED;
}
@@ -225,6 +229,8 @@ static int delete_marker_exec(bContext *C, wmOperator *UNUSED(op))
sc->flag &= ~SC_LOCK_SELECTION;
}
+ ED_space_clip_update_dopesheet(sc);
+
return OPERATOR_FINISHED;
}
@@ -723,19 +729,19 @@ static MovieTrackingTrack *find_nearest_track(SpaceClip *sc, ListBase *tracksbas
while (cur) {
MovieTrackingMarker *marker = BKE_tracking_get_marker(cur, sc->user.framenr);
- if (((cur->flag & TRACK_HIDDEN) == 0) && MARKER_VISIBLE(sc, cur, marker)) {
+ if (((cur->flag & TRACK_HIDDEN) == 0) && MARKER_VISIBLE(sc, marker)) {
float dist, d1, d2 = FLT_MAX, d3 = FLT_MAX;
- d1 = sqrtf((co[0]-marker->pos[0]-cur->offset[0])*(co[0]-marker->pos[0]-cur->offset[0])+
+ d1= sqrtf((co[0]-marker->pos[0]-cur->offset[0])*(co[0]-marker->pos[0]-cur->offset[0])+
(co[1]-marker->pos[1]-cur->offset[1])*(co[1]-marker->pos[1]-cur->offset[1])); /* distance to marker point */
/* distance to pattern boundbox */
if (sc->flag & SC_SHOW_MARKER_PATTERN)
- d2 = dist_to_rect(co, marker->pos, cur->pat_min, cur->pat_max);
+ d2= dist_to_rect(co, marker->pos, cur->pat_min, cur->pat_max);
/* distance to search boundbox */
if (sc->flag & SC_SHOW_MARKER_SEARCH && TRACK_VIEW_SELECTED(sc, cur))
- d3 = dist_to_rect(co, marker->pos, cur->search_min, cur->search_max);
+ d3= dist_to_rect(co, marker->pos, cur->search_min, cur->search_max);
/* choose minimal distance. useful for cases of overlapped markers. */
dist = MIN3(d1, d2, d3);
@@ -789,9 +795,8 @@ static int mouse_select(bContext *C, float co[2], int extend)
sc->ylockof = 0.0f;
}
- BKE_tracking_dopesheet_tag_update(tracking);
-
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
+ ED_space_clip_update_dopesheet(sc);
return OPERATOR_FINISHED;
}
@@ -863,9 +868,8 @@ static int border_select_exec(bContext *C, wmOperator *op)
{
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip(sc);
- MovieTracking *tracking = &clip->tracking;
MovieTrackingTrack *track;
- ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
+ ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
rcti rect;
rctf rectf;
int change = FALSE, mode, extend;
@@ -888,7 +892,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
if ((track->flag & TRACK_HIDDEN) == 0) {
MovieTrackingMarker *marker = BKE_tracking_get_marker(track, sc->user.framenr);
- if (MARKER_VISIBLE(sc, track, marker)) {
+ if (MARKER_VISIBLE(sc, marker)) {
if (BLI_in_rctf(&rectf, marker->pos[0], marker->pos[1])) {
BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, mode!=GESTURE_MODAL_SELECT);
}
@@ -904,7 +908,7 @@ static int border_select_exec(bContext *C, wmOperator *op)
}
if (change) {
- BKE_tracking_dopesheet_tag_update(tracking);
+ ED_space_clip_update_dopesheet(sc);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
@@ -952,9 +956,8 @@ static int circle_select_exec(bContext *C, wmOperator *op)
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip(sc);
ARegion *ar = CTX_wm_region(C);
- MovieTracking *tracking = &clip->tracking;
MovieTrackingTrack *track;
- ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
+ ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
int x, y, radius, width, height, mode, change = FALSE;
float zoomx, zoomy, offset[2], ellipse[2];
@@ -980,7 +983,7 @@ static int circle_select_exec(bContext *C, wmOperator *op)
if ((track->flag & TRACK_HIDDEN) == 0) {
MovieTrackingMarker *marker = BKE_tracking_get_marker(track, sc->user.framenr);
- if (MARKER_VISIBLE(sc, track, marker) && marker_inside_ellipse(marker, offset, ellipse)) {
+ if (MARKER_VISIBLE(sc, marker) && marker_inside_ellipse(marker, offset, ellipse)) {
BKE_tracking_track_flag(track, TRACK_AREA_ALL, SELECT, mode!=GESTURE_MODAL_SELECT);
change = TRUE;
@@ -991,7 +994,7 @@ static int circle_select_exec(bContext *C, wmOperator *op)
}
if (change) {
- BKE_tracking_dopesheet_tag_update(tracking);
+ ED_space_clip_update_dopesheet(sc);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
@@ -1030,10 +1033,9 @@ static int select_all_exec(bContext *C, wmOperator *op)
{
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip(sc);
- MovieTracking *tracking = &clip->tracking;
MovieTrackingTrack *track = NULL; /* selected track */
MovieTrackingMarker *marker;
- ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
+ ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
int action = RNA_enum_get(op->ptr, "action");
int framenr = sc->user.framenr;
int has_selection = FALSE;
@@ -1045,7 +1047,7 @@ static int select_all_exec(bContext *C, wmOperator *op)
if (TRACK_VIEW_SELECTED(sc, track)) {
marker = BKE_tracking_get_marker(track, framenr);
- if (MARKER_VISIBLE(sc, track, marker)) {
+ if (MARKER_VISIBLE(sc, marker)) {
action = SEL_DESELECT;
break;
}
@@ -1060,7 +1062,7 @@ static int select_all_exec(bContext *C, wmOperator *op)
if ((track->flag & TRACK_HIDDEN)==0) {
marker = BKE_tracking_get_marker(track, framenr);
- if (MARKER_VISIBLE(sc, track, marker)) {
+ if (MARKER_VISIBLE(sc, marker)) {
switch (action) {
case SEL_SELECT:
track->flag |= SELECT;
@@ -1090,7 +1092,7 @@ static int select_all_exec(bContext *C, wmOperator *op)
if (!has_selection)
sc->flag &= ~SC_LOCK_SELECTION;
- BKE_tracking_dopesheet_tag_update(tracking);
+ ED_space_clip_update_dopesheet(sc);
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, NULL);
@@ -1172,7 +1174,7 @@ static int select_groped_exec(bContext *C, wmOperator *op)
track = track->next;
}
- BKE_tracking_dopesheet_tag_update(tracking);
+ ED_space_clip_update_dopesheet(sc);
WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, clip);
@@ -1553,7 +1555,7 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
static int track_markers_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
{
/* no running tracking, remove handler and pass through */
- if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
+ if (0==WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
return OPERATOR_FINISHED|OPERATOR_PASS_THROUGH;
/* running tracking */
@@ -2743,7 +2745,7 @@ static int hide_tracks_exec(bContext *C, wmOperator *op)
sc->flag &= ~SC_LOCK_SELECTION;
}
- BKE_tracking_dopesheet_tag_update(tracking);
+ BKE_tracking_update_dopesheet(tracking);
WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, NULL);
@@ -2774,8 +2776,7 @@ static int hide_tracks_clear_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip(sc);
- MovieTracking *tracking = &clip->tracking;
- ListBase *tracksbase = BKE_tracking_get_tracks(tracking);
+ ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
MovieTrackingTrack *track;
track = tracksbase->first;
@@ -2785,8 +2786,6 @@ static int hide_tracks_clear_exec(bContext *C, wmOperator *UNUSED(op))
track = track->next;
}
- BKE_tracking_dopesheet_tag_update(tracking);
-
WM_event_add_notifier(C, NC_MOVIECLIP|ND_DISPLAY, NULL);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 51741b8972a..e99d907b14f 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -334,7 +334,6 @@ void IMAGE_OT_view_pan(wmOperatorType *ot)
/* identifiers */
ot->name = "View Pan";
ot->idname = "IMAGE_OT_view_pan";
- ot->description = "Pan the view";
/* api callbacks */
ot->exec = image_view_pan_exec;
@@ -472,7 +471,6 @@ void IMAGE_OT_view_zoom(wmOperatorType *ot)
/* identifiers */
ot->name = "View Zoom";
ot->idname = "IMAGE_OT_view_zoom";
- ot->description = "Zoom in/out the image";
/* api callbacks */
ot->exec = image_view_zoom_exec;
@@ -541,7 +539,6 @@ void IMAGE_OT_view_ndof(wmOperatorType *ot)
/* identifiers */
ot->name = "NDOF Pan/Zoom";
ot->idname = "IMAGE_OT_view_ndof";
- ot->description = "Use a 3D mouse device to pan/zoom the view";
/* api callbacks */
ot->invoke = image_view_ndof_invoke;
@@ -595,7 +592,6 @@ void IMAGE_OT_view_all(wmOperatorType *ot)
/* identifiers */
ot->name = "View All";
ot->idname = "IMAGE_OT_view_all";
- ot->description = "View the whole picture";
/* api callbacks */
ot->exec = image_view_all_exec;
@@ -657,7 +653,6 @@ void IMAGE_OT_view_selected(wmOperatorType *ot)
/* identifiers */
ot->name = "View Center";
ot->idname = "IMAGE_OT_view_selected";
- ot->description = "View all selected UVs";
/* api callbacks */
ot->exec = image_view_selected_exec;
@@ -697,7 +692,6 @@ void IMAGE_OT_view_zoom_in(wmOperatorType *ot)
/* identifiers */
ot->name = "View Zoom In";
ot->idname = "IMAGE_OT_view_zoom_in";
- ot->description = "Zoom in the image (centered around 2D cursor)";
/* api callbacks */
ot->invoke = image_view_zoom_in_invoke;
@@ -739,7 +733,6 @@ void IMAGE_OT_view_zoom_out(wmOperatorType *ot)
/* identifiers */
ot->name = "View Zoom Out";
ot->idname = "IMAGE_OT_view_zoom_out";
- ot->description = "Zoom out the image (centered around 2D cursor)";
/* api callbacks */
ot->invoke = image_view_zoom_out_invoke;
@@ -782,7 +775,6 @@ void IMAGE_OT_view_zoom_ratio(wmOperatorType *ot)
/* identifiers */
ot->name = "View Zoom Ratio";
ot->idname = "IMAGE_OT_view_zoom_ratio";
- ot->description = "Set zoom ration of the view";
/* api callbacks */
ot->exec = image_view_zoom_ratio_exec;
@@ -986,7 +978,6 @@ void IMAGE_OT_replace(wmOperatorType *ot)
/* identifiers */
ot->name = "Replace Image";
ot->idname = "IMAGE_OT_replace";
- ot->description = "Replace current image by another one from disk";
/* api callbacks */
ot->exec = image_replace_exec;
@@ -1325,7 +1316,6 @@ void IMAGE_OT_save_as(wmOperatorType *ot)
/* identifiers */
ot->name = "Save As Image";
ot->idname = "IMAGE_OT_save_as";
- ot->description = "Save the image with another name and/or settings";
/* api callbacks */
ot->exec = image_save_as_exec;
@@ -1372,7 +1362,6 @@ void IMAGE_OT_save(wmOperatorType *ot)
/* identifiers */
ot->name = "Save Image";
ot->idname = "IMAGE_OT_save";
- ot->description = "Save the image with current name and settings";
/* api callbacks */
ot->exec = image_save_exec;
@@ -1450,7 +1439,6 @@ void IMAGE_OT_save_sequence(wmOperatorType *ot)
/* identifiers */
ot->name = "Save Sequence";
ot->idname = "IMAGE_OT_save_sequence";
- ot->description = "Save a sequence of images";
/* api callbacks */
ot->exec = image_save_sequence_exec;
@@ -1486,7 +1474,6 @@ void IMAGE_OT_reload(wmOperatorType *ot)
/* identifiers */
ot->name = "Reload Image";
ot->idname = "IMAGE_OT_reload";
- ot->description = "Reload current image from disk";
/* api callbacks */
ot->exec = image_reload_exec;
@@ -1659,7 +1646,6 @@ void IMAGE_OT_invert(wmOperatorType *ot)
/* identifiers */
ot->name = "Invert Channels";
ot->idname = "IMAGE_OT_invert";
- ot->description = "Invert image's channels";
/* api callbacks */
ot->exec = image_invert_exec;
@@ -2035,7 +2021,6 @@ void IMAGE_OT_sample(wmOperatorType *ot)
/* identifiers */
ot->name = "Sample Color";
ot->idname = "IMAGE_OT_sample";
- ot->description = "Use mouse to sample a color in current image";
/* api callbacks */
ot->invoke = image_sample_invoke;
@@ -2145,7 +2130,6 @@ void IMAGE_OT_sample_line(wmOperatorType *ot)
/* identifiers */
ot->name = "Sample Line";
ot->idname = "IMAGE_OT_sample_line";
- ot->description = "Sample a line and show it in Scope panels";
/* api callbacks */
ot->invoke = image_sample_line_invoke;
@@ -2173,7 +2157,6 @@ void IMAGE_OT_curves_point_set(wmOperatorType *ot)
/* identifiers */
ot->name = "Set Curves Point";
ot->idname = "IMAGE_OT_curves_point_set";
- ot->description = "Set black or white point for curves";
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -2379,7 +2362,6 @@ void IMAGE_OT_cycle_render_slot(wmOperatorType *ot)
/* identifiers */
ot->name = "Cycle Render Slot";
ot->idname = "IMAGE_OT_cycle_render_slot";
- ot->description = "Cycle through all non-void render slots";
/* api callbacks */
ot->exec = image_cycle_render_slot_exec;
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index 080f12bf35b..870a5724b49 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -107,7 +107,6 @@ void FILE_OT_pack_all(wmOperatorType *ot)
/* identifiers */
ot->name = "Pack All";
ot->idname = "FILE_OT_pack_all";
- ot->description = "Pack all used external files into the .blend";
/* api callbacks */
ot->exec = pack_all_exec;
@@ -176,7 +175,6 @@ void FILE_OT_unpack_all(wmOperatorType *ot)
/* identifiers */
ot->name = "Unpack All";
ot->idname = "FILE_OT_unpack_all";
- ot->description = "Unpack all files packed into this .blend to external ones";
/* api callbacks */
ot->exec = unpack_all_exec;
@@ -213,7 +211,6 @@ void FILE_OT_make_paths_relative(wmOperatorType *ot)
/* identifiers */
ot->name = "Make All Paths Relative";
ot->idname = "FILE_OT_make_paths_relative";
- ot->description = "Make all paths to external files relative to current .blend";
/* api callbacks */
ot->exec = make_paths_relative_exec;
@@ -246,7 +243,6 @@ void FILE_OT_make_paths_absolute(wmOperatorType *ot)
/* identifiers */
ot->name = "Make All Paths Absolute";
ot->idname = "FILE_OT_make_paths_absolute";
- ot->description = "Make all paths to external files absolute";
/* api callbacks */
ot->exec = make_paths_absolute_exec;
@@ -272,7 +268,6 @@ void FILE_OT_report_missing_files(wmOperatorType *ot)
/* identifiers */
ot->name = "Report Missing Files";
ot->idname = "FILE_OT_report_missing_files";
- ot->description = "Report all missing external files";
/* api callbacks */
ot->exec = report_missing_files_exec;
@@ -305,7 +300,6 @@ void FILE_OT_find_missing_files(wmOperatorType *ot)
/* identifiers */
ot->name = "Find Missing Files";
ot->idname = "FILE_OT_find_missing_files";
- ot->description = "Try to find missing external files";
/* api callbacks */
ot->exec = find_missing_files_exec;
@@ -420,7 +414,6 @@ void INFO_OT_reports_display_update(wmOperatorType *ot)
/* identifiers */
ot->name = "Update Reports Display";
ot->idname = "INFO_OT_reports_display_update";
- ot->description = "Update the display of reports in Blender UI (internal use)";
/* api callbacks */
ot->invoke = update_reports_display_invoke;
diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c
index 9e59b3372cb..1173d04bf85 100644
--- a/source/blender/editors/space_node/node_edit.c
+++ b/source/blender/editors/space_node/node_edit.c
@@ -2341,6 +2341,9 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
case MOUSEMOVE:
if (in_out==SOCK_OUT) {
+ /* only target socket becomes hilighted */
+ node_deselect_all_input_sockets(snode, 0);
+
if (node_find_indicated_socket(snode, &tnode, &tsock, SOCK_IN)) {
if (nodeFindLink(snode->edittree, sock, tsock)==NULL) {
if ( link->tosock!= tsock && (!tnode || (tnode!=node && link->tonode!=tnode)) ) {
@@ -2354,6 +2357,9 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
ntreeUpdateTree(snode->edittree);
}
}
+
+ /* hilight target socket */
+ node_socket_select(tnode, tsock);
}
else {
if (link->tonode || link->tosock) {
@@ -2368,6 +2374,9 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
}
}
else {
+ /* only target socket becomes hilighted */
+ node_deselect_all_output_sockets(snode, 0);
+
if (node_find_indicated_socket(snode, &tnode, &tsock, SOCK_OUT)) {
if (nodeFindLink(snode->edittree, sock, tsock)==NULL) {
if (nodeCountSocketLinks(snode->edittree, tsock) < tsock->limit) {
@@ -2383,6 +2392,9 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
}
}
}
+
+ /* hilight target socket */
+ node_socket_select(tnode, tsock);
}
else {
if (link->tonode || link->tosock) {
@@ -2410,6 +2422,10 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
if (in_out==SOCK_OUT)
node_remove_extra_links(snode, link->tosock, link);
+ /* deselect sockets after successful linking */
+ node_deselect_all_input_sockets(snode, 0);
+ node_deselect_all_output_sockets(snode, 0);
+
/* when linking to group outputs, update the socket type */
/* XXX this should all be part of a generic update system */
if (!link->tonode) {
@@ -2435,6 +2451,10 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
}
snode->edittree->update |= NTREE_UPDATE_GROUP_OUT | NTREE_UPDATE_LINKS;
}
+
+ /* deselect sockets after successful linking */
+ node_deselect_all_input_sockets(snode, 0);
+ node_deselect_all_output_sockets(snode, 0);
}
else
nodeRemLink(snode->edittree, link);
@@ -2475,6 +2495,10 @@ static int node_link_init(SpaceNode *snode, bNodeLinkDrag *nldrag)
in_out = SOCK_IN;
}
}
+
+ /* hilight source socket only */
+ node_deselect_all_output_sockets(snode, 0);
+ node_socket_select(nldrag->node, nldrag->sock);
}
/* or an input? */
else if (node_find_indicated_socket(snode, &nldrag->node, &nldrag->sock, SOCK_IN)) {
@@ -2497,6 +2521,10 @@ static int node_link_init(SpaceNode *snode, bNodeLinkDrag *nldrag)
in_out = SOCK_OUT;
}
}
+
+ /* hilight source socket only */
+ node_deselect_all_input_sockets(snode, 0);
+ node_socket_select(nldrag->node, nldrag->sock);
}
return in_out;
@@ -3709,8 +3737,7 @@ void NODE_OT_output_file_move_active_socket(wmOperatorType *ot)
{
static EnumPropertyItem direction_items[] = {
{1, "UP", 0, "Up", ""},
- {2, "DOWN", 0, "Down", ""},
- { 0, NULL, 0, NULL, NULL }};
+ {2, "DOWN", 0, "Down", ""}};
/* identifiers */
ot->name = "Move File Node Socket";
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 85eda858d24..032cc4ecbf2 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -44,7 +44,6 @@
#include "BKE_context.h"
#include "BKE_screen.h"
-#include "BKE_text.h"
#include "ED_space_api.h"
#include "ED_screen.h"
@@ -203,8 +202,6 @@ static void text_operatortypes(void)
WM_operatortype_append(TEXT_OT_select_line);
WM_operatortype_append(TEXT_OT_select_all);
WM_operatortype_append(TEXT_OT_select_word);
-
- WM_operatortype_append(TEXT_OT_move_lines);
WM_operatortype_append(TEXT_OT_jump);
WM_operatortype_append(TEXT_OT_move);
@@ -323,10 +320,8 @@ static void text_keymap(struct wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "TEXT_OT_select_all", AKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "TEXT_OT_select_line", AKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
WM_keymap_add_item(keymap, "TEXT_OT_select_word", LEFTMOUSE, KM_DBL_CLICK, 0, 0);
-
- RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_lines", UPARROWKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0)->ptr, "direction", TXT_MOVE_LINE_UP);
- RNA_enum_set(WM_keymap_add_item(keymap, "TEXT_OT_move_lines", DOWNARROWKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0)->ptr, "direction", TXT_MOVE_LINE_DOWN);
+
WM_keymap_add_item(keymap, "TEXT_OT_indent", TABKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "TEXT_OT_unindent", TABKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "TEXT_OT_uncomment", DKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0);
diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h
index 4f973e7076b..07d2dffb95b 100644
--- a/source/blender/editors/space_text/text_intern.h
+++ b/source/blender/editors/space_text/text_intern.h
@@ -137,8 +137,6 @@ void TEXT_OT_select_line(struct wmOperatorType *ot);
void TEXT_OT_select_all(struct wmOperatorType *ot);
void TEXT_OT_select_word(struct wmOperatorType *ot);
-void TEXT_OT_move_lines(struct wmOperatorType *ot);
-
void TEXT_OT_jump(struct wmOperatorType *ot);
void TEXT_OT_move(struct wmOperatorType *ot);
void TEXT_OT_move_select(struct wmOperatorType *ot);
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index 2211b1ddb62..a03b6cca8df 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -1297,7 +1297,7 @@ static void draw_bone(int dt, int armflag, int boneflag, short constflag, unsign
{
/* Draw a 3d octahedral bone, we use normalized space based on length,
- * for display-lists */
+ * for glDisplayLists */
glScalef(length, length, length);
@@ -1996,7 +1996,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
/* finally names and axes */
if ((arm->flag & (ARM_DRAWNAMES | ARM_DRAWAXES)) && (is_outline == 0)) {
- /* patch for several 3d cards (IBM mostly) that crash on GL_SELECT with text drawing */
+ /* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */
if ((G.f & G_PICKSEL) == 0) {
float vec[3];
@@ -2208,7 +2208,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt)
/* finally names and axes */
if (arm->flag & (ARM_DRAWNAMES | ARM_DRAWAXES)) {
- // patch for several 3d cards (IBM mostly) that crash on GL_SELECT with text drawing
+ // patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing
if ((G.f & G_PICKSEL) == 0) {
float vec[3];
unsigned char col[4];
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index b27ca604810..79470e22c93 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -387,7 +387,7 @@ static void draw_textured_end(void)
glDisable(GL_CULL_FACE);
/* XXX, bad patch - GPU_default_lights() calls
- * glLightfv(GL_POSITION, ...) which
+ * glLightfv(GL_LIGHT_POSITION, ...) which
* is transformed by the current matrix... we
* need to make sure that matrix is identity.
*
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index b1f86fa5e69..5186844f402 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -2902,10 +2902,9 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
#define DRAW_EM_MEASURE_STATS_FACEAREA() \
if (BM_elem_flag_test(f, BM_ELEM_SELECT)) { \
- mul_v3_fl(vmid, 1.0f / (float)n); \
+ mul_v3_fl(vmid, 1.0 / n); \
if (unit->system) \
- bUnit_AsString(numstr, sizeof(numstr), \
- (double)(area * unit->scale_length), \
+ bUnit_AsString(numstr, sizeof(numstr), area * unit->scale_length, \
3, unit->system, B_UNIT_LENGTH, do_split, FALSE); \
else \
BLI_snprintf(numstr, sizeof(numstr), conv_float, area); \
@@ -6991,7 +6990,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
drawtexspace(ob);
}
if (dtx & OB_DRAWNAME) {
- /* patch for several 3d cards (IBM mostly) that crash on GL_SELECT with text drawing */
+ /* patch for several 3d cards (IBM mostly) that crash on glSelect with text drawing */
/* but, we also don't draw names for sets or duplicators */
if (flag == 0) {
float zero[3] = {0, 0, 0};
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index dd90ef57307..0a890230ca7 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -313,15 +313,15 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
double scalar = bUnit_GetScaler(usys, i);
dx_scalar = dx * scalar / unit->scale_length;
- if (dx_scalar < (GRID_MIN_PX * 2.0))
+ if (dx_scalar < (GRID_MIN_PX * 2))
continue;
/* Store the smallest drawn grid size units name so users know how big each grid cell is */
if (*grid_unit == NULL) {
*grid_unit = bUnit_GetNameDisplay(usys, i);
- rv3d->gridview = (float)((scalar * v3d->grid) / (double)unit->scale_length);
+ rv3d->gridview = (scalar * v3d->grid) / unit->scale_length;
}
- blend_fac = 1.0f - ((GRID_MIN_PX * 2.0f) / (float)dx_scalar);
+ blend_fac = 1 - ((GRID_MIN_PX * 2) / dx_scalar);
/* tweak to have the fade a bit nicer */
blend_fac = (blend_fac * blend_fac) * 2.0f;
@@ -355,7 +355,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
}
}
else { // start blending out
- UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX * 6.0f));
+ UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX * 6));
drawgrid_draw(ar, wx, wy, x, y, dx);
UI_ThemeColor(TH_GRID);
@@ -363,7 +363,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
}
}
else { // start blending out (GRID_MIN_PX < dx < (GRID_MIN_PX*10))
- UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX * 6.0f));
+ UI_ThemeColorBlend(TH_BACK, TH_GRID, dx / (GRID_MIN_PX * 6));
drawgrid_draw(ar, wx, wy, x, y, dx);
UI_ThemeColor(TH_GRID);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 3e8ac58df8e..62f38281871 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -76,7 +76,6 @@
#include "ED_transform.h"
#include "ED_mesh.h"
#include "ED_view3d.h"
-#include "ED_sculpt.h"
#include "PIL_time.h" /* smoothview */
@@ -699,7 +698,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y)
if (dot_v3v3(xaxis, m_inv[0]) < 0) {
negate_v3(xaxis);
}
- fac = angle_normalized_v3v3(zvec_global, m_inv[2]) / (float)M_PI;
+ fac = angle_normalized_v3v3(zvec_global, m_inv[2]) / M_PI;
fac = fabsf(fac - 0.5f) * 2;
fac = fac * fac;
interp_v3_v3v3(xaxis, xaxis, m_inv[0], fac);
@@ -2203,10 +2202,6 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT)) {
ok = PE_minmax(scene, min, max);
}
- else if (ob && (ob->mode & OB_MODE_SCULPT)) {
- ok = ED_sculpt_minmax(C, min, max);
- ok_dist = 0; /* don't zoom */
- }
else {
Base *base;
for (base = FIRSTBASE; base; base = base->next) {
@@ -2230,24 +2225,18 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
sub_v3_v3v3(afm, max, min);
size = MAX3(afm[0], afm[1], afm[2]);
- if (ok_dist) {
- /* fix up zoom distance if needed */
-
- if (rv3d->is_persp) {
- if (size <= v3d->near * 1.5f) {
- /* do not zoom closer than the near clipping plane */
- size = v3d->near * 1.5f;
- }
+ if (!rv3d->is_persp) {
+ if (size < 0.0001f) { /* if its a sinble point. don't even re-scale */
+ ok_dist = 0;
}
- else /* ortho */ {
- if (size < 0.0001f) {
- /* bounding box was a single point so do not zoom */
- ok_dist = 0;
- }
- else {
- /* adjust zoom so it looks nicer */
- size *= 0.7f;
- }
+ else {
+ /* perspective should be a bit farther away to look nice */
+ size *= 0.7f;
+ }
+ }
+ else {
+ if (size <= v3d->near * 1.5f) {
+ size = v3d->near * 1.5f;
}
}
@@ -2265,7 +2254,7 @@ static int viewselected_exec(bContext *C, wmOperator *UNUSED(op))
if (rv3d->persp == RV3D_CAMOB && !ED_view3d_camera_lock_check(v3d, rv3d)) {
rv3d->persp = RV3D_PERSP;
- smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, ok_dist ? &new_dist : NULL, NULL);
+ smooth_view(C, v3d, ar, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
}
else {
smooth_view(C, v3d, ar, NULL, NULL, new_ofs, NULL, ok_dist ? &new_dist : NULL, NULL);
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 44f7dd0b871..447a65ced87 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -2199,7 +2199,7 @@ static void mesh_circle_select(ViewContext *vc, int select, const int mval[2], f
int bbsel;
CircleSelectUserData data;
- bbsel = EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f));
+ bbsel = EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0));
ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); /* for foreach's screen/vert projection */
vc->em = BMEdit_FromObject(vc->obedit);
@@ -2250,7 +2250,7 @@ static void paint_facesel_circle_select(ViewContext *vc, int select, const int m
if (me) {
bm_vertoffs = me->totpoly + 1; /* max index array */
- /* bbsel= */ /* UNUSED */ EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0f));
+ /* bbsel= */ /* UNUSED */ EDBM_backbuf_circle_init(vc, mval[0], mval[1], (short)(rad + 1.0));
edbm_backbuf_check_and_select_tfaces(me, select == LEFTMOUSE);
EDBM_backbuf_free();
}
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index ae7d02e1cfb..81791721015 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -4387,7 +4387,7 @@ static int createSlideVerts(TransInfo *t)
BMVert *v, *v2, *first;
BMLoop *l, *l1, *l2;
TransDataSlideVert *sv_array;
- BMBVHTree *btree = BMBVH_NewBVH(em, BMBVH_RESPECT_HIDDEN, NULL, NULL);
+ BMBVHTree *btree = BMBVH_NewBVH(em, 0, NULL, NULL);
SmallHash table;
SlideData *sld = MEM_callocN(sizeof(*sld), "sld");
View3D *v3d = t->sa ? t->sa->spacedata.first : NULL;
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 3cd41edacf5..9ab1b90ed2e 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -3694,9 +3694,9 @@ void flushTransGraphData(TransInfo *t)
switch (sipo->autosnap) {
case SACTSNAP_FRAME: /* snap to nearest frame (or second if drawing seconds) */
if (sipo->flag & SIPO_DRAWTIME)
- td2d->loc[0] = (float)(floorf((td2d->loc[0]/secf) + 0.5f) * secf);
+ td2d->loc[0]= (float)(floor((td2d->loc[0]/secf) + 0.5f) * secf);
else
- td2d->loc[0] = (float)(floorf(td2d->loc[0]+0.5f));
+ td2d->loc[0]= (float)(floor(td2d->loc[0]+0.5f));
break;
case SACTSNAP_MARKER: /* snap to nearest marker */
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index b986bda4c13..a528bf7e47f 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -204,16 +204,16 @@ static void clipMirrorModifier(TransInfo *t, Object *ob)
}
if (axis & 2) {
- if (fabsf(iloc[1]) <= tolerance[1] ||
- loc[1] * iloc[1]<0.0f)
+ if (fabs(iloc[1])<=tolerance[1] ||
+ loc[1]*iloc[1]<0.0f)
{
loc[1]= 0.0f;
clip = 1;
}
}
if (axis & 4) {
- if (fabsf(iloc[2]) <= tolerance[2] ||
- loc[2] * iloc[2] < 0.0f)
+ if (fabs(iloc[2])<=tolerance[2] ||
+ loc[2]*iloc[2]<0.0f)
{
loc[2]= 0.0f;
clip = 1;
@@ -541,12 +541,12 @@ static void recalcData_nla(TransInfo *t)
switch (snla->autosnap) {
case SACTSNAP_FRAME: /* snap to nearest frame/time */
if (snla->flag & SNLA_DRAWTIME) {
- tdn->h1[0] = (float)(floor(((double)tdn->h1[0] / secf) + 0.5) * secf);
- tdn->h2[0] = (float)(floor(((double)tdn->h2[0] / secf) + 0.5) * secf);
+ tdn->h1[0]= (float)( floor((tdn->h1[0]/secf) + 0.5f) * secf );
+ tdn->h2[0]= (float)( floor((tdn->h2[0]/secf) + 0.5f) * secf );
}
else {
- tdn->h1[0] = floorf(tdn->h1[0] + 0.5f);
- tdn->h2[0] = floorf(tdn->h2[0] + 0.5f);
+ tdn->h1[0]= (float)( floor(tdn->h1[0]+0.5f) );
+ tdn->h2[0]= (float)( floor(tdn->h2[0]+0.5f) );
}
break;
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index 0f0d1cc8344..467e3dc600e 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -199,17 +199,17 @@ static void InputCustomRatio(TransInfo *UNUSED(t), MouseInput *mi, const int mva
mdx = (mi->precision_mval[0] + (float)(mval[0] - mi->precision_mval[0]) / 10.0f) - data[2];
mdy = (mi->precision_mval[1] + (float)(mval[1] - mi->precision_mval[1]) / 10.0f) - data[3];
- distance = (length != 0.0) ? (mdx * dx + mdy * dy) / length: 0.0;
+ distance = (length != 0.0f)? (mdx*dx + mdy*dy) / length: 0.0f;
}
else {
int mdx, mdy;
mdx = mval[0] - data[2];
mdy = mval[1] - data[3];
- distance = (length != 0.0) ? (mdx * dx + mdy * dy) / length: 0.0;
+ distance = (length != 0.0f)? (mdx*dx + mdy*dy) / length: 0.0f;
}
- output[0] = (length != 0.0) ? (double)(distance / length) : 0.0f;
+ output[0] = (float)((length != 0.0f)? distance / length: 0.0f);
}
}
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index a90f8253654..fb7e2254e45 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -855,7 +855,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
glDisable(GL_BLEND);
/* draw vert preview */
- glPointSize(pointsize * 2.0f);
+ glPointSize(pointsize * 2.0);
UI_ThemeColor4(TH_STITCH_PREVIEW_STITCHABLE);
glVertexPointer(2, GL_FLOAT, 0, stitch_preview->preview_stitchable);
glDrawArrays(GL_POINTS, 0, stitch_preview->num_stitchable);
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 53bf19c04cc..b275ce64cbd 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -799,9 +799,9 @@ void uv_find_nearest_vert(Scene *scene, Image *ima, BMEditMesh *em,
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
if (penalty && uvedit_uv_select_test(em, scene, l))
- dist = fabsf(co[0] - luv->uv[0]) + penalty[0] + fabsf(co[1] - luv->uv[1]) + penalty[1];
+ dist = fabs(co[0] - luv->uv[0]) + penalty[0] + fabs(co[1] - luv->uv[1]) + penalty[1];
else
- dist = fabsf(co[0] - luv->uv[0]) + fabsf(co[1] - luv->uv[1]);
+ dist = fabs(co[0] - luv->uv[0]) + fabs(co[1] - luv->uv[1]);
if (dist <= mindist) {
if (dist == mindist)
diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c
index b30821dc56a..183f75c6b42 100644
--- a/source/blender/editors/uvedit/uvedit_smart_stitch.c
+++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c
@@ -257,8 +257,8 @@ static void stitch_uv_rotate(float rotation, float medianPoint[2], float uv[2])
uv[0] -= medianPoint[0];
uv[1] -= medianPoint[1];
- uv_rotation_result[0] = cosf(rotation) * uv[0] - sinf(rotation) * uv[1];
- uv_rotation_result[1] = sinf(rotation) * uv[0] + cosf(rotation) * uv[1];
+ uv_rotation_result[0] = cos(rotation) * uv[0] - sin(rotation) * uv[1];
+ uv_rotation_result[1] = sin(rotation) * uv[0] + cos(rotation) * uv[1];
uv[0] = uv_rotation_result[0] + medianPoint[0];
uv[1] = uv_rotation_result[1] + medianPoint[1];
@@ -286,8 +286,8 @@ static int stitch_check_uvs_stitchable(UvElement *element, UvElement *element_it
l_iter = element_iter->l;
luv_iter = CustomData_bmesh_get(&state->em->bm->ldata, l_iter->head.data, CD_MLOOPUV);
- if (fabsf(luv_orig->uv[0] - luv_iter->uv[0]) < limit &&
- fabsf(luv_orig->uv[1] - luv_iter->uv[1]) < limit)
+ if (fabs(luv_orig->uv[0] - luv_iter->uv[0]) < limit &&
+ fabs(luv_orig->uv[1] - luv_iter->uv[1]) < limit)
{
return 1;
}
@@ -403,7 +403,7 @@ static void stitch_island_calculate_edge_rotation(UvEdge *edge, StitchState *sta
edgecos = uv1[0] * uv2[0] + uv1[1] * uv2[1];
edgesin = uv1[0] * uv2[1] - uv2[0] * uv1[1];
- rotation = (edgesin > 0.0f) ? acosf(MAX2(-1.0f, MIN2(1.0f, edgecos))) : -acosf(MAX2(-1.0f, MIN2(1.0f, edgecos)));
+ rotation = (edgesin > 0) ? acos(MAX2(-1.0, MIN2(1.0, edgecos))) : -acos(MAX2(-1.0, MIN2(1.0, edgecos)));
island_stitch_data[element1->island].num_rot_elements++;
island_stitch_data[element1->island].rotation += rotation;
@@ -412,7 +412,7 @@ static void stitch_island_calculate_edge_rotation(UvEdge *edge, StitchState *sta
static void stitch_island_calculate_vert_rotation(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data)
{
- float edgecos = 1.0f, edgesin = 0.0f;
+ float edgecos = 1, edgesin = 0;
int index;
UvElement *element_iter;
float rotation = 0;
@@ -441,12 +441,12 @@ static void stitch_island_calculate_vert_rotation(UvElement *element, StitchStat
negate_v2_v2(normal, state->normals + index_tmp2 * 2);
edgecos = dot_v2v2(normal, state->normals + index_tmp1 * 2);
edgesin = cross_v2v2(normal, state->normals + index_tmp1 * 2);
- rotation += (edgesin > 0.0f) ? acosf(edgecos) : -acosf(edgecos);
+ rotation += (edgesin > 0) ? acos(edgecos) : -acos(edgecos);
}
}
if (state->midpoints)
- rotation /= 2.0f;
+ rotation /= 2.0;
island_stitch_data[element->island].num_rot_elements++;
island_stitch_data[element->island].rotation += rotation;
}
@@ -1179,13 +1179,13 @@ static int stitch_init(bContext *C, wmOperator *op)
}
else {
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
- BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, i) {
+ i = 0;
+ BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if (uvedit_uv_select_test(em, scene, l)) {
UvElement *element = ED_uv_element_get(state->element_map, efa, l);
- if (element) {
- stitch_select_uv(element, state, 1);
- }
+ stitch_select_uv(element, state, 1);
}
+ i++;
}
}
}
@@ -1364,7 +1364,7 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
case PADPLUSKEY:
case WHEELUPMOUSE:
if (event->alt) {
- stitch_state->limit_dist += 0.01f;
+ stitch_state->limit_dist += 0.01;
if (!stitch_process_data(stitch_state, scene, 0)) {
return stitch_cancel(C, op);
}
@@ -1377,8 +1377,8 @@ static int stitch_modal(bContext *C, wmOperator *op, wmEvent *event)
case PADMINUS:
case WHEELDOWNMOUSE:
if (event->alt) {
- stitch_state->limit_dist -= 0.01f;
- stitch_state->limit_dist = MAX2(0.01f, stitch_state->limit_dist);
+ stitch_state->limit_dist -= 0.01;
+ stitch_state->limit_dist = MAX2(0.01, stitch_state->limit_dist);
if (!stitch_process_data(stitch_state, scene, 0)) {
return stitch_cancel(C, op);
}
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index f9db8b5423b..f38c33fa750 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -1027,7 +1027,7 @@ static void correct_uv_aspect(BMEditMesh *em)
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- luv->uv[0] = ((luv->uv[0] - 0.5f) * scale) + 0.5f;
+ luv->uv[0] = ((luv->uv[0] - 0.5) * scale) + 0.5;
}
}
}
@@ -1040,7 +1040,7 @@ static void correct_uv_aspect(BMEditMesh *em)
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- luv->uv[1] = ((luv->uv[1] - 0.5f) * scale) + 0.5f;
+ luv->uv[1] = ((luv->uv[1] - 0.5) * scale) + 0.5;
}
}
}
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index ebfedea3968..fdd964d0727 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -1087,7 +1087,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
GMS.gob = ob;
GMS.gscene = scene;
GMS.totmat= ob->totcol+1; /* materials start from 1, default material is 0 */
- GMS.glay= (v3d->localvd)? v3d->localvd->lay: v3d->lay; /* keep lamps visible in local view */
+ GMS.glay= v3d->lay;
GMS.gviewmat= rv3d->viewmat;
GMS.gviewinv= rv3d->viewinv;
@@ -1304,7 +1304,7 @@ void GPU_end_object_materials(void)
GMS.gmatbuf= NULL;
GMS.alphablend= NULL;
- /* resetting the texture matrix after the scaling needed for tiled textures */
+ /* resetting the texture matrix after the glScale needed for tiled textures */
if (GTS.tilemode) {
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
diff --git a/source/blender/imbuf/intern/moviecache.c b/source/blender/imbuf/intern/moviecache.c
index 485f593a8fb..8b18be87b3c 100644
--- a/source/blender/imbuf/intern/moviecache.c
+++ b/source/blender/imbuf/intern/moviecache.c
@@ -44,7 +44,7 @@
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
-static MEM_CacheLimiterC *limitor = NULL;
+static MEM_CacheLimiterC *limitor= NULL;
typedef struct MovieCache {
GHash *hash;
@@ -113,7 +113,7 @@ static void check_unused_keys(MovieCache *cache)
{
GHashIterator *iter;
- iter = BLI_ghashIterator_new(cache->hash);
+ iter= BLI_ghashIterator_new(cache->hash);
while (!BLI_ghashIterator_isDone(iter)) {
MovieCacheKey *key = BLI_ghashIterator_getKey(iter);
MovieCacheItem *item = BLI_ghashIterator_getValue(iter);
@@ -253,7 +253,7 @@ void IMB_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf)
if (cache->points) {
MEM_freeN(cache->points);
- cache->points = NULL;
+ cache->points= NULL;
}
}
@@ -321,7 +321,7 @@ void IMB_moviecache_get_cache_segments(MovieCache *cache, int proxy, int render_
GHashIterator *iter;
iter = BLI_ghashIterator_new(cache->hash);
- a = 0;
+ a= 0;
while (!BLI_ghashIterator_isDone(iter)) {
MovieCacheKey *key = BLI_ghashIterator_getKey(iter);
MovieCacheItem *item = BLI_ghashIterator_getValue(iter);
diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c
index a9396a5824d..2fd259d2816 100644
--- a/source/blender/imbuf/intern/tiff.c
+++ b/source/blender/imbuf/intern/tiff.c
@@ -317,8 +317,8 @@ static void scanline_contig_16bit(float *rectf, unsigned short *sbuf, int scanli
int i;
for (i=0; i < scanline_w; i++) {
rectf[i*4 + 0] = sbuf[i*spp + 0] / 65535.0;
- rectf[i*4 + 1] = (spp>=3)? sbuf[i*spp + 1] / 65535.0: sbuf[i*spp + 0] / 65535.0;
- rectf[i*4 + 2] = (spp>=3)? sbuf[i*spp + 2] / 65535.0: sbuf[i*spp + 0] / 65535.0;
+ rectf[i*4 + 1] = sbuf[i*spp + 1] / 65535.0;
+ rectf[i*4 + 2] = sbuf[i*spp + 2] / 65535.0;
rectf[i*4 + 3] = (spp==4)?(sbuf[i*spp + 3] / 65535.0):1.0;
}
}
@@ -328,8 +328,8 @@ static void scanline_contig_32bit(float *rectf, float *fbuf, int scanline_w, int
int i;
for (i=0; i < scanline_w; i++) {
rectf[i*4 + 0] = fbuf[i*spp + 0];
- rectf[i*4 + 1] = (spp>=3)? fbuf[i*spp + 1]: fbuf[i*spp + 0];
- rectf[i*4 + 2] = (spp>=3)? fbuf[i*spp + 2]: fbuf[i*spp + 0];
+ rectf[i*4 + 1] = fbuf[i*spp + 1];
+ rectf[i*4 + 2] = fbuf[i*spp + 2];
rectf[i*4 + 3] = (spp==4)?fbuf[i*spp + 3]:1.0f;
}
}
@@ -437,8 +437,6 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul)
if (bitspersample == 32) {
if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */
fill_vn_fl(fbuf, ibuf->x, 1.0f);
- else if (chan >= spp) /* for grayscale, duplicate first channel into G and B */
- success |= TIFFReadScanline(image, fbuf, row, 0);
else
success |= TIFFReadScanline(image, fbuf, row, chan);
scanline_separate_32bit(tmpibuf->rect_float+ib_offset, fbuf, ibuf->x, chan);
@@ -447,8 +445,6 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul)
else if (bitspersample == 16) {
if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */
fill_vn_ushort(sbuf, ibuf->x, 65535);
- else if (chan >= spp) /* for grayscale, duplicate first channel into G and B */
- success |= TIFFReadScanline(image, fbuf, row, 0);
else
success |= TIFFReadScanline(image, sbuf, row, chan);
scanline_separate_16bit(tmpibuf->rect_float+ib_offset, sbuf, ibuf->x, chan);
@@ -778,17 +774,22 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
if (pixels16) {
/* convert from float source */
- float rgb[4];
+ float rgb[3];
if (ibuf->profile == IB_PROFILE_LINEAR_RGB)
linearrgb_to_srgb_v3_v3(rgb, &fromf[from_i]);
else
copy_v3_v3(rgb, &fromf[from_i]);
- rgb[3] = fromf[from_i+3];
-
- for (i = 0; i < samplesperpixel; i++, to_i++)
- to16[to_i] = FTOUSHORT(rgb[i]);
+ to16[to_i+0] = FTOUSHORT(rgb[0]);
+ to16[to_i+1] = FTOUSHORT(rgb[1]);
+ to16[to_i+2] = FTOUSHORT(rgb[2]);
+ to_i += 3; from_i+=3;
+
+ if (samplesperpixel == 4) {
+ to16[to_i+3] = FTOUSHORT(fromf[from_i+3]);
+ /*to_i++; from_i++;*/ /*unused, set on each loop */
+ }
}
else {
for (i = 0; i < samplesperpixel; i++, to_i++, from_i++)
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 06eefc36723..1737f3b79e6 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -133,8 +133,9 @@ typedef struct Library {
* some cases its useful to access the absolute one,
* This is set on file read.
* Use BKE_library_filepath_set() rather than
- * setting 'name' directly and it will be kept in
+ * setting 'name' directly and it will be kepk in
* sync - campbell */
+ int tot, pad; /* tot, idblock and filedata are only fo read and write */
struct Library *parent; /* set for indirectly linked libs, used in the outliner and while reading */
} Library;
@@ -150,7 +151,7 @@ typedef struct PreviewImage {
unsigned int h[2];
short changed[2];
short changed_timestamp[2];
- unsigned int *rect[2];
+ unsigned int * rect[2];
} PreviewImage;
/**
@@ -254,3 +255,4 @@ typedef struct PreviewImage {
#endif
#endif
+
diff --git a/source/blender/makesdna/DNA_camera_types.h b/source/blender/makesdna/DNA_camera_types.h
index 73cebfb3d9f..112247f3d66 100644
--- a/source/blender/makesdna/DNA_camera_types.h
+++ b/source/blender/makesdna/DNA_camera_types.h
@@ -48,7 +48,7 @@ typedef struct Camera {
ID id;
struct AnimData *adt; /* animation data (must be immediately after id for utilities to use it) */
- char type; /* CAM_PERSP, CAM_ORTHO or CAM_PANO */
+ char type; /* CAM_PERSP or CAM_ORTHO */
char dtx; /* draw type extra */
short flag;
float passepartalpha;
@@ -75,7 +75,6 @@ typedef struct Camera {
/* type */
#define CAM_PERSP 0
#define CAM_ORTHO 1
-#define CAM_PANO 2
/* dtx */
#define CAM_DTX_CENTER 1
@@ -95,7 +94,7 @@ typedef struct Camera {
#define CAM_SHOWNAME 16
#define CAM_ANGLETOGGLE 32
#define CAM_DS_EXPAND 64
-#define CAM_PANORAMA 128 /* deprecated */
+#define CAM_PANORAMA 128
#define CAM_SHOWSENSOR 256
/* yafray: dof sampling switch */
diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h
index da8458d587e..a50cd16e351 100644
--- a/source/blender/makesdna/DNA_curve_types.h
+++ b/source/blender/makesdna/DNA_curve_types.h
@@ -234,8 +234,6 @@ typedef struct Curve {
struct CharInfo *strinfo;
struct CharInfo curinfo;
-
- float bevfac1, bevfac2;
} Curve;
/* **************** CURVE ********************* */
diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h
index dfc70e5bd66..de2c9919df0 100644
--- a/source/blender/makesdna/DNA_image_types.h
+++ b/source/blender/makesdna/DNA_image_types.h
@@ -92,8 +92,8 @@ typedef struct Image {
unsigned int bindcode; /* only for current image... */
unsigned int *repbind; /* for repeat of parts of images */
- struct PackedFile *packedfile;
- struct PreviewImage *preview;
+ struct PackedFile * packedfile;
+ struct PreviewImage * preview;
/* game engine tile animation */
float lastupdate;
@@ -141,3 +141,4 @@ typedef struct Image {
#define IMA_GEN_FLOAT 1
#endif
+
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 0bc91907d6e..c2fbc611bc3 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -523,12 +523,6 @@ typedef struct SpaceClip {
int postproc_flag, pad2;
void *draw_context;
-
- /* dopesheet */
- short dope_sort; /* sort order in dopesheet view */
- short dope_flag; /* dopsheet view flags */
-
- int pad3;
} SpaceClip;
/* view3d Now in DNA_view3d_types.h */
@@ -922,13 +916,8 @@ enum {
#define SC_VIEW_GRAPH 1
#define SC_VIEW_DOPESHEET 2
-/* SpaceClip->dope_sort */
-#define SC_DOPE_SORT_NAME 0
-#define SC_DOPE_SORT_LONGEST 1
-#define SC_DOPE_SORT_TOTAL 2
-
-/* SpaceClip->dope_flag */
-#define SC_DOPE_SORT_INVERSE 1
+/* SpaceClip->runtime_flag */
+#define SC_GRAPH_BOTTOM (1<<0)
/* space types, moved from DNA_screen_types.h */
/* Do NOT change order, append on end. types are hardcoded needed */
diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h
index 6bf059c7ecb..e8abee36716 100644
--- a/source/blender/makesdna/DNA_tracking_types.h
+++ b/source/blender/makesdna/DNA_tracking_types.h
@@ -195,23 +195,13 @@ typedef struct MovieTrackingStats {
typedef struct MovieTrackingDopesheetChannel {
struct MovieTrackingDopesheetChannel *next, *prev;
-
- MovieTrackingTrack *track; /* motion track for which channel is created */
- int pad;
-
- int tot_segment; /* total number of segments */
- int *segments; /* tracked segments */
- int max_segment, total_frames; /* longest segment length and total number of tracked frames */
+ MovieTrackingTrack *track;
+ int flag, pad;
} MovieTrackingDopesheetChannel;
typedef struct MovieTrackingDopesheet {
- int ok, pad; /* flag if dopesheet information is still relevant */
-
ListBase channels;
- int tot_channel;
-
- short sort_method; /* method to be used to sort tracks */
- short sort_inverse; /* order of tracks is inverted */
+ int tot_channel, pad;
} MovieTrackingDopesheet;
typedef struct MovieTracking {
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 5ce5827fac3..adcdf5df106 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -874,8 +874,6 @@ static int calculate_structlens(int firststruct)
printf(" %s\n", types[structtype]);
}
}
-
- dna_error = 1;
}
return(dna_error);
diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c
index 70a33734c3f..0da971d01a0 100644
--- a/source/blender/makesrna/intern/rna_camera.c
+++ b/source/blender/makesrna/intern/rna_camera.c
@@ -97,7 +97,6 @@ void RNA_def_camera(BlenderRNA *brna)
static EnumPropertyItem prop_type_items[] = {
{CAM_PERSP, "PERSP", 0, "Perspective", ""},
{CAM_ORTHO, "ORTHO", 0, "Orthographic", ""},
- {CAM_PANO, "PANO", 0, "Panoramic", ""},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem prop_draw_type_extra_items[] = {
{CAM_DTX_CENTER, "CENTER", 0, "Center", ""},
@@ -272,6 +271,12 @@ void RNA_def_camera(BlenderRNA *brna)
RNA_def_property_enum_items(prop, prop_lens_unit_items);
RNA_def_property_ui_text(prop, "Lens Unit", "Unit to edit lens in for the user interface");
+ prop = RNA_def_property(srna, "use_panorama", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_PANORAMA);
+ RNA_def_property_ui_text(prop, "Panorama",
+ "Render the scene with a cylindrical camera for pseudo-fisheye lens effects");
+ RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
+
/* pointers */
rna_def_animdata_common(srna);
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index 96ec37d8fa0..2c9347e5024 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -1470,18 +1470,6 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Materials", "");
RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
RNA_def_property_collection_funcs(prop, 0, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
-
- prop = RNA_def_property(srna, "bevel_factor_start", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "bevfac1");
- RNA_def_property_range(prop, 0, 1.0);
- RNA_def_property_ui_text(prop, "Start Bevel Factor", "Factor that defines from where beveling of spline happens (0=from the very beginning, 1=from the very end)");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "bevel_factor_end", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "bevfac2");
- RNA_def_property_range(prop, 0, 1.0);
- RNA_def_property_ui_text(prop, "End Bevel Factor", "Factor that defines to where beveling of spline happens (0=to the very beginning, 1=to the very end)");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
}
static void rna_def_curve_nurb(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index aafcc381c51..34c3e328ae5 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2934,12 +2934,6 @@ static void rna_def_space_clip(BlenderRNA *brna)
{SC_VIEW_DOPESHEET, "DOPESHEET", ICON_ACTION, "Dopesheet", "Dopesheet view for tracking data"},
{0, NULL, 0, NULL, NULL}};
- static EnumPropertyItem dope_sort_items[] = {
- {SC_DOPE_SORT_NAME, "NAME", 0, "Name", "Sort channels by their names"},
- {SC_DOPE_SORT_LONGEST, "LONGEST", 0, "Longest", "Sort channels by longest tracked segment"},
- {SC_DOPE_SORT_TOTAL, "TOTAL", 0, "Total", "Sort channels by overall amount of tracked segments"},
- {0, NULL, 0, NULL, NULL}};
-
srna = RNA_def_struct(brna, "SpaceClipEditor", "Space");
RNA_def_struct_sdna(srna, "SpaceClip");
RNA_def_struct_ui_text(srna, "Space Clip Editor", "Clip editor space data");
@@ -3118,21 +3112,6 @@ static void rna_def_space_clip(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_SECONDS);
RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
RNA_def_property_update(prop, NC_MOVIECLIP|ND_DISPLAY, NULL);
-
- /* ** dopesheet ** */
-
- /* dopesheet sort */
- prop = RNA_def_property(srna, "dopesheet_sort_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "dope_sort");
- RNA_def_property_enum_items(prop, dope_sort_items);
- RNA_def_property_ui_text(prop, "Dopesheet Sort Field", "Method to be used to sort channels in dopesheet view");
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
-
- /* invert_dopesheet_sort */
- prop = RNA_def_property(srna, "invert_dopesheet_sort", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dope_flag", SC_DOPE_SORT_INVERSE);
- RNA_def_property_ui_text(prop, "Invert Dopesheet Sort", "Invert sort order of dopesheet channels");
- RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
}
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index 5eb4e2190e4..85adf524717 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -265,7 +265,7 @@ static void rna_trackingCamera_focal_mm_set(PointerRNA *ptr, float value)
if (clip->lastsize[0])
value = clip->lastsize[0]*value/camera->sensor_width;
- if (value >= 0.0001f)
+ if (value >= 0.0001)
camera->focal = value;
}
diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c
index 369b8ed9b0e..2fce6b2373f 100644
--- a/source/blender/modifiers/intern/MOD_boolean_util.c
+++ b/source/blender/modifiers/intern/MOD_boolean_util.c
@@ -113,7 +113,7 @@ static void VertexIt_Fill(CSG_IteratorPtr it, CSG_IVertex *vert)
static void VertexIt_Step(CSG_IteratorPtr it)
{
VertexIt * iterator = (VertexIt *)it;
- iterator->pos++;
+ iterator->pos ++;
}
static void VertexIt_Reset(CSG_IteratorPtr it)
@@ -207,7 +207,7 @@ static void FaceIt_Fill(CSG_IteratorPtr it, CSG_IFace *face)
static void FaceIt_Step(CSG_IteratorPtr it)
{
FaceIt * face_it = (FaceIt *)it;
- face_it->pos++;
+ face_it->pos ++;
}
static void FaceIt_Reset(CSG_IteratorPtr it)
@@ -441,7 +441,7 @@ static DerivedMesh *ConvertCSGDescriptorsToDerivedMesh(
mat_nr = 0;
for (a = 0; a < ob1->totcol; a++) {
- if (give_current_material(ob1, a + 1) == orig_mat) {
+ if (give_current_material(ob1, a+1) == orig_mat) {
mat_nr = a;
break;
}
@@ -601,7 +601,7 @@ int NewBooleanMesh(Scene *scene, Base *base, Base *base_select, int int_op_type)
dm_select = mesh_create_derived_view(scene, ob_select, 0); // no modifiers in editmode ??
maxmat= ob->totcol + ob_select->totcol;
- mat = (Material **)MEM_mallocN(sizeof(Material *) * maxmat, "NewBooleanMeshMat");
+ mat= (Material**)MEM_mallocN(sizeof(Material*)*maxmat, "NewBooleanMeshMat");
/* put some checks in for nice user feedback */
if (dm == NULL || dm_select == NULL) {
@@ -632,7 +632,7 @@ int NewBooleanMesh(Scene *scene, Base *base, Base *base_select, int int_op_type)
/* add materials to object */
for (a = 0; a < totmat; a++)
- assign_material(ob_new, mat[a], a + 1);
+ assign_material(ob_new, mat[a], a+1);
MEM_freeN(mat);
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c
index 1bc23ab5040..d5d8439c749 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -113,7 +113,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, Scene *scene, Ob
CollisionModifierData *coll_clmd = (CollisionModifierData *)modifiers_findByType(ob1, eModifierType_Collision);
if (coll_clmd) {
DagNode *curNode = dag_get_node(forest, ob1);
- dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA, "Cloth Collision");
+ dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Cloth Collision");
}
}
}
diff --git a/source/blender/modifiers/intern/MOD_collision.c b/source/blender/modifiers/intern/MOD_collision.c
index e0b9939d152..f65789013d9 100644
--- a/source/blender/modifiers/intern/MOD_collision.c
+++ b/source/blender/modifiers/intern/MOD_collision.c
@@ -117,7 +117,7 @@ static void deformVerts(ModifierData *md, Object *ob,
/* if possible use/create DerivedMesh */
if (derivedData) dm = CDDM_copy(derivedData);
- else if (ob->type == OB_MESH) dm = CDDM_from_mesh(ob->data, ob);
+ else if (ob->type==OB_MESH) dm = CDDM_from_mesh(ob->data, ob);
if (!ob->pd) {
printf("CollisionModifier deformVerts: Should not happen!\n");
@@ -138,7 +138,7 @@ static void deformVerts(ModifierData *md, Object *ob,
numverts = dm->getNumVerts (dm);
- if ((current_time > collmd->time_xnew) || (BKE_ptcache_get_continue_physics())) {
+ if ((current_time > collmd->time_xnew)|| (BKE_ptcache_get_continue_physics())) {
unsigned int i;
// check if mesh has changed
@@ -148,7 +148,7 @@ static void deformVerts(ModifierData *md, Object *ob,
if (collmd->time_xnew == -1000) { /* first time */
collmd->x = dm->dupVertArray(dm); // frame start position
- for (i = 0; i < numverts; i++) {
+ for ( i = 0; i < numverts; i++ ) {
// we save global positions
mul_m4_v3(ob->obmat, collmd->x[i].co);
}
diff --git a/source/blender/modifiers/intern/MOD_decimate.c b/source/blender/modifiers/intern/MOD_decimate.c
index e1a8e221476..f55faf9c183 100644
--- a/source/blender/modifiers/intern/MOD_decimate.c
+++ b/source/blender/modifiers/intern/MOD_decimate.c
@@ -140,7 +140,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
/* we assume the decim_faces tells how much to reduce */
while (lod.face_num > numTris*dmd->percent) {
- if ( LOD_CollapseEdge(&lod) == 0) break;
+ if ( LOD_CollapseEdge(&lod)==0) break;
}
if (lod.vertex_num>2) {
@@ -160,7 +160,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
if (lod.vertex_num>2) {
mface = CDDM_get_tessfaces(result);
- for (a = 0; a < lod.face_num; a++) {
+ for (a=0; a<lod.face_num; a++) {
MFace *mf = &mface[a];
int *tri = &lod.triangle_index_buffer[a*3];
mf->v1 = tri[0];
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 4d9b8de061e..70294588fd4 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -189,7 +189,7 @@ static void displaceModifier_do(
modifier_init_texture(dmd->modifier.scene, dmd->texture);
- for (i = 0; i < numVerts; i++) {
+ for (i = 0; i < numVerts; ++i) {
TexResult texres;
float delta = 0, strength = dmd->strength;
diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c
index 3e399707040..def02081be8 100644
--- a/source/blender/modifiers/intern/MOD_edgesplit.c
+++ b/source/blender/modifiers/intern/MOD_edgesplit.c
@@ -64,7 +64,7 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj
BMEditMesh *em;
BMIter iter;
BMEdge *e;
- float threshold = cosf((emd->split_angle + 0.00001f) * (float)M_PI / 180.0f);
+ float threshold = cos((emd->split_angle + 0.00001) * M_PI / 180.0);
em = DM_to_editbmesh(dm, NULL, FALSE);
bm = em->bm;
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index 0b0a276c4a0..773b5d04a17 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -122,7 +122,7 @@ static void updateDepgraph(ModifierData *md, DagForest *forest,
DagNode *curNode = dag_get_node(forest, hmd->object);
if (hmd->subtarget[0])
- dag_add_relation(forest, curNode, obNode, DAG_RL_OB_DATA | DAG_RL_DATA_DATA, "Hook Modifier");
+ dag_add_relation(forest, curNode, obNode, DAG_RL_OB_DATA|DAG_RL_DATA_DATA, "Hook Modifier");
else
dag_add_relation(forest, curNode, obNode, DAG_RL_OB_DATA, "Hook Modifier");
}
@@ -195,9 +195,9 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm,
for (j = 0; j < numVerts; j++) {
if (origindex_ar[j] == *index_pt) {
float *co = vertexCos[j];
- if ((fac = hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
+ if ((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
if (dvert)
- fac *= defvert_find_weight(dvert + j, defgrp_index);
+ fac *= defvert_find_weight(dvert+j, defgrp_index);
if (fac) {
mul_v3_m4v3(vec, mat, co);
@@ -210,12 +210,12 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm,
}
}
else { /* missing dm or ORIGINDEX */
- for (i = 0, index_pt = hmd->indexar; i < hmd->totindex; i++, index_pt++) {
+ for (i= 0, index_pt= hmd->indexar; i < hmd->totindex; i++, index_pt++) {
if (*index_pt < numVerts) {
float *co = vertexCos[*index_pt];
- if ((fac = hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
+ if ((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
if (dvert)
- fac *= defvert_find_weight(dvert + (*index_pt), defgrp_index);
+ fac *= defvert_find_weight(dvert+(*index_pt), defgrp_index);
if (fac) {
mul_v3_m4v3(vec, mat, co);
@@ -227,13 +227,13 @@ static void deformVerts_do(HookModifierData *hmd, Object *ob, DerivedMesh *dm,
}
}
else if (dvert) { /* vertex group hook */
- const float fac_orig = hmd->force;
+ const float fac_orig= hmd->force;
for (i = 0; i < max_dvert; i++, dvert++) {
float fac;
float *co = vertexCos[i];
- if ((fac = hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
+ if ((fac= hook_falloff(hmd->cent, co, falloff_squared, fac_orig))) {
fac *= defvert_find_weight(dvert, defgrp_index);
if (fac) {
mul_v3_m4v3(vec, mat, co);
diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c
index aa7d0446a36..8eea871c97f 100644
--- a/source/blender/modifiers/intern/MOD_mask.c
+++ b/source/blender/modifiers/intern/MOD_mask.c
@@ -407,9 +407,7 @@ ModifierTypeInfo modifierType_Mask = {
/* structName */ "MaskModifierData",
/* structSize */ sizeof(MaskModifierData),
/* type */ eModifierTypeType_Nonconstructive,
- /* flags */ eModifierTypeFlag_AcceptsMesh |
- eModifierTypeFlag_SupportsMapping |
- eModifierTypeFlag_SupportsEditmode,
+ /* flags */ eModifierTypeFlag_AcceptsMesh|eModifierTypeFlag_SupportsMapping|eModifierTypeFlag_SupportsEditmode,
/* copyData */ copyData,
/* deformVerts */ NULL,
diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c
index 1bcafc2918e..aee8dd21903 100644
--- a/source/blender/modifiers/intern/MOD_meshdeform.c
+++ b/source/blender/modifiers/intern/MOD_meshdeform.c
@@ -142,24 +142,24 @@ static float meshdeform_dynamic_bind(MeshDeformModifierData *mmd, float (*dco)[3
size= mmd->dyngridsize;
for (i=0; i<3; i++) {
- gridvec[i] = (vec[i] - mmd->dyncellmin[i] - mmd->dyncellwidth*0.5f)/mmd->dyncellwidth;
- ivec[i] = (int)gridvec[i];
- dvec[i] = gridvec[i] - ivec[i];
+ gridvec[i]= (vec[i] - mmd->dyncellmin[i] - mmd->dyncellwidth*0.5f)/mmd->dyncellwidth;
+ ivec[i]= (int)gridvec[i];
+ dvec[i]= gridvec[i] - ivec[i];
}
for (i=0; i<8; i++) {
- if (i & 1) { x = ivec[0] + 1; wx = dvec[0]; }
- else { x = ivec[0]; wx = 1.0f - dvec[0]; }
+ if (i & 1) { x= ivec[0]+1; wx= dvec[0]; }
+ else { x= ivec[0]; wx= 1.0f-dvec[0]; }
- if (i & 2) { y = ivec[1] + 1; wy = dvec[1]; }
- else { y = ivec[1]; wy = 1.0f - dvec[1]; }
+ if (i & 2) { y= ivec[1]+1; wy= dvec[1]; }
+ else { y= ivec[1]; wy= 1.0f-dvec[1]; }
- if (i & 4) { z = ivec[2] + 1; wz = dvec[2]; }
- else { z = ivec[2]; wz = 1.0f - dvec[2]; }
+ if (i & 4) { z= ivec[2]+1; wz= dvec[2]; }
+ else { z= ivec[2]; wz= 1.0f-dvec[2]; }
- CLAMP(x, 0, size - 1);
- CLAMP(y, 0, size - 1);
- CLAMP(z, 0, size - 1);
+ CLAMP(x, 0, size-1);
+ CLAMP(y, 0, size-1);
+ CLAMP(z, 0, size-1);
a= x + y*size + z*size*size;
weight= wx*wy*wz;
@@ -314,7 +314,7 @@ static void meshdeformModifier_do(
totweight= 0.0f;
zero_v3(co);
- for (a = offsets[b]; a < offsets[b + 1]; a++) {
+ for (a=offsets[b]; a<offsets[b+1]; a++) {
weight= influences[a].weight;
madd_v3_v3fl(co, dco[influences[a].vertex], weight);
totweight += weight;
@@ -322,7 +322,7 @@ static void meshdeformModifier_do(
}
if (totweight > 0.0f) {
- mul_v3_fl(co, fac / totweight);
+ mul_v3_fl(co, fac/totweight);
mul_m3_v3(icagemat, co);
if (G.rt != 527)
add_v3_v3(vertexCos[b], co);
@@ -394,8 +394,8 @@ void modifier_mdef_compact_influences(ModifierData *md)
}
/* allocate bind influences */
- mmd->bindinfluences = MEM_callocN(sizeof(MDefInfluence) * mmd->totinfluence, "MDefBindInfluence");
- mmd->bindoffsets = MEM_callocN(sizeof(int) * (totvert + 1), "MDefBindOffset");
+ mmd->bindinfluences= MEM_callocN(sizeof(MDefInfluence)*mmd->totinfluence, "MDefBindInfluence");
+ mmd->bindoffsets= MEM_callocN(sizeof(int)*(totvert+1), "MDefBindOffset");
/* write influences */
totinfluence= 0;
@@ -417,8 +417,8 @@ void modifier_mdef_compact_influences(ModifierData *md)
weight= weights[a + b*totcagevert];
if (weight > MESHDEFORM_MIN_INFLUENCE) {
- mmd->bindinfluences[totinfluence].weight = weight / totweight;
- mmd->bindinfluences[totinfluence].vertex = a;
+ mmd->bindinfluences[totinfluence].weight= weight/totweight;
+ mmd->bindinfluences[totinfluence].vertex= a;
totinfluence++;
}
}
diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c
index 2df0bd17eaf..09924b5b0a4 100644
--- a/source/blender/modifiers/intern/MOD_mirror.c
+++ b/source/blender/modifiers/intern/MOD_mirror.c
@@ -231,10 +231,10 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
ml2 = ml + mp->loopstart + maxLoops;
e = ml2[0].e;
- for (j = 0; j < mp->totloop - 1; j++) {
- ml2[j].e = ml2[j + 1].e;
+ for (j = 0; j < mp->totloop-1; j++) {
+ ml2[j].e = ml2[j+1].e;
}
- ml2[mp->totloop - 1].e = e;
+ ml2[mp->totloop-1].e = e;
mp->loopstart += maxLoops;
}
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index 71839312cf5..d3e54651eea 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -478,7 +478,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
sub_v3_v3v3(e1, mvert[ml_next->v].co, mvert[ml->v].co);
sub_v3_v3v3(e2, mvert[ml_prev->v].co, mvert[ml->v].co);
- angle = (float)M_PI - angle_normalized_v3v3(e1, e2);
+ angle = M_PI - angle_normalized_v3v3(e1, e2);
BLI_array_append(face_angles, angle);
}
@@ -644,13 +644,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
ml[j].v = ed->v1+numVerts;
ml[j++].e = eidx+numEdges;
- ml[j].v = ed->v2 + numVerts;
- ml[j++].e = numEdges * 2 + old_vert_arr[ed->v2];
+ ml[j].v = ed->v2+numVerts;
+ ml[j++].e = numEdges*2 + old_vert_arr[ed->v2];
}
if (edge_origIndex) {
- edge_origIndex[ml[j - 3].e] = ORIGINDEX_NONE;
- edge_origIndex[ml[j - 1].e] = ORIGINDEX_NONE;
+ edge_origIndex[ml[j-3].e] = ORIGINDEX_NONE;
+ edge_origIndex[ml[j-1].e] = ORIGINDEX_NONE;
}
/* use the next material index if option enabled */
@@ -667,16 +667,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
if (crease_inner) {
/* crease += crease_inner; without wrapping */
- unsigned char *cr = (unsigned char *)&(medge[numEdges + eidx].crease);
- int tcr = *cr + crease_inner;
- *cr = tcr > 255 ? 255 : tcr;
+ unsigned char *cr= (unsigned char *)&(medge[numEdges + eidx].crease);
+ int tcr= *cr + crease_inner;
+ *cr= tcr > 255 ? 255 : tcr;
}
#ifdef SOLIDIFY_SIDE_NORMALS
- normal_quad_v3(nor, mvert[ml[j - 4].v].co,
- mvert[ml[j - 3].v].co,
- mvert[ml[j - 2].v].co,
- mvert[ml[j - 1].v].co);
+ normal_quad_v3(nor, mvert[ml[j-4].v].co, mvert[ml[j-3].v].co, mvert[ml[j-2].v].co, mvert[ml[j-1].v].co);
add_v3_v3(edge_vert_nos[ed->v1], nor);
add_v3_v3(edge_vert_nos[ed->v2], nor);
diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c
index 4e9e980e8b7..8694d7bf37d 100644
--- a/source/blender/modifiers/intern/MOD_uvproject.c
+++ b/source/blender/modifiers/intern/MOD_uvproject.c
@@ -193,7 +193,7 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
if (projectors[i].ob->type == OB_CAMERA) {
cam = (Camera *)projectors[i].ob->data;
- if (cam->type == CAM_PANO) {
+ if (cam->flag & CAM_PANORAMA) {
projectors[i].uci= BLI_uvproject_camera_info(projectors[i].ob, NULL, aspx, aspy);
BLI_uvproject_camera_info_scale(projectors[i].uci, scax, scay);
free_uci= 1;
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c
index 5ee8103630d..38a93091700 100644
--- a/source/blender/modifiers/intern/MOD_warp.c
+++ b/source/blender/modifiers/intern/MOD_warp.c
@@ -192,7 +192,7 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
modifier_get_vgroup(ob, dm, wmd->defgrp_name, &dvert, &defgrp_index);
- if (wmd->curfalloff == NULL) /* should never happen, but bad lib linking could cause it */
+ if (wmd->curfalloff==NULL) /* should never happen, but bad lib linking could cause it */
wmd->curfalloff = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
invert_m4_m4(obinv, ob->obmat);
@@ -229,10 +229,9 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
for (i = 0; i < numVerts; i++) {
float *co = vertexCos[i];
- if (wmd->falloff_type == eWarp_Falloff_None ||
- ((fac = len_v3v3(co, mat_from[3])) < wmd->falloff_radius &&
- (fac = (wmd->falloff_radius-fac) / wmd->falloff_radius)))
- {
+ if (wmd->falloff_type==eWarp_Falloff_None ||
+ ((fac=len_v3v3(co, mat_from[3])) < wmd->falloff_radius && (fac=(wmd->falloff_radius-fac)/wmd->falloff_radius)) ) {
+
/* skip if no vert group found */
if (dvert && defgrp_index >= 0) {
dv = &dvert[i];
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index 31cd20e7f97..bcfdced4ffd 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -112,7 +112,7 @@ static void get_vert2geom_distance(int numVerts, float (*v_cos)[3],
dist_f,loc2trgt) \
schedule(static)
#endif
- for (i = 0; i < numVerts; i++) {
+ for (i = 0; i < numVerts; ++i) {
float tmp_co[3];
/* Convert the vertex to tree coordinates. */
@@ -319,12 +319,12 @@ static void updateDepgraph(ModifierData *md, DagForest *forest, struct Scene *UN
if (wmd->mask_tex_map_obj && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
curNode = dag_get_node(forest, wmd->mask_tex_map_obj);
- dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA,
+ dag_add_relation(forest, curNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA,
"WeightVGProximity Modifier");
}
if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL)
- dag_add_relation(forest, obNode, obNode, DAG_RL_DATA_DATA | DAG_RL_OB_DATA,
+ dag_add_relation(forest, obNode, obNode, DAG_RL_DATA_DATA|DAG_RL_OB_DATA,
"WeightVGProximity Modifier");
}
@@ -546,10 +546,10 @@ ModifierTypeInfo modifierType_WeightVGProximity = {
/* structName */ "WeightVGProximityModifierData",
/* structSize */ sizeof(WeightVGProximityModifierData),
/* type */ eModifierTypeType_NonGeometrical,
- /* flags */ eModifierTypeFlag_AcceptsMesh |
- eModifierTypeFlag_SupportsMapping |
- eModifierTypeFlag_SupportsEditmode |
- eModifierTypeFlag_UsesPreview,
+ /* flags */ eModifierTypeFlag_AcceptsMesh
+ |eModifierTypeFlag_SupportsMapping
+ |eModifierTypeFlag_SupportsEditmode
+ |eModifierTypeFlag_UsesPreview,
/* copyData */ copyData,
/* deformVerts */ NULL,
diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c
index 77b62938d94..5675acbe084 100644
--- a/source/blender/nodes/composite/nodes/node_composite_blur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_blur.c
@@ -609,6 +609,7 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
new = pass_on_compbuf(img);
}
else {
+ CompBuf *new, *img = in[0]->data;
// TODO: can this be mapped with reference, too?
const float sx = ((float)nbd->sizex*in[1]->vec[0])/2.0f, sy = ((float)nbd->sizey*in[1]->vec[0])/2.0f;
int c;
diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
index 7a28eabec34..f6ffc783b08 100644
--- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
+++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.c
@@ -76,9 +76,9 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
node->storage = BKE_tracking_distortion_create();
if (node->custom1 == 0)
- obuf = BKE_tracking_distortion_exec(node->storage, tracking, ibuf, width, height, overscan, 1);
+ obuf= BKE_tracking_distortion_exec(node->storage, tracking, ibuf, width, height, overscan, 1);
else
- obuf = BKE_tracking_distortion_exec(node->storage, tracking, ibuf, width, height, overscan, 0);
+ obuf= BKE_tracking_distortion_exec(node->storage, tracking, ibuf, width, height, overscan, 0);
stackbuf->rect = obuf->rect_float;
stackbuf->malloc = TRUE;
@@ -118,7 +118,7 @@ static void storage_free(bNode *node)
if (node->storage)
BKE_tracking_distortion_destroy(node->storage);
- node->storage = NULL;
+ node->storage= NULL;
}
static void storage_copy(bNode *orig_node, bNode *new_node)
diff --git a/source/blender/nodes/shader/nodes/node_shader_common.c b/source/blender/nodes/shader/nodes/node_shader_common.c
index df369482a2e..f75cecfe83b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_common.c
+++ b/source/blender/nodes/shader/nodes/node_shader_common.c
@@ -73,9 +73,6 @@ static void *group_initexec(bNode *node)
bNodeTree *ngroup= (bNodeTree*)node->id;
bNodeTreeExec *exec;
- if (!ngroup)
- return NULL;
-
/* initialize the internal node tree execution */
exec = ntreeShaderBeginExecTree(ngroup, 0);
@@ -124,9 +121,6 @@ static void group_execute(void *data, int thread, struct bNode *node, void *node
bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
bNodeThreadStack *nts;
- if (!exec)
- return;
-
/* XXX same behavior as trunk: all nodes inside group are executed.
* it's stupid, but just makes it work. compo redesign will do this better.
*/
diff --git a/source/blender/nodes/texture/nodes/node_texture_common.c b/source/blender/nodes/texture/nodes/node_texture_common.c
index 1eaf9b2b0fe..9a66ecb5ffb 100644
--- a/source/blender/nodes/texture/nodes/node_texture_common.c
+++ b/source/blender/nodes/texture/nodes/node_texture_common.c
@@ -58,9 +58,6 @@ static void *group_initexec(bNode *node)
bNodeTree *ngroup= (bNodeTree*)node->id;
void *exec;
- if (!ngroup)
- return NULL;
-
/* initialize the internal node tree execution */
exec = ntreeTexBeginExecTree(ngroup, 0);
@@ -110,9 +107,6 @@ static void group_execute(void *data, int thread, struct bNode *node, void *node
bNodeTreeExec *exec= (bNodeTreeExec*)nodedata;
bNodeThreadStack *nts;
- if (!exec)
- return;
-
/* XXX same behavior as trunk: all nodes inside group are executed.
* it's stupid, but just makes it work. compo redesign will do this better.
*/
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index dbb25eb854b..4d0c05f6582 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -1071,8 +1071,8 @@ static EnumPropertyItem *enum_items_from_py(PyObject *seq_fast, PyObject *def, i
else {
MEM_freeN(items);
PyErr_SetString(PyExc_TypeError,
- "EnumProperty(...): expected a tuple containing "
- "(identifier, name, description) and optionally a "
+ "EnumProperty(...): expected an tuple containing "
+ "(identifier, name description) and optionally a "
"unique number");
return NULL;
}
diff --git a/source/blender/render/intern/include/strand.h b/source/blender/render/intern/include/strand.h
index 7482b4d10ee..5094b646807 100644
--- a/source/blender/render/intern/include/strand.h
+++ b/source/blender/render/intern/include/strand.h
@@ -101,7 +101,7 @@ void free_strand_surface(struct Render *re);
struct StrandShadeCache *strand_shade_cache_create(void);
void strand_shade_cache_free(struct StrandShadeCache *cache);
void strand_shade_segment(struct Render *re, struct StrandShadeCache *cache, struct StrandSegment *sseg, struct ShadeSample *ssamp, float t, float s, int addpassflag);
-void strand_shade_unref(struct StrandShadeCache *cache, struct ObjectInstanceRen *obi, struct StrandVert *svert);
+void strand_shade_unref(struct StrandShadeCache *cache, struct StrandVert *svert);
#endif
diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c
index f986be5eaeb..b68525c7150 100644
--- a/source/blender/render/intern/source/strand.c
+++ b/source/blender/render/intern/source/strand.c
@@ -323,18 +323,13 @@ struct StrandShadeCache {
MemArena *memarena;
};
-typedef struct StrandCacheEntry {
- GHashPair pair;
- ShadeResult shr;
-} StrandCacheEntry;
-
StrandShadeCache *strand_shade_cache_create(void)
{
StrandShadeCache *cache;
cache= MEM_callocN(sizeof(StrandShadeCache), "StrandShadeCache");
- cache->resulthash= BLI_ghash_new(BLI_ghashutil_pairhash, BLI_ghashutil_paircmp, "strand_shade_cache_create1 gh");
- cache->refcounthash= BLI_ghash_new(BLI_ghashutil_pairhash, BLI_ghashutil_paircmp, "strand_shade_cache_create2 gh");
+ cache->resulthash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "strand_shade_cache_create1 gh");
+ cache->refcounthash= BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "strand_shade_cache_create2 gh");
cache->memarena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, "strand shade cache arena");
return cache;
@@ -343,47 +338,39 @@ StrandShadeCache *strand_shade_cache_create(void)
void strand_shade_cache_free(StrandShadeCache *cache)
{
BLI_ghash_free(cache->refcounthash, NULL, NULL);
- BLI_ghash_free(cache->resulthash, (GHashKeyFreeFP)MEM_freeN, NULL);
+ BLI_ghash_free(cache->resulthash, NULL, (GHashValFreeFP)MEM_freeN);
BLI_memarena_free(cache->memarena);
MEM_freeN(cache);
}
-static GHashPair strand_shade_hash_pair(ObjectInstanceRen *obi, StrandVert *svert)
-{
- GHashPair pair = {obi, svert};
- return pair;
-}
-
static void strand_shade_get(Render *re, StrandShadeCache *cache, ShadeSample *ssamp, StrandSegment *sseg, StrandVert *svert)
{
- StrandCacheEntry *entry;
+ ShadeResult *hashshr;
StrandPoint p;
int *refcount;
- GHashPair pair = strand_shade_hash_pair(sseg->obi, svert);
- entry= BLI_ghash_lookup(cache->resulthash, &pair);
- refcount= BLI_ghash_lookup(cache->refcounthash, &pair);
+ hashshr= BLI_ghash_lookup(cache->resulthash, svert);
+ refcount= BLI_ghash_lookup(cache->refcounthash, svert);
- if (!entry) {
+ if (!hashshr) {
/* not shaded yet, shade and insert into hash */
p.t= (sseg->v[1] == svert)? 0.0f: 1.0f;
strand_eval_point(sseg, &p);
strand_shade_point(re, ssamp, sseg, svert, &p);
- entry= MEM_callocN(sizeof(StrandCacheEntry), "StrandCacheEntry");
- entry->pair = pair;
- entry->shr = ssamp->shr[0];
- BLI_ghash_insert(cache->resulthash, entry, entry);
+ hashshr= MEM_callocN(sizeof(ShadeResult), "HashShadeResult");
+ *hashshr= ssamp->shr[0];
+ BLI_ghash_insert(cache->resulthash, svert, hashshr);
}
else
/* already shaded, just copy previous result from hash */
- ssamp->shr[0]= entry->shr;
+ ssamp->shr[0]= *hashshr;
/* lower reference count and remove if not needed anymore by any samples */
(*refcount)--;
if (*refcount == 0) {
- BLI_ghash_remove(cache->resulthash, &pair, (GHashKeyFreeFP)MEM_freeN, NULL);
- BLI_ghash_remove(cache->refcounthash, &pair, NULL, NULL);
+ BLI_ghash_remove(cache->resulthash, svert, NULL, (GHashValFreeFP)MEM_freeN);
+ BLI_ghash_remove(cache->refcounthash, svert, NULL, NULL);
}
}
@@ -401,39 +388,34 @@ void strand_shade_segment(Render *re, StrandShadeCache *cache, StrandSegment *ss
/* apply alpha along width */
if (sseg->buffer->widthfade != 0.0f) {
- s = 1.0f - powf(fabsf(s), sseg->buffer->widthfade);
+ s = 1.0f - pow(fabs(s), sseg->buffer->widthfade);
strand_apply_shaderesult_alpha(ssamp->shr, s);
}
}
-void strand_shade_unref(StrandShadeCache *cache, ObjectInstanceRen *obi, StrandVert *svert)
+void strand_shade_unref(StrandShadeCache *cache, StrandVert *svert)
{
- GHashPair pair = strand_shade_hash_pair(obi, svert);
int *refcount;
/* lower reference count and remove if not needed anymore by any samples */
- refcount= BLI_ghash_lookup(cache->refcounthash, &pair);
+ refcount= BLI_ghash_lookup(cache->refcounthash, svert);
(*refcount)--;
if (*refcount == 0) {
- BLI_ghash_remove(cache->resulthash, &pair, (GHashKeyFreeFP)MEM_freeN, NULL);
- BLI_ghash_remove(cache->refcounthash, &pair, NULL, NULL);
+ BLI_ghash_remove(cache->resulthash, svert, NULL, (GHashValFreeFP)MEM_freeN);
+ BLI_ghash_remove(cache->refcounthash, svert, NULL, NULL);
}
}
-static void strand_shade_refcount(StrandShadeCache *cache, StrandSegment *sseg, StrandVert *svert)
+static void strand_shade_refcount(StrandShadeCache *cache, StrandVert *svert)
{
- GHashPair pair = strand_shade_hash_pair(sseg->obi, svert);
- GHashPair *key;
- int *refcount= BLI_ghash_lookup(cache->refcounthash, &pair);
+ int *refcount= BLI_ghash_lookup(cache->refcounthash, svert);
if (!refcount) {
- key= BLI_memarena_alloc(cache->memarena, sizeof(GHashPair));
- *key = pair;
refcount= BLI_memarena_alloc(cache->memarena, sizeof(int));
*refcount= 1;
- BLI_ghash_insert(cache->refcounthash, key, refcount);
+ BLI_ghash_insert(cache->refcounthash, svert, refcount);
}
else
(*refcount)++;
@@ -598,8 +580,8 @@ static void do_strand_fillac(void *handle, int x, int y, float u, float v, float
}
if (cache) {
- strand_shade_refcount(cache, sseg, sseg->v[1]);
- strand_shade_refcount(cache, sseg, sseg->v[2]);
+ strand_shade_refcount(cache, sseg->v[1]);
+ strand_shade_refcount(cache, sseg->v[2]);
}
spart->totapixbuf[offset]++;
}
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index 4c3c9889d53..bc70cdaafbf 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -3748,8 +3748,8 @@ static void unref_strand_samples(StrandShadeCache *cache, ZTranspRow *row, int t
strand= RE_findOrAddStrand(obr, row[totface].p-1);
svert= strand->vert + row[totface].segment;
- strand_shade_unref(cache, obi, svert);
- strand_shade_unref(cache, obi, svert+1);
+ strand_shade_unref(cache, svert);
+ strand_shade_unref(cache, svert+1);
}
}
}
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 2b83a55d7bb..66cadf1e76a 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -475,7 +475,7 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
glTexImage2D(triple->target, 0, GL_RGB8, triple->x[x], triple->y[y], 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(triple->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(triple->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- // The current color is ignored if the GL_REPLACE texture environment is used.
+ // glColor still used with this enabled?
// glTexEnvi(triple->target, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBindTexture(triple->target, 0);
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 36bacd34dfe..8f12ffc955c 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -84,7 +84,6 @@
#include "ED_screen.h"
#include "ED_util.h"
-#include "ED_object.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -2134,12 +2133,7 @@ static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED
{
if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
char filepath[FILE_MAX];
-
- if (G.main->name[0] == 0)
- BLI_strncpy(filepath, "untitled", sizeof(filepath));
- else
- BLI_strncpy(filepath, G.main->name, sizeof(filepath));
-
+ BLI_strncpy(filepath, G.main->name, sizeof(filepath));
BLI_replace_extension(filepath, sizeof(filepath), ".dae");
RNA_string_set(op->ptr, "filepath", filepath);
}
@@ -2163,10 +2157,6 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", filename);
selected = RNA_boolean_get(op->ptr, "selected");
second_life = RNA_boolean_get(op->ptr, "second_life");
-
- /* get editmode results */
- ED_object_exit_editmode(C, 0); /* 0 = does not exit editmode */
-
if (collada_export(CTX_data_scene(C), filename, selected, second_life)) {
return OPERATOR_FINISHED;
}
diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index 563eef8304c..6ffb28ba013 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -237,7 +237,7 @@ void wm_subwindow_position(wmWindow *win, int swinid, rcti *winrct)
}
}
-/* ---------------- WM versions of OpenGL style API calls ------------------------ */
+/* ---------------- WM versions of OpenGL calls, using glBlah() syntax ------------------------ */
/* ----------------- exported in WM_api.h ------------------------------------------------------ */
/* internal state, no threaded opengl! XXX */
diff --git a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp b/source/gameengine/GamePlayer/common/GPC_Canvas.cpp
index f4224b9e255..eccfefedd4d 100644
--- a/source/gameengine/GamePlayer/common/GPC_Canvas.cpp
+++ b/source/gameengine/GamePlayer/common/GPC_Canvas.cpp
@@ -88,12 +88,6 @@ void GPC_Canvas::Resize(int width, int height)
{
m_width = width;
m_height = height;
-
- // initialize area so that it's available for game logic on frame 1 (ImageViewport)
- m_displayarea.m_x1 = 0;
- m_displayarea.m_y1 = 0;
- m_displayarea.m_x2 = width;
- m_displayarea.m_y2 = height;
}
void GPC_Canvas::EndFrame()