svn merge ^/trunk/blender -r47103:47150
authorCampbell Barton <ideasman42@gmail.com>
Tue, 29 May 2012 05:48:07 +0000 (05:48 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 29 May 2012 05:48:07 +0000 (05:48 +0000)
61 files changed:
build_files/scons/config/win64-vc-config.py
extern/bullet2/CMakeLists.txt
extern/bullet2/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h
extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp
extern/bullet2/src/SConscript
intern/cycles/SConscript
intern/cycles/blender/blender_mesh.cpp
intern/cycles/blender/blender_sync.cpp
intern/cycles/device/device_cuda.cpp
intern/cycles/kernel/CMakeLists.txt
intern/cycles/kernel/SConscript
intern/cycles/kernel/kernel_bvh.h
intern/cycles/kernel/kernel_compat_cuda.h
intern/cycles/kernel/kernel_projection.h
intern/cycles/util/util_transform.h
release/scripts/modules/bpy/utils.py
release/scripts/startup/bl_ui/properties_game.py
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/effect.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/sequencer.c
source/blender/blenkernel/intern/smoke.c
source/blender/blenlib/BLI_ghash.h
source/blender/blenlib/BLI_utildefines.h
source/blender/blenlib/PIL_time.h
source/blender/blenlib/intern/BLI_ghash.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/curve/editcurve.c
source/blender/editors/include/ED_sequencer.h
source/blender/editors/interface/interface_panel.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_outliner/outliner_edit.c
source/blender/editors/space_outliner/outliner_select.c
source/blender/editors/space_outliner/outliner_tools.c
source/blender/editors/space_outliner/outliner_tree.c
source/blender/editors/space_sequencer/sequencer_add.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_sequencer/sequencer_intern.h
source/blender/editors/space_sequencer/sequencer_select.c
source/blender/editors/space_view3d/drawobject.c
source/blender/makesdna/DNA_object_types.h
source/blender/makesrna/intern/rna_image_api.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_object.c
source/blender/python/generic/py_capi_utils.c
source/blender/windowmanager/intern/wm_operators.c
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Ketsji/KX_BulletPhysicsController.cpp
source/gameengine/Ketsji/KX_BulletPhysicsController.h
source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
source/gameengine/Ketsji/KX_IPhysicsController.cpp
source/gameengine/Ketsji/KX_IPhysicsController.h
source/gameengine/Ketsji/KX_Scene.cpp
source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
source/gameengine/Physics/Bullet/CcdPhysicsController.h
source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
source/gameengine/Physics/common/PHY_Pro.h

index 3a376be60244da8776abc64fb331a30b5e5f3165..9e36be42329e225b0cd28ca95e0dfdc2fb0f9471 100644 (file)
@@ -166,7 +166,8 @@ BF_CYCLES_CUDA_BINARIES_ARCH = ['sm_13', 'sm_20', 'sm_21']
 
 #Ray trace optimization
 WITH_BF_RAYOPTIMIZATION = True
-BF_RAYOPTIMIZATION_SSE_FLAGS = ['/arch:SSE','/arch:SSE2']
+# No need to manually specify SSE/SSE2 on x64 systems.
+BF_RAYOPTIMIZATION_SSE_FLAGS = ['']
 
 WITH_BF_STATICOPENGL = False
 BF_OPENGL_INC = '${BF_OPENGL}/include'
index 51b295e897f9dba9cbae43b35c5614f8a1a4af2f..ae7d282ca55ae0508843d05ccefe69596aded54e 100644 (file)
@@ -118,6 +118,7 @@ set(SRC
        src/BulletCollision/NarrowPhaseCollision/btRaycastCallback.cpp
        src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp
        src/BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.cpp
+       src/BulletDynamics/Character/btKinematicCharacterController.cpp
        src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp
        src/BulletDynamics/ConstraintSolver/btContactConstraint.cpp
        src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp
@@ -154,7 +155,6 @@ set(SRC
        # src/BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp
        # src/BulletCollision/CollisionShapes/btBox2dShape.cpp
        # src/BulletCollision/CollisionShapes/btConvex2dShape.cpp
-       # src/BulletDynamics/Character/btKinematicCharacterController.cpp
        # src/BulletDynamics/ConstraintSolver/btHinge2Constraint.cpp
        # src/BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp
 
@@ -274,6 +274,7 @@ set(SRC
        src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h
        src/BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h
        src/BulletDynamics/Character/btCharacterControllerInterface.h
+       src/BulletDynamics/Character/btKinematicCharacterController.h
        src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h
        src/BulletDynamics/ConstraintSolver/btConstraintSolver.h
        src/BulletDynamics/ConstraintSolver/btContactConstraint.h
@@ -343,7 +344,6 @@ set(SRC
        # src/BulletCollision/CollisionDispatch/btInternalEdgeUtility.h
        # src/BulletCollision/CollisionShapes/btBox2dShape.h
        # src/BulletCollision/CollisionShapes/btConvex2dShape.h
-       # src/BulletDynamics/Character/btKinematicCharacterController.h
        # src/BulletDynamics/ConstraintSolver/btHinge2Constraint.h
        # src/BulletDynamics/ConstraintSolver/btUniversalConstraint.h
 )
index 51b27afe6866612359e52c844eb036540ca26697..9e247d125f588386b4c139c1394762d126de63e3 100644 (file)
@@ -339,7 +339,7 @@ public:
 
        
        ///***************************************** expert/internal use only *************************
-       void    setQuantizationValues(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax,btScalar quantizationMargin=btScalar(1.0));
+       void    setQuantizationValues(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax,btScalar quantizationMargin=btScalar(1.5));
        QuantizedNodeArray&     getLeafNodeArray() {                    return  m_quantizedLeafNodes;   }
        ///buildInternal is expert use only: assumes that setQuantizationValues and LeafNodeArray are initialized
        void    buildInternal();
index 9732553130d15adc834cfe8415ffbfa61449757e..f733dc0cd226fd3474beb6dd32f7ce8dd4775b9a 100644 (file)
@@ -84,7 +84,7 @@ public:
                } else
                {
                        ///need to transform normal into worldspace
-                       hitNormalWorld = m_hitCollisionObject->getWorldTransform().getBasis()*convexResult.m_hitNormalLocal;
+                       hitNormalWorld = convexResult.m_hitCollisionObject->getWorldTransform().getBasis()*convexResult.m_hitNormalLocal;
                }
 
                btScalar dotUp = m_up.dot(hitNormalWorld);
index f59bcba9fa61e4980435523eddd91f0d61004291..cd94df257eca19cda84354a799bbddd014f6a0c8 100644 (file)
@@ -23,7 +23,7 @@ elif sys.platform=='darwin':
 
 linearmath_src = env.Glob("LinearMath/*.cpp")
 
-bulletdyn_src = env.Glob("BulletDynamics/Vehicle/*.cpp") + env.Glob("BulletDynamics/ConstraintSolver/*.cpp") + env.Glob("BulletDynamics/Dynamics/*.cpp")
+bulletdyn_src = env.Glob("BulletDynamics/Vehicle/*.cpp") + env.Glob("BulletDynamics/ConstraintSolver/*.cpp") + env.Glob("BulletDynamics/Dynamics/*.cpp") + env.Glob("BulletDynamics/Character/*.cpp")
 
 collision_broadphase_src = env.Glob("BulletCollision/BroadphaseCollision/*.cpp")
 collision_dispatch_src = env.Glob("BulletCollision/CollisionDispatch/*.cpp")
index 34c6e8df2fd2a917fbce303895a662dc213c7c63..03880bddd8aec146cd7e1c45c9462dfc5cd9fd68 100644 (file)
@@ -46,8 +46,10 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', '
 if env['WITH_BF_RAYOPTIMIZATION']:
     optim_cxxflags = []
 
-    if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
+    if env['OURPLATFORM'] == 'win32-vc':
         optim_cxxflags.append('/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
+    elif env['OURPLATFORM'] == 'win64-vc':
+        optim_cxxflags.append('-D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
     else:
         optim_cxxflags.append('-ffast-math -msse -msse2 -msse3 -mfpmath=sse'.split())
     
index d7003729c46703e921188b50f93b6b2227e61b24..ad91022de075d23fef187854d70e0d042b64c742 100644 (file)
@@ -304,7 +304,6 @@ Mesh *BlenderSync::sync_mesh(BL::Object b_ob, bool object_updated)
 void BlenderSync::sync_mesh_motion(BL::Object b_ob, Mesh *mesh, int motion)
 {
        /* todo: displacement, subdivision */
-       BL::ID b_ob_data = b_ob.data();
        size_t size = mesh->verts.size();
 
        /* skip objects without deforming modifiers. this is not a totally reliable,
index c0b6e210bb14395e4b41fe9d7a4e6646640703e4..488fea8d12b4f15e26c1685c311329eb967cef96 100644 (file)
@@ -135,7 +135,6 @@ void BlenderSync::sync_data(BL::SpaceView3D b_v3d, BL::Object b_override, const
 
 void BlenderSync::sync_integrator()
 {
-       BL::RenderSettings r = b_scene.render();
        PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
 
        experimental = (RNA_enum_get(&cscene, "feature_set") != 0);
index 23ad5e5ff92a9bc949326b5f9bf23dca881c815d..491a63a7cf2f1c87834c17fcbbd7771edcd06c27 100644 (file)
@@ -259,7 +259,7 @@ public:
 
                path_create_directories(cubin);
 
-               string command = string_printf("\"%s\" -arch=sm_%d%d -m%d --cubin \"%s\" --use_fast_math "
+               string command = string_printf("\"%s\" -arch=sm_%d%d -m%d --cubin \"%s\" "
                        "-o \"%s\" --ptxas-options=\"-v\" --maxrregcount=%d --opencc-options -OPT:Olimit=0 -I\"%s\" -DNVCC",
                        nvcc.c_str(), major, minor, machine, kernel.c_str(), cubin.c_str(), maxreg, include.c_str());
 
index d165716aacaabed34ebdc3745ea8d1ff30c81479..98cb16d5dfc6aca0a054d5a4f2cd6474a82d635f 100644 (file)
@@ -114,7 +114,7 @@ if(WITH_CYCLES_CUDA_BINARIES)
 
                add_custom_command(
                        OUTPUT ${cuda_cubin}
-                       COMMAND ${CUDA_NVCC_EXECUTABLE} -arch=${arch} -m${CUDA_BITS} --cubin ${CMAKE_CURRENT_SOURCE_DIR}/kernel.cu --use_fast_math -o ${CMAKE_CURRENT_BINARY_DIR}/${cuda_cubin} --ptxas-options="-v" --maxrregcount=24 --opencc-options -OPT:Olimit=0 -I${CMAKE_CURRENT_SOURCE_DIR}/../util -I${CMAKE_CURRENT_SOURCE_DIR}/svm -DCCL_NAMESPACE_BEGIN= -DCCL_NAMESPACE_END= -DNVCC
+                       COMMAND ${CUDA_NVCC_EXECUTABLE} -arch=${arch} -m${CUDA_BITS} --cubin ${CMAKE_CURRENT_SOURCE_DIR}/kernel.cu -o ${CMAKE_CURRENT_BINARY_DIR}/${cuda_cubin} --ptxas-options="-v" --maxrregcount=24 --opencc-options -OPT:Olimit=0 -I${CMAKE_CURRENT_SOURCE_DIR}/../util -I${CMAKE_CURRENT_SOURCE_DIR}/svm -DCCL_NAMESPACE_BEGIN= -DCCL_NAMESPACE_END= -DNVCC
                        DEPENDS ${cuda_sources})
 
                delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${cuda_cubin}" ${CYCLES_INSTALL_PATH}/lib)
index be3c37b476c14b5a5aaa713917f369aac8ef9f8d..14890164a42ed754d82e99beb129c2754e0bf224 100644 (file)
@@ -35,7 +35,7 @@ if env['WITH_BF_CYCLES_CUDA_BINARIES']:
 
     # nvcc flags
     nvcc_flags = "-m%s" % (bits)
-    nvcc_flags += " --cubin -use_fast_math --ptxas-options=\"-v\" --maxrregcount=24"
+    nvcc_flags += " --cubin --ptxas-options=\"-v\" --maxrregcount=24"
     nvcc_flags += " --opencc-options -OPT:Olimit=0"
     nvcc_flags += " -DCCL_NAMESPACE_BEGIN= -DCCL_NAMESPACE_END= -DNVCC"
     nvcc_flags += " -I \"%s\" -I \"%s\"" % (util_dir, svm_dir)
index 5da4253bd86b8b7e7f973f78244c55a85e5de999..522f9861c35fe5b0f789c9cfef5d3d8c3db56c99 100644 (file)
@@ -74,10 +74,10 @@ __device_inline void bvh_instance_push(KernelGlobals *kg, int object, const Ray
 
 __device_inline void bvh_instance_pop(KernelGlobals *kg, int object, const Ray *ray, float3 *P, float3 *idir, float *t, const float tmax)
 {
-       Transform tfm = object_fetch_transform(kg, object, ray->time, OBJECT_TRANSFORM);
-
-       if(*t != FLT_MAX)
+       if(*t != FLT_MAX) {
+               Transform tfm = object_fetch_transform(kg, object, ray->time, OBJECT_TRANSFORM);
                *t *= len(transform_direction(&tfm, 1.0f/(*idir)));
+       }
 
        *P = ray->P;
        *idir = bvh_inverse_direction(ray->D);
index 2f9f2c45e88bbc89337e4090893038eb097715c9..40bae069dea6708ab831d8376b8ac255391162c8 100644 (file)
@@ -62,5 +62,14 @@ typedef texture<uchar4, 2, cudaReadModeNormalizedFloat> texture_image_uchar4;
 
 #define kernel_data __data
 
+/* Use fast math functions */
+
+#define cosf(x) __cosf(((float)x))
+#define sinf(x) __sinf(((float)x))
+#define powf(x, y) __powf(((float)x), ((float)y))
+#define tanf(x) __tanf(((float)x))
+#define logf(x) __logf(((float)x))
+#define expf(x) __expf(((float)x))
+
 #endif /* __KERNEL_COMPAT_CUDA_H__ */
 
index a5735920cd9ff7b5776eb2121e03bf3a46eba88a..72d368116264b4d5e26550e1151a454abf7d242a 100644 (file)
@@ -69,20 +69,20 @@ __device float3 equirectangular_to_direction(float u, float v)
        float theta = M_PI_F*(1.0f - v);
 
        return make_float3(
-               sin(theta)*cos(phi),
-               sin(theta)*sin(phi),
-               cos(theta));
+               sinf(theta)*cosf(phi),
+               sinf(theta)*sinf(phi),
+               cosf(theta));
 }
 
 /* Fisheye <-> Cartesian direction */
 
 __device float2 direction_to_fisheye(float3 dir, float fov)
 {
-       float r = atan2f(sqrt(dir.y*dir.y +  dir.z*dir.z), dir.x) / fov;
-       float phi = atan2(dir.z, dir.y);
+       float r = atan2f(sqrtf(dir.y*dir.y +  dir.z*dir.z), dir.x) / fov;
+       float phi = atan2f(dir.z, dir.y);
 
-       float u = r * cos(phi) + 0.5f;
-       float v = r * sin(phi) + 0.5f;
+       float u = r * cosf(phi) + 0.5f;
+       float v = r * sinf(phi) + 0.5f;
 
        return make_float2(u, v);
 }
@@ -92,7 +92,7 @@ __device float3 fisheye_to_direction(float u, float v, float fov)
        u = (u - 0.5f) * 2.0f;
        v = (v - 0.5f) * 2.0f;
 
-       float r = sqrt(u*u + v*v);
+       float r = sqrtf(u*u + v*v);
 
        if(r > 1.0f)
                return make_float3(0.0f, 0.0f, 0.0f);
@@ -127,7 +127,7 @@ __device float3 fisheye_equisolid_to_direction(float u, float v, float lens, flo
        v = (v - 0.5f) * height;
 
        float rmax = 2.0f * lens * sinf(fov * 0.25f);
-       float r = sqrt(u*u + v*v);
+       float r = sqrtf(u*u + v*v);
 
        if(r > rmax)
                return make_float3(0.0f, 0.0f, 0.0f);
@@ -153,7 +153,7 @@ __device float3 mirrorball_to_direction(float u, float v)
 
        dir.x = 2.0f*u - 1.0f;
        dir.z = 2.0f*v - 1.0f;
-       dir.y = -sqrt(max(1.0f - dir.x*dir.x - dir.z*dir.z, 0.0f));
+       dir.y = -sqrtf(max(1.0f - dir.x*dir.x - dir.z*dir.z, 0.0f));
 
        /* reflection */
        float3 I = make_float3(0.0f, -1.0f, 0.0f);
@@ -166,7 +166,7 @@ __device float2 direction_to_mirrorball(float3 dir)
        /* inverse of mirrorball_to_direction */
        dir.y -= 1.0f;
 
-       float div = 2.0f*sqrt(max(-0.5f*dir.y, 0.0f));
+       float div = 2.0f*sqrtf(max(-0.5f*dir.y, 0.0f));
        if(div > 0.0f)
                dir /= div;
 
index e4897ee6787e9aa5ca80b47387fe21c938f74127..b460c4c87a2a8d04c7e252da48c1faf742ae6ba3 100644 (file)
@@ -61,16 +61,20 @@ __device_inline float3 transform_perspective(const Transform *t, const float3 a)
 
 __device_inline float3 transform_point(const Transform *t, const float3 a)
 {
-       float4 b = make_float4(a.x, a.y, a.z, 1.0f);
-       float3 c = make_float3(dot(t->x, b), dot(t->y, b), dot(t->z, b));
+       float3 c = make_float3(
+               a.x*t->x.x + a.y*t->x.y + a.z*t->x.z + t->x.w,
+               a.x*t->y.x + a.y*t->y.y + a.z*t->y.z + t->y.w,
+               a.x*t->z.x + a.y*t->z.y + a.z*t->z.z + t->z.w);
 
        return c;
 }
 
 __device_inline float3 transform_direction(const Transform *t, const float3 a)
 {
-       float4 b = make_float4(a.x, a.y, a.z, 0.0f);
-       float3 c = make_float3(dot(t->x, b), dot(t->y, b), dot(t->z, b));
+       float3 c = make_float3(
+               a.x*t->x.x + a.y*t->x.y + a.z*t->x.z,
+               a.x*t->y.x + a.y*t->y.y + a.z*t->y.z,
+               a.x*t->z.x + a.y*t->z.y + a.z*t->z.z);
 
        return c;
 }
index 2824d6245e5a820ebca2ae9ebdbbcee67652f902..2e6d1bf8fbc4a2848a6d997fd6616f0c54c07fad 100644 (file)
@@ -391,6 +391,11 @@ def smpte_from_frame(frame, fps=None, fps_base=None):
     Returns an SMPTE formatted string from the frame: "HH:MM:SS:FF".
 
     If *fps* and *fps_base* are not given the current scene is used.
+
+    :arg time: time in seconds.
+    :type time: number or timedelta object
+    :return: the frame.
+    :rtype: float
     """
 
     if fps is None:
@@ -402,6 +407,56 @@ def smpte_from_frame(frame, fps=None, fps_base=None):
     return smpte_from_seconds((frame * fps_base) / fps, fps)
 
 
+def time_from_frame(frame, fps=None, fps_base=None):
+    """
+    Returns the time from a frame number .
+
+    If *fps* and *fps_base* are not given the current scene is used.
+
+    :arg frame: number.
+    :type frame: the frame number
+    :return: the time in seconds.
+    :rtype: timedate.timedelta
+    """
+
+    if fps is None:
+        fps = _bpy.context.scene.render.fps
+
+    if fps_base is None:
+        fps_base = _bpy.context.scene.render.fps_base
+
+    from datetime import timedelta
+
+    return timedelta((frame * fps_base) / fps)
+
+
+def time_to_frame(time, fps=None, fps_base=None):
+    """
+    Returns a float frame number from a time given in seconds or
+    as a timedate.timedelta object.
+
+    If *fps* and *fps_base* are not given the current scene is used.
+
+    :arg time: time in seconds.
+    :type time: number or a timedate.timedelta object
+    :return: the frame.
+    :rtype: float
+    """
+
+    if fps is None:
+        fps = _bpy.context.scene.render.fps
+
+    if fps_base is None:
+        fps_base = _bpy.context.scene.render.fps_base
+
+    from datetime import timedelta
+
+    if isinstance(time, timedelta):
+        time = time.total_seconds()
+
+    return (time / fps_base) * fps
+
+
 def preset_find(name, preset_path, display_name=False, ext=".py"):
     if not name:
         return None
index 2aff07bd98eaaf3d4f8e10a9c2310eeda9340f2d..857afbd9f0981689ceab14c94fa9f94f821a1b0f 100644 (file)
@@ -49,7 +49,12 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, Panel):
 
         physics_type = game.physics_type
 
-        if physics_type in {'DYNAMIC', 'RIGID_BODY'}:
+        if physics_type == 'CHARACTER':
+            layout.prop(game, "step_height", slider=True)
+            layout.prop(game, "jump_speed")
+            layout.prop(game, "fall_speed")
+
+        elif physics_type in {'DYNAMIC', 'RIGID_BODY'}:
             split = layout.split()
 
             col = split.column()
@@ -192,7 +197,7 @@ class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, Panel):
     def poll(cls, context):
         game = context.object.game
         rd = context.scene.render
-        return (game.physics_type in {'DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC'}) and (rd.engine in cls.COMPAT_ENGINES)
+        return (game.physics_type in {'DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC', 'CHARACTER'}) and (rd.engine in cls.COMPAT_ENGINES)
 
     def draw_header(self, context):
         game = context.active_object.game
index 7e2d881689c21cee8c4796e58c481c67c3fee0e7..5774dd7b1bacd28ed264b09deb0dbd8feebf4067 100644 (file)
@@ -1651,7 +1651,9 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
                                        orcodm = create_orco_dm(ob, me, NULL, CD_ORCO);
 
                                nextmask &= ~CD_MASK_ORCO;
-                               DM_set_only_copy(orcodm, nextmask | CD_MASK_ORIGINDEX);
+                               DM_set_only_copy(orcodm, nextmask | CD_MASK_ORIGINDEX |
+                                                                (mti->requiredDataMask ?
+                                                                 mti->requiredDataMask(ob, md) : 0));
                                ndm = mti->applyModifier(md, ob, orcodm, app_flags & ~MOD_APPLY_USECACHE);
 
                                if (ndm) {
index 4e7653e24737838037d2788d4a25b90aa3af780f..5dc50dca45ad01066494e3ab85c60b5c4f79de6f 100644 (file)
@@ -1193,6 +1193,18 @@ static const char *layerType_getName(int type)
        return LAYERTYPENAMES[type];
 }
 
+void customData_mask_layers__print(CustomDataMask mask)
+{
+       int i;
+
+       printf("mask=0x%lx:\n", (long unsigned int)mask);
+       for (i = 0; i < CD_NUMTYPES; i++) {
+               if (mask & CD_TYPE_AS_MASK(i)) {
+                       printf("  %s\n", layerType_getName(i));
+               }
+       }
+}
+
 /********************* CustomData functions *********************/
 static void customData_update_offsets(CustomData *data);
 
index 1d109d5f61674dc11c39e8e7d54f9e6803e5b1a6..b5254b97844beb69391d78dc693474e4a0908acd 100644 (file)
@@ -929,6 +929,8 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
                }
        }
 
+       if (point->ave)
+               zero_v3(point->ave);
        if (pd->flag & PFIELD_DO_ROTATION && point->ave && point->rot) {
                float xvec[3] = {1.0f, 0.0f, 0.0f};
                float dave[3];
index 098d702a7e26d78df417c3a78cb83e5f61003421..04631729d7a718c4fb016af9843c9118e3d8e187 100644 (file)
@@ -835,6 +835,9 @@ Object *BKE_object_add_only_object(int type, const char *name)
        /* ob->pad3 == Contact Processing Threshold */
        ob->m_contactProcessingThreshold = 1.0f;
        ob->obstacleRad = 1.0f;
+       ob->step_height = 0.15f;
+       ob->jump_speed = 10.0f;
+       ob->fall_speed = 55.0f;
        
        /* NT fluid sim defaults */
        ob->fluidsimSettings = NULL;
index fa47600deb21bd465d44dd1af2753e4016b82467..cdedd818b43372b6ebc2296e53247bf0d0c73245 100644 (file)
@@ -2673,6 +2673,9 @@ static void basic_force_cb(void *efdata_v, ParticleKey *state, float *force, flo
                force[1] += (BLI_frand()-0.5f) * part->brownfac;
                force[2] += (BLI_frand()-0.5f) * part->brownfac;
        }
+
+       if(part->flag & PART_ROT_DYN && epoint.ave)
+               copy_v3_v3(pa->state.ave, epoint.ave);
 }
 /* gathers all forces that effect particles and calculates a new state for the particle */
 static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, float cfra)
@@ -2730,7 +2733,7 @@ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, floa
 }
 static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, float timestep)
 {
-       float rotfac, rot1[4], rot2[4]={1.0,0.0,0.0,0.0}, dtime=dfra*timestep;
+       float rotfac, rot1[4], rot2[4]={1.0,0.0,0.0,0.0}, dtime=dfra*timestep, extrotfac;
 
        if ((part->flag & PART_ROTATIONS)==0) {
                pa->state.rot[0]=1.0f;
@@ -2738,7 +2741,9 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f
                return;
        }
 
-       if ((part->flag & PART_ROT_DYN)==0 && ELEM3(part->avemode, PART_AVE_VELOCITY, PART_AVE_HORIZONTAL, PART_AVE_VERTICAL)) {
+       extrotfac = len_v3(pa->state.ave);
+
+       if ((part->flag & PART_ROT_DYN) && ELEM3(part->avemode, PART_AVE_VELOCITY, PART_AVE_HORIZONTAL, PART_AVE_VERTICAL)) {
                float angle;
                float len1 = len_v3(pa->prev_state.vel);
                float len2 = len_v3(pa->state.vel);
@@ -2758,7 +2763,7 @@ static void basic_rotate(ParticleSettings *part, ParticleData *pa, float dfra, f
        }
 
        rotfac = len_v3(pa->state.ave);
-       if (rotfac == 0.0f) { /* unit_qt(in VecRotToQuat) doesn't give unit quat [1,0,0,0]?? */
+       if (rotfac == 0.0f || (part->flag & PART_ROT_DYN)==0 || extrotfac == 0.0f) { /* unit_qt(in VecRotToQuat) doesn't give unit quat [1,0,0,0]?? */
                rot1[0]=1.0f;
                rot1[1]=rot1[2]=rot1[3]=0;
        }
index 5892a6a7b3e5a9f6d7e9af6bcb618a95a5473053..63cabf80eae64fef73ffd054181ae6410c8379a6 100644 (file)
@@ -1552,8 +1552,7 @@ static void make_cb_table_byte(float lift, float gain, float gamma,
 
        for (y = 0; y < 256; y++) {
                float v = color_balance_fl((float)y * (1.0f / 255.0f), lift, gain, gamma, mul);
-               CLAMP(v, 0.0f, 1.0f);
-               table[y] = round(v * 255);
+               table[y] = FTOCHAR(v);
        }
 }
 
index ce739a00bb40e05661c02352db8c05d4e9d28daf..46286eb6cf9e8d94bcff14b22ac0651725c3807a 100644 (file)
@@ -1868,7 +1868,7 @@ static float calc_voxel_transp(float *result, float *input, int res[3], int *pix
        
        if(result[index] < 0.0f)        
        {
-#pragma omp critical           
+// #pragma omp critical                
                result[index] = *tRay;  
        }       
 
@@ -2012,7 +2012,7 @@ static void smoke_calc_transparency(float *result, float *input, float *p0, floa
        bv[4] = p0[2];
        bv[5] = p1[2];
 
-#pragma omp parallel for schedule(static,1)
+// #pragma omp parallel for schedule(static,1)
        for(z = 0; z < res[2]; z++)
        {
                size_t index = z*slabsize;
index 9034e8e51d982b0ee0bcd97da146c70d0d8287c4..c26e6cd15b329030084fc8c86c3420661d948e1a 100644 (file)
@@ -70,6 +70,7 @@ void   BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfre
 void   BLI_ghash_insert(GHash *gh, void *key, void *val);
 void  *BLI_ghash_lookup(GHash *gh, const void *key);
 int    BLI_ghash_remove(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp);
+void  *BLI_ghash_pop(GHash *gh, void *key, GHashKeyFreeFP keyfreefp);
 int    BLI_ghash_haskey(GHash *gh, void *key);
 int    BLI_ghash_size(GHash *gh);
 
index f027fb57842fa11820ef86916ddfabfcd43a98d2..f761f2edcba4422aba1b9a58ea9338c985183cfa 100644 (file)
                *(v1) =   *(v2);                                                      \
                *(v1 + 1) = *(v2 + 1);                                                \
 } (void)0
-#define VECADD(v1, v2, v3) {                                                   \
-               *(v1) =   *(v2)   + *(v3);                                             \
-               *(v1 + 1) = *(v2 + 1) + *(v3 + 1);                                     \
-               *(v1 + 2) = *(v2 + 2) + *(v3 + 2);                                     \
+#define VECADD(v1, v2, v3) {                                                  \
+               *(v1) =   *(v2)   + *(v3);                                            \
+               *(v1 + 1) = *(v2 + 1) + *(v3 + 1);                                    \
+               *(v1 + 2) = *(v2 + 2) + *(v3 + 2);                                    \
 } (void)0
-#define VECSUB(v1, v2, v3) {                                                   \
-               *(v1) =   *(v2)   - *(v3);                                             \
-               *(v1 + 1) = *(v2 + 1) - *(v3 + 1);                                     \
-               *(v1 + 2) = *(v2 + 2) - *(v3 + 2);                                     \
+#define VECSUB(v1, v2, v3) {                                                  \
+               *(v1) =   *(v2)   - *(v3);                                            \
+               *(v1 + 1) = *(v2 + 1) - *(v3 + 1);                                    \
+               *(v1 + 2) = *(v2 + 2) - *(v3 + 2);                                    \
 } (void)0
-#define VECSUB2D(v1, v2, v3)     {                                             \
-               *(v1) =   *(v2)   - *(v3);                                             \
-               *(v1 + 1) = *(v2 + 1) - *(v3 + 1);                                     \
+#define VECSUB2D(v1, v2, v3)     {                                            \
+               *(v1) =   *(v2)   - *(v3);                                            \
+               *(v1 + 1) = *(v2 + 1) - *(v3 + 1);                                    \
 } (void)0
-#define VECADDFAC(v1, v2, v3, fac) {                                           \
-               *(v1) =   *(v2)   + *(v3) * (fac);                                     \
-               *(v1 + 1) = *(v2 + 1) + *(v3 + 1) * (fac);                             \
-               *(v1 + 2) = *(v2 + 2) + *(v3 + 2) * (fac);                             \
+#define VECADDFAC(v1, v2, v3, fac) {                                          \
+               *(v1) =   *(v2)   + *(v3) * (fac);                                    \
+               *(v1 + 1) = *(v2 + 1) + *(v3 + 1) * (fac);                            \
+               *(v1 + 2) = *(v2 + 2) + *(v3 + 2) * (fac);                            \
 } (void)0
-#define VECSUBFAC(v1, v2, v3, fac) {                                           \
-               *(v1) =   *(v2)   - *(v3) * (fac);                                     \
-               *(v1 + 1) = *(v2 + 1) - *(v3 + 1) * (fac);                             \
-               *(v1 + 2) = *(v2 + 2) - *(v3 + 2) * (fac);                             \
+#define VECSUBFAC(v1, v2, v3, fac) {                                          \
+               *(v1) =   *(v2)   - *(v3) * (fac);                                    \
+               *(v1 + 1) = *(v2 + 1) - *(v3 + 1) * (fac);                            \
+               *(v1 + 2) = *(v2 + 2) - *(v3 + 2) * (fac);                            \
 } (void)0
 
 #define INPR(v1, v2) ( (v1)[0] * (v2)[0] + (v1)[1] * (v2)[1] + (v1)[2] * (v2)[2])
 #define SWITCH_SHORT(a) {                                                     \
                char s_i, *p_i;                                                       \
                p_i = (char *)&(a);                                                   \
-               s_i = p_i[0]; p_i[0] = p_i[1]; p_i[1] = s_i;                           \
+               s_i = p_i[0]; p_i[0] = p_i[1]; p_i[1] = s_i;                          \
        } (void)0
 
 
index 6153007be807d61773498520c7229e51e99f54b4..288d2fe78e52805171fe88c171f61980c014c496 100644 (file)
@@ -61,7 +61,7 @@ void    PIL_sleep_ms(int ms);
                double _timeit_##var = PIL_check_seconds_timer();                     \
                printf("time start (" #var "):  " AT "\n");                           \
                fflush(stdout);                                                       \
-               { (void)                                                              \
+               { (void)0                                                             \
 
 
 #define TIMEIT_VALUE(var) (float)(PIL_check_seconds_timer() - _timeit_##var)
@@ -71,7 +71,7 @@ void    PIL_sleep_ms(int ms);
        }                                                                         \
        printf("time end   (" #var "): %.6f" "  " AT "\n",  TIMEIT_VALUE(var));   \
        fflush(stdout);                                                           \
-} (void)                                                                      \
+} (void)0                                                                     \
 
 #ifdef __cplusplus
 }
index 5cfde3dfb777b8fd632c897065b6cf263b12fe88..4bcedb06fb032537ad82c9de06f367b2d77e2041 100644 (file)
@@ -132,18 +132,14 @@ int BLI_ghash_remove(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFre
                if (gh->cmpfp(key, e->key) == 0) {
                        Entry *n = e->next;
 
-                       if (keyfreefp)
-                               keyfreefp(e->key);
-                       if (valfreefp)
-                               valfreefp(e->val);
+                       if (keyfreefp) keyfreefp(e->key);
+                       if (valfreefp) valfreefp(e->val);
                        BLI_mempool_free(gh->entrypool, e);
 
                        /* correct but 'e' isn't used before return */
                        /* e= n; *//*UNUSED*/
-                       if (p)
-                               p->next = n;
-                       else
-                               gh->buckets[hash] = n;
+                       if (p) p->next = n;
+                       else   gh->buckets[hash] = n;
 
                        gh->nentries--;
                        return 1;
@@ -154,6 +150,36 @@ int BLI_ghash_remove(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFre
        return 0;
 }
 
+/* same as above but return the value,
+ * no free value argument since it will be returned */
+void *BLI_ghash_pop(GHash *gh, void *key, GHashKeyFreeFP keyfreefp)
+{
+       unsigned int hash = gh->hashfp(key) % gh->nbuckets;
+       Entry *e;
+       Entry *p = NULL;
+
+       for (e = gh->buckets[hash]; e; e = e->next) {
+               if (gh->cmpfp(key, e->key) == 0) {
+                       Entry *n = e->next;
+                       void *value = e->val;
+
+                       if (keyfreefp) keyfreefp(e->key);
+                       BLI_mempool_free(gh->entrypool, e);
+
+                       /* correct but 'e' isn't used before return */
+                       /* e= n; *//*UNUSED*/
+                       if (p) p->next = n;
+                       else   gh->buckets[hash] = n;
+
+                       gh->nentries--;
+                       return value;
+               }
+               p = e;
+       }
+
+       return NULL;
+}
+
 int BLI_ghash_haskey(GHash *gh, void *key)
 {
        unsigned int hash = gh->hashfp(key) % gh->nbuckets;
index 34cebe1a9683f7f687894b7505617b35d474defd..046dee148b4a1a07c73e812553b10466875ee289 100644 (file)
@@ -9147,12 +9147,6 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
                                        
                                        fd = blo_openblenderfile(mainptr->curlib->filepath, basefd->reports);
 
-                                       /* share the mainlist, so all libraries are added immediately in a
-                                        * single list. it used to be that all FileData's had their own list,
-                                        * but with indirectly linking this meant we didn't catch duplicate
-                                        * libraries properly */
-                                       fd->mainlist = mainlist;
-                                       
                                        /* allow typing in a new lib path */
                                        if (G.rt == -666) {
                                                while (fd == NULL) {
@@ -9179,6 +9173,12 @@ static void read_libraries(FileData *basefd, ListBase *mainlist)
                                        }
                                        
                                        if (fd) {
+                                               /* share the mainlist, so all libraries are added immediately in a
+                                                * single list. it used to be that all FileData's had their own list,
+                                                * but with indirectly linking this meant we didn't catch duplicate
+                                                * libraries properly */
+                                               fd->mainlist = mainlist;
+
                                                fd->reports = basefd->reports;
                                                
                                                if (fd->libmap)
index 492111ff8e7d537daa6c12ad1170ce17c3a4bb63..b94d3653f60ae5e0a7962c358b13e5be52766251 100644 (file)
@@ -356,6 +356,11 @@ static CVKeyIndex *getCVKeyIndex(EditNurb *editnurb, void *cv)
        return BLI_ghash_lookup(editnurb->keyindex, cv);
 }
 
+static CVKeyIndex *popCVKeyIndex(EditNurb *editnurb, void *cv)
+{
+       return BLI_ghash_pop(editnurb->keyindex, cv, NULL);
+}
+
 static BezTriple *getKeyIndexOrig_bezt(EditNurb *editnurb, BezTriple *bezt)
 {
        CVKeyIndex *index = getCVKeyIndex(editnurb, bezt);
@@ -459,9 +464,7 @@ static void keyIndex_updateCV(EditNurb *editnurb, char *cv,
        }
 
        for (i = 0; i < count; i++) {
-               index = getCVKeyIndex(editnurb, cv);
-
-               BLI_ghash_remove(editnurb->keyindex, cv, NULL, NULL);
+               index = popCVKeyIndex(editnurb, cv);
 
                if (index) {
                        BLI_ghash_insert(editnurb->keyindex, newcv, index);
@@ -496,11 +499,8 @@ static void keyIndex_updateNurb(EditNurb *editnurb, Nurb *nu, Nurb *newnu)
 
 static void keyIndex_swap(EditNurb *editnurb, void *a, void *b)
 {
-       CVKeyIndex *index1 = getCVKeyIndex(editnurb, a);
-       CVKeyIndex *index2 = getCVKeyIndex(editnurb, b);
-
-       BLI_ghash_remove(editnurb->keyindex, a, NULL, NULL);
-       BLI_ghash_remove(editnurb->keyindex, b, NULL, NULL);
+       CVKeyIndex *index1 = popCVKeyIndex(editnurb, a);
+       CVKeyIndex *index2 = popCVKeyIndex(editnurb, b);
 
        if (index2) BLI_ghash_insert(editnurb->keyindex, a, index2);
        if (index1) BLI_ghash_insert(editnurb->keyindex, b, index1);
index f20ebe811898d107156b6723c95d52eaddb714fc..c731245949e4bb09166e824b205b8a3cea715149 100644 (file)
 
 #define SEQ_ZOOM_FAC(szoom) ((szoom) > 0.0f) ? (szoom) : ((szoom) == 0.0f) ? (1.0f) : (-1.0f / (szoom))
 
+struct Scene;
+struct Sequence;
+
+void ED_sequencer_select_sequence_single(struct Scene *scene, struct Sequence *seq, int deselect_all);
+void ED_sequencer_deselect_all(struct Scene *scene);
+
 #endif /*  __ED_SEQUENCER_H__ */
index 92d92359814df796be28f512a00f77e7c6ad3cd5..21f87029cb0cd3a7ef0eda466be4b4ffbe111f6f 100644 (file)
@@ -166,13 +166,13 @@ static int panels_re_align(ScrArea *sa, ARegion *ar, Panel **r_pa)
 
 static void panels_collapse_all(ScrArea *sa, ARegion *ar)
 {
-       Panel *pa;
-       int align = panel_aligned(sa, ar);
+    Panel *pa;
+    int flag = ((panel_aligned(sa, ar)==BUT_HORIZONTAL)? PNL_CLOSEDX: PNL_CLOSEDY);
 
-       for (pa= ar->panels.first; pa; pa= pa->next) {
-                       if (pa->type && !(pa->type->flag & PNL_NO_HEADER))
-                               pa->flag = (align==BUT_HORIZONTAL)? PNL_CLOSEDX: PNL_CLOSEDY;
-       }
+    for (pa= ar->panels.first; pa; pa= pa->next) {
+        if (pa->type && !(pa->type->flag & PNL_NO_HEADER))
+            pa->flag = flag;
+    }
 }
 
 
index c5c08a94ae533c3e452d15800af8f0114b5d9b3e..e05191dad3b92b7630884b15526b7f19697f52e8 100644 (file)
@@ -2100,8 +2100,7 @@ static char *wpaint_make_validmap(Object *ob)
                                        if (chan->bone->flag & BONE_NO_DEFORM)
                                                continue;
 
-                                       if (BLI_ghash_haskey(gh, chan->name)) {
-                                               BLI_ghash_remove(gh, chan->name, NULL, NULL);
+                                       if (BLI_ghash_remove(gh, chan->name, NULL, NULL)) {
                                                BLI_ghash_insert(gh, chan->name, SET_INT_IN_POINTER(1));
                                        }
                                }
index c4ea8c4025fd98dcbe3c7abc573919906351ae45..8ff930ba3acd85c0d60a1222e6646f1082930314 100644 (file)
@@ -2399,6 +2399,7 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
        SpaceNode *snode= CTX_wm_space_node(C);
        ARegion *ar= CTX_wm_region(C);
        bNodeLinkDrag *nldrag= op->customdata;
+       bNodeTree *ntree = snode->edittree;
        bNode *tnode;
        bNodeSocket *tsock= NULL;
        bNodeLink *link;
@@ -2429,12 +2430,12 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
                                                link->tonode = tnode;
                                                link->tosock = tsock;
                                                /* add it to the node tree temporarily */
-                                               if (link->prev==NULL && link->next==NULL)
-                                                       BLI_addtail(&snode->edittree->links, link);
+                                               if (BLI_findindex(&ntree->links, link) < 0)
+                                                       BLI_addtail(&ntree->links, link);
                                                
-                                               snode->edittree->update |= NTREE_UPDATE_LINKS;
+                                               ntree->update |= NTREE_UPDATE_LINKS;
                                        }
-                                       ntreeUpdateTree(snode->edittree);
+                                       ntreeUpdateTree(ntree);
                                }
                                else {
                                        int do_update = FALSE;
@@ -2442,17 +2443,17 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
                                                link = linkdata->data;
                                                
                                                if (link->tonode || link->tosock) {
-                                                       BLI_remlink(&snode->edittree->links, link);
+                                                       BLI_remlink(&ntree->links, link);
                                                        link->prev = link->next = NULL;
                                                        link->tonode= NULL;
                                                        link->tosock= NULL;
                                                        
-                                                       snode->edittree->update |= NTREE_UPDATE_LINKS;
+                                                       ntree->update |= NTREE_UPDATE_LINKS;
                                                        do_update = TRUE;
                                                }
                                        }
                                        if (do_update) {
-                                               ntreeUpdateTree(snode->edittree);
+                                               ntreeUpdateTree(ntree);
                                        }
                                }
                        }
@@ -2472,12 +2473,12 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
                                                link->fromnode = tnode;
                                                link->fromsock = tsock;
                                                /* add it to the node tree temporarily */
-                                               if (link->prev==NULL && link->next==NULL)
-                                                       BLI_addtail(&snode->edittree->links, link);
+                                               if (BLI_findindex(&ntree->links, link) < 0)
+                                                       BLI_addtail(&ntree->links, link);
                                                
-                                               snode->edittree->update |= NTREE_UPDATE_LINKS;
+                                               ntree->update |= NTREE_UPDATE_LINKS;
                                        }
-                                       ntreeUpdateTree(snode->edittree);
+                                       ntreeUpdateTree(ntree);
                                }
                                else {
                                        int do_update = FALSE;
@@ -2485,17 +2486,17 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
                                                link = linkdata->data;
                                                
                                                if (link->fromnode || link->fromsock) {
-                                                       BLI_remlink(&snode->edittree->links, link);
+                                                       BLI_remlink(&ntree->links, link);
                                                        link->prev = link->next = NULL;
                                                        link->fromnode= NULL;
                                                        link->fromsock= NULL;
                                                        
-                                                       snode->edittree->update |= NTREE_UPDATE_LINKS;
+                                                       ntree->update |= NTREE_UPDATE_LINKS;
                                                        do_update = TRUE;
                                                }
                                        }
                                        if (do_update) {
-                                               ntreeUpdateTree(snode->edittree);
+                                               ntreeUpdateTree(ntree);
                                        }
                                }
                        }
@@ -2528,27 +2529,27 @@ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event)
                                else if (outside_group_rect(snode) && (link->tonode || link->fromnode)) {
                                        /* automatically add new group socket */
                                        if (link->tonode && link->tosock) {
-                                               link->fromsock = node_group_expose_socket(snode->edittree, link->tosock, SOCK_IN);
+                                               link->fromsock = node_group_expose_socket(ntree, link->tosock, SOCK_IN);
                                                link->fromnode = NULL;
-                                               if (link->prev==NULL && link->next==NULL)
-                                                       BLI_addtail(&snode->edittree->links, link);
+                                               if (BLI_findindex(&ntree->links, link) < 0)
+                                                       BLI_addtail(&ntree->links, link);
                                                
-                                               snode->edittree->update |= NTREE_UPDATE_GROUP_IN | NTREE_UPDATE_LINKS;
+                                               ntree->update |= NTREE_UPDATE_GROUP_IN | NTREE_UPDATE_LINKS;
                                        }
                                        else if (link->fromnode && link->fromsock) {
-                                               link->tosock = node_group_expose_socket(snode->edittree, link->fromsock, SOCK_OUT);
+                                               link->tosock = node_group_expose_socket(ntree, link->fromsock, SOCK_OUT);
                                                link->tonode = NULL;
-                                               if (link->prev==NULL && link->next==NULL)
-                                                       BLI_addtail(&snode->edittree->links, link);
+                                               if (BLI_findindex(&ntree->links, link) < 0)
+                                                       BLI_addtail(&ntree->links, link);
                                                
-                                               snode->edittree->update |= NTREE_UPDATE_GROUP_OUT | NTREE_UPDATE_LINKS;
+                                               ntree->update |= NTREE_UPDATE_GROUP_OUT | NTREE_UPDATE_LINKS;
                                        }
                                }
                                else
-                                       nodeRemLink(snode->edittree, link);
+                                       nodeRemLink(ntree, link);
                        }
                        
-                       ntreeUpdateTree(snode->edittree);
+                       ntreeUpdateTree(ntree);
                        snode_notify(C, snode);
                        snode_dag_update(C, snode);
                        
@@ -2589,6 +2590,7 @@ static bNodeLinkDrag *node_link_init(SpaceNode *snode, int detach)
                                        linkdata = MEM_callocN(sizeof(LinkData), "drag link op link data");
                                        linkdata->data = oplink = MEM_callocN(sizeof(bNodeLink), "drag link op link");
                                        *oplink = *link;
+                                       oplink->next = oplink->prev = NULL;
                                        BLI_addtail(&nldrag->links, linkdata);
                                        nodeRemLink(snode->edittree, link);
                                }
@@ -2620,6 +2622,7 @@ static bNodeLinkDrag *node_link_init(SpaceNode *snode, int detach)
                                        linkdata = MEM_callocN(sizeof(LinkData), "drag link op link data");
                                        linkdata->data = oplink = MEM_callocN(sizeof(bNodeLink), "drag link op link");
                                        *oplink = *link;
+                                       oplink->next = oplink->prev = NULL;
                                        BLI_addtail(&nldrag->links, linkdata);
                                        nodeRemLink(snode->edittree, link);
                                        
@@ -4055,7 +4058,7 @@ void NODE_OT_join(wmOperatorType *ot)
 {
        /* identifiers */
        ot->name = "Join Nodes";
-       ot->description = "Attaches selected nodes to a new common frame";
+       ot->description = "Attach selected nodes to a new common frame";
        ot->idname = "NODE_OT_join";
 
        /* api callbacks */
@@ -4125,7 +4128,7 @@ void NODE_OT_attach(wmOperatorType *ot)
 {
        /* identifiers */
        ot->name = "Attach Nodes";
-       ot->description = "Attaches active node to a frame";
+       ot->description = "Attach active node to a frame";
        ot->idname = "NODE_OT_attach";
 
        /* api callbacks */
@@ -4194,7 +4197,7 @@ void NODE_OT_detach(wmOperatorType *ot)
 {
        /* identifiers */
        ot->name = "Detach Nodes";
-       ot->description = "Detaches selected nodes from parents";
+       ot->description = "Detach selected nodes from parents";
        ot->idname = "NODE_OT_detach";
 
        /* api callbacks */
index 04e9cbf24c233d87f8abd8f93c7aa2987824bffc..0232006829fb205d16d5ca8f946e08a65e15110a 100644 (file)
@@ -1426,7 +1426,8 @@ TreeElement *outliner_dropzone_parent(bContext *C, wmEvent *event, TreeElement *
                /* name and first icon */
                if ((fmval[0] > te->xs + UI_UNIT_X) && (fmval[0] < te->xend)) {
                        /* always makes active object */
-                       if (te->idcode == ID_OB) {
+                       if (te->idcode == ID_OB &&
+                           !ELEM4(tselem->type, TSE_MODIFIER_BASE, TSE_MODIFIER, TSE_CONSTRAINT_BASE, TSE_CONSTRAINT)) {
                                return te;
                        }
                        else {
@@ -1635,7 +1636,7 @@ int outliner_dropzone_parent_clear(bContext *C, wmEvent *event, TreeElement *te,
                if ((fmval[0] < (te->xs + UI_UNIT_X)) || (fmval[0] > te->xend)) {
                        return 1;
                }
-               else if (te->idcode != ID_OB) {
+               else if (te->idcode != ID_OB || ELEM(tselem->type, TSE_MODIFIER_BASE, TSE_CONSTRAINT_BASE)) {
                        return 1;
                }
                
index 18769476118587ce4e0aea8edaab94ad75f21afb..068532a08a2dac4329cc95bd50259f6f8fbe10b9 100644 (file)
@@ -43,6 +43,7 @@
 #include "DNA_world_types.h"
 
 #include "BLI_utildefines.h"
+#include "BLI_listbase.h"
 
 #include "BKE_context.h"
 #include "BKE_depsgraph.h"
@@ -52,6 +53,7 @@
 #include "ED_armature.h"
 #include "ED_object.h"
 #include "ED_screen.h"
+#include "ED_sequencer.h"
 #include "ED_util.h"
 
 #include "WM_api.h"
@@ -568,16 +570,34 @@ static int tree_element_active_pose(bContext *C, Scene *scene, TreeElement *UNUS
        return 0;
 }
 
-static int tree_element_active_sequence(TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
+static int tree_element_active_sequence(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
 {
        Sequence *seq = (Sequence *) te->directdata;
+       Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
 
        if (set) {
-// XXX         select_single_seq(seq, 1);
+               /* only check on setting */
+               if (BLI_findindex(ed->seqbasep, seq) != -1) {
+                       if (set == 2) {
+                               BKE_sequencer_active_set(scene, NULL);
+                       }
+                       ED_sequencer_deselect_all(scene);
+
+                       if (set == 2 && seq->flag & SELECT) {
+                               seq->flag &= ~SELECT;
+                       }
+                       else {
+                               seq->flag |= SELECT;
+                               BKE_sequencer_active_set(scene, seq);
+                       }
+               }
+
+               WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
        }
        else {
-               if (seq->flag & SELECT)
-                       return(1);
+               if (ed->act_seq == seq && seq->flag & SELECT) {
+                       return 1;
+               }
        }
        return(0);
 }
@@ -678,7 +698,7 @@ int tree_element_type_active(bContext *C, Scene *scene, SpaceOops *soops, TreeEl
                case TSE_POSEGRP:
                        return tree_element_active_posegroup(C, scene, te, tselem, set);
                case TSE_SEQUENCE:
-                       return tree_element_active_sequence(te, tselem, set);
+                       return tree_element_active_sequence(C, scene, te, tselem, set);
                case TSE_SEQUENCE_DUP:
                        return tree_element_active_sequence_dup(scene, te, tselem, set);
                case TSE_KEYMAP_ITEM:
index a3ed2eac2d52fc1fcfba0d0df26f07917e9d3879..72b954b88e719b189061f87ea980d38dec52eb0c 100644 (file)
@@ -39,6 +39,7 @@
 #include "DNA_mesh_types.h"
 #include "DNA_meta_types.h"
 #include "DNA_scene_types.h"
+#include "DNA_sequence_types.h"
 #include "DNA_world_types.h"
 #include "DNA_object_types.h"
 
 #include "BKE_main.h"
 #include "BKE_report.h"
 #include "BKE_scene.h"
+#include "BKE_sequencer.h"
 
 #include "ED_armature.h"
 #include "ED_object.h"
 #include "ED_screen.h"
+#include "ED_sequencer.h"
 #include "ED_util.h"
 
 #include "WM_api.h"
@@ -226,7 +229,7 @@ static void outliner_do_libdata_operation(bContext *C, Scene *scene, SpaceOops *
                tselem = TREESTORE(te);
                if (tselem->flag & TSE_SELECTED) {
                        if (tselem->type == 0) {
-                               TreeStoreElem *tsep = TREESTORE(te->parent);
+                               TreeStoreElem *tsep = te->parent ? TREESTORE(te->parent) : NULL;
                                operation_cb(C, scene, te, tsep, tselem);
                        }
                }
@@ -396,13 +399,13 @@ void outliner_do_object_operation(bContext *C, Scene *scene_act, SpaceOops *soop
 
 /* ******************************************** */
 
-static void unlinkact_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te), TreeStoreElem *tselem)
+static void unlinkact_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te), TreeStoreElem *tselem, void *UNUSED(arg))
 {
        /* just set action to NULL */
        BKE_animdata_set_action(NULL, tselem->id, NULL);
 }
 
-static void cleardrivers_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te), TreeStoreElem *tselem)
+static void cleardrivers_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te), TreeStoreElem *tselem, void *UNUSED(arg))
 {
        IdAdtTemplate *iat = (IdAdtTemplate *)tselem->id;
        
@@ -410,7 +413,7 @@ static void cleardrivers_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te),
        free_fcurves(&iat->adt->drivers);
 }
 
-static void refreshdrivers_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te), TreeStoreElem *tselem)
+static void refreshdrivers_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te), TreeStoreElem *tselem, void *UNUSED(arg))
 {
        IdAdtTemplate *iat = (IdAdtTemplate *)tselem->id;
        FCurve *fcu;
@@ -426,7 +429,7 @@ static void refreshdrivers_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te
 
 /* --------------------------------- */
 
-static void pchan_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
+static void pchan_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *UNUSED(arg))
 {
        bPoseChannel *pchan = (bPoseChannel *)te->directdata;
        
@@ -442,7 +445,7 @@ static void pchan_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
                pchan->bone->flag &= ~BONE_HIDDEN_P;
 }
 
-static void bone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
+static void bone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *UNUSED(arg))
 {
        Bone *bone = (Bone *)te->directdata;
        
@@ -458,7 +461,7 @@ static void bone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
                bone->flag &= ~BONE_HIDDEN_P;
 }
 
-static void ebone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
+static void ebone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem), void *UNUSED(arg))
 {
        EditBone *ebone = (EditBone *)te->directdata;
        
@@ -474,16 +477,23 @@ static void ebone_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem))
                ebone->flag &= ~BONE_HIDDEN_A;
 }
 
-static void sequence_cb(int event, TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tselem))
+static void sequence_cb(int event, TreeElement *te, TreeStoreElem *tselem, void *scene_ptr)
 {
-//     Sequence *seq= (Sequence*) te->directdata;
+       Sequence *seq = (Sequence *)te->directdata;
        if (event == 1) {
-// XXX         select_single_seq(seq, 1);
+               Scene *scene = (Scene *)scene_ptr;
+               Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
+               if (BLI_findindex(ed->seqbasep, seq) != -1) {
+                       ED_sequencer_select_sequence_single(scene, seq, TRUE);
+               }
        }
+
+       (void)tselem;
 }
 
-static void outliner_do_data_operation(SpaceOops *soops, int type, int event, ListBase *lb, 
-                                       void (*operation_cb)(int, TreeElement *, TreeStoreElem *))
+static void outliner_do_data_operation(SpaceOops *soops, int type, int event, ListBase *lb,
+                                       void (*operation_cb)(int, TreeElement *, TreeStoreElem *, void *),
+                                       void *arg)
 {
        TreeElement *te;
        TreeStoreElem *tselem;
@@ -492,11 +502,11 @@ static void outliner_do_data_operation(SpaceOops *soops, int type, int event, Li
                tselem = TREESTORE(te);
                if (tselem->flag & TSE_SELECTED) {
                        if (tselem->type == type) {
-                               operation_cb(event, te, tselem);
+                               operation_cb(event, te, tselem, arg);
                        }
                }
                if (TSELEM_OPEN(tselem, soops)) {
-                       outliner_do_data_operation(soops, type, event, &te->subtree, operation_cb);
+                       outliner_do_data_operation(soops, type, event, &te->subtree, operation_cb, arg);
                }
        }
 }
@@ -866,7 +876,7 @@ static void outliner_do_id_set_operation(SpaceOops *soops, int type, ListBase *l
                tselem = TREESTORE(te);
                if (tselem->flag & TSE_SELECTED) {
                        if (tselem->type == type) {
-                               TreeStoreElem *tsep = TREESTORE(te->parent);
+                               TreeStoreElem *tsep = te->parent ? TREESTORE(te->parent) : NULL;
                                operation_cb(te, tselem, tsep, newid);
                        }
                }
@@ -1013,14 +1023,14 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
                
                case OUTLINER_ANIMOP_CLEAR_ACT:
                        /* clear active action - using standard rules */
-                       outliner_do_data_operation(soops, datalevel, event, &soops->tree, unlinkact_animdata_cb);
+                       outliner_do_data_operation(soops, datalevel, event, &soops->tree, unlinkact_animdata_cb, NULL);
                        
                        WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
                        ED_undo_push(C, "Unlink action");
                        break;
                        
                case OUTLINER_ANIMOP_REFRESH_DRV:
-                       outliner_do_data_operation(soops, datalevel, event, &soops->tree, refreshdrivers_animdata_cb);
+                       outliner_do_data_operation(soops, datalevel, event, &soops->tree, refreshdrivers_animdata_cb, NULL);
                        
                        WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, NULL);
                        //ED_undo_push(C, "Refresh Drivers"); /* no undo needed - shouldn't have any impact? */
@@ -1028,7 +1038,7 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
                        break;
                        
                case OUTLINER_ANIMOP_CLEAR_DRV:
-                       outliner_do_data_operation(soops, datalevel, event, &soops->tree, cleardrivers_animdata_cb);
+                       outliner_do_data_operation(soops, datalevel, event, &soops->tree, cleardrivers_animdata_cb, NULL);
                        
                        WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, NULL);
                        ED_undo_push(C, "Clear Drivers");
@@ -1097,28 +1107,29 @@ static int outliner_data_operation_exec(bContext *C, wmOperator *op)
        
        if (datalevel == TSE_POSE_CHANNEL) {
                if (event > 0) {
-                       outliner_do_data_operation(soops, datalevel, event, &soops->tree, pchan_cb);
+                       outliner_do_data_operation(soops, datalevel, event, &soops->tree, pchan_cb, NULL);
                        WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
                        ED_undo_push(C, "PoseChannel operation");
                }
        }
        else if (datalevel == TSE_BONE) {
                if (event > 0) {
-                       outliner_do_data_operation(soops, datalevel, event, &soops->tree, bone_cb);
+                       outliner_do_data_operation(soops, datalevel, event, &soops->tree, bone_cb, NULL);
                        WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
                        ED_undo_push(C, "Bone operation");
                }
        }
        else if (datalevel == TSE_EBONE) {
                if (event > 0) {
-                       outliner_do_data_operation(soops, datalevel, event, &soops->tree, ebone_cb);
+                       outliner_do_data_operation(soops, datalevel, event, &soops->tree, ebone_cb, NULL);
                        WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
                        ED_undo_push(C, "EditBone operation");
                }
        }
        else if (datalevel == TSE_SEQUENCE) {
                if (event > 0) {
-                       outliner_do_data_operation(soops, datalevel, event, &soops->tree, sequence_cb);
+                       Scene *scene = CTX_data_scene(C);
+                       outliner_do_data_operation(soops, datalevel, event, &soops->tree, sequence_cb, scene);
                }
        }
        
index 097823135f34ae6a6c96a6d99379bd59d12da13a..ff3648fc2b86d9e1b81cabcf37af8f4e3186ea97 100644 (file)
@@ -897,24 +897,16 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
                 */
                te->idcode = seq->type;
                te->directdata = seq;
+               te->name = seq->name + 2;
 
-               if (seq->type < 7) {
+               if (seq->type < SEQ_EFFECT) {
                        /*
                         * This work like the sequence.
                         * If the sequence have a name (not default name)
                         * show it, in other case put the filename.
                         */
-                       if (strcmp(seq->name, "SQ"))
-                               te->name = seq->name;
-                       else {
-                               if ((seq->strip) && (seq->strip->stripdata))
-                                       te->name = seq->strip->stripdata->name;
-                               else
-                                       te->name = "SQ None";
-                       }
 
                        if (seq->type == SEQ_META) {
-                               te->name = "Meta Strip";
                                p = seq->seqbase.first;
                                while (p) {
                                        outliner_add_element(soops, &te->subtree, (void *)p, te, TSE_SEQUENCE, index);
@@ -924,8 +916,6 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
                        else
                                outliner_add_element(soops, &te->subtree, (void *)seq->strip, te, TSE_SEQ_STRIP, index);
                }
-               else
-                       te->name = "Effect";
        }
        else if (type == TSE_SEQ_STRIP) {
                Strip *strip = (Strip *)idv;
index 97bfe1bafc20e8e2e82abae053d8b8938ce5222f..3861e2670f176afa4d6110fe10efa2bb492f209b 100644 (file)
@@ -65,6 +65,7 @@
 /* for menu/popup icons etc etc*/
 
 #include "ED_screen.h"
+#include "ED_sequencer.h"
 
 #include "UI_view2d.h"
 
@@ -246,7 +247,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
        BKE_sequencer_sort(scene);
        
        if (RNA_boolean_get(op->ptr, "replace_sel")) {
-               deselect_all_seq(scene);
+               ED_sequencer_deselect_all(scene);
                BKE_sequencer_active_set(scene, seq);
                seq->flag |= SELECT;
        }
@@ -345,7 +346,7 @@ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op)
        BKE_sequencer_sort(scene);
        
        if (RNA_boolean_get(op->ptr, "replace_sel")) {
-               deselect_all_seq(scene);
+               ED_sequencer_deselect_all(scene);
                BKE_sequencer_active_set(scene, seq);
                seq->flag |= SELECT;
        }
@@ -414,7 +415,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad
        seq_load_operator_info(&seq_load, op);
 
        if (seq_load.flag & SEQ_LOAD_REPLACE_SEL)
-               deselect_all_seq(scene);
+               ED_sequencer_deselect_all(scene);
 
        if (RNA_struct_property_is_set(op->ptr, "files"))
                tot_files = RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
@@ -595,7 +596,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
                return OPERATOR_CANCELLED;
 
        if (seq_load.flag & SEQ_LOAD_REPLACE_SEL)
-               deselect_all_seq(scene);
+               ED_sequencer_deselect_all(scene);
 
 
        /* main adding function */
@@ -786,7 +787,7 @@ static int sequencer_add_effect_strip_exec(bContext *C, wmOperator *op)
        BKE_sequencer_sort(scene); 
 
        if (RNA_boolean_get(op->ptr, "replace_sel")) {
-               deselect_all_seq(scene);
+               ED_sequencer_deselect_all(scene);
                BKE_sequencer_active_set(scene, seq);
                seq->flag |= SELECT;
        }
index b3b4e47ba812fa54d60988b3cf68e51e85cb96ca..778bddb545acdccecdd12dde6138f91b762d32f6 100644 (file)
@@ -454,7 +454,7 @@ static int seq_is_predecessor(Sequence *pred, Sequence *seq)
        return 0;
 }
 
-void deselect_all_seq(Scene *scene)
+void ED_sequencer_deselect_all(Scene *scene)
 {
        Sequence *seq;
        Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
@@ -2665,7 +2665,7 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
        int ofs;
        Sequence *iseq;
 
-       deselect_all_seq(scene);
+       ED_sequencer_deselect_all(scene);
        ofs = scene->r.cfra - seqbase_clipboard_frame;
 
        seqbase_dupli_recursive(scene, NULL, &nseqbase, &seqbase_clipboard, SEQ_DUPE_UNIQUE_NAME);
index fd536524c118054be0999889bc51be5a6795afb9..19cd7ed4ad43f75c2953bc546608a45fecef9e0f 100644 (file)
@@ -61,7 +61,6 @@ void seq_rectf(struct Sequence *seq, struct rctf *rectf);
 void boundbox_seq(struct Scene *scene, struct rctf *rect);
 struct Sequence *find_nearest_seq(struct Scene *scene, struct View2D *v2d, int *hand, const int mval[2]);
 struct Sequence *find_neighboring_sequence(struct Scene *scene, struct Sequence *test, int lr, int sel);
-void deselect_all_seq(struct Scene *scene);
 void recurs_sel_seq(struct Sequence *seqm);
 int seq_effect_find_selected(struct Scene *scene, struct Sequence *activeseq, int type, struct Sequence **selseq1, struct Sequence **selseq2, struct Sequence **selseq3, const char **error_str);
 
index 811a89b07a810f413a44deba1ef03c7f755ca550..3911ec0ef827b0911daa5636c5e3286652e640bd 100644 (file)
@@ -58,6 +58,7 @@
 
 #include "ED_types.h"
 #include "ED_screen.h"
+#include "ED_sequencer.h"
 
 #include "UI_view2d.h"
 
@@ -161,13 +162,13 @@ void select_surround_from_last(Scene *scene)
 }
 #endif
 
-
-static void UNUSED_FUNCTION(select_single_seq) (Scene * scene, Sequence * seq, int deselect_all) /* BRING BACK */
+void ED_sequencer_select_sequence_single(Scene * scene, Sequence * seq, int deselect_all)
 {
        Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
        
        if (deselect_all)
-               deselect_all_seq(scene);
+               ED_sequencer_deselect_all(scene);
+
        BKE_sequencer_active_set(scene, seq);
 
        if ((seq->type == SEQ_IMAGE) || (seq->type == SEQ_MOVIE)) {
@@ -359,7 +360,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
        else if (left_right) {
                /* use different logic for this */
                float x;
-               deselect_all_seq(scene);
+               ED_sequencer_deselect_all(scene);
                UI_view2d_region_to_view(v2d, event->mval[0], event->mval[1], &x, NULL);
 
                SEQP_BEGIN (ed, seq)
@@ -403,7 +404,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
                act_orig = ed->act_seq;
 
                if (extend == 0 && linked_handle == 0)
-                       deselect_all_seq(scene);
+                       ED_sequencer_deselect_all(scene);
        
                if (seq) {
                        BKE_sequencer_active_set(scene, seq);
@@ -442,7 +443,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
                        
                        /* On Alt selection, select the strip and bordering handles */
                        if (linked_handle && !ELEM(hand, SEQ_SIDE_LEFT, SEQ_SIDE_RIGHT)) {
-                               if (extend == 0) deselect_all_seq(scene);
+                               if (extend == 0) ED_sequencer_deselect_all(scene);
                                seq->flag |= SELECT;
                                select_surrounding_handles(scene, seq);
                        }
@@ -458,13 +459,13 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
                                        switch (sel_side) {
                                                case SEQ_SIDE_LEFT:
                                                        if ((seq->flag & SEQ_LEFTSEL) && (neighbor->flag & SEQ_RIGHTSEL)) {
-                                                               if (extend == 0) deselect_all_seq(scene);
+                                                               if (extend == 0) ED_sequencer_deselect_all(scene);
                                                                seq->flag |= SELECT;
 
                                                                select_active_side(ed->seqbasep, SEQ_SIDE_LEFT, seq->machine, seq->startdisp);
                                                        }
                                                        else {
-                                                               if (extend == 0) deselect_all_seq(scene);
+                                                               if (extend == 0) ED_sequencer_deselect_all(scene);
                                                                seq->flag |= SELECT;
 
                                                                neighbor->flag |= SELECT;
@@ -475,13 +476,13 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
                                                        break;
                                                case SEQ_SIDE_RIGHT:
                                                        if ((seq->flag & SEQ_RIGHTSEL) && (neighbor->flag & SEQ_LEFTSEL)) {
-                                                               if (extend == 0) deselect_all_seq(scene);
+                                                               if (extend == 0) ED_sequencer_deselect_all(scene);
                                                                seq->flag |= SELECT;
 
                                                                select_active_side(ed->seqbasep, SEQ_SIDE_RIGHT, seq->machine, seq->startdisp);
                                                        }
                                                        else {
-                                                               if (extend == 0) deselect_all_seq(scene);
+                                                               if (extend == 0) ED_sequencer_deselect_all(scene);
                                                                seq->flag |= SELECT;
 
                                                                neighbor->flag |= SELECT;
@@ -493,7 +494,7 @@ static int sequencer_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
                                        }
                                }
                                else {
-                                       if (extend == 0) deselect_all_seq(scene);
+                                       if (extend == 0) ED_sequencer_deselect_all(scene);
                                        select_active_side(ed->seqbasep, sel_side, seq->machine, seq->startdisp);
                                }
                        }
@@ -686,7 +687,7 @@ static int sequencer_select_linked_pick_invoke(bContext *C, wmOperator *op, wmEv
                return OPERATOR_FINISHED;  /* user error as with mesh?? */
        
        if (extend == 0)
-               deselect_all_seq(scene);
+               ED_sequencer_deselect_all(scene);
        
        mouse_seq->flag |= SELECT;
        recurs_sel_seq(mouse_seq);
index d22b3125987bb68a89b9b689ca3d0597d9f4aaa2..f60c46fed9a8379ed027c8d78500aeabeac19686 100644 (file)
@@ -2974,16 +2974,16 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
                        copy_v3_v3(v1, l[0]->v->co);
                        copy_v3_v3(v2, l[1]->v->co);
                        copy_v3_v3(v3, l[2]->v->co);
+                       add_v3_v3(vmid, v1);
+                       add_v3_v3(vmid, v2);
+                       add_v3_v3(vmid, v3);
+                       n += 3;
                        if (do_global) {
                                mul_mat3_m4_v3(ob->obmat, v1);
                                mul_mat3_m4_v3(ob->obmat, v2);
                                mul_mat3_m4_v3(ob->obmat, v3);
                        }
                        area += area_tri_v3(v1, v2, v3);
-                       add_v3_v3(vmid, v1);
-                       add_v3_v3(vmid, v2);
-                       add_v3_v3(vmid, v3);
-                       n += 3;
                }
 
                if (f) {
@@ -3030,16 +3030,15 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS
                                                        mul_mat3_m4_v3(ob->obmat, v3);
 
                                                        angle = angle_v3v3v3(v1, v2, v3);
-                                                       interp_v3_v3v3(fvec, vmid, v2, 0.8f);
                                                        copy_v3_v3(v1, v2);
                                                        copy_v3_v3(v2, v3);
                                                }
                                                else {
                                                        angle = angle_v3v3v3(loop->prev->v->co, loop->v->co, loop->next->v->co);
-                                                       interp_v3_v3v3(fvec, vmid, loop->v->co, 0.8f);
                                                }
 
                                                BLI_snprintf(numstr, sizeof(numstr), "%.3f", is_rad ? angle : RAD2DEGF(angle));
+                                               interp_v3_v3v3(fvec, vmid, loop->v->co, 0.8f);
                                                view3d_cached_text_draw_add(fvec, numstr, 0, txt_flag, col);
                                        }
                                }
index 1ea50ec9c1a2c7b988728fbbb7e35cd04768e9e8..11ca1f1fa8ecc55068b07459448a93dd4a1c28cf 100644 (file)
@@ -204,6 +204,12 @@ typedef struct Object {
        float min_vel; /* clamp the maximum velocity 0.0 is disabled */
        float m_contactProcessingThreshold;
        float obstacleRad;
+       
+       /* "Character" physics properties */
+       float step_height;
+       float jump_speed;
+       float fall_speed;
+       char pad1[4];
 
        short rotmode;          /* rotation mode - uses defines set out in DNA_action_types.h for PoseChannel rotations... */
 
@@ -483,6 +489,7 @@ typedef struct DupliObject {
 #define OB_SENSOR              0x80000
 #define OB_NAVMESH             0x100000
 #define OB_HASOBSTACLE 0x200000
+#define OB_CHARACTER           0x400000
 
 /* ob->gameflag2 */
 #define OB_NEVER_DO_ACTIVITY_CULLING   1
@@ -504,6 +511,7 @@ typedef struct DupliObject {
 #define OB_BODY_TYPE_OCCLUDER          5
 #define OB_BODY_TYPE_SENSOR                    6
 #define OB_BODY_TYPE_NAVMESH           7
+#define OB_BODY_TYPE_CHARACTER                 8
 
 /* ob->scavisflag */
 #define OB_VIS_SENS            1
index cf19002f44e5298e964a019c03127a4d22ab7e73..f84e213bfd0f069b77bb04b58e3fbfb5054e91aa 100644 (file)
@@ -207,6 +207,9 @@ static int rna_Image_gl_load(Image *image, ReportList *reports, int filter, int
                error = (int)gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
 
        if (!error) {
+               /* clean glError buffer */
+               while (glGetError() != GL_NO_ERROR){};
+
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, image->tpageflag & IMA_CLAMP_U ? GL_CLAMP : GL_REPEAT);
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, image->tpageflag & IMA_CLAMP_V ? GL_CLAMP : GL_REPEAT);
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLint)filter);
@@ -232,7 +235,7 @@ static int rna_Image_gl_touch(Image *image, ReportList *reports, int filter, int
        BKE_image_tag_time(image);
 
        if (*bind == 0)
-               error = rna_Image_gl_load(image, reports, GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR);
+               error = rna_Image_gl_load(image, reports, filter, mag);
 
        return error;
 }
index 955aac83a5cbb621325a3a951f796140b401c438..59c4af4c376a0d204e71a51a32005cfd59ba3d9b 100644 (file)
@@ -4019,7 +4019,8 @@ static void rna_def_composite_nodetree(BlenderRNA *brna)
 
        prop = RNA_def_property(srna, "chunk_size", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "chunksize");
-       RNA_def_property_ui_text(prop, "Chunksize", "Max size of a tile. Smaller values gives better distribution of multiple threads, but more overhead");
+       RNA_def_property_ui_text(prop, "Chunksize", "Max size of a tile (smaller values gives better distribution "
+                                                   "of multiple threads, but more overhead)");
        RNA_def_property_range(prop, 32, 1024);
 
        prop = RNA_def_property(srna, "use_opencl", PROP_BOOLEAN, PROP_NONE);
index 21c9187cbb84939709a58188649e8407e15027fd..7e3b368aa64cbd2bf3e3099d5c89a2cc7ecd7619 100644 (file)
@@ -891,6 +891,9 @@ static int rna_GameObjectSettings_physics_type_get(PointerRNA *ptr)
                        ob->body_type = OB_BODY_TYPE_NO_COLLISION;
                }
        }
+       else if (ob->gameflag & OB_CHARACTER) {
+               ob->body_type = OB_BODY_TYPE_CHARACTER;
+       }
        else if (ob->gameflag & OB_SENSOR) {
                ob->body_type = OB_BODY_TYPE_SENSOR;
        }
@@ -922,16 +925,16 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value)
        switch (ob->body_type) {
                case OB_BODY_TYPE_SENSOR:
                        ob->gameflag |= OB_SENSOR | OB_COLLISION | OB_GHOST;
-                       ob->gameflag &= ~(OB_OCCLUDER | OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_ACTOR |
+                       ob->gameflag &= ~(OB_OCCLUDER | OB_CHARACTER | OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_ACTOR |
                                          OB_ANISOTROPIC_FRICTION | OB_DO_FH | OB_ROT_FH | OB_COLLISION_RESPONSE | OB_NAVMESH);
                        break;
                case OB_BODY_TYPE_OCCLUDER:
                        ob->gameflag |= OB_OCCLUDER;
-                       ob->gameflag &= ~(OB_SENSOR | OB_RIGID_BODY | OB_SOFT_BODY | OB_COLLISION | OB_DYNAMIC | OB_NAVMESH);
+                       ob->gameflag &= ~(OB_SENSOR | OB_RIGID_BODY | OB_SOFT_BODY | OB_COLLISION | OB_CHARACTER | OB_DYNAMIC | OB_NAVMESH);
                        break;
                case OB_BODY_TYPE_NAVMESH:
                        ob->gameflag |= OB_NAVMESH;
-                       ob->gameflag &= ~(OB_SENSOR | OB_RIGID_BODY | OB_SOFT_BODY | OB_COLLISION | OB_DYNAMIC | OB_OCCLUDER);
+                       ob->gameflag &= ~(OB_SENSOR | OB_RIGID_BODY | OB_SOFT_BODY | OB_COLLISION | OB_CHARACTER | OB_DYNAMIC | OB_OCCLUDER);
 
                        if (ob->type == OB_MESH) {
                                /* could be moved into mesh UI but for now ensure mesh data layer */
@@ -940,24 +943,29 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value)
 
                        break;
                case OB_BODY_TYPE_NO_COLLISION:
-                       ob->gameflag &= ~(OB_SENSOR | OB_RIGID_BODY | OB_SOFT_BODY | OB_COLLISION | OB_OCCLUDER | OB_DYNAMIC | OB_NAVMESH);
+                       ob->gameflag &= ~(OB_SENSOR | OB_RIGID_BODY | OB_SOFT_BODY | OB_COLLISION | OB_CHARACTER | OB_OCCLUDER | OB_DYNAMIC | OB_NAVMESH);
                        break;
+               case OB_BODY_TYPE_CHARACTER:
+                       ob->gameflag |= OB_COLLISION | OB_GHOST | OB_CHARACTER;
+                       ob->gameflag &= ~(OB_SENSOR | OB_OCCLUDER | OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_ACTOR
+                                    | OB_ANISOTROPIC_FRICTION | OB_DO_FH | OB_ROT_FH | OB_COLLISION_RESPONSE | OB_NAVMESH);
+               break;
                case OB_BODY_TYPE_STATIC:
                        ob->gameflag |= OB_COLLISION;
-                       ob->gameflag &= ~(OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_OCCLUDER | OB_SENSOR | OB_NAVMESH);
+                       ob->gameflag &= ~(OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_OCCLUDER | OB_CHARACTER | OB_SENSOR | OB_NAVMESH);
                        break;
                case OB_BODY_TYPE_DYNAMIC:
                        ob->gameflag |= OB_COLLISION | OB_DYNAMIC | OB_ACTOR;
-                       ob->gameflag &= ~(OB_RIGID_BODY | OB_SOFT_BODY | OB_OCCLUDER | OB_SENSOR | OB_NAVMESH);
+                       ob->gameflag &= ~(OB_RIGID_BODY | OB_SOFT_BODY | OB_OCCLUDER | OB_CHARACTER | OB_SENSOR | OB_NAVMESH);
                        break;
                case OB_BODY_TYPE_RIGID:
                        ob->gameflag |= OB_COLLISION | OB_DYNAMIC | OB_RIGID_BODY | OB_ACTOR;
-                       ob->gameflag &= ~(OB_SOFT_BODY | OB_OCCLUDER | OB_SENSOR | OB_NAVMESH);
+                       ob->gameflag &= ~(OB_SOFT_BODY | OB_OCCLUDER | OB_CHARACTER | OB_SENSOR | OB_NAVMESH);
                        break;
                default:
                case OB_BODY_TYPE_SOFT:
                        ob->gameflag |= OB_COLLISION | OB_DYNAMIC | OB_SOFT_BODY | OB_ACTOR;
-                       ob->gameflag &= ~(OB_RIGID_BODY | OB_OCCLUDER | OB_SENSOR | OB_NAVMESH);
+                       ob->gameflag &= ~(OB_RIGID_BODY | OB_OCCLUDER | OB_CHARACTER | OB_SENSOR | OB_NAVMESH);
 
                        /* assume triangle mesh, if no bounds chosen for soft body */
                        if ((ob->gameflag & OB_BOUNDS) && (ob->boundtype < OB_BOUND_TRIANGLE_MESH)) {
@@ -1436,6 +1444,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna)
                                      "Collision Sensor, detects static and dynamic objects but not the other "
                                      "collision sensor objects"},
                {OB_BODY_TYPE_NAVMESH, "NAVMESH", 0, "Navigation Mesh", "Navigation mesh"},
+               {OB_BODY_TYPE_CHARACTER, "CHARACTER", 0, "Character", "Simple kinematic physics appropiate for game characters"},
                {0, NULL, 0, NULL, NULL}
        };
 
@@ -1529,6 +1538,22 @@ static void rna_def_object_game_settings(BlenderRNA *brna)
        RNA_def_property_float_sdna(prop, NULL, "max_vel");
        RNA_def_property_range(prop, 0.0, 1000.0);
        RNA_def_property_ui_text(prop, "Velocity Max", "Clamp velocity to this maximum speed");
+       
+       prop= RNA_def_property(srna, "step_height", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "step_height");
+       RNA_def_property_range(prop, 0.0, 1.0);
+       RNA_def_property_ui_text(prop, "Step Height", "Maximum height of steps the character can run over");
+
+       prop= RNA_def_property(srna, "jump_speed", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "jump_speed");
+       RNA_def_property_range(prop, 0.0, 1000.0);
+       RNA_def_property_ui_text(prop, "Jump Force", "Upward velocity applied to the character when jumping (with the Motion actuator)");
+
+       prop= RNA_def_property(srna, "fall_speed", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "fall_speed");
+       RNA_def_property_range(prop, 0.0, 1000.0);
+       RNA_def_property_ui_text(prop, "Fall Speed Max", "Maximum speed at which the character will fall");
+
 
        /* lock position */
        prop = RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE);
index 3a405575926aae59924928cf49dabd9c98e8307e..fd12f7f483dc651afa2be1abb7e42fa732ae8df3 100644 (file)
@@ -489,7 +489,7 @@ void PyC_SetHomePath(const char *py_path_bundle)
        /* cmake/MSVC debug build crashes without this, why only
         * in this case is unknown.. */
        {
-               BLI_setenv("PYTHONPATH", py_path_bundle);
+               /*BLI_setenv("PYTHONPATH", py_path_bundle)*/;
        }
 #endif
 #endif
index 0d1d9a7a552eb42909d145c70ad3a98a24c26abf..42787be8e021411342486d18f35b48320a8c8bc0 100644 (file)
@@ -922,7 +922,7 @@ void WM_operator_properties_mouse_select(wmOperatorType *ot)
 {
        RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first");
        RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Remove from selection");
-       RNA_def_boolean(ot->srna, "toggle", 0, "Toggle Selection", "Toggles selection");
+       RNA_def_boolean(ot->srna, "toggle", 0, "Toggle Selection", "Toggle the selection");
 }
 
 void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor)
index 196f032e584eb1a4521f3cf6cea923d94d5136b1..3d73ca66c92794b6b25991fda2bebebfde58aeb6 100644 (file)
@@ -1346,6 +1346,11 @@ static PHY_ShapeProps *CreateShapePropsFromBlenderObject(struct Object* blendero
        shapeProps->m_clamp_vel_min = blenderobject->min_vel;
        shapeProps->m_clamp_vel_max = blenderobject->max_vel;
        
+//  Character physics properties
+       shapeProps->m_step_height = blenderobject->step_height;
+       shapeProps->m_jump_speed = blenderobject->jump_speed;
+       shapeProps->m_fall_speed = blenderobject->fall_speed;
+       
        return shapeProps;
 }
 
@@ -1638,6 +1643,7 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
        objprop.m_dyna = (blenderobject->gameflag & OB_DYNAMIC) != 0;
        objprop.m_softbody = (blenderobject->gameflag & OB_SOFT_BODY) != 0;
        objprop.m_angular_rigidbody = (blenderobject->gameflag & OB_RIGID_BODY) != 0;
+       objprop.m_character = (blenderobject->gameflag & OB_CHARACTER) != 0;
        
        ///contact processing threshold is only for rigid bodies and static geometry, not 'dynamic'
        if (objprop.m_angular_rigidbody || !objprop.m_dyna )
@@ -1754,6 +1760,11 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj,
                objprop.m_boundclass = KX_BOUNDMESH;
        }
 
+       if ((blenderobject->gameflag & OB_CHARACTER) && !(blenderobject->gameflag & OB_BOUNDS))
+       {
+               objprop.m_boundclass = KX_BOUNDSPHERE;
+       }
+
        KX_BoxBounds bb;
        DerivedMesh* dm = NULL;
        if (gameobj->GetDeformer())
index f5926818e7d478971c312e287e8e8a0efb72055c..abc2460a5ba564f1196f031b94a54b2b95fdd21f 100644 (file)
@@ -20,8 +20,8 @@
 #include "BulletSoftBody/btSoftBody.h"
 
 
-KX_BulletPhysicsController::KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna, bool sensor, bool compound)
-: KX_IPhysicsController(dyna,sensor,compound,(PHY_IPhysicsController*)this),
+KX_BulletPhysicsController::KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna, bool sensor, bool character, bool compound)
+: KX_IPhysicsController(dyna,sensor,character,compound,(PHY_IPhysicsController*)this),
 CcdPhysicsController(ci),
 m_savedCollisionFlags(0),
 m_savedCollisionFilterGroup(0),
@@ -472,7 +472,7 @@ SG_Controller*      KX_BulletPhysicsController::GetReplica(class SG_Node* destnode)
 void   KX_BulletPhysicsController::SetSumoTransform(bool nondynaonly)
 {
 
-       if (!m_bDyna && !m_bSensor)
+       if (!m_bDyna && !m_bSensor && !m_bCharacter)
        {
                btCollisionObject* object = GetRigidBody();
                object->setActivationState(ACTIVE_TAG);
index d2f56bccaa0106b83e429ff67be1294b9517d283..4ced21aa2d81968f912ec2307645c2a96a5fd9db 100644 (file)
@@ -26,7 +26,7 @@ private:
 
 public:
 #ifdef USE_BULLET
-       KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna, bool sensor, bool compound);
+       KX_BulletPhysicsController (const CcdConstructionInfo& ci, bool dyna, bool sensor, bool character, bool compound);
        virtual ~KX_BulletPhysicsController ();
 #endif
        ///////////////////////////////////
index f1f58d7da9ac55607a3df586920eeb85f9ba5653..0f1ce4038813dc770c798736dc801890ea2cf749 100644 (file)
@@ -72,6 +72,7 @@ struct KX_ObjectProperties
        class KX_GameObject*    m_dynamic_parent;
        bool    m_isactor;
        bool    m_sensor;
+       bool    m_character;
        bool    m_concave;
        bool    m_isdeformable;
        bool    m_disableSleeping;
index e0e8e2d9b3f729c1d144e328c6572e23e155970d..227ca39281f6672c09f174a4065900ab83521aa1 100644 (file)
@@ -100,6 +100,7 @@ void        KX_ConvertBulletObject( class   KX_GameObject* gameobj,
 
        bool isbulletdyna = false;
        bool isbulletsensor = false;
+       bool isbulletchar = false;
        bool useGimpact = false;
        CcdConstructionInfo ci;
        class PHY_IMotionState* motionstate = new KX_MotionState(gameobj->GetSGNode());
@@ -122,9 +123,13 @@ void       KX_ConvertBulletObject( class   KX_GameObject* gameobj,
        ci.m_clamp_vel_min = shapeprops->m_clamp_vel_min;
        ci.m_clamp_vel_max = shapeprops->m_clamp_vel_max;
        ci.m_margin = objprop->m_margin;
+       ci.m_stepHeight = objprop->m_character ? shapeprops->m_step_height : 0.f;
+       ci.m_jumpSpeed = objprop->m_character ? shapeprops->m_jump_speed : 0.f;
+       ci.m_fallSpeed = objprop->m_character ? shapeprops->m_fall_speed : 0.f;
        shapeInfo->m_radius = objprop->m_radius;
        isbulletdyna = objprop->m_dyna;
        isbulletsensor = objprop->m_sensor;
+       isbulletchar = objprop->m_character;
        useGimpact = ((isbulletdyna || isbulletsensor) && !objprop->m_softbody);
 
        ci.m_localInertiaTensor = btVector3(ci.m_mass/3.f,ci.m_mass/3.f,ci.m_mass/3.f);
@@ -400,21 +405,24 @@ void      KX_ConvertBulletObject( class   KX_GameObject* gameobj,
        ////////////////////
        ci.m_collisionFilterGroup = 
                (isbulletsensor) ? short(CcdConstructionInfo::SensorFilter) :
-               (isbulletdyna) ? short(CcdConstructionInfo::DefaultFilter) : 
+               (isbulletdyna) ? short(CcdConstructionInfo::DefaultFilter) :
+               (isbulletchar) ? short(CcdConstructionInfo::CharacterFilter) : 
                short(CcdConstructionInfo::StaticFilter);
        ci.m_collisionFilterMask = 
                (isbulletsensor) ? short(CcdConstructionInfo::AllFilter ^ CcdConstructionInfo::SensorFilter) :
                (isbulletdyna) ? short(CcdConstructionInfo::AllFilter) : 
+               (isbulletchar) ? short(CcdConstructionInfo::AllFilter) :
                short(CcdConstructionInfo::AllFilter ^ CcdConstructionInfo::StaticFilter);
        ci.m_bRigid = objprop->m_dyna && objprop->m_angular_rigidbody;
        
        ci.m_contactProcessingThreshold = objprop->m_contactProcessingThreshold;//todo: expose this in advanced settings, just like margin, default to 10000 or so
        ci.m_bSoft = objprop->m_softbody;
        ci.m_bSensor = isbulletsensor;
+       ci.m_bCharacter = isbulletchar;
        ci.m_bGimpact = useGimpact;
        MT_Vector3 scaling = gameobj->NodeGetWorldScaling();
        ci.m_scaling.setValue(scaling[0], scaling[1], scaling[2]);
-       KX_BulletPhysicsController* physicscontroller = new KX_BulletPhysicsController(ci,isbulletdyna,isbulletsensor,objprop->m_hasCompoundChildren);
+       KX_BulletPhysicsController* physicscontroller = new KX_BulletPhysicsController(ci,isbulletdyna,isbulletsensor,isbulletchar,objprop->m_hasCompoundChildren);
        // shapeInfo is reference counted, decrement now as we don't use it anymore
        if (shapeInfo)
                shapeInfo->Release();
index bd75246a97f631adc3ff0a29aeed1b38f5cd007c..f0e57ceac02e6226df8f51c99d8ac35cd4ff4503 100644 (file)
 
 #include "PHY_DynamicTypes.h"
 
-KX_IPhysicsController::KX_IPhysicsController(bool dyna, bool sensor, bool compound, void* userdata)
+KX_IPhysicsController::KX_IPhysicsController(bool dyna, bool sensor, bool character, bool compound, void* userdata)
 
 :      m_bDyna(dyna),
        m_bSensor(sensor),
+       m_bCharacter(character),
        m_bCompound(compound),
        m_suspendDynamics(false),
        m_userdata(userdata)
index 68577f09414cb403cc637c37d4809a206c9a51ca..528bf00d574ef734660ae20e09960a89288f68c8 100644 (file)
@@ -53,11 +53,12 @@ class KX_IPhysicsController : public SG_Controller
 protected:
        bool            m_bDyna;
        bool            m_bSensor;
+       bool            m_bCharacter;
        bool            m_bCompound;
        bool            m_suspendDynamics;
        void*           m_userdata;
 public:
-       KX_IPhysicsController(bool dyna,bool sensor,bool compound, void* userdata);
+       KX_IPhysicsController(bool dyna,bool sensor,bool character,bool compound, void* userdata);
        virtual ~KX_IPhysicsController();
 
 
@@ -109,6 +110,10 @@ public:
                m_bSensor = isSensor;
        }
 
+       void    SetCharacter(bool isCharacter) {
+               m_bCharacter = isCharacter;
+       }
+
        bool    IsDyna(void) {
                return m_bDyna;
        }
@@ -117,6 +122,10 @@ public:
                return m_bSensor;
        }
 
+       bool    IsCharacter(void) {
+               return m_bCharacter;
+       }
+
        bool    IsCompound(void) {
                return m_bCompound;
        }
index 503c16fae9cada5beff8e0de00aa889fdca92102..4f0ae4261c9214f357a2084ecf99fc7578f36ef0 100644 (file)
@@ -2267,7 +2267,10 @@ KX_PYMETHODDEF_DOC(KX_Scene, addObject,
                        !ConvertPythonToGameObject(pyother, &other, false, "scene.addObject(object, other, time): KX_Scene (second argument)") )
                return NULL;
 
-
+    if (!m_inactivelist->SearchValue(ob)) {
+        PyErr_Format(PyExc_ValueError, "scene.addObject(object, other, time): KX_Scene (second argument): object does not belong to scene");
+        return NULL;
+    }
        SCA_IObject* replica = AddReplicaObject((SCA_IObject*)ob, other, time);
        
        // release here because AddReplicaObject AddRef's
index 6c1e2998bdb719f2bca7f21d46cd2b18e278ec18..92a9b405b7c8a1d22d1383820ffe0cc0587827e7 100644 (file)
@@ -22,6 +22,7 @@ subject to the following restrictions:
 
 #include "CcdPhysicsController.h"
 #include "btBulletDynamicsCommon.h"
+#include "BulletCollision/CollisionDispatch/btGhostObject.h"
 #include "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h"
 
 #include "BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h"
@@ -88,7 +89,7 @@ CcdPhysicsController::CcdPhysicsController (const CcdConstructionInfo& ci)
                m_shapeInfo->AddRef();
        
        m_bulletMotionState = 0;
-       
+       m_characterController = 0;
        
        CreateRigidbody();
        
@@ -151,6 +152,24 @@ public:
 
 };
 
+class BlenderBulletCharacterController : public btKinematicCharacterController
+{
+private:
+       btMotionState* m_motionState;
+
+public:
+       BlenderBulletCharacterController(btMotionState *motionState, btPairCachingGhostObject *ghost, btConvexShape* shape, float stepHeight)
+               : btKinematicCharacterController(ghost,shape,stepHeight,2),
+                 m_motionState(motionState)
+       {
+       }
+
+       virtual void updateAction(btCollisionWorld *collisionWorld, btScalar dt)
+       {
+               btKinematicCharacterController::updateAction(collisionWorld,dt);
+               m_motionState->setWorldTransform(getGhostObject()->getWorldTransform());
+       }
+};
 
 btRigidBody* CcdPhysicsController::GetRigidBody()
 {
@@ -164,6 +183,10 @@ btSoftBody* CcdPhysicsController::GetSoftBody()
 {
        return btSoftBody::upcast(m_object);
 }
+btKinematicCharacterController* CcdPhysicsController::GetCharacterController()
+{
+       return m_characterController;
+}
 
 #include "BulletSoftBody/btSoftBodyHelpers.h"
 
@@ -425,6 +448,29 @@ bool CcdPhysicsController::CreateSoftbody()
        return true;
 }
 
+bool CcdPhysicsController::CreateCharacterController()
+{
+       if (!m_cci.m_bCharacter)
+               return false;
+       m_object = new btPairCachingGhostObject();
+       m_object->setCollisionShape(m_collisionShape);
+       m_object->setCollisionFlags(btCollisionObject::CF_CHARACTER_OBJECT);
+
+       btTransform trans;
+       m_bulletMotionState->getWorldTransform(trans);
+       m_object->setWorldTransform(trans);
+
+       m_characterController = new BlenderBulletCharacterController(m_bulletMotionState,(btPairCachingGhostObject*)m_object,(btConvexShape*)m_collisionShape,m_cci.m_stepHeight);
+
+       PHY__Vector3 gravity;
+       m_cci.m_physicsEnv->getGravity(gravity);
+       m_characterController->setGravity(-gravity.m_vec[2]); // need positive gravity
+       m_characterController->setJumpSpeed(m_cci.m_jumpSpeed);
+       m_characterController->setFallSpeed(m_cci.m_fallSpeed);
+
+       return true;
+}
 
 void CcdPhysicsController::CreateRigidbody()
 {
@@ -433,7 +479,7 @@ void CcdPhysicsController::CreateRigidbody()
        m_bulletMotionState = new BlenderBulletMotionState(m_MotionState);
 
        ///either create a btCollisionObject, btRigidBody or btSoftBody
-       if (CreateSoftbody())
+       if (CreateSoftbody() || CreateCharacterController())
                // soft body created, done
                return;
 
index 2228b6511ce89b1525d00e1ba342530d331e0ca5..63c267443aa6a6d4ba952b1cf330eb4392e2742c 100644 (file)
@@ -29,6 +29,7 @@ subject to the following restrictions:
 ///    PHY_IPhysicsController is the abstract simplified Interface to a physical object.
 ///    It contains the IMotionState and IDeformableMesh Interfaces.
 #include "btBulletDynamicsCommon.h"
+#include "BulletDynamics/Character/btKinematicCharacterController.h"
 #include "LinearMath/btTransform.h"
 
 #include "PHY_IMotionState.h"
@@ -221,7 +222,8 @@ struct CcdConstructionInfo
                KinematicFilter = 4,
                DebrisFilter = 8,
                SensorFilter = 16,
-               AllFilter = DefaultFilter | StaticFilter | KinematicFilter | DebrisFilter | SensorFilter,
+               CharacterFilter = 32,
+               AllFilter = DefaultFilter | StaticFilter | KinematicFilter | DebrisFilter | SensorFilter | CharacterFilter,
        };
 
 
@@ -301,6 +303,10 @@ struct CcdConstructionInfo
        btScalar        m_margin;
 
        ////////////////////
+       float   m_stepHeight;
+       float   m_jumpSpeed;
+       float   m_fallSpeed;
+       
        int             m_gamesoftFlag;
        float   m_soft_linStiff;                        /* linear stiffness 0..1 */
        float   m_soft_angStiff;                /* angular stiffness 0..1 */
@@ -343,6 +349,7 @@ struct CcdConstructionInfo
        bool            m_bRigid;
        bool            m_bSoft;
        bool            m_bSensor;
+       bool            m_bCharacter;
        bool            m_bGimpact;                     // use Gimpact for mesh body
 
        ///optional use of collision group/mask:
@@ -391,6 +398,7 @@ class CcdPhysicsController : public PHY_IPhysicsController
 {
 protected:
        btCollisionObject* m_object;
+       btKinematicCharacterController* m_characterController;
        
 
        class PHY_IMotionState*         m_MotionState;
@@ -417,6 +425,7 @@ protected:
 
        void CreateRigidbody();
        bool CreateSoftbody();
+       bool CreateCharacterController();
 
        bool Register() { 
                return (m_registerCount++ == 0) ? true : false;
@@ -453,6 +462,7 @@ protected:
                btRigidBody* GetRigidBody();
                btCollisionObject*      GetCollisionObject();
                btSoftBody* GetSoftBody();
+               btKinematicCharacterController* GetCharacterController();
 
                CcdShapeConstructionInfo* GetShapeInfo() { return m_shapeInfo; }
 
index ba0d3f18b1dc054ab68e050409f97e6b0022301b..767d99583b86a41c76d783ab5ddd5f29e487bd23 100644 (file)
@@ -26,6 +26,7 @@ subject to the following restrictions:
 #include <algorithm>
 #include "btBulletDynamicsCommon.h"
 #include "LinearMath/btIDebugDraw.h"
+#include "BulletCollision/CollisionDispatch/btGhostObject.h"
 #include "BulletCollision/CollisionDispatch/btSimulationIslandManager.h"
 #include "BulletSoftBody/btSoftRigidDynamicsWorld.h"
 #include "BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.h"
@@ -369,6 +370,7 @@ m_scalingPropagated(false)
 
        m_filterCallback = new CcdOverlapFilterCallBack(this);
        m_broadphase->getOverlappingPairCache()->setOverlapFilterCallback(m_filterCallback);
+       m_broadphase->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback());
 
        setSolverType(1);//issues with quickstep and memory allocations
 //     m_dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,m_broadphase,m_solver,m_collisionConfiguration);
@@ -406,7 +408,11 @@ void       CcdPhysicsEnvironment::addCcdPhysicsController(CcdPhysicsController* ctrl)
                {
                        if (obj->getCollisionShape())
                        {
-                               m_dynamicsWorld->addCollisionObject(obj,ctrl->GetCollisionFilterGroup(), ctrl->GetCollisionFilterMask());
+                               m_dynamicsWorld->addCollisionObject(obj, ctrl->GetCollisionFilterGroup(), ctrl->GetCollisionFilterMask());
+                       }
+                       if (ctrl->GetCharacterController())
+                       {
+                               m_dynamicsWorld->addAction(ctrl->GetCharacterController());
                        }
                }
        }
index 110d4731cdc012ef5136387387e50d2449ae6082..b930177d3a8b0c28cc20a76e826e1e3f03c52b42 100644 (file)
@@ -46,6 +46,9 @@ struct PHY_ShapeProps {
        bool       m_do_anisotropic;        // Should I do anisotropic friction? 
        bool       m_do_fh;                 // Should the object have a linear Fh spring?
        bool       m_do_rot_fh;             // Should the object have an angular Fh spring?
+       MT_Scalar  m_step_height;                       // Max height of climbable steps (Character)
+       MT_Scalar  m_jump_speed;                        // Velocity of jumps (Character)
+       MT_Scalar  m_fall_speed;                        // Max velocity of falling (Character)
 };