merged changes to revision 24077
authorMaxime Curioni <maxime.curioni@gmail.com>
Sun, 25 Oct 2009 10:43:03 +0000 (10:43 +0000)
committerMaxime Curioni <maxime.curioni@gmail.com>
Sun, 25 Oct 2009 10:43:03 +0000 (10:43 +0000)
272 files changed:
CMakeLists.txt
extern/Eigen2/Eigen/src/Array/Functors.h
extern/Eigen2/Eigen/src/Array/PartialRedux.h
extern/Eigen2/Eigen/src/Core/CommaInitializer.h
extern/Eigen2/Eigen/src/Core/Cwise.h
extern/Eigen2/Eigen/src/Core/Flagged.h
extern/Eigen2/Eigen/src/Core/Functors.h
extern/Eigen2/Eigen/src/Core/Matrix.h
extern/Eigen2/Eigen/src/Core/NestByValue.h
extern/Eigen2/Eigen/src/Core/Part.h
extern/Eigen2/Eigen/src/Core/Swap.h
extern/Eigen2/Eigen/src/Core/util/Memory.h
extern/Eigen2/Eigen/src/SVD/SVD.h
extern/Eigen2/Eigen/src/Sparse/AmbiVector.h
extern/Eigen2/Eigen/src/Sparse/DynamicSparseMatrix.h
extern/Eigen2/Eigen/src/Sparse/SparseBlock.h
extern/Eigen2/Eigen/src/Sparse/SparseCwise.h
extern/Eigen2/Eigen/src/Sparse/SparseCwiseBinaryOp.h
extern/Eigen2/Eigen/src/Sparse/SparseCwiseUnaryOp.h
extern/Eigen2/Eigen/src/Sparse/SparseDiagonalProduct.h
extern/Eigen2/Eigen/src/Sparse/SparseFlagged.h
extern/Eigen2/Eigen/src/Sparse/SparseMatrix.h
extern/Eigen2/Eigen/src/Sparse/SparseTranspose.h
extern/Eigen2/Eigen/src/Sparse/SparseVector.h
extern/Eigen2/eigen-update.sh
intern/ghost/intern/GHOST_SystemCocoa.h
intern/ghost/intern/GHOST_SystemCocoa.mm
intern/ghost/intern/GHOST_SystemX11.cpp
intern/ghost/intern/GHOST_Window.h
intern/ghost/intern/GHOST_WindowCocoa.h
intern/ghost/intern/GHOST_WindowCocoa.mm
intern/ghost/intern/GHOST_WindowX11.cpp
intern/itasc/kdl/frameacc.hpp
intern/itasc/kdl/framevel.hpp
projectfiles_vc9/blender/editors/ED_editors.vcproj
release/environment-macosx [new file with mode: 0644]
release/environment-mswindows [new file with mode: 0644]
release/environment-unix [new file with mode: 0644]
release/scripts/modules/bpy_ops.py
release/scripts/ui/buttons_data_armature.py
release/scripts/ui/buttons_data_empty.py
release/scripts/ui/buttons_data_mesh.py
release/scripts/ui/buttons_material.py
release/scripts/ui/buttons_particle.py
release/scripts/ui/buttons_texture.py
release/scripts/ui/space_info.py
release/scripts/ui/space_outliner.py
release/scripts/ui/space_sequencer.py
release/scripts/ui/space_userpref.py
release/scripts/ui/space_view3d.py
release/scripts/ui/space_view3d_toolbar.py
source/blender/blenkernel/BKE_animsys.h
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/BKE_curve.h
source/blender/blenkernel/BKE_global.h
source/blender/blenkernel/BKE_key.h
source/blender/blenkernel/BKE_material.h
source/blender/blenkernel/BKE_mesh.h
source/blender/blenkernel/BKE_modifier.h
source/blender/blenkernel/BKE_sequence.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/blender.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/key.c
source/blender/blenkernel/intern/lattice.c
source/blender/blenkernel/intern/material.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/paint.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/sequence.c
source/blender/blenkernel/intern/softbody.c
source/blender/blenlib/BLI_bfile.h
source/blender/blenlib/BLI_editVert.h
source/blender/blenlib/BLI_util.h
source/blender/blenlib/BLI_winstuff.h
source/blender/blenlib/intern/BLI_bfile.c
source/blender/blenlib/intern/storage.c
source/blender/blenlib/intern/util.c
source/blender/blenlib/intern/winstuff.c
source/blender/blenloader/BLO_readfile.h
source/blender/blenloader/intern/readblenentry.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/readfile.h
source/blender/blenloader/intern/writefile.c
source/blender/editors/animation/anim_channels_defines.c
source/blender/editors/animation/anim_channels_edit.c
source/blender/editors/animation/anim_draw.c
source/blender/editors/animation/anim_filter.c
source/blender/editors/animation/anim_markers.c
source/blender/editors/animation/anim_ops.c
source/blender/editors/animation/keyframes_edit.c
source/blender/editors/armature/armature_ops.c
source/blender/editors/armature/editarmature.c
source/blender/editors/armature/poseobject.c
source/blender/editors/datafiles/B.blend.c
source/blender/editors/include/ED_keyframes_edit.h
source/blender/editors/include/ED_mesh.h
source/blender/editors/include/ED_object.h
source/blender/editors/include/ED_physics.h
source/blender/editors/include/ED_space_api.h
source/blender/editors/include/UI_icons.h
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/Makefile
source/blender/editors/interface/SConscript
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_icons.c
source/blender/editors/interface/interface_layout.c
source/blender/editors/interface/interface_panel.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/interface_style.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/mesh/editface.c
source/blender/editors/mesh/editmesh.c
source/blender/editors/mesh/editmesh_add.c
source/blender/editors/mesh/editmesh_loop.c
source/blender/editors/mesh/editmesh_mods.c
source/blender/editors/mesh/loopcut.c
source/blender/editors/mesh/mesh_intern.h
source/blender/editors/mesh/mesh_ops.c
source/blender/editors/mesh/meshtools.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_intern.h
source/blender/editors/object/object_modifier.c
source/blender/editors/object/object_ops.c
source/blender/editors/object/object_shapekey.c
source/blender/editors/object/object_vgroup.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/physics/particle_object.c
source/blender/editors/physics/physics_fluid.c
source/blender/editors/physics/physics_intern.h
source/blender/editors/physics/physics_ops.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_intern.h
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/editors/sculpt_paint/paint_stroke.c
source/blender/editors/sculpt_paint/paint_utils.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sound/sound_ops.c
source/blender/editors/space_action/action_header.c
source/blender/editors/space_api/spacetypes.c
source/blender/editors/space_buttons/buttons_context.c
source/blender/editors/space_buttons/buttons_header.c
source/blender/editors/space_console/console_ops.c
source/blender/editors/space_file/file_draw.c
source/blender/editors/space_graph/graph_draw.c
source/blender/editors/space_graph/graph_edit.c
source/blender/editors/space_graph/graph_header.c
source/blender/editors/space_graph/graph_intern.h
source/blender/editors/space_graph/graph_ops.c
source/blender/editors/space_graph/space_graph.c
source/blender/editors/space_image/image_draw.c
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_logic/logic_buttons.c
source/blender/editors/space_nla/nla_header.c
source/blender/editors/space_nla/space_nla.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_node/space_node.c
source/blender/editors/space_outliner/outliner.c
source/blender/editors/space_outliner/outliner_intern.h
source/blender/editors/space_outliner/outliner_ops.c
source/blender/editors/space_script/script_edit.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_sequencer/sequencer_ops.c
source/blender/editors/space_sequencer/sequencer_select.c
source/blender/editors/space_sequencer/space_sequencer.c
source/blender/editors/space_text/text_draw.c
source/blender/editors/space_text/text_ops.c
source/blender/editors/space_text/text_python.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/drawvolume.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/space_view3d/view3d_view.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform.h
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_snap.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/editors/uvedit/uvedit_unwrap_ops.c
source/blender/gpu/GPU_extensions.h
source/blender/gpu/intern/gpu_buffers.c
source/blender/gpu/intern/gpu_extensions.c
source/blender/gpu/intern/gpu_material.c
source/blender/gpu/intern/gpu_shader_material.glsl
source/blender/gpu/intern/gpu_shader_material.glsl.c
source/blender/ikplugin/intern/itasc_plugin.cpp
source/blender/makesdna/DNA_fileglobal_types.h
source/blender/makesdna/DNA_mesh_types.h
source/blender/makesdna/DNA_modifier_types.h
source/blender/makesdna/DNA_object_types.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_screen_types.h
source/blender/makesdna/DNA_space_types.h
source/blender/makesdna/DNA_text_types.h
source/blender/makesdna/DNA_windowmanager_types.h
source/blender/makesrna/RNA_types.h
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_constraint.c
source/blender/makesrna/intern/rna_key.c
source/blender/makesrna/intern/rna_material.c
source/blender/makesrna/intern/rna_mesh.c
source/blender/makesrna/intern/rna_modifier.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_sculpt_paint.c
source/blender/makesrna/intern/rna_sequence.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_ui.c
source/blender/makesrna/intern/rna_ui_api.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/makesrna/intern/rna_wm.c
source/blender/nodes/intern/CMP_nodes/CMP_defocus.c
source/blender/nodes/intern/CMP_nodes/CMP_image.c
source/blender/nodes/intern/CMP_util.c
source/blender/nodes/intern/SHD_nodes/SHD_mixRgb.c
source/blender/nodes/intern/TEX_nodes/TEX_output.c
source/blender/python/generic/matrix.c
source/blender/python/generic/vector.c
source/blender/python/intern/bpy_interface.c
source/blender/python/intern/bpy_rna.c
source/blender/render/SConscript
source/blender/render/intern/raytrace/reorganize.h
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/rayshade.c
source/blender/render/intern/source/volume_precache.c
source/blender/render/intern/source/volumetric.c
source/blender/render/intern/source/zbuf.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/WM_types.h
source/blender/windowmanager/intern/wm.c
source/blender/windowmanager/intern/wm_cursors.c
source/blender/windowmanager/intern/wm_draw.c
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_files.c
source/blender/windowmanager/intern/wm_init_exit.c
source/blender/windowmanager/intern/wm_jobs.c
source/blender/windowmanager/intern/wm_keymap.c
source/blender/windowmanager/intern/wm_operators.c
source/blender/windowmanager/intern/wm_window.c
source/blender/windowmanager/wm.h
source/blender/windowmanager/wm_event_types.h
source/blender/windowmanager/wm_window.h
source/creator/CMakeLists.txt
source/creator/SConscript
source/creator/buildinfo.c
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
source/gameengine/Converter/BL_ArmatureActuator.cpp
source/gameengine/Converter/BL_ShapeDeformer.cpp
source/gameengine/Converter/BL_SkinDeformer.cpp
source/gameengine/Converter/BL_SkinDeformer.h
source/gameengine/GamePlayer/ghost/GPG_Application.cpp
source/gameengine/Ketsji/KX_GameObject.cpp
source/nan_compile.mk
tools/Blender.py

index d53f4ed99664361c3e302a5e00984e74ff3c2acd..ea62bbceb0e9d44f9c2390eec358c0bc16a7128e 100644 (file)
@@ -82,7 +82,8 @@ OPTION(WITH_BUILDINFO     "Include extra build details" ON)
 OPTION(WITH_INSTALL       "Install accompanying scripts and language files needed to run blender" ON)
 
 IF (APPLE)
-OPTION(WITH_COCOA        "Use Cocoa framework instead of deprecated Carbon" OFF)
+OPTION(WITH_COCOA        "Use Cocoa framework instead of deprecated Carbon" ON)
+OPTION(WITH_LIBS10.5     "Use 10.5 libs (needed for 64bit builds)" OFF)
 ENDIF (APPLE)
 
 IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
@@ -396,17 +397,22 @@ IF(WIN32)
 ENDIF(WIN32)
 
 IF(APPLE)
-       IF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
-               SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.x.i386)
-       ELSE(CMAKE_OSX_ARCHITECTURES MATCHES i386)
-               SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-6.1-powerpc)
-       ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
+       IF(WITH_LIBS10.5)
+               SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-9.x.universal)
+       ELSE(WITH_LIBS10.5)
+               IF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
+                       SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-8.x.i386)
+               ELSE(CMAKE_OSX_ARCHITECTURES MATCHES i386)
+                       SET(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin-6.1-powerpc)
+               ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES i386)
+       ENDIF(WITH_LIBS10.5)
+       
 
        IF(WITH_OPENAL)
                FIND_PACKAGE(OpenAL)
                IF(OPENAL_FOUND)
                        SET(WITH_OPENAL ON)
-                       SET(OPENAL_INCLUDE_DIR "${OPENAL_INCLUDE_DIR};${LIBDIR}/openal/include")
+                       SET(OPENAL_INCLUDE_DIR "${LIBDIR}/openal/include")
                ELSE(OPENAL_FOUND)
                        SET(WITH_OPENAL OFF)
                ENDIF(OPENAL_FOUND)
@@ -432,20 +438,20 @@ IF(APPLE)
                # we use precompiled libraries for py 3.1 and up by default
 
                SET(PYTHON ${LIBDIR}/python)
-               SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}" CACHE STRING "")
-               # SET(PYTHON_BINARY "${PYTHON}/bin/python${PYTHON_VERSION}" CACHE STRING "") # not used yet
+               SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}")
+               # SET(PYTHON_BINARY "${PYTHON}/bin/python${PYTHON_VERSION}") # not used yet
                SET(PYTHON_LIB python${PYTHON_VERSION})
-               SET(PYTHON_LIBPATH "${PYTHON}/lib/python${PYTHON_VERSION}" CACHE STRING "")
+               SET(PYTHON_LIBPATH "${PYTHON}/lib/python${PYTHON_VERSION}")
                #    SET(PYTHON_LINKFLAGS "-u _PyMac_Error")  # won't  build with this enabled
        ELSE(PYTHON_VERSION MATCHES 3.1)
                # otherwise, use custom system framework
 
                SET(PYTHON /System/Library/Frameworks/Python.framework/Versions/)
                SET(PYTHON_VERSION 2.5)
-               SET(PYTHON_INC "${PYTHON}${PYTHON_VERSION}/include/python${PYTHON_VERSION}" CACHE STRING "")
-               # SET(PYTHON_BINARY ${PYTHON}${PYTHON_VERSION}/bin/python${PYTHON_VERSION} CACHE STRING "") # not used yet
+               SET(PYTHON_INC "${PYTHON}${PYTHON_VERSION}/include/python${PYTHON_VERSION}")
+               # SET(PYTHON_BINARY ${PYTHON}${PYTHON_VERSION}/bin/python${PYTHON_VERSION}) # not used yet
                SET(PYTHON_LIB "")
-               SET(PYTHON_LIBPATH ${PYTHON}${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config CACHE STRING "")
+               SET(PYTHON_LIBPATH ${PYTHON}${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config)
                SET(PYTHON_LINKFLAGS "-u _PyMac_Error -framework System -framework Python")
        ENDIF(PYTHON_VERSION MATCHES 3.1)
 
@@ -457,7 +463,7 @@ IF(APPLE)
        IF(WITH_FFTW3)
                SET(FFTW3 ${LIBDIR}/fftw3)
                SET(FFTW3_INC ${FFTW3}/include)
-               SET(FFTW3_LIB libfftw)
+               SET(FFTW3_LIB fftw3)
                SET(FFTW3_LIBPATH ${FFTW3}/lib)
        ENDIF(WITH_FFTW3)
 
@@ -529,15 +535,21 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
 
 
 # buildinfo
-IF(UNIX)
-       IF(WITH_BUILDINFO)
+IF(WITH_BUILDINFO)
+       # BUILD_PLATFORM and BUILD_PLATFORM are taken from CMake
+       IF(UNIX)
                EXEC_PROGRAM("date \"+%Y-%m-%d\"" OUTPUT_VARIABLE BUILD_DATE)
                EXEC_PROGRAM("date \"+%H:%M:%S\"" OUTPUT_VARIABLE BUILD_TIME)  
                EXEC_PROGRAM("svnversion ${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE BUILD_REV)
-               # BUILD_PLATFORM and BUILD_PLATFORM are taken from CMake
-       ENDIF(WITH_BUILDINFO)
-ENDIF(UNIX)
-
+       ENDIF(UNIX)
+       
+       IF(WIN32)
+               EXEC_PROGRAM("cmd /c date /t" OUTPUT_VARIABLE BUILD_DATE)
+               EXEC_PROGRAM("cmd /c time /t" OUTPUT_VARIABLE BUILD_TIME)  
+               EXEC_PROGRAM("svnversion ${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE BUILD_REV)
+       ENDIF(WIN32)
+ENDIF(WITH_BUILDINFO)
+       
 #-----------------------------------------------------------------------------
 # Common.
 
index 0aae7fd2c40d33a6af750a22fb54e9c5c377ae3c..c2c325a788e35430e13ca07fc8ef649714f3dfed 100644 (file)
@@ -43,6 +43,8 @@ struct ei_scalar_add_op {
   inline const PacketScalar packetOp(const PacketScalar& a) const
   { return ei_padd(a, ei_pset1(m_other)); }
   const Scalar m_other;
+private:
+  ei_scalar_add_op& operator=(const ei_scalar_add_op&);
 };
 template<typename Scalar>
 struct ei_functor_traits<ei_scalar_add_op<Scalar> >
@@ -138,6 +140,8 @@ struct ei_scalar_pow_op {
   inline ei_scalar_pow_op(const Scalar& exponent) : m_exponent(exponent) {}
   inline Scalar operator() (const Scalar& a) const { return ei_pow(a, m_exponent); }
   const Scalar m_exponent;
+private:
+  ei_scalar_pow_op& operator=(const ei_scalar_pow_op&);
 };
 template<typename Scalar>
 struct ei_functor_traits<ei_scalar_pow_op<Scalar> >
index b1e8fd4babdfa3e22fd443992cf309bb72e32951..3a052ca8a3d70e84312752073179ab739c44bbb6 100644 (file)
@@ -133,6 +133,8 @@ struct ei_member_redux {
   inline result_type operator()(const MatrixBase<Derived>& mat) const
   { return mat.redux(m_functor); }
   const BinaryOp m_functor;
+private:
+  ei_member_redux& operator=(const ei_member_redux&);
 };
 
 /** \array_module \ingroup Array
@@ -290,6 +292,9 @@ template<typename ExpressionType, int Direction> class PartialRedux
 
   protected:
     ExpressionTypeNested m_matrix;
+
+  private:
+    PartialRedux& operator=(const PartialRedux&);
 };
 
 /** \array_module
index ed28e0ca3713c9fc5b19719d6fe7bfdfbd2ae086..f66cbd6d5e1fc23015963d19adc74f464d2f6ceb 100644 (file)
@@ -116,6 +116,9 @@ struct CommaInitializer
   int m_row;              // current row id
   int m_col;              // current col id
   int m_currentBlockRows; // current block height
+
+private:
+  CommaInitializer& operator=(const CommaInitializer&);
 };
 
 /** \anchor MatrixBaseCommaInitRef
index 0e92dce4e121c977a45a21251c156cb9b9f61302..4dc9d514b04935c73345c85e489db05e67c96843 100644 (file)
@@ -178,6 +178,9 @@ template<typename ExpressionType> class Cwise
 
   protected:
     ExpressionTypeNested m_matrix;
+
+  private:
+    Cwise& operator=(const Cwise&);
 };
 
 /** \returns a Cwise wrapper of *this providing additional coefficient-wise operations
index ce50246cb678e628dd5c81a4ac35c13c50b0f7cc..e3d25341d9e840521d05b6767040b74f3943ab44 100644 (file)
@@ -109,6 +109,9 @@ template<typename ExpressionType, unsigned int Added, unsigned int Removed> clas
 
   protected:
     ExpressionTypeNested m_matrix;
+
+private:
+  Flagged& operator=(const Flagged&);
 };
 
 /** \returns an expression of *this with added flags
index c8ca3dac1cfdc04f9bfec97946d87c46ea8daed4..969cad78d8f768fb9bcf1ffb23c74558309e48e8 100644 (file)
@@ -279,6 +279,8 @@ struct ei_scalar_multiple_op {
   EIGEN_STRONG_INLINE const PacketScalar packetOp(const PacketScalar& a) const
   { return ei_pmul(a, ei_pset1(m_other)); }
   const Scalar m_other;
+private:
+  ei_scalar_multiple_op& operator=(const ei_scalar_multiple_op&);
 };
 template<typename Scalar>
 struct ei_functor_traits<ei_scalar_multiple_op<Scalar> >
@@ -294,6 +296,8 @@ struct ei_scalar_quotient1_impl {
   EIGEN_STRONG_INLINE const PacketScalar packetOp(const PacketScalar& a) const
   { return ei_pmul(a, ei_pset1(m_other)); }
   const Scalar m_other;
+private:
+  ei_scalar_quotient1_impl& operator=(const ei_scalar_quotient1_impl&);
 };
 template<typename Scalar>
 struct ei_functor_traits<ei_scalar_quotient1_impl<Scalar,true> >
@@ -306,6 +310,8 @@ struct ei_scalar_quotient1_impl<Scalar,false> {
   EIGEN_STRONG_INLINE ei_scalar_quotient1_impl(const Scalar& other) : m_other(other) {}
   EIGEN_STRONG_INLINE Scalar operator() (const Scalar& a) const { return a / m_other; }
   const Scalar m_other;
+private:
+  ei_scalar_quotient1_impl& operator=(const ei_scalar_quotient1_impl&);
 };
 template<typename Scalar>
 struct ei_functor_traits<ei_scalar_quotient1_impl<Scalar,false> >
@@ -323,6 +329,8 @@ template<typename Scalar>
 struct ei_scalar_quotient1_op : ei_scalar_quotient1_impl<Scalar, NumTraits<Scalar>::HasFloatingPoint > {
   EIGEN_STRONG_INLINE ei_scalar_quotient1_op(const Scalar& other)
     : ei_scalar_quotient1_impl<Scalar, NumTraits<Scalar>::HasFloatingPoint >(other) {}
+private:
+  ei_scalar_quotient1_op& operator=(const ei_scalar_quotient1_op&);
 };
 
 // nullary functors
@@ -335,6 +343,8 @@ struct ei_scalar_constant_op {
   EIGEN_STRONG_INLINE const Scalar operator() (int, int = 0) const { return m_other; }
   EIGEN_STRONG_INLINE const PacketScalar packetOp() const { return ei_pset1(m_other); }
   const Scalar m_other;
+private:
+  ei_scalar_constant_op& operator=(const ei_scalar_constant_op&);
 };
 template<typename Scalar>
 struct ei_functor_traits<ei_scalar_constant_op<Scalar> >
index ffd16d3760614ba0e25c19359b087a9576447e12..22090c777da8b6d40b860467f988b713f34c9fb3 100644 (file)
@@ -505,7 +505,9 @@ class Matrix
     template<typename OtherDerived>
     EIGEN_STRONG_INLINE Matrix& _set(const MatrixBase<OtherDerived>& other)
     {
-      _set_selector(other.derived(), typename ei_meta_if<bool(int(OtherDerived::Flags) & EvalBeforeAssigningBit), ei_meta_true, ei_meta_false>::ret());
+      // this enum introduced to fix compilation with gcc 3.3
+      enum { cond = int(OtherDerived::Flags) & EvalBeforeAssigningBit };
+      _set_selector(other.derived(), typename ei_meta_if<bool(cond), ei_meta_true, ei_meta_false>::ret());
       return *this;
     }
 
index da79315bffe1753eeb59558de39c1c25411c54cd..2a14ab1f1562f2d6641838bab3a9c8db135a5134 100644 (file)
@@ -100,6 +100,9 @@ template<typename ExpressionType> class NestByValue
 
   protected:
     const ExpressionType m_expression;
+
+  private:
+    NestByValue& operator=(const NestByValue&);
 };
 
 /** \returns an expression of the temporary version of *this.
index 9c273f249ecd1aeda4027be62b4a72763b93ab15..96229f43b68be6dfcf0f887ab2027790bf9065c3 100644 (file)
@@ -124,8 +124,10 @@ template<typename MatrixType, unsigned int Mode> class Part
     }
 
   protected:
-
     const typename MatrixType::Nested m_matrix;
+
+  private:
+    Part& operator=(const Part&);
 };
 
 /** \nonstableyet
index 77d562cd3ace59fdab03d48311f6657eedcb1a9e..9aaac652fd830087dac8190acc15047aad8dffb4 100644 (file)
@@ -117,6 +117,9 @@ template<typename ExpressionType> class SwapWrapper
 
   protected:
     ExpressionType& m_expression;
+
+  private:
+    SwapWrapper& operator=(const SwapWrapper&);
 };
 
 /** swaps *this with the expression \a other.
index 09ad39d5be97de102ebbc45f743d76c5df3493e4..0a43e7f7bf2c0d58b4f2f73930853a5e81705fc3 100644 (file)
@@ -1,5 +1,5 @@
 // This file is part of Eigen, a lightweight C++ template library
-// for linear algebra. Eigen itself is part of the KDE project.
+// for linear algebra.
 //
 // Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
 // Copyright (C) 2008-2009 Benoit Jacob <jacob.benoit.1@gmail.com>
 #ifndef EIGEN_MEMORY_H
 #define EIGEN_MEMORY_H
 
-#if defined(__APPLE__) || defined(_WIN64)
+// FreeBSD 6 seems to have 16-byte aligned malloc
+// See http://svn.freebsd.org/viewvc/base/stable/6/lib/libc/stdlib/malloc.c?view=markup
+// FreeBSD 7 seems to have 16-byte aligned malloc except on ARM and MIPS architectures
+// See http://svn.freebsd.org/viewvc/base/stable/7/lib/libc/stdlib/malloc.c?view=markup
+#if defined(__FreeBSD__) && !defined(__arm__) && !defined(__mips__)
+#define EIGEN_FREEBSD_MALLOC_ALREADY_ALIGNED 1
+#else
+#define EIGEN_FREEBSD_MALLOC_ALREADY_ALIGNED 0
+#endif
+
+#if defined(__APPLE__) || defined(_WIN64) || EIGEN_FREEBSD_MALLOC_ALREADY_ALIGNED
   #define EIGEN_MALLOC_ALREADY_ALIGNED 1
 #else
   #define EIGEN_MALLOC_ALREADY_ALIGNED 0
@@ -65,7 +75,7 @@ inline void ei_handmade_aligned_free(void *ptr)
 }
 
 /** \internal allocates \a size bytes. The returned pointer is guaranteed to have 16 bytes alignment.
-  * On allocation error, the returned pointer is undefined, but if exceptions are enabled then a std::bad_alloc is thrown.
+  * On allocation error, the returned pointer is null, and if exceptions are enabled then a std::bad_alloc is thrown.
   */
 inline void* ei_aligned_malloc(size_t size)
 {
@@ -96,7 +106,7 @@ inline void* ei_aligned_malloc(size_t size)
 }
 
 /** allocates \a size bytes. If Align is true, then the returned ptr is 16-byte-aligned.
-  * On allocation error, the returned pointer is undefined, but if exceptions are enabled then a std::bad_alloc is thrown.
+  * On allocation error, the returned pointer is null, and if exceptions are enabled then a std::bad_alloc is thrown.
   */
 template<bool Align> inline void* ei_conditional_aligned_malloc(size_t size)
 {
@@ -116,20 +126,29 @@ template<> inline void* ei_conditional_aligned_malloc<false>(size_t size)
   return result;
 }
 
+/** \internal construct the elements of an array.
+  * The \a size parameter tells on how many objects to call the constructor of T.
+  */
+template<typename T> inline T* ei_construct_elements_of_array(T *ptr, size_t size)
+{
+  for (size_t i=0; i < size; ++i) ::new (ptr + i) T;
+  return ptr;
+}
+
 /** allocates \a size objects of type T. The returned pointer is guaranteed to have 16 bytes alignment.
   * On allocation error, the returned pointer is undefined, but if exceptions are enabled then a std::bad_alloc is thrown.
   * The default constructor of T is called.
   */
 template<typename T> inline T* ei_aligned_new(size_t size)
 {
-  void *void_result = ei_aligned_malloc(sizeof(T)*size);
-  return ::new(void_result) T[size];
+  T *result = reinterpret_cast<T*>(ei_aligned_malloc(sizeof(T)*size));
+  return ei_construct_elements_of_array(result, size);
 }
 
 template<typename T, bool Align> inline T* ei_conditional_aligned_new(size_t size)
 {
-  void *void_result = ei_conditional_aligned_malloc<Align>(sizeof(T)*size);
-  return ::new(void_result) T[size];
+  T *result = reinterpret_cast<T*>(ei_conditional_aligned_malloc<Align>(sizeof(T)*size));
+  return ei_construct_elements_of_array(result, size);
 }
 
 /** \internal free memory allocated with ei_aligned_malloc
@@ -163,10 +182,10 @@ template<> inline void ei_conditional_aligned_free<false>(void *ptr)
   free(ptr);
 }
 
-/** \internal delete the elements of an array.
+/** \internal destruct the elements of an array.
   * The \a size parameters tells on how many objects to call the destructor of T.
   */
-template<typename T> inline void ei_delete_elements_of_array(T *ptr, size_t size)
+template<typename T> inline void ei_destruct_elements_of_array(T *ptr, size_t size)
 {
   // always destruct an array starting from the end.
   while(size) ptr[--size].~T();
@@ -177,7 +196,7 @@ template<typename T> inline void ei_delete_elements_of_array(T *ptr, size_t size
   */
 template<typename T> inline void ei_aligned_delete(T *ptr, size_t size)
 {
-  ei_delete_elements_of_array<T>(ptr, size);
+  ei_destruct_elements_of_array<T>(ptr, size);
   ei_aligned_free(ptr);
 }
 
@@ -186,7 +205,7 @@ template<typename T> inline void ei_aligned_delete(T *ptr, size_t size)
   */
 template<typename T, bool Align> inline void ei_conditional_aligned_delete(T *ptr, size_t size)
 {
-  ei_delete_elements_of_array<T>(ptr, size);
+  ei_destruct_elements_of_array<T>(ptr, size);
   ei_conditional_aligned_free<Align>(ptr);
 }
 
@@ -225,8 +244,8 @@ inline static int ei_alignmentOffset(const Scalar* ptr, int maxOffset)
   #define ei_aligned_stack_free(PTR,SIZE) ei_aligned_free(PTR)
 #endif
 
-#define ei_aligned_stack_new(TYPE,SIZE) ::new(ei_aligned_stack_alloc(sizeof(TYPE)*SIZE)) TYPE[SIZE]
-#define ei_aligned_stack_delete(TYPE,PTR,SIZE) do {ei_delete_elements_of_array<TYPE>(PTR, SIZE); \
+#define ei_aligned_stack_new(TYPE,SIZE) ei_construct_elements_of_array(reinterpret_cast<TYPE*>(ei_aligned_stack_alloc(sizeof(TYPE)*SIZE)), SIZE)
+#define ei_aligned_stack_delete(TYPE,PTR,SIZE) do {ei_destruct_elements_of_array<TYPE>(PTR, SIZE); \
                                                    ei_aligned_stack_free(PTR,sizeof(TYPE)*SIZE);} while(0)
 
 
@@ -244,7 +263,7 @@ inline static int ei_alignmentOffset(const Scalar* ptr, int maxOffset)
         return Eigen::ei_conditional_aligned_malloc<NeedsToAlign>(size); \
       }
   #endif
-  
+
   #define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) \
       void *operator new(size_t size) { \
         return Eigen::ei_conditional_aligned_malloc<NeedsToAlign>(size); \
index 0a52acf3d5b91a1ab54c251158dd7fe12106976b..d117c158397aa61574b498f8402398afa65f6f11 100644 (file)
@@ -107,6 +107,7 @@ void SVD<MatrixType>::compute(const MatrixType& matrix)
   const int m = matrix.rows();
   const int n = matrix.cols();
   const int nu = std::min(m,n);
+  ei_assert(m>=n && "In Eigen 2.0, SVD only works for MxN matrices with M>=N. Sorry!");
 
   m_matU.resize(m, nu);
   m_matU.setZero();
index 75001a2fa25321b174e7f03cfe30ab09140e5b41..f279e80f00a160fea6c52a649ac53c99b7099f8b 100644 (file)
@@ -99,6 +99,8 @@ template<typename _Scalar> class AmbiVector
       allocSize = allocSize/sizeof(Scalar) + (allocSize%sizeof(Scalar)>0?1:0);
       Scalar* newBuffer = new Scalar[allocSize];
       memcpy(newBuffer,  m_buffer,  copyElements * sizeof(ListEl));
+      delete[] m_buffer;
+      m_buffer = newBuffer;
     }
 
   protected:
@@ -238,8 +240,11 @@ Scalar& AmbiVector<Scalar>::coeffRef(int i)
       else
       {
         if (m_llSize>=m_allocatedElements)
+        {
           reallocateSparse();
-        ei_internal_assert(m_llSize<m_size && "internal error: overflow in sparse mode");
+          llElements = reinterpret_cast<ListEl*>(m_buffer);
+        }
+        ei_internal_assert(m_llSize<m_allocatedElements && "internal error: overflow in sparse mode");
         // let's insert a new coefficient
         ListEl& el = llElements[m_llSize];
         el.value = Scalar(0);
@@ -365,6 +370,9 @@ class AmbiVector<_Scalar>::Iterator
     int m_cachedIndex;          // current coordinate
     Scalar m_cachedValue;       // current value
     bool m_isDense;             // mode of the vector
+
+  private:
+    Iterator& operator=(const Iterator&);
 };
 
 
index 7119a84bd51479b2070a51a732454a33a61017d2..01f97cd6d9478a96a7f09ed41ec61fc544921837 100644 (file)
@@ -289,9 +289,11 @@ class DynamicSparseMatrix<Scalar,_Flags>::InnerIterator : public SparseVector<Sc
     inline int row() const { return IsRowMajor ? m_outer : Base::index(); }
     inline int col() const { return IsRowMajor ? Base::index() : m_outer; }
 
-
   protected:
     const int m_outer;
+
+  private:
+    InnerIterator& operator=(const InnerIterator&);
 };
 
 #endif // EIGEN_DYNAMIC_SPARSEMATRIX_H
index c39066676b6159094dede01e6e4c3529189bdbbf..ae77a77879b936e6d1f6254b83fbee758ad93e40 100644 (file)
@@ -53,6 +53,9 @@ class SparseInnerVectorSet : ei_no_assignment_operator,
         inline InnerIterator(const SparseInnerVectorSet& xpr, int outer)
           : MatrixType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer)
         {}
+
+      private:
+        InnerIterator& operator=(const InnerIterator&);
     };
 
     inline SparseInnerVectorSet(const MatrixType& matrix, int outerStart, int outerSize)
@@ -110,6 +113,8 @@ class SparseInnerVectorSet<DynamicSparseMatrix<_Scalar, _Options>, Size>
         inline InnerIterator(const SparseInnerVectorSet& xpr, int outer)
           : MatrixType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer)
         {}
