Merging r47535 through r47566 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 7 Jun 2012 09:32:39 +0000 (09:32 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 7 Jun 2012 09:32:39 +0000 (09:32 +0000)
105 files changed:
CMakeLists.txt
intern/container/CTR_UHeap.h
intern/cycles/blender/blender_camera.cpp
intern/cycles/blender/blender_session.cpp
intern/cycles/blender/blender_sync.h
intern/cycles/kernel/kernel_light.h
intern/cycles/kernel/kernel_path.h
intern/cycles/render/buffers.cpp
intern/cycles/render/camera.cpp
intern/cycles/render/camera.h
intern/cycles/render/session.cpp
intern/cycles/util/util_system.cpp
intern/ghost/GHOST_Types.h
intern/itasc/Armature.cpp
intern/itasc/CMakeLists.txt
intern/itasc/Distance.cpp
intern/itasc/SConscript
intern/itasc/kdl/jntarray.cpp
intern/itasc/kdl/jntarray.hpp
intern/itasc/kdl/joint.cpp
intern/itasc/kdl/joint.hpp
intern/itasc/kdl/kinfam_io.cpp
intern/itasc/kdl/segment.cpp
intern/itasc/kdl/segment.hpp
intern/itasc/kdl/utilities/utility.h
intern/mikktspace/mikktspace.c
intern/mikktspace/mikktspace.h
source/blender/blenkernel/BKE_cloth.h
source/blender/blenkernel/BKE_collision.h
source/blender/blenkernel/BKE_customdata.h
source/blender/blenkernel/BKE_mask.h
source/blender/blenkernel/BKE_mesh.h
source/blender/blenkernel/BKE_node.h
source/blender/blenkernel/BKE_sketch.h
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/implicit.c
source/blender/blenkernel/intern/mask.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/seqcache.c
source/blender/blenloader/intern/readfile.c
source/blender/bmesh/intern/bmesh_marking.h
source/blender/editors/armature/editarmature_retarget.c
source/blender/editors/include/ED_transform.h
source/blender/editors/mask/mask_add.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_file/filelist.h
source/blender/editors/space_node/node_intern.h
source/blender/editors/space_outliner/outliner_draw.c
source/blender/editors/space_outliner/outliner_tools.c
source/blender/editors/space_view3d/drawarmature.c
source/blender/editors/space_view3d/drawmesh.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_ops.c
source/blender/gpu/shaders/gpu_shader_material.glsl
source/blender/ikplugin/CMakeLists.txt
source/blender/ikplugin/SConscript
source/blender/ikplugin/intern/itasc_plugin.cpp
source/blender/imbuf/intern/openexr/openexr_api.cpp
source/blender/makesdna/DNA_actuator_types.h
source/blender/makesdna/DNA_cloth_types.h
source/blender/makesdna/DNA_listBase.h
source/blender/makesdna/DNA_mask_types.h
source/blender/makesdna/DNA_particle_types.h
source/blender/python/intern/bpy_interface.c
source/blender/render/extern/include/RE_shader_ext.h
source/blender/render/intern/include/render_types.h
source/blender/render/intern/include/rendercore.h
source/blender/render/intern/include/sunsky.h
source/blender/render/intern/include/voxeldata.h
source/blender/render/intern/include/zbuf.h
source/blender/render/intern/raytrace/rayobject_instance.cpp
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/pointdensity.c
source/blender/windowmanager/WM_types.h
source/blender/windowmanager/intern/wm_window.c
source/blenderplayer/CMakeLists.txt
source/gameengine/Converter/BL_ArmatureObject.cpp
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Converter/BL_DeformableGameObject.cpp
source/gameengine/Converter/BL_ShapeActionActuator.cpp
source/gameengine/Converter/KX_BlenderSceneConverter.cpp
source/gameengine/Expressions/PyObjectPlus.h
source/gameengine/Expressions/Value.h
source/gameengine/GameLogic/Joystick/SCA_Joystick.h
source/gameengine/GameLogic/SCA_JoystickSensor.cpp
source/gameengine/GameLogic/SCA_JoystickSensor.h
source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
source/gameengine/Ketsji/KX_BulletPhysicsController.h
source/gameengine/Ketsji/KX_Dome.cpp
source/gameengine/Ketsji/KX_GameObject.h
source/gameengine/Ketsji/KX_IpoActuator.cpp
source/gameengine/Ketsji/KX_KetsjiEngine.h
source/gameengine/Ketsji/KX_LightIpoSGController.h
source/gameengine/Ketsji/KX_MaterialIpoController.h
source/gameengine/Ketsji/KX_ObColorIpoSGController.h
source/gameengine/Ketsji/KX_SoundActuator.h
source/gameengine/Ketsji/KX_WorldIpoController.h
source/gameengine/Rasterizer/RAS_LightObject.h
source/gameengine/SceneGraph/SG_ParentRelation.h

index bd038415772a81641d52ff6dd3b43bca8512b626..191fb61e1b4f593c21f3197f6895ce3aeb6a39dd 100644 (file)
@@ -1,4 +1,3 @@
-set(Boost_DEBUG TRUE)
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
 # This program is free software; you can redistribute it and/or
index ad3d7d2bb0241134f7d0cbed983598a3eb099acf..8711d4375cb172d2739c9b4a50e95885d17291a1 100644 (file)
@@ -56,7 +56,7 @@ class CTR_UHeapable {
 public :
                int &
        HeapPos(
-       ){
+       ) {
                return m_ind;
        };
                float &
@@ -93,7 +93,7 @@ protected :
        };
 
        ~CTR_UHeapable(
-       ){
+       ) {
        };
 };
        
@@ -214,7 +214,7 @@ private:
                HeapType *base,
                int i, 
                int j
-       ){
+       ) {
                std::swap(m_vector[i],m_vector[j]);
                
                CTR_UHeapable *heap_i = base + m_vector[i];
index bdd02bb508601e882546c9706296be44ee83dbed..9bc82344fcc808a5a8b311cbc0f9bcfc1baa6308 100644 (file)
@@ -56,6 +56,11 @@ struct BlenderCamera {
        float sensor_width;
        float sensor_height;
 
+       float border_left;
+       float border_right;
+       float border_bottom;
+       float border_top;
+
        Transform matrix;
 };
 
@@ -70,6 +75,8 @@ static void blender_camera_init(BlenderCamera *bcam)
        bcam->sensor_height = 18.0f;
        bcam->sensor_fit = BlenderCamera::AUTO;
        bcam->shuttertime = 1.0f;
+       bcam->border_right = 1.0f;
+       bcam->border_top = 1.0f;
 }
 
 static float blender_camera_focal_distance(BL::Object b_ob, BL::Camera b_camera)
@@ -188,85 +195,94 @@ static Transform blender_camera_matrix(const Transform& tfm, CameraType type)
        return transform_clear_scale(result);
 }
 
-static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int height)
+static void blender_camera_viewplane(BlenderCamera *bcam, int width, int height,
+       float *left, float *right, float *bottom, float *top, float *aspectratio, float *sensor_size)
 {
-       /* copy camera to compare later */
-       Camera prevcam = *cam;
-
        /* dimensions */
        float xratio = width*bcam->pixelaspect.x;
        float yratio = height*bcam->pixelaspect.y;
 
        /* compute x/y aspect and ratio */
-       float aspectratio, xaspect, yaspect;
+       float xaspect, yaspect;
 
        /* sensor fitting */
        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;
+               *sensor_size = bcam->sensor_width;
        }
        else if(bcam->sensor_fit == BlenderCamera::HORIZONTAL) {
                horizontal_fit = true;
-               sensor_size = bcam->sensor_width;
+               *sensor_size = bcam->sensor_width;
        }
        else {
                horizontal_fit = false;
-               sensor_size = bcam->sensor_height;
+               *sensor_size = bcam->sensor_height;
        }
 
        if(horizontal_fit) {
-               aspectratio= xratio/yratio;
-               xaspect= aspectratio;
+               *aspectratio= xratio/yratio;
+               xaspect= *aspectratio;
                yaspect= 1.0f;
        }
        else {
-               aspectratio= yratio/xratio;
+               *aspectratio= yratio/xratio;
                xaspect= 1.0f;
-               yaspect= aspectratio;
+               yaspect= *aspectratio;
        }
 
        /* modify aspect for orthographic scale */
        if(bcam->type == CAMERA_ORTHOGRAPHIC) {
-               xaspect = xaspect*bcam->ortho_scale/(aspectratio*2.0f);
-               yaspect = yaspect*bcam->ortho_scale/(aspectratio*2.0f);
-               aspectratio = bcam->ortho_scale/2.0f;
+               xaspect = xaspect*bcam->ortho_scale/(*aspectratio*2.0f);
+               yaspect = yaspect*bcam->ortho_scale/(*aspectratio*2.0f);
+               *aspectratio = bcam->ortho_scale/2.0f;
        }
 
        if(bcam->type == CAMERA_PANORAMA) {
                /* set viewplane */
-               cam->left = 0.0f;
-               cam->right = 1.0f;
-               cam->bottom = 0.0f;
-               cam->top = 1.0f;
+               *left = 0.0f;
+               *right = 1.0f;
+               *bottom = 0.0f;
+               *top = 1.0f;
        }
        else {
                /* set viewplane */
-               cam->left = -xaspect;
-               cam->right = xaspect;
-               cam->bottom = -yaspect;
-               cam->top = yaspect;
+               *left = -xaspect;
+               *right = xaspect;
+               *bottom = -yaspect;
+               *top = yaspect;
 
                /* zoom for 3d camera view */
-               cam->left *= bcam->zoom;
-               cam->right *= bcam->zoom;
-               cam->bottom *= bcam->zoom;
-               cam->top *= bcam->zoom;
+               *left *= bcam->zoom;
+               *right *= bcam->zoom;
+               *bottom *= bcam->zoom;
+               *top *= bcam->zoom;
 
                /* modify viewplane with camera shift and 3d camera view offset */
-               float dx = 2.0f*(aspectratio*bcam->shift.x + bcam->offset.x*xaspect*2.0f);
-               float dy = 2.0f*(aspectratio*bcam->shift.y + bcam->offset.y*yaspect*2.0f);
+               float dx = 2.0f*(*aspectratio*bcam->shift.x + bcam->offset.x*xaspect*2.0f);
+               float dy = 2.0f*(*aspectratio*bcam->shift.y + bcam->offset.y*yaspect*2.0f);
 
-               cam->left += dx;
-               cam->right += dx;
-               cam->bottom += dy;
-               cam->top += dy;
+               *left += dx;
+               *right += dx;
+               *bottom += dy;
+               *top += dy;
        }
+}
+
+static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int height)
+{
+       /* copy camera to compare later */
+       Camera prevcam = *cam;
+       float aspectratio, sensor_size;
+
+       /* viewplane */
+       blender_camera_viewplane(bcam, width, height,
+               &cam->left, &cam->right, &cam->bottom, &cam->top, &aspectratio, &sensor_size);
+
+       /* sensor */
+       cam->sensorwidth = bcam->sensor_width;
+       cam->sensorheight = bcam->sensor_height;
 
        /* clipping distances */
        cam->nearclip = bcam->nearclip;
@@ -294,6 +310,12 @@ static void blender_camera_sync(Camera *cam, BlenderCamera *bcam, int width, int
        cam->use_motion = false;
        cam->shuttertime = bcam->shuttertime;
 
+       /* border */
+       cam->border_left = bcam->border_left;
+       cam->border_right = bcam->border_right;
+       cam->border_bottom = bcam->border_bottom;
+       cam->border_top = bcam->border_top;
+
        /* set update flag */
        if(cam->modified(prevcam))
                cam->tag_update();
@@ -313,6 +335,14 @@ void BlenderSync::sync_camera(BL::Object b_override, int width, int height)
        bcam.pixelaspect.y = r.pixel_aspect_y();
        bcam.shuttertime = r.motion_blur_shutter();
 
+       /* border */
+       if(r.use_border()) {
+               bcam.border_left = r.border_min_x();
+               bcam.border_right = r.border_max_x();
+               bcam.border_bottom = r.border_min_y();
+               bcam.border_top = r.border_max_y();
+       }
+
        /* camera object */
        BL::Object b_ob = b_scene.camera();
 
@@ -348,67 +378,142 @@ void BlenderSync::sync_camera_motion(BL::Object b_ob, int motion)
 
 /* Sync 3D View Camera */
 
-void BlenderSync::sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height)
+static void blender_camera_from_view(BlenderCamera *bcam, BL::Scene b_scene, BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height)
 {
-       BlenderCamera bcam;
-       blender_camera_init(&bcam);
-
        /* 3d view parameters */
-       bcam.nearclip = b_v3d.clip_start();
-       bcam.farclip = b_v3d.clip_end();
-       bcam.lens = b_v3d.lens();
-       bcam.shuttertime = b_scene.render().motion_blur_shutter();
+       bcam->nearclip = b_v3d.clip_start();
+       bcam->farclip = b_v3d.clip_end();
+       bcam->lens = b_v3d.lens();
+       bcam->shuttertime = b_scene.render().motion_blur_shutter();
 
        if(b_rv3d.view_perspective() == BL::RegionView3D::view_perspective_CAMERA) {
                /* camera view */
                BL::Object b_ob = (b_v3d.lock_camera_and_layers())? b_scene.camera(): b_v3d.camera();
 
                if(b_ob) {
-                       blender_camera_from_object(&bcam, b_ob);
+                       blender_camera_from_object(bcam, b_ob);
 
                        /* magic zoom formula */
-                       bcam.zoom = (float)b_rv3d.view_camera_zoom();
-                       bcam.zoom = (1.41421f + bcam.zoom/50.0f);
-                       bcam.zoom *= bcam.zoom;
-                       bcam.zoom = 2.0f/bcam.zoom;
+                       bcam->zoom = (float)b_rv3d.view_camera_zoom();
+                       bcam->zoom = (1.41421f + bcam->zoom/50.0f);
+                       bcam->zoom *= bcam->zoom;
+                       bcam->zoom = 2.0f/bcam->zoom;
 
                        /* offset */
-                       bcam.offset = get_float2(b_rv3d.view_camera_offset());
+                       bcam->offset = get_float2(b_rv3d.view_camera_offset());
                }
        }
        else if(b_rv3d.view_perspective() == BL::RegionView3D::view_perspective_ORTHO) {
                /* orthographic view */
-               bcam.farclip *= 0.5;
-               bcam.nearclip = -bcam.farclip;
+               bcam->farclip *= 0.5;
+               bcam->nearclip = -bcam->farclip;
 
-               bcam.type = CAMERA_ORTHOGRAPHIC;
-               bcam.ortho_scale = b_rv3d.view_distance();
+               bcam->type = CAMERA_ORTHOGRAPHIC;
+               bcam->ortho_scale = b_rv3d.view_distance();
        }
 
-       bcam.zoom *= 2.0f;
+       bcam->zoom *= 2.0f;
 
        /* 3d view transform */
-       bcam.matrix = transform_inverse(get_transform(b_rv3d.view_matrix()));
+       bcam->matrix = transform_inverse(get_transform(b_rv3d.view_matrix()));
+}
+
+static void blender_camera_border(BlenderCamera *bcam, BL::Scene b_scene, BL::SpaceView3D b_v3d,
+       BL::RegionView3D b_rv3d, int width, int height)
+{
+       BL::RenderSettings r = b_scene.render();
+
+       if(!r.use_border())
+               return;
+
+       /* camera view? */
+       if(!(b_rv3d && b_rv3d.view_perspective() == BL::RegionView3D::view_perspective_CAMERA))
+               return;
+
+       BL::Object b_ob = (b_v3d.lock_camera_and_layers())? b_scene.camera(): b_v3d.camera();
+
+       if(!b_ob)
+               return;
+
+       bcam->border_left = r.border_min_x();
+       bcam->border_right = r.border_max_x();
+       bcam->border_bottom = r.border_min_y();
+       bcam->border_top = r.border_max_y();
+
+       float cam_left, cam_right, cam_bottom, cam_top;
+       float view_left, view_right, view_bottom, view_top;
+       float view_aspect, cam_aspect, sensor_size;
+
+       /* get viewport viewplane */
+       BlenderCamera view_bcam;
+       blender_camera_init(&view_bcam);
+       blender_camera_from_view(&view_bcam, b_scene, b_v3d, b_rv3d, width, height);
+
+       blender_camera_viewplane(&view_bcam, width, height,
+               &view_left, &view_right, &view_bottom, &view_top, &view_aspect, &sensor_size);
+
+       view_left /= view_aspect;
+       view_right /= view_aspect;
+       view_bottom /= view_aspect;
+       view_top /= view_aspect;
+
+       /* get camera viewplane */
+       BlenderCamera cam_bcam;
+       blender_camera_init(&cam_bcam);
+       blender_camera_from_object(&cam_bcam, b_ob);
+
+       width = (int)(r.resolution_x()*r.resolution_percentage()/100);
+       height = (int)(r.resolution_y()*r.resolution_percentage()/100);
+
+       blender_camera_viewplane(&cam_bcam, width, height,
+               &cam_left, &cam_right, &cam_bottom, &cam_top, &cam_aspect, &sensor_size);
+
+       cam_left /= cam_aspect;
+       cam_right /= cam_aspect;
+       cam_bottom /= cam_aspect;
+       cam_top /= cam_aspect;
+
+       /* determine viewport subset matching camera border */
+       float tmp_left = ((cam_left - view_left) / (view_right - view_left));
+       float tmp_right = ((cam_right - view_left) / (view_right - view_left));
+       float tmp_bottom = ((cam_bottom - view_bottom) / (view_top - view_bottom));
+       float tmp_top = ((cam_top - view_bottom) / (view_top - view_bottom));
+
+       bcam->border_left = tmp_left + bcam->border_left*(tmp_right - tmp_left);
+       bcam->border_right = tmp_left + bcam->border_right*(tmp_right - tmp_left);
+       bcam->border_bottom = tmp_bottom + bcam->border_bottom*(tmp_top - tmp_bottom);
+       bcam->border_top = tmp_bottom + bcam->border_top*(tmp_top - tmp_bottom);
+
+       /* clamp */
+       bcam->border_left = max(bcam->border_left, 0.0f);
+       bcam->border_right = min(bcam->border_right, 1.0f);
+       bcam->border_bottom = max(bcam->border_bottom, 0.0f);
+       bcam->border_top = min(bcam->border_top, 1.0f);
+}
+
+void BlenderSync::sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int width, int height)
+{
+       BlenderCamera bcam;
+       blender_camera_init(&bcam);
+       blender_camera_from_view(&bcam, b_scene, b_v3d, b_rv3d, width, height);
+       blender_camera_border(&bcam, b_scene, b_v3d, b_rv3d, width, height);
 
-       /* sync */
        blender_camera_sync(scene->camera, &bcam, width, height);
 }
 