+      private:
+        InnerIterator& operator=(const InnerIterator&);
     };
 
     inline SparseInnerVectorSet(const MatrixType& matrix, int outerStart, int outerSize)
index 2206883cc764d154757483b4ba620cda723fd222..ac285ec1aa3d9b4d4bae81d1a958b846d5600dee 100644 (file)
@@ -156,6 +156,9 @@ template<typename ExpressionType> class SparseCwise
 
   protected:
     ExpressionTypeNested m_matrix;
+
+  private:
+    SparseCwise& operator=(const SparseCwise&);
 };
 
 template<typename Derived>
index d19970efcb1a2860fe7c874dc2b7b8c8e8c71e32..da9746e2099d1d3554004bfe9a3ee168e97f2893 100644 (file)
@@ -126,6 +126,8 @@ class SparseCwiseBinaryOp<BinaryOp,Lhs,Rhs>::InnerIterator
     EIGEN_STRONG_INLINE InnerIterator(const SparseCwiseBinaryOp& binOp, int outer)
       : Base(binOp,outer)
     {}
+  private:
+    InnerIterator& operator=(const InnerIterator&);
 };
 
 /***************************************************************************
@@ -197,6 +199,9 @@ class ei_sparse_cwise_binary_op_inner_iterator_selector<BinaryOp, Lhs, Rhs, Deri
     const BinaryOp& m_functor;
     Scalar m_value;
     int m_id;
+
+  private:
+    ei_sparse_cwise_binary_op_inner_iterator_selector& operator=(const ei_sparse_cwise_binary_op_inner_iterator_selector&);
 };
 
 // sparse - sparse  (product)
@@ -250,6 +255,9 @@ class ei_sparse_cwise_binary_op_inner_iterator_selector<ei_scalar_product_op<T>,
     LhsIterator m_lhsIter;
     RhsIterator m_rhsIter;
     const BinaryFunc& m_functor;
+
+  private:
+    ei_sparse_cwise_binary_op_inner_iterator_selector& operator=(const ei_sparse_cwise_binary_op_inner_iterator_selector&);
 };
 
 // sparse - dense  (product)
@@ -290,6 +298,9 @@ class ei_sparse_cwise_binary_op_inner_iterator_selector<ei_scalar_product_op<T>,
     LhsIterator m_lhsIter;
     const BinaryFunc m_functor;
     const int m_outer;
+
+  private:
+    ei_sparse_cwise_binary_op_inner_iterator_selector& operator=(const ei_sparse_cwise_binary_op_inner_iterator_selector&);
 };
 
 // sparse - dense  (product)
index b11c0f8a3773522a5f58a255ad983cf76e0aaf14..2ed7a15579f08b3f5d3ee4700a3768128689451a 100644 (file)
@@ -90,6 +90,9 @@ class SparseCwiseUnaryOp<UnaryOp,MatrixType>::InnerIterator
   protected:
     MatrixTypeIterator m_iter;
     const UnaryOp m_functor;
+
+  private:
+    InnerIterator& operator=(const InnerIterator&);
 };
 
 template<typename Derived>
index 932daf220b9f9110bc4633c4bff2447c3e348b8c..9b7432a82164a7e27b497a86855113b42d614737 100644 (file)
@@ -120,6 +120,8 @@ class ei_sparse_diagonal_product_inner_iterator_selector
               const SparseDiagonalProductType& expr, int outer)
       : Base(expr.rhs().innerVector(outer) .cwise()* expr.lhs().diagonal(), 0)
     {}
+  private:
+    ei_sparse_diagonal_product_inner_iterator_selector& operator=(const ei_sparse_diagonal_product_inner_iterator_selector&);
 };
 
 template<typename Lhs, typename Rhs, typename SparseDiagonalProductType>
index c47e162f538f4107ed4e00cc4543db3a5e073443..315ec4af39ff978ffce3485bec473043da8be1c3 100644 (file)
@@ -64,16 +64,21 @@ template<typename ExpressionType, unsigned int Added, unsigned int Removed> clas
 
   protected:
     ExpressionTypeNested m_matrix;
+
+  private:
+    SparseFlagged& operator=(const SparseFlagged&);
 };
 
 template<typename ExpressionType, unsigned int Added, unsigned int Removed>
   class SparseFlagged<ExpressionType,Added,Removed>::InnerIterator : public ExpressionType::InnerIterator
 {
   public:
-
     EIGEN_STRONG_INLINE InnerIterator(const SparseFlagged& xpr, int outer)
       : ExpressionType::InnerIterator(xpr.m_matrix, outer)
     {}
+
+  private:
+    InnerIterator& operator=(const InnerIterator&);
 };
 
 template<typename ExpressionType, unsigned int Added, unsigned int Removed>
index 3f09596bc6481213accce58faff634a34d23abf1..65c609686d2a4f16579a35b62603a00678ac8bea 100644 (file)
@@ -259,19 +259,21 @@ class SparseMatrix
       m_data.resize(k,0);
     }
 
+    /** Resizes the matrix to a \a rows x \a cols matrix and initializes it to zero
+      * \sa resizeNonZeros(int), reserve(), setZero()
+      */
     void resize(int rows, int cols)
     {
-//       std::cerr << this << " resize " << rows << "x" << cols << "\n";
       const int outerSize = IsRowMajor ? rows : cols;
       m_innerSize = IsRowMajor ? cols : rows;
       m_data.clear();
-      if (m_outerSize != outerSize)
+      if (m_outerSize != outerSize || m_outerSize==0)
       {
         delete[] m_outerIndex;
         m_outerIndex = new int [outerSize+1];
         m_outerSize = outerSize;
-        memset(m_outerIndex, 0, (m_outerSize+1)*sizeof(int));
       }
+      memset(m_outerIndex, 0, (m_outerSize+1)*sizeof(int));
     }
     void resizeNonZeros(int size)
     {
@@ -442,6 +444,9 @@ class SparseMatrix<Scalar,_Flags>::InnerIterator
     int m_id;
     const int m_start;
     const int m_end;
+
+  private:
+    InnerIterator& operator=(const InnerIterator&);
 };
 
 #endif // EIGEN_SPARSEMATRIX_H
index 89a14d70707326c47a8d20496bc99d32bffbf05b..7386294e4d465af619a6a6d54785962c62bae471 100644 (file)
@@ -62,15 +62,20 @@ template<typename MatrixType> class SparseTranspose
 
   protected:
     const typename MatrixType::Nested m_matrix;
+
+  private:
+    SparseTranspose& operator=(const SparseTranspose&);
 };
 
 template<typename MatrixType> class SparseTranspose<MatrixType>::InnerIterator : public MatrixType::InnerIterator
 {
   public:
-
     EIGEN_STRONG_INLINE InnerIterator(const SparseTranspose& trans, int outer)
       : MatrixType::InnerIterator(trans.m_matrix, outer)
     {}
+
+  private:
+    InnerIterator& operator=(const InnerIterator&);
 };
 
 template<typename MatrixType> class SparseTranspose<MatrixType>::ReverseInnerIterator : public MatrixType::ReverseInnerIterator
index 8e5a6efeda8b44064afab68aa791b578e72bee78..5d47209f790dc8e12cf3da3cbaaceae626b8d736 100644 (file)
@@ -360,6 +360,9 @@ class SparseVector<Scalar,_Flags>::InnerIterator
     const CompressedStorage<Scalar>& m_data;
     int m_id;
     const int m_end;
+
+  private:
+    InnerIterator& operator=(const InnerIterator&);
 };
 
 #endif // EIGEN_SPARSEVECTOR_H
index 926a36ef1207572c45891141eae0efdf0a958b2d..797c710c196156e42ec53426533b5e6fb327c4ca 100755 (executable)
@@ -17,7 +17,7 @@ if [ -d eigen2 ]
 then
     cd eigen2
     # put here the version you want to use
-    hg up 2.0.6
+    hg up 2.0
     rm -f `find Eigen/ -type f -name "CMakeLists.txt"`
     cp -r Eigen ..
     cd ..
index ee7f9d8ed37dbe302c48d9f981edf71b3754921d..e880f8512679eef42f82bb58e2b967da3a53aced 100644 (file)
@@ -228,34 +228,7 @@ protected:
      * @return Indication whether the event was handled. 
      */
     GHOST_TSuccess handleKeyEvent(void *eventPtr);
-
-    /**
-     * Handles all basic Mac application stuff for a mouse down event.
-     * @param eventPtr An NSEvent pointer (casted to void* to enable compilation in standard C++)
-     * @return Indication whether the event was handled. 
-     */
-   // bool handleMouseDown(void *eventPtr);
-
-    /**
-     * Handles a Mac menu command.
-     * @param menuResult A Mac menu/item identifier.
-     * @return Indication whether the event was handled. 
-     */
-   // bool handleMenuCommand(GHOST_TInt32 menuResult);
     
-    /* callback for blender generated events */
-//     static OSStatus blendEventHandlerProc(EventHandlerCallRef handler, EventRef event, void* userData);
-
-
-    /**
-     * Callback for Mac Timer tasks that expire.
-     * @param tmTask Pointer to the timer task that expired.
-     */
-    //static void s_timerCallback(TMTaskPtr tmTask);
-       
-    /** Event handler reference. */
-    //EventHandlerRef m_handler;
-       
        /** Start time at initialization. */
        GHOST_TUns64 m_start_time;
        
@@ -266,7 +239,12 @@ protected:
     GHOST_TUns32 m_modifierMask;
 
     /** Ignores window size messages (when window is dragged). */
-    bool m_ignoreWindowSizedMessages;    
+    bool m_ignoreWindowSizedMessages;   
+       
+       /** Stores the mouse cursor delta due to setting a new cursor position
+        * Needed because cocoa event delta cursor move takes setCursorPosition changes too.
+        */
+       GHOST_TInt32 m_cursorDelta_x, m_cursorDelta_y;
 };
 
 #endif // _GHOST_SYSTEM_COCOA_H_
index 62f0c538e7e2b62b270915151dd4e0652875eac8..20b190cc41f48da25b86c210691a5b8d11c5b871 100644 (file)
@@ -525,7 +525,8 @@ extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG]) {
 @interface CocoaAppDelegate : NSObject {
        GHOST_SystemCocoa *systemCocoa;
 }
--(void)setSystemCocoa:(GHOST_SystemCocoa *)sysCocoa;
+- (void)setSystemCocoa:(GHOST_SystemCocoa *)sysCocoa;
+- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename;
 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
 - (void)applicationWillTerminate:(NSNotification *)aNotification;
 @end
@@ -536,6 +537,12 @@ extern "C" int GHOST_HACK_getFirstFile(char buf[FIRSTFILEBUFLG]) {
        systemCocoa = sysCocoa;
 }
 
+- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
+{
+       NSLog(@"\nGet open file event from cocoa : %@",filename);
+       return YES;
+}
+
 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
 {
        //TODO: implement graceful termination through Cocoa mechanism to avoid session log off to be cancelled
@@ -565,6 +572,8 @@ GHOST_SystemCocoa::GHOST_SystemCocoa()
 {
        m_modifierMask =0;
        m_pressedMouseButtons =0;
+       m_cursorDelta_x=0;
+       m_cursorDelta_y=0;
        m_displayManager = new GHOST_DisplayManagerCocoa ();
        GHOST_ASSERT(m_displayManager, "GHOST_SystemCocoa::GHOST_SystemCocoa(): m_displayManager==0\n");
        m_displayManager->initialize();
@@ -656,13 +665,14 @@ GHOST_TSuccess GHOST_SystemCocoa::init()
                                [NSApp setWindowsMenu:windowMenu];
                                [windowMenu release];
                        }
-                       [NSApp finishLaunching];
                }
                if ([NSApp delegate] == nil) {
                        CocoaAppDelegate *appDelegate = [[CocoaAppDelegate alloc] init];
                        [appDelegate setSystemCocoa:this];
                        [NSApp setDelegate:appDelegate];
                }
+               
+               [NSApp finishLaunching];
                                
                [pool drain];
     }
@@ -787,7 +797,9 @@ GHOST_TSuccess GHOST_SystemCocoa::endFullScreen(void)
 
 
        
-
+/**
+ * @note : returns coordinates in Cocoa screen coordinates
+ */
 GHOST_TSuccess GHOST_SystemCocoa::getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const
 {
     NSPoint mouseLoc = [NSEvent mouseLocation];
@@ -798,17 +810,24 @@ GHOST_TSuccess GHOST_SystemCocoa::getCursorPosition(GHOST_TInt32& x, GHOST_TInt3
     return GHOST_kSuccess;
 }
 
-
+/**
+ * @note : expect Cocoa screen coordinates
+ */
 GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) const
 {
        float xf=(float)x, yf=(float)y;
+       GHOST_WindowCocoa* window = (GHOST_WindowCocoa*)m_windowManager->getActiveWindow();
+       NSScreen *windowScreen = window->getScreen();
+       NSRect screenRect = [windowScreen frame];
        
-       //Quartz Display Services uses the old coordinates (top left origin)
-       yf = [[NSScreen mainScreen] frame].size.height -yf;
+       //Set position relative to current screen
+       xf -= screenRect.origin.x;
+       yf -= screenRect.origin.y;
        
-       //CGAssociateMouseAndMouseCursorPosition(false);
-       CGWarpMouseCursorPosition(CGPointMake(xf, yf));
-       //CGAssociateMouseAndMouseCursorPosition(true);
+       //Quartz Display Services uses the old coordinates (top left origin)
+       yf = screenRect.size.height -yf;
+
+       CGDisplayMoveCursorToPoint([[[windowScreen deviceDescription] objectForKey:@"NSScreenNumber"] unsignedIntValue], CGPointMake(xf, yf));
 
     return GHOST_kSuccess;
 }
@@ -873,15 +892,6 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent)
                 
                 if (timerMgr->fireTimers(getMilliSeconds())) {
                 anyProcessed = true;
-                }
-                
-                        if (getFullScreen()) {
-                // Check if the full-screen window is dirty
-                GHOST_IWindow* window = m_windowManager->getFullScreenWindow();
-                if (((GHOST_WindowCarbon*)window)->getFullScreenDirty()) {
-                pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowUpdate, window) );
-                anyProcessed = true;
-                }
                 }*/
                
                do {
@@ -999,6 +1009,12 @@ GHOST_TSuccess GHOST_SystemCocoa::handleWindowEvent(GHOST_TEventType eventType,
 
 GHOST_TUns8 GHOST_SystemCocoa::handleQuitRequest()
 {
+       GHOST_Window* window = (GHOST_Window*)m_windowManager->getActiveWindow();
+       
+       //Discard quit event if we are in cursor grab sequence
+       if (window && (window->getCursorGrabMode() != GHOST_kGrabDisable) && (window->getCursorGrabMode() != GHOST_kGrabNormal))
+               return GHOST_kExitCancel;
+       
        //Check open windows if some changes are not saved
        if (m_windowManager->getAnyModifiedState())
        {
@@ -1008,7 +1024,14 @@ GHOST_TUns8 GHOST_SystemCocoa::handleQuitRequest()
                {
                        pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventQuit, NULL) );
                        return GHOST_kExitNow;
+               } else {
+                       //Give back focus to the blender window if user selected cancel quit
+                       NSArray *windowsList = [NSApp orderedWindows];
+                       if ([windowsList count]) {
+                               [[windowsList objectAtIndex:0] makeKeyAndOrderFront:nil];
+                       }
                }
+
        }
        else {
                pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventQuit, NULL) );
@@ -1023,11 +1046,14 @@ GHOST_TSuccess GHOST_SystemCocoa::handleTabletEvent(void *eventPtr, short eventT
 {
        NSEvent *event = (NSEvent *)eventPtr;
        GHOST_IWindow* window = m_windowManager->getActiveWindow();
+       
+       if (!window) return GHOST_kFailure;
+       
        GHOST_TabletData& ct=((GHOST_WindowCocoa*)window)->GetCocoaTabletData();
        
        switch (eventType) {
                case NSTabletPoint:
-                       ct.Pressure = [event tangentialPressure];
+                       ct.Pressure = [event pressure];
                        ct.Xtilt = [event tilt].x;
                        ct.Ytilt = [event tilt].y;
                        break;
@@ -1129,27 +1155,78 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
                                        //No tablet event included : do nothing
                                        break;
                        }
+                       
                case NSMouseMoved:
-                       {
-                               if(window->getCursorWarp()) {
-                                       GHOST_TInt32 x_warp, y_warp, x_accum, y_accum;
-                                       
-                                       window->getCursorWarpPos(x_warp, y_warp);
-                                       
-                                       window->getCursorWarpAccum(x_accum, y_accum);
-                                       x_accum += [event deltaX];
-                                       y_accum += -[event deltaY]; //Strange Apple implementation (inverted coordinates for the deltaY) ...
-                                       window->setCursorWarpAccum(x_accum, y_accum);
-                                       
-                                       pushEvent(new GHOST_EventCursor([event timestamp], GHOST_kEventCursorMove, window, x_warp+x_accum, y_warp+y_accum));
-                               } 
-                               else { //Normal cursor operation: send mouse position in window
-                                       NSPoint mousePos = [event locationInWindow];
-                                       pushEvent(new GHOST_EventCursor([event timestamp], GHOST_kEventCursorMove, window, mousePos.x, mousePos.y));
-                                       window->setCursorWarpAccum(0, 0); //Mouse motion occured between two cursor warps, so we can reset the delta counter
+                               switch (window->getCursorGrabMode()) {
+                                       case GHOST_kGrabHide: //Cursor hidden grab operation : no cursor move
+                                       {
+                                               GHOST_TInt32 x_warp, y_warp, x_accum, y_accum;
+                                               
+                                               window->getCursorGrabInitPos(x_warp, y_warp);
+                                               
+                                               window->getCursorGrabAccum(x_accum, y_accum);
+                                               x_accum += [event deltaX];
+                                               y_accum += -[event deltaY]; //Strange Apple implementation (inverted coordinates for the deltaY) ...
+                                               window->setCursorGrabAccum(x_accum, y_accum);
+                                               
+                                               pushEvent(new GHOST_EventCursor([event timestamp], GHOST_kEventCursorMove, window, x_warp+x_accum, y_warp+y_accum));
+                                       }
+                                               break;
+                                       case GHOST_kGrabWrap: //Wrap cursor at area/window boundaries
+                                       {
+                                               NSPoint mousePos = [event locationInWindow];
+                                               GHOST_TInt32 x_mouse= mousePos.x;
+                                               GHOST_TInt32 y_mouse= mousePos.y;
+                                               GHOST_TInt32 x_accum, y_accum, x_cur, y_cur;
+                                               GHOST_Rect bounds, windowBounds, correctedBounds;
+                                               
+                                               /* fallback to window bounds */
+                                               if(window->getCursorGrabBounds(bounds)==GHOST_kFailure)
+                                                       window->getClientBounds(bounds);
+                                               
+                                               //Switch back to Cocoa coordinates orientation (y=0 at botton,the same as blender internal btw!), and to client coordinates
+                                               window->getClientBounds(windowBounds);
+                                               window->screenToClient(bounds.m_l,bounds.m_b, correctedBounds.m_l, correctedBounds.m_t);
+                                               window->screenToClient(bounds.m_r, bounds.m_t, correctedBounds.m_r, correctedBounds.m_b);
+                                               correctedBounds.m_b = (windowBounds.m_b - windowBounds.m_t) - correctedBounds.m_b;
+                                               correctedBounds.m_t = (windowBounds.m_b - windowBounds.m_t) - correctedBounds.m_t;
+                                               
+                                               //Update accumulation counts
+                                               window->getCursorGrabAccum(x_accum, y_accum);
+                                               x_accum += [event deltaX]-m_cursorDelta_x;
+                                               y_accum += -[event deltaY]-m_cursorDelta_y; //Strange Apple implementation (inverted coordinates for the deltaY) ...
+                                               window->setCursorGrabAccum(x_accum, y_accum);
+                                               
+                                               
+                                               //Warp mouse cursor if needed
+                                               x_mouse += [event deltaX]-m_cursorDelta_x;
+                                               y_mouse += -[event deltaY]-m_cursorDelta_y;
+                                               correctedBounds.wrapPoint(x_mouse, y_mouse, 2);
+                                               
+                                               //Compensate for mouse moved event taking cursor position set into account
+                                               m_cursorDelta_x = x_mouse-mousePos.x;
+                                               m_cursorDelta_y = y_mouse-mousePos.y;
+                                               
+                                               //Set new cursor position
+                                               window->clientToScreen(x_mouse, y_mouse, x_cur, y_cur);
+                                               setCursorPosition(x_cur, y_cur); /* wrap */
+                                               
+                                               //Post event
+                                               window->getCursorGrabInitPos(x_cur, y_cur);
+                                               pushEvent(new GHOST_EventCursor([event timestamp], GHOST_kEventCursorMove, window, x_cur + x_accum, y_cur + y_accum));
+                                       }
+                                               break;
+                                       default:
+                                       {
+                                               //Normal cursor operation: send mouse position in window
+                                               NSPoint mousePos = [event locationInWindow];
+                                               pushEvent(new GHOST_EventCursor([event timestamp], GHOST_kEventCursorMove, window, mousePos.x, mousePos.y));
+                                               m_cursorDelta_x=0;
+                                               m_cursorDelta_y=0; //Mouse motion occured between two cursor warps, so we can reset the delta counter
+                                       }
+                                               break;
                                }
                                break;
-                       }
                        
                case NSScrollWheel:
                        {
@@ -1323,74 +1400,3 @@ void GHOST_SystemCocoa::putClipboard(GHOST_TInt8 *buffer, bool selection) const
        
        [pool drain];
 }
-
-#pragma mark Carbon stuff to remove
-
-#ifdef WITH_CARBON
-
-
-OSErr GHOST_SystemCarbon::sAEHandlerLaunch(const AppleEvent *event, AppleEvent *reply, SInt32 refCon)
-{
-       //GHOST_SystemCarbon* sys = (GHOST_SystemCarbon*) refCon;
-       
-       return noErr;
-}
-
-OSErr GHOST_SystemCarbon::sAEHandlerOpenDocs(const AppleEvent *event, AppleEvent *reply, SInt32 refCon)
-{
-       //GHOST_SystemCarbon* sys = (GHOST_SystemCarbon*) refCon;
-       AEDescList docs;
-       SInt32 ndocs;
-       OSErr err;
-       
-       err = AEGetParamDesc(event, keyDirectObject, typeAEList, &docs);
-       if (err != noErr)  return err;
-       
-       err = AECountItems(&docs, &ndocs);
-       if (err==noErr) {
-               int i;
-               
-               for (i=0; i<ndocs; i++) {
-                       FSSpec fss;
-                       AEKeyword kwd;
-                       DescType actType;
-                       Size actSize;
-                       
-                       err = AEGetNthPtr(&docs, i+1, typeFSS, &kwd, &actType, &fss, sizeof(fss), &actSize);
-                       if (err!=noErr)
-                               break;
-                       
-                       if (i==0) {
-                               FSRef fsref;
-                               
-                               if (FSpMakeFSRef(&fss, &fsref)!=noErr)
-                                       break;
-                               if (FSRefMakePath(&fsref, (UInt8*) g_firstFileBuf, sizeof(g_firstFileBuf))!=noErr)
-                                       break;
-                               
-                               g_hasFirstFile = true;
-                       }
-               }
-       }
-       
-       AEDisposeDesc(&docs);
-       
-       return err;
-}
-
-OSErr GHOST_SystemCarbon::sAEHandlerPrintDocs(const AppleEvent *event, AppleEvent *reply, SInt32 refCon)
-{
-       //GHOST_SystemCarbon* sys = (GHOST_SystemCarbon*) refCon;
-       
-       return noErr;
-}
-
-OSErr GHOST_SystemCarbon::sAEHandlerQuit(const AppleEvent *event, AppleEvent *reply, SInt32 refCon)
-{
-       GHOST_SystemCarbon* sys = (GHOST_SystemCarbon*) refCon;
-       
-       sys->pushEvent( new GHOST_Event(sys->getMilliSeconds(), GHOST_kEventQuit, NULL) );
-       
-       return noErr;
-}
-#endif
\ No newline at end of file
index 774fd025b854ef25f35db3ac25fb1c65d90a8110..ff4a5956a1287243a4d998171ff8841c84cbf35b 100644 (file)
@@ -405,19 +405,21 @@ GHOST_SystemX11::processEvent(XEvent *xe)
                                window->getCursorGrabAccum(x_accum, y_accum);
 
                                if(x_new != xme.x_root || y_new != xme.y_root) {
+                                       /* when wrapping we don't need to add an event because the
+                                        * setCursorPosition call will cause a new event after */
                                        setCursorPosition(x_new, y_new); /* wrap */
                                        window->setCursorGrabAccum(x_accum + (xme.x_root - x_new), y_accum + (xme.y_root - y_new));
                                }
-
-                               g_event = new
-                               GHOST_EventCursor(
-                                       getMilliSeconds(),
-                                       GHOST_kEventCursorMove,
-                                       window,
-                                       xme.x_root + x_accum,
-                                       xme.y_root + y_accum
-                               );
-
+                               else {
+                                       g_event = new
+                                       GHOST_EventCursor(
+                                               getMilliSeconds(),
+                                               GHOST_kEventCursorMove,
+                                               window,
+                                               xme.x_root + x_accum,
+                                               xme.y_root + y_accum
+                                       );
+                               }
                        }
                        else {
                                g_event = new
index 0986fc5743058b6b64ad755c6fa2fb5d473ddf5d..86447a8623c533fe50c04f0e7022f56c7d00206f 100644 (file)
@@ -159,6 +159,7 @@ public:
         */
        inline virtual bool getCursorVisibility() const;
        inline virtual GHOST_TGrabCursorMode getCursorGrabMode() const;
+       inline virtual void getCursorGrabInitPos(GHOST_TInt32 &x, GHOST_TInt32 &y) const;
        inline virtual void getCursorGrabAccum(GHOST_TInt32 &x, GHOST_TInt32 &y) const;
        inline virtual void setCursorGrabAccum(GHOST_TInt32 x, GHOST_TInt32 y);
 
@@ -327,6 +328,12 @@ inline GHOST_TGrabCursorMode GHOST_Window::getCursorGrabMode() const
        return m_cursorGrab;
 }
 
+inline void GHOST_Window::getCursorGrabInitPos(GHOST_TInt32 &x, GHOST_TInt32 &y) const
+{
+       x = m_cursorGrabInitPos[0];
+       y = m_cursorGrabInitPos[1];
+}
+
 inline void GHOST_Window::getCursorGrabAccum(GHOST_TInt32 &x, GHOST_TInt32 &y) const
 {
        x= m_cursorGrabAccumPos[0];
index e5fff75c66ed7d3d236a22eadd4b91eea00ce9a4..e3479ada5d69f8c4829e12b09668fa588f66ec2b 100644 (file)
@@ -169,6 +169,12 @@ public:
         */
        virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
 
+       /**
+        * Gets the screen the window is displayed in
+        * @return The NSScreen object
+        */
+       NSScreen* getScreen();
+       
        /**
         * Sets the state of the window (normal, minimized, maximized).
         * @param state The state of the window.
@@ -236,18 +242,12 @@ protected:
         */
        virtual GHOST_TSuccess setWindowCursorVisibility(bool visible);
        
-       /**
-        * Sets the cursor warp accumulator. Overriden for workaround due to Cocoa next event after cursor set giving delta values non zero
-        */
-       inline virtual bool setCursorGrabAccum(GHOST_TInt32 x, GHOST_TInt32 y);
-       
        /**
         * Sets the cursor grab on the window using
         * native window system calls.
-        * @param warp  Only used when grab is enabled, hides the mouse and allows gragging outside the screen.
         */
-       virtual GHOST_TSuccess setWindowCursorGrab(bool grab, bool warp, bool restore);
-       
+       virtual GHOST_TSuccess setWindowCursorGrab(GHOST_TGrabCursorMode mode);
+               
        /**
         * Sets the cursor shape on the window using
         * native window system calls.
index e41c773a4c3fb781a7c49a385e189e6fcf1eb17a..0090d8e10385a219fa3c360516c39007ebc46abf 100644 (file)
 #include <Carbon/Carbon.h>
 #endif
 
+/***** Multithreaded opengl code : uncomment for enabling
+#include <OpenGL/OpenGL.h>
+*/
 #include "GHOST_WindowCocoa.h"
 #include "GHOST_SystemCocoa.h"
 #include "GHOST_Debug.h"
@@ -50,14 +54,27 @@ static NSOpenGLPixelFormatAttribute pixelFormatAttrsWindow[] =
 };
 
 #pragma mark Cocoa window delegate object
-
+/* live resize ugly patch
+extern "C" {
+       struct bContext;
+       typedef struct bContext bContext;
+       bContext* ghostC;
+       extern int wm_window_timer(const bContext *C);
+       extern void wm_window_process_events(const bContext *C);
+       extern void wm_event_do_handlers(bContext *C);
+       extern void wm_event_do_notifiers(bContext *C);
+       extern void wm_draw_update(bContext *C);
+};*/
 @interface CocoaWindowDelegate : NSObject
+#ifdef MAC_OS_X_VERSION_10_6
+<NSWindowDelegate>
+#endif
 {
        GHOST_SystemCocoa *systemCocoa;
        GHOST_WindowCocoa *associatedWindow;
 }
 
-- (void)setSystemAndWindowCocoa:(const GHOST_SystemCocoa *)sysCocoa windowCocoa:(GHOST_WindowCocoa *)winCocoa;
+- (void)setSystemAndWindowCocoa:(GHOST_SystemCocoa *)sysCocoa windowCocoa:(GHOST_WindowCocoa *)winCocoa;
 - (void)windowWillClose:(NSNotification *)notification;
 - (void)windowDidBecomeKey:(NSNotification *)notification;
 - (void)windowDidResignKey:(NSNotification *)notification;
@@ -97,7 +114,22 @@ static NSOpenGLPixelFormatAttribute pixelFormatAttrsWindow[] =
 
 - (void)windowDidResize:(NSNotification *)notification
 {
-       systemCocoa->handleWindowEvent(GHOST_kEventWindowSize, associatedWindow);
+#ifdef MAC_OS_X_VERSION_10_6
+       //if (![[notification object] inLiveResize]) {
+               //Send event only once, at end of resize operation (when user has released mouse button)
+#endif
+               systemCocoa->handleWindowEvent(GHOST_kEventWindowSize, associatedWindow);
+#ifdef MAC_OS_X_VERSION_10_6
+       //}
+#endif
+       /* Live resize ugly patch. Needed because live resize runs in a modal loop, not letting main loop run
+        if ([[notification object] inLiveResize]) {
+               systemCocoa->dispatchEvents();
+               wm_window_timer(ghostC);
+               wm_event_do_handlers(ghostC);
+               wm_event_do_notifiers(ghostC);
+               wm_draw_update(ghostC);
+       }*/
 }
 @end
 
@@ -107,8 +139,6 @@ static NSOpenGLPixelFormatAttribute pixelFormatAttrsWindow[] =
 {
 
 }
--(BOOL)canBecomeKeyWindow;
-
 @end
 @implementation CocoaWindow
 
@@ -125,7 +155,6 @@ static NSOpenGLPixelFormatAttribute pixelFormatAttrsWindow[] =
 //We need to subclass it in order to give Cocoa the feeling key events are trapped
 @interface CocoaOpenGLView : NSOpenGLView
 {
-       
 }
 @end
 @implementation CocoaOpenGLView
@@ -173,6 +202,7 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
 
        //Creates the window
        NSRect rect;
+       NSSize  minSize;
        
        rect.origin.x = left;
        rect.origin.y = top;
@@ -187,6 +217,11 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
                return;
        }
        
+       //Forbid to resize the window below the blender defined minimum one
+       minSize.width = 320;
+       minSize.height = 240;
+       [m_window setContentMinSize:minSize];
+       
        setTitle(title);
        
                        
@@ -480,6 +515,13 @@ void GHOST_WindowCocoa::clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST
        outY = screenCoord.y;
 }
 
+
+NSScreen* GHOST_WindowCocoa::getScreen()
+{
+       return [m_window screen];
+}
+
+
 /**
  * @note Fullscreen switch is not actual fullscreen with display capture. As this capture removes all OS X window manager features.
  * Instead, the menu bar and the dock are hidden, and the window is made borderless and enlarged.
@@ -515,6 +557,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state)
                                //Make window borderless and enlarge it
                                [m_window setStyleMask:NSBorderlessWindowMask];
                                [m_window setFrame:[[m_window screen] frame] display:YES];
+                               [m_window makeFirstResponder:m_openGLView];
 #else
                                //With 10.5, we need to create a new window to change its style to borderless
                                //Hide menu & dock if needed
@@ -572,6 +615,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setState(GHOST_TWindowState state)
                                //Make window normal and resize it
                                [m_window setStyleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask)];
                                [m_window setFrame:[[m_window screen] visibleFrame] display:YES];
+                               [m_window makeFirstResponder:m_openGLView];
 #else
                                //With 10.5, we need to create a new window to change its style to borderless
                                //Show menu & dock if needed
@@ -696,6 +740,10 @@ GHOST_TSuccess GHOST_WindowCocoa::installDrawingContext(GHOST_TDrawingContextTyp
        NSOpenGLPixelFormat *pixelFormat;
        NSOpenGLContext *tmpOpenGLContext;
        
+       /***** Multithreaded opengl code : uncomment for enabling
+       CGLContextObj cglCtx;
+       */
+        
        switch (type) {
                case GHOST_kDrawingContextTypeOpenGL:
                        if (!getValid()) break;
@@ -708,6 +756,13 @@ GHOST_TSuccess GHOST_WindowCocoa::installDrawingContext(GHOST_TDrawingContextTyp
                                break;
                        }
                        
+                       //Switch openGL to multhreaded mode
+                       /******* Multithreaded opengl code : uncomment for enabling
+                       cglCtx = (CGLContextObj)[tmpOpenGLContext CGLContextObj];
+                       if (CGLEnable(cglCtx, kCGLCEMPEngine) == kCGLNoError)
+                               printf("\nSwitched openGL to multithreaded mode");
+                        */
+                       
                        if (!s_firstOpenGLcontext) s_firstOpenGLcontext = tmpOpenGLContext;
 #ifdef WAIT_FOR_VSYNC
                                /* wait for vsync, to avoid tearing artifacts */
@@ -849,73 +904,42 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorVisibility(bool visible)
 }
 
 
-//Override this method to provide set feature even if not in warp
-inline bool GHOST_WindowCocoa::setCursorWarpAccum(GHOST_TInt32 x, GHOST_TInt32 y)
+GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorGrab(GHOST_TGrabCursorMode mode)
 {
-       m_cursorWarpAccumPos[0]= x;
-       m_cursorWarpAccumPos[1]= y;
+       GHOST_TSuccess err = GHOST_kSuccess;
        
-       return GHOST_kSuccess;
-}
-
-
-GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorGrab(bool grab, bool warp, bool restore)
-{
-       if (grab)
+       if (mode != GHOST_kGrabDisable)
        {
                //No need to perform grab without warp as it is always on in OS X
-               if(warp) {
+               if(mode != GHOST_kGrabNormal) {
                        GHOST_TInt32 x_old,y_old;
 
-                       m_cursorWarp= true;
                        m_systemCocoa->getCursorPosition(x_old,y_old);
-                       screenToClient(x_old, y_old, m_cursorWarpInitPos[0], m_cursorWarpInitPos[1]);
+                       screenToClient(x_old, y_old, m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]);
                        //Warp position is stored in client (window base) coordinates
-                       setWindowCursorVisibility(false);
-                       return CGAssociateMouseAndMouseCursorPosition(false) == kCGErrorSuccess ? GHOST_kSuccess : GHOST_kFailure;
+                       setCursorGrabAccum(0, 0);
+                       
+                       if(mode == GHOST_kGrabHide) {
+                               setWindowCursorVisibility(false);
+                       }
+                       
+                       //Dissociate cursor position even for warp mode, to allow mouse acceleration to work even when warping the cursor
+                       err = CGAssociateMouseAndMouseCursorPosition(false) == kCGErrorSuccess ? GHOST_kSuccess : GHOST_kFailure;
                }
        }
        else {
-               if(m_cursorWarp)
-               {/* are we exiting warp */
+               if(m_cursorGrab==GHOST_kGrabHide)
+               {
+                       //No need to set again cursor position, as it has not changed for Cocoa
                        setWindowCursorVisibility(true);
-                       /* Almost works without but important otherwise the mouse GHOST location can be incorrect on exit */
-                       if(restore) {
-                               GHOST_Rect bounds;
-                               GHOST_TInt32 x_new, y_new, x_cur, y_cur;
-                               
-                               getClientBounds(bounds);
-                               x_new= m_cursorWarpInitPos[0]+m_cursorWarpAccumPos[0];
-                               y_new= m_cursorWarpInitPos[1]+m_cursorWarpAccumPos[1];
-                               
-                               if(x_new < 0)           x_new = 0;
-                               if(y_new < 0)           y_new = 0;
-                               if(x_new > bounds.getWidth())   x_new = bounds.getWidth();
-                               if(y_new > bounds.getHeight())  y_new = bounds.getHeight();
-                               
-                               //get/set cursor position works in screen coordinates
-                               clientToScreen(x_new, y_new, x_cur, y_cur);
-                               m_systemCocoa->setCursorPosition(x_cur, y_cur);
-                               
-                               //As Cocoa will give as first deltaX,deltaY this change in cursor position, we need to compensate for it
-                               //Issue appearing in case of two transform operations conducted w/o mouse motion in between
-                               x_new=m_cursorWarpAccumPos[0];
-                               y_new=m_cursorWarpAccumPos[1];
-                               setCursorWarpAccum(-x_new, -y_new);
-                       }
-                       else {
-                               GHOST_TInt32 x_new, y_new;
-                               //get/set cursor position works in screen coordinates
-                               clientToScreen(m_cursorWarpInitPos[0], m_cursorWarpInitPos[1], x_new, y_new);
-                               m_systemCocoa->setCursorPosition(x_new, y_new);
-                               setCursorWarpAccum(0, 0);
-                       }
-                       
-                       m_cursorWarp= false;
-                       return CGAssociateMouseAndMouseCursorPosition(true) == kCGErrorSuccess ? GHOST_kSuccess : GHOST_kFailure;
                }
+               
+               err = CGAssociateMouseAndMouseCursorPosition(true) == kCGErrorSuccess ? GHOST_kSuccess : GHOST_kFailure;
+               /* Almost works without but important otherwise the mouse GHOST location can be incorrect on exit */
+               setCursorGrabAccum(0, 0);
+               m_cursorGrabBounds.m_l= m_cursorGrabBounds.m_r= -1; /* disable */
        }
-       return GHOST_kSuccess;
+       return err;
 }
        
 GHOST_TSuccess GHOST_WindowCocoa::setWindowCursorShape(GHOST_TStandardCursor shape)
@@ -979,7 +1003,7 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 *bitmap
                                                                                                                samplesPerPixel:2
                                                                                                                           hasAlpha:YES
                                                                                                                           isPlanar:YES
-                                                                                                                colorSpaceName:NSDeviceBlackColorSpace
+                                                                                                                colorSpaceName:NSDeviceWhiteColorSpace
                                                                                                                        bytesPerRow:(sizex/8 + (sizex%8 >0 ?1:0))
                                                                                                                   bitsPerPixel:1];
        