-BufferParams BlenderSync::get_buffer_params(BL::Scene b_scene, BL::RegionView3D b_rv3d, int width, int height)
+BufferParams BlenderSync::get_buffer_params(BL::Scene b_scene, Camera *cam, int width, int height)
 {
        BufferParams params;
 
        params.full_width = width;
        params.full_height = height;
 
-       /* border render */
-       BL::RenderSettings r = b_scene.render();
-
-       if(!b_rv3d && r.use_border()) {
-               params.full_x = r.border_min_x()*width;
-               params.full_y = r.border_min_y()*height;
-               params.width = (int)(r.border_max_x()*width) - params.full_x;
-               params.height = (int)(r.border_max_y()*height) - params.full_y;
+       if(b_scene.render().use_border()) {
+               /* border render */
+               params.full_x = cam->border_left*width;
+               params.full_y = cam->border_bottom*height;
+               params.width = (int)(cam->border_right*width) - params.full_x;
+               params.height = (int)(cam->border_top*height) - params.full_y;
        }
        else {
                params.width = width;
index 997909f1b9287d3722e836a24840ac380a014664..9726f7b94cf3a7e08851a20dc967acd0eaed9db7 100644 (file)
@@ -106,7 +106,7 @@ void BlenderSession::create_session()
        session->set_pause(BlenderSync::get_session_pause(b_scene, background));
 
        /* set buffer parameters */
-       BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_rv3d, width, height);
+       BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, scene->camera, width, height);
        session->reset(buffer_params, session_params.samples);
 }
 
@@ -181,7 +181,7 @@ void BlenderSession::render()
 {
        /* get buffer parameters */
        SessionParams session_params = BlenderSync::get_session_params(b_userpref, b_scene, background);
-       BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_rv3d, width, height);
+       BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, scene->camera, width, height);
        int w = buffer_params.width, h = buffer_params.height;
 
        /* create render result */
@@ -326,7 +326,7 @@ void BlenderSession::synchronize()
 
        /* reset if needed */
        if(scene->need_reset()) {
-               BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_rv3d, width, height);
+               BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, scene->camera, width, height);
                session->reset(buffer_params, session_params.samples);
        }
 }
@@ -364,7 +364,7 @@ bool BlenderSession::draw(int w, int h)
                /* reset if requested */
                if(reset) {
                        SessionParams session_params = BlenderSync::get_session_params(b_userpref, b_scene, background);
-                       BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_rv3d, width, height);
+                       BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, scene->camera, w, h);
 
                        session->reset(buffer_params, session_params.samples);
                }
@@ -374,7 +374,7 @@ bool BlenderSession::draw(int w, int h)
        update_status_progress();
 
        /* draw */
-       BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, b_rv3d, width, height);
+       BufferParams buffer_params = BlenderSync::get_buffer_params(b_scene, scene->camera, width, height);
 
        return !session->draw(buffer_params);
 }
index 10afd468850cd530c4b8ed18da8795b8b4263cf0..bc6258d35ac0ca4740410aa2bb647bd1b868511e 100644 (file)
@@ -63,7 +63,7 @@ public:
        static SceneParams get_scene_params(BL::Scene b_scene, bool background);
        static SessionParams get_session_params(BL::UserPreferences b_userpref, BL::Scene b_scene, bool background);
        static bool get_session_pause(BL::Scene b_scene, bool background);
-       static BufferParams get_buffer_params(BL::Scene b_scene, BL::RegionView3D b_rv3d, int width, int height);
+       static BufferParams get_buffer_params(BL::Scene b_scene, Camera *cam, int width, int height);
 
 private:
        /* sync */