@@ -989,10 +1013,10 @@ GHOST_TSuccess GHOST_WindowCocoa::setWindowCustomCursorShape(GHOST_TUns8 *bitmap
        
        for (y=0; y<nbUns16; y++) {
 #if !defined(__LITTLE_ENDIAN__)
-               cursorBitmap[y] = uns16ReverseBits((bitmap[2*y]<<0) | (bitmap[2*y+1]<<8));
+               cursorBitmap[y] = ~uns16ReverseBits((bitmap[2*y]<<0) | (bitmap[2*y+1]<<8));
                cursorBitmap[nbUns16+y] = uns16ReverseBits((mask[2*y]<<0) | (mask[2*y+1]<<8));
 #else
-               cursorBitmap[y] = uns16ReverseBits((bitmap[2*y+1]<<0) | (bitmap[2*y]<<8));
+               cursorBitmap[y] = ~uns16ReverseBits((bitmap[2*y+1]<<0) | (bitmap[2*y]<<8));
                cursorBitmap[nbUns16+y] = uns16ReverseBits((mask[2*y+1]<<0) | (mask[2*y]<<8));
 #endif
                
index dba1be1b86275b8521e73bfcfc236e3557f74794..d9c2654f446f86960d133aceaf5fac38f51fa942 100644 (file)
@@ -297,11 +297,13 @@ GHOST_WindowX11(
        // we want this window treated.
 
        XSizeHints * xsizehints = XAllocSizeHints();
-       xsizehints->flags = USPosition | USSize;
+       xsizehints->flags = PPosition | PSize | PMinSize;
        xsizehints->x = left;
        xsizehints->y = top;
        xsizehints->width = width;
        xsizehints->height = height;
+       xsizehints->min_width= 320;     // size hints, could be made apart of the ghost api
+       xsizehints->min_height= 240;    // limits are also arbitrary, but should not allow 1x1 window
        XSetWMNormalHints(m_display, m_window, xsizehints);
        XFree(xsizehints);
 
@@ -382,7 +384,6 @@ GHOST_WindowX11(
        XSetWMHints(display, m_window, xwmhints );
        XFree(xwmhints);
        // done setting the icon
-       
 
        setTitle(title);
 
@@ -1419,6 +1420,13 @@ setWindowCursorGrab(
                        setWindowCursorVisibility(true);
                }
 
+               if(m_cursorGrab != GHOST_kGrabNormal) {
+                       /* use to generate a mouse move event, otherwise the last event
+                        * blender gets can be outside the screen causing menus not to show
+                        * properly unless the user moves the mouse */
+                       XWarpPointer(m_display,None,None,0,0,0,0,0,0);
+               }
+
                /* Almost works without but important otherwise the mouse GHOST location can be incorrect on exit */
                setCursorGrabAccum(0, 0);
                m_cursorGrabBounds.m_l= m_cursorGrabBounds.m_r= -1; /* disable */
index 4157237222e285e135af18c7df15e957181b2363..43e38698ef340c893dd31ba425b25817361bf88c 100644 (file)
@@ -98,9 +98,9 @@ public:
     Vector   dw;    //!< angular acceration vector
 public:
     RotationAcc():R(),w() {}
-    explicit RotationAcc(const Rotation& _R):R(_R),w(Vector::Zero()){}
-    RotationAcc(const Rotation& _R,const Vector& _w,const Vector& _dw):
-        R(_R),w(_w),dw(_dw) {}
+    explicit RotationAcc(const Rotation& R_):R(R_),w(Vector::Zero()){}
+    RotationAcc(const Rotation& R_,const Vector& _w,const Vector& _dw):
+        R(R_),w(_w),dw(_dw) {}
     IMETHOD RotationAcc& operator = (const RotationAcc& arg);
     IMETHOD RotationAcc& operator = (const Rotation& arg);
     IMETHOD static RotationAcc Identity();
@@ -152,9 +152,9 @@ public:
     VectorAcc   p;   //!< Translation, velocity and acceleration of origin.
 public:
     FrameAcc(){}
-    explicit FrameAcc(const Frame& _T):M(_T.M),p(_T.p) {}
-    FrameAcc(const Frame& _T,const Twist& _t,const Twist& _dt):
-        M(_T.M,_t.rot,_dt.rot),p(_T.p,_t.vel,_dt.vel) {}
+    explicit FrameAcc(const Frame& T_):M(T_.M),p(T_.p) {}
+    FrameAcc(const Frame& T_,const Twist& _t,const Twist& _dt):
+        M(T_.M,_t.rot,_dt.rot),p(T_.p,_t.vel,_dt.vel) {}
     FrameAcc(const RotationAcc& _M,const VectorAcc& _p):M(_M),p(_p) {}
 
     IMETHOD FrameAcc& operator = (const FrameAcc& arg);
index 21a7844f522c8740f52953a7f36a68461573dc07..b70182bccded854d065577b267f5c941928b8c4a 100644 (file)
@@ -133,8 +133,8 @@ public:
     Vector   w; // rotation vector
 public:
     RotationVel():R(),w() {}
-    explicit RotationVel(const Rotation& _R):R(_R),w(Vector::Zero()){}
-    RotationVel(const Rotation& _R,const Vector& _w):R(_R),w(_w){}
+    explicit RotationVel(const Rotation& R_):R(R_),w(Vector::Zero()){}
+    RotationVel(const Rotation& R_,const Vector& _w):R(R_),w(_w){}
 
 
     Rotation value() const { return R;}
@@ -194,11 +194,11 @@ public:
 public:
     FrameVel(){}
 
-    explicit FrameVel(const Frame& _T):
-        M(_T.M),p(_T.p) {}
+    explicit FrameVel(const Frame& T_):
+        M(T_.M),p(T_.p) {}
 
-    FrameVel(const Frame& _T,const Twist& _t):
-        M(_T.M,_t.rot),p(_T.p,_t.vel) {}
+    FrameVel(const Frame& T_,const Twist& _t):
+        M(T_.M,_t.rot),p(T_.p,_t.vel) {}
 
     FrameVel(const RotationVel& _M,const VectorVel& _p):
         M(_M),p(_p) {}
index c49e817196eb1a7e7d3127630a8b4cad1d09d771..4a8063bb5f02dce2f5579ca06b829b431d51c3e0 100644 (file)
                                RelativePath="..\..\..\source\blender\editors\space_outliner\outliner.c"\r
                                >\r
                        </File>\r
-                       <File\r
-                               RelativePath="..\..\..\source\blender\editors\space_outliner\outliner_header.c"\r
-                               >\r
-                       </File>\r
                        <File\r
                                RelativePath="..\..\..\source\blender\editors\space_outliner\outliner_intern.h"\r
                                >\r
diff --git a/release/environment-macosx b/release/environment-macosx
new file mode 100644 (file)
index 0000000..d41d5ec
--- /dev/null
@@ -0,0 +1,18 @@
+# This is a Blender Environment Variable config file.
+#
+# Comment lines start with "#", other lines will be split at the "="
+# and the part before will be used as env var name and the part after
+# as env var value. The value can make reference to previous or
+# prelaunch variables with "${}" and the content will be replaced.
+# Once set, values of variables will not be overwritten.
+#
+# BLENDER_SHARE should be /Library/Application Support/Blender for typical installs.
+# BLENDER_VERSION will be set by the program before processing this file.
+BLENDER_USER_BASE=${HOME}/Library/Application Support/Blender/${BLENDER_VERSION}
+BLENDER_SYSTEM_BASE=${BLENDER_SHARE}/${BLENDER_VERSION}
+BLENDER_USER_DATAFILES=${HOME}/Library/Application Support/Blender/${BLENDER_VERSION}/datafiles
+BLENDER_SYSTEM_DATAFILES=${BLENDER_SHARE}/${BLENDER_VERSION}/datafiles
+BLENDER_USER_PY=${HOME}/Library/Application Support/Blender/${BLENDER_VERSION}/py
+BLENDER_SYSTEM_PY=${BLENDER_SHARE}/${BLENDER_VERSION}/py
+BLENDER_USER_PLUGINS=${HOME}/Library/Application Support/Blender/${BLENDER_VERSION}/plugins
+BLENDER_SYSTEM_PLUGINS=${BLENDER_SHARE}/${BLENDER_VERSION}/plugins
diff --git a/release/environment-mswindows b/release/environment-mswindows
new file mode 100644 (file)
index 0000000..f8890f8
--- /dev/null
@@ -0,0 +1,18 @@
+# This is a Blender Environment Variable config file.\r
+#\r
+# Comment lines start with "#", other lines will be split at the "="\r
+# and the part before will be used as env var name and the part after\r
+# as env var value. The value can make reference to previous or\r
+# prelaunch variables with "%%" and the content will be replaced.\r
+# Once set, values of variables will not be overwritten.\r
+#\r
+# BLENDER_SHARE should be COMMON_APPDATA\\Blender Foundation\\Blender for typical installs.\r
+# BLENDER_VERSION will be set by the program before processing this file.\r
+BLENDER_USER_BASE=%USERPROFILE%\\Blender Foundation\\Blender\\%BLENDER_VERSION%\r
+BLENDER_SYSTEM_BASE=%BLENDER_SHARE%\\%BLENDER_VERSION%\r
+BLENDER_USER_DATAFILES=%USERPROFILE%\\Blender Foundation\\%BLENDER_VERSION%\\datafiles\r
+BLENDER_SYSTEM_DATAFILES=%BLENDER_SHARE%\\%BLENDER_VERSION%\\datafiles\r
+BLENDER_USER_PY=%USERPROFILE%\\Blender Foundation\\%BLENDER_VERSION%\\py\r
+BLENDER_SYSTEM_PY=%BLENDER_SHARE%\\%BLENDER_VERSION%\\py\r
+BLENDER_USER_PLUGINS=%USERPROFILE%\\Blender Foundation\\%BLENDER_VERSION%\\plugins\r
+BLENDER_SYSTEM_PLUGINS=%BLENDER_SHARE%\\%BLENDER_VERSION%\\plugins\r
diff --git a/release/environment-unix b/release/environment-unix
new file mode 100644 (file)
index 0000000..8a13c28
--- /dev/null
@@ -0,0 +1,18 @@
+# This is a Blender Environment Variable config file.
+#
+# Comment lines start with "#", other lines will be split at the "="
+# and the part before will be used as env var name and the part after
+# as env var value. The value can make reference to previous or
+# prelaunch variables with "${}" and the content will be replaced.
+# Once set, values of variables will not be overwritten.
+#
+# BLENDER_SHARE should be /usr/share/blender for typical distro installs.
+# BLENDER_VERSION will be set by the program before processing this file.
+BLENDER_USER_BASE=${HOME}/.blender/${BLENDER_VERSION}
+BLENDER_SYSTEM_BASE=${BLENDER_SHARE}/${BLENDER_VERSION}
+BLENDER_USER_DATAFILES=${HOME}/.blender/${BLENDER_VERSION}/datafiles
+BLENDER_SYSTEM_DATAFILES=${BLENDER_SHARE}/${BLENDER_VERSION}/datafiles
+BLENDER_USER_PY=${HOME}/.blender/${BLENDER_VERSION}/py
+BLENDER_SYSTEM_PY=${BLENDER_SHARE}/${BLENDER_VERSION}/py
+BLENDER_USER_PLUGINS=${HOME}/.blender/${BLENDER_VERSION}/plugins
+BLENDER_SYSTEM_PLUGINS=${BLENDER_SHARE}/${BLENDER_VERSION}/plugins
index 6772a3771cb9f614434e8501f51cf59604336b05..639b9836b0c65cc78f82edefec715297ec27997d 100644 (file)
@@ -154,51 +154,68 @@ class MESH_OT_delete_edgeloop(bpy.types.Operator):
                return ('FINISHED',)
 
 rna_path_prop = bpy.props.StringProperty(attr="path", name="Context Attributes", description="rna context string", maxlen= 1024, default= "")
+rna_reverse_prop = bpy.props.BoolProperty(attr="reverse", name="Reverse", description="Cycle backwards", default= False)
+
+class NullPathMember:
+       pass
+
+def context_path_validate(context, path):
+       import sys
+       try:
+               value = eval("context.%s" % path)
+       except AttributeError:
+               if "'NoneType'" in str(sys.exc_info()[1]):
+                       # One of the items in the rna path is None, just ignore this
+                       value = NullPathMember
+               else:
+                       # We have a real error in the rna path, dont ignore that
+                       raise
+       
+       return value
+               
+       
+
+def execute_context_assign(self, context):
+       if context_path_validate(context, self.path) == NullPathMember:
+               return ('PASS_THROUGH',)
+       
+       exec("context.%s=self.value" % self.path)
+       return ('FINISHED',)
 
 class WM_OT_context_set_boolean(bpy.types.Operator):
        '''Set a context value.'''
        __idname__ = "wm.context_set_boolean"
        __label__ = "Context Set"
        __props__ = [rna_path_prop, bpy.props.BoolProperty(attr="value", name="Value", description="Assignment value", default= True)]
-       def execute(self, context):
-               exec("context.%s=%s" % (self.path, self.value)) # security nuts will complain.
-               return ('FINISHED',)
+       execute = execute_context_assign
 
 class WM_OT_context_set_int(bpy.types.Operator): # same as enum
        '''Set a context value.'''
        __idname__ = "wm.context_set_int"
        __label__ = "Context Set"
        __props__ = [rna_path_prop, bpy.props.IntProperty(attr="value", name="Value", description="Assignment value", default= 0)]
-       def execute(self, context):
-               exec("context.%s=%d" % (self.path, self.value)) # security nuts will complain.
-               return ('FINISHED',)
+       execute = execute_context_assign
                
 class WM_OT_context_set_float(bpy.types.Operator): # same as enum
        '''Set a context value.'''
        __idname__ = "wm.context_set_int"
        __label__ = "Context Set"
        __props__ = [rna_path_prop, bpy.props.FloatProperty(attr="value", name="Value", description="Assignment value", default= 0.0)]
-       def execute(self, context):
-               exec("context.%s=%f" % (self.path, self.value)) # security nuts will complain.
-               return ('FINISHED',)
+       execute = execute_context_assign
 
 class WM_OT_context_set_string(bpy.types.Operator): # same as enum
        '''Set a context value.'''
        __idname__ = "wm.context_set_string"
        __label__ = "Context Set"
        __props__ = [rna_path_prop, bpy.props.StringProperty(attr="value", name="Value", description="Assignment value", maxlen= 1024, default= "")]
-       def execute(self, context):
-               exec("context.%s='%s'" % (self.path, self.value)) # security nuts will complain.
-               return ('FINISHED',)
+       execute = execute_context_assign
 
 class WM_OT_context_set_enum(bpy.types.Operator):
        '''Set a context value.'''
        __idname__ = "wm.context_set_enum"
        __label__ = "Context Set"
        __props__ = [rna_path_prop, bpy.props.StringProperty(attr="value", name="Value", description="Assignment value (as a string)", maxlen= 1024, default= "")]
-       def execute(self, context):
-               exec("context.%s='%s'" % (self.path, self.value)) # security nuts will complain.
-               return ('FINISHED',)
+       execute = execute_context_assign
 
 class WM_OT_context_toggle(bpy.types.Operator):
        '''Toggle a context value.'''
@@ -206,6 +223,10 @@ class WM_OT_context_toggle(bpy.types.Operator):
        __label__ = "Context Toggle"
        __props__ = [rna_path_prop]
        def execute(self, context):
+               
+               if context_path_validate(context, self.path) == NullPathMember:
+                       return ('PASS_THROUGH',)
+               
                exec("context.%s=not (context.%s)" % (self.path, self.path)) # security nuts will complain.
                return ('FINISHED',)
 
@@ -219,16 +240,49 @@ class WM_OT_context_toggle_enum(bpy.types.Operator):
                bpy.props.StringProperty(attr="value_2", name="Value", description="Toggle enum", maxlen= 1024, default= "")
        ]
        def execute(self, context):
+               
+               if context_path_validate(context, self.path) == NullPathMember:
+                       return ('PASS_THROUGH',)
+               
                exec("context.%s = ['%s', '%s'][context.%s!='%s']" % (self.path, self.value_1, self.value_2, self.path, self.value_2)) # security nuts will complain.
                return ('FINISHED',)
 
+class WM_OT_context_cycle_int(bpy.types.Operator):
+       '''Set a context value. Useful for cycling active material, vertex keys, groups' etc.'''
+       __idname__ = "wm.context_cycle_int"
+       __label__ = "Context Int Cycle"
+       __props__ = [rna_path_prop, rna_reverse_prop]
+       def execute(self, context):
+               
+               value = context_path_validate(context, self.path)
+               if value == NullPathMember:
+                       return ('PASS_THROUGH',)
+               
+               self.value = value
+               if self.reverse:        self.value -= 1
+               else:           self.value += 1
+               execute_context_assign(self, context)
+               
+               if self.value != eval("context.%s" % self.path):
+                       # relies on rna clamping int's out of the range
+                       if self.reverse:        self.value =  (1<<32)
+                       else:           self.value = -(1<<32)
+                       execute_context_assign(self, context)
+                       
+               return ('FINISHED',)
+
 class WM_OT_context_cycle_enum(bpy.types.Operator):
        '''Toggle a context value.'''
        __idname__ = "wm.context_cycle_enum"
        __label__ = "Context Enum Cycle"
-       __props__ = [rna_path_prop, bpy.props.BoolProperty(attr="reverse", name="Reverse", description="Cycle backwards", default= False)]
+       __props__ = [rna_path_prop, rna_reverse_prop]
        def execute(self, context):
-               orig_value = eval("context.%s" % self.path) # security nuts will complain.
+               
+               value = context_path_validate(context, self.path)
+               if value == NullPathMember:
+                       return ('PASS_THROUGH',)
+               
+               orig_value = value
                
                # Have to get rna enum values
                rna_struct_str, rna_prop_str =  self.path.rsplit('.', 1)
@@ -257,6 +311,7 @@ class WM_OT_context_cycle_enum(bpy.types.Operator):
                exec("context.%s=advance_enum" % self.path)
                return ('FINISHED',)
 
+
 bpy.ops.add(MESH_OT_delete_edgeloop)
 
 bpy.ops.add(WM_OT_context_set_boolean)
@@ -267,4 +322,5 @@ bpy.ops.add(WM_OT_context_set_enum)
 bpy.ops.add(WM_OT_context_toggle)
 bpy.ops.add(WM_OT_context_toggle_enum)
 bpy.ops.add(WM_OT_context_cycle_enum)
+bpy.ops.add(WM_OT_context_cycle_int)
 
index bbec295a165b9348ba2ff0a74dd105f7a4a4a004..0fb00b03961db534831d6c85b386f1141830c69b 100644 (file)
@@ -47,9 +47,6 @@ class DATA_PT_skeleton(DataButtonsPanel):
                col.itemR(arm, "layer", text="")
                col.itemL(text="Protected Layers:")
                col.itemR(arm, "layer_protection", text="")
-               col.itemL(text="Edit Options:")
-               col.itemR(arm, "x_axis_mirror")
-               col.itemR(arm, "auto_ik")
                
                col = split.column()
                col.itemL(text="Deform:")
index c07f3136fae274b31b3b4b1fde07af37c7623f98..eda6cced0ae47a8d86d940cac5a54101511b7d5d 100644 (file)
@@ -17,7 +17,7 @@ class DATA_PT_empty(DataButtonsPanel):
                
                ob = context.object
 
-               layout.itemR(ob, "empty_draw_type", text="Draw Type")
-               layout.itemR(ob, "empty_draw_size", text="Draw Size")
+               layout.itemR(ob, "empty_draw_type", text="Display")
+               layout.itemR(ob, "empty_draw_size", text="Size")
                
 bpy.types.register(DATA_PT_empty)
index 35d0ecafdf1b5176af835d33c74ef0a1448c302c..77c6f83407313d4caad586f8a341a3559cbaaf7f 100644 (file)
@@ -60,9 +60,6 @@ class DATA_PT_settings(DataButtonsPanel):
                
                col = split.column()
                col.itemR(mesh, "texture_mesh")
-               
-               col = split.column()
-               col.itemR(mesh, "use_mirror_x")
 
 class DATA_PT_vertex_groups(DataButtonsPanel):
        __label__ = "Vertex Groups"
@@ -74,9 +71,14 @@ class DATA_PT_vertex_groups(DataButtonsPanel):
                layout = self.layout
                
                ob = context.object
+               group = ob.active_vertex_group
+
+               rows = 2
+               if group:
+                       rows= 5
 
                row = layout.row()
-               row.template_list(ob, "vertex_groups", ob, "active_vertex_group_index", rows=2)
+               row.template_list(ob, "vertex_groups", ob, "active_vertex_group_index", rows=rows)
 
                col = row.column(align=True)
                col.itemO("object.vertex_group_add", icon='ICON_ZOOMIN', text="")
@@ -86,12 +88,11 @@ class DATA_PT_vertex_groups(DataButtonsPanel):
                if ob.data.users > 1:
                        col.itemO("object.vertex_group_copy_to_linked", icon='ICON_LINK_AREA', text="")
 
-               group = ob.active_vertex_group
                if group:
                        row = layout.row()
                        row.itemR(group, "name")
 
-               if ob.mode == 'EDIT':
+               if ob.mode == 'EDIT' and len(ob.vertex_groups) > 0:
                        row = layout.row()
                        
                        sub = row.row(align=True)
@@ -108,7 +109,7 @@ class DATA_PT_shape_keys(DataButtonsPanel):
        __label__ = "Shape Keys"
        
        def poll(self, context):
-               return (context.object and context.object.type in ('MESH', 'LATTICE'))
+               return (context.object and context.object.type in ('MESH', 'LATTICE', 'CURVE', 'SURFACE'))
 
        def draw(self, context):
                layout = self.layout
@@ -117,60 +118,78 @@ class DATA_PT_shape_keys(DataButtonsPanel):
                key = ob.data.shape_keys
                kb = ob.active_shape_key
 
+               enable_edit = ob.mode != 'EDIT'
+               enable_edit_value = False
+
+               if ob.shape_key_lock == False:
+                       if enable_edit or (ob.type == 'MESH' and ob.shape_key_edit_mode):
+                               enable_edit_value = True
+
                row = layout.row()
-               row.template_list(key, "keys", ob, "active_shape_key_index", rows=2)
+
+               rows = 2
+               if kb:
+                       rows= 5
+               row.template_list(key, "keys", ob, "active_shape_key_index", rows=rows)
 
                col = row.column()
 
                subcol = col.column(align=True)
                subcol.itemO("object.shape_key_add", icon='ICON_ZOOMIN', text="")
                subcol.itemO("object.shape_key_remove", icon='ICON_ZOOMOUT', text="")
-               subcol.itemO("object.shape_key_mirror", icon='ICON_MOD_MIRROR', text="")
 
                if kb:
                        col.itemS()
 
                        subcol = col.column(align=True)
-                       subcol.itemR(ob, "shape_key_lock", icon='ICON_UNPINNED', text="")
-                       subcol.itemR(kb, "mute", icon='ICON_MUTE_IPO_OFF', text="")
+                       subcol.item_enumO("object.shape_key_move", "type", 'UP', icon='ICON_TRIA_UP', text="")
+                       subcol.item_enumO("object.shape_key_move", "type", 'DOWN', icon='ICON_TRIA_DOWN', text="")
 
-                       if key.relative:
-                               row = layout.row()
-                               row.itemR(key, "relative")
-                               row.itemL()
+                       split = layout.split(percentage=0.4)
+                       sub = split.row()
+                       sub.enabled = enable_edit
+                       sub.itemR(key, "relative")
 
-                               row = layout.row()
-                               row.itemR(kb, "name")
+                       sub = split.row()
+                       sub.alignment = 'RIGHT'
+
+                       subrow = sub.row(align=True)
+                       subrow.active= enable_edit_value
+                       subrow.itemR(ob, "shape_key_lock", icon='ICON_UNPINNED', text="")
+                       subrow.itemR(kb, "mute", icon='ICON_MUTE_IPO_OFF', text="")
+                       subrow.itemO("object.shape_key_clear", icon='ICON_X', text="")
+
+                       sub.itemO("object.shape_key_mirror", icon='ICON_MOD_MIRROR', text="")
+
+                       sub.itemR(ob, "shape_key_edit_mode", text="")
+
+                       row = layout.row()
+                       row.itemR(kb, "name")
 
+                       if key.relative:
                                if ob.active_shape_key_index != 0:
-                                       
                                        row = layout.row()
-                                       row.enabled = ob.shape_key_lock == False
+                                       row.active = enable_edit_value
                                        row.itemR(kb, "value")
-                                       row.itemO("object.shape_key_clear", icon='ICON_X', text="")
                                        
                                        split = layout.split()
                                        sub = split.column(align=True)
-                                       sub.enabled = ob.shape_key_lock == False
+                                       sub.active = enable_edit_value
                                        sub.itemL(text="Range:")
                                        sub.itemR(kb, "slider_min", text="Min")
                                        sub.itemR(kb, "slider_max", text="Max")
                                        
-                                       sub = split.column()
+                                       sub = split.column(align=True)
+                                       sub.active = enable_edit_value
                                        sub.itemL(text="Blend:")
                                        sub.item_pointerR(kb, "vertex_group", ob, "vertex_groups", text="")
                                        sub.item_pointerR(kb, "relative_key", key, "keys", text="")
                                        
                        else:
                                row = layout.row()
-                               row.itemR(key, "relative")
+                               row.active = enable_edit_value
                                row.itemR(key, "slurph")
 
-                               layout.itemR(kb, "name")
-
-               if ob.mode == 'EDIT':
-                       layout.enabled = False
-
 class DATA_PT_uv_texture(DataButtonsPanel):
        __label__ = "UV Texture"
        
@@ -220,3 +239,4 @@ bpy.types.register(DATA_PT_vertex_groups)
 bpy.types.register(DATA_PT_shape_keys)
 bpy.types.register(DATA_PT_uv_texture)
 bpy.types.register(DATA_PT_vertex_colors)
+
index e38eb583447ee2a8ca564a2629ca0ea146bb7148..9499478a029dcb4fcedf6e1ee6f420ee52520f74 100644 (file)
@@ -150,7 +150,9 @@ class MATERIAL_PT_strand(MaterialButtonsPanel):
                col = split.column()
                col.itemL(text="Shading:")
                col.itemR(tan, "width_fade")
-               col.itemR(tan, "uv_layer")
+               ob = context.object
+               if ob and ob.type == 'MESH': col.item_pointerR(tan, "uv_layer", ob.data, "uv_textures", text="")
+               else: col.itemR(tan, "uv_layer", text="")
                col.itemS()
                sub = col.column()
                sub.active = (not mat.shadeless)
index b0be974727aa4a6b732e3c0c46e76232c2962112..dcc93bd9c75ccf40b5b94ac90f36249c31268833 100644 (file)
@@ -650,6 +650,8 @@ class PARTICLE_PT_render(ParticleButtonsPanel):
                                col = row.column()
                                subrow = col.row()
                                subcol = subrow.column(align=True)
+                               subcol.itemO("particle.dupliob_copy", icon='ICON_ZOOMIN', text="")
+                               subcol.itemO("particle.dupliob_remove", icon='ICON_ZOOMOUT', text="")
                                subcol.itemO("particle.dupliob_move_up", icon='VICON_MOVE_UP', text="")
                                subcol.itemO("particle.dupliob_move_down", icon='VICON_MOVE_DOWN', text="")
                                
index 270ecaf19aad380688736c121cd7c7d223653079..1680a80bb6c1b16704ccfc0862be7cc90f065f5c 100644 (file)
@@ -171,7 +171,9 @@ class TEXTURE_PT_mapping(TextureSlotPanel):
                        elif tex.texture_coordinates == 'UV':
                                split = layout.split(percentage=0.3)
                                split.itemL(text="Layer:")
-                               split.itemR(tex, "uv_layer", text="")
+                               ob = context.object
+                               if ob and ob.type == 'MESH': split.item_pointerR(tex, "uv_layer", ob.data, "uv_textures", text="")
+                               else: split.itemR(tex, "uv_layer", text="")
                        elif tex.texture_coordinates == 'OBJECT':
                                split = layout.split(percentage=0.3)
                                split.itemL(text="Object:")
@@ -217,8 +219,12 @@ class TEXTURE_PT_mapping(TextureSlotPanel):
 
 class TEXTURE_PT_influence(TextureSlotPanel):
        __label__ = "Influence"
+       def poll(self, context):
+               return context.texture_slot
+               
        
        def draw(self, context):
+               
                layout = self.layout
                
                idblock = context_tex_datablock(context)
index 7246159be7a66378a8d40f9387a47f3e673ae6ce..d1e4ac13ab7b5191b7cf4570b6b7bd1367ae36c2 100644 (file)
@@ -39,7 +39,8 @@ class INFO_HT_header(bpy.types.Header):
                layout.template_running_jobs()
 
                layout.itemL(text=scene.statistics())
-
+               
+               layout.itemO("wm.window_fullscreen_toggle", icon='ICON_ARROW_LEFTRIGHT', text="")
 
 class INFO_MT_file(bpy.types.Menu):
        __label__ = "File"
@@ -53,6 +54,7 @@ class INFO_MT_file(bpy.types.Menu):
                layout.itemO("wm.open_mainfile", text="Open...", icon='ICON_FILE_FOLDER')
                layout.item_menu_enumO("wm.open_recentfile", "file", text="Open Recent")
                layout.itemO("wm.recover_last_session")
+               layout.itemO("wm.recover_auto_save", text="Recover Auto Save...")
 
                layout.itemS()
 
@@ -133,7 +135,7 @@ class INFO_MT_mesh_add(dynamic_menu.DynMenu):
                layout.itemO("mesh.primitive_circle_add", icon='ICON_MESH_CIRCLE', text="Circle")
                layout.itemO("mesh.primitive_uv_sphere_add", icon='ICON_MESH_UVSPHERE', text="UV Sphere")
                layout.itemO("mesh.primitive_ico_sphere_add", icon='ICON_MESH_ICOSPHERE', text="Icosphere")
-               layout.itemO("mesh.primitive_cylinder_add", icon='ICON_MESH_TUBE', text="Tube")
+               layout.itemO("mesh.primitive_tube_add", icon='ICON_MESH_TUBE', text="Tube")
                layout.itemO("mesh.primitive_cone_add", icon='ICON_MESH_CONE', text="Cone")
                layout.itemS()
                layout.itemO("mesh.primitive_grid_add", icon='ICON_MESH_GRID', text="Grid")
@@ -287,7 +289,7 @@ class HELP_OT_user_community(HelpOperator):
 
 class HELP_OT_operator_cheat_sheet(bpy.types.Operator):
        __idname__ = "help.operator_cheat_sheet"
-       __label__ = "Operator Cheet Sheet (new textblock)"
+       __label__ = "Operator Cheat Sheet (new textblock)"
        def execute(self, context):
                op_strings = []
                tot = 0
index 87c31e1aa949db29641c9e2cd9977d6b959b7cbd..40816309e7e97fd86d0eec65a54abcd71a1d7d85 100644 (file)
@@ -17,6 +17,8 @@ class OUTLINER_HT_header(bpy.types.Header):
                if context.area.show_menus:
                        sub = row.row(align=True)
                        sub.itemM("OUTLINER_MT_view")
+                       if space.display_mode == 'DATABLOCKS':
+                               sub.itemM("OUTLINER_MT_edit_datablocks")
 
                layout.itemR(space, "display_mode", text="")
                
@@ -26,13 +28,16 @@ class OUTLINER_HT_header(bpy.types.Header):
                        row = layout.row(align=True)
                        row.itemO("outliner.keyingset_add_selected", icon='ICON_ZOOMIN', text="")
                        row.itemO("outliner.keyingset_remove_selected", icon='ICON_ZOOMOUT', text="")
+                       
                        if ks:
+                               row = layout.row(align=False)
                                row.item_pointerR(scene, "active_keying_set", scene, "keying_sets", text="")
                                
                                row = layout.row(align=True)
                                row.itemO("anim.insert_keyframe", text="", icon='ICON_KEY_HLT')
                                row.itemO("anim.delete_keyframe", text="", icon='ICON_KEY_DEHLT')
                        else:
+                               row = layout.row(align=False)
                                row.itemL(text="No Keying Set active")
 
 class OUTLINER_MT_view(bpy.types.Menu):
@@ -51,6 +56,23 @@ class OUTLINER_MT_view(bpy.types.Menu):
 
                col.itemO("outliner.show_one_level")
                col.itemO("outliner.show_hierarchy")
+               
+class OUTLINER_MT_edit_datablocks(bpy.types.Menu):
+       __label__ = "Edit"
+       
+       def draw(self, context):
+               layout = self.layout
+               
+               col = layout.column()
+
+               col.itemO("outliner.keyingset_add_selected")
+               col.itemO("outliner.keyingset_remove_selected")
+               
+               col.itemS()
+               
+               col.itemO("outliner.drivers_add_selected")
+               col.itemO("outliner.drivers_delete_selected")
 
 bpy.types.register(OUTLINER_HT_header)
 bpy.types.register(OUTLINER_MT_view)
+bpy.types.register(OUTLINER_MT_edit_datablocks)
index 582481401a620adfbc3bd6323f074c1a7babf088..ca84e34588582c912b74014c7e22354c6fd3f112 100644 (file)
@@ -147,6 +147,7 @@ class SEQUENCER_MT_add(bpy.types.Menu):
 
        def draw(self, context):
                layout = self.layout
+               layout.operator_context = 'INVOKE_REGION_WIN'
                
                st = context.space_data
                
@@ -163,7 +164,7 @@ class SEQUENCER_MT_add_effect(bpy.types.Menu):
 
        def draw(self, context):
                layout = self.layout
-               
+               layout.operator_context = 'INVOKE_REGION_WIN'
                st = context.space_data
                
                layout.column()
index 46a56f7d133b2ac458b2d493d05afaf13e6fcf07..c887289e45d040ec654f53ac80e1613efca18ac8 100644 (file)
@@ -15,7 +15,7 @@ class USERPREF_HT_header(bpy.types.Header):
 
                if userpref.active_section == 'INPUT':
                        layout.operator_context = "INVOKE_DEFAULT"
-                       layout.itemO("wm.keyconfig_save", "Save Key Configuration...")
+                       layout.itemO("wm.keyconfig_export", "Export Key Configuration...")
                        
 class USERPREF_MT_view(bpy.types.Menu):
        __label__ = "View"
@@ -548,10 +548,10 @@ bpy.types.register(USERPREF_PT_system)
 bpy.types.register(USERPREF_PT_file)
 bpy.types.register(USERPREF_PT_input)
 
-class WM_OT_keyconfig_save(bpy.types.Operator):
-       "Save key configuration to a python script."
-       __idname__ = "wm.keyconfig_save"
-       __label__ = "Save Key Configuration..."
+class WM_OT_keyconfig_export(bpy.types.Operator):
+       "Export key configuration to a python script."
+       __idname__ = "wm.keyconfig_export"
+       __label__ = "Export Key Configuration..."
        __props__ = [
                bpy.props.StringProperty(attr="path", name="File Path", description="File path to write file to.")]
 
@@ -578,7 +578,7 @@ class WM_OT_keyconfig_save(bpy.types.Operator):
                                                result += ", "
                                result += "]"
                else:
-                       print("Save key configuration: can't write ", value)
+                       print("Export key configuration: can't write ", value)
 
                return result
 
@@ -688,7 +688,7 @@ class WM_OT_keyitem_remove(bpy.types.Operator):
                km.remove_item(kmi)
                return ('FINISHED',)
 
-bpy.ops.add(WM_OT_keyconfig_save)
+bpy.ops.add(WM_OT_keyconfig_export)
 bpy.ops.add(WM_OT_keymap_edit)
 bpy.ops.add(WM_OT_keymap_restore)
 bpy.ops.add(WM_OT_keyitem_add)
index b4300710dab94213fef9b8736ae18be98f88114f..ad2597d6c243d2d9a716d04d48e7cee45baf87c6 100644 (file)
@@ -110,6 +110,7 @@ class VIEW3D_MT_view(bpy.types.Menu):
                
                layout.itemS()
                
+               layout.itemO("view3d.localview", text="View Global/Local")
                layout.itemO("view3d.view_center")
                layout.itemO("view3d.view_all")
                
@@ -256,6 +257,8 @@ class VIEW3D_MT_select_edit_mesh(bpy.types.Menu):
                layout.itemO("mesh.select_more", text="More")
 
                layout.itemS()
+               
+               layout.itemO("mesh.select_mirror", text="Mirror")
 
                layout.itemO("mesh.select_linked", text="Linked")
                layout.itemO("mesh.select_vertex_path", text="Vertex Path")
@@ -425,6 +428,7 @@ class VIEW3D_MT_object(bpy.types.Menu):
                
                layout.itemS()
                
+               layout.itemO("object.move_to_layer", text="Move to Layer...")
                layout.itemM("VIEW3D_MT_object_showhide")
                
                layout.item_menu_enumO("object.convert", "target")
@@ -827,6 +831,8 @@ class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu):
                layout.itemO("mesh.select_vertex_path")
                
                layout.itemO("mesh.blend_from_shape")
+               
+               layout.itemO("object.vertex_group_blend")
                # uiItemO(layout, "Propagate to All Shapes", 0, "mesh.shape_propagate_to_all");
 
 class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu):
@@ -1233,7 +1239,6 @@ class VIEW3D_PT_3dview_display(bpy.types.Panel):
                view = context.space_data
                gs = context.scene.game_data
                ob = context.object
-               mesh = context.active_object.data
                
                col = layout.column()
                col.itemR(view, "display_floor", text="Grid Floor")
@@ -1243,7 +1248,8 @@ class VIEW3D_PT_3dview_display(bpy.types.Panel):
                col.itemR(view, "outline_selected")
                col.itemR(view, "all_object_centers")
                col.itemR(view, "relationship_lines")
-               if ob.type =='MESH':
+               if ob and ob.type =='MESH':
+                       mesh = context.active_object.data
                        col.itemR(mesh, "all_edges")
                
                col = layout.column()
@@ -1379,6 +1385,48 @@ class VIEW3D_PT_transform_orientations(bpy.types.Panel):
                        col.itemR(orientation, "name")
                        col.itemO("tfm.delete_orientation", text="Delete")
 
+class VIEW3D_PT_etch_a_ton(bpy.types.Panel):
+       __space_type__ = 'VIEW_3D'
+       __region_type__ = 'UI'
+       __label__ = "Skeleton Sketching"
+       __default_closed__ = True
+
+       def poll(self, context):
+               scene = context.space_data
+               ob = context.active_object
+               return scene and ob and ob.type == 'ARMATURE' and ob.mode == 'EDIT' 
+
+       def draw_header(self, context):
+               layout = self.layout
+               toolsettings = context.scene.tool_settings
+
+               layout.itemR(toolsettings, "bone_sketching", text="")
+
+       def draw(self, context):
+               layout = self.layout
+               toolsettings = context.scene.tool_settings
+
+               col = layout.column()
+
+               col.itemR(toolsettings, "etch_quick")
+               col.itemR(toolsettings, "etch_overdraw")
+
+               col.itemR(toolsettings, "etch_convert_mode")
+               
+               if toolsettings.etch_convert_mode == "LENGTH":
+                       col.itemR(toolsettings, "etch_length_limit")
+               elif toolsettings.etch_convert_mode == "ADAPTIVE":
+                       col.itemR(toolsettings, "etch_adaptive_limit")
+               elif toolsettings.etch_convert_mode == "FIXED":
+                       col.itemR(toolsettings, "etch_subdivision_number")
+               elif toolsettings.etch_convert_mode == "RETARGET":
+                       col.itemR(toolsettings, "etch_template")
+                       col.itemR(toolsettings, "etch_roll_mode")
+                       col.itemR(toolsettings, "etch_autoname")
+                       col.itemR(toolsettings, "etch_number")
+                       col.itemR(toolsettings, "etch_side")
+               
+
 # Operators 
 
 class OBJECT_OT_select_pattern(bpy.types.Operator):
@@ -1497,6 +1545,7 @@ bpy.types.register(VIEW3D_PT_3dview_meshdisplay)
 bpy.types.register(VIEW3D_PT_3dview_curvedisplay)
 bpy.types.register(VIEW3D_PT_background_image)
 bpy.types.register(VIEW3D_PT_transform_orientations)
+bpy.types.register(VIEW3D_PT_etch_a_ton)
 
 bpy.ops.add(OBJECT_OT_select_pattern)
 
index d93a2d26040070fd1b948aca67de7b35ee7dfb66..65802744034ec315329a4a6e6ac2649288a0bae5 100644 (file)
@@ -102,6 +102,18 @@ class VIEW3D_PT_tools_meshedit(View3DPanel):
                col.itemO("screen.repeat_last")
                col.itemO("screen.repeat_history", text="History...")
                col.itemO("screen.redo_last", text="Tweak...")
+               
+class VIEW3D_PT_tools_meshedit_options(View3DPanel):
+       __context__ = "mesh_edit"
+       __label__ = "Mesh Options"
+
+       def draw(self, context):
+               layout = self.layout
+       
+               mesh = context.active_object.data
+               
+               col = layout.column(align=True)
+               col.itemR(mesh, "use_mirror_x")
 
 # ********** default tools for editmode_curve ****************
 
@@ -251,6 +263,9 @@ class VIEW3D_PT_tools_armatureedit(View3DPanel):
                col.itemO("screen.repeat_last")
                col.itemO("screen.repeat_history", text="History...")
                col.itemO("screen.redo_last", text="Tweak...")
+               
+
+
 
 # ********** default tools for editmode_mball ****************
 
@@ -355,6 +370,19 @@ class VIEW3D_PT_tools_posemode(View3DPanel):
                col.itemO("screen.repeat_last")
                col.itemO("screen.repeat_history", text="History...")
                col.itemO("screen.redo_last", text="Tweak...")
+               
+class VIEW3D_PT_tools_posemode_options(View3DPanel):
+       __context__ = "posemode"
+       __label__ = "Pose Options"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               arm = context.active_object.data
+
+               col = layout.column(align=True)
+               col.itemR(arm, "x_axis_mirror")
+               col.itemR(arm, "auto_ik")
 
 # ********** default tools for paint modes ****************
 
@@ -607,6 +635,22 @@ class VIEW3D_PT_sculpt_options(PaintPanel):
 # ********** default tools for weightpaint ****************
 
 class VIEW3D_PT_tools_weightpaint(View3DPanel):
+       __context__ = "weightpaint"
+       __label__ = "Weight Tools"
+
+       def draw(self, context):
+               layout = self.layout
+               
+               wpaint = context.tool_settings.weight_paint
+
+               col = layout.column()
+               # col.itemL(text="Blend:")
+               col.itemO("object.vertex_group_normalize_all", text="Normalize All")
+               col.itemO("object.vertex_group_normalize", text="Normalize")
+               col.itemO("object.vertex_group_invert", text="Invert")
+               col.itemO("object.vertex_group_clean", text="Clean")
+
+class VIEW3D_PT_tools_weightpaint_options(View3DPanel):
        __context__ = "weightpaint"
        __label__ = "Options"
 
@@ -622,6 +666,11 @@ class VIEW3D_PT_tools_weightpaint(View3DPanel):
                col.itemR(wpaint, "normals")
                col.itemR(wpaint, "spray")
                col.itemR(wpaint, "vertex_dist", text="Distance")
+               
+               
+               data = context.weight_paint_object.data
+               if type(data) == bpy.types.Mesh:
+                       col.itemR(data, "use_mirror_x")
 
 # Commented out because the Apply button isn't an operator yet, making these settings useless
 #              col.itemL(text="Gamma:")
@@ -773,8 +822,10 @@ class VIEW3D_PT_tools_particlemode(View3DPanel):
                sub.active = pe.fade_time
                sub.itemR(pe, "fade_frames", slider=True)
 
+bpy.types.register(VIEW3D_PT_tools_weightpaint)
 bpy.types.register(VIEW3D_PT_tools_objectmode)
 bpy.types.register(VIEW3D_PT_tools_meshedit)
+bpy.types.register(VIEW3D_PT_tools_meshedit_options)
 bpy.types.register(VIEW3D_PT_tools_curveedit)
 bpy.types.register(VIEW3D_PT_tools_surfaceedit)
 bpy.types.register(VIEW3D_PT_tools_textedit)
@@ -782,11 +833,12 @@ bpy.types.register(VIEW3D_PT_tools_armatureedit)
 bpy.types.register(VIEW3D_PT_tools_mballedit)
 bpy.types.register(VIEW3D_PT_tools_latticeedit)
 bpy.types.register(VIEW3D_PT_tools_posemode)
+bpy.types.register(VIEW3D_PT_tools_posemode_options)
 bpy.types.register(VIEW3D_PT_tools_brush)
 bpy.types.register(VIEW3D_PT_tools_brush_stroke)
 bpy.types.register(VIEW3D_PT_tools_brush_curve)
 bpy.types.register(VIEW3D_PT_sculpt_options)
 bpy.types.register(VIEW3D_PT_tools_vertexpaint)
-bpy.types.register(VIEW3D_PT_tools_weightpaint)
+bpy.types.register(VIEW3D_PT_tools_weightpaint_options)
 bpy.types.register(VIEW3D_PT_tools_projectpaint)
 bpy.types.register(VIEW3D_PT_tools_particlemode)
index cc5b4dfdcaf7ccfec48d2335430fb067e9216f4d..045095567bc91697715ff8d43d2ca20f08810509 100644 (file)
@@ -67,6 +67,7 @@ struct KeyingSet *BKE_keyingset_add(struct ListBase *list, const char name[], sh
 /* Add a destination to a KeyingSet */
 void BKE_keyingset_add_destination(struct KeyingSet *ks, struct ID *id, const char group_name[], const char rna_path[], int array_index, short flag, short groupmode);
 
+/* Find the destination matching the criteria given */
 struct KS_Path *BKE_keyingset_find_destination(struct KeyingSet *ks, struct ID *id, const char group_name[], const char rna_path[], int array_index, int group_mode);
 
 /* Copy all KeyingSets in the given list */
@@ -78,6 +79,15 @@ void BKE_keyingset_free(struct KeyingSet *ks);
 /* Free all the KeyingSets in the given list */
 void BKE_keyingsets_free(struct ListBase *list);
 
+/* ************************************* */
+/* Path Fixing API */
+
+/* Fix all the paths for the given ID+AnimData */
+void BKE_animdata_fix_paths_rename(struct ID *owner_id, struct AnimData *adt, char *prefix, char *oldName, char *newName);
+
+/* Fix all the paths for the entire database... */
+void BKE_all_animdata_fix_paths_rename(char *prefix, char *oldName, char *newName);
+
 /* ************************************* */
 // TODO: overrides, remapping, and path-finding api's
 
index e91e434b97d21c9517bd98541fba0fcd7ddc3ef1..ebeec31c98458b919816b1e5b1ade96e82b6dff8 100644 (file)
@@ -43,7 +43,7 @@ struct bContext;
 struct ReportList;
 
 #define BLENDER_VERSION                        250
-#define BLENDER_SUBVERSION             6
+#define BLENDER_SUBVERSION             7
 
 #define BLENDER_MINVERSION             250
 #define BLENDER_MINSUBVERSION  0
index 78a2f13a7cc7f86fdfc39f1731fb8f203e1427e7..2d1bec09dbfb37bc92b27ce55bde3124f0d4b557 100644 (file)
@@ -92,6 +92,9 @@ void switchdirectionNurb( struct Nurb *nu);
 float (*curve_getVertexCos(struct Curve *cu, struct ListBase *lb, int *numVerts_r))[3];
 void curve_applyVertexCos(struct Curve *cu, struct ListBase *lb, float (*vertexCos)[3]);
 
+float (*curve_getKeyVertexCos(struct Curve *cu, struct ListBase *lb, float *key))[3];
+void curve_applyKeyVertexTilts(struct Curve *cu, struct ListBase *lb, float *key);
+
 /* nurb checks if they can be drawn, also clamp order func */
 int check_valid_nurb_u( struct Nurb *nu);
 int check_valid_nurb_v( struct Nurb *nu);
index 5d0b89220d5123542257a7d5da420325980a85d8..2e9ac2f65f0adfbd1e89f55469169643eaaf2fb9 100644 (file)
@@ -110,7 +110,7 @@ typedef struct Global {
 #define G_BACKBUFSEL   (1 <<  4)
 #define G_PICKSEL              (1 <<  5)
 
-#define G_FACESELECT   (1 <<  8)
+/* #define G_FACESELECT        (1 <<  8) use (mesh->editflag & ME_EDIT_PAINT_MASK) */
 
 #define G_DEBUG                        (1 << 12)
 #define G_DOSCRIPTLINKS (1 << 13)
@@ -145,6 +145,7 @@ typedef struct Global {
 #define G_FILE_GLSL_NO_NODES    (1 << 20)                              /* deprecated */
 #define G_FILE_GLSL_NO_EXTRA_TEX (1 << 21)                             /* deprecated */
 #define G_FILE_IGNORE_DEPRECATION_WARNINGS     (1 << 22)       /* deprecated */
+#define G_FILE_RECOVER                  (1 << 23)
 
 /* G.windowstate */
 #define G_WINDOWSTATE_USERDEF          0
index 1b4cbc1cf2a6dba0e2bc480e3965b22586f22c14..b70801a9edd5c2a4aee4e8e399d9361b168c6c6b 100644 (file)
@@ -56,10 +56,7 @@ void key_curve_position_weights(float t, float *data, int type);
 void key_curve_tangent_weights(float t, float *data, int type);
 void key_curve_normal_weights(float t, float *data, int type);
 
-/* only exported to curve.c! */
-void cp_cu_key(struct Curve *cu, struct KeyBlock *kb, int start, int end);
-
-int do_ob_key(struct Scene *scene, struct Object *ob);
+float *do_ob_key(struct Scene *scene, struct Object *ob);
 
 struct Key *ob_get_key(struct Object *ob);
 struct KeyBlock *ob_get_keyblock(struct Object *ob);
@@ -67,7 +64,7 @@ struct KeyBlock *key_get_keyblock(struct Key *key, int index);
 struct KeyBlock *key_get_named_keyblock(struct Key *key, const char name[]);
 char *key_get_curValue_rnaPath(struct Key *key, struct KeyBlock *kb);
 // needed for the GE
-void do_rel_key(int start, int end, int tot, char *basispoin, struct Key *key, int mode);
+void do_rel_key(int start, int end, int tot, char *basispoin, struct Key *key, struct KeyBlock *actkb, int mode);
 
 #ifdef __cplusplus
 };
index 85316dddedf19e8316c108a5a57e76dcc2d8f755..3ea7cae2c862088e5cde0e06a0bf92faf87039f4 100644 (file)
@@ -47,6 +47,7 @@ void test_object_materials(struct ID *id);
 void init_material(struct Material *ma);
 struct Material *add_material(char *name);
 struct Material *copy_material(struct Material *ma);
+struct Material *give_node_material(struct Material *ma); /* returns node material or self */
 void make_local_material(struct Material *ma);
 
 void automatname(struct Material *);
index d2f5e0faa0f905a806942bd151859ae85f03f775..09c1ab9f7d6865b3768fe2667e38bed930a72efb 100644 (file)
@@ -92,7 +92,6 @@ void mesh_calc_normals(struct MVert *mverts, int numVerts, struct MFace *mfaces,
        /* Return a newly MEM_malloc'd array of all the mesh vertex locations
         * (_numVerts_r_ may be NULL) */
 float (*mesh_getVertexCos(struct Mesh *me, int *numVerts_r))[3];
-float (*mesh_getRefKeyCos(struct Mesh *me, int *numVerts_r))[3];
 
 /* map from uv vertex to face (for select linked, stitch, uv suburf) */
 
index 9957ced95554811678bfc01273218ce6386858d0..245db7e35ff6e5c9f4ecb752d1a2976688c6f39b 100644 (file)
@@ -293,7 +293,7 @@ void          modifiers_foreachIDLink(struct Object *ob,
 struct ModifierData  *modifiers_findByType(struct Object *ob, ModifierType type);
 void          modifiers_clearErrors(struct Object *ob);
 int           modifiers_getCageIndex(struct Object *ob,
-                                     int *lastPossibleCageIndex_r);
+                                     int *lastPossibleCageIndex_r, int virtual_);
 
 int           modifiers_isSoftbodyEnabled(struct Object *ob);
 int           modifiers_isClothEnabled(struct Object *ob);
index f72617c83128da36e1d9c56989f629357167d4b6..fb3c282b0900b6646f0a94b95c46162944632643 100644 (file)
@@ -135,6 +135,7 @@ struct SeqEffectHandle {
 /* ********************* prototypes *************** */
 
 /* sequence.c */
+void printf_strip(struct Sequence *seq);
 
 // extern
 void seq_free_sequence(struct Scene *scene, struct Sequence *seq);
@@ -181,6 +182,7 @@ int check_single_seq(struct Sequence *seq);
 void fix_single_seq(struct Sequence *seq);
 int seq_test_overlap(struct ListBase * seqbasep, struct Sequence *test);
 int shuffle_seq(struct ListBase * seqbasep, struct Sequence *test);
+int shuffle_seq_time(ListBase * seqbasep);
 void free_imbuf_seq(struct ListBase * seqbasep, int check_mem_usage);
 
 void seq_update_sound(struct Sequence *seq);
index a8ea83a45fcaf46f024422aaa7d405cbe42c8cda..11e58203bb3615508c780f6ab4e3bef389ea633d 100644 (file)
@@ -1755,9 +1755,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
        *final_r = NULL;
 
        if(useDeform) {
-               if(useDeform > 0 && do_ob_key(scene, ob)) /* shape key makes deform verts */
-                       deformedVerts = mesh_getVertexCos(me, &numVerts);
-               else if(inputVertexCos)
+               if(inputVertexCos)
                        deformedVerts = inputVertexCos;
                
                /* Apply all leading deforming modifiers */
@@ -1800,7 +1798,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
                if(inputVertexCos)
                        deformedVerts = inputVertexCos;
                else
-                       deformedVerts = mesh_getRefKeyCos(me, &numVerts);
+                       deformedVerts = mesh_getVertexCos(me, &numVerts);
        }
 
 
@@ -2013,7 +2011,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri
        float (*deformedVerts)[3] = NULL;
        CustomDataMask mask;
        DerivedMesh *dm, *orcodm = NULL;
-       int i, numVerts = 0, cageIndex = modifiers_getCageIndex(ob, NULL);
+       int i, numVerts = 0, cageIndex = modifiers_getCageIndex(ob, NULL, 1);
        LinkNode *datamasks, *curr;
        int required_mode = eModifierMode_Realtime | eModifierMode_Editmode;
 
@@ -2024,7 +2022,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri
        }
 
        dm = NULL;
-       md = ob->modifiers.first;
+       md = modifiers_getVirtualModifierList(ob);
        
        /* we always want to keep original indices */
        dataMask |= CD_MASK_ORIGINDEX;
@@ -2460,13 +2458,13 @@ int editmesh_get_first_deform_matrices(Object *ob, EditMesh *em, float (**deform
        ModifierData *md;
        DerivedMesh *dm;
        int i, a, numleft = 0, numVerts = 0;
-       int cageIndex = modifiers_getCageIndex(ob, NULL);
+       int cageIndex = modifiers_getCageIndex(ob, NULL, 1);
        float (*defmats)[3][3] = NULL, (*deformedVerts)[3] = NULL;
 
        modifiers_clearErrors(ob);
 
        dm = NULL;
-       md = ob->modifiers.first;
+       md = modifiers_getVirtualModifierList(ob);
 
        /* compute the deformation matrices and coordinates for the first
           modifiers with on cage editing that are enabled and support computing
index 47f5dd116d7b655d213e4cbfa8df9b9c8e5f594f..61e754ffbec6aac9654e162cd043dfa5ed2ec648 100644 (file)
@@ -238,24 +238,88 @@ void BKE_animdata_make_local(AnimData *adt)
 
 /* Path Validation -------------------------------------------- */
 
-#if 0
-/* Check if some given RNA Path needs fixing - free the given path and set a new one as appropriate */
-static char *rna_path_rename_fix (ID *owner_id, PointerRNA *modPtr, char *newName, char *oldpath)
+/* Check if a given RNA Path is valid, by tracing it from the given ID, and seeing if we can resolve it */
+static short check_rna_path_is_valid (ID *owner_id, char *path)
 {
+       PointerRNA id_ptr, ptr;
+       PropertyRNA *prop=NULL;
        
+       /* make initial RNA pointer to start resolving from */
+       RNA_id_pointer_create(owner_id, &id_ptr);
        
-       return oldpath; // FIXME!!!
+       /* try to resolve */
+       return RNA_path_resolve(&id_ptr, path, &ptr, &prop); 
+}
+
+/* Check if some given RNA Path needs fixing - free the given path and set a new one as appropriate 
+ * NOTE: we assume that oldName and newName have [" "] padding around them
+ */
+static char *rna_path_rename_fix (ID *owner_id, char *prefix, char *oldName, char *newName, char *oldpath)
+{
+       char *prefixPtr= strstr(oldpath, prefix);
+       char *oldNamePtr= strstr(oldpath, oldName);
+       int prefixLen= strlen(prefix);
+       int oldNameLen= strlen(oldName);
+       
+       /* only start fixing the path if the prefix and oldName feature in the path,
+        * and prefix occurs immediately before oldName
+        */
+       if ( (prefixPtr && oldNamePtr) && (prefixPtr+prefixLen == oldNamePtr) ) {
+               /* if we haven't aren't able to resolve the path now, try again after fixing it */
+               if (check_rna_path_is_valid(owner_id, oldpath) == 0) {          
+                       DynStr *ds= BLI_dynstr_new();
+                       char *postfixPtr= oldNamePtr+oldNameLen;
+                       char *newPath = NULL;
+                       char oldChar;
+                       
+                       /* add the part of the string that goes up to the start of the prefix */
+                       if (prefixPtr > oldpath) {
+                               oldChar= prefixPtr[0]; 
+                               prefixPtr[0]= 0;
+                               BLI_dynstr_append(ds, oldpath);
+                               prefixPtr[0]= oldChar;
+                       }
+                       
+                       /* add the prefix */
+                       BLI_dynstr_append(ds, prefix);
+                       
+                       /* add the new name (complete with brackets) */
+                       BLI_dynstr_append(ds, newName);
+                       
+                       /* add the postfix */
+                       BLI_dynstr_append(ds, postfixPtr);
+                       
+                       /* create new path, and cleanup old data */
+                       newPath= BLI_dynstr_get_cstring(ds);
+                       BLI_dynstr_free(ds);
+                       
+                       /* check if the new path will solve our problems */
+                       // TODO: will need to check whether this step really helps in practice
+                       if (check_rna_path_is_valid(owner_id, newPath)) {
+                               /* free the old path, and return the new one, since we've solved the issues */
+                               MEM_freeN(oldpath);
+                               return newPath;
+                       }
+                       else {
+                               /* still couldn't resolve the path... so, might as well just leave it alone */
+                               MEM_freeN(newPath);
+                       }
+               }
+       }
+       
+       /* the old path doesn't need to be changed */
+       return oldpath;
 }
 
 /* Check RNA-Paths for a list of F-Curves */
-static void fcurves_path_rename_fix (ID *owner_id, PointerRNA *modPtr, char *newName, ListBase *curves)
+static void fcurves_path_rename_fix (ID *owner_id, char *prefix, char *oldName, char *newName, ListBase *curves)
 {
        FCurve *fcu;
        
        /* we need to check every curve... */
        for (fcu= curves->first; fcu; fcu= fcu->next) {
                /* firstly, handle the F-Curve's own path */
-               fcu->rna_path= rna_path_rename_fix(owner_id, modPtr, newName, fcu->rna_path);
+               fcu->rna_path= rna_path_rename_fix(owner_id, prefix, oldName, newName, fcu->rna_path);
                
                /* driver? */
                if (fcu->driver) {
@@ -264,14 +328,14 @@ static void fcurves_path_rename_fix (ID *owner_id, PointerRNA *modPtr, char *new
                        
                        /* driver targets */
                        for (dtar= driver->targets.first; dtar; dtar=dtar->next) {
-                               dtat->rna_path= rna_path_rename_fix(dtar->id, modPtr, newName, dtar->rna_path);
+                               dtar->rna_path= rna_path_rename_fix(dtar->id, prefix, oldName, newName, dtar->rna_path);
                        }
                }
        }
 }
 
 /* Fix all RNA-Paths for Actions linked to NLA Strips */
-static void nlastrips_path_rename_fix (ID *owner_id, PointerRNA *modPtr, char *newName, ListBase *strips)
+static void nlastrips_path_rename_fix (ID *owner_id, char *prefix, char *oldName, char *newName, ListBase *strips)
 {
        NlaStrip *strip;
        
@@ -279,42 +343,122 @@ static void nlastrips_path_rename_fix (ID *owner_id, PointerRNA *modPtr, char *n
        for (strip= strips->first; strip; strip= strip->next) {
                /* fix strip's action */
                if (strip->act)
-                       fcurves_path_rename_fix(owner_id, modPtr, newName, &strip->act->curves);
+                       fcurves_path_rename_fix(owner_id, prefix, oldName, newName, &strip->act->curves);
                /* ignore own F-Curves, since those are local...  */
                
                /* check sub-strips (if metas) */
-               nlastrips_path_rename_fix(owner_id, modPtr, newName, &strip->strips);
+               nlastrips_path_rename_fix(owner_id, prefix, oldName, newName, &strip->strips);
        }
 }
 
 /* Fix all RNA-Paths in the AnimData block used by the given ID block
- *     - the pointer of interest must not have had its new name assigned already, otherwise
- *       path matching for this will never work
+ * NOTE: it is assumed that the structure we're replacing is <prefix><["><name><"]>
+ *             i.e. pose.pose_channels["Bone"]
  */
-void BKE_animdata_fix_paths_rename (ID *owner_id, PointerRNA *modPtr, char *newName)
+void BKE_animdata_fix_paths_rename (ID *owner_id, AnimData *adt, char *prefix, char *oldName, char *newName)
 {
-       AnimData *adt= BKE_animdata_from_id(owner_id);
        NlaTrack *nlt;
+       char *oldN, *newN;
        
        /* if no AnimData, no need to proceed */
-       if (ELEM4(NULL, owner_id, adt, modPtr, newName))
+       if (ELEM4(NULL, owner_id, adt, oldName, newName))
                return;
        
+       /* pad the names with [" "] so that only exact matches are made */
+       oldN= BLI_sprintfN("[\"%s\"]", oldName);
+       newN= BLI_sprintfN("[\"%s\"]", newName);
+       
        /* Active action and temp action */
        if (adt->action)
-               fcurves_path_rename_fix(owner_id, modPtr, newName, &adt->action->curves);
+               fcurves_path_rename_fix(owner_id, prefix, oldN, newN, &adt->action->curves);
        if (adt->tmpact)
-               fcurves_path_rename_fix(owner_id, modPtr, newName, &adt->tmpact->curves);
+               fcurves_path_rename_fix(owner_id, prefix, oldN, newN, &adt->tmpact->curves);
                
        /* Drivers - Drivers are really F-Curves */
-       fcurves_path_rename_fix(owner_id, modPtr, newName, &adt->drivers);
+       fcurves_path_rename_fix(owner_id, prefix, oldN, newN, &adt->drivers);
        
        /* NLA Data - Animation Data for Strips */
-       for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
+       for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next)
+               nlastrips_path_rename_fix(owner_id, prefix, oldN, newN, &nlt->strips);
+               
+       /* free the temp names */
+       MEM_freeN(oldN);
+       MEM_freeN(newN);
+}
+
+/* Fix all RNA-Paths throughout the database (directly access the Global.main version)
+ * NOTE: it is assumed that the structure we're replacing is <prefix><["><name><"]>
+ *             i.e. pose.pose_channels["Bone"]
+ */
+void BKE_all_animdata_fix_paths_rename (char *prefix, char *oldName, char *newName)
+{
+       Main *mainptr= G.main;
+       ID *id;
+       
+       /* macro for less typing 
+        *      - whether animdata exists is checked for by the main renaming callback, though taking 
+        *        this outside of the function may make things slightly faster?
+        */
+#define RENAMEFIX_ANIM_IDS(first) \
+       for (id= first; id; id= id->next) { \
+               AnimData *adt= BKE_animdata_from_id(id); \
+               BKE_animdata_fix_paths_rename(id, adt, prefix, oldName, newName);\
+       }
+       
+       /* nodes */
+       RENAMEFIX_ANIM_IDS(mainptr->nodetree.first);
+       
+       /* textures */
+       RENAMEFIX_ANIM_IDS(mainptr->tex.first);
+       
+       /* lamps */
+       RENAMEFIX_ANIM_IDS(mainptr->lamp.first);
+       
+       /* materials */
+       RENAMEFIX_ANIM_IDS(mainptr->mat.first);
+       
+       /* cameras */
+       RENAMEFIX_ANIM_IDS(mainptr->camera.first);
+       
+       /* shapekeys */
+       RENAMEFIX_ANIM_IDS(mainptr->key.first);
+       
+       /* metaballs */
+       RENAMEFIX_ANIM_IDS(mainptr->mball.first);
+       
+       /* curves */
+       RENAMEFIX_ANIM_IDS(mainptr->curve.first);
+       
+       /* armatures */
+       RENAMEFIX_ANIM_IDS(mainptr->armature.first);
+       
+       /* meshes */
+       // TODO...
+       
+       /* particles */
+       RENAMEFIX_ANIM_IDS(mainptr->particle.first);
+       
+       /* objects */
+       RENAMEFIX_ANIM_IDS(mainptr->object.first); 
+       
+       /* worlds */
+       RENAMEFIX_ANIM_IDS(mainptr->world.first);
+       
+       /* scenes */
+       for (id= mainptr->scene.first; id; id= id->next) {
+               AnimData *adt= BKE_animdata_from_id(id);
+               Scene *scene= (Scene *)id;
+               
+               /* do compositing nodes first (since these aren't included in main tree) */
+               if (scene->nodetree) {
+                       AnimData *adt2= BKE_animdata_from_id((ID *)scene->nodetree);
+                       BKE_animdata_fix_paths_rename((ID *)scene->nodetree, adt2, prefix, oldName, newName);
+               }
                
+               /* now fix scene animation data as per normal */
+               BKE_animdata_fix_paths_rename((ID *)id, adt, prefix, oldName, newName);
        }
 }
-#endif
 
 /* *********************************** */ 
 /* KeyingSet API */
index 9894cc8578474ace45c40ea31f517f481393dd94..504450e033414894cc02c8fbfc5a99f0b0f0bc4c 100644 (file)
@@ -1286,7 +1286,7 @@ void armature_mat_pose_to_delta(float delta_mat[][4], float pose_mat[][4], float
  *     - the result should be that the rotations given in the provided pointers have had conversions 
  *       applied (as appropriate), such that the rotation of the element hasn't 'visually' changed 
  */
-void BKE_rotMode_change_values (float quat[4], float eul[3], float *axis, float angle[3], short oldMode, short newMode)
+void BKE_rotMode_change_values (float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode)
 {
        /* check if any change - if so, need to convert data */
        if (newMode > 0) { /* to euler */
index 796e6a10d6c290e88758de5abfda0ca42b312a42..60943cbf3b1dbf17d31c89a314f0412bc6f1d8b4 100644 (file)
@@ -228,8 +228,6 @@ static void clear_global(void)
 //     free_vertexpaint();
 
        G.main= NULL;
-       
-       G.f &= ~(G_FACESELECT);
 }
 
 /* make sure path names are correct for OS */
@@ -283,12 +281,15 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
        Object *ob;
        bScreen *curscreen= NULL;
        Scene *curscene= NULL;
+       int recover;
        char mode;
-       
+
        /* 'u' = undo save, 'n' = no UI load */
        if(bfd->main->screen.first==NULL) mode= 'u';
        else if(G.fileflags & G_FILE_NO_UI) mode= 'n';
        else mode= 0;
+
+       recover= (G.fileflags & G_FILE_RECOVER);
        
        clean_paths(bfd->main);
        
@@ -373,6 +374,16 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
        if(G.main->versionfile < 250)
                do_versions_ipos_to_animato(G.main); // XXX fixme... complicated versionpatching
        
+       /* in case of autosave or quit.blend, use original filename instead */
+       if(recover && bfd->filename[0])
+               filename= bfd->filename;
+       
+       /* these are the same at times, should never copy to the same location */
+       if(G.sce != filename)
+               BLI_strncpy(G.sce, filename, FILE_MAX);
+       
+       BLI_strncpy(G.main->name, filename, FILE_MAX); /* is guaranteed current file */
+
        /* baseflags, groups, make depsgraph, etc */
        set_scene_bg(CTX_data_scene(C));
 
@@ -385,11 +396,6 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
        /* now tag update flags, to ensure deformers get calculated on redraw */
        DAG_scene_update_flags(CTX_data_scene(C), CTX_data_scene(C)->lay);
        
-       if (G.sce != filename) /* these are the same at times, should never copy to the same location */
-               strcpy(G.sce, filename);
-       
-       BLI_strncpy(G.main->name, filename, FILE_MAX); /* is guaranteed current file */
-       
        MEM_freeN(bfd);
 }
 
index 2ce877bd8472f8cd6812c401ef7edaf20e587ce6..f31f4cd975385dbef6fb2ef5242fa7d60c48896a 100644 (file)
@@ -1099,8 +1099,7 @@ float *make_orco_curve(Scene *scene, Object *ob)
        float *fp, *coord_array;
        int remakeDisp = 0;
 
-       if (!(cu->flag&CU_UV_ORCO) && cu->key && cu->key->refkey) {
-               cp_cu_key(cu, cu->key->refkey, 0, count_curveverts(&cu->nurb));
+       if (!(cu->flag&CU_UV_ORCO) && cu->key && cu->key->block.first) {
                makeDispListCurveTypes(scene, ob, 1);
                remakeDisp = 1;
        }
@@ -1922,7 +1921,7 @@ void makeBevelList(Object *ob)
        BevPoint *bevp, *bevp2, *bevp1 = NULL, *bevp0;
        float min, inp, x1, x2, y1, y2;
        struct bevelsort *sortdata, *sd, *sd1;
-       int a, b, nr, poly, resolu, len=0;
+       int a, b, nr, poly, resolu = 0, len = 0;
        int do_tilt, do_radius;
        
        /* this function needs an object, because of tflag and upflag */
@@ -2905,6 +2904,64 @@ void curve_applyVertexCos(Curve *cu, ListBase *lb, float (*vertexCos)[3])
        }
 }
 
+float (*curve_getKeyVertexCos(Curve *cu, ListBase *lb, float *key))[3]
+{
+       int i, numVerts;
+       float *co, (*cos)[3] = MEM_mallocN(sizeof(*cos)*numVerts, "cu_vcos");
+       Nurb *nu;
+
+       co = cos[0];
+       for (nu=lb->first; nu; nu=nu->next) {
+               if (nu->type == CU_BEZIER) {
+                       BezTriple *bezt = nu->bezt;
+
+                       for (i=0; i<nu->pntsu; i++,bezt++) {
+                               VECCOPY(co, key); co+=3; key+=3;
+                               VECCOPY(co, key); co+=3; key+=3;
+                               VECCOPY(co, key); co+=3; key+=3;
+                               key++; /* skip tilt */
+                       }
+               }
+               else {
+                       BPoint *bp = nu->bp;
+
+                       for(i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
+                               VECCOPY(co, key); co+=3; key+=3;
+                               key++; /* skip tilt */
+                       }
+               }
+       }
+
+       return cos;
+}
+
+void curve_applyKeyVertexTilts(Curve *cu, ListBase *lb, float *key)
+{
+       Nurb *nu;
+       int i;
+
+       for(nu=lb->first; nu; nu=nu->next) {
+               if(nu->type == CU_BEZIER) {
+                       BezTriple *bezt = nu->bezt;
+
+                       for(i=0; i<nu->pntsu; i++,bezt++) {
+                               key+=3*3;
+                               bezt->alfa= *key;
+                               key++;
+                       }
+               }
+               else {
+                       BPoint *bp = nu->bp;
+
+                       for(i=0; i<nu->pntsu*nu->pntsv; i++,bp++) {
+                               key+=3;
+                               bp->alfa= *key;
+                               key++;
+                       }
+               }
+       }
+}
+
 int check_valid_nurb_u( struct Nurb *nu )
 {
        if (nu==NULL)                                           return 0;
index 266a528dc57b03d3ddd0bc0fb14ae424f2d0d3e5..64af08d6f6a7adb31cc4c840354ca2471ba0b44d 100644 (file)
@@ -1245,6 +1245,7 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
        int editmode = (!forRender && cu->editnurb);
        float (*originalVerts)[3] = NULL;
        float (*deformedVerts)[3] = NULL;
+       float *keyVerts= NULL;
        int required_mode;
 
        if(forRender) required_mode = eModifierMode_Render;
@@ -1254,9 +1255,17 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
        
        if(editmode) required_mode |= eModifierMode_Editmode;
 
-       if(cu->editnurb==NULL && do_ob_key(scene, ob)) {
-               deformedVerts = curve_getVertexCos(ob->data, nurb, &numVerts);
-               originalVerts = MEM_dupallocN(deformedVerts);
+       if(cu->editnurb==NULL) {
+               keyVerts= do_ob_key(scene, ob);
+
+               if(keyVerts) {
+                       /* split coords from key data, the latter also includes
+                          tilts, which is passed through in the modifier stack.
+                          this is also the reason curves do not use a virtual
+                          shape key modifier yet. */
+                       deformedVerts= curve_getKeyVertexCos(cu, nurb, keyVerts);
+                       originalVerts= MEM_dupallocN(deformedVerts);
+               }
        }
        
        if (preTesselatePoint) {
@@ -1270,7 +1279,7 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
                        if (mti->type!=eModifierTypeType_OnlyDeform) continue;
 
                        if (!deformedVerts) {
-                               deformedVerts = curve_getVertexCos(ob->data, nurb, &numVerts);
+                               deformedVerts = curve_getVertexCos(cu, nurb, &numVerts);
                                originalVerts = MEM_dupallocN(deformedVerts);
                        }
                        
@@ -1281,9 +1290,13 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, int forRender, fl
                }
        }
 
-       if (deformedVerts) {
-               curve_applyVertexCos(ob->data, nurb, deformedVerts);
-       }
+       if (deformedVerts)
+               curve_applyVertexCos(cu, nurb, deformedVerts);
+       if (keyVerts) /* these are not passed through modifier stack */
+               curve_applyKeyVertexTilts(cu, nurb, keyVerts);
+       
+       if(keyVerts)
+               MEM_freeN(keyVerts);
 
        *originalVerts_r = originalVerts;
        *deformedVerts_r = deformedVerts;
index 3fffdef478bf81464d03a2ff1b9164e10f83ca3a..61f51d61e0b08f025ff745817c9712513de27113 100644 (file)
@@ -36,6 +36,7 @@
 #include "MEM_guardedalloc.h"
 
 #include "BLI_blenlib.h"
+#include "BLI_editVert.h"
 
 #include "DNA_anim_types.h"
 #include "DNA_curve_types.h"
@@ -168,7 +169,7 @@ Key *copy_key(Key *key)
        while(kbn) {
                
                if(kbn->data) kbn->data= MEM_dupallocN(kbn->data);
-               if( kb==key->refkey ) keyn->refkey= kbn;
+               if(kb==key->refkey) keyn->refkey= kbn;
                
                kbn= kbn->next;
                kb= kb->next;
@@ -497,48 +498,77 @@ static void rel_flerp(int aantal, float *in, float *ref, float *out, float fac)
        }
 }
 
-static void cp_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *k, float *weights, int mode)
+static char *key_block_get_data(Key *key, KeyBlock *actkb, KeyBlock *kb, char **freedata)
+{
+       if(kb == actkb) {
+               /* this hack makes it possible to edit shape keys in
+                  edit mode with shape keys blending applied */
+               if(GS(key->from->name) == ID_ME) {
+                       Mesh *me;
+                       EditVert *eve;
+                       float (*co)[3];
+                       int a;
+
+                       me= (Mesh*)key->from;
+
+                       if(me->edit_mesh && me->edit_mesh->totvert == kb->totelem) {
+                               a= 0;
+                               co= MEM_callocN(sizeof(float)*3*me->edit_mesh->totvert, "key_block_get_data");
+
+                               for(eve=me->edit_mesh->verts.first; eve; eve=eve->next, a++)
+                                       VECCOPY(co[a], eve->co);
+
+                               *freedata= (char*)co;
+                               return (char*)co;
+                       }
+               }
+       }
+
+       *freedata= NULL;
+       return kb->data;
+}
+
+static void cp_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *actkb, KeyBlock *kb, float *weights, int mode)
 {
        float ktot = 0.0, kd = 0.0;
        int elemsize, poinsize = 0, a, *ofsp, ofs[32], flagflo=0;
-       char *k1, *kref;
+       char *k1, *kref, *freek1, *freekref;
        char *cp, elemstr[8];
 
        if(key->from==NULL) return;
 
        if( GS(key->from->name)==ID_ME ) {
-               ofs[0]= sizeof(MVert);
+               ofs[0]= sizeof(float)*3;
                ofs[1]= 0;
                poinsize= ofs[0];
        }
        else if( GS(key->from->name)==ID_LT ) {
-               ofs[0]= sizeof(BPoint);
+               ofs[0]= sizeof(float)*3;
                ofs[1]= 0;
                poinsize= ofs[0];
        }
        else if( GS(key->from->name)==ID_CU ) {
-               if(mode==KEY_BPOINT) ofs[0]= sizeof(BPoint);
-               else ofs[0]= sizeof(BezTriple);
+               if(mode==KEY_BPOINT) ofs[0]= sizeof(float)*4;
+               else ofs[0]= sizeof(float)*10;
                
                ofs[1]= 0;
                poinsize= ofs[0];
        }
 
-
        if(end>tot) end= tot;
        
-       k1= k->data;
-       kref= key->refkey->data;
-       
-       if(tot != k->totelem) {
+       if(tot != kb->totelem) {
                ktot= 0.0;
                flagflo= 1;
-               if(k->totelem) {
-                       kd= k->totelem/(float)tot;
+               if(kb->totelem) {
+                       kd= kb->totelem/(float)tot;
                }
                else return;
        }
 
+       k1= key_block_get_data(key, actkb, kb, &freek1);
+       kref= key_block_get_data(key, actkb, key->refkey, &freekref);
+
        /* this exception is needed for slurphing */
        if(start!=0) {
                
@@ -575,33 +605,24 @@ static void cp_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *
                        
                        switch(cp[1]) {
                        case IPO_FLOAT:
-                               
                                if(weights) {
-                                       memcpy(poin, kref, sizeof(float)*cp[0]);
+                                       memcpy(poin, kref, sizeof(float)*3);
                                        if(*weights!=0.0f)
                                                rel_flerp(cp[0], (float *)poin, (float *)kref, (float *)k1, *weights);
                                        weights++;
                                }
                                else 
-                                       memcpy(poin, k1, sizeof(float)*cp[0]);
-
-                               poin+= ofsp[0];
-
+                                       memcpy(poin, k1, sizeof(float)*3);
                                break;
                        case IPO_BPOINT:
-                               memcpy(poin, k1, 3*sizeof(float));
-                               memcpy(poin+4*sizeof(float), k1+3*sizeof(float), sizeof(float));
-                               
-                               poin+= ofsp[0];                         
-
+                               memcpy(poin, k1, sizeof(float)*4);
                                break;
                        case IPO_BEZTRIPLE:
                                memcpy(poin, k1, sizeof(float)*10);
-                               poin+= ofsp[0]; 
-
                                break;
                        }
                        
+                       poin+= ofsp[0]; 
                        cp+= 2; ofsp++;
                }
                
@@ -621,71 +642,63 @@ static void cp_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *
                
                if(mode==KEY_BEZTRIPLE) a+=2;
        }
+
+       if(freek1) MEM_freeN(freek1);
+       if(freekref) MEM_freeN(freekref);
 }
 
-void cp_cu_key(Curve *cu, KeyBlock *kb, int start, int end)
+static void cp_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock *kb, int start, int end, char *out, int tot)
 {
        Nurb *nu;
-       int a, step = 0, tot, a1, a2;
        char *poin;
+       int a, step, a1, a2;
 
-       tot= count_curveverts(&cu->nurb);
-       nu= cu->nurb.first;
-       a= 0;
-       while(nu) {
+       for(a=0, nu=cu->nurb.first; nu; nu=nu->next, a+=step) {
                if(nu->bp) {
-                       
                        step= nu->pntsu*nu->pntsv;
                        
                        /* exception because keys prefer to work with complete blocks */
-                       poin= (char *)nu->bp->vec;
-                       poin -= a*sizeof(BPoint);
-                       
+                       poin= out - a*sizeof(float)*4;
                        a1= MAX2(a, start);
                        a2= MIN2(a+step, end);
                        
-                       if(a1<a2) cp_key(a1, a2, tot, poin, cu->key, kb, NULL, KEY_BPOINT);
+                       if(a1<a2) cp_key(a1, a2, tot, poin, key, actkb, kb, NULL, KEY_BPOINT);
                }
                else if(nu->bezt) {
-                       
                        step= 3*nu->pntsu;
                        
-                       poin= (char *)nu->bezt->vec;
-                       poin -= a*sizeof(BezTriple);
-
+                       poin= out - a*sizeof(float)*10;
                        a1= MAX2(a, start);
                        a2= MIN2(a+step, end);
 
-                       if(a1<a2) cp_key(a1, a2, tot, poin, cu->key, kb, NULL, KEY_BEZTRIPLE);
-                       
+                       if(a1<a2) cp_key(a1, a2, tot, poin, key, actkb, kb, NULL, KEY_BEZTRIPLE);
                }
-               a+= step;
-               nu=nu->next;
+               else
+                       step= 0;
        }
 }
 
 
-void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, int mode)
+void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, KeyBlock *actkb, int mode)
 {
        KeyBlock *kb;
        int *ofsp, ofs[3], elemsize, b;
        char *cp, *poin, *reffrom, *from, elemstr[8];
+       char *freefrom, *freereffrom;
        
        if(key->from==NULL) return;
        
-       if (G.f & G_DEBUG) printf("do_rel_key() \n");
-       
        if( GS(key->from->name)==ID_ME ) {
-               ofs[0]= sizeof(MVert);
+               ofs[0]= sizeof(float)*3;
                ofs[1]= 0;
        }
        else if( GS(key->from->name)==ID_LT ) {
-               ofs[0]= sizeof(BPoint);
+               ofs[0]= sizeof(float)*3;
                ofs[1]= 0;
        }
        else if( GS(key->from->name)==ID_CU ) {
-               if(mode==KEY_BPOINT) ofs[0]= sizeof(BPoint);
-               else ofs[0]= sizeof(BezTriple);
+               if(mode==KEY_BPOINT) ofs[0]= sizeof(float)*4;
+               else ofs[0]= sizeof(float)*10;
                
                ofs[1]= 0;
        }
@@ -702,7 +715,7 @@ void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, int mode
        if(mode==KEY_BEZTRIPLE) elemsize*= 3;
 
        /* step 1 init */
-       cp_key(start, end, tot, basispoin, key, key->refkey, NULL, mode);
+       cp_key(start, end, tot, basispoin, key, actkb, key->refkey, NULL, mode);
        
        /* step 2: do it */
        
@@ -710,21 +723,18 @@ void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, int mode
                if(kb!=key->refkey) {
                        float icuval= kb->curval;
                        
-                       if (G.f & G_DEBUG) printf("\tdo rel key %s : %s = %f \n", key->id.name+2, kb->name, icuval);
-                       
                        /* only with value, and no difference allowed */
                        if(!(kb->flag & KEYBLOCK_MUTE) && icuval!=0.0f && kb->totelem==tot) {
                                KeyBlock *refb;
                                float weight, *weights= kb->weights;
-                               
-                               if (G.f & G_DEBUG) printf("\t\tnot skipped \n");
-                               
-                               poin= basispoin;
-                               from= kb->data;
+
                                /* reference now can be any block */
                                refb= BLI_findlink(&key->block, kb->relative);
                                if(refb==NULL) continue;
-                               reffrom= refb->data;
+                               
+                               poin= basispoin;
+                               from= key_block_get_data(key, actkb, kb, &freefrom);
+                               reffrom= key_block_get_data(key, actkb, refb, &freereffrom);
                                
                                poin+= start*ofs[0];
                                reffrom+= key->elemsize*start;  // key elemsize yes!
@@ -746,17 +756,13 @@ void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, int mode
                                                
                                                switch(cp[1]) {
                                                case IPO_FLOAT:
-                                                       rel_flerp(cp[0], (float *)poin, (float *)reffrom, (float *)from, weight);
-                                                       
+                                                       rel_flerp(3, (float *)poin, (float *)reffrom, (float *)from, weight);
                                                        break;
                                                case IPO_BPOINT:
-                                                       rel_flerp(3, (float *)poin, (float *)reffrom, (float *)from, icuval);
-                                                       rel_flerp(1, (float *)(poin+16), (float *)(reffrom+16), (float *)(from+16), icuval);
-                       
+                                                       rel_flerp(4, (float *)poin, (float *)reffrom, (float *)from, weight);
                                                        break;
                                                case IPO_BEZTRIPLE:
-                                                       rel_flerp(9, (float *)poin, (float *)reffrom, (float *)from, icuval);
-                       
+                                                       rel_flerp(10, (float *)poin, (float *)reffrom, (float *)from, weight);
                                                        break;
                                                }
                                                
@@ -772,38 +778,39 @@ void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, int mode
                                        if(mode==KEY_BEZTRIPLE) b+= 2;
                                        if(weights) weights++;
                                }
+
+                               if(freefrom) MEM_freeN(freefrom);
+                               if(freereffrom) MEM_freeN(freereffrom);
                        }
                }
        }
 }
 
 
-static void do_key(int start, int end, int tot, char *poin, Key *key, KeyBlock **k, float *t, int mode)
+static void do_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *actkb, KeyBlock **k, float *t, int mode)
 {
        float k1tot = 0.0, k2tot = 0.0, k3tot = 0.0, k4tot = 0.0;
        float k1d = 0.0, k2d = 0.0, k3d = 0.0, k4d = 0.0;
        int a, ofs[32], *ofsp;
        int flagdo= 15, flagflo=0, elemsize, poinsize=0;
-       char *k1, *k2, *k3, *k4;
+       char *k1, *k2, *k3, *k4, *freek1, *freek2, *freek3, *freek4;
        char *cp, elemstr[8];;
 
        if(key->from==0) return;
 
-       if (G.f & G_DEBUG) printf("do_key() \n");
-       
        if( GS(key->from->name)==ID_ME ) {
-               ofs[0]= sizeof(MVert);
+               ofs[0]= sizeof(float)*3;
                ofs[1]= 0;
                poinsize= ofs[0];
        }
        else if( GS(key->from->name)==ID_LT ) {
-               ofs[0]= sizeof(BPoint);
+               ofs[0]= sizeof(float)*3;
                ofs[1]= 0;
                poinsize= ofs[0];
        }
        else if( GS(key->from->name)==ID_CU ) {
-               if(mode==KEY_BPOINT) ofs[0]= sizeof(BPoint);
-               else ofs[0]= sizeof(BezTriple);
+               if(mode==KEY_BPOINT) ofs[0]= sizeof(float)*4;
+               else ofs[0]= sizeof(float)*10;
                
                ofs[1]= 0;
                poinsize= ofs[0];
@@ -811,10 +818,10 @@ static void do_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *
        
        if(end>tot) end= tot;
 
-       k1= k[0]->data;
-       k2= k[1]->data;
-       k3= k[2]->data;
-       k4= k[3]->data;
+       k1= key_block_get_data(key, actkb, k[0], &freek1);
+       k2= key_block_get_data(key, actkb, k[1], &freek2);
+       k3= key_block_get_data(key, actkb, k[2], &freek3);
+       k4= key_block_get_data(key, actkb, k[3], &freek4);
 
        /*  test for more or less points (per key!) */
        if(tot != k[0]->totelem) {
@@ -922,26 +929,17 @@ static void do_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *
                        
                        switch(cp[1]) {
                        case IPO_FLOAT:
-                               flerp(cp[0], (float *)poin, (float *)k1, (float *)k2, (float *)k3, (float *)k4, t);
-                               poin+= ofsp[0];                         
-
+                               flerp(3, (float *)poin, (float *)k1, (float *)k2, (float *)k3, (float *)k4, t);
                                break;
                        case IPO_BPOINT:
-                               flerp(3, (float *)poin, (float *)k1, (float *)k2, (float *)k3, (float *)k4, t);
-                               flerp(1, (float *)(poin+16), (float *)(k1+12), (float *)(k2+12), (float *)(k3+12), (float *)(k4+12), t);
-                               
-                               poin+= ofsp[0];                         
-
+                               flerp(4, (float *)poin, (float *)k1, (float *)k2, (float *)k3, (float *)k4, t);
                                break;
                        case IPO_BEZTRIPLE:
-                               flerp(9, (void *)poin, (void *)k1, (void *)k2, (void *)k3, (void *)k4, t);
-                               flerp(1, (float *)(poin+36), (float *)(k1+36), (float *)(k2+36), (float *)(k3+36), (float *)(k4+36), t);
-                               poin+= ofsp[0];                         
-
+                               flerp(10, (void *)poin, (void *)k1, (void *)k2, (void *)k3, (void *)k4, t);
                                break;
                        }
                        
-
+                       poin+= ofsp[0];                         
                        cp+= 2;
                        ofsp++;
                }
@@ -989,6 +987,11 @@ static void do_key(int start, int end, int tot, char *poin, Key *key, KeyBlock *
                
                if(mode==KEY_BEZTRIPLE) a+= 2;
        }
+
+       if(freek1) MEM_freeN(freek1);
+       if(freek2) MEM_freeN(freek2);
+       if(freek3) MEM_freeN(freek3);
+       if(freek4) MEM_freeN(freek4);
 }
 
 static float *get_weights_array(Object *ob, char *vgroup)
@@ -1038,41 +1041,30 @@ static float *get_weights_array(Object *ob, char *vgroup)
        return NULL;
 }
 
-static int do_mesh_key(Scene *scene, Object *ob, Mesh *me)
+static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, int tot)
 {
-       KeyBlock *k[4];
-       float cfra, ctime, t[4], delta, loc[3], size[3];
+       KeyBlock *k[4], *actkb= ob_get_keyblock(ob);
+       float cfra, ctime, t[4], delta;
        int a, flag = 0, step;
        
-       if(me->totvert==0) return 0;
-       if(me->key==NULL) return 0;
-       if(me->key->block.first==NULL) return 0;
-       
-       /* prevent python from screwing this up? anyhoo, the from pointer could be dropped */
-       me->key->from= (ID *)me;
-       
-       if (G.f & G_DEBUG) printf("do mesh key ob:%s me:%s ke:%s \n", ob->id.name+2, me->id.name+2, me->key->id.name+2);
-       
-       if(me->key->slurph && me->key->type!=KEY_RELATIVE ) {
-               if (G.f & G_DEBUG) printf("\tslurph key\n");
-               
-               delta= me->key->slurph;
-               delta/= me->totvert;
+       if(key->slurph && key->type!=KEY_RELATIVE ) {
+               delta= key->slurph;
+               delta/= tot;
                
                step= 1;
-               if(me->totvert>100 && slurph_opt) {
-                       step= me->totvert/50;
+               if(tot>100 && slurph_opt) {
+                       step= tot/50;
                        delta*= step;
                        /* in do_key and cp_key the case a>tot is handled */
                }
                
                cfra= (float)scene->r.cfra;
                
-               for(a=0; a<me->totvert; a+=step, cfra+= delta) {
+               for(a=0; a<tot; a+=step, cfra+= delta) {
                        
                        ctime= bsystem_time(scene, 0, cfra, 0.0); // xxx  ugly cruft!
 #if 0 // XXX old animation system
-                       if(calc_ipo_spec(me->key->ipo, KEY_SPEED, &ctime)==0) {
+                       if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
                                ctime /= 100.0;
                                CLAMP(ctime, 0.0, 1.0);
                        }
@@ -1081,42 +1073,33 @@ static int do_mesh_key(Scene *scene, Object *ob, Mesh *me)
                        ctime /= 100.0f;
                        CLAMP(ctime, 0.0f, 1.0f); // XXX for compat, we use this, but this clamping was confusing
                
-                       flag= setkeys(ctime, &me->key->block, k, t, 0);
-                       if(flag==0) {
-                               
-                               do_key(a, a+step, me->totvert, (char *)me->mvert->co, me->key, k, t, 0);
-                       }
-                       else {
-                               cp_key(a, a+step, me->totvert, (char *)me->mvert->co, me->key, k[2], NULL, 0);
-                       }
+                       flag= setkeys(ctime, &key->block, k, t, 0);
+
+                       if(flag==0)
+                               do_key(a, a+step, tot, (char *)out, key, actkb, k, t, 0);
+                       else
+                               cp_key(a, a+step, tot, (char *)out, key, actkb, k[2], NULL, 0);
                }
-               
-               if(flag && k[2]==me->key->refkey) tex_space_mesh(me);
-               else boundbox_mesh(me, loc, size);
        }
        else {
-               if(me->key->type==KEY_RELATIVE) {
+               if(key->type==KEY_RELATIVE) {
                        KeyBlock *kb;
                        
-                       if (G.f & G_DEBUG) printf("\tdo relative \n");
-                       
-                       for(kb= me->key->block.first; kb; kb= kb->next)
+                       for(kb= key->block.first; kb; kb= kb->next)
                                kb->weights= get_weights_array(ob, kb->vgroup);
 
-                       do_rel_key(0, me->totvert, me->totvert, (char *)me->mvert->co, me->key, 0);
+                       do_rel_key(0, tot, tot, (char *)out, key, actkb, 0);
                        
-                       for(kb= me->key->block.first; kb; kb= kb->next) {
+                       for(kb= key->block.first; kb; kb= kb->next) {
                                if(kb->weights) MEM_freeN(kb->weights);
                                kb->weights= NULL;
                        }
                }
                else {
-                       if (G.f & G_DEBUG) printf("\tdo absolute \n");
-                       
                        ctime= bsystem_time(scene, ob, (float)scene->r.cfra, 0.0f); // xxx old cruft
                        
 #if 0 // XXX old animation system
-                       if(calc_ipo_spec(me->key->ipo, KEY_SPEED, &ctime)==0) {
+                       if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
                                ctime /= 100.0;
                                CLAMP(ctime, 0.0, 1.0);
                        }
@@ -1125,106 +1108,69 @@ static int do_mesh_key(Scene *scene, Object *ob, Mesh *me)
                        ctime /= 100.0f;
                        CLAMP(ctime, 0.0f, 1.0f); // XXX for compat, we use this, but this clamping was confusing
                        
-                       flag= setkeys(ctime, &me->key->block, k, t, 0);
-                       if(flag==0) {
-                               do_key(0, me->totvert, me->totvert, (char *)me->mvert->co, me->key, k, t, 0);
-                       }
-                       else {
-                               cp_key(0, me->totvert, me->totvert, (char *)me->mvert->co, me->key, k[2], NULL, 0);
-                       }
-                       
-                       if(flag && k[2]==me->key->refkey) tex_space_mesh(me);
-                       else boundbox_mesh(me, loc, size);
+                       flag= setkeys(ctime, &key->block, k, t, 0);
+
+                       if(flag==0)
+                               do_key(0, tot, tot, (char *)out, key, actkb, k, t, 0);
+                       else
+                               cp_key(0, tot, tot, (char *)out, key, actkb, k[2], NULL, 0);
                }
        }
-       return 1;
 }
 
-static void do_cu_key(Curve *cu, KeyBlock **k, float *t)
+static void do_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock **k, float *t, char *out, int tot)
 {
        Nurb *nu;
-       int a, step = 0, tot;
        char *poin;
+       int a, step;
        
-       tot= count_curveverts(&cu->nurb);
-       nu= cu->nurb.first;
-       a= 0;
-       
-       while(nu) {
+       for(a=0, nu=cu->nurb.first; nu; nu=nu->next, a+=step) {
                if(nu->bp) {
-                       
                        step= nu->pntsu*nu->pntsv;
-                       
-                       /* exception because keys prefer to work with complete blocks */
-                       poin= (char *)nu->bp->vec;
-                       poin -= a*sizeof(BPoint);
-                       
-                       do_key(a, a+step, tot, poin, cu->key, k, t, KEY_BPOINT);
+                       poin= out - a*sizeof(float)*4;
+                       do_key(a, a+step, tot, poin, key, actkb, k, t, KEY_BPOINT);
                }
                else if(nu->bezt) {
-                       
                        step= 3*nu->pntsu;
-                       
-                       poin= (char *)nu->bezt->vec;
-                       poin -= a*sizeof(BezTriple);
-
-                       do_key(a, a+step, tot, poin, cu->key, k, t, KEY_BEZTRIPLE);
-                       
+                       poin= out - a*sizeof(float)*10;
+                       do_key(a, a+step, tot, poin, key, actkb, k, t, KEY_BEZTRIPLE);
                }
-               a+= step;
-               nu=nu->next;
+               else
+                       step= 0;
        }
 }
 
-static void do_rel_cu_key(Curve *cu, float ctime)
+static void do_rel_cu_key(Curve *cu, Key *key, KeyBlock *actkb, float ctime, char *out, int tot)
 {
        Nurb *nu;
-       int a, step = 0, tot;
        char *poin;
+       int a, step;
        
-       tot= count_curveverts(&cu->nurb);
-       nu= cu->nurb.first;
-       a= 0;
-       while(nu) {
+       for(a=0, nu=cu->nurb.first; nu; nu=nu->next, a+=step) {
                if(nu->bp) {
-                       
                        step= nu->pntsu*nu->pntsv;
-                       
-                       /* exception because keys prefer to work with complete blocks */
-                       poin= (char *)nu->bp->vec;
-                       poin -= a*sizeof(BPoint);
-                       
-                       do_rel_key(a, a+step, tot, poin, cu->key, KEY_BPOINT);
+                       poin= out - a*sizeof(float)*3;
+                       do_rel_key(a, a+step, tot, out, key, actkb, KEY_BPOINT);
                }
                else if(nu->bezt) {
-                       
                        step= 3*nu->pntsu;
-                       
-                       poin= (char *)nu->bezt->vec;
-                       poin -= a*sizeof(BezTriple);
-
-                       do_rel_key(a, a+step, tot, poin, cu->key, KEY_BEZTRIPLE);
+                       poin= out - a*sizeof(float)*10;
+                       do_rel_key(a, a+step, tot, poin, key, actkb, KEY_BEZTRIPLE);
                }
-               a+= step;
-               
-               nu=nu->next;
+               else
+                       step= 0;
        }
 }
 
-static int do_curve_key(Scene *scene, Curve *cu)
+static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, int tot)
 {
-       KeyBlock *k[4];
+       Curve *cu= ob->data;
+       KeyBlock *k[4], *actkb= ob_get_keyblock(ob);
        float cfra, ctime, t[4], delta;
-       int a, flag = 0, step = 0, tot;
+       int a, flag = 0, step = 0;
        
-       tot= count_curveverts(&cu->nurb);
-       
-       if(tot==0) return 0;
-       if(cu->key==NULL) return 0;
-       if(cu->key->block.first==NULL) return 0;
-       
-       if(cu->key->slurph) {
-               delta= cu->key->slurph;
+       if(key->slurph) {
+               delta= key->slurph;
                delta/= tot;
                
                step= 1;
@@ -1239,66 +1185,52 @@ static int do_curve_key(Scene *scene, Curve *cu)
                for(a=0; a<tot; a+=step, cfra+= delta) {
                        ctime= bsystem_time(scene, 0, cfra, 0.0f); // XXX old cruft
 #if 0 // XXX old animation system
-                       if(calc_ipo_spec(cu->key->ipo, KEY_SPEED, &ctime)==0) {
+                       if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
                                ctime /= 100.0;
                                CLAMP(ctime, 0.0, 1.0);
                        }
 #endif // XXX old animation system
                
-                       flag= setkeys(ctime, &cu->key->block, k, t, 0);
-                       if(flag==0) {
-                               
-                               /* do_key(a, a+step, tot, (char *)cu->mvert->co, cu->key, k, t, 0); */
-                       }
-                       else {
-                               /* cp_key(a, a+step, tot, (char *)cu->mvert->co, cu->key, k[2],0); */
-                       }
-               }
+                       flag= setkeys(ctime, &key->block, k, t, 0);
 
-               if(flag && k[2]==cu->key->refkey) tex_space_curve(cu);
-               
-               
+                       if(flag==0)
+                               ; /* do_key(a, a+step, tot, (char *)out, key, k, t, 0); */
+                       else
+                               ; /* cp_key(a, a+step, tot, (char *)out, key, k[2],0); */
+               }
        }
        else {
                
                ctime= bsystem_time(scene, NULL, (float)scene->r.cfra, 0.0);
                
-               if(cu->key->type==KEY_RELATIVE) {
-                       do_rel_cu_key(cu, ctime);
+               if(key->type==KEY_RELATIVE) {
+                       do_rel_cu_key(cu, cu->key, actkb, ctime, out, tot);
                }
                else {
 #if 0 // XXX old animation system
-                       if(calc_ipo_spec(cu->key->ipo, KEY_SPEED, &ctime)==0) {
+                       if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
                                ctime /= 100.0;
                                CLAMP(ctime, 0.0, 1.0);
                        }
 #endif // XXX old animation system
                        
-                       flag= setkeys(ctime, &cu->key->block, k, t, 0);
+                       flag= setkeys(ctime, &key->block, k, t, 0);
                        
-                       if(flag==0) do_cu_key(cu, k, t);
-                       else cp_cu_key(cu, k[2], 0, tot);
-                                       
-                       if(flag && k[2]==cu->key->refkey) tex_space_curve(cu);
+                       if(flag==0) do_cu_key(cu, key, actkb, k, t, out, tot);
+                       else cp_cu_key(cu, key, actkb, k[2], 0, tot, out, tot);
                }
        }
-       
-       return 1;
 }
 
-static int do_latt_key(Scene *scene, Object *ob, Lattice *lt)
+static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, int tot)
 {
-       KeyBlock *k[4];
+       Lattice *lt= ob->data;
+       KeyBlock *k[4], *actkb= ob_get_keyblock(ob);
        float delta, cfra, ctime, t[4];
-       int a, tot, flag;
+       int a, flag;
        
-       if(lt->key==NULL) return 0;
-       if(lt->key->block.first==NULL) return 0;
-
-       tot= lt->pntsu*lt->pntsv*lt->pntsw;
-
-       if(lt->key->slurph) {
-               delta= lt->key->slurph;
+       if(key->slurph) {
+               delta= key->slurph;
                delta/= (float)tot;
                
                cfra= (float)scene->r.cfra;
@@ -1307,74 +1239,110 @@ static int do_latt_key(Scene *scene, Object *ob, Lattice *lt)
                        
                        ctime= bsystem_time(scene, 0, cfra, 0.0); // XXX old cruft
 #if 0 // XXX old animation system
-                       if(calc_ipo_spec(lt->key->ipo, KEY_SPEED, &ctime)==0) {
+                       if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
                                ctime /= 100.0;
                                CLAMP(ctime, 0.0, 1.0);
                        }
 #endif // XXX old animation system
                
-                       flag= setkeys(ctime, &lt->key->block, k, t, 0);
-                       if(flag==0) {
-                               
-                               do_key(a, a+1, tot, (char *)lt->def->vec, lt->key, k, t, 0);
-                       }
-                       else {
-                               cp_key(a, a+1, tot, (char *)lt->def->vec, lt->key, k[2], NULL, 0);
-                       }
+                       flag= setkeys(ctime, &key->block, k, t, 0);
+
+                       if(flag==0)
+                               do_key(a, a+1, tot, (char *)out, key, actkb, k, t, 0);
+                       else
+                               cp_key(a, a+1, tot, (char *)out, key, actkb, k[2], NULL, 0);
                }               
        }
        else {
-               ctime= bsystem_time(scene, NULL, (float)scene->r.cfra, 0.0);
-       
-               if(lt->key->type==KEY_RELATIVE) {
+               if(key->type==KEY_RELATIVE) {
                        KeyBlock *kb;
                        
-                       for(kb= lt->key->block.first; kb; kb= kb->next)
+                       for(kb= key->block.first; kb; kb= kb->next)
                                kb->weights= get_weights_array(ob, kb->vgroup);
                        
-                       do_rel_key(0, tot, tot, (char *)lt->def->vec, lt->key, 0);
+                       do_rel_key(0, tot, tot, (char *)out, key, actkb, 0);
                        
-                       for(kb= lt->key->block.first; kb; kb= kb->next) {
+                       for(kb= key->block.first; kb; kb= kb->next) {
                                if(kb->weights) MEM_freeN(kb->weights);
                                kb->weights= NULL;
                        }
                }
                else {
+                       ctime= bsystem_time(scene, NULL, (float)scene->r.cfra, 0.0);
+
 #if 0 // XXX old animation system
-                       if(calc_ipo_spec(lt->key->ipo, KEY_SPEED, &ctime)==0) {
+                       if(calc_ipo_spec(key->ipo, KEY_SPEED, &ctime)==0) {
                                ctime /= 100.0;
                                CLAMP(ctime, 0.0, 1.0);
                        }
 #endif // XXX old animation system
                        
-                       flag= setkeys(ctime, &lt->key->block, k, t, 0);
-                       if(flag==0) {
-                               do_key(0, tot, tot, (char *)lt->def->vec, lt->key, k, t, 0);
-                       }
-                       else {
-                               cp_key(0, tot, tot, (char *)lt->def->vec, lt->key, k[2], NULL, 0);
-                       }
+                       flag= setkeys(ctime, &key->block, k, t, 0);
+
+                       if(flag==0)
+                               do_key(0, tot, tot, (char *)out, key, actkb, k, t, 0);
+                       else
+                               cp_key(0, tot, tot, (char *)out, key, actkb, k[2], NULL, 0);
                }
        }
        
        if(lt->flag & LT_OUTSIDE) outside_lattice(lt);
-       
-       return 1;
 }
 
-/* returns 1 when key applied */
-int do_ob_key(Scene *scene, Object *ob)
+/* returns key coordinates (+ tilt) when key applied, NULL otherwise */
+float *do_ob_key(Scene *scene, Object *ob)
 {
        Key *key= ob_get_key(ob);
+       KeyBlock *actkb= ob_get_keyblock(ob);
+       char *out;
+       int tot= 0, size= 0;
        
-       if(key==NULL)
-               return 0;
+       if(key==NULL || key->block.first==NULL)
+               return NULL;
+
+       /* compute size of output array */
+       if(ob->type == OB_MESH) {
+               Mesh *me= ob->data;
+
+               tot= me->totvert;
+               size= tot*3*sizeof(float);
+       }
+       else if(ob->type == OB_LATTICE) {
+               Lattice *lt= ob->data;
+
+               tot= lt->pntsu*lt->pntsv*lt->pntsw;
+               size= tot*3*sizeof(float);
+       }
+       else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
+               Curve *cu= ob->data;
+               Nurb *nu;
+
+               for(nu=cu->nurb.first; nu; nu=nu->next) {
+                       if(nu->bezt) {
+                               tot += 3*nu->pntsu;
+                               size += nu->pntsu*10*sizeof(float);
+                       }
+                       else if(nu->bp) {
+                               tot += nu->pntsu*nu->pntsv;
+                               size += nu->pntsu*nu->pntsv*10*sizeof(float);
+                       }
+               }
+       }
+
+       /* if nothing to interpolate, cancel */
+       if(tot == 0 || size == 0)
+               return NULL;
+       
+       /* allocate array */
+       out= MEM_callocN(size, "do_ob_key out");
+
+       /* prevent python from screwing this up? anyhoo, the from pointer could be dropped */
+       key->from= (ID *)ob->data;
                
        if(ob->shapeflag & OB_SHAPE_LOCK) {
+               /* shape locked, copy the locked shape instead of blending */
                KeyBlock *kb= BLI_findlink(&key->block, ob->shapenr-1);
                
-               if (G.f & G_DEBUG) printf("ob %s, key %s locked \n", ob->id.name+2, key->id.name+2);
-               
                if(kb && (kb->flag & KEYBLOCK_MUTE))
                        kb= key->refkey;
 
@@ -1383,46 +1351,29 @@ int do_ob_key(Scene *scene, Object *ob)
                        ob->shapenr= 1;
                }
                
-               if(ob->type==OB_MESH) {
-                       Mesh *me= ob->data;
+               if(ELEM(ob->type, OB_MESH, OB_LATTICE)) {
                        float *weights= get_weights_array(ob, kb->vgroup);
 
-                       cp_key(0, me->totvert, me->totvert, (char *)me->mvert->co, key, kb, weights, 0);
-                       
-                       if(weights) MEM_freeN(weights);
-               }
-               else if(ob->type==OB_LATTICE) {
-                       Lattice *lt= ob->data;
-                       float *weights= get_weights_array(ob, kb->vgroup);
-                       int tot= lt->pntsu*lt->pntsv*lt->pntsw;
-                       
-                       cp_key(0, tot, tot, (char *)lt->def->vec, key, kb, weights, 0);
-                       
+                       cp_key(0, tot, tot, (char*)out, key, actkb, kb, weights, 0);
+
                        if(weights) MEM_freeN(weights);
                }
-               else if ELEM(ob->type, OB_CURVE, OB_SURF) {
-                       Curve *cu= ob->data;
-                       int tot= count_curveverts(&cu->nurb);
-                       
-                       cp_cu_key(cu, kb, 0, tot);
-               }
-               return 1;
+               else if(ELEM(ob->type, OB_CURVE, OB_SURF))
+                       cp_cu_key(ob->data, key, actkb, kb, 0, tot, out, tot);
        }
        else {
                /* do shapekey local drivers */
                float ctime= (float)scene->r.cfra; // XXX this needs to be checked
                
-               if (G.f & G_DEBUG) 
-                       printf("ob %s - do shapekey (%s) drivers \n", ob->id.name+2, key->id.name+2);
                BKE_animsys_evaluate_animdata(&key->id, key->adt, ctime, ADT_RECALC_DRIVERS);
                
-               if(ob->type==OB_MESH) return do_mesh_key(scene, ob, ob->data);
-               else if(ob->type==OB_CURVE) return do_curve_key(scene, ob->data);
-               else if(ob->type==OB_SURF) return do_curve_key(scene, ob->data);
-               else if(ob->type==OB_LATTICE) return do_latt_key(scene, ob, ob->data);
+               if(ob->type==OB_MESH) do_mesh_key(scene, ob, key, out, tot);
+               else if(ob->type==OB_LATTICE) do_latt_key(scene, ob, key, out, tot);
+               else if(ob->type==OB_CURVE) do_curve_key(scene, ob, key, out, tot);
+               else if(ob->type==OB_SURF) do_curve_key(scene, ob, key, out, tot);
        }
        
-       return 0;
+       return (float*)out;
 }
 
 Key *ob_get_key(Object *ob)
@@ -1505,7 +1456,7 @@ char *key_get_curValue_rnaPath(Key *key, KeyBlock *kb)
                return NULL;
        
        /* create the RNA pointer */
-       RNA_pointer_create(key, &RNA_ShapeKey, kb, &ptr);
+       RNA_pointer_create(&key->id, &RNA_ShapeKey, kb, &ptr);
        /* get pointer to the property too */
        prop= RNA_struct_find_property(&ptr, "value");
        
index a957be4704c20888dfdd61e037775f0352fe47ac..c53101299c6babda41cacdd2461ef6ef0c187f89 100644 (file)
@@ -995,10 +995,6 @@ void lattice_calc_modifiers(Scene *scene, Object *ob)
 
        freedisplist(&ob->disp);
 
-       if (!editmode) {
-               do_ob_key(scene, ob);
-       }
-
        for (; md; md=md->next) {
                ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 
index c1093c119dc1e72e2bb6605cb3f7a53043522d5c..c2260e1e76144242272a09127dc4ebedf1a045e4 100644 (file)
@@ -485,6 +485,18 @@ ID *material_from(Object *ob, int act)
        else return ob->data;
 }
 
+Material *give_node_material(Material *ma)
+{
+       if(ma && ma->use_nodes && ma->nodetree) {
+               bNode *node= nodeGetActiveID(ma->nodetree, ID_MA);
+
+               if(node)
+                       return (Material *)node->id;
+       }
+
+       return NULL;
+}
+
 /* GS reads the memory pointed at in a specific ordering. There are,
  * however two definitions for it. I have jotted them down here, both,
  * but I think the first one is actually used. The thing is that
@@ -982,7 +994,7 @@ int object_remove_material_slot(Object *ob)
 /* if g==NULL, it only does r channel */
 void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col)
 {
-       float tmp, facm= 1.0-fac;
+       float tmp, facm= 1.0f-fac;
        
        switch (type) {
                case MA_RAMP_BLEND:
@@ -1007,26 +1019,26 @@ void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col)
                        }
                                break;
                case MA_RAMP_SCREEN:
-                       *r = 1.0 - (facm + fac*(1.0 - col[0])) * (1.0 - *r);
+                       *r = 1.0f - (facm + fac*(1.0f - col[0])) * (1.0f - *r);
                        if(g) {
-                               *g = 1.0 - (facm + fac*(1.0 - col[1])) * (1.0 - *g);
-                               *b = 1.0 - (facm + fac*(1.0 - col[2])) * (1.0 - *b);
+                               *g = 1.0f - (facm + fac*(1.0f - col[1])) * (1.0f - *g);
+                               *b = 1.0f - (facm + fac*(1.0f - col[2])) * (1.0f - *b);
                        }
                                break;
                case MA_RAMP_OVERLAY:
                        if(*r < 0.5f)
                                *r *= (facm + 2.0f*fac*col[0]);
                        else
-                               *r = 1.0 - (facm + 2.0f*fac*(1.0 - col[0])) * (1.0 - *r);
+                               *r = 1.0f - (facm + 2.0f*fac*(1.0f - col[0])) * (1.0f - *r);
                        if(g) {
                                if(*g < 0.5f)
                                        *g *= (facm + 2.0f*fac*col[1]);
                                else
-                                       *g = 1.0 - (facm + 2.0f*fac*(1.0 - col[1])) * (1.0 - *g);
+                                       *g = 1.0f - (facm + 2.0f*fac*(1.0f - col[1])) * (1.0f - *g);
                                if(*b < 0.5f)
                                        *b *= (facm + 2.0f*fac*col[2]);
                                else
-                                       *b = 1.0 - (facm + 2.0f*fac*(1.0 - col[2])) * (1.0 - *b);
+                                       *b = 1.0f - (facm + 2.0f*fac*(1.0f - col[2])) * (1.0f - *b);
                        }
                                break;
                case MA_RAMP_SUB:
@@ -1037,12 +1049,12 @@ void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col)
                        }
                                break;
                case MA_RAMP_DIV:
-                       if(col[0]!=0.0)
+                       if(col[0]!=0.0f)
                                *r = facm*(*r) + fac*(*r)/col[0];
                        if(g) {
-                               if(col[1]!=0.0)
+                               if(col[1]!=0.0f)
                                        *g = facm*(*g) + fac*(*g)/col[1];
-                               if(col[2]!=0.0)
+                               if(col[2]!=0.0f)
                                        *b = facm*(*b) + fac*(*b)/col[2];
                        }
                                break;
@@ -1076,31 +1088,31 @@ void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col)
                case MA_RAMP_DODGE:                     
                        
                                
-                       if(*r !=0.0){
-                               tmp = 1.0 - fac*col[0];
-                               if(tmp <= 0.0)
-                                       *r = 1.0;
-                               else if ((tmp = (*r) / tmp)> 1.0)
-                                       *r = 1.0;
+                       if(*r !=0.0f){
+                               tmp = 1.0f - fac*col[0];
+                               if(tmp <= 0.0f)
+                                       *r = 1.0f;
+                               else if ((tmp = (*r) / tmp)> 1.0f)
+                                       *r = 1.0f;
                                else 
                                        *r = tmp;
                        }
                        if(g) {
-                               if(*g !=0.0){
-                                       tmp = 1.0 - fac*col[1];
-                                       if(tmp <= 0.0 )
-                                               *g = 1.0;
-                                       else if ((tmp = (*g) / tmp) > 1.0 )
-                                               *g = 1.0;
+                               if(*g !=0.0f){
+                                       tmp = 1.0f - fac*col[1];
+                                       if(tmp <= 0.0f )
+                                               *g = 1.0f;
+                                       else if ((tmp = (*g) / tmp) > 1.0f )
+                                               *g = 1.0f;
                                        else
                                                *g = tmp;
                                }
-                               if(*b !=0.0){
-                                       tmp = 1.0 - fac*col[2];
-                                       if(tmp <= 0.0)
-                                               *b = 1.0;
-                                       else if ((tmp = (*b) / tmp) > 1.0 )
-                                               *b = 1.0;
+                               if(*b !=0.0f){
+                                       tmp = 1.0f - fac*col[2];
+                                       if(tmp <= 0.0f)
+                                               *b = 1.0f;
+                                       else if ((tmp = (*b) / tmp) > 1.0f )
+                                               *b = 1.0f;
                                        else
                                                *b = tmp;
                                }
@@ -1111,33 +1123,33 @@ void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col)
                        
                        tmp = facm + fac*col[0];
                        
-                       if(tmp <= 0.0)
-                               *r = 0.0;
-                       else if (( tmp = (1.0 - (1.0 - (*r)) / tmp )) < 0.0)
-                               *r = 0.0;
-                       else if (tmp > 1.0)
-                               *r=1.0;
+                       if(tmp <= 0.0f)
+                               *r = 0.0f;
+                       else if (( tmp = (1.0f - (1.0f - (*r)) / tmp )) < 0.0f)
+                               *r = 0.0f;
+                       else if (tmp > 1.0f)
+                               *r=1.0f;
                        else 
                                *r = tmp; 
 
                        if(g) {
                                tmp = facm + fac*col[1];
-                               if(tmp <= 0.0)
-                                       *g = 0.0;
-                               else if (( tmp = (1.0 - (1.0 - (*g)) / tmp )) < 0.0 )
-                                       *g = 0.0;
-                               else if(tmp >1.0)
-                                       *g=1.0;
+                               if(tmp <= 0.0f)
+                                       *g = 0.0f;
+                               else if (( tmp = (1.0f - (1.0f - (*g)) / tmp )) < 0.0f )
+                                       *g = 0.0f;
+                               else if(tmp >1.0f)
+                                       *g=1.0f;
                                else
                                        *g = tmp;
                                        
                                tmp = facm + fac*col[2];
-                               if(tmp <= 0.0)
-                                       *b = 0.0;
-                               else if (( tmp = (1.0 - (1.0 - (*b)) / tmp )) < 0.0  )
-                                       *b = 0.0;
-                               else if(tmp >1.0)
-                                       *b= 1.0;
+                               if(tmp <= 0.0f)
+                                       *b = 0.0f;
+                               else if (( tmp = (1.0f - (1.0f - (*b)) / tmp )) < 0.0f  )
+                                       *b = 0.0f;
+                               else if(tmp >1.0f)
+                                       *b= 1.0f;
                                else
                                        *b = tmp;
                        }
@@ -1197,29 +1209,29 @@ void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col)
                 float scr, scg, scb; 
                  
                 /* first calculate non-fac based Screen mix */ 
-                scr = 1.0 - ((1.0 - col[0])) * (1.0 - *r); 
-                scg = 1.0 - ((1.0 - col[1])) * (1.0 - *g); 
-                scb = 1.0 - ((1.0 - col[2])) * (1.0 - *b); 
+                scr = 1.0f - (1.0f - col[0]) * (1.0f - *r); 
+                scg = 1.0f - (1.0f - col[1]) * (1.0f - *g); 
+                scb = 1.0f - (1.0f - col[2]) * (1.0f - *b); 
                  
-                *r = facm*(*r) + fac*(((1.0 - *r) * col[0] * (*r)) + (*r * scr)); 
-                *g = facm*(*g) + fac*(((1.0 - *g) * col[1] * (*g)) + (*g * scg)); 
-                *b = facm*(*b) + fac*(((1.0 - *b) * col[2] * (*b)) + (*b * scb)); 
+                *r = facm*(*r) + fac*(((1.0f - *r) * col[0] * (*r)) + (*r * scr)); 
+                *g = facm*(*g) + fac*(((1.0f - *g) * col[1] * (*g)) + (*g * scg)); 
+                *b = facm*(*b) + fac*(((1.0f - *b) * col[2] * (*b)) + (*b * scb)); 
             } 
                 break; 
         case MA_RAMP_LINEAR: 
-            if (col[0] > 0.5)  
-                *r = *r + fac*(2*(col[0]-0.5)); 
+            if (col[0] > 0.5f)  
+                *r = *r + fac*(2.0f*(col[0]-0.5f)); 
             else  
-                *r = *r + fac*(2*(col[0]) - 1); 
+                *r = *r + fac*(2.0f*(col[0]) - 1.0f); 
             if (g){ 
-                if (col[1] > 0.5)  
-                    *g = *g + fac*(2*(col[1]-0.5)); 
+                if (col[1] > 0.5f)  
+                    *g = *g + fac*(2.0f*(col[1]-0.5f)); 
                 else  
-                    *g = *g + fac*(2*(col[1]) -1); 
-                if (col[2] > 0.5)  
-                    *b = *b + fac*(2*(col[2]-0.5)); 
+                    *g = *g + fac*(2.0f*(col[1]) -1.0f); 
+                if (col[2] > 0.5f)  
+                    *b = *b + fac*(2.0f*(col[2]-0.5f)); 
                 else  
-                    *b = *b + fac*(2*(col[2]) - 1); 
+                    *b = *b + fac*(2.0f*(col[2]) - 1.0f); 
             } 
                 break; 
        }       
index 0065c348ad00a643849ebe3c22ddf34ef7468aca..6ef557ca8796c1e557c092652de11719c757572c 100644 (file)
@@ -362,35 +362,12 @@ void boundbox_mesh(Mesh *me, float *loc, float *size)
 
 void tex_space_mesh(Mesh *me)
 {
-       KeyBlock *kb;
-       float *fp, loc[3], size[3], min[3], max[3];
+       float loc[3], size[3];
        int a;
 
        boundbox_mesh(me, loc, size);
 
        if(me->texflag & AUTOSPACE) {
-               if(me->key) {
-                       kb= me->key->refkey;
-                       if (kb) {
-                               
-                               INIT_MINMAX(min, max);
-                               
-                               fp= kb->data;
-                               for(a=0; a<kb->totelem; a++, fp+=3) {   
-                                       DO_MINMAX(fp, min, max);
-                               }
-                               if(kb->totelem) {
-                                       loc[0]= (min[0]+max[0])/2.0f; loc[1]= (min[1]+max[1])/2.0f; loc[2]= (min[2]+max[2])/2.0f;
-                                       size[0]= (max[0]-min[0])/2.0f; size[1]= (max[1]-min[1])/2.0f; size[2]= (max[2]-min[2])/2.0f;
-                               }
-                               else {
-                                       loc[0]= loc[1]= loc[2]= 0.0;
-                                       size[0]= size[1]= size[2]= 0.0;
-                               }
-                               
-                       }
-               }
-
                for (a=0; a<3; a++) {
                        if(size[a]==0.0) size[a]= 1.0;
                        else if(size[a]>0.0 && size[a]<0.00001) size[a]= 0.00001;
@@ -430,26 +407,20 @@ void mesh_get_texspace(Mesh *me, float *loc_r, float *rot_r, float *size_r)
 float *get_mesh_orco_verts(Object *ob)
 {
        Mesh *me = ob->data;
+       MVert *mvert = NULL;
+       Mesh *tme = me->texcomesh?me->texcomesh:me;
        int a, totvert;
        float (*vcos)[3] = NULL;
 
        /* Get appropriate vertex coordinates */
-       if(me->key && me->texcomesh==0 && me->key->refkey) {
-               vcos= mesh_getRefKeyCos(me, &totvert);
-       }
-       else {
-               MVert *mvert = NULL;            
-               Mesh *tme = me->texcomesh?me->texcomesh:me;
-
-               vcos = MEM_callocN(sizeof(*vcos)*me->totvert, "orco mesh");
-               mvert = tme->mvert;
-               totvert = MIN2(tme->totvert, me->totvert);
-
-               for(a=0; a<totvert; a++, mvert++) {
-                       vcos[a][0]= mvert->co[0];
-                       vcos[a][1]= mvert->co[1];
-                       vcos[a][2]= mvert->co[2];
-               }
+       vcos = MEM_callocN(sizeof(*vcos)*me->totvert, "orco mesh");
+       mvert = tme->mvert;
+       totvert = MIN2(tme->totvert, me->totvert);
+
+       for(a=0; a<totvert; a++, mvert++) {
+               vcos[a][0]= mvert->co[0];
+               vcos[a][1]= mvert->co[1];
+               vcos[a][2]= mvert->co[2];
        }
 
        return (float*)vcos;
@@ -1220,29 +1191,6 @@ float (*mesh_getVertexCos(Mesh *me, int *numVerts_r))[3]
        return cos;
 }
 
-float (*mesh_getRefKeyCos(Mesh *me, int *numVerts_r))[3]
-{
-       KeyBlock *kb;
-       float (*cos)[3] = NULL;
-       int totvert;
-       
-       if(me->key && me->key->refkey) {
-               if(numVerts_r) *numVerts_r= me->totvert;
-               
-               kb= me->key->refkey;
-               
-               /* prevent accessing invalid memory */
-               if (me->totvert > kb->totelem)          cos= MEM_callocN(sizeof(*cos)*me->totvert, "vertexcos1");
-               else                                                            cos= MEM_mallocN(sizeof(*cos)*me->totvert, "vertexcos1");
-               
-               totvert= MIN2(kb->totelem, me->totvert);
-
-               memcpy(cos, kb->data, sizeof(*cos)*totvert);
-       }
-
-       return cos;
-}
-
 UvVertMap *make_uv_vert_map(struct MFace *mface, struct MTFace *tface, unsigned int totface, unsigned int totvert, int selected, float *limit)
 {
        UvVertMap *vmap;
index 532c3e5da733550d5dfa02f7abae7fe21e438267..a445b6986f622e876a76a32c451f539f0e6b47ba 100644 (file)
@@ -60,6 +60,7 @@
 #include "DNA_curve_types.h"
 #include "DNA_effect_types.h"
 #include "DNA_group_types.h"
+#include "DNA_key_types.h"
 #include "DNA_material_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
@@ -92,6 +93,7 @@
 #include "BKE_fluidsim.h"
 #include "BKE_global.h"
 #include "BKE_multires.h"
+#include "BKE_key.h"
 #include "BKE_lattice.h"
 #include "BKE_library.h"
 #include "BKE_material.h"
@@ -1187,9 +1189,9 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd,
 
        /* need to avoid infinite recursion here */
        if(amd->start_cap && amd->start_cap != ob)
-               start_cap = mesh_get_derived_final(scene, amd->start_cap, CD_MASK_MESH);
+               start_cap = amd->start_cap->derivedFinal;
        if(amd->end_cap && amd->end_cap != ob)
-               end_cap = mesh_get_derived_final(scene, amd->end_cap, CD_MASK_MESH);
+               end_cap = amd->end_cap->derivedFinal;
 
        Mat4One(offset);
 
@@ -6356,7 +6358,7 @@ static DerivedMesh *booleanModifier_applyModifier(
 {
        // XXX doesn't handle derived data
        BooleanModifierData *bmd = (BooleanModifierData*) md;
-       DerivedMesh *dm = mesh_get_derived_final(md->scene, bmd->object, CD_MASK_BAREMESH);
+       DerivedMesh *dm = bmd->object->derivedFinal;
 
        /* we do a quick sanity check */
        if(dm && (derivedData->getNumFaces(derivedData) > 3)
@@ -8341,6 +8343,52 @@ static void simpledeformModifier_deformVertsEM(ModifierData *md, Object *ob, Edi
                dm->release(dm);
 }
 
+/* Shape Key */
+
+static void shapekeyModifier_deformVerts(
+                                        ModifierData *md, Object *ob, DerivedMesh *derivedData,
+      float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+{
+       KeyBlock *kb= ob_get_keyblock(ob);
+       float (*deformedVerts)[3];
+
+       if(kb && kb->totelem == numVerts) {
+               deformedVerts= (float(*)[3])do_ob_key(md->scene, ob);
+               if(deformedVerts) {
+                       memcpy(vertexCos, deformedVerts, sizeof(float)*3*numVerts);
+                       MEM_freeN(deformedVerts);
+               }
+       }
+}
+
+static void shapekeyModifier_deformVertsEM(
+                                          ModifierData *md, Object *ob, EditMesh *editData,
+       DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
+{
+       Key *key= ob_get_key(ob);
+
+       if(key && key->type == KEY_RELATIVE)
+               shapekeyModifier_deformVerts(md, ob, derivedData, vertexCos, numVerts, 0, 0);
+}
+
+static void shapekeyModifier_deformMatricesEM(
+                                             ModifierData *md, Object *ob, EditMesh *editData,
+          DerivedMesh *derivedData, float (*vertexCos)[3],
+                                            float (*defMats)[3][3], int numVerts)
+{
+       Key *key= ob_get_key(ob);
+       KeyBlock *kb= ob_get_keyblock(ob);
+       float scale[3][3];
+       int a;
+
+       if(kb && kb->totelem==numVerts && kb!=key->refkey) {
+               Mat3Scale(scale, kb->curval);
+
+               for(a=0; a<numVerts; a++)
+                       Mat3CpyMat3(defMats[a], scale);
+       }
+}
+
 /***/
 
 static ModifierTypeInfo typeArr[NUM_MODIFIER_TYPES];
@@ -8745,6 +8793,14 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
                mti->copyData = multiresModifier_copyData;
                mti->applyModifier = multiresModifier_applyModifier;
 
+               mti = INIT_TYPE(ShapeKey);
+               mti->type = eModifierTypeType_OnlyDeform;
+               mti->flags = eModifierTypeFlag_AcceptsCVs
+                               | eModifierTypeFlag_SupportsEditmode;
+               mti->deformVerts = shapekeyModifier_deformVerts;
+               mti->deformVertsEM = shapekeyModifier_deformVertsEM;
+               mti->deformMatricesEM = shapekeyModifier_deformMatricesEM;
+
                typeArrInit = 0;
 #undef INIT_TYPE
        }
@@ -8909,9 +8965,9 @@ void modifier_setError(ModifierData *md, char *format, ...)
  * also used in transform_conversion.c, to detect CrazySpace [tm] (2nd arg
  * then is NULL)
  */
-int modifiers_getCageIndex(Object *ob, int *lastPossibleCageIndex_r)
+int modifiers_getCageIndex(Object *ob, int *lastPossibleCageIndex_r, int virtual_)
 {
-       ModifierData *md = ob->modifiers.first;
+       ModifierData *md = (virtual_)? modifiers_getVirtualModifierList(ob): ob->modifiers.first;
        int i, cageIndex = -1;
 
        /* Find the last modifier acting on the cage. */
@@ -9020,11 +9076,11 @@ ModifierData *modifiers_getVirtualModifierList(Object *ob)
        static ArmatureModifierData amd;
        static CurveModifierData cmd;
        static LatticeModifierData lmd;
+       static ShapeKeyModifierData smd;
        static int init = 1;
+       ModifierData *md;
 
        if (init) {
-               ModifierData *md;
-
                md = modifier_new(eModifierType_Armature);
                amd = *((ArmatureModifierData*) md);
                modifier_free(md);
@@ -9037,32 +9093,50 @@ ModifierData *modifiers_getVirtualModifierList(Object *ob)
                lmd = *((LatticeModifierData*) md);
                modifier_free(md);
 
+               md = modifier_new(eModifierType_ShapeKey);
+               smd = *((ShapeKeyModifierData*) md);
+               modifier_free(md);
+
                amd.modifier.mode |= eModifierMode_Virtual;
                cmd.modifier.mode |= eModifierMode_Virtual;
                lmd.modifier.mode |= eModifierMode_Virtual;
+               smd.modifier.mode |= eModifierMode_Virtual;
 
                init = 0;
        }
 
-       if (ob->parent) {
+       md = ob->modifiers.first;
+
+       if(ob->parent) {
                if(ob->parent->type==OB_ARMATURE && ob->partype==PARSKEL) {
                        amd.object = ob->parent;
-                       amd.modifier.next = ob->modifiers.first;
+                       amd.modifier.next = md;
                        amd.deformflag= ((bArmature *)(ob->parent->data))->deformflag;
-                       return &amd.modifier;
+                       md = &amd.modifier;
                } else if(ob->parent->type==OB_CURVE && ob->partype==PARSKEL) {
                        cmd.object = ob->parent;
                        cmd.defaxis = ob->trackflag + 1;
-                       cmd.modifier.next = ob->modifiers.first;
-                       return &cmd.modifier;
+                       cmd.modifier.next = md;
+                       md = &cmd.modifier;
                } else if(ob->parent->type==OB_LATTICE && ob->partype==PARSKEL) {
                        lmd.object = ob->parent;
-                       lmd.modifier.next = ob->modifiers.first;
-                       return &lmd.modifier;
+                       lmd.modifier.next = md;
+                       md = &lmd.modifier;
                }
        }
 
-       return ob->modifiers.first;
+       /* shape key modifier, not yet for curves */
+       if(ELEM(ob->type, OB_MESH, OB_LATTICE) && ob_get_key(ob)) {
+               if(ob->type == OB_MESH && (ob->shapeflag & OB_SHAPE_EDIT_MODE))
+                       smd.modifier.mode |= eModifierMode_Editmode|eModifierMode_OnCage;
+               else
+                       smd.modifier.mode &= ~eModifierMode_Editmode|eModifierMode_OnCage;
+
+               smd.modifier.next = md;
+               md = &smd.modifier;
+       }
+
+       return md;
 }
 /* Takes an object and returns its first selected armature, else just its
  * armature