index a056cd71bb1caea4e3fe2720b2bd0be9ec2f79de..2bc5a882ce5bdbf720492d298e0801ce4b385eaf 100644 (file)
@@ -391,6 +391,10 @@ __device float light_sample_pdf(KernelGlobals *kg, LightSample *ls, float3 I, fl
 __device void light_select(KernelGlobals *kg, int index, float randu, float randv, float3 P, LightSample *ls, float *pdf)
 {
        regular_light_sample(kg, index, randu, randv, P, ls, pdf);
+
+       /* compute incoming direction and distance */
+       if(ls->t != FLT_MAX)
+               ls->D = normalize_len(ls->P - P, &ls->t);
 }
 
 __device float light_select_pdf(KernelGlobals *kg, LightSample *ls, float3 I, float t)
index e0e17ee57dc845d9ecbaded6aed17786bcd90faa..e41a5a62c1476bc07c4bd4487d81cbbcab7312f2 100644 (file)
@@ -365,7 +365,7 @@ __device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample, R
 
 #ifdef __MULTI_LIGHT__
                                /* index -1 means randomly sample from distribution */
-                               int i = (kernel_data.integrator.num_distribution)? -1: 0;
+                               int i = (kernel_data.integrator.num_all_lights)? 0: -1;
 
                                for(; i < kernel_data.integrator.num_all_lights; i++) {
 #else
index a80851b945a14746414609cdf4d2b553058332b7..a7fd47c94cf895e039f41abdb7ad730756ca213b 100644 (file)
@@ -311,8 +311,14 @@ void DisplayBuffer::draw_set(int width, int height)
 
 void DisplayBuffer::draw(Device *device)
 {
-       if(draw_width != 0 && draw_height != 0)
+       if(draw_width != 0 && draw_height != 0) {
+               glPushMatrix();
+               glTranslatef(params.full_x, params.full_y, 0.0f);
+
                device->draw_pixels(rgba, 0, draw_width, draw_height, 0, params.width, params.height, transparent);
+
+               glPopMatrix();
+       }
 }
 
 bool DisplayBuffer::draw_ready()
index 3ecffab7cbc4398d7bdb693d4db8092fbaf4b6a9..ed239074cd452be4d0145df4a7b8ef32b10df7b9 100644 (file)
@@ -58,6 +58,11 @@ Camera::Camera()
        bottom = -1.0f;
        top = 1.0f;
 
+       border_left = 0.0f;
+       border_right = 1.0f;
+       border_bottom = 0.0f;
+       border_top = 1.0f;
+
        screentoworld = transform_identity();
        rastertoworld = transform_identity();
        ndctoworld = transform_identity();
@@ -248,6 +253,10 @@ bool Camera::modified(const Camera& cam)
                (right == cam.right) &&
                (bottom == cam.bottom) &&
                (top == cam.top) &&
+               (border_left == cam.border_left) &&
+               (border_right == cam.border_right) &&
+               (border_bottom == cam.border_bottom) &&
+               (border_top == cam.border_top) &&
                (matrix == cam.matrix) &&
                (motion == cam.motion) &&
                (use_motion == cam.use_motion) &&
index 7a09b5981e4042800dc491d121a96dca84d25e09..647423d88baf8bfc2a282d69134fd48f7294efd5 100644 (file)
@@ -67,6 +67,9 @@ public:
        int width, height;
        float left, right, bottom, top;
 
+       /* border */
+       float border_left, border_right, border_bottom, border_top;
+
        /* transformation */
        Transform matrix;
 
index 34a0c0ff877771fd04e30783aa75fce6061277b2..173d73ea2c77f460c6ca31d08cbbf886812ce797 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "util_foreach.h"
 #include "util_function.h"
+#include "util_opengl.h"
 #include "util_task.h"
 #include "util_time.h"
 
index e8c81e576542cf7e73fcc2c466d20384fe4212f3..ad7f3347cee7fba3c87bf6e5fb55147bee3f1bcd 100644 (file)
@@ -152,7 +152,7 @@ bool system_cpu_support_optimized()
                /*__cpuid(result, 0x80000000);
                num_ex = result[0];*/
 
-               if(num >= 1){
+               if(num >= 1) {
                        __cpuid(result, 0x00000001);
                        caps.mmx = (result[3] & ((int)1 << 23)) != 0;
                        caps.sse = (result[3] & ((int)1 << 25)) != 0;
@@ -167,7 +167,7 @@ bool system_cpu_support_optimized()
                        caps.fma3 = (result[2] & ((int)1 << 12)) != 0;
                }
 
-               /*if(num_ex >= 0x80000001){
+               /*if(num_ex >= 0x80000001) {
                        __cpuid(result, 0x80000001);
                        caps.x64 = (result[3] & ((int)1 << 29)) != 0;
                        caps.sse4a = (result[2] & ((int)1 <<  6)) != 0;
index 7614cb80e00cf7169d0e50d4fb90ac9888c2fc6d..8454f338645fca58ab3693901f8f7f1f15d29d6a 100644 (file)
@@ -56,8 +56,7 @@ typedef unsigned long long GHOST_TUns64;
 
 typedef void *GHOST_TUserDataPtr;
 
-typedef enum
-{
+typedef enum {
        GHOST_kFailure = 0,
        GHOST_kSuccess
 } GHOST_TSuccess;
index dd5c1921a98ca716d25648e1e9edd5b653bed571..1dacb8bc184069309198e277b7c01021ed6cd929 100644 (file)
@@ -158,7 +158,7 @@ void Armature::pushQ(CacheTS timestamp)
 {
        if (m_qCCh >= 0) {
                // try to keep the cache if the joints are the same
-               m_cache->addCacheVectorIfDifferent(this, m_qCCh, timestamp, &m_qKdl(0), m_qKdl.rows(), KDL::epsilon);
+               m_cache->addCacheVectorIfDifferent(this, m_qCCh, timestamp, m_qKdl(0), m_qKdl.rows(), KDL::epsilon);
                m_qCTs = timestamp;
        }
 }
@@ -170,8 +170,8 @@ bool Armature::popQ(CacheTS timestamp)
                double* item;
                item = (double*)m_cache->getPreviousCacheItem(this, m_qCCh, &timestamp);
                if (item && m_qCTs != timestamp) {
-                       double& q = m_qKdl(0);
-                       memcpy(&q, item, m_qKdl.rows()*sizeof(q));
+                       double* q = m_qKdl(0);
+                       memcpy(q, item, m_qKdl.rows()*sizeof(double));
                        m_qCTs = timestamp;
                        // changing the joint => recompute the jacobian
                        updateJacobian();
@@ -255,7 +255,7 @@ bool Armature::getSegment(const std::string& name, const unsigned int q_size, co
        p_tip = &sit->second.segment.getFrameToTip();
        for (unsigned int dof=0; dof<p_joint->getNDof(); dof++) {
                (&q_rest)[dof] = m_joints[sit->second.q_nr+dof].rest;
-               (&q)[dof] = m_qKdl(sit->second.q_nr+dof);
+               (&q)[dof] = m_qKdl[sit->second.q_nr+dof];
        }
        return true;
 }
@@ -267,7 +267,7 @@ double Armature::getMaxJointChange()
        double maxJoint = 0.0;
        for (unsigned int i=0; i<m_njoint; i++) {
                // this is a very rough calculation, it doesn't work well for spherical joint
-               double joint = fabs(m_oldqKdl(i)-m_qKdl(i));
+               double joint = fabs(m_oldqKdl[i]-m_qKdl[i]);
                if (maxJoint < joint)
                        maxJoint = joint;
        }
@@ -392,7 +392,7 @@ bool Armature::finalize()
        m_newqKdl.resize(m_njoint);
        m_qdotKdl.resize(m_njoint);
        for (i=0; i<m_njoint; i++) {
-               m_newqKdl(i) = m_oldqKdl(i) = m_qKdl(i) = m_joints[i].rest;
+               m_newqKdl[i] = m_oldqKdl[i] = m_qKdl[i] = m_joints[i].rest;
        }
        updateJacobian();
        // estimate the maximum size of the robot arms
@@ -447,15 +447,15 @@ bool Armature::updateJoint(const Timestamp& timestamp, JointLockCallback& callba
        // integration and joint limit
        // for spherical joint we must use a more sophisticated method
        unsigned int q_nr;
-       double* qdot=&m_qdotKdl(0);
-       double* q=&m_qKdl(0);
-       double* newq=&m_newqKdl(0);
+       double* qdot=m_qdotKdl(0);
+       double* q=m_qKdl(0);
+       double* newq=m_newqKdl(0);
        double norm, qx, qz, CX, CZ, sx, sz;
        bool locked = false;
        int unlocked = 0;
 
        for (q_nr=0; q_nr<m_nq; ++q_nr)
-               m_qdotKdl(q_nr)=m_qdot(q_nr);
+               qdot[q_nr]=m_qdot[q_nr];
 
        for (q_nr=0; q_nr<m_nq; ) {
                Joint_struct* joint = &m_joints[q_nr];
@@ -624,7 +624,7 @@ void Armature::updateKinematics(const Timestamp& timestamp){
                return;
 
        // the new joint value have been computed already, just copy
-       memcpy(&m_qKdl(0), &m_newqKdl(0), sizeof(double)*m_qKdl.rows());
+       memcpy(m_qKdl(0), m_newqKdl(0), sizeof(double)*m_qKdl.rows());
        pushCache(timestamp);
        updateJacobian();
        // here update the desired output.
@@ -677,7 +677,7 @@ void Armature::updateControlOutput(const Timestamp& timestamp)
 
        if (!timestamp.substep) {
                // save previous joint state for getMaxJointChange()
-               memcpy(&m_oldqKdl(0), &m_qKdl(0), sizeof(double)*m_qKdl.rows());
+               memcpy(m_oldqKdl(0), m_qKdl(0), sizeof(double)*m_qKdl.rows());
                for (unsigned int i=0; i<m_neffector; i++) {
                        m_effectors[i].oldpose = m_effectors[i].pose;
                }
@@ -696,8 +696,8 @@ void Armature::updateControlOutput(const Timestamp& timestamp)
                JointConstraint_struct* pConstraint = *it;
                unsigned int nr, i;
                for (i=0, nr = pConstraint->segment->second.q_nr; i<pConstraint->v_nr; i++, nr++) {
-                       *(double*)&pConstraint->value[i].y = m_qKdl(nr);
-                       *(double*)&pConstraint->value[i].ydot = m_qdotKdl(nr);
+                       *(double*)&pConstraint->value[i].y = m_qKdl[nr];
+                       *(double*)&pConstraint->value[i].ydot = m_qdotKdl[nr];
                }
                if (pConstraint->function && (pConstraint->substep || (!timestamp.reiterate && !timestamp.substep))) {
                        (*pConstraint->function)(timestamp, pConstraint->values, pConstraint->v_nr, pConstraint->param);
index 3d24a0cb8c6556496f4fe65ab7dcaa88957c3ece..f4bc0326ea1c79b931b7b969eae0b819da7c367b 100644 (file)
@@ -318,8 +318,5 @@ set(SRC
        ../../extern/Eigen3/Eigen/src/Cholesky/LLT.h
 )
 
-if(WIN32)
-       add_definitions(-DEIGEN_DONT_ALIGN_STATICALLY)
-endif()
 
 blender_add_lib(bf_intern_itasc "${SRC}" "${INC}" "${INC_SYS}")
index 7cf04367a4ee16f12fdcd3cf2d905872ff7cdaf9..c9efca101e35c52c2535318536b1d7850c0865c7 100644 (file)
@@ -189,7 +189,7 @@ void Distance::updateKinematics(const Timestamp& timestamp)
 void Distance::updateJacobian()
 {
     for(unsigned int i=0;i<6;i++)
-        m_chiKdl(i)=m_chi(i);
+        m_chiKdl[i]=m_chi[i];
 
     m_fksolver->JntToCart(m_chiKdl,m_internalPose);
     m_jacsolver->JntToJac(m_chiKdl,m_jac);
index 69dddf402287c468f72182e461a511578b48187a..c1ad931c665d77f7235808b5c79b4c7b0c18acac 100644 (file)
@@ -9,8 +9,5 @@ incs = '. ../../extern/Eigen3'
 
 defs = []
 
-if env['PLATFORM'] == 'win32':
-    defs.append('EIGEN_DONT_ALIGN_STATICALLY')
-
 env.BlenderLib ('bf_intern_itasc', sources, Split(incs), defs, libtype=['intern','player'], priority=[20,100] )
 
index 77c75e6af6c4f66f98e9b86df33324a4463b024e..db2c913a532fec5e4dbf701371fb3eb49ff8fa74 100644 (file)
@@ -71,20 +71,25 @@ namespace KDL
         SetToZero(*this);
     }
 
-    double JntArray::operator()(unsigned int i,unsigned int j)const
+    double JntArray::operator[](unsigned int i)const
     {
-        assert(i<size&&j==0);
-        assert(0 != size);  // found JntArray containing no data
+        assert(i<size);
         return data[i];
     }
 
-    double& JntArray::operator()(unsigned int i,unsigned int j)
+    double& JntArray::operator[](unsigned int i)
     {
-        assert(i<size&&j==0);
-        assert(0 != size);  // found JntArray containing no data
+        assert(i<size);
         return data[i];
     }
 
+    double* JntArray::operator()(unsigned int i)
+    {
+        if (i>=size)
+                       return NULL;
+        return &data[i];
+    }
+
     unsigned int JntArray::rows()const
     {
         return size;
index 8db4cd6f2b32ee7ef26623d52242ddae203e800b..ece6b0bdb6b5dc0859729fc8bf03fe70b636afc0 100644 (file)
@@ -107,24 +107,30 @@ class MyTask : public RTT::TaskContext
                
         JntArray& operator = ( const JntArray& arg);
         /**
-         * get_item operator for the joint array, if a second value is
-         * given it should be zero, since a JntArray resembles a column.
+         * get_item operator for the joint array
          *
          *
          * @return the joint value at position i, starting from 0
          * @pre 0 != size (ie non-default constructor or resize() called)
          */
-        double operator()(unsigned int i,unsigned int j=0)const;
+        double operator[](unsigned int i) const;
         /**
-         * set_item operator, again if a second value is given it
-         *should be zero.
+         * set_item operator
          *
          * @return reference to the joint value at position i,starting
          *from zero.
          * @pre 0 != size (ie non-default constructor or resize() called)
          */
-        double& operator()(unsigned int i,unsigned int j=0);
+        double& operator[](unsigned int i);
         /**
+         * access operator for the joint array. Use pointer here to allow
+                * access to sequential joint angles (required for ndof joints)
+         * 
+         *
+         * @return the joint value at position i, NULL if i is outside the valid range
+         */
+        double* operator()(unsigned int i);
+               /**
          * Returns the number of rows (size) of the array
          *
          */
index 5458efc4fcf58111ee6b41f69285188648357cf3..161794ddd72dcab540d7c7df9cc61841c672053e 100644 (file)
@@ -55,37 +55,45 @@ namespace KDL {
     {
     }
 
-    Frame Joint::pose(const double& q)const
+    Frame Joint::pose(const double* q)const
     {
 
         switch(type){
         case RotX:
-            return Frame(Rotation::RotX(scale*q+offset));
+                       assert(q);
+            return Frame(Rotation::RotX(scale*q[0]+offset));
             break;
         case RotY:
-            return  Frame(Rotation::RotY(scale*q+offset));
+                       assert(q);
+            return  Frame(Rotation::RotY(scale*q[0]+offset));
             break;
         case RotZ:
-            return  Frame(Rotation::RotZ(scale*q+offset));
+                       assert(q);
+            return  Frame(Rotation::RotZ(scale*q[0]+offset));
             break;
         case TransX:
-            return  Frame(Vector(scale*q+offset,0.0,0.0));
+                       assert(q);
+            return  Frame(Vector(scale*q[0]+offset,0.0,0.0));
             break;
         case TransY:
-            return Frame(Vector(0.0,scale*q+offset,0.0));
+                       assert(q);
+            return Frame(Vector(0.0,scale*q[0]+offset,0.0));
             break;
         case TransZ:
-            return Frame(Vector(0.0,0.0,scale*q+offset));
+                       assert(q);
+            return Frame(Vector(0.0,0.0,scale*q[0]+offset));
             break;
                case Sphere:
                        // the joint angles represent a rotation vector expressed in the base frame of the joint
                        // (= the frame you get when there is no offset nor rotation)
-                       return Frame(Rot(Vector((&q)[0], (&q)[1], (&q)[2])));
+                       assert(q);
+                       return Frame(Rot(Vector(q[0], q[1], q[2])));
                        break;
                case Swing:
                        // the joint angles represent a 2D rotation vector in the XZ planee of the base frame of the joint
                        // (= the frame you get when there is no offset nor rotation)
-                       return Frame(Rot(Vector((&q)[0], 0.0, (&q)[1])));
+                       assert(q);
+                       return Frame(Rot(Vector(q[0], 0.0, q[1])));
                        break;
         default:
             return Frame::Identity();
index a1291509f0fa051abd3bbaf6835f393f82ec7f53..9d25b4274999da73d06cbc845e51aa9f04d188f4 100644 (file)
@@ -70,7 +70,7 @@ namespace KDL {
          *
          * @return the resulting 6D-pose
          */
-        Frame pose(const double& q)const;
+        Frame pose(const double* q)const;
         /**
          * Request the resulting 6D-velocity with a joint velocity qdot
          *
index 15557ab5f05fe6bb484cc2110f086b49d3bbfe6b..ff4cab862ce6915084f11bfaf038023179555351 100644 (file)
@@ -76,7 +76,7 @@ std::istream& operator >>(std::istream& is, Tree& tree) {
 std::ostream& operator <<(std::ostream& os, const JntArray& array) {
        os << "[";
        for (unsigned int i = 0; i < array.rows(); i++)
-               os << std::setw(KDL_FRAME_WIDTH) << array(i);
+               os << std::setw(KDL_FRAME_WIDTH) << array[i];
        os << "]";
        return os;
 }
index cba797899e15a8dcfbd9919c4fd2246d59279362..f963559c4c8d91d82376328cbc4f65af2adf961f 100644 (file)
@@ -48,12 +48,12 @@ namespace KDL {
     {
     }
 
-    Frame Segment::pose(const double& q)const
+    Frame Segment::pose(const double* q)const
     {
         return joint.pose(q)*f_tip;
     }
 
-    Twist Segment::twist(const double& q, const double& qdot, int dof)const
+    Twist Segment::twist(const double* q, const double& qdot, int dof)const
     {
         return joint.twist(qdot, dof).RefPoint(pose(q).p);
     }
index 87d972ead705a5d8d9059e46a293c61020697dc1..130bfb13f8b0a4a41bed1ab1787846ea66008e58 100644 (file)
@@ -73,7 +73,7 @@ namespace KDL {
          *
          * @return pose from the root to the tip of the segment
          */
-        Frame pose(const double& q)const;
+        Frame pose(const double* q)const;
         /**
          * Request the 6D-velocity of the tip of the segment, given
          * the joint position q and the joint velocity qdot.
@@ -85,7 +85,7 @@ namespace KDL {
          *in the base-frame of the segment(root) and with the tip of
          *the segment as reference point.
          */
-        Twist twist(const double& q,const double& qdot, int dof=0)const;
+        Twist twist(const double* q,const double& qdot, int dof=0)const;
 
         /**
          * Request the 6D-velocity at a given point p, relative to base frame of the segment
index fbf9982665a2f43e00b4e5ed0cdf51aab3a758ce..892b375d4428f4150106e0edbbcb76450f513f31 100644 (file)
 #include <cassert>
 #include <cmath>
 
+#ifdef NDEBUG
+#undef assert
+#define assert(e) ((void)0)
+#endif
 
 /////////////////////////////////////////////////////////////
 // configurable options for the frames library.
index cba4c406759c887505400238bb6b24629198207a..0a3141d67829468c4ee5f0cd99fd2685693ac1a6 100644 (file)
@@ -40,8 +40,7 @@
 #define INTERNAL_RND_SORT_SEED         39871946
 
 // internal structure
-typedef struct
-{
+typedef struct {
        float x, y, z;
 } SVec3;
 
@@ -119,14 +118,12 @@ static tbool VNotZero(const SVec3 v)
 
 
 
-typedef struct
-{
+typedef struct {
        int iNrFaces;
        int * pTriMembers;
 } SSubGroup;
 
-typedef struct
-{
+typedef struct {
        int iNrFaces;
        int * pFaceIndices;
        int iVertexRepresentitive;
@@ -141,8 +138,7 @@ typedef struct
 
 
 
-typedef struct
-{
+typedef struct {
        int FaceNeighbors[3];
        SGroup * AssignedGroup[3];
        
@@ -156,8 +152,7 @@ typedef struct
        unsigned char vert_num[4];
 } STriInfo;
 
-typedef struct
-{
+typedef struct {
        SVec3 vOs;
        float fMagS;
        SVec3 vOt;
@@ -426,8 +421,7 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
-typedef struct
-{
+typedef struct {
        float vert[3];
        int index;
 } STmpVert;
@@ -911,8 +905,7 @@ static SVec3 GetTexCoord(const SMikkTSpaceContext * pContext, const int index)
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 
-typedef union
-{
+typedef union {
        struct
        {
                int i0, i1, f;
index dc2308f6116e6204e9e65c325ee127329d6e2530..52c44a713c60ebff71133a41e0711bbf7199fc5e 100644 (file)
@@ -62,8 +62,7 @@ extern "C" {
 typedef int tbool;
 typedef struct SMikkTSpaceContext SMikkTSpaceContext;
 
-typedef struct
-{
+typedef struct {
        // Returns the number of faces (triangles/quads) on the mesh to be processed.
        int (*m_getNumFaces)(const SMikkTSpaceContext * pContext);
 
index 3475ef532da5ccb52e91aee8e6cae7bcc6d535c7..bcda970e60c93001af960ffea5845fb2517eac07 100644 (file)
@@ -69,8 +69,7 @@ struct CollisionTree;
  * own connectivity of the mesh based on the actual edges in the mesh.
  *
  */
-typedef struct Cloth
-{
+typedef struct Cloth {
        struct ClothVertex      *verts;                 /* The vertices that represent this cloth. */
        struct  LinkNode        *springs;               /* The springs connecting the mesh. */
        unsigned int            numverts;               /* The number of verts == m * n. */
@@ -91,8 +90,7 @@ typedef struct Cloth
 /**
  * The definition of a cloth vertex.
  */
-typedef struct ClothVertex
-{
+typedef struct ClothVertex {
        int     flags;          /* General flags per vertex.            */
        float   v[3];           /* The velocity of the point.           */
        float   xconst[3];      /* constrained position                 */
@@ -117,8 +115,7 @@ ClothVertex;
 /**
  * The definition of a spring.
  */
-typedef struct ClothSpring
-{
+typedef struct ClothSpring {
        int     ij;             /* Pij from the paper, one end of the spring.   */
        int     kl;             /* Pkl from the paper, one end of the spring.   */
        float   restlen;        /* The original length of the spring.   */
@@ -149,8 +146,7 @@ ClothSpring;
 
 /* SIMULATION FLAGS: goal flags,.. */
 /* These are the bits used in SimSettings.flags. */
-typedef enum
-{
+typedef enum {
        CLOTH_SIMSETTINGS_FLAG_COLLOBJ = ( 1 << 2 ),// object is only collision object, no cloth simulation is done
        CLOTH_SIMSETTINGS_FLAG_GOAL = ( 1 << 3 ),       // we have goals enabled
        CLOTH_SIMSETTINGS_FLAG_TEARING = ( 1 << 4 ),// true if tearing is enabled
@@ -160,15 +156,13 @@ typedef enum
 } CLOTH_SIMSETTINGS_FLAGS;
 
 /* COLLISION FLAGS */
-typedef enum
-{
+typedef enum {
        CLOTH_COLLSETTINGS_FLAG_ENABLED = ( 1 << 1 ), /* enables cloth - object collisions */
        CLOTH_COLLSETTINGS_FLAG_SELF = ( 1 << 2 ), /* enables selfcollisions */
 } CLOTH_COLLISIONSETTINGS_FLAGS;
 
 /* Spring types as defined in the paper.*/
-typedef enum
-{
+typedef enum {
        CLOTH_SPRING_TYPE_STRUCTURAL  = (1 << 1),
        CLOTH_SPRING_TYPE_SHEAR       = (1 << 2),
        CLOTH_SPRING_TYPE_BENDING     = (1 << 3),
@@ -176,8 +170,7 @@ typedef enum
 } CLOTH_SPRING_TYPES;
 
 /* SPRING FLAGS */
-typedef enum
-{
+typedef enum {
        CLOTH_SPRING_FLAG_DEACTIVATE = ( 1 << 1 ),
        CLOTH_SPRING_FLAG_NEEDED = ( 1 << 2 ), // springs has values to be applied
 } CLOTH_SPRINGS_FLAGS;
@@ -230,16 +223,14 @@ int cloth_add_spring (struct ClothModifierData *clmd, unsigned int indexA, unsig
 
 /* This enum provides the IDs for our solvers. */
 // only one available in the moment
-typedef enum
-{
+typedef enum {
        CM_IMPLICIT = 0,
 } CM_SOLVER_ID;
 
 
 /* This structure defines how to call the solver.
  */
-typedef struct
-{
+typedef struct {
        const char              *name;
        CM_SOLVER_ID    id;
        int     ( *init ) (struct Object *ob, struct ClothModifierData *clmd );
index 191056571c0f2127c8ebcc4d9e13f7db9b24da60..ec257a2f394bc1a1e7c6d6bcc1ffc43ef3b4210c 100644 (file)
@@ -59,8 +59,7 @@ struct LinkNode;
 ////////////////////////////////////////
 
 /* COLLISION FLAGS */
-typedef enum
-{
+typedef enum {
        COLLISION_IN_FUTURE =       (1 << 1),
 #ifdef WITH_ELTOPO
        COLLISION_USE_COLLFACE =    (1 << 2),
index bbe68db8bfe93cd5153f08cbcc3f0fc87b817e4d..3dc68edf12b37a09856c6b5ff6919fbcca8b7a13 100644 (file)
@@ -321,6 +321,7 @@ void CustomData_to_bmeshpoly(struct CustomData *fdata, struct CustomData *pdata,
                              struct CustomData *ldata, int totloop, int totpoly);
 void CustomData_from_bmeshpoly(struct CustomData *fdata, struct CustomData *pdata, struct CustomData *ldata, int total);
 void CustomData_bmesh_update_active_layers(struct CustomData *fdata, struct CustomData *pdata, struct CustomData *ldata);
+void CustomData_bmesh_do_versions_update_active_layers(struct CustomData *fdata, struct CustomData *pdata, struct CustomData *ldata);
 void CustomData_bmesh_init_pool(struct CustomData *data, int totelem, const char htype);
 
 /* External file storage */
index 19feb4d8f2ec46f9c49347c850fe2970e83bae7f..a93e811557a72629c6fa6780177984b29940cc89 100644 (file)
@@ -122,15 +122,17 @@ void BKE_mask_update_display(struct Mask *mask, float ctime);
 void BKE_mask_evaluate_all_masks(struct Main *bmain, float ctime, const int do_newframe);
 void BKE_mask_update_scene(struct Main *bmain, struct Scene *scene, const int do_newframe);
 void BKE_mask_parent_init(struct MaskParent *parent);
-void BKE_mask_calc_handle_adjacent_interp(struct Mask *mask, struct MaskSpline *spline, struct MaskSplinePoint *point,
-                                          const float u);
-void BKE_mask_calc_tangent_polyline(struct Mask *mask, struct MaskSpline *spline, struct MaskSplinePoint *point, float t[2]);
-void BKE_mask_calc_handle_point(struct Mask *mask, struct MaskSpline *spline, struct MaskSplinePoint *point);
-void BKE_mask_calc_handle_point_auto(struct Mask *mask, struct MaskSpline *spline, struct MaskSplinePoint *point,
+void BKE_mask_calc_handle_adjacent_interp(struct MaskSpline *spline, struct MaskSplinePoint *point, const float u);
+void BKE_mask_calc_tangent_polyline(struct MaskSpline *spline, struct MaskSplinePoint *point, float t[2]);
+void BKE_mask_calc_handle_point(struct MaskSpline *spline, struct MaskSplinePoint *point);
+void BKE_mask_calc_handle_point_auto(struct MaskSpline *spline, struct MaskSplinePoint *point,
                                      const short do_recalc_length);
-void BKE_mask_get_handle_point_adjacent(struct Mask *mask, struct MaskSpline *spline, struct MaskSplinePoint *point,
+void BKE_mask_get_handle_point_adjacent(struct MaskSpline *spline, struct MaskSplinePoint *point,
                                         struct MaskSplinePoint **r_point_prev, struct MaskSplinePoint **r_point_next);
+void BKE_mask_layer_calc_handles(struct MaskLayer *masklay);
+void BKE_mask_layer_calc_handles_deform(struct MaskLayer *masklay);
 void BKE_mask_calc_handles(struct Mask *mask);
+void BKE_mask_calc_handles_deform(struct Mask *mask);
 void BKE_mask_spline_ensure_deform(struct MaskSpline *spline);
 
 /* animation */
index 1878e43f577af754a8f4cd17ae1fa5f5cb804cd8..887340622ad99922c3988d87bf71c9e46ecfd6aa 100644 (file)
@@ -151,6 +151,7 @@ void copy_dverts(struct MDeformVert *dst, struct MDeformVert *src, int totvert);
 void BKE_mesh_delete_material_index(struct Mesh *me, short index);
 void BKE_mesh_smooth_flag_set(struct Object *meshOb, int enableSmooth);
 void BKE_mesh_convert_mfaces_to_mpolys(struct Mesh *mesh);
+void BKE_mesh_do_versions_convert_mfaces_to_mpolys(struct Mesh *mesh);
 void BKE_mesh_convert_mfaces_to_mpolys_ex(struct ID *id,
                                           struct CustomData *fdata, struct CustomData *ldata, struct CustomData *pdata,
                                           int totedge_i, int totface_i, int totloop_i, int totpoly_i,
index 351cb7dbb8b9cf6e6efb08f75d2e68cdcb9c8eb0..eaaa1d8b62edcfa1ce508b2b7f8a875e5e072859 100644 (file)
@@ -266,8 +266,7 @@ struct bNodeTreeExec;
 
 typedef void (*bNodeTreeCallback)(void *calldata, struct ID *owner_id, struct bNodeTree *ntree);
 typedef void (*bNodeClassCallback)(void *calldata, int nclass, const char *name);
-typedef struct bNodeTreeType
-{
+typedef struct bNodeTreeType {
        int type;                                               /* type identifier */
        char idname[64];                                /* id name for RNA identification */
        
index 50ee1184b3edc34ac0f12881e790a1e874a369b1..ed7ce05506d1465f9cec1f5593cd0a15171a8823 100644 (file)
  *  \ingroup bke
  */
 
-typedef enum SK_PType
-{
+typedef enum SK_PType {
        PT_CONTINUOUS,
        PT_EXACT,
 } SK_PType;
 
-typedef enum SK_PMode
-{
+typedef enum SK_PMode {
        PT_SNAP,
        PT_PROJECT,
 } SK_PMode;
index 5dc50dca45ad01066494e3ab85c60b5c4f79de6f..f551b2d18a4a3792cf3234202ebce057a2b4da96 100644 (file)
@@ -2219,6 +2219,48 @@ void CustomData_bmesh_update_active_layers(CustomData *fdata, CustomData *pdata,
        }
 }
 
+/* update active indices for active/render/clone/stencil custom data layers
+ * based on indices from fdata layers
+ * used by do_versions in readfile.c when creating pdata and ldata for pre-bmesh
+ * meshes and needed to preserve active/render/clone/stencil flags set in pre-bmesh files
+ */
+void CustomData_bmesh_do_versions_update_active_layers(CustomData *fdata, CustomData *pdata, CustomData *ldata)
+{
+       int act;
+
+       if (CustomData_has_layer(fdata, CD_MTFACE)) {
+               act = CustomData_get_active_layer(fdata, CD_MTFACE);
+               CustomData_set_layer_active(pdata, CD_MTEXPOLY, act);
+               CustomData_set_layer_active(ldata, CD_MLOOPUV, act);
+
+               act = CustomData_get_render_layer(fdata, CD_MTFACE);
+               CustomData_set_layer_render(pdata, CD_MTEXPOLY, act);
+               CustomData_set_layer_render(ldata, CD_MLOOPUV, act);
+
+               act = CustomData_get_clone_layer(fdata, CD_MTFACE);
+               CustomData_set_layer_clone(pdata, CD_MTEXPOLY, act);
+               CustomData_set_layer_clone(ldata, CD_MLOOPUV, act);
+
+               act = CustomData_get_stencil_layer(fdata, CD_MTFACE);
+               CustomData_set_layer_stencil(pdata, CD_MTEXPOLY, act);
+               CustomData_set_layer_stencil(ldata, CD_MLOOPUV, act);
+       }
+
+       if (CustomData_has_layer(fdata, CD_MCOL)) {
+               act = CustomData_get_active_layer(fdata, CD_MCOL);
+               CustomData_set_layer_active(ldata, CD_MLOOPCOL, act);
+
+               act = CustomData_get_render_layer(fdata, CD_MCOL);
+               CustomData_set_layer_render(ldata, CD_MLOOPCOL, act);
+
+               act = CustomData_get_clone_layer(fdata, CD_MCOL);
+               CustomData_set_layer_clone(ldata, CD_MLOOPCOL, act);
+
+               act = CustomData_get_stencil_layer(fdata, CD_MCOL);
+               CustomData_set_layer_stencil(ldata, CD_MLOOPCOL, act);
+       }
+}
+
 void CustomData_bmesh_init_pool(CustomData *data, int totelem, const char htype)
 {
        int chunksize;
index d4861a270578b1dba2191905cd44f08ed912a71b..4aef47159df2bd37aec1a1a30adb29cdf07e4afc 100644 (file)
@@ -695,8 +695,7 @@ DO_INLINE void subadd_bfmatrixS_bfmatrixS( fmatrix3x3 *to, fmatrix3x3 *from, flo
 ///////////////////////////////////////////////////////////////////
 // simulator start
 ///////////////////////////////////////////////////////////////////
-typedef struct Implicit_Data 
-{
+typedef struct Implicit_Data  {
        lfVector *X, *V, *Xnew, *Vnew, *olddV, *F, *B, *dV, *z;
        fmatrix3x3 *A, *dFdV, *dFdX, *S, *P, *Pinv, *bigI, *M; 
 } Implicit_Data;
index aaefa558c9ba9663c274cb7511c091d6088ce4f0..0a6063a6b21fdd73a903adbbe1f5b6dbbe4b6f97 100644 (file)
@@ -1228,26 +1228,25 @@ static void mask_calc_point_handle(MaskSplinePoint *point, MaskSplinePoint *poin
 #endif
 }
 
-void BKE_mask_get_handle_point_adjacent(Mask *UNUSED(mask), MaskSpline *spline, MaskSplinePoint *point,
+void BKE_mask_get_handle_point_adjacent(MaskSpline *spline, MaskSplinePoint *point,
                                         MaskSplinePoint **r_point_prev, MaskSplinePoint **r_point_next)
 {
-       int i = (int)(point - spline->points);
-       BLI_assert(i >= i && i < spline->tot_point);
-       (void)i; /* quiet release builds */
+       /* TODO, could avoid calling this at such low level */
+       MaskSplinePoint *points_array = BKE_mask_spline_point_array_from_point(spline, point);
 
-       *r_point_prev = mask_spline_point_prev(spline, spline->points, point);
-       *r_point_next = mask_spline_point_next(spline, spline->points, point);
+       *r_point_prev = mask_spline_point_prev(spline, points_array, point);
+       *r_point_next = mask_spline_point_next(spline, points_array, point);
 }
 
 /* calculates the tanget of a point by its previous and next
  * (ignoring handles - as if its a poly line) */
-void BKE_mask_calc_tangent_polyline(Mask *mask, MaskSpline *spline, MaskSplinePoint *point, float t[2])
+void BKE_mask_calc_tangent_polyline(MaskSpline *spline, MaskSplinePoint *point, float t[2])
 {
        float tvec_a[2], tvec_b[2];
 
        MaskSplinePoint *point_prev, *point_next;
 
-       BKE_mask_get_handle_point_adjacent(mask, spline, point,
+       BKE_mask_get_handle_point_adjacent(spline, point,
                                           &point_prev, &point_next);
 
        if (point_prev) {
@@ -1270,11 +1269,11 @@ void BKE_mask_calc_tangent_polyline(Mask *mask, MaskSpline *spline, MaskSplinePo
        normalize_v2(t);
 }
 
-void BKE_mask_calc_handle_point(Mask *mask, MaskSpline *spline, MaskSplinePoint *point)
+void BKE_mask_calc_handle_point(MaskSpline *spline, MaskSplinePoint *point)
 {
        MaskSplinePoint *point_prev, *point_next;
 
-       BKE_mask_get_handle_point_adjacent(mask, spline, point,
+       BKE_mask_get_handle_point_adjacent(spline, point,
                                           &point_prev, &point_next);
 
        mask_calc_point_handle(point, point_prev, point_next);
@@ -1291,7 +1290,7 @@ static void enforce_dist_v2_v2fl(float v1[2], const float v2[2], const float dis
        }
 }
 
-void BKE_mask_calc_handle_adjacent_interp(Mask *mask, MaskSpline *spline, MaskSplinePoint *point, const float u)
+void BKE_mask_calc_handle_adjacent_interp(MaskSpline *spline, MaskSplinePoint *point, const float u)
 {
        /* TODO! - make this interpolate between siblings - not always midpoint! */
        int length_tot = 0;
@@ -1303,7 +1302,7 @@ void BKE_mask_calc_handle_adjacent_interp(Mask *mask, MaskSpline *spline, MaskSp
 
        BLI_assert(u >= 0.0f && u <= 1.0f);
 
-       BKE_mask_get_handle_point_adjacent(mask, spline, point,
+       BKE_mask_get_handle_point_adjacent(spline, point,
                                           &point_prev, &point_next);
 
        if (point_prev && point_next) {
@@ -1344,7 +1343,7 @@ void BKE_mask_calc_handle_adjacent_interp(Mask *mask, MaskSpline *spline, MaskSp
  *
  * Useful for giving sane defaults.
  */
-void BKE_mask_calc_handle_point_auto(Mask *mask, MaskSpline *spline, MaskSplinePoint *point,
+void BKE_mask_calc_handle_point_auto(MaskSpline *spline, MaskSplinePoint *point,
                                      const short do_recalc_length)
 {
        MaskSplinePoint *point_prev, *point_next;
@@ -1353,7 +1352,7 @@ void BKE_mask_calc_handle_point_auto(Mask *mask, MaskSpline *spline, MaskSplineP
                                     (len_v3v3(point->bezt.vec[0], point->bezt.vec[1]) +
                                      len_v3v3(point->bezt.vec[1], point->bezt.vec[2])) / 2.0f;
 
-       BKE_mask_get_handle_point_adjacent(mask, spline, point,
+       BKE_mask_get_handle_point_adjacent(spline, point,
                                           &point_prev, &point_next);
 
        point->bezt.h1 = HD_AUTO;
@@ -1370,25 +1369,33 @@ void BKE_mask_calc_handle_point_auto(Mask *mask, MaskSpline *spline, MaskSplineP
        }
 }
 
+void BKE_mask_layer_calc_handles(MaskLayer *masklay)
+{
+       MaskSpline *spline;
+       for (spline = masklay->splines.first; spline; spline = spline->next) {
+               int i;
+               for (i = 0; i < spline->tot_point; i++) {
+                       BKE_mask_calc_handle_point(spline, &spline->points[i]);
+               }
+       }
+}
+
+void BKE_mask_layer_calc_handles_deform(MaskLayer *masklay)
+{
+       MaskSpline *spline;
+       for (spline = masklay->splines.first; spline; spline = spline->next) {
+               int i;
+               for (i = 0; i < spline->tot_point; i++) {
+                       BKE_mask_calc_handle_point(spline, &spline->points_deform[i]);
+               }
+       }
+}
+
 void BKE_mask_calc_handles(Mask *mask)
 {
        MaskLayer *masklay;
-
        for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
-               MaskSpline *spline;
-
-               for (spline = masklay->splines.first; spline; spline = spline->next) {
-                       int i;
-
-                       for (i = 0; i < spline->tot_point; i++) {
-                               BKE_mask_calc_handle_point(mask, spline, &spline->points[i]);
-
-                               /* could be done in a different function... */
-                               if (spline->points_deform) {
-                                       BKE_mask_calc_handle_point(mask, spline, &spline->points[i]);
-                               }
-                       }
-               }
+               BKE_mask_layer_calc_handles(masklay);
        }
 }
 
@@ -1501,9 +1508,10 @@ void BKE_mask_evaluate(Mask *mask, float ctime, const int do_newframe)
 
        for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
                MaskSpline *spline;
-               int i;
 
                for (spline = masklay->splines.first; spline; spline = spline->next) {
+                       int i;
+                       int has_auto = FALSE;
 
                        BKE_mask_spline_ensure_deform(spline);
 
@@ -1522,7 +1530,22 @@ void BKE_mask_evaluate(Mask *mask, float ctime, const int do_newframe)
                                        add_v2_v2(point_deform->bezt.vec[1], delta);
                                        add_v2_v2(point_deform->bezt.vec[2], delta);
                                }
+
+                               if (point->bezt.h1 == HD_AUTO) {
+                                       has_auto = TRUE;
+                               }
+                       }
+
+                       /* if the spline has auto handles, these need to be recalculated after deformation */
+                       if (has_auto) {
+                               for (i = 0; i < spline->tot_point; i++) {
+                                       MaskSplinePoint *point_deform = &spline->points_deform[i];
+                                       if (point_deform->bezt.h1 == HD_AUTO) {
+                                               BKE_mask_calc_handle_point(spline, point_deform);
+                                       }
+                               }
                        }
+                       /* end extra calc handles loop */
                }
        }
 }
index ed93f27fe5ced4b2b69629482f3eb56b4d715fa7..d0b9e73e29597b06966e8e33dc98676ea129e6a3 100644 (file)
@@ -2038,6 +2038,28 @@ void BKE_mesh_convert_mfaces_to_mpolys(Mesh *mesh)
        mesh_update_customdata_pointers(mesh, TRUE);
 }
 
+/* the same as BKE_mesh_convert_mfaces_to_mpolys but oriented to be used in do_versions from readfile.c
+ * the difference is how active/render/clone/stencil indices are handled here
+ *
+ * normally thay're being set from pdata which totally makes sense for meshes which are already
+ * converted to bmesh structures, but when loading older files indices shall be updated in other
+ * way around, so newly added pdata and ldata would have this indices set based on fdata layer
+ *
+ * this is normally only needed when reading older files, in all other cases BKE_mesh_convert_mfaces_to_mpolys
+ * shall be always used
+ */
+void BKE_mesh_do_versions_convert_mfaces_to_mpolys(Mesh *mesh)
+{
+       BKE_mesh_convert_mfaces_to_mpolys_ex(&mesh->id, &mesh->fdata, &mesh->ldata, &mesh->pdata,
+                                            mesh->totedge, mesh->totface, mesh->totloop, mesh->totpoly,
+                                            mesh->medge, mesh->mface,
+                                            &mesh->totloop, &mesh->totpoly, &mesh->mloop, &mesh->mpoly);
+
+       CustomData_bmesh_do_versions_update_active_layers(&mesh->fdata, &mesh->pdata, &mesh->ldata);
+
+       mesh_update_customdata_pointers(mesh, TRUE);
+}
+
 void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id, CustomData *fdata, CustomData *ldata, CustomData *pdata,
                                           int totedge_i, int totface_i, int totloop_i, int totpoly_i,
                                           MEdge *medge, MFace *mface,
index 04631729d7a718c4fb016af9843c9118e3d8e187..a01024acfd30da67241db0c55dd00f3ee8da8706 100644 (file)
 #include "GPU_material.h"
 
 /* Local function protos */
-static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[][4], float slowmat[][4], int simul);
-
 float originmat[3][3];  /* after BKE_object_where_is_calc(), can be used in other functions (bad!) */
 
 void BKE_object_workob_clear(Object *workob)
@@ -1904,109 +1902,6 @@ static void ob_parvert3(Object *ob, Object *par, float mat[][4])
        }
 }
 
-static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[4][4])
-{
-       float *fp1, *fp2;
-       float fac1, fac2;
-       int a;
-
-       // include framerate
-       fac1 = (1.0f / (1.0f + fabsf(ob->sf)) );
-       if (fac1 >= 1.0f) return 0;
-       fac2 = 1.0f - fac1;
-
-       fp1 = obmat[0];
-       fp2 = slowmat[0];
-       for (a = 0; a < 16; a++, fp1++, fp2++) {
-               fp1[0] = fac1 * fp1[0] + fac2 * fp2[0];
-       }
-
-       return 1;
-}
-
-void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime)
-{
-       float slowmat[4][4] = MAT4_UNITY;
-       float stime = ctime;
-       
-       /* new version: correct parent+vertexparent and track+parent */
-       /* this one only calculates direct attached parent and track */
-       /* is faster, but should keep track of timeoffs */
-       
-       if (ob == NULL) return;
-       
-       /* execute drivers only, as animation has already been done */
-       BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, ctime, ADT_RECALC_DRIVERS);
-       
-       if (ob->parent) {
-               Object *par = ob->parent;
-               
-               /* hurms, code below conflicts with depgraph... (ton) */
-               /* and even worse, it gives bad effects for NLA stride too (try ctime != par->ctime, with MBlur) */
-               if (stime != par->ctime) {
-                       // only for ipo systems? 
-                       Object tmp = *par;
-                       
-                       if (par->proxy_from) ;  // was a copied matrix, no where_is! bad...
-                       else BKE_object_where_is_calc_time(scene, par, ctime);
-                       
-                       solve_parenting(scene, ob, par, ob->obmat, slowmat, 0);
-                       
-                       *par = tmp;
-               }
-               else
-                       solve_parenting(scene, ob, par, ob->obmat, slowmat, 0);
-               
-               /* "slow parent" is definitely not threadsafe, and may also give bad results jumping around 
-                * An old-fashioned hack which probably doesn't really cut it anymore
-                */
-               if (ob->partype & PARSLOW) {
-                       if (!where_is_object_parslow(ob, ob->obmat, slowmat))
-                               return;
-               }
-       }
-       else {
-               BKE_object_to_mat4(ob, ob->obmat);
-       }
-
-       /* solve constraints */
-       if (ob->constraints.first && !(ob->transflag & OB_NO_CONSTRAINTS)) {
-               bConstraintOb *cob;
-               
-               cob = constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
-               
-               /* constraints need ctime, not stime. Some call BKE_object_where_is_calc_time and bsystem_time */
-               solve_constraints(&ob->constraints, cob, ctime);
-               
-               constraints_clear_evalob(cob);
-       }
-       
-       /* set negative scale flag in object */
-       if (is_negative_m4(ob->obmat)) ob->transflag |= OB_NEG_SCALE;
-       else ob->transflag &= ~OB_NEG_SCALE;
-}
-
-/* get object transformation matrix without recalculating dependencies and
- * constraints -- assume dependencies are already solved by depsgraph.
- * no changes to object and it's parent would be done.
- * used for bundles orientation in 3d space relative to parented blender camera */
-void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4])
-{
-       float slowmat[4][4] = MAT4_UNITY;
-
-       if (ob->parent) {
-               Object *par = ob->parent;
-
-               solve_parenting(scene, ob, par, obmat, slowmat, 1);
-
-               if (ob->partype & PARSLOW)
-                       where_is_object_parslow(ob, obmat, slowmat);
-       }
-       else {
-               BKE_object_to_mat4(ob, obmat);
-       }
-}
-
 static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[][4], float slowmat[][4], int simul)
 {
        float totmat[4][4];
@@ -2028,11 +1923,11 @@ static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[]
                                        ok = 1;
                                }
                        }
-               
+                       
                        if (ok) mul_serie_m4(totmat, par->obmat, tmat,
                                                 NULL, NULL, NULL, NULL, NULL, NULL);
                        else copy_m4_m4(totmat, par->obmat);
-               
+                       
                        break;
                case PARBONE:
                        ob_parbone(ob, par, tmat);
@@ -2052,7 +1947,7 @@ static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[]
                        break;
                case PARVERT3:
                        ob_parvert3(ob, par, tmat);
-               
+                       
                        mul_serie_m4(totmat, par->obmat, tmat,
                                     NULL, NULL, NULL, NULL, NULL, NULL);
                        break;
@@ -2083,7 +1978,87 @@ static void solve_parenting(Scene *scene, Object *ob, Object *par, float obmat[]
                        copy_v3_v3(ob->orig, totmat[3]);
                }
        }
+}
+
+static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[4][4])
+{
+       float *fp1, *fp2;
+       float fac1, fac2;
+       int a;
+
+       // include framerate
+       fac1 = (1.0f / (1.0f + fabsf(ob->sf)) );
+       if (fac1 >= 1.0f) return 0;
+       fac2 = 1.0f - fac1;
+
+       fp1 = obmat[0];
+       fp2 = slowmat[0];
+       for (a = 0; a < 16; a++, fp1++, fp2++) {
+               fp1[0] = fac1 * fp1[0] + fac2 * fp2[0];
+       }
+
+       return 1;
+}
+
+void BKE_object_where_is_calc_time(Scene *scene, Object *ob, float ctime)
+{
+       if (ob == NULL) return;
+       
+       /* execute drivers only, as animation has already been done */
+       BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, ctime, ADT_RECALC_DRIVERS);
+       
+       if (ob->parent) {
+               Object *par = ob->parent;
+               float slowmat[4][4] = MAT4_UNITY;
+               
+               /* calculate parent matrix */
+               solve_parenting(scene, ob, par, ob->obmat, slowmat, 0);
+               
+               /* "slow parent" is definitely not threadsafe, and may also give bad results jumping around 
+                * An old-fashioned hack which probably doesn't really cut it anymore
+                */
+               if (ob->partype & PARSLOW) {
+                       if (!where_is_object_parslow(ob, ob->obmat, slowmat))
+                               return;
+               }
+       }
+       else {
+               BKE_object_to_mat4(ob, ob->obmat);
+       }
+       
+       /* solve constraints */
+       if (ob->constraints.first && !(ob->transflag & OB_NO_CONSTRAINTS)) {
+               bConstraintOb *cob;
+               
+               cob = constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
+               solve_constraints(&ob->constraints, cob, ctime);
+               constraints_clear_evalob(cob);
+       }
+       
+       /* set negative scale flag in object */
+       if (is_negative_m4(ob->obmat)) ob->transflag |= OB_NEG_SCALE;
+       else ob->transflag &= ~OB_NEG_SCALE;
+}
 
+/* get object transformation matrix without recalculating dependencies and
+ * constraints -- assume dependencies are already solved by depsgraph.
+ * no changes to object and it's parent would be done.
+ * used for bundles orientation in 3d space relative to parented blender camera */
+void BKE_object_where_is_calc_mat4(Scene *scene, Object *ob, float obmat[4][4])
+{
+       float slowmat[4][4] = MAT4_UNITY;
+
+       if (ob->parent) {
+               Object *par = ob->parent;
+               
+               solve_parenting(scene, ob, par, obmat, slowmat, 1);
+               
+               if (ob->partype & PARSLOW)
+                       where_is_object_parslow(ob, obmat, slowmat);
+       }
+       else {
+               BKE_object_to_mat4(ob, obmat);
+       }
 }
 
 void BKE_object_where_is_calc(struct Scene *scene, Object *ob)
@@ -2091,7 +2066,6 @@ void BKE_object_where_is_calc(struct Scene *scene, Object *ob)
        BKE_object_where_is_calc_time(scene, ob, (float)scene->r.cfra);
 }
 
-
 void BKE_object_where_is_calc_simul(Scene *scene, Object *ob)
 /* was written for the old game engine (until 2.04) */
 /* It seems that this function is only called
index f19dfe74a36028a9d65cc5b8be5c02e3cc81eb8a..6c7336958b54241960a235aea1236da51f759f00 100644 (file)
@@ -2363,13 +2363,12 @@ static EdgeHash *sph_springhash_build(ParticleSystem *psys)
 }
 
 #define SPH_NEIGHBORS 512
-typedef struct SPHNeighbor
-{
+typedef struct SPHNeighbor {
        ParticleSystem *psys;
        int index;
 } SPHNeighbor;
-typedef struct SPHRangeData
-{
+
+typedef struct SPHRangeData {
        SPHNeighbor neighbors[SPH_NEIGHBORS];
        int tot_neighbors;
 
@@ -2641,8 +2640,7 @@ static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float d
 /************************************************/
 /*                     Basic physics                                           */
 /************************************************/
-typedef struct EfData
-{
+typedef struct EfData {
        ParticleTexture ptex;
        ParticleSimulationData *sim;
        ParticleData *pa;
index d9f1a6372ee6e7d8ed6d1909b22d9151ce28d2eb..1113555e3bfc9d1a6ec82929f225db6e80d625f5 100644 (file)
@@ -610,8 +610,6 @@ void BKE_scene_set_background(Main *bmain, Scene *scene)
                /* not too nice... for recovering objects with lost data */
                //if (ob->pose == NULL) base->flag &= ~OB_POSEMODE;
                ob->flag = base->flag;
-               
-               ob->ctime = -1234567.0;  /* force ipo to be calculated later */
        }
        /* no full animation update, this to enable render code to work (render code calls own animation updates) */
 }
index f1f3dd47d8ba71807bc50de0203ddf561d9a74e5..ea4699f8495368a1125f2133fa4d8c93071f6b47 100644 (file)
@@ -38,8 +38,7 @@
 
 #include "IMB_moviecache.h"
 
-typedef struct seqCacheKey 
-{
+typedef struct seqCacheKey {
        struct Sequence * seq;
        SeqRenderData context;
        float cfra;
index 588a6826919b110331d4742a236ced08ed25cc1a..cc5abce64f3c886735b81ce65c60c64a79f0081e 100644 (file)
@@ -3684,7 +3684,7 @@ static void lib_link_mesh(FileData *fd, Main *main)
                                Main *gmain = G.main;
                                G.main = main;
                                
-                               BKE_mesh_convert_mfaces_to_mpolys(me);
+                               BKE_mesh_do_versions_convert_mfaces_to_mpolys(me);
                                
                                G.main = gmain;
                        }
index 12ebaedac60fd52c180ef62a360fc00ceb3e799c..406971652dc14b0107aaa736f2cc1867295226ec 100644 (file)
@@ -27,8 +27,7 @@
  *  \ingroup bmesh
  */
 
-typedef struct BMEditSelection
-{
+typedef struct BMEditSelection {
        struct BMEditSelection *next, *prev;
        BMElem *ele;
        char htype;
@@ -82,7 +81,7 @@ void    BM_editselection_plane(BMEditSelection *ese,  float r_plane[3]);
 #define BM_select_history_store_notest(bm, ele) _bm_select_history_store_notest(bm, &(ele)->head)
 #define BM_select_history_store(bm, ele)        _bm_select_history_store(bm,        &(ele)->head)
 
-int  _bm_select_history_check(BMesh *bm, const  BMHeader *ele);
+int  _bm_select_history_check(BMesh *bm,  const BMHeader *ele);
 int  _bm_select_history_remove(BMesh *bm,       BMHeader *ele);
 void _bm_select_history_store_notest(BMesh *bm, BMHeader *ele);
 void _bm_select_history_store(BMesh *bm,        BMHeader *ele);
index d90bd96a6f18f3cd61d3282ee19f81fda72b805e..91c342ec070619ce1ed3f7c5804a6e8244d6e20a 100644 (file)
@@ -81,20 +81,17 @@ typedef struct RetargetParam {
        bContext    *context;
 } RetargetParam;
 
-typedef enum 
-{
+typedef enum  {
        RETARGET_LENGTH,
        RETARGET_AGGRESSIVE
 } RetargetMode; 
 
-typedef enum
-{
+typedef enum {
        METHOD_BRUTE_FORCE = 0,
        METHOD_MEMOIZE = 1
 } RetargetMethod;
 
-typedef enum
-{
+typedef enum {
        ARC_FREE = 0,
        ARC_TAKEN = 1,
        ARC_USED = 2
index c4d7197bfa1f8a69b19a29698450dd9970fab789..42036d1ea1714958ab5ff871b01ca094c506536e 100644 (file)
@@ -168,8 +168,7 @@ typedef struct DepthPeel {
 
 struct ListBase;
 
-typedef enum SnapMode
-{
+typedef enum SnapMode {
        SNAP_ALL = 0,
        SNAP_NOT_SELECTED = 1,
        SNAP_NOT_OBEDIT = 2
index f8c36e866d7355fb0c2077f7ff603b7e50df3169..7ffff2b06e58f3a9d85f53bd61c0e15ab234d66b 100644 (file)
@@ -235,7 +235,7 @@ static void setup_vertex_point(bContext *C, Mask *mask, MaskSpline *spline, Mask
                add_v2_v2(bezt->vec[2], vec);
 
                if (reference_adjacent) {
-                       BKE_mask_calc_handle_adjacent_interp(mask, spline, new_point, u);
+                       BKE_mask_calc_handle_adjacent_interp(spline, new_point, u);
                }
        }
        else {
@@ -287,8 +287,8 @@ static void setup_vertex_point(bContext *C, Mask *mask, MaskSpline *spline, Mask
                add_v2_v2(bezt->vec[0], vec);
                sub_v2_v2(bezt->vec[2], vec);
 #else
-               BKE_mask_calc_handle_point_auto(mask, spline, new_point, TRUE);
-               BKE_mask_calc_handle_adjacent_interp(mask, spline, new_point, u);
+               BKE_mask_calc_handle_point_auto(spline, new_point, TRUE);
+               BKE_mask_calc_handle_adjacent_interp(spline, new_point, u);
 
 #endif
        }
@@ -425,7 +425,7 @@ static int add_vertex_extrude(bContext *C, Mask *mask, MaskLayer *masklay, const
        if ((spline->flag & MASK_SPLINE_CYCLIC) ||
            (point_index > 0 && point_index != spline->tot_point - 1))
        {
-               BKE_mask_calc_tangent_polyline(mask, spline, point, tangent_point);
+               BKE_mask_calc_tangent_polyline(spline, point, tangent_point);
                sub_v2_v2v2(tangent_co, co, point->bezt.vec[1]);
 
                if (dot_v2v2(tangent_point, tangent_co) < 0.0f) {
@@ -487,7 +487,7 @@ static int add_vertex_extrude(bContext *C, Mask *mask, MaskLayer *masklay, const
 
        if (do_recalc_src) {
                /* TODO, update keyframes in time */
-               BKE_mask_calc_handle_point_auto(mask, spline, ref_point, FALSE);
+               BKE_mask_calc_handle_point_auto(spline, ref_point, FALSE);
        }
 
        WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
@@ -572,8 +572,8 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
                                spline->flag |= MASK_SPLINE_CYCLIC;
 
                                /* TODO, update keyframes in time */
-                               BKE_mask_calc_handle_point_auto(mask, spline, point, FALSE);
-                               BKE_mask_calc_handle_point_auto(mask, spline, point_other, FALSE);
+                               BKE_mask_calc_handle_point_auto(spline, point, FALSE);
+                               BKE_mask_calc_handle_point_auto(spline, point_other, FALSE);
 
                                /* TODO: only update this spline */
                                BKE_mask_update_display(mask, CTX_data_scene(C)->r.cfra);
index d84214413da6916170755979d879dd805897c4b8..a535e8881565eb26ada9f20c85eb2de03a69d8c5 100644 (file)
@@ -102,8 +102,7 @@ typedef struct ThumbnailJob {
        ReportList reports;
 } ThumbnailJob;
 
-typedef struct FileList
-{
+typedef struct FileList {
        struct direntry *filelist;
        int *fidx;
        int numfiles;
@@ -124,8 +123,7 @@ typedef struct FileList
 
 } FileList;
 
-typedef struct FolderList
-{
+typedef struct FolderList {
        struct FolderList *next, *prev;
        char *foldername;
 } FolderList;
index fac6a387b9f703f61fac6b381226cacdfef003a8..7a37c5fb3c58fc934bea9d4fa1dadd7f05a1e671 100644 (file)
@@ -53,8 +53,7 @@ typedef enum FileSelType {
        FILE_SEL_TOGGLE  = 2
 } FileSelType;
 
-typedef enum FileCheckType
-{
+typedef enum FileCheckType {
        CHECK_DIRS = 1,
        CHECK_FILES = 2,
        CHECK_ALL = 3
index 35b1583b24e90ca812b4ff81be1d2e3a73c91076..9e873799f1c85dc3bfbf70eddbfb69846fc90a2f 100644 (file)
@@ -50,8 +50,7 @@ struct bNodeLink;
 struct Main;
 
 /* temp data to pass on to modal */
-typedef struct bNodeLinkDrag
-{
+typedef struct bNodeLinkDrag {
        struct bNodeLinkDrag *next, *prev;
        
        /* List of links dragged by the operator.
index 547e8288d20382fa741bfcca05b5b495819430ea..483016b7e005e9eb7bd3b24dc4f7d1ddd485a693 100644 (file)
@@ -69,6 +69,9 @@
 
 #include "outliner_intern.h"
 
+/* disable - this is far too slow - campbell */
+// #define USE_GROUP_SELECT
+
 /* ****************************************************** */
 /* Tree Size Functions */
 
@@ -207,6 +210,7 @@ static int group_restrict_flag(Group *gr, int flag)
        return 1;
 }
 
+#ifdef USE_GROUP_SELECT
 static int group_select_flag(Group *gr)
 {
        GroupObject *gob;
@@ -217,6 +221,7 @@ static int group_select_flag(Group *gr)
 
        return 0;
 }
+#endif
 
 void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag)
 {      
@@ -422,16 +427,26 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
                                gr = (Group *)tselem->id;
                                
                                uiBlockSetEmboss(block, UI_EMBOSSN);
-                               
+
+#ifndef USE_GROUP_SELECT
+                               restrict_bool = FALSE;
+#endif
+
+#ifdef USE_GROUP_SELECT
                                restrict_bool = group_restrict_flag(gr, OB_RESTRICT_VIEW);
+#endif
                                bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF, (int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, NULL, 0, 0, 0, 0, "Restrict/Allow visibility in the 3D View");
                                uiButSetFunc(bt, restrictbutton_gr_restrict_view, scene, gr);
 
+#ifdef USE_GROUP_SELECT
                                restrict_bool = group_restrict_flag(gr, OB_RESTRICT_SELECT);
+#endif
                                bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_SELECT_ON : ICON_RESTRICT_SELECT_OFF, (int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, NULL, 0, 0, 0, 0, "Restrict/Allow selection in the 3D View");
                                uiButSetFunc(bt, restrictbutton_gr_restrict_select, scene, gr);
-       
+
+#ifdef USE_GROUP_SELECT
                                restrict_bool = group_restrict_flag(gr, OB_RESTRICT_RENDER);
+#endif
                                bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_RENDER_ON : ICON_RESTRICT_RENDER_OFF, (int)ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX, (int)te->ys, UI_UNIT_X - 1, UI_UNIT_Y - 1, NULL, 0, 0, 0, 0, "Restrict/Allow renderability");
                                uiButSetFunc(bt, restrictbutton_gr_restrict_render, scene, gr);
 
@@ -1274,8 +1289,8 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
                                }
                        }
                        else if (te->idcode == ID_GR) {
+#ifdef USE_GROUP_SELECT
                                Group *gr = (Group *)tselem->id;
-                               
                                if (group_select_flag(gr)) {
                                        char col[4];
                                        UI_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col);
@@ -1284,6 +1299,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene
                                        
                                        active = 2;
                                }
+#endif
                        }
                        else if (te->idcode == ID_OB) {
                                Object *ob = (Object *)tselem->id;
index b556fbf5c9d4e342512a67d54890bfebfc4664ed..e656b1242abd79c8a0e5a1cc102e6a5486db3754 100644 (file)
@@ -385,6 +385,18 @@ static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElemen
        }
 }
 
+static void group_instance_cb(bContext *C, Scene *scene, TreeElement *UNUSED(te),
+                              TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem)
+{
+       Group *group = (Group *)tselem->id;
+
+       Object *ob = ED_object_add_type(C, OB_EMPTY, scene->cursor, NULL, FALSE, scene->layact);
+       rename_id(&ob->id, group->id.name + 2);
+       ob->dup_group = group;
+       ob->transflag |= OB_DUPLIGROUP;
+       id_lib_extern(&group->id);
+}
+
 void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOops *soops, ListBase *lb, 
                                   void (*operation_cb)(bContext *C, Scene *scene, TreeElement *,
                                                        TreeStoreElem *, TreeStoreElem *))
@@ -636,13 +648,14 @@ void OUTLINER_OT_object_operation(wmOperatorType *ot)
 /* **************************************** */
 
 static EnumPropertyItem prop_group_op_types[] = {
-       {1, "UNLINK", 0, "Unlink", ""},
-       {2, "LOCAL", 0, "Make Local", ""},
-       {3, "LINK", 0, "Link Group Objects to Scene", ""},
-       {4, "TOGVIS", 0, "Toggle Visible", ""},
-       {5, "TOGSEL", 0, "Toggle Selectable", ""},
-       {6, "TOGREN", 0, "Toggle Renderable", ""},
-       {7, "RENAME", 0, "Rename", ""},
+       {0, "UNLINK",   0, "Unlink Group", ""},
+       {1, "LOCAL",    0, "Make Local Group", ""},
+       {2, "LINK",     0, "Link Group Objects to Scene", ""},
+       {3, "INSTANCE", 0, "Instance Group in Scene", ""},
+       {4, "TOGVIS",   0, "Toggle Visible Group", ""},
+       {5, "TOGSEL",   0, "Toggle Selectable", ""},
+       {6, "TOGREN",   0, "Toggle Renderable", ""},
+       {7, "RENAME",   0, "Rename", ""},
        {0, NULL, 0, NULL, NULL}
 };
 
@@ -651,45 +664,36 @@ static int outliner_group_operation_exec(bContext *C, wmOperator *op)
        Scene *scene = CTX_data_scene(C);
        SpaceOops *soops = CTX_wm_space_outliner(C);
        int event;
-       const char *str = NULL;
        
        /* check for invalid states */
        if (soops == NULL)
                return OPERATOR_CANCELLED;
        
        event = RNA_enum_get(op->ptr, "type");
-       
-       if (event == 1) {
-               outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_group_cb);
-               str = "Unlink group";
-       }
-       else if (event == 2) {
-               outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb);
-               str = "Localized Data";
-       }
-       else if (event == 3) {
-               outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_linkobs2scene_cb);
-               str = "Link Group Objects to Scene";
-       }
-       else if (event == 4) {
-               outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_visibility_cb);
-               str = "Toggle Visibility";
-       }
-       else if (event == 5) {
-               outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_selectability_cb);
-               str = "Toggle Selectability";
-       }
-       else if (event == 6) {
-               outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_renderability_cb);
-               str = "Toggle Renderability";
-       }
-       else if (event == 7) {
-               outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb);
-               str = "Rename";
+
+       switch (event) {
+               case 0: outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_group_cb); break;
+               case 1: outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb); break;
+               case 2: outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_linkobs2scene_cb); break;
+               case 3: outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_instance_cb); break;
+               case 4: outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_visibility_cb); break;
+               case 5: outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_selectability_cb); break;
+               case 6: outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_renderability_cb); break;
+               case 7: outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb); break;
+               default:
+                       BLI_assert(0);
+                       return OPERATOR_CANCELLED;
        }
        
+
+       if (event == 3) { /* instance */
+               Main *bmain = CTX_data_main(C);
+
+               /* works without this except if you try render right after, see: 22027 */
+               DAG_scene_sort(bmain, scene);
+       }
        
-       ED_undo_push(C, str);
+       ED_undo_push(C, prop_group_op_types[event].name);
        WM_event_add_notifier(C, NC_GROUP, NULL);
        
        return OPERATOR_FINISHED;
index cb8b309dc7200f9f41b17fee145a8e3589819730..7edf18136d2592015559e6c3fff5a81fbdffa482 100644 (file)
@@ -1658,7 +1658,7 @@ static void bone_matrix_translate_y(float mat[][4], float y)
 /* assumes object is Armature with pose */
 static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
                             int dt, const unsigned char ob_wire_col[4],
-                            const short is_ghost, const short is_outline)
+                            const short do_const_color, const short is_outline)
 {
        RegionView3D *rv3d = ar->regiondata;
        Object *ob = base->object;
@@ -1753,8 +1753,13 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
                                        if (bone == arm->act_bone)
                                                flag |= BONE_DRAW_ACTIVE;
                                        
-                                       /* set color-set to use */
-                                       set_pchan_colorset(ob, pchan);
+                                       if (do_const_color) {
+                                               /* keep color */
+                                       }
+                                       else {
+                                               /* set color-set to use */
+                                               set_pchan_colorset(ob, pchan);
+                                       }
                                        
                                        if (use_custom) {
                                                /* if drawwire, don't try to draw in solid */
@@ -1828,10 +1833,10 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
                                                        }
                                                        
                                                        /* prepare colors */
-                                                       if (is_ghost) {
+                                                       if (do_const_color) {
                                                                /* 13 October 2009, Disabled this to make ghosting show the right colors (Aligorith) */
                                                        }
-                                                       else if (arm->flag & ARM_POSEMODE)      
+                                                       else if (arm->flag & ARM_POSEMODE)
                                                                set_pchan_colorset(ob, pchan);
                                                        else {
                                                                glColor3ubv(ob_wire_col);
@@ -1950,7 +1955,12 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
                                        /* extra draw service for pose mode */
 
                                        /* set color-set to use */
-                                       set_pchan_colorset(ob, pchan);
+                                       if (do_const_color) {
+                                               /* keep color */
+                                       }
+                                       else {
+                                               set_pchan_colorset(ob, pchan);
+                                       }
                                        
                                        if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) {
                                                /* custom bone shapes should not be drawn here! */
@@ -1985,20 +1995,35 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
        glDisable(GL_CULL_FACE);
        
        /* draw DoFs */
-       if (arm->flag & ARM_POSEMODE)
-               draw_pose_dofs(ob);
+       if (arm->flag & ARM_POSEMODE) {
+               if (((base->flag & OB_FROMDUPLI) == 0)) {
+                       draw_pose_dofs(ob);
+               }
+       }
 
        /* finally names and axes */
-       if ((arm->flag & (ARM_DRAWNAMES | ARM_DRAWAXES)) && (is_outline == 0)) {
+       if ((arm->flag & (ARM_DRAWNAMES | ARM_DRAWAXES)) &&
+           (is_outline == 0) &&
+           ((base->flag & OB_FROMDUPLI) == 0))
+       {
                /* patch for several 3d cards (IBM mostly) that crash on GL_SELECT with text drawing */
                if ((G.f & G_PICKSEL) == 0) {
                        float vec[3];
-                       
+
                        unsigned char col[4];
-                       col[0] = ob_wire_col[0];
-                       col[1] = ob_wire_col[1];
-                       col[2] = ob_wire_col[2];
-                       col[3] = 255;
+                       if (do_const_color) {
+                               /* so we can draw bone names in current const color */
+                               float tcol[4];
+                               glGetFloatv(GL_CURRENT_COLOR, tcol);
+                               rgb_float_to_uchar(col, tcol);
+                               col[3] = 255;
+                       }
+                       else {
+                               col[0] = ob_wire_col[0];
+                               col[1] = ob_wire_col[1];
+                               col[2] = ob_wire_col[2];
+                               col[3] = 255;
+                       }
                        
                        if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
                        
@@ -2546,11 +2571,8 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
        
        if (dt > OB_WIRE && !ELEM(arm->drawtype, ARM_LINE, ARM_WIRE)) {
                /* we use color for solid lighting */
-               glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
-               glEnable(GL_COLOR_MATERIAL);
-               glColor3ub(255, 255, 255);    // clear spec
-               glDisable(GL_COLOR_MATERIAL);
-               
+               const float white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
+               glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, white);
                glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
                glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW); // only for lighting...
        }
@@ -2602,7 +2624,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
                                        }
                                }       
                        }
-                       draw_pose_bones(scene, v3d, ar, base, dt, ob_wire_col, FALSE, is_outline);
+                       draw_pose_bones(scene, v3d, ar, base, dt, ob_wire_col, (flag & DRAW_CONSTCOLOR), is_outline);
                        arm->flag &= ~ARM_POSEMODE; 
                        
                        if (ob->mode & OB_MODE_POSE)
index de1d9f2266754d4aa6820ee728e22e82e4b64294..19696b2b0e0e3b58438a31bca4d469d3f1ba4de5 100644 (file)
@@ -1015,14 +1015,14 @@ void draw_mesh_paint(View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *d
        if (ob && ob->mode & OB_MODE_WEIGHT_PAINT) {
 
                if (do_light) {
+                       const float spec[4] = {0.47f, 0.47f, 0.47f, 0.47f};
+
                        /* enforce default material settings */
                        GPU_enable_material(0, NULL);
                
                        /* but set default spec */
                        glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
-                       glEnable(GL_COLOR_MATERIAL);    /* according manpages needed */
-                       glColor3ub(120, 120, 120);
-                       glDisable(GL_COLOR_MATERIAL);
+                       glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec);
 
                        /* diffuse */
                        glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
index 63dc6c218634c2cfc3f3e15c0ca3659483f18065..63780ebbd20988683bcc3a02b5a64e457ef50fab 100644 (file)
@@ -1231,19 +1231,23 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
 
        /* lamp center */
        copy_v3_v3(vec, ob->obmat[3]);
-       
-       /* for AA effects */
-       curcol[0] = ob_wire_col[0];
-       curcol[1] = ob_wire_col[1];
-       curcol[2] = ob_wire_col[2];
-       curcol[3] = 154;
-       glColor4ubv(curcol);
+
+       if ((flag & DRAW_CONSTCOLOR) == 0) {
+               /* for AA effects */
+               curcol[0] = ob_wire_col[0];
+               curcol[1] = ob_wire_col[1];
+               curcol[2] = ob_wire_col[2];
+               curcol[3] = 154;
+               glColor4ubv(curcol);
+       }
 
        if (lampsize > 0.0f) {
 
-               if (ob->id.us > 1) {
-                       if (ob == OBACT || (ob->flag & SELECT)) glColor4ub(0x88, 0xFF, 0xFF, 155);
-                       else glColor4ub(0x77, 0xCC, 0xCC, 155);
+               if ((flag & DRAW_CONSTCOLOR) == 0) {
+                       if (ob->id.us > 1) {
+                               if (ob == OBACT || (ob->flag & SELECT)) glColor4ub(0x88, 0xFF, 0xFF, 155);
+                               else glColor4ub(0x77, 0xCC, 0xCC, 155);
+                       }
                }
                
                /* Inner Circle */
@@ -1253,8 +1257,10 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
                drawcircball(GL_POLYGON, vec, lampsize, imat);
                
                /* restore */
-               if (ob->id.us > 1)
-                       glColor4ubv(curcol);
+               if ((flag & DRAW_CONSTCOLOR) == 0) {
+                       if (ob->id.us > 1)
+                               glColor4ubv(curcol);
+               }
 
                /* Outer circle */
                circrad = 3.0f * lampsize;
@@ -1486,9 +1492,10 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
        
        glDisable(GL_BLEND);
        
-       /* restore for drawing extra stuff */
-       glColor3ubv(ob_wire_col);
-
+       if ((flag & DRAW_CONSTCOLOR) == 0) {
+               /* restore for drawing extra stuff */
+               glColor3ubv(ob_wire_col);
+       }
 }
 
 static void draw_limit_line(float sta, float end, unsigned int col)
@@ -3427,6 +3434,8 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
                                dm->drawFacesSolid(dm, NULL, 0, GPU_enable_material);
                        }
                        else {
+                               const float spec[4] = {0.47f, 0.47f, 0.47f, 0.47f};
+
                                /* draw outline */
                                if ( (v3d->flag & V3D_SELECT_OUTLINE) &&
                                     ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) &&
@@ -3444,9 +3453,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
                                
                                /* set default spec */
                                glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR);
-                               glEnable(GL_COLOR_MATERIAL);    /* according manpages needed */
-                               glColor3ub(120, 120, 120);
-                               glDisable(GL_COLOR_MATERIAL);
+                               glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, spec);
                                /* diffuse */
                                glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
                                glEnable(GL_LIGHTING);
@@ -6540,7 +6547,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
        RegionView3D *rv3d = ar->regiondata;
        float vec1[3], vec2[3];
        unsigned int col = 0;
-       unsigned char ob_wire_col[4];
+       unsigned char _ob_wire_col[4];      /* dont initialize this */
+       unsigned char *ob_wire_col = NULL;  /* dont initialize this, use NULL crashes as a way to find invalid use */
        int i, selstart, selend, empty_object = 0;
        short dt, dtx, zbufoff = 0;
        const short is_obact = (ob == OBACT);
@@ -6578,9 +6586,6 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
        /* no return after this point, otherwise leaks */
        view3d_cached_text_draw_begin();
        
-       /* patch? children objects with a timeoffs change the parents. How to solve! */
-       /* if ( ((int)ob->ctime) != F_(scene->r.cfra)) BKE_object_where_is_calc(scene, ob); */
-       
        /* draw motion paths (in view space) */
        if (ob->mpath && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
                bAnimVizSettings *avs = &ob->avs;
@@ -6604,7 +6609,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
 
                project_short(ar, ob->obmat[3], &base->sx);
 
-               draw_object_wire_color(scene, base, ob_wire_col, warning_recursive);
+               draw_object_wire_color(scene, base, _ob_wire_col, warning_recursive);
+               ob_wire_col = _ob_wire_col;
 
                glColor3ubv(ob_wire_col);
        }
index 7c12816741d54acd3ef66cd0175091196e097648..a36c14151e61179f1300fc2901784b0077eee679 100644 (file)
@@ -1146,7 +1146,6 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
 
        /* border */
        if (scene->r.mode & R_BORDER) {
-               
                cpack(0);
                x3 = x1 + scene->r.border.xmin * (x2 - x1);
                y3 = y1 + scene->r.border.ymin * (y2 - y1);
@@ -2735,12 +2734,15 @@ static void draw_viewport_fps(Scene *scene, ARegion *ar)
        BLF_draw_default_ascii(22,  ar->winy - 17, 0.0f, printable, sizeof(printable));
 }
 
-static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar)
+static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const char **grid_unit);
+
+static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw_border)
 {
        Scene *scene = CTX_data_scene(C);
        View3D *v3d = CTX_wm_view3d(C);
        RegionView3D *rv3d = CTX_wm_region_view3d(C);
        RenderEngineType *type;
+       GLint scissor[4];
 
        /* create render engine */
        if (!rv3d->render_engine) {
@@ -2757,17 +2759,48 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar)
        view3d_main_area_setup_view(scene, v3d, ar, NULL, NULL);
 
        /* background draw */
+       ED_region_pixelspace(ar);
+
+       if (draw_border) {
+               /* for border draw, we only need to clear a subset of the 3d view */
+               rctf viewborder;
+               rcti cliprct;
+
+               ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, FALSE);
+
+               cliprct.xmin = viewborder.xmin + scene->r.border.xmin * (viewborder.xmax - viewborder.xmin);
+               cliprct.ymin = viewborder.ymin + scene->r.border.ymin * (viewborder.ymax - viewborder.ymin);
+               cliprct.xmax = viewborder.xmin + scene->r.border.xmax * (viewborder.xmax - viewborder.xmin);
+               cliprct.ymax = viewborder.ymin + scene->r.border.ymax * (viewborder.ymax - viewborder.ymin);
+
+               cliprct.xmin += ar->winrct.xmin;
+               cliprct.xmax += ar->winrct.xmin;
+               cliprct.ymin += ar->winrct.ymin;
+               cliprct.ymax += ar->winrct.ymin;
+
+               cliprct.xmin = MAX2(cliprct.xmin, ar->winrct.xmin);
+               cliprct.ymin = MAX2(cliprct.ymin, ar->winrct.ymin);
+               cliprct.xmax = MIN2(cliprct.xmax, ar->winrct.xmax);
+               cliprct.ymax = MIN2(cliprct.ymax, ar->winrct.ymax);
+
+               glGetIntegerv(GL_SCISSOR_BOX, scissor);
+               glScissor(cliprct.xmin, cliprct.ymin, cliprct.xmax - cliprct.xmin, cliprct.ymax - cliprct.ymin);
+       }
+
        glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
-       ED_region_pixelspace(ar);
-
-       /* render result draw */
        if (v3d->flag & V3D_DISPBGPICS)
                view3d_draw_bgpic(scene, ar, v3d, FALSE, TRUE);
        else
                fdrawcheckerboard(0, 0, ar->winx, ar->winy);
 
+       if (draw_border) {
+               /* restore scissor as it was before */
+               glScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
+       }
+
+       /* render result draw */
        type = rv3d->render_engine->type;
        type->view_draw(rv3d->render_engine, C);
 
@@ -3028,15 +3061,21 @@ static void view3d_main_area_draw_info(const bContext *C, ARegion *ar, const cha
 
 void view3d_main_area_draw(const bContext *C, ARegion *ar)
 {
+       Scene *scene = CTX_data_scene(C);
        View3D *v3d = CTX_wm_view3d(C);
+       RegionView3D *rv3d = CTX_wm_region_view3d(C);
        const char *grid_unit = NULL;
+       int draw_border = (rv3d->persp == RV3D_CAMOB && (scene->r.mode & R_BORDER));
 
-       /* draw viewport using external renderer? */
-       if (!(v3d->drawtype == OB_RENDER && view3d_main_area_draw_engine(C, ar))) {
-               /* draw viewport using opengl */
+       /* draw viewport using opengl */
+       if (v3d->drawtype != OB_RENDER || draw_border) {
                view3d_main_area_draw_objects(C, ar, &grid_unit);
                ED_region_pixelspace(ar);
        }
+
+       /* draw viewport using external renderer */
+       if (v3d->drawtype == OB_RENDER)
+               view3d_main_area_draw_engine(C, ar, draw_border);
        
        view3d_main_area_draw_info(C, ar, grid_unit);
 
index c99c4b8a50c92bf1347cbe5fb2810473acdf3cf1..fb28afbbdd9eed52426d02752ed5bcbf23c3c807 100644 (file)
@@ -5216,7 +5216,7 @@ void initEdgeSlide(TransInfo *t)
 
 int handleEventEdgeSlide(struct TransInfo *t, struct wmEvent *event)
 {
-       if (t->flag & TFM_EDGE_SLIDE) {
+       if (t->mode == TFM_EDGE_SLIDE) {
                SlideData *sld = t->customData;
 
                if (sld) {
@@ -5258,7 +5258,7 @@ int handleEventEdgeSlide(struct TransInfo *t, struct wmEvent *event)
 
 void drawNonPropEdge(const struct bContext *C, TransInfo *t)
 {
-       if (t->flag & TFM_EDGE_SLIDE) {
+       if (t->mode == TFM_EDGE_SLIDE) {
                SlideData *sld = (SlideData *)t->customData;
                /* Non-Prop mode */
                if (sld && sld->is_proportional == FALSE) {
index 2637d9e3b9bcec4d2ccda8d762bc449863a46db4..38ac8c2999c30f1830df3301ada3614bbc32b4ae 100644 (file)
@@ -5878,7 +5878,7 @@ void flushTransTracking(TransInfo *t)
 
 /* * masking * */
 
-typedef struct TransDataMasking{
+typedef struct TransDataMasking {
        int   is_handle;
 
        float handle[2], orig_handle[2];
index 4ea89de9070e9166ec6debe43df091286a92a9f5..52b32ae66fcdbeb9ed41bb957af0cd854b6da36c 100644 (file)
@@ -51,8 +51,7 @@
 
 #include "transform.h"
 
-typedef struct TransformModeItem
-{
+typedef struct TransformModeItem {
        char *idname;
        int             mode;
        void (*opfunc)(wmOperatorType*);
index b9bd7e961f8f62d04d06062060c4a0d17b9ca278..fb248f1b0169729faa29ba79cdcd81b0d17114a6 100644 (file)
@@ -1261,8 +1261,8 @@ void mtex_bump_bicubic( vec3 texco, sampler2D ima, float hScale,
 
                mat4 H;
                
-               for(int i = 0; i < 4; i++){
-                       for(int j = 0; j < 4; j++){
+               for(int i = 0; i < 4; i++) {
+                       for(int j = 0; j < 4; j++) {
                                ivec2 iTexTmp = iTexLocMod + ivec2(i,j);
                                
                                // wrap texture coordinates manually for texelFetch to work on uvs oitside the 0,1 range.
index 87b0c6c671a5fe93e6c5aaf50da98c5b2f9942ce..f37b254d719f6c914ac5fda89dd49af6330d267e 100644 (file)
@@ -57,8 +57,5 @@ if(WITH_IK_ITASC)
        )
 endif()
 
-if(WIN32)
-       add_definitions(-DEIGEN_DONT_ALIGN_STATICALLY)
-endif()
 
 blender_add_lib(bf_ikplugin "${SRC}" "${INC}" "${INC_SYS}")
index 4cff3399fdce7192ffb039078a7c87a64e15f354..38c53894df8e60e34e4d1868cd706fbdc9e184a1 100644 (file)
@@ -8,7 +8,4 @@ incs += ' ../blenkernel ../include ../ikplugin #/intern/itasc #/extern/Eigen3'
 
 defs.append('WITH_IK_ITASC')
 
-if env['PLATFORM'] == 'win32':
-    defs.append('EIGEN_DONT_ALIGN_STATICALLY')
-
 env.BlenderLib ( 'bf_ikplugin', sources, Split(incs), defs, libtype=['core','player'], priority=[180, 190] )
index ebbb201de8e2c4308406715ff0b39bd376930e89..048dd9557265958df18938fa2953d8e32b0326ff 100644 (file)
@@ -1000,7 +1000,7 @@ static void convert_pose(IK_Scene *ikscene)
 
        // assume uniform scaling and take Y scale as general scale for the armature
        scale = len_v3(ikscene->blArmature->obmat[1]);
-       rot = (ikscene->jointArray.rows() > 0) ? &ikscene->jointArray(0) : NULL;
+       rot = ikscene->jointArray(0);
        for (joint=a=0, ikchan = ikscene->channels; a<ikscene->numchan && joint<ikscene->numjoint; ++a, ++ikchan) {
                pchan= ikchan->pchan;
                bone= pchan->bone;
@@ -1041,7 +1041,7 @@ static void BKE_pose_rest(IK_Scene *ikscene)
        // rest pose is 0 
        SetToZero(ikscene->jointArray);
        // except for transY joints
-       rot = (ikscene->jointArray.rows() > 0) ? &ikscene->jointArray(0) : NULL;
+       rot = ikscene->jointArray(0);
        for (joint=a=0, ikchan = ikscene->channels; a<ikscene->numchan && joint<ikscene->numjoint; ++a, ++ikchan) {
                pchan= ikchan->pchan;
                bone= pchan->bone;
@@ -1140,7 +1140,7 @@ static IK_Scene* convert_tree(Scene *blscene, Object *ob, bPoseChannel *pchan)
                // in Blender, the rest pose is always 0 for joints
                BKE_pose_rest(ikscene);
        }
-       rot = (ikscene->jointArray.rows() > 0) ? &ikscene->jointArray(0) : NULL;
+       rot = ikscene->jointArray(0);
        for (a=0, ikchan = ikscene->channels; a<tree->totchannel; ++a, ++ikchan) {
                pchan= ikchan->pchan;
                bone= pchan->bone;
index 93a5f8eca7cfe4bd2f2882cd8eff84c63f862409..baea18d4898f8151be5d98083131651c6ec0a85c 100644 (file)
@@ -904,8 +904,7 @@ static ExrHandle *imb_exr_begin_read_mem(InputFile *file, int width, int height)
 
 /* ********************************************************* */
 
-typedef struct RGBA
-{
+typedef struct RGBA {
        float r;
        float g;
        float b;
index f4e06455c63d96c81fe742d823cbf613d4ea6d55..4a5ad69cb9188401064db59abd645f5354eca71e 100644 (file)
@@ -62,8 +62,7 @@ typedef struct bActionActuator {
        float   layer_weight;   /* How much of the previous layer to use for blending. (<0 = disable, 0 = add mode) */
 } bActionActuator;                                                                                             
 
-typedef struct Sound3D
-{
+typedef struct Sound3D {
        float min_gain;
        float max_gain;
        float reference_distance;
index b214186fee6eb57efc18e11988777fcc59efda1b..4928a88b33e417dbfb30287663faf6f8078470ac 100644 (file)
@@ -44,8 +44,7 @@
  * variables with different names to minimize confusion.
  */
 
-typedef struct ClothSimSettings
-{
+typedef struct ClothSimSettings {
        struct  LinkNode *cache; /* UNUSED atm */       
        float   mingoal;        /* see SB */
        float   Cdis;           /* Mechanical damping of springs.               */
@@ -89,8 +88,7 @@ typedef struct ClothSimSettings
 } ClothSimSettings;
 
 
-typedef struct ClothCollSettings
-{
+typedef struct ClothCollSettings {
        struct  LinkNode *collision_list; /* e.g. pointer to temp memory for collisions */
        float   epsilon;                /* min distance for collisions.         */
        float   self_friction;          /* Fiction/damping with self contact. */
index 35549aee3d224de7b65f71f378b6283db090757b..333e414278d5b084083490479462e139349470c3 100644 (file)
@@ -41,22 +41,19 @@ extern "C" {
 #endif
 
 /* generic - all structs which are used in linked-lists used this */
-typedef struct Link
-{
+typedef struct Link {
        struct Link *next, *prev;
 } Link;
 
 
 /* use this when it is not worth defining a custom one... */
-typedef struct LinkData
-{
+typedef struct LinkData {
        struct LinkData *next, *prev;
        void *data;
 } LinkData;
 
 /* never change the size of this! genfile.c detects pointerlen with it */
-typedef struct ListBase 
-{
+typedef struct ListBase  {
        void *first, *last;
 } ListBase;
 
index c036369c692996b8c0e77a125e5e292a12136ba4..23f33729f69e9ca6ebf010fdf5db252e4cd68fc1 100644 (file)
@@ -43,9 +43,9 @@
 typedef struct Mask {
        ID id;
        struct AnimData *adt;
-       ListBase masklayers;   /* mask layers */
-       int masklay_act;     /* index of active mask layer (-1 == None) */
-       int masklay_tot;     /* total number of mask layers */
+       ListBase masklayers;  /* mask layers */
+       int masklay_act;      /* index of active mask layer (-1 == None) */
+       int masklay_tot;      /* total number of mask layers */
 } Mask;
 
 typedef struct MaskParent {
@@ -166,5 +166,4 @@ enum {
        MASK_BLENDFLAG_INVERT = (1 << 0)
 };
 
-
 #endif // __DNA_MASK_TYPES_H__
index f5d525d47b5341a7fe2164dc5b9cbb0a0d97d5f3..0853df87a35c9c40b3ffc510572295a84d47ecd4 100644 (file)
@@ -234,8 +234,8 @@ typedef struct ParticleSettings {
        struct PartDeflect *pd2;
 } ParticleSettings;
 
-typedef struct ParticleSystem
-{      /* note1: make sure all (runtime) are NULL's in 'copy_particlesystem' XXX, this function is no more! - need to invstigate */
+typedef struct ParticleSystem {
+       /* note1: make sure all (runtime) are NULL's in 'copy_particlesystem' XXX, this function is no more! - need to invstigate */
        /* note2: make sure any uses of this struct in DNA are accounted for in 'BKE_object_copy_particlesystems' */
 
        struct ParticleSystem *next, *prev;
index 0c88c7d9c819d9486e3eb8391dc5baab0439bfb0..73188b3f8302eb45b588dc41099e0ca227bca59f 100644 (file)
@@ -421,7 +421,7 @@ static int python_script_exec(bContext *C, const char *fn, struct Text *text,
 
                                fclose(fp);
 
-                               pystring = MEM_mallocN(strlen(fn) + 36, "pystring");
+                               pystring = MEM_mallocN(strlen(fn) + 37, "pystring");
                                pystring[0] = '\0';
                                sprintf(pystring, "f=open(r'%s');exec(f.read());f.close()", fn);
                                py_result = PyRun_String(pystring, Py_file_input, py_dict, py_dict);
index cf9e6f7966f2224292d25657ea915722ed10b13b..26a1b9908b3e549bfa2812c179687ed4e04c851e 100644 (file)
@@ -45,8 +45,7 @@ typedef struct TexResult {
 } TexResult;
 
 /* localized shade result data */
-typedef struct ShadeResult 
-{
+typedef struct ShadeResult {
        float combined[4];
        float col[4];
        float alpha, mist, z;
@@ -95,8 +94,7 @@ typedef struct ShadeInputCol {
 } ShadeInputCol;
 
 /* localized renderloop data */
-typedef struct ShadeInput
-{
+typedef struct ShadeInput {
        /* copy from face, also to extract tria from quad */
        /* note it mirrors a struct above for quick copy */
        
index f84b00451a6242d718a50c478ec4f626f0adc050..e5af51cf2d7dfba889445f783ca497fcfd418c36 100644 (file)
@@ -65,16 +65,14 @@ struct Main;
 #define TABLEINITSIZE 1024
 #define LAMPINITSIZE 256
 
-typedef struct SampleTables
-{
+typedef struct SampleTables {
        float centLut[16];
        float *fmask1[9], *fmask2[9];
        char cmask[256], *centmask;
        
 } SampleTables;
 
-typedef struct QMCSampler
-{
+typedef struct QMCSampler {
        struct QMCSampler *next, *prev;
        int type;
        int tot;
@@ -88,8 +86,7 @@ typedef struct QMCSampler
 #define SAMP_TYPE_HAMMERSLEY   2
 
 /* this is handed over to threaded hiding/passes/shading engine */
-typedef struct RenderPart
-{
+typedef struct RenderPart {
        struct RenderPart *next, *prev;
        
        RenderResult *result;                   /* result of part rendering */
@@ -347,8 +344,7 @@ typedef struct ObjectInstanceRen {
 
 /* ------------------------------------------------------------------------- */
 
-typedef struct VertRen
-{
+typedef struct VertRen {
        float co[3];
        float n[3];
        float *orco;
@@ -384,8 +380,7 @@ typedef struct VlakRen {
        int index;
 } VlakRen;
 
-typedef struct HaloRen
-{      
+typedef struct HaloRen {
        short miny, maxy;
        float alfa, xs, ys, rad, radsq, sin, cos, co[3], no[3];
        float hard, b, g, r;
@@ -456,8 +451,7 @@ typedef struct StrandRen {
 
 /* ------------------------------------------------------------------------- */
 
-typedef struct VolumeOb
-{
+typedef struct VolumeOb {
        struct VolumeOb *next, *prev;
        struct Material *ma;
        struct ObjectRen *obr;
@@ -469,8 +463,7 @@ typedef struct MatInside {
        struct ObjectInstanceRen *obi;
 } MatInside;
 
-typedef struct VolPrecachePart
-{
+typedef struct VolPrecachePart {
        struct VolPrecachePart *next, *prev;
        struct RayObject *tree;
        struct ShadeInput *shi;
@@ -486,8 +479,7 @@ typedef struct VolPrecachePart
        struct Render *re;
 } VolPrecachePart;
 
-typedef struct VolumePrecache
-{
+typedef struct VolumePrecache {
        int res[3];
        float *bbmin, *bbmax;
        float *data_r;
index 284b386ca3388b748faba1f3da9dbe505cab07f2..0fbbf52e613b4e6b083ae2583924455bba36fee4 100644 (file)
@@ -46,16 +46,14 @@ struct RayObject;
 
 /* ------------------------------------------------------------------------- */
 
-typedef struct PixStr
-{
+typedef struct PixStr {
        struct PixStr *next;
        int obi, facenr, z, maskz;
        unsigned short mask;
        short shadfac;
 } PixStr;
 
-typedef struct PixStrMain
-{
+typedef struct PixStrMain {
        struct PixStrMain *next, *prev;
        struct PixStr *ps;
        int counter;
index 0afd9246150035b0401c7600ae8dc15eff92dc65..4bb7d99ba16fa2764e10886ff8d58f2513451a2e 100644 (file)
@@ -31,8 +31,7 @@
 #define SPECTRUM_START              350.0
 #define SPECTRUM_END                800.0
 
-typedef struct SunSky
-{
+typedef struct SunSky {
        short effect_type, skyblendtype, sky_colorspace;
        float turbidity;
        float theta, phi;
index 63620331c85225c5aa6e24e5b48ddf2984af68a0..dd2262e03577ab8fea3ce73afd8029412bcee753 100644 (file)
@@ -35,8 +35,7 @@
 struct Render;
 struct TexResult;
 
-typedef struct VoxelDataHeader
-{
+typedef struct VoxelDataHeader {
        int resolX, resolY, resolZ;
        int frames;
 } VoxelDataHeader;
index 77cee59a83ad025907bba1ac3380a6037cacec28..cdf171443d71a33bf7c38900e4f7f20c5e58e6f1 100644 (file)
@@ -80,8 +80,7 @@ typedef struct APixstrand {
        struct APixstrand *next;
 } APixstrand;
 
-typedef struct APixstrMain
-{
+typedef struct APixstrMain {
        struct APixstrMain *next, *prev;
        void *ps;
 } APixstrMain;
index ce88bac1587ae6a600566e85d4d1891a757fe769..92a412103ba0ba6f748acfa596411cc01cbddbd3 100644 (file)
@@ -62,8 +62,7 @@ static RayObjectAPI instance_api =
        RE_rayobject_instance_hint_bb   
 };
 
-typedef struct InstanceRayObject
-{
+typedef struct InstanceRayObject {
        RayObject rayobj;
        RayObject *target;
 
index a2b911911d0769e59e780b9d1ad5328018c2f852..a48a6b75049654f662c42277789b702695f7d305 100644 (file)
@@ -520,8 +520,7 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr
  ************ tangent space generation interface ****************
  ****************************************************************/
 
-typedef struct
-{
+typedef struct {
        ObjectRen *obr;
 
 } SRenderMeshToTangent;
@@ -1011,8 +1010,7 @@ static Material *give_render_material(Render *re, Object *ob, short nr)
 /* ------------------------------------------------------------------------- */
 /* Particles                                                                 */
 /* ------------------------------------------------------------------------- */
-typedef struct ParticleStrandData
-{
+typedef struct ParticleStrandData {
        struct MCol *mcol;
        float *orco, *uvco, *surfnor;
        float time, adapt_angle, adapt_pix, size;
index 96a1a13b75fe2e781988027b5d88dbf784f22e35..3c1a18316ca26a1aad9054e7096e79f89d17fe8c 100644 (file)
@@ -325,8 +325,7 @@ void free_pointdensities(Render *re)
        }
 }
 
-typedef struct PointDensityRangeData
-{
+typedef struct PointDensityRangeData {
        float *density;
        float squared_radius;
        float *point_data;
index 25abc171057b5f8de247a8d72210f8138db21453..a15d020c2306e56c6a67bc2f7e65a68363b565e5 100644 (file)
@@ -385,7 +385,7 @@ typedef struct wmTabletData {
        float Ytilt;            /* as above */
 } wmTabletData;
 
-typedef enum { // motion progress, for modal handlers
+typedef enum {  /* motion progress, for modal handlers */
        P_NOT_STARTED,
        P_STARTING,    // <--
        P_IN_PROGRESS, // <-- only these are sent for NDOF motion
index 7361e74755e21e6263273fefc9b20cd818ac9008..265a3c113777a8825a4ef307cb9baf875cb53dd3 100644 (file)
@@ -577,12 +577,11 @@ int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op))
 
 /* ************ events *************** */
 
-typedef enum
-{
-       SHIFT = 's',
-       CONTROL = 'c',
-       ALT = 'a',
-       OS = 'C'
+typedef enum {
+       SHIFT    = 's',
+       CONTROL  = 'c',
+       ALT      = 'a',
+       OS       = 'C'
 } modifierKeyType;
 
 /* check if specified modifier key type is pressed */
index 2ca7019487f9ad24cbc2fce4724c2d99632e1831..99db5576fa0a31bd073712bf1fe628397a31d169 100644 (file)
@@ -31,12 +31,6 @@ if(WITH_CODEC_QUICKTIME)
        add_definitions(-DWITH_QUICKTIME)
 endif()
 
-add_custom_command(
-       OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dna.c
-       COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna ${CMAKE_CURRENT_BINARY_DIR}/dna.c ${CMAKE_SOURCE_DIR}/source/blender/makesdna/
-       DEPENDS ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/makesdna
-)
-
 if(WIN32 AND NOT UNIX)
        string(SUBSTRING ${BLENDER_VERSION} 0 1 bver1)
        string(SUBSTRING ${BLENDER_VERSION} 2 1 bver2)
@@ -60,10 +54,10 @@ if(WIN32 AND NOT UNIX)
                )
        endif()
 
-       add_executable(blenderplayer ${EXETYPE} ${CMAKE_CURRENT_BINARY_DIR}/dna.c ../icons/winblender.rc)
+       add_executable(blenderplayer ${EXETYPE} bad_level_call_stubs/stubs.c ../icons/winblender.rc)
 
 elseif(APPLE)
-       add_executable(blenderplayer ${EXETYPE} ${CMAKE_CURRENT_BINARY_DIR}/dna.c)
+       add_executable(blenderplayer ${EXETYPE} bad_level_call_stubs/stubs.c)
        # setup Info.plist
        execute_process(COMMAND date "+%Y-%m-%d" OUTPUT_VARIABLE BLENDER_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
        set(PLAYER_SOURCEDIR ${CMAKE_SOURCE_DIR}/source/darwin/blenderplayer.app)
@@ -74,7 +68,7 @@ elseif(APPLE)
                MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION} ${BLENDER_DATE}")
 
 else()
-       add_executable(blenderplayer ${CMAKE_CURRENT_BINARY_DIR}/dna.c)
+       add_executable(blenderplayer bad_level_call_stubs/stubs.c)
 endif()
 
 add_dependencies(blenderplayer makesdna)
index f38782a940541bf5468fe4360d07e9b6c2a83719..7174a563efa48bb94d5ab84ede3565c1da864b26 100644 (file)
@@ -529,7 +529,7 @@ bool BL_ArmatureObject::SetActiveAction(BL_ActionActuator *act, short priority,
                
                        return true;
                }
-               else{
+               else {
                        act->SetBlendTime(0.0);
                        return false;
                }
index 3d73ca66c92794b6b25991fda2bebebfde58aeb6..927a05358703c6e723fa83647e93a8e36a2b3fb4 100644 (file)
@@ -488,11 +488,10 @@ static void GetRGB(short type,
        }
 }
 
-typedef struct MTF_localLayer
-{
+typedef struct MTF_localLayer {
        MTFace *face;
        const char *name;
-}MTF_localLayer;
+} MTF_localLayer;
 
 // ------------------------------------
 bool ConvertMaterial(
@@ -1193,7 +1192,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
                                twoside = ((ma->game.flag  & GEMAT_BACKCULL)==0);
                                collider = ((ma->game.flag & GEMAT_NOPHYSICS)==0);
                        }
-                       else{
+                       else {
                                visible = true;
                                twoside = false;
                                collider = true;
index dd4c51b5403f635feafd1c79b07c42e3c4dc29a2..4967401f2797ade7381406b4ce648525c2b7c403 100644 (file)
@@ -76,7 +76,7 @@ bool BL_DeformableGameObject::SetActiveAction(BL_ShapeActionActuator *act, short
        
                return true;
        }
-       else{
+       else {
                act->SetBlendTime(0.0f);
                return false;
        }
index 13e79b133049bdd3aab1648c46b9e8608c5f6048..c339e10f67302760070ead264c08763d490ebe1a 100644 (file)
@@ -316,7 +316,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
                        m_localtime += (length/m_stridelength) * deltapos.length();
                        m_lastpos = newpos;
                }
-               else{
+               else {
                        SetLocalTime(curtime);
                }
        }
@@ -466,7 +466,7 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
                                BLI_freelistN(&tchanbase);
                        }
                }
-               else{
+               else {
                        m_blendframe = 0.0f;
                }
        }
index 0613b137fe88ba53637da6ad221b47f7af4fac32..78e5d7b32c23c41a2711b6709a73509efead9812 100644 (file)
@@ -930,13 +930,34 @@ bool KX_BlenderSceneConverter::LinkBlendFilePath(const char *path, char *group,
        return LinkBlendFile(bpy_openlib, path, group, scene_merge, err_str, options);
 }
 
-bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const char *path, char *group, KX_Scene *scene_merge, char **err_str, short options)
+static void load_datablocks(Main *main_newlib, BlendHandle *bpy_openlib, const char *path, int idcode)
 {
-       Main *main_newlib; /* stored as a dynamic 'main' until we free it */
        Main *main_tmp= NULL; /* created only for linking, then freed */
        LinkNode *names = NULL;
-       int idcode= BKE_idcode_from_name(group);
        short flag= 0; /* don't need any special options */
+
+       /* here appending/linking starts */
+       main_tmp = BLO_library_append_begin(main_newlib, &bpy_openlib, (char *)path);
+
+       int totnames_dummy;
+       names = BLO_blendhandle_get_datablock_names( bpy_openlib, idcode, &totnames_dummy);
+       
+       int i=0;
+       LinkNode *n= names;
+       while(n) {
+               BLO_library_append_named_part(main_tmp, &bpy_openlib, (char *)n->link, idcode);
+               n= (LinkNode *)n->next;
+               i++;
+       }
+       BLI_linklist_free(names, free); /* free linklist *and* each node's data */
+       
+       BLO_library_append_end(NULL, main_tmp, &bpy_openlib, idcode, flag);
+}
+
+bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const char *path, char *group, KX_Scene *scene_merge, char **err_str, short options)
+{
+       Main *main_newlib; /* stored as a dynamic 'main' until we free it */
+       int idcode= BKE_idcode_from_name(group);
        ReportList reports;
        static char err_local[255];
        
@@ -964,40 +985,11 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha
        main_newlib= (Main *)MEM_callocN( sizeof(Main), "BgeMain");
        BKE_reports_init(&reports, RPT_STORE);  
 
-       /* here appending/linking starts */
-       main_tmp = BLO_library_append_begin(main_newlib, &bpy_openlib, (char *)path);
-
-       int totnames_dummy;
-       names = BLO_blendhandle_get_datablock_names( bpy_openlib, idcode, &totnames_dummy);
-       
-       int i=0;
-       LinkNode *n= names;
-       while(n) {
-               BLO_library_append_named_part(main_tmp, &bpy_openlib, (char *)n->link, idcode);
-               n= (LinkNode *)n->next;
-               i++;
-       }
-       BLI_linklist_free(names, free); /* free linklist *and* each node's data */
-       
-       BLO_library_append_end(NULL, main_tmp, &bpy_openlib, idcode, flag);
+       load_datablocks(main_newlib, bpy_openlib, path, idcode);
 
        /* now do another round of linking for Scenes so all actions are properly loaded */
        if (idcode==ID_SCE && options & LIB_LOAD_LOAD_ACTIONS) {
-               main_tmp = BLO_library_append_begin(main_newlib, &bpy_openlib, (char *)path);
-
-               int totnames_dummy;
-               names = BLO_blendhandle_get_datablock_names( bpy_openlib, ID_AC, &totnames_dummy);
-       
-               int i=0;
-               LinkNode *n= names;
-               while(n) {
-                       BLO_library_append_named_part(main_tmp, &bpy_openlib, (char *)n->link, ID_AC);
-                       n= (LinkNode *)n->next;
-                       i++;
-               }
-               BLI_linklist_free(names, free); /* free linklist *and* each node's data */
-       
-               BLO_library_append_end(NULL, main_tmp, &bpy_openlib, ID_AC, flag);
+               load_datablocks(main_newlib, bpy_openlib, path, ID_AC);
        }
        
        BLO_blendhandle_close(bpy_openlib);
index 278febee4acb05f16203730ac145360cc7952b5a..c50e42446a5a29d14375329554d149a7c750775b 100644 (file)
@@ -527,7 +527,7 @@ typedef struct KX_PYATTRIBUTE_DEF {
 /*------------------------------
  * PyObjectPlus
 ------------------------------*/
-typedef PyTypeObject * PyParentObject;                         // Define the PyParent Object
+typedef PyTypeObject *PyParentObject;  /* Define the PyParent Object */
 
 #else // WITH_PYTHON
 
index 00320ff9ed2557bee0c3cfc6b4e6581e5d1e8c3e..261f5244f21f42c398cd566e017acf40d1dba744 100644 (file)
@@ -158,7 +158,7 @@ class CAction
 public:
        CAction() {
        };
-       virtual ~CAction(){
+       virtual ~CAction() {
        };
        virtual void Execute() const =0;
        
index a6809716e324923b22f5a1fdb8f09cb69a3bf9d8..685cc3fcc4863d9c75f890a83efc45927106cc39 100644 (file)
@@ -99,7 +99,7 @@ class SCA_Joystick
        void OnButtonDown(SDL_Event *sdl_event);
        void OnNothing(SDL_Event *sdl_event);
 #if 0 /* not used yet */
-       void OnBallMotion(SDL_Event *sdl_event){}
+       void OnBallMotion(SDL_Event *sdl_event) {}
 #endif
                
 #endif /* WITH_SDL */
@@ -156,27 +156,27 @@ public:
 
        void cSetPrecision(int val);
 
-       int GetAxisPosition(int index){
+       int GetAxisPosition(int index) {
                return m_axis_array[index];
        }
 
-       int GetHat(int index){
+       int GetHat(int index) {
                return m_hat_array[index];
        }
 
-       int GetThreshold(void){
+       int GetThreshold(void) {
                return m_prec;
        }
 
-       bool IsTrigAxis(void){
+       bool IsTrigAxis(void) {
                return m_istrig_axis;
        }
        
-       bool IsTrigButton(void){
+       bool IsTrigButton(void) {
                return m_istrig_button;
        }
        
-       bool IsTrigHat(void){
+       bool IsTrigHat(void) {
                return m_istrig_hat;
        }
 
index 07fad3bfe37b116e04a27592c18b98df6fd23989..c82e015919dea537a9815a1d28c86e7cbe78fc0d 100644 (file)
@@ -137,7 +137,8 @@ bool SCA_JoystickSensor::Evaluate()
                                if (js->aAxisPairIsPositive(m_axis-1)) { /* use zero based axis index internally */
                                        m_istrig = 1;
                                        result = true;
-                               }else{
+                               }
+                               else {
                                        if (m_istrig) {
                                                m_istrig = 0;
                                                result = true;
@@ -148,7 +149,8 @@ bool SCA_JoystickSensor::Evaluate()
                                if (js->aAxisPairDirectionIsPositive(m_axis-1, m_axisf)) { /* use zero based axis index internally */
                                        m_istrig = 1;
                                        result = true;
-                               }else{
+                               }
+                               else {
                                        if (m_istrig) {
                                                m_istrig = 0;
                                                result = true;
@@ -168,7 +170,8 @@ bool SCA_JoystickSensor::Evaluate()
                        if (js->aAxisIsPositive(m_axis-1)) { /* use zero based axis index internally */
                                m_istrig = 1;
                                result = true;
-                       }else{
+                       }
+                       else {
                                if (m_istrig) {
                                        m_istrig = 0;
                                        result = true;
@@ -209,7 +212,8 @@ bool SCA_JoystickSensor::Evaluate()
                        if ((m_bAllEvents && js->GetHat(m_hat-1)) || js->aHatIsPositive(m_hat-1, m_hatf)) {
                                m_istrig = 1;
                                result = true;
-                       }else{
+                       }
+                       else {
                                if (m_istrig) {
                                        m_istrig = 0;
                                        result = true;
index eecbf2c41831ee1f8c72e6c5fd247c8acac2a2c8..5dc35faf24479d16e13ed3683594c0f2f1c62b47 100644 (file)
@@ -117,7 +117,7 @@ public:
        virtual bool IsPositiveTrigger();
        virtual void Init();
        
-       short int GetJoyIndex(void){
+       short int GetJoyIndex(void) {
                return m_joyindex;
        }
 
index 1e16cbd51f2b40c5cc8ecf867a0509faa65207e5..26cfc560b6d5b088fa90680e72d0fc9064dd8aa8 100644 (file)
@@ -118,8 +118,7 @@ static void mem_error_cb(const char *errorStr)
 }
 
 #ifdef WIN32
-typedef enum 
-{
+typedef enum {
   SCREEN_SAVER_MODE_NONE = 0,
   SCREEN_SAVER_MODE_PREVIEW,
   SCREEN_SAVER_MODE_SAVER,
index 4ced21aa2d81968f912ec2307645c2a96a5fd9db..3b3a1f5cbfb45087a030c19e55aba85065748e91 100644 (file)
@@ -86,7 +86,7 @@ public:
        SetOption(
                int option,
                int value
-       ){
+       ) {
                // intentionally empty
        };
 
index eaabbdd8233950f6d72b01c07b2b67baea562638..6d57b6950f1fcd2c8ffe68f0c7d253258575c86a 100644 (file)
@@ -445,7 +445,8 @@ void KX_Dome::GLDrawWarpQuads(void)
                        }
                }
                glEnd();
-       } else{
+       }
+       else {
                printf("Dome Error: Warp Mode %d unsupported. Try 1 for Polar Mesh or 2 for Fisheye.\n", warp.mode);
        }
 }
@@ -502,7 +503,8 @@ bool KX_Dome::ParseWarpMesh(STR_String text)
        if ((int)lines.size() < 2 + (warp.n_width * warp.n_height)) {
                printf("Dome Error: Warp Mesh File with insufficient data!\n");
                return false;
-       }else{
+       }
+       else {
                warp.nodes = vector<vector<WarpMeshNode> > (warp.n_height, vector<WarpMeshNode>(warp.n_width));
 
                for (i=2; i-2 < (warp.n_width*warp.n_height); i++) {
@@ -520,7 +522,7 @@ bool KX_Dome::ParseWarpMesh(STR_String text)
                                warp.nodes[nodeY][nodeX].v = atof(columns[3]);
                                warp.nodes[nodeY][nodeX].i = atof(columns[4]);
                        }
-                       else{
+                       else {
                                warp.nodes.clear();
                                printf("Dome Error: Warp Mesh File with wrong number of fields. You should use 5: x y u v i.\n");
                                return false;
@@ -1671,7 +1673,8 @@ void KX_Dome::DrawEnvMap(void)
                if (can_width/3 <= can_height/2) {
                        ortho_width = 1.0;
                        ortho_height = (float)can_height/can_width;
-               }else{
+               }
+               else {
                        ortho_height = 2.0f / 3;
                        ortho_width = (float)can_width/can_height * ortho_height;
                }
@@ -1801,7 +1804,8 @@ void KX_Dome::DrawDomeFisheye(void)
                        if (can_width < can_height) {
                                ortho_width = 1.0;
                                ortho_height = (float)can_height/can_width;
-                       }else{
+                       }
+                       else {
                                ortho_width = (float)can_width/can_height;
                                ortho_height = 1.0;
                        }
@@ -1897,7 +1901,8 @@ void KX_Dome::DrawPanorama(void)
                if ((can_width / 2) <= (can_height)) {
                        ortho_width = 1.0;
                        ortho_height = (float)can_height/can_width;
-               }else{
+               }
+               else {
                        ortho_width = (float)can_width/can_height * 0.5;
                        ortho_height = 0.5;
                }
@@ -1995,7 +2000,7 @@ void KX_Dome::DrawDomeWarped(void)
                glBindTexture(GL_TEXTURE_2D, domefacesId[m_numfaces]);
                glCallList(dlistId + m_numfaces);
        }
-       else{
+       else {
                glBindTexture(GL_TEXTURE_2D, domefacesId[m_numfaces]);
                GLDrawWarpQuads();
        }
index a173ef1ed8f78d89f89d6e553cadd25088a3cb40..2b0d13ff2f73a2c5b50b217a581c28c56610a417 100644 (file)
@@ -712,7 +712,7 @@ public:
                void                                            
        AddMesh(
                RAS_MeshObject* mesh
-       )
+       ) {
                m_meshes.push_back(mesh);
        }
 
index 9777eaf333e41605ec024cd464db60791f17e3c2..7e7e7f8cef2dcc713f23e7546a039a1aa2080e12 100644 (file)
@@ -297,7 +297,7 @@ bool KX_IpoActuator::Update(double curtime, bool frame)
                        {
                                SetLocalTime(curtime);
                        }
-                       else{
+                       else {
                                if (!m_bNegativeEvent) {
                                        /* Perform wraparound */
                                        SetLocalTime(curtime);
index 0a50ab0a43a4787662c4ee82e26a7fa966d0be26..f9c6d59b6689f3cc6c71ba2223d378cb50eb02e4 100644 (file)
@@ -150,8 +150,7 @@ private:
        int m_curreye;
 
        /** Categories for profiling display. */
-       typedef enum
-       {
+       typedef enum {
                tc_first = 0,
                tc_physics = 0,
                tc_logic,
index 78466e822e7d588c88c9bab9c95a11ec9e5b0228..15591bfa981a0fc64963a7ef596e84c5a8112ac4 100644 (file)
@@ -90,7 +90,7 @@ public:
        SetOption(
                int option,
                int value
-       ){
+       ) {
                // intentionally empty
        };
 
index 85b2a971fbea9662741189ba0fd5c8a94c558154..11d92925a0232504094f7d83e1f81a80f0ce25d1 100644 (file)
@@ -49,7 +49,7 @@ public:
        SetOption(
                int option,
                int value
-       ){
+       ) {
                // intentionally empty
        };
 
index d2d69d6db12c75eeef85df9ba33faf0e072a04b3..d2f4c69bf4786ba1d7d7ec7a82c1ee516166cbb1 100644 (file)
@@ -64,7 +64,7 @@ public:
        SetOption(
                int option,
                int value
-       ){
+       ) {
                // intentionally empty
        };
 
index 71ec3ae2f597210cac121fb76ae3cd6773ab90fe..dbdb17d0da5807e11bcd58610433894d66ba472a 100644 (file)
@@ -43,8 +43,7 @@
 
 #include "BKE_sound.h"
 
-typedef struct KX_3DSoundSettings
-{
+typedef struct KX_3DSoundSettings {
        float min_gain;
        float max_gain;
        float reference_distance;
index 1f60280e35509a340422c9cd83a515c0fc8f5267..9578130b51ecc52c7e9be8a1896c2c22b4cd1237 100644 (file)
@@ -88,7 +88,7 @@ public:
        SetOption(
                int option,
                int value
-       ){
+       ) {
                // intentionally empty
        };
 
index c378a9ea0c2085e45678e143e6431b7287274013..ddf360683cd9918f8f4eebd0a970f5b4d823f415 100644 (file)
@@ -36,7 +36,7 @@
 
 struct RAS_LightObject
 {
-       enum LightType{
+       enum LightType {
                LIGHT_SPOT,
                LIGHT_SUN,
                LIGHT_NORMAL
index 689ada84edd5df3de98669adbf9046a99ed52f17..4140563828fc45e6bf75a389c0f6b349b4463a64 100644 (file)
@@ -76,8 +76,7 @@ public :
 
        virtual 
        ~SG_ParentRelation(
-       ){
-       };
+       ) {};
 
        /** 
         * You must provide a way of duplicating an