Cycles: svn merge -r36352:36495 https://svn.blender.org/svnroot/bf-blender/trunk...
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 5 May 2011 10:14:56 +0000 (10:14 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 5 May 2011 10:14:56 +0000 (10:14 +0000)
211 files changed:
CMakeLists.txt
build_files/buildbot/config/user-config-i686.py
build_files/buildbot/config/user-config-x86_64.py
build_files/package_spec/debian/menu
build_files/scons/tools/btools.py
doc/python_api/examples/bpy.types.Operator.1.py
extern/CMakeLists.txt
extern/SConscript
extern/bullet2/uninitialized_stack_vec.patch [deleted file]
intern/ghost/GHOST_C-api.h
intern/ghost/GHOST_ISystem.h
intern/ghost/intern/GHOST_C-api.cpp
intern/ghost/intern/GHOST_Debug.h
intern/ghost/intern/GHOST_SystemCarbon.h
intern/ghost/intern/GHOST_SystemCocoa.h
intern/ghost/intern/GHOST_SystemWin32.cpp
intern/ghost/intern/GHOST_SystemWin32.h
intern/ghost/intern/GHOST_SystemX11.cpp
intern/ghost/intern/GHOST_SystemX11.h
intern/ghost/intern/GHOST_WindowWin32.cpp
intern/ghost/intern/GHOST_WindowWin32.h
intern/ghost/test/gears/GHOST_C-Test.c
intern/guardedalloc/MEM_sys_types.h
intern/opennl/superlu/superlu_sys_types.h
release/datafiles/.Bfs [deleted file]
release/scripts/modules/bpy/utils.py
release/scripts/presets/interaction/blender.py
release/scripts/presets/interaction/maya.py
release/scripts/startup/bl_operators/mesh.py
release/scripts/startup/bl_operators/presets.py
release/scripts/startup/bl_operators/wm.py
release/scripts/startup/bl_ui/properties_data_modifier.py
release/scripts/startup/bl_ui/properties_game.py
release/scripts/startup/bl_ui/properties_material.py
release/scripts/startup/bl_ui/properties_physics_cloth.py
release/scripts/startup/bl_ui/properties_texture.py
release/scripts/startup/bl_ui/space_image.py
release/scripts/startup/bl_ui/space_userpref.py
release/scripts/startup/bl_ui/space_userpref_keymap.py
release/scripts/startup/bl_ui/space_view3d.py
release/scripts/startup/bl_ui/space_view3d_toolbar.py
release/scripts/templates/operator_export.py
source/blender/blenfont/BLF_api.h
source/blender/blenfont/intern/blf.c
source/blender/blenfont/intern/blf_font.c
source/blender/blenfont/intern/blf_internal_types.h
source/blender/blenkernel/BKE_cloth.h
source/blender/blenkernel/BKE_collision.h
source/blender/blenkernel/BKE_image.h
source/blender/blenkernel/BKE_sequencer.h
source/blender/blenkernel/BKE_shrinkwrap.h
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/SConscript
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/action.c
source/blender/blenkernel/intern/blender.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/cloth.c
source/blender/blenkernel/intern/collision.c
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/context.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/font.c
source/blender/blenkernel/intern/idprop.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/implicit.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/sequencer.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenkernel/intern/texture.c
source/blender/blenlib/BLI_listbase.h
source/blender/blenlib/BLI_math_geom.h
source/blender/blenlib/BLI_path_util.h
source/blender/blenlib/BLI_winstuff.h
source/blender/blenlib/intern/listbase.c
source/blender/blenlib/intern/math_geom.c
source/blender/blenlib/intern/path_util.c
source/blender/blenlib/intern/winstuff.c
source/blender/blenloader/intern/readblenentry.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/armature/editarmature.c
source/blender/editors/curve/editcurve.c
source/blender/editors/gpencil/drawgpencil.c
source/blender/editors/gpencil/gpencil_paint.c
source/blender/editors/include/ED_uvedit.h
source/blender/editors/include/ED_view3d.h
source/blender/editors/include/UI_interface.h
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/mesh/editmesh_add.c
source/blender/editors/mesh/editmesh_mods.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/mesh_ops.c
source/blender/editors/object/object_constraint.c
source/blender/editors/object/object_intern.h
source/blender/editors/object/object_ops.c
source/blender/editors/object/object_transform.c
source/blender/editors/render/render_internal.c
source/blender/editors/render/render_opengl.c
source/blender/editors/render/render_preview.c
source/blender/editors/render/render_shading.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/screen/screendump.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_ops.c
source/blender/editors/sculpt_paint/paint_stroke.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/sculpt_paint/sculpt_intern.h
source/blender/editors/sculpt_paint/sculpt_undo.c
source/blender/editors/space_file/file_draw.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_graph/graph_select.c
source/blender/editors/space_image/CMakeLists.txt
source/blender/editors/space_image/image_buttons.c
source/blender/editors/space_image/image_header.c [deleted file]
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_time/time_ops.c
source/blender/editors/space_view3d/drawarmature.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_fly.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/editors/space_view3d/view3d_intern.h
source/blender/editors/space_view3d/view3d_view.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_constraints.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_input.c
source/blender/editors/transform/transform_snap.c
source/blender/editors/util/crazyspace.c
source/blender/editors/uvedit/CMakeLists.txt
source/blender/editors/uvedit/uvedit_buttons.c [new file with mode: 0644]
source/blender/editors/uvedit/uvedit_ops.c
source/blender/editors/uvedit/uvedit_unwrap_ops.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/imbuf/IMB_thumbs.h
source/blender/imbuf/intern/thumbs.c
source/blender/makesdna/DNA_cloth_types.h
source/blender/makesdna/DNA_modifier_types.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_texture_types.h
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_animation.c
source/blender/makesrna/intern/rna_brush.c
source/blender/makesrna/intern/rna_cloth.c
source/blender/makesrna/intern/rna_image.c
source/blender/makesrna/intern/rna_image_api.c
source/blender/makesrna/intern/rna_modifier.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_object_force.c
source/blender/makesrna/intern/rna_pose.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_sculpt_paint.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_texture.c
source/blender/makesrna/intern/rna_ui_api.c
source/blender/modifiers/CMakeLists.txt
source/blender/modifiers/MOD_modifiertypes.h
source/blender/modifiers/intern/MOD_displace.c
source/blender/modifiers/intern/MOD_multires.c
source/blender/modifiers/intern/MOD_simpledeform.c
source/blender/modifiers/intern/MOD_util.c
source/blender/modifiers/intern/MOD_util.h
source/blender/modifiers/intern/MOD_warp.c [new file with mode: 0644]
source/blender/modifiers/intern/MOD_wave.c
source/blender/nodes/intern/CMP_nodes/CMP_outputFile.c
source/blender/python/intern/bpy_interface.c
source/blender/python/intern/bpy_library.c
source/blender/python/intern/bpy_operator.c
source/blender/python/intern/bpy_props.c
source/blender/python/intern/bpy_rna.c
source/blender/python/intern/bpy_rna_anim.c
source/blender/python/intern/bpy_traceback.c
source/blender/python/intern/bpy_util.c
source/blender/render/extern/include/RE_pipeline.h
source/blender/render/intern/include/render_types.h
source/blender/render/intern/raytrace/reorganize.h
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/initrender.c
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/pointdensity.c
source/blender/render/intern/source/render_texture.c
source/blender/render/intern/source/volume_precache.c
source/blender/windowmanager/CMakeLists.txt
source/blender/windowmanager/intern/wm_files.c
source/blender/windowmanager/intern/wm_init_exit.c
source/blender/windowmanager/intern/wm_operators.c
source/blenderplayer/bad_level_call_stubs/stubs.c
source/creator/CMakeLists.txt
source/creator/creator.c
source/gameengine/GamePlayer/ghost/GPG_Application.cpp
source/gameengine/GamePlayer/ghost/GPG_Application.h
source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp

index 8f4981d7e36617dd87278407cad4cad77bdfa569..e83b5528d6399d31d6c35b39425290c632d6f75d 100644 (file)
@@ -103,8 +103,12 @@ get_blender_version()
 
 # Blender internal features
 option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
+
 option(WITH_PYTHON        "Enable Embedded Python API  (only disable for development)" ON)
+option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default (recommend to leave off)" OFF)
 mark_as_advanced(WITH_PYTHON)  # dont want people disabling this unless they really know what they are doing.
+mark_as_advanced(WITH_PYTHON_SECURITY)  # some distrobutions see this as a security issue, rather then have them patch it, make a build option.
+
 option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency, only enable for development)." OFF)
 option(WITH_PYTHON_MODULE "Enable building as a python module (experemental, only enable for development)" OFF)
 option(WITH_BUILDINFO     "Include extra build details (only disable for development & faster builds)" ON)
index 6f0fca18dd4ea69c0b0ceda71c16cf82c80e438b..de8dd93982feaced688fa329d935c86a7b1fe5cf 100644 (file)
@@ -22,20 +22,14 @@ BF_EXPAT_LIB = ''
 WITH_BF_FFMPEG = True
 WITH_BF_STATICFFMPEG = True
 
-# Used for linking against system ffmpeg, but it gives pixelization,, so fall back to ffmpeg from 2.52 temporary
-#BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libavutil.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libdc1394.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libraw1394.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libfaad.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libspeex.a ${BF_FFMPEG_LIBPATH}/libbz2.a ${BF_FFMPEG_LIBPATH}/liboil-0.3.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libgsm.a'
-
 BF_FFMPEG = '/home/sources/staticlibs/ffmpeg'
 BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib32'
-BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libextern_libavformat.a ${BF_FFMPEG_LIBPATH}/libextern_libswscale.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libextern_libavcodec.a ${BF_FFMPEG_LIBPATH}/libextern_libavdevice.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libextern_libavutil.a ${BF_FFMPEG_LIBPATH}/libextern_xvidcore.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libextern_libmp3lame.a ${BF_FFMPEG_LIBPATH}/libextern_x264.a'
+BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a'
 
 # Don't depend on system's libstdc++
 WITH_BF_STATICCXX = True
index c44a387c1d61383019a0f000840ff4fc8e30230c..7bae2d232cdc20d8fea8476d2ae314a1ad11e755 100644 (file)
@@ -22,20 +22,14 @@ BF_EXPAT_LIB = ''
 WITH_BF_FFMPEG = True
 WITH_BF_STATICFFMPEG = True
 
-# Used for linking against system ffmpeg, but it gives pixelization,, so fall back to ffmpeg from 2.52 temporary
-#BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libavutil.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libdc1394.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libraw1394.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a ${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libfaad.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libspeex.a ${BF_FFMPEG_LIBPATH}/libbz2.a ${BF_FFMPEG_LIBPATH}/liboil-0.3.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
-#    '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libgsm.a'
-
 BF_FFMPEG = '/home/sources/staticlibs/ffmpeg'
 BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib64'
-BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libextern_libavformat.a ${BF_FFMPEG_LIBPATH}/libextern_libswscale.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libextern_libavcodec.a ${BF_FFMPEG_LIBPATH}/libextern_libavdevice.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libextern_libavutil.a ${BF_FFMPEG_LIBPATH}/libextern_xvidcore.a ' + \
-    '${BF_FFMPEG_LIBPATH}/libextern_libmp3lame.a ${BF_FFMPEG_LIBPATH}/libextern_x264.a'
+BF_FFMPEG_LIB_STATIC = '${BF_FFMPEG_LIBPATH}/libavformat.a ${BF_FFMPEG_LIBPATH}/libswscale.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libavcodec.a ${BF_FFMPEG_LIBPATH}/libavdevice.a ${BF_FFMPEG_LIBPATH}/libavutil.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libxvidcore.a ${BF_FFMPEG_LIBPATH}/libx264.a ${BF_FFMPEG_LIBPATH}/libmp3lame.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libvpx.a ${BF_FFMPEG_LIBPATH}/libvorbis.a ${BF_FFMPEG_LIBPATH}/libogg.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libvorbisenc.a ${BF_FFMPEG_LIBPATH}/libtheora.a ' + \
+    '${BF_FFMPEG_LIBPATH}/libschroedinger-1.0.a ${BF_FFMPEG_LIBPATH}/liborc-0.4.a ${BF_FFMPEG_LIBPATH}/libdirac_encoder.a'
 
 # Don't depend on system's libstdc++
 WITH_BF_STATICCXX = True
index 1124c723b3c26cf32d037a6037bebe3730d15f2b..d69c7354f3c3cee1f24144252950655ebdba495b 100644 (file)
@@ -1,4 +1,4 @@
 ?package(blender-snapshot):needs="X11" section="Applications/Graphics"\
   longtitle="Blender 3D modeler / renderer"\
-  icon="/usr/share/pixmaps/blender.svg"\
+  icon="/usr/share/icons/hicolor/scalable/apps/blender.svg"\
   title="blender" command="/usr/bin/blender"
index a646b9084c2879b1ad5519b21f7373afa935b165..fcc782bd824245e4606efda1c1da50f6e32df348 100644 (file)
@@ -99,7 +99,7 @@ def validate_arguments(args, bc):
             'WITH_BF_INTERNATIONAL',
             'BF_GETTEXT', 'BF_GETTEXT_INC', 'BF_GETTEXT_LIB', 'WITH_BF_GETTEXT_STATIC', 'BF_GETTEXT_LIB_STATIC', 'BF_GETTEXT_LIBPATH',
             'WITH_BF_ICONV', 'BF_ICONV', 'BF_ICONV_INC', 'BF_ICONV_LIB', 'BF_ICONV_LIBPATH',
-            'WITH_BF_GAMEENGINE', 'WITH_BF_BULLET', 'BF_BULLET', 'BF_BULLET_INC', 'BF_BULLET_LIB',
+            'WITH_BF_GAMEENGINE', 'WITH_BF_BULLET', 'WITH_BF_ELTOPO', 'BF_BULLET', 'BF_BULLET_INC', 'BF_BULLET_LIB',
             'BF_WINTAB', 'BF_WINTAB_INC',
             'WITH_BF_FREETYPE', 'BF_FREETYPE', 'BF_FREETYPE_INC', 'BF_FREETYPE_LIB', 'BF_FREETYPE_LIBPATH', 'BF_FREETYPE_LIB_STATIC', 'WITH_BF_FREETYPE_STATIC',
             'WITH_BF_QUICKTIME', 'BF_QUICKTIME', 'BF_QUICKTIME_INC', 'BF_QUICKTIME_LIB', 'BF_QUICKTIME_LIBPATH',
@@ -365,6 +365,8 @@ def read_opts(env, cfg, args):
         (BoolVariable('WITH_BF_GAMEENGINE', 'Build with gameengine' , False)),
 
         (BoolVariable('WITH_BF_BULLET', 'Use Bullet if true', True)),
+        (BoolVariable('WITH_BF_ELTOPO', 'Use Eltopo collision library if true', False)),
+        
         ('BF_BULLET', 'Bullet base dir', ''),
         ('BF_BULLET_INC', 'Bullet include path', ''),
         ('BF_BULLET_LIB', 'Bullet library', ''),
index 133dc09af46999bd83da5d3fe0454233bd8490c0..fc016508d39dd1cb64c3c313313c135bb57b190a 100644 (file)
@@ -32,7 +32,7 @@ class SimpleMouseOperator(bpy.types.Operator):
 
     def execute(self, context):
         # rather then printing, use the report function,
-        # this way the messag appiers in the header,
+        # this way the message appears in the header,
         self.report({'INFO'}, "Mouse coords are %d %d" % (self.x, self.y))
         return {'FINISHED'}
 
index d74c6683f2c7dcdd4c95242a96b3efb8e4e10f6e..3990d132757f62e7696de42aa025faa8ae940319 100644 (file)
@@ -31,6 +31,10 @@ if(WITH_BULLET)
        add_subdirectory(bullet2)
 endif()
 
+if(WITH_MOD_CLOTH_ELTOPO)
+       add_subdirectory(eltopo)
+endif()
+
 if(WITH_BINRELOC)
        add_subdirectory(binreloc)
 endif()
index bd73d71f1238f4d57942dc18bb9b0daaa509448c..061bd1ba6a38bda04eab51704546efed9cec2a9b 100644 (file)
@@ -4,6 +4,9 @@ Import('env')
 
 SConscript(['glew/SConscript'])
 
+if env['WITH_BF_ELTOPO']:
+    SConscript(['eltopo/SConscript'])
+
 if env['WITH_BF_BULLET']:
     SConscript(['bullet2/src/SConscript'])
 
diff --git a/extern/bullet2/uninitialized_stack_vec.patch b/extern/bullet2/uninitialized_stack_vec.patch
deleted file mode 100644 (file)
index 96833b7..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-Index: src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp
-===================================================================
---- src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp       (revision 34336)
-+++ src/BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp       (working copy)
-@@ -61,10 +61,12 @@
-       scaledAabbMin[0] = m_localScaling.getX() >= 0. ? aabbMin[0] * invLocalScaling[0] : aabbMax[0] * invLocalScaling[0];
-       scaledAabbMin[1] = m_localScaling.getY() >= 0. ? aabbMin[1] * invLocalScaling[1] : aabbMax[1] * invLocalScaling[1];
-       scaledAabbMin[2] = m_localScaling.getZ() >= 0. ? aabbMin[2] * invLocalScaling[2] : aabbMax[2] * invLocalScaling[2];
-+      scaledAabbMin[3] = 0.0; /* otherwise un-initialized stack memory: uninitialized_stack_vec.patch, blender patch */
-       
-       scaledAabbMax[0] = m_localScaling.getX() <= 0. ? aabbMin[0] * invLocalScaling[0] : aabbMax[0] * invLocalScaling[0];
-       scaledAabbMax[1] = m_localScaling.getY() <= 0. ? aabbMin[1] * invLocalScaling[1] : aabbMax[1] * invLocalScaling[1];
-       scaledAabbMax[2] = m_localScaling.getZ() <= 0. ? aabbMin[2] * invLocalScaling[2] : aabbMax[2] * invLocalScaling[2];
-+      scaledAabbMax[3] = 0.0; /* otherwise un-initialized stack memory: uninitialized_stack_vec.patch, blender patch */
-       
-       
-       m_bvhTriMeshShape->processAllTriangles(&scaledCallback,scaledAabbMin,scaledAabbMax);
index be8dc138797d1f9b8a028ccacc47ccb9e74cc140..75837239c4ac75fb30152750598a066aa98f4024 100644 (file)
@@ -845,6 +845,18 @@ extern GHOST_TUns8* GHOST_getClipboard(int selection);
 extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection);
 
 
+
+/**
+ * Toggles console
+ * @action     0 - Hides
+ *                     1 - Shows
+ *                     2 - Toggles
+ *                     3 - Hides if it runs not from  command line
+ *                     * - Does nothing
+ * @return current status (1 -visible, 0 - hidden)
+ */
+extern int GHOST_toggleConsole(int action);
+
 #ifdef __cplusplus
 }
 #endif
index 38c732153d79c201aeb97f770023f3ef52bd23a2..69e10070be57a87c87fbcc8848b0ae296b9eb465 100644 (file)
@@ -355,6 +355,16 @@ public:
         */
        virtual GHOST_TSuccess getButtonState(GHOST_TButtonMask mask, bool& isDown) const = 0;
 
+       /**
+        * Toggles console
+        * @action      0 - Hides
+        *                      1 - Shows
+        *                      2 - Toggles
+        *                      3 - Hides if it runs not from  command line
+        *                      * - Does nothing
+        * @return current status (1 -visible, 0 - hidden)
+        */
+       virtual int toggleConsole(int action) = 0;
        
        /***************************************************************************************
         ** Access to clipboard.
index a1e1bafa82fe05d84bd9b02d0fbdc5380ba54012..7ba8d7db411c3d281a1bb9dce7ea47c8804d1165 100644 (file)
@@ -877,3 +877,9 @@ void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection)
        GHOST_ISystem* system = GHOST_ISystem::getSystem();
        system->putClipboard(buffer, selection);
 }
+
+int GHOST_toggleConsole(int action)
+{
+       GHOST_ISystem* system = GHOST_ISystem::getSystem();
+       return system->toggleConsole(action);
+}
index 602f52a6435c3998c3da9a8bbfdfb1b3212713b1..e77f3b9c46106681678e61b18ff61fef019647b1 100644 (file)
 
 #ifdef GHOST_DEBUG
        #define GHOST_PRINT(x) { std::cout << x; }
-       //#define GHOST_PRINTF(x) { printf(x); }
+       #define GHOST_PRINTF(x, ...) { printf(x, __VA_ARGS__); }
 #else  // GHOST_DEBUG
        #define GHOST_PRINT(x)
-       //#define GHOST_PRINTF(x)
+       #define GHOST_PRINTF(x, ...)
 #endif // GHOST_DEBUG
 
 
index ae15afdbcdeabf82a009f504212732e42361b2e5..b0cf622f70932d5d37ce62edf498f5a32f2519a1 100644 (file)
@@ -191,6 +191,11 @@ public:
         */
        virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
 
+       /**
+        * @see GHOST_ISystem
+        */
+       int toggleConsole(int action) { return 0; }
+
 protected:
        /**
         * Initializes the system.
index dbe879dc6291dae6548b3b30c64b6aed2db49e80..e7a8178a38259a2910a44e9b0901c3a3df280232 100644 (file)
@@ -227,6 +227,11 @@ public:
      * @return Indication whether the event was handled. 
      */
     GHOST_TSuccess handleApplicationBecomeActiveEvent();
+
+       /**
+        * @see GHOST_ISystem
+        */
+       int toggleConsole(int action) { return 0; }
        
        
 protected:
index dc16711b532979355ce7b4d282313b0364e50af1..2fdddda835dadfdcb3d1077ecb62eb1b819e44b6 100644 (file)
 
 #include <iostream>
 
+#ifdef FREE_WINDOWS
+#  define _WIN32_WINNT 0x0500 /* GetConsoleWindow() for MinGW */
+#endif
+
 #include "GHOST_SystemWin32.h"
 #include "GHOST_EventDragnDrop.h"
 
@@ -174,6 +178,8 @@ GHOST_SystemWin32::GHOST_SystemWin32()
        GHOST_ASSERT(m_displayManager, "GHOST_SystemWin32::GHOST_SystemWin32(): m_displayManager==0\n");
        m_displayManager->initialize();
 
+       m_consoleStatus = 1;
+
        // Check if current keyboard layout uses AltGr and save keylayout ID for
        // specialized handling if keys like VK_OEM_*. I.e. french keylayout
        // generates VK_OEM_8 for their exclamation key (key left of right shift)
@@ -186,6 +192,7 @@ GHOST_SystemWin32::~GHOST_SystemWin32()
 {
        // Shutdown COM
        OleUninitialize();
+       toggleConsole(1);
 }
 
 
@@ -231,7 +238,7 @@ GHOST_IWindow* GHOST_SystemWin32::createWindow(
        bool stereoVisual, const GHOST_TUns16 numOfAASamples, const GHOST_TEmbedderWindowID parentWindow )
 {
        GHOST_Window* window = 0;
-       window = new GHOST_WindowWin32 (this, title, left, top, width, height, state, type, stereoVisual, numOfAASamples);
+       window = new GHOST_WindowWin32 (this, title, left, top, width, height, state, type, stereoVisual, numOfAASamples, parentWindow);
        if (window) {
                if (window->getValid()) {
                        // Store the pointer to the window
@@ -240,6 +247,14 @@ GHOST_IWindow* GHOST_SystemWin32::createWindow(
 //                     }
                }
                else {
+
+                       // Invalid parent window hwnd
+                       if (((GHOST_WindowWin32*)window)->getNextWindow() == NULL) {
+                               delete window;
+                               window = 0;
+                               return window;
+                       }
+
                        // An invalid window could be one that was used to test for AA
                        window = ((GHOST_WindowWin32*)window)->getNextWindow();
                        
@@ -847,7 +862,14 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
                                         * a dead key that is pressed while holding down the alt key.
                                         * To prevent the sound, DefWindowProc must be avoided by return
                                         */
-                                       return 0;
+                                       break;
+                               case WM_SYSCOMMAND:
+                                       /* The WM_SYSCHAR message is sent to the window when system commands such as 
+                                        * maximize, minimize  or close the window are triggered. Also it is sent when ALT 
+                                        * button is press for menu. To prevent this we must return preventing DefWindowProc.
+                                        */
+                                       if(wParam==SC_KEYMENU) return 0;
+                                       break;
                                ////////////////////////////////////////////////////////////////////////
                                // Tablet events, processed
                                ////////////////////////////////////////////////////////////////////////
@@ -1047,8 +1069,12 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
                                         * DestroyWindow function sends the WM_NCDESTROY message to the window following the WM_DESTROY
                                         * message. WM_DESTROY is used to free the allocated memory object associated with the window. 
                                         */
+                                       break;
                                case WM_KILLFOCUS:
-                                       /* The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus. */
+                                       /* The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus. 
+                                        * We want to prevent this if a window is still active and it loses focus to nowhere*/
+                                       if(!wParam && hwnd==GetActiveWindow())
+                                               SetFocus(hwnd);
                                case WM_SHOWWINDOW:
                                        /* The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown. */
                                case WM_WINDOWPOSCHANGING:
@@ -1196,3 +1222,32 @@ void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const
                return;
        }
 }
+
+int GHOST_SystemWin32::toggleConsole(int action)
+{
+       switch(action)
+       {
+               case 3: //hide if no console
+                       {
+                       CONSOLE_SCREEN_BUFFER_INFO csbi = {{0}};
+                       if(!GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi) || csbi.dwCursorPosition.X || csbi.dwCursorPosition.Y>1)
+                               break;
+                       }
+               case 0: //hide
+                       ShowWindow(GetConsoleWindow(),SW_HIDE);
+                       m_consoleStatus = 0;
+                       break;
+               case 1: //show
+                       ShowWindow(GetConsoleWindow(),SW_SHOW);
+                       m_consoleStatus = 1;
+                       break;
+               case 2: //toggle
+                       ShowWindow(GetConsoleWindow(),m_consoleStatus?SW_HIDE:SW_SHOW);
+                       m_consoleStatus=!m_consoleStatus;
+                       break;
+
+       };
+
+
+       return m_consoleStatus;
+}
index d79b9a22b698236b20f0d92e416d5b33ef74592a..2dad3a6f44d768e94c90c1e97ac1d74804bd7ffa 100644 (file)
@@ -415,6 +415,17 @@ protected:
         * Initiates WM_INPUT messages from keyboard 
         */
        GHOST_TInt32 initKeyboardRawInput(void);
+
+       /**
+ * Toggles console
+ * @action     0 - Hides
+ *                     1 - Shows
+ *                     2 - Toggles
+ *                     3 - Hides if it runs not from  command line
+ *                     * - Does nothing
+ * @return current status (1 -visible, 0 - hidden)
+ */
+       int toggleConsole(int action);
        
        /** The current state of the modifier keys. */
        GHOST_ModifierKeys m_modifierKeys;
@@ -431,6 +442,9 @@ protected:
        /** stores keyboard layout. */
        HKL m_keylayout;
 
+       /** Console status */
+       int m_consoleStatus;
+
        /** handle for user32.dll*/
        HMODULE user32;
        #ifdef NEED_RAW_PROC
@@ -471,6 +485,5 @@ inline void GHOST_SystemWin32::handleKeyboardChange(void)
                }
        }
 }
-
 #endif // _GHOST_SYSTEM_WIN32_H_
 
index e2ee7044392810ca8d2494b615aa9c595a3a598b..378bc6b90beeb56f068a61d5a48ae495c0ca1602 100644 (file)
@@ -1485,10 +1485,8 @@ void GHOST_SystemX11::putClipboard(GHOST_TInt8 *buffer, bool selection) const
                        txt_select_buffer = (char*) malloc(strlen(buffer)+1);
                        strcpy(txt_select_buffer, buffer);
                }
-       
+
                if (owner != m_window)
                        fprintf(stderr, "failed to own primary\n");
        }
 }
-
-
index d0e7265951799a4f2381397d9c332d20bca04d80..0b00127363440534d33577ad13e147bf2bfe3d7e 100644 (file)
@@ -227,6 +227,11 @@ public:
         */
        void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
 
+       /**
+        * @see GHOST_ISystem
+        */
+       int toggleConsole(int action) { return 0; }
+
        /**
         * Atom used for ICCCM, WM-spec and Motif.
         * We only need get this atom at the start, it's relative
index 5d21edb758de89184313b04b92aa5880aebefe64..a89b2608bb45c1136ab323dc79037d584d532a69 100644 (file)
@@ -132,6 +132,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(
        GHOST_TDrawingContextType type,
        const bool stereoVisual,
        const GHOST_TUns16 numOfAASamples,
+       GHOST_TEmbedderWindowID parentwindowhwnd,
        GHOST_TSuccess msEnabled,
        int msPixelFormat)
 :
@@ -149,6 +150,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(
        m_tablet(0),
        m_maxPressure(0),
        m_multisample(numOfAASamples),
+       m_parentWindowHwnd(parentwindowhwnd),
        m_multisampleEnabled(msEnabled),
        m_msPixelFormat(msPixelFormat),
        //For recreation
@@ -223,15 +225,26 @@ GHOST_WindowWin32::GHOST_WindowWin32(
                else if(top < monitor.rcWork.top)
                        top = monitor.rcWork.top;
 
+               int wintype = WS_OVERLAPPEDWINDOW;
+               if (m_parentWindowHwnd != 0)
+               {
+                       wintype = WS_CHILD;
+                       GetWindowRect((HWND)m_parentWindowHwnd, &rect);
+                       left = 0;
+                       top = 0;
+                       width = rect.right - rect.left;
+                       height = rect.bottom - rect.top;
+               }
+               
                m_hWnd = ::CreateWindow(
                        s_windowClassName,                      // pointer to registered class name
                        title,                                          // pointer to window name
-                       WS_OVERLAPPEDWINDOW,            // window style
+                       wintype,                                        // window style
                        left,                                   // horizontal position of window
                        top,                                    // vertical position of window
                        width,                                          // window width
                        height,                                         // window height
-                       HWND_DESKTOP,                           // handle to parent or owner window
+                       (HWND) m_parentWindowHwnd,      // handle to parent or owner window
                        0,                                                      // handle to menu or child-window identifier
                        ::GetModuleHandle(0),           // handle to application instance
                        0);                                                     // pointer to window-creation data
@@ -452,6 +465,11 @@ void GHOST_WindowWin32::getClientBounds(GHOST_Rect& bounds) const
                        bounds.m_l = rect.left + sm_cysizeframe;
                        bounds.m_r = rect.right - sm_cysizeframe;
                        bounds.m_t = rect.top;
+               } else if (state == GHOST_kWindowStateEmbedded) {
+                       bounds.m_b = rect.bottom;
+                       bounds.m_l = rect.left;
+                       bounds.m_r = rect.right;
+                       bounds.m_t = rect.top;
                } else {
                        bounds.m_b = rect.bottom-GetSystemMetrics(SM_CYCAPTION)-sm_cysizeframe*2;
                        bounds.m_l = rect.left;
@@ -459,7 +477,6 @@ void GHOST_WindowWin32::getClientBounds(GHOST_Rect& bounds) const
                        bounds.m_t = rect.top;
                }
        } else {
-               ::GetWindowRect(m_hWnd, &rect);
                bounds.m_b = rect.bottom;
                bounds.m_l = rect.left;
                bounds.m_r = rect.right;
@@ -528,6 +545,15 @@ GHOST_TSuccess GHOST_WindowWin32::setClientSize(GHOST_TUns32 width, GHOST_TUns32
 GHOST_TWindowState GHOST_WindowWin32::getState() const
 {
        GHOST_TWindowState state;
+
+       // XXX 27.04.2011
+       // we need to find a way to combine parented windows + resizing if we simply set the
+       // state as GHOST_kWindowStateEmbedded we will need to check for them somewhere else.
+       // It's also strange that in Windows is the only platform we need to make this separation.
+       if (m_parentWindowHwnd != 0) {
+               state = GHOST_kWindowStateEmbedded;
+               return state;
+       }
        if (::IsIconic(m_hWnd)) {
                state = GHOST_kWindowStateMinimized;
        }
@@ -589,6 +615,9 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state)
                wp.ptMaxPosition.y = 0;
                SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_POPUP | WS_MAXIMIZE);
                break;
+       case GHOST_kWindowStateEmbedded:
+               SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_CHILD);
+               break;
        case GHOST_kWindowStateNormal:
        default:
                ShowWindow(m_hWnd, SW_HIDE);
@@ -651,10 +680,11 @@ GHOST_TSuccess GHOST_WindowWin32::invalidate()
 GHOST_TSuccess GHOST_WindowWin32::initMultisample(PIXELFORMATDESCRIPTOR pfd)
 {
        int pixelFormat;
-       bool success;
+       bool success = FALSE;
        UINT numFormats;
        HDC hDC = GetDC(getHWND());
        float fAttributes[] = {0, 0};
+       UINT nMaxFormats = 1;
 
        // The attributes to look for
        int iAttributes[] = {
@@ -679,36 +709,24 @@ GHOST_TSuccess GHOST_WindowWin32::initMultisample(PIXELFORMATDESCRIPTOR pfd)
                return GHOST_kFailure;
        }
 
-       // See if the format is valid
-       success = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats);
-
-       if (success && numFormats >= 1)
-       {
-               m_multisampleEnabled = GHOST_kSuccess;
-               m_msPixelFormat = pixelFormat;
-               return GHOST_kSuccess;
-       }
-       else
-       {
-               // See if any formats are supported
-               while (!success && iAttributes[19] != 0)
-               {
-                       iAttributes[19] /= 2;
-
-                       success = wglChoosePixelFormatARB(m_hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats);
-
-                       if (success && numFormats >= 1)
-                       {
-                               m_multisampleEnabled = GHOST_kSuccess;
-                               m_msPixelFormat = pixelFormat;
-                               return GHOST_kSuccess;
-                       }
+       // iAttributes[17] is the initial multisample. If not valid try to use the closest valid value under it.
+       while (iAttributes[17] > 0) {
+               // See if the format is valid
+               success = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, nMaxFormats, &pixelFormat, &numFormats);
+               GHOST_PRINTF("WGL_SAMPLES_ARB = %i --> success = %i, %i formats\n", iAttributes[17], success, numFormats);
 
-                       success = GHOST_kFailure;
+               if (success && numFormats >= 1 && m_multisampleEnabled == GHOST_kFailure) {
+                       GHOST_PRINTF("valid pixel format with %i multisamples\n", iAttributes[17]);
+                       m_multisampleEnabled = GHOST_kSuccess;
+                       m_msPixelFormat = pixelFormat;
                }
+               iAttributes[17] -= 1;
+               success = GHOST_kFailure;
        }
-
-       // No available pixel format...
+       if (m_multisampleEnabled == GHOST_kSuccess)     {
+               return GHOST_kSuccess;
+       }
+       GHOST_PRINT("no available pixel format\n");
        return GHOST_kFailure;
 }
 
@@ -856,12 +874,17 @@ GHOST_TSuccess GHOST_WindowWin32::installDrawingContext(GHOST_TDrawingContextTyp
                                                                                                        type,
                                                                                                        m_stereo,
                                                                                                        m_multisample,
+                                                                                                       m_parentWindowHwnd,
                                                                                                        m_multisampleEnabled,
                                                                                                        m_msPixelFormat);
 
                                        // Return failure so we can trash this window.
                                        success = GHOST_kFailure;
                                        break;
+                               } else {
+                                       m_multisampleEnabled = GHOST_kSuccess;
+                                       printf("Multisample failed to initialized\n");
+                                       success = GHOST_kSuccess;
                                }
                        }
                }
index 20212bbc2afd6d45f86dcbbe2981929ababcc5bc..4055c3acf56ed1e4e99a38ac836bfec982e12d56 100644 (file)
@@ -100,6 +100,7 @@ public:
                GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
                const bool stereoVisual = false,
                const GHOST_TUns16 numOfAASamples = 0,
+               GHOST_TEmbedderWindowID parentWindowHwnd=0,
                GHOST_TSuccess msEnabled = GHOST_kFailure,
                int msPixelFormat = 0
        );
@@ -391,6 +392,9 @@ protected:
 
        /** The GHOST_System passes this to wm if this window is being replaced */
        GHOST_Window *m_nextWindow;
+
+       /** Hwnd to parent window */
+       GHOST_TEmbedderWindowID m_parentWindowHwnd;
 };
 
 #endif // _GHOST_WINDOW_WIN32_H_
index e8e818abca7c92b9ef0678dde4a61393ed3979e9..b34a37132b60a0c6cb2c762f3a0299739d6473da 100644 (file)
@@ -83,71 +83,71 @@ static void testTimerProc(GHOST_TimerTaskHandle task, GHOST_TUns64 time)
 static void gearGL(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, GLint teeth, GLfloat tooth_depth)
 {
        GLint i;
-    GLfloat r0, r1, r2;
-    GLfloat angle, da;
-    GLfloat u, v, len;
+       GLfloat r0, r1, r2;
+       GLfloat angle, da;
+       GLfloat u, v, len;
        const double pi = 3.14159264;
        
-    r0 = inner_radius;
-    r1 = (float)(outer_radius - tooth_depth/2.0);
-    r2 = (float)(outer_radius + tooth_depth/2.0);
+       r0 = inner_radius;
+       r1 = (float)(outer_radius - tooth_depth/2.0);
+       r2 = (float)(outer_radius + tooth_depth/2.0);
        
-    da = (float)(2.0*pi / teeth / 4.0);
+       da = (float)(2.0*pi / teeth / 4.0);
        
-    glShadeModel(GL_FLAT);
-    glNormal3f(0.0, 0.0, 1.0);
+       glShadeModel(GL_FLAT);
+       glNormal3f(0.0, 0.0, 1.0);
        
-    /* draw front face */
-    glBegin(GL_QUAD_STRIP);
-    for (i=0;i<=teeth;i++) {
+       /* draw front face */
+       glBegin(GL_QUAD_STRIP);
+       for (i=0;i<=teeth;i++) {
                angle = (float)(i * 2.0*pi / teeth);
                glVertex3f((float)(r0*cos(angle)), (float)(r0*sin(angle)), (float)(width*0.5));
                glVertex3f((float)(r1*cos(angle)), (float)(r1*sin(angle)), (float)(width*0.5));
                glVertex3f((float)(r0*cos(angle)), (float)(r0*sin(angle)), (float)(width*0.5));
                glVertex3f((float)(r1*cos(angle+3*da)), (float)(r1*sin(angle+3*da)), (float)(width*0.5));
-    }
-    glEnd();
+       }
+       glEnd();
        
-    /* draw front sides of teeth */
-    glBegin(GL_QUADS);
-    da = (float)(2.0*pi / teeth / 4.0);
-    for (i=0;i<teeth;i++) {
+       /* draw front sides of teeth */
+       glBegin(GL_QUADS);
+       da = (float)(2.0*pi / teeth / 4.0);
+       for (i=0;i<teeth;i++) {
                angle = (float)(i * 2.0*pi / teeth);
                glVertex3f((float)(r1*cos(angle)), (float)(r1*sin(angle)), (float)(width*0.5));
                glVertex3f((float)(r2*cos(angle+da)), (float)(r2*sin(angle+da)), (float)(width*0.5));
                glVertex3f((float)(r2*cos(angle+2*da)), (float)(r2*sin(angle+2*da)), (float)(width*0.5));
                glVertex3f((float)(r1*cos(angle+3*da)), (float)(r1*sin(angle+3*da)), (float)(width*0.5));
-    }
-    glEnd();
+       }
+       glEnd();
        
-    glNormal3f(0.0, 0.0, -1.0);
+       glNormal3f(0.0, 0.0, -1.0);
        
        /* draw back face */
-    glBegin(GL_QUAD_STRIP);
-    for (i=0;i<=teeth;i++) {
+       glBegin(GL_QUAD_STRIP);
+       for (i=0;i<=teeth;i++) {
                angle = (float)(i * 2.0*pi / teeth);
                glVertex3f((float)(r1*cos(angle)), (float)(r1*sin(angle)), (float)(-width*0.5));
                glVertex3f((float)(r0*cos(angle)), (float)(r0*sin(angle)), (float)(-width*0.5));
                glVertex3f((float)(r1*cos(angle+3*da)), (float)(r1*sin(angle+3*da)), (float)(-width*0.5));
                glVertex3f((float)(r0*cos(angle)), (float)(r0*sin(angle)), (float)(-width*0.5));
-    }
-    glEnd();
+       }
+       glEnd();
        
-    /* draw back sides of teeth */
-    glBegin(GL_QUADS);
-    da = (float)(2.0*pi / teeth / 4.0);
-    for (i=0;i<teeth;i++) {
+       /* draw back sides of teeth */
+       glBegin(GL_QUADS);
+       da = (float)(2.0*pi / teeth / 4.0);
+       for (i=0;i<teeth;i++) {
                angle = (float)(i * 2.0*pi / teeth);
                glVertex3f((float)(r1*cos(angle+3*da)), (float)(r1*sin(angle+3*da)), (float)(-width*0.5));
                glVertex3f((float)(r2*cos(angle+2*da)), (float)(r2*sin(angle+2*da)), (float)(-width*0.5));
                glVertex3f((float)(r2*cos(angle+da)), (float)(r2*sin(angle+da)), (float)(-width*0.5));
                glVertex3f((float)(r1*cos(angle)), (float)(r1*sin(angle)), (float)(-width*0.5));
-    }
-    glEnd();
+       }
+       glEnd();
        
-    /* draw outward faces of teeth */
-    glBegin(GL_QUAD_STRIP);
-    for (i=0;i<teeth;i++) {
+       /* draw outward faces of teeth */
+       glBegin(GL_QUAD_STRIP);
+       for (i=0;i<teeth;i++) {
                angle = (float)(i * 2.0*pi / teeth);
                glVertex3f((float)(r1*cos(angle)), (float)(r1*sin(angle)), (float)(width*0.5));
                glVertex3f((float)(r1*cos(angle)), (float)(r1*sin(angle)), (float)(-width*0.5));
@@ -168,22 +168,22 @@ static void gearGL(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, GL
                glVertex3f((float)(r1*cos(angle+3*da)), (float)(r1*sin(angle+3*da)), (float)(width*0.5));
                glVertex3f((float)(r1*cos(angle+3*da)), (float)(r1*sin(angle+3*da)), (float)(-width*0.5));
                glNormal3f((float)(cos(angle)), (float)(sin(angle)), 0.0);
-    }
-    glVertex3f((float)(r1*cos(0.0)), (float)(r1*sin(0.0)), (float)(width*0.5));
-    glVertex3f((float)(r1*cos(0.0)), (float)(r1*sin(0.0)), (float)(-width*0.5));
-    glEnd();
+       }
+       glVertex3f((float)(r1*cos(0.0)), (float)(r1*sin(0.0)), (float)(width*0.5));
+       glVertex3f((float)(r1*cos(0.0)), (float)(r1*sin(0.0)), (float)(-width*0.5));
+       glEnd();
        
-    glShadeModel(GL_SMOOTH);
+       glShadeModel(GL_SMOOTH);
        
-    /* draw inside radius cylinder */
-    glBegin(GL_QUAD_STRIP);
-    for (i=0;i<=teeth;i++) {
+       /* draw inside radius cylinder */
+       glBegin(GL_QUAD_STRIP);
+       for (i=0;i<=teeth;i++) {
                angle = (float)(i * 2.0*pi / teeth);
                glNormal3f((float)(-cos(angle)), (float)(-sin(angle)), 0.0);
                glVertex3f((float)(r0*cos(angle)), (float)(r0*sin(angle)), (float)(-width*0.5));
                glVertex3f((float)(r0*cos(angle)), (float)(r0*sin(angle)), (float)(width*0.5));
-    }
-    glEnd();
+       }
+       glEnd();
 }
 
 
index ff945a8c0c1a44ca92d5b76ca420bea7bd15e778..c5148e84ffed932d1dcfe6d142441504905461bc 100644 (file)
@@ -48,8 +48,8 @@
  *  \ingroup MEM
  */
 
-#ifndef BLO_SYS_TYPES_H
-#define BLO_SYS_TYPES_H
+#ifndef MEM_SYS_TYPES_H
+#define MEM_SYS_TYPES_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -127,5 +127,5 @@ typedef unsigned long uintptr_t;
 }
 #endif
 
-#endif /* eof */
+#endif /* MEM_SYS_TYPES_H */
 
index d8b28e54348f4ef77e563fcbfd324c052356966d..2cd9cab453d684969c01fef85baf00813c224770 100644 (file)
@@ -48,8 +48,8 @@
 // jesterKing: renamed to superlu_sys_types.h
 */
 
-#ifndef BLO_SYS_TYPES_H
-#define BLO_SYS_TYPES_H
+#ifndef SUPERLU_SYS_TYPES_H
+#define SUPERLU_SYS_TYPES_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -129,5 +129,5 @@ typedef unsigned long uintptr_t;
 }
 #endif
 
-#endif /* eof */
+#endif /* SUPERLU_SYS_TYPES_H */
 
diff --git a/release/datafiles/.Bfs b/release/datafiles/.Bfs
deleted file mode 100644 (file)
index 8085442..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/\r
-/tmp/\r
index eee98bdca37229b0788851524b6fcd35347376f4..27ac1d6ea792a648e467c40489d687992968ad67 100644 (file)
@@ -33,6 +33,7 @@ import sys as _sys
 
 import addon_utils as _addon_utils
 
+_script_module_dirs = "startup", "modules"
 
 def _test_import(module_name, loaded_modules):
     use_time = _bpy.app.debug
@@ -183,7 +184,7 @@ def load_scripts(reload_scripts=False, refresh_scripts=False):
         _global_loaded_modules[:] = []
 
     for base_path in script_paths():
-        for path_subdir in ("startup", "modules"):
+        for path_subdir in _script_module_dirs:
             path = _os.path.join(base_path, path_subdir)
             if _os.path.isdir(path):
                 _sys_path_ensure(path)
@@ -226,27 +227,41 @@ def user_script_path():
         return None
 
 
-def script_paths(subdir=None, user=True):
+def script_paths(subdir=None, user_pref=True, all=False):
     """
-    Returns a list of valid script paths from the home directory and user preferences.
+    Returns a list of valid script paths.
 
-    Accepts any number of string arguments which are joined to make a path.
+    :arg subdir: Optional subdir.
+    :type subdir: string
+    :arg user_pref: Include the user preference script path.
+    :type user_pref: bool
+    :arg all: Include local, user and system paths rather just the paths blender uses.
+    :type all: bool
+    :return: script paths.
+    :rtype: list
     """
     scripts = list(_scripts)
 
     # add user scripts dir
-    if user:
+    if user_pref:
         user_script_path = _bpy.context.user_preferences.filepaths.script_directory
     else:
         user_script_path = None
 
-    for path in _bpy_script_paths() + (user_script_path, ):
+    if all:
+        # all possible paths
+        base_paths = tuple(_os.path.join(resource_path(res), "scripts") for res in ('LOCAL', 'USER', 'SYSTEM'))
+    else:
+        # only paths blender uses
+        base_paths = _bpy_script_paths()
+
+    for path in base_paths + (user_script_path, ):
         if path:
             path = _os.path.normpath(path)
             if path not in scripts and _os.path.isdir(path):
                 scripts.append(path)
 
-    if not subdir:
+    if subdir is None:
         return scripts
 
     script_paths = []
@@ -258,6 +273,24 @@ def script_paths(subdir=None, user=True):
     return script_paths
 
 
+def refresh_script_paths():
+    """
+    Run this after creating new script paths to update sys.path
+    """
+
+    for base_path in script_paths():
+        for path_subdir in _script_module_dirs:
+            path = _os.path.join(base_path, path_subdir)
+            if _os.path.isdir(path):
+                _sys_path_ensure(path)
+
+    for path in _addon_utils.paths():
+        _sys_path_ensure(path)
+        path = _os.path.join(path, "modules")
+        if _os.path.isdir(path):
+            _sys_path_ensure(path)
+
+
 _presets = _os.path.join(_scripts[0], "presets")  # FIXME - multiple paths
 
 
@@ -266,7 +299,7 @@ def preset_paths(subdir):
     Returns a list of paths for a specific preset.
     """
     dirs = []
-    for path in script_paths("presets"):
+    for path in script_paths("presets", all=True):
         directory = _os.path.join(path, subdir)
         if _os.path.isdir(directory):
             dirs.append(directory)
index 603158ed936636e5884781483a8d91c0dc120c07..3b6ce13d7e0b304157d75385eebc2483795ca5c2 100644 (file)
@@ -10,4 +10,4 @@ bpy.context.user_preferences.inputs.select_mouse = 'RIGHT'
 bpy.context.user_preferences.inputs.view_zoom_method = 'DOLLY'
 bpy.context.user_preferences.inputs.view_zoom_axis = 'VERTICAL'
 bpy.context.user_preferences.inputs.view_rotate_method = 'TRACKBALL'
-bpy.context.user_preferences.inputs.invert_mouse_wheel_zoom = False
+bpy.context.user_preferences.inputs.invert_mouse_zoom = False
index ec7ecaf46392f315871b530f1fb368989e201e45..62084645081b249ba656cc8d8b75619ff4d7a14b 100644 (file)
@@ -7,4 +7,4 @@ bpy.context.user_preferences.inputs.select_mouse = 'LEFT'
 bpy.context.user_preferences.inputs.view_zoom_method = 'DOLLY'
 bpy.context.user_preferences.inputs.view_zoom_axis = 'HORIZONTAL'
 bpy.context.user_preferences.inputs.view_rotate_method = 'TURNTABLE'
-bpy.context.user_preferences.inputs.invert_mouse_wheel_zoom = True
+bpy.context.user_preferences.inputs.invert_mouse_zoom = True
index a37a83f0f09c967246188e815eb6c9c1ea8405bb..44d81ba53df5ac5eaa79c3a2f477525d5cf8589f 100644 (file)
@@ -20,6 +20,8 @@
 
 import bpy
 
+from bpy.props import EnumProperty
+
 
 class MeshSelectInteriorFaces(bpy.types.Operator):
     '''Select faces where all edges have more then 2 face users.'''
@@ -66,17 +68,23 @@ class MeshSelectInteriorFaces(bpy.types.Operator):
 
 class MeshMirrorUV(bpy.types.Operator):
     '''Copy mirror UV coordinates on the X axis based on a mirrored mesh'''
-    bl_idname = "mesh.faces_miror_uv"
+    bl_idname = "mesh.faces_mirror_uv"
     bl_label = "Copy Mirrored UV coords"
     bl_options = {'REGISTER', 'UNDO'}
 
+    direction = EnumProperty(items=(
+                        ('POSITIVE', "Positive", ""),
+                        ('NEGATIVE', "Negative", "")),
+                name="Axis Direction",
+                description="")
+
     @classmethod
     def poll(cls, context):
         ob = context.active_object
         return (ob and ob.type == 'MESH')
 
     def execute(self, context):
-        DIR = 1  # TODO, make an option
+        DIR = (self.direction == 'NEGATIVE')
 
         from mathutils import Vector
 
index 30fc802356c5492b05ff738cdecc2ead705ec17b..493c51ad2379ae2f170da9f399adc82ab0cc383f 100644 (file)
@@ -48,11 +48,11 @@ class AddPresetBase():
         preset_menu_class = getattr(bpy.types, self.preset_menu)
 
         if not self.remove_active:
-
-            if not self.name:
+            name = self.name.strip()
+            if not name:
                 return {'FINISHED'}
 
-            filename = self.as_filename(self.name)
+            filename = self.as_filename(name)
 
             target_path = bpy.utils.user_resource('SCRIPTS', os.path.join("presets", self.preset_subdir), create=True)
 
@@ -118,7 +118,7 @@ class AddPresetBase():
         return {'FINISHED'}
 
     def check(self, context):
-        self.name = self.as_filename(self.name)
+        self.name = self.as_filename(self.name.strip())
 
     def invoke(self, context, event):
         if not self.remove_active:
@@ -264,7 +264,7 @@ class AddPresetInteraction(AddPresetBase, bpy.types.Operator):
     preset_values = [
         "user_preferences.edit.use_drag_immediately",
         "user_preferences.edit.use_insertkey_xyz_to_rgb",
-        "user_preferences.inputs.invert_mouse_wheel_zoom",
+        "user_preferences.inputs.invert_mouse_zoom",
         "user_preferences.inputs.select_mouse",
         "user_preferences.inputs.use_emulate_numpad",
         "user_preferences.inputs.use_mouse_continuous",
@@ -327,7 +327,7 @@ class AddPresetOperator(AddPresetBase, bpy.types.Operator):
         ret = []
         for prop_id, prop in operator_rna.properties.items():
             if (not prop.is_hidden) and prop_id not in properties_blacklist:
-                    ret.append("op.%s" % prop_id)
+                ret.append("op.%s" % prop_id)
 
         return ret
 
index 6161aa4aa1959454da6b3fb0b58cabe35edf686c..53c8d56229717ee43a6cd3b263ad3a4a54e61297 100644 (file)
@@ -395,7 +395,7 @@ class WM_MT_context_menu_enum(bpy.types.Menu):
         base_path, prop_string = data_path.rsplit(".", 1)
         value_base = context_path_validate(context, base_path)
 
-        values = [(i.name, i.identifier) for i in value_base.bl_rna.properties[prop_string].items]
+        values = [(i.name, i.identifier) for i in value_base.bl_rna.properties[prop_string].enum_items]
 
         for name, identifier in values:
             prop = self.layout.operator("wm.context_set_enum", text=name)
@@ -837,6 +837,7 @@ class WM_OT_properties_add(bpy.types.Operator):
         item[property] = 1.0
         return {'FINISHED'}
 
+
 class WM_OT_properties_context_change(bpy.types.Operator):
     "Change the context tab in a Properties Window"
     bl_idname = "wm.properties_context_change"
@@ -846,7 +847,6 @@ class WM_OT_properties_context_change(bpy.types.Operator):
 
     def execute(self, context):
         context.space_data.context = (self.context)
-               
         return {'FINISHED'}
 
 
index e640654ea69ae94216c216bd2eab0f9bd0519a5e..1fa79a88f439bc9f6c33346ae5d8869d85a61bda 100644 (file)
@@ -581,7 +581,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
         col.prop(md, "use_even_offset")
         col.prop(md, "use_quality_normals")
         col.prop(md, "use_rim")
-        
+
         sub = col.column()
         sub.label()
         row = sub.split(align=True, percentage=0.4)
@@ -635,6 +635,48 @@ class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
             sub.prop(md, "scale_x", text="Scale X")
             sub.prop(md, "scale_y", text="Scale Y")
 
+    def WARP(self, layout, ob, md):
+        use_falloff = (md.falloff_type != 'NONE')
+        split = layout.split()
+
+        col = split.column()
+        col.label(text="From:")
+        col.prop(md, "object_from", text="")
+
+        col.prop(md, "use_volume_preserve")
+
+        col = split.column()
+        col.label(text="To:")
+        col.prop(md, "object_to", text="")
+        col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+
+        col = layout.column()
+
+        row = col.row(align=True)
+        row.prop(md, "strength")
+        if use_falloff:
+            row.prop(md, "falloff_radius")
+
+        col.prop(md, "falloff_type")
+        if use_falloff:
+            if md.falloff_type == 'CURVE':
+                col.template_curve_mapping(md, "falloff_curve")
+
+        # 2 new columns
+        split = layout.split()
+        col = split.column()
+        col.label(text="Texture:")
+        col.prop(md, "texture", text="")
+
+        col = split.column()
+        col.label(text="Texture Coordinates:")
+        col.prop(md, "texture_coords", text="")
+
+        if md.texture_coords == 'OBJECT':
+            layout.prop(md, "texture_coordinate_object", text="Object")
+        elif md.texture_coords == 'UV' and ob.type == 'MESH':
+            layout.prop_object(md, "uv_layer", ob.data, "uv_textures")
+
     def WAVE(self, layout, ob, md):
         split = layout.split()
 
index a151234e184c6cf3c25d61b431a1caad882d47f9..0c07451b3b2dcdde62413053dbe48b305765863c 100644 (file)
@@ -323,6 +323,7 @@ class RENDER_PT_game_shading(RenderButtonsPanel, bpy.types.Panel):
             col.prop(gs, "use_glsl_lights", text="Lights")
             col.prop(gs, "use_glsl_shaders", text="Shaders")
             col.prop(gs, "use_glsl_shadows", text="Shadows")
+            col.prop(gs, "use_glsl_color_management", text="Color Management")
 
             col = split.column()
             col.prop(gs, "use_glsl_ramps", text="Ramps")
index 0443a351afab951e26bc4439b097bd7f84983d9c..52d6b5f1376e257e10cfacdbd1b469349868c6fd 100644 (file)
@@ -549,6 +549,7 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, bpy.types.Panel):
         col = split.column()
         col.prop(mat, "alpha")
         col.prop(mat, "diffuse_color", text="")
+        col.prop(halo, "seed")
 
         col = split.column()
         col.prop(halo, "size")
index 5c7882e97229e4546e1df9fb304f983dc87da2fd..bce6ab993a7fd8a3fa5745a6beaffe7de7684f92 100644 (file)
@@ -157,6 +157,8 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, bpy.types.Panel):
         col = split.column()
         col.prop(cloth, "collision_quality", slider=True, text="Quality")
         col.prop(cloth, "distance_min", slider=True, text="Distance")
+        col.prop(cloth, "repel_force", slider=True, text="Repel")
+        col.prop(cloth, "distance_repel", slider=True, text="Repel Distance")
         col.prop(cloth, "friction")
 
         col = split.column()
index bc0dbc3c170456aba2cda93f0728894835080791..01890bc3c99d0de455187eeda020ff178d25af44 100644 (file)
@@ -721,6 +721,15 @@ class TEXTURE_PT_pointdensity(TextureButtonsPanel, bpy.types.Panel):
         col.prop(pd, "falloff", text="")
         if pd.falloff == 'SOFT':
             col.prop(pd, "falloff_soft")
+        if pd.falloff == "PARTICLE_VELOCITY":
+            col.prop(pd, "falloff_speed_scale")
+
+        col.prop(pd, "use_falloff_curve")
+
+        if pd.use_falloff_curve:
+            col = layout.column()
+            col.label(text="Falloff Curve")
+            col.template_curve_mapping(pd, "falloff_curve", brush=False)
 
 
 class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel, bpy.types.Panel):
index f3b78de813cd7379c16357a787ccb7ea644baa14..77583b8082476aa173f13d4a74aceb5c28c21e0c 100644 (file)
@@ -91,7 +91,7 @@ class IMAGE_MT_select(bpy.types.Menu):
         layout.separator()
 
         layout.operator("uv.select_all")
-        layout.operator("uv.select_inverse")
+        layout.operator("uv.select_all", text="Inverse").action = 'INVERT'
         layout.operator("uv.unlink_selected")
 
         layout.separator()
@@ -263,7 +263,7 @@ class IMAGE_MT_uvs(bpy.types.Menu):
         layout.operator("uv.average_islands_scale")
         layout.operator("uv.minimize_stretch")
         layout.operator("uv.stitch")
-        layout.operator("mesh.faces_miror_uv")
+        layout.operator("mesh.faces_mirror_uv")
 
         layout.separator()
 
@@ -370,10 +370,7 @@ class IMAGE_HT_header(bpy.types.Header):
             layout.prop(toolsettings, "use_uv_select_sync", text="")
 
             if toolsettings.use_uv_select_sync:
-                row = layout.row(align=True)
-                row.prop(toolsettings, "mesh_select_mode", text="", index=0, icon='VERTEXSEL')
-                row.prop(toolsettings, "mesh_select_mode", text="", index=1, icon='EDGESEL')
-                row.prop(toolsettings, "mesh_select_mode", text="", index=2, icon='FACESEL')
+                layout.template_edit_mode_selection()
             else:
                 layout.prop(toolsettings, "uv_select_mode", text="", expand=True)
                 layout.prop(uvedit, "sticky_select_mode", text="", icon_only=True)
index 7ae2efb369694b203c7bf3a860b5cb2cc30769ed..bf396e98c79b371d6a61d5266d815cdc8841809c 100644 (file)
@@ -1103,7 +1103,8 @@ class WM_OT_addon_install(bpy.types.Operator):
         del pyfile_dir
         # done checking for exceptional case
 
-        contents = set(os.listdir(path_addons))
+        addon_files_old = set(os.listdir(path_addons))
+        addons_old = {mod.__name__ for mod in addon_utils.modules(USERPREF_PT_addons._addons_fake_modules)}
 
         #check to see if the file is in compressed format (.zip)
         if zipfile.is_zipfile(pyfile):
@@ -1152,11 +1153,13 @@ class WM_OT_addon_install(bpy.types.Operator):
                 traceback.print_exc()
                 return {'CANCELLED'}
 
+        addons_new = {mod.__name__ for mod in addon_utils.modules(USERPREF_PT_addons._addons_fake_modules)} - addons_old
+        addons_new.discard("modules")
+
         # disable any addons we may have enabled previously and removed.
         # this is unlikely but do just incase. bug [#23978]
-        addons_new = set(os.listdir(path_addons)) - contents
         for new_addon in addons_new:
-            addon_utils.disable(os.path.splitext(new_addon)[0])
+            addon_utils.disable(new_addon)
 
         # possible the zip contains multiple addons, we could disallow this
         # but for now just use the first
@@ -1169,6 +1172,9 @@ class WM_OT_addon_install(bpy.types.Operator):
                 context.window_manager.addon_search = info["name"]
                 break
 
+        # incase a new module path was created to install this addon.
+        bpy.utils.refresh_script_paths()
+
         # TODO, should not be a warning.
         # self.report({'WARNING'}, "File installed to '%s'\n" % path_dest)
         return {'FINISHED'}
index 2fbaae499e7ccfea5f8dded7b22cbc8a21fc35f0..378fe2310915ce1455045d250c89d726f3987f00 100644 (file)
@@ -555,13 +555,7 @@ class WM_OT_keyconfig_import(bpy.types.Operator):
 
         config_name = basename(self.filepath)
 
-        path = bpy.utils.preset_paths("keyconfig")[0]  # we need some way to tell the user and system preset path
-        print(path)
-
-        # create config folder if needed
-        if not os.path.exists(path):
-            os.mkdir(path)
-
+        path = bpy.utils.user_resource('SCRIPTS', os.path.join("presets", "keyconfig"), create=True)
         path = os.path.join(path, config_name)
 
         if self.keep_original:
index 2eaac42cf354649ee03cf8b5601469e53e37648c..7d31bc39b0a96f8b809987e583b17986ce5dfef7 100644 (file)
@@ -851,10 +851,15 @@ class VIEW3D_MT_object_apply(bpy.types.Menu):
     def draw(self, context):
         layout = self.layout
 
-        layout.operator("object.location_apply", text="Location")
-        layout.operator("object.rotation_apply", text="Rotation")
-        layout.operator("object.scale_apply", text="Scale")
+        layout.operator("object.transform_apply", text="Location").location = True
+        layout.operator("object.transform_apply", text="Rotation").rotation = True
+        layout.operator("object.transform_apply", text="Scale").scale = True
+        props = layout.operator("object.transform_apply", text="Rotation & Scale")
+        props.scale = True
+        props.rotation = True
+
         layout.separator()
+
         layout.operator("object.visual_transform_apply", text="Visual Transform")
         layout.operator("object.duplicates_make_real")
 
index bd258fa18f62021d43cd1307d46096f90411b337..a6db6fbdde85b4eb35260e9dc85c8c90907858ac 100644 (file)
@@ -946,26 +946,21 @@ class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel):
         sculpt = tool_settings.sculpt
         settings = __class__.paint_settings(context)
 
-        split = layout.split()
-
-        col = split.column()
-
-        col.prop(sculpt, "use_threaded", text="Threaded Sculpt")
-        col.prop(sculpt, "show_low_resolution")
-        col.prop(sculpt, "show_brush")
-
-        col.label(text="Unified Settings:")
-        col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
-        col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
-
-        col = split.column()
-
-        col.label(text="Lock:")
-        row = col.row(align=True)
+        layout.label(text="Lock:")
+        row = layout.row(align=True)
         row.prop(sculpt, "lock_x", text="X", toggle=True)
         row.prop(sculpt, "lock_y", text="Y", toggle=True)
         row.prop(sculpt, "lock_z", text="Z", toggle=True)
 
+        layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
+        layout.prop(sculpt, "show_low_resolution")
+        layout.prop(sculpt, "show_brush")
+        layout.prop(sculpt, "use_deform_only")
+
+        layout.label(text="Unified Settings:")
+        layout.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
+        layout.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
+
 
 class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel):
     bl_label = "Symmetry"
index af359517e405793da700b95bcd36853680b1d5a9..1b1c90c8a21ae1a4833692cf86d22e6b4b67a698 100644 (file)
@@ -17,7 +17,7 @@ from bpy.props import StringProperty, BoolProperty, EnumProperty
 
 
 class ExportSomeData(bpy.types.Operator, ExportHelper):
-    '''This appiers in the tooltip of the operator and in the generated docs.'''
+    '''This appears in the tooltip of the operator and in the generated docs.'''
     bl_idname = "export.some_data"  # this is important since its how bpy.ops.export.some_data is constructed
     bl_label = "Export Some Data"
 
index 93b9cbc0bdf00e300102ec9aa0925c984e938a4f..57f8c83eda61963661a2820cb9d2e7ecaa65b022 100644 (file)
@@ -90,6 +90,14 @@ void BLF_boundbox(int fontid, const char *str, struct rctf *box);
 float BLF_width(int fontid, const char *str);
 float BLF_height(int fontid, const char *str);
 
+/*
+ * Return dimensions of the font without any sample text.
+ */
+float BLF_height_max(int fontid);
+float BLF_width_max(int fontid);
+float BLF_descender(int fontid);
+float BLF_ascender(int fontid);
+
 /*
  * The following function return the width and height of the string, but
  * just in one call, so avoid extra freetype2 stuff.
@@ -157,7 +165,7 @@ void BLF_shadow_offset(int fontid, int x, int y);
  *
  *     BLF_buffer(NULL, NULL, 0, 0, 0);
  */
-void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, unsigned int w, unsigned int h, int nch);
+void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch);
 
 /*
  * Set the color to be used for text.
index 930f55a48fae83e08fbf4f4a1deacaca7b334ce8..c0e62b1c0c70340d72bcf2b58efbebc2ecc8c33d 100644 (file)
@@ -580,6 +580,54 @@ float BLF_height(int fontid, const char *str)
        return(0.0f);
 }
 
+float BLF_height_max(int fontid)
+{
+       FontBLF *font;
+
+       font= BLF_get(fontid);
+       if (font) {
+               if(font->glyph_cache)
+                       return(font->glyph_cache->max_glyph_height);
+       }
+       return(0.0f);
+}
+
+float BLF_width_max(int fontid)
+{
+       FontBLF *font;
+
+       font= BLF_get(fontid);
+       if (font) {
+               if(font->glyph_cache)
+                       return(font->glyph_cache->max_glyph_width);
+       }
+       return(0.0f);
+}
+
+float BLF_descender(int fontid)
+{
+       FontBLF *font;
+
+       font= BLF_get(fontid);
+       if (font) {
+               if(font->glyph_cache)
+                       return(font->glyph_cache->descender);
+       }
+       return(0.0f);
+}
+
+float BLF_ascender(int fontid)
+{
+       FontBLF *font;
+
+       font= BLF_get(fontid);
+       if (font) {
+               if(font->glyph_cache)
+                       return(font->glyph_cache->ascender);
+       }
+       return(0.0f);
+}
+
 float BLF_height_default(const char *str)
 {
        float height;
@@ -657,7 +705,7 @@ void BLF_shadow_offset(int fontid, int x, int y)
        }
 }
 
-void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, unsigned int w, unsigned int h, int nch)
+void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch)
 {
        FontBLF *font;
 
index 80d0a48954a0063fc251368a55adf74ea03ba255..708b3708ab7fbcd12b20779324098d98f95cd3f9 100644 (file)
@@ -218,7 +218,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
        FT_Vector delta;
        FT_UInt glyph_index;
        float a, *fbuf;
-       int pen_x, y, x, yb;
+       int pen_x, y, x;
        int i, has_kerning, st, chx, chy;
 
        if (!font->glyph_cache || (!font->b_fbuf && !font->b_cbuf))
@@ -276,13 +276,20 @@ void blf_font_buffer(FontBLF *font, const char *str)
                        /* dont draw beyond the buffer bounds */
                        int width_clip= g->width;
                        int height_clip= g->height;
+                       int yb_start= g->pitch < 0 ? 0 : g->height-1;
 
                        if (width_clip + chx > font->bw)        width_clip  -= chx + width_clip - font->bw;
                        if (height_clip + pen_y > font->bh) height_clip -= pen_y + height_clip - font->bh;
-
-                       yb= g->pitch < 0 ? 0 : g->height-1;
                        
+                       /* drawing below the image? */
+                       if(pen_y < 0) {
+                               yb_start += (g->pitch < 0) ? -pen_y : pen_y;
+                               height_clip += pen_y;
+                               pen_y= 0;
+                       }
+
                        if (font->b_fbuf) {
+                               int yb= yb_start;
                                for (y=(chy >= 0 ? 0:-chy); y < height_clip; y++) {
                                        for (x=(chx >= 0 ? 0:-chx); x < width_clip; x++) {
                                                
@@ -311,6 +318,7 @@ void blf_font_buffer(FontBLF *font, const char *str)
                        }
 
                        if (font->b_cbuf) {
+                               int yb= yb_start;
                                for (y= 0; y < height_clip; y++) {
                                        for (x= 0; x < width_clip; x++) {
                                                a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
index deb13006eafb11a9b249c8352ed27931b26bdcf7..c4e192626e870f08b56166f062c42e6dc90166b1 100644 (file)
@@ -200,9 +200,9 @@ typedef struct FontBLF {
        /* the same but unsigned char */
        unsigned char *b_cbuf;
 
-       /* buffer size. */
-       unsigned int bw;
-       unsigned int bh;
+       /* buffer size, keep signed so comparisons with negative values work */
+       int bw;
+       int bh;
 
        /* number of channels. */
        int bch;
index 1ee51cd2122db196a2dc1559a3da1921a6ee341f..a5c88000db2c251e68e8db2e2cd49061c5f0a69b 100644 (file)
@@ -35,6 +35,7 @@
  */
 
 #include <float.h>
+#include "BLI_math_inline.h"
 
 struct Object;
 struct ListBase;
@@ -44,16 +45,7 @@ struct DerivedMesh;
 struct ClothModifierData;
 struct CollisionTree;
 
-// this is needed for inlining behaviour
-#if defined _WIN32
-#   define DO_INLINE __inline
-#elif defined (__sgi)
-#   define DO_INLINE
-#elif defined (__sun) || defined (__sun__)
-#   define DO_INLINE
-#else
-#   define DO_INLINE static inline
-#endif
+#define DO_INLINE MALWAYS_INLINE
 
 #define CLOTH_MAX_THREAD 2
 
index b54d4275719729ba2480ab0ad6487c274d3dfd68..4048ee2f457e6bf5cc7f60eb0f09c6c9806afa2a 100644 (file)
@@ -63,7 +63,11 @@ struct LinkNode;
 /* COLLISION FLAGS */
 typedef enum
 {
-       COLLISION_IN_FUTURE = ( 1 << 1 ),
+       COLLISION_IN_FUTURE =           (1 << 1),
+#ifdef WITH_ELTOPO
+       COLLISION_USE_COLLFACE =        (1 << 2),
+       COLLISION_IS_EDGES =            (1 << 3),
+#endif
 } COLLISION_FLAGS;
 
 
@@ -81,7 +85,13 @@ typedef struct CollPair
        float pa[3], pb[3]; // collision point p1 on face1, p2 on face2
        int flag;
        float time; // collision time, from 0 up to 1
+#ifdef WITH_ELTOPO /*either ap* or bp* can be set, but not both*/
+       float bary[3];
+       int ap1, ap2, ap3, collp, bp1, bp2, bp3;
+       int collface;
+#else
        int ap1, ap2, ap3, bp1, bp2, bp3;
+#endif
        int pointsb[4];
 }
 CollPair;
@@ -109,6 +119,7 @@ typedef struct FaceCollPair
        float pa[3], pb[3]; // collision point p1 on face1, p2 on face2
 }
 FaceCollPair;
+
 ////////////////////////////////////////
 
 
index 8f0ce8c1660566e08c2a22234a99388df880ebd3..10910493ec94d467633adce0268ed8ae6dd11d15 100644 (file)
@@ -44,14 +44,16 @@ struct ImBuf;
 struct Tex;
 struct anim;
 struct Scene;
+struct Object;
 
 /* call from library */
 void   free_image(struct Image *me);
 
-void   BKE_stamp_info(struct Scene *scene, struct ImBuf *ibuf);
-void   BKE_stamp_buf(struct Scene *scene, unsigned char *rect, float *rectf, int width, int height, int channels);
+void   BKE_stamp_info(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf);
+void   BKE_stamp_buf(struct Scene *scene, struct Object *camera, unsigned char *rect, float *rectf, int width, int height, int channels);
 int            BKE_alphatest_ibuf(struct ImBuf *ibuf);
-int            BKE_write_ibuf(struct Scene *scene, struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
+int            BKE_write_ibuf_stamp(struct Scene *scene, struct Object *camera, struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
+int            BKE_write_ibuf(struct ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality);
 void   BKE_makepicstring(char *string, const char *base, int frame, int imtype, const short use_ext, const short use_frames);
 int            BKE_add_image_extension(char *string, int imtype);
 int            BKE_ftype_to_imtype(int ftype);
@@ -131,6 +133,7 @@ void BKE_image_assign_ibuf(struct Image *ima, struct ImBuf *ibuf);
 
 /* called on frame change or before render */
 void BKE_image_user_calc_frame(struct ImageUser *iuser, int cfra, int fieldnr);
+int BKE_image_user_get_frame(const struct ImageUser *iuser, int cfra, int fieldnr);
 
 /* fix things in ImageUser when new image gets assigned */
 void BKE_image_user_new_image(struct Image *ima, struct ImageUser *iuser);
index 42786e1c9bec9136f14ec31a3ad078cee9508a5e..57829e957f7793d1a7ba85b02de171559f4edd17 100644 (file)
@@ -330,7 +330,7 @@ struct Sequence *sequencer_add_sound_strip(struct bContext *C, ListBase *seqbase
 struct Sequence *sequencer_add_movie_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load);
 
 /* view3d draw callback, run when not in background view */
-typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, int, int, unsigned int, int, char[256]);
+typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, struct Object *, int, int, unsigned int, int, char[256]);
 extern SequencerDrawView sequencer_view3d_cb;
 
 /* copy/paste */
index 937a46d68dd947dbf24bde4b5f9e6e59b273e2e0..d1fef8b0ce11186456156d3c3b2278bf79b31eb0 100644 (file)
@@ -90,7 +90,7 @@ void space_transform_invert(const struct SpaceTransform *data, float *co);
  *    - Normal projection
  *
  * ShrinkwrapCalcData encapsulates all needed data for shrinkwrap functions.
- * (So that you dont have to pass an enormous ammount of arguments to functions)
+ * (So that you dont have to pass an enormous amount of arguments to functions)
  */
 
 struct Object;
index 47d393559f4319d94377869d3ef017bb1524a4ba..ca551e1634a6d6cb0ebd28c2d503086e6a410085 100644 (file)
@@ -145,7 +145,7 @@ set(SRC
        intern/writeavi.c
        intern/writeffmpeg.c
        intern/writeframeserver.c
-
+       
        BKE_DerivedMesh.h
        BKE_action.h
        BKE_anim.h
@@ -240,6 +240,11 @@ if(WITH_BULLET)
        add_definitions(-DUSE_BULLET)
 endif()
 
+if(WITH_MOD_CLOTH_ELTOPO)
+       list(APPEND INC ../../../extern/eltopo)
+       add_definitions(-DWITH_ELTOPO)
+endif()
+
 if(WITH_IMAGE_OPENEXR)
        add_definitions(-DWITH_OPENEXR)
 endif()
@@ -282,6 +287,10 @@ endif()
 if(WITH_PYTHON)
        list(APPEND INC ../python ${PYTHON_INCLUDE_DIRS})
        add_definitions(-DWITH_PYTHON)
+
+       if(WITH_PYTHON_SECURITY)
+               add_definitions(-DWITH_PYTHON_SECURITY)
+       endif()
 endif()
 
 if(WITH_OPENMP)
index bef72d3bf67234cf6678fa8c1a5bf5995fe7bb92..dc327abd3adbb01c9c516394cf271d7ae7c48510 100644 (file)
@@ -27,6 +27,10 @@ if env['WITH_BF_PYTHON']:
     if env['BF_DEBUG']:
         defs.append('DEBUG')
 
+if env['WITH_BF_ELTOPO']:
+    incs += ' ../../../extern/eltopo'
+    defs.append('WITH_ELTOPO')
+        
 if env['WITH_BF_QUICKTIME']:
     incs += ' ../quicktime'
 
index 7d3219d917e3879019187be57402fc2ea1bad35b..d9c98bc0200af2a4e782ec1b32add26497d7370e 100644 (file)
@@ -1772,11 +1772,20 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
                        modifier_setError(md, "Modifier requires original data, bad stack position.");
                        continue;
                }
-               if(sculpt_mode && (!has_multires || multires_applied))
-                       if(mti->type != eModifierTypeType_OnlyDeform || multires_applied) {
+               if(sculpt_mode && (!has_multires || multires_applied)) {
+                       int unsupported= 0;
+
+                       if(scene->toolsettings->sculpt->flags & SCULPT_ONLY_DEFORM)
+                               unsupported|= mti->type != eModifierTypeType_OnlyDeform;
+
+                       unsupported|= md->type == eModifierType_Multires && ((MultiresModifierData*)md)->sculptlvl==0;
+                       unsupported|= multires_applied;
+
+                       if(unsupported) {
                                modifier_setError(md, "Not supported in sculpt mode.");
                                continue;
                        }
+               }
                if(needMapping && !modifier_supportsMapping(md)) continue;
                if(useDeform < 0 && mti->dependsOnTime && mti->dependsOnTime(md)) continue;
 
@@ -1815,7 +1824,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
                         * to avoid giving bogus normals to the next modifier see: [#23673] */
                        if(isPrevDeform &&  mti->dependsOnNormals && mti->dependsOnNormals(md)) {
                                /* XXX, this covers bug #23673, but we may need normal calc for other types */
-                               if(dm->type == DM_TYPE_CDDM) {
+                               if(dm && dm->type == DM_TYPE_CDDM) {
                                        CDDM_apply_vert_coords(dm, deformedVerts);
                                        CDDM_calc_normals(dm);
                                }
index 058227e7cc35a120e91d4a633dd1977ba33929d8..5b49d9a9841204a94cc16cf8e3a67b1a69829ed4 100644 (file)
@@ -420,11 +420,11 @@ bPoseChannel *verify_pose_channel(bPose *pose, const char *name)
                return NULL;
        
        /* See if this channel exists */
-       for (chan=pose->chanbase.first; chan; chan=chan->next) {
-               if (!strcmp (name, chan->name))
-                       return chan;
+       chan= BLI_findstring(&pose->chanbase, name, offsetof(bPoseChannel, name));
+       if(chan) {
+               return chan;
        }
-       
+
        /* If not, create it and add it */
        chan = MEM_callocN(sizeof(bPoseChannel), "verifyPoseChannel");
        
index d1a181046a6c2cf47ebe166459188993cacc5480..75c6303d800dddbdfd81b7bfd91c4f85a6cba1ff 100644 (file)
@@ -140,8 +140,12 @@ void initglobals(void)
        G.charstart = 0x0000;
        G.charmin = 0x0000;
        G.charmax = 0xffff;
-       
+
+#ifndef WITH_PYTHON_SECURITY /* default */
        G.f |= G_SCRIPT_AUTOEXEC;
+#else
+       G.f &= ~G_SCRIPT_AUTOEXEC;
+#endif
 }
 
 /***/
@@ -615,24 +619,14 @@ void BKE_reset_undo(void)
 /* based on index nr it does a restore */
 void BKE_undo_number(bContext *C, int nr)
 {
-       UndoElem *uel;
-       int a=1;
-       
-       for(uel= undobase.first; uel; uel= uel->next, a++) {
-               if(a==nr) break;
-       }
-       curundo= uel;
+       curundo= BLI_findlink(&undobase, nr - 1);
        BKE_undo_step(C, 0);
 }
 
 /* go back to the last occurance of name in stack */
 void BKE_undo_name(bContext *C, const char *name)
 {
-       UndoElem *uel;
-
-       for(uel= undobase.last; uel; uel= uel->prev)
-               if(strcmp(name, uel->name)==0)
-                       break;
+       UndoElem *uel= BLI_rfindstring(&undobase, name, offsetof(UndoElem, name));
 
        if(uel && uel->prev) {
                curundo= uel->prev;
@@ -644,12 +638,7 @@ void BKE_undo_name(bContext *C, const char *name)
 int BKE_undo_valid(const char *name)
 {
        if(name) {
-               UndoElem *uel;
-               
-               for(uel= undobase.last; uel; uel= uel->prev)
-                       if(strcmp(name, uel->name)==0)
-                               break;
-               
+               UndoElem *uel= BLI_rfindstring(&undobase, name, offsetof(UndoElem, name));
                return uel && uel->prev;
        }
        
index 8bd650b1a423e25a41f293ffb348b72b710d4fc9..72ee9b55800ff13cc029f2d7d2982e16036fde3f 100644 (file)
@@ -231,19 +231,21 @@ static struct PBVH *cdDM_getPBVH(Object *ob, DerivedMesh *dm)
           this derivedmesh is just original mesh. it's the multires subsurf dm
           that this is actually for, to support a pbvh on a modified mesh */
        if(!cddm->pbvh && ob->type == OB_MESH) {
+               SculptSession *ss= ob->sculpt;
                Mesh *me= ob->data;
                cddm->pbvh = BLI_pbvh_new();
                cddm->pbvh_draw = can_pbvh_draw(ob, dm);
                BLI_pbvh_build_mesh(cddm->pbvh, me->mface, me->mvert,
                                   me->totface, me->totvert);
 
-               if(ob->sculpt->modifiers_active) {
+               if(ss->modifiers_active && ob->derivedDeform) {
+                       DerivedMesh *deformdm= ob->derivedDeform;
                        float (*vertCos)[3];
                        int totvert;
 
-                       totvert= dm->getNumVerts(dm);
+                       totvert= deformdm->getNumVerts(deformdm);
                        vertCos= MEM_callocN(3*totvert*sizeof(float), "cdDM_getPBVH vertCos");
-                       dm->getVertCos(dm, vertCos);
+                       deformdm->getVertCos(deformdm, vertCos);
                        BLI_pbvh_apply_vertCos(cddm->pbvh, vertCos);
                        MEM_freeN(vertCos);
                }
@@ -594,26 +596,26 @@ static void cdDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned cha
                                glBegin(glmode = new_glmode);
                        }
                                
-                       glColor3ub(cp1[0], cp1[1], cp1[2]);
+                       glColor3ubv(cp1+0);
                        glVertex3fv(mvert[mface->v1].co);
-                       glColor3ub(cp1[4], cp1[5], cp1[6]);
+                       glColor3ubv(cp1+4);
                        glVertex3fv(mvert[mface->v2].co);
-                       glColor3ub(cp1[8], cp1[9], cp1[10]);
+                       glColor3ubv(cp1+8);
                        glVertex3fv(mvert[mface->v3].co);
                        if(mface->v4) {
-                               glColor3ub(cp1[12], cp1[13], cp1[14]);
+                               glColor3ubv(cp1+12);
                                glVertex3fv(mvert[mface->v4].co);
                        }
                                
                        if(useTwoSided) {
-                               glColor3ub(cp2[8], cp2[9], cp2[10]);
+                               glColor3ubv(cp2+8);
                                glVertex3fv(mvert[mface->v3].co );
-                               glColor3ub(cp2[4], cp2[5], cp2[6]);
+                               glColor3ubv(cp2+4);
                                glVertex3fv(mvert[mface->v2].co );
-                               glColor3ub(cp2[0], cp2[1], cp2[2]);
+                               glColor3ubv(cp2+0);
                                glVertex3fv(mvert[mface->v1].co );
                                if(mface->v4) {
-                                       glColor3ub(cp2[12], cp2[13], cp2[14]);
+                                       glColor3ubv(cp2+12);
                                        glVertex3fv(mvert[mface->v4].co );
                                }
                        }
index 5eccf7242561e4b6a8069165c400b0a833f2b0be..ea055e90b45477df459c03ebc9faf66f51c2fbc9 100644 (file)
@@ -919,7 +919,7 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
        if(!first)
                implicit_set_positions(clmd);
 
-       clmd->clothObject->bvhtree = bvhtree_build_from_cloth ( clmd, clmd->coll_parms->epsilon );
+       clmd->clothObject->bvhtree = bvhtree_build_from_cloth ( clmd, MAX2(clmd->coll_parms->epsilon, clmd->coll_parms->distance_repel) );
        
        for(i = 0; i < dm->getNumVerts(dm); i++)
        {
index ebdbbfcf7b4a5d1d1ed0586b7d54ada3b0320600..e2a1b0dfb33e1277b3c10ae913ea75d57dd18bf4 100644 (file)
@@ -48,6 +48,9 @@
 #include "BLI_math.h"
 #include "BLI_edgehash.h"
 #include "BLI_utildefines.h"
+#include "BLI_ghash.h"
+#include "BLI_memarena.h"
+#include "BLI_rand.h"
 
 #include "BKE_DerivedMesh.h"
 #include "BKE_global.h"
 #include "BLI_kdopbvh.h"
 #include "BKE_collision.h"
 
+#ifdef WITH_ELTOPO
+#include "eltopo-capi.h"
+#endif
+
 
 /***********************************
 Collision modifier code start
@@ -486,7 +493,7 @@ DO_INLINE void collision_interpolateOnTriangle ( float to[3], float v1[3], float
        VECADDMUL ( to, v3, w3 );
 }
 
-
+#ifndef WITH_ELTOPO
 static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionModifierData *collmd, CollPair *collpair, CollPair *collision_end )
 {
        int result = 0;
@@ -601,12 +608,799 @@ static int cloth_collision_response_static ( ClothModifierData *clmd, CollisionM
        }
        return result;
 }
+#endif /* !WITH_ELTOPO */
+
+#ifdef WITH_ELTOPO
+typedef struct edgepairkey {
+       int a1, a2, b1, b2;
+} edgepairkey;
+
+unsigned int edgepair_hash(void *vkey)
+{
+       edgepairkey *key = vkey;
+       int keys[4] = {key->a1, key->a2, key->b1, key->b2};
+       int i, j;
+       
+       for (i=0; i<4; i++) {
+               for (j=0; j<3; j++) {
+                       if (keys[j] >= keys[j+1]) {
+                               SWAP(int, keys[j], keys[j+1]);
+                       }
+               }
+       }
+       
+       return keys[0]*101 + keys[1]*72 + keys[2]*53 + keys[3]*34;
+}
+
+int edgepair_cmp(const void *va, const void *vb)
+{
+       edgepairkey *a = va, *b = vb;
+       int keysa[4] = {a->a1, a->a2, a->b1, a->b2};
+       int keysb[4] = {b->a1, b->a2, b->b1, b->b2};
+       int i;
+       
+       for (i=0; i<4; i++) {
+               int j, ok=0;
+               for (j=0; j<4; j++) {
+                       if (keysa[i] == keysa[j]) {
+                               ok = 1;
+                               break;
+                       }
+               }
+               if (!ok)
+                       return -1;
+       }
+       
+       return 0;
+}
+
+static void get_edgepairkey(edgepairkey *key, int a1, int a2, int b1, int b2)
+{
+       key->a1 = a1;
+       key->a2 = a2;
+       key->b1 = b1;
+       key->b2 = b2;
+}
+
+/*an immense amount of duplication goes on here. . .a major performance hit, I'm sure*/
+static CollPair* cloth_edge_collision ( ModifierData *md1, ModifierData *md2, 
+                                                                               BVHTreeOverlap *overlap, CollPair *collpair,
+                                                                               GHash *visithash, MemArena *arena)
+{
+       ClothModifierData *clmd = ( ClothModifierData * ) md1;
+       CollisionModifierData *collmd = ( CollisionModifierData * ) md2;
+       MFace *face1=NULL, *face2 = NULL;
+       ClothVertex *verts1 = clmd->clothObject->verts;
+       double distance = 0;
+       edgepairkey *key, tstkey;
+       float epsilon1 = clmd->coll_parms->epsilon;
+       float epsilon2 = BLI_bvhtree_getepsilon ( collmd->bvhtree );
+       float no[3], uv[3], t, relnor;
+       int i, i1, i2, i3, i4, i5, i6;
+       Cloth *cloth = clmd->clothObject;
+       float n1[3], n2[3], off[3], v1[2][3], v2[2][3], v3[2][3], v4[2][3], v5[2][3], v6[2][3];
+       void **verts[] = {v1, v2, v3, v4, v5, v6};
+       int j, ret, bp1, bp2, bp3, ap1, ap2, ap3, table[6];
+       
+       face1 = & ( clmd->clothObject->mfaces[overlap->indexA] );
+       face2 = & ( collmd->mfaces[overlap->indexB] );
+
+       // check all 4 possible collisions
+       for ( i = 0; i < 4; i++ )
+       {
+               if ( i == 0 )
+               {
+                       // fill faceA
+                       ap1 = face1->v1;
+                       ap2 = face1->v2;
+                       ap3 = face1->v3;
+
+                       // fill faceB
+                       bp1 = face2->v1;
+                       bp2 = face2->v2;
+                       bp3 = face2->v3;
+               }
+               else if ( i == 1 )
+               {
+                       if ( face1->v4 )
+                       {
+                               // fill faceA
+                               ap1 = face1->v1;
+                               ap2 = face1->v3;
+                               ap3 = face1->v4;
+
+                               // fill faceB
+                               bp1 = face2->v1;
+                               bp2 = face2->v2;
+                               bp3 = face2->v3;
+                       }
+                       else {
+                               continue;
+                       }
+               }
+               if ( i == 2 )
+               {
+                       if ( face2->v4 )
+                       {
+                               // fill faceA
+                               ap1 = face1->v1;
+                               ap2 = face1->v2;
+                               ap3 = face1->v3;
+
+                               // fill faceB
+                               bp1 = face2->v1;
+                               bp2 = face2->v3;
+                               bp3 = face2->v4;
+                       }
+                       else {
+                               continue;
+                       }
+               }
+               else if ( i == 3 )
+               {
+                       if ( face1->v4 && face2->v4 )
+                       {
+                               // fill faceA
+                               ap1 = face1->v1;
+                               ap2 = face1->v3;
+                               ap3 = face1->v4;
+
+                               // fill faceB
+                               bp1 = face2->v1;
+                               bp2 = face2->v3;
+                               bp3 = face2->v4;
+                       }
+                       else {
+                               continue;
+                       }
+               }
+               
+               copy_v3_v3(v1[0], cloth->verts[ap1].txold); 
+               copy_v3_v3(v1[1], cloth->verts[ap1].tx);
+               copy_v3_v3(v2[0], cloth->verts[ap2].txold);
+               copy_v3_v3(v2[1], cloth->verts[ap2].tx);
+               copy_v3_v3(v3[0], cloth->verts[ap3].txold);
+               copy_v3_v3(v3[1], cloth->verts[ap3].tx);
+               
+               copy_v3_v3(v4[0], collmd->current_x[bp1].co);
+               copy_v3_v3(v4[1], collmd->current_xnew[bp1].co);
+               copy_v3_v3(v5[0], collmd->current_x[bp2].co);
+               copy_v3_v3(v5[1], collmd->current_xnew[bp2].co);
+               copy_v3_v3(v6[0], collmd->current_x[bp3].co);
+               copy_v3_v3(v6[1], collmd->current_xnew[bp3].co);
+               
+               normal_tri_v3(n2, v4[1], v5[1], v6[1]);
+
+               /*offset new positions a bit, to account for margins*/
+               i1 = ap1; i2 = ap2; i3 = ap3;
+               i4 = bp1; i5 = bp2; i6 = bp3;
+
+               for (j=0; j<3; j++) {
+                       int collp1, collp2, k, j2 = (j+1)%3;
+                       
+                       table[0] = ap1; table[1] = ap2; table[2] = ap3;
+                       table[3] = bp1; table[4] = bp2; table[5] = bp3;
+                       for (k=0; k<3; k++) {
+                               float p1[3], p2[3];
+                               int k2 = (k+1)%3;
+                               
+                               get_edgepairkey(&tstkey, table[j], table[j2], table[k+3], table[k2+3]);
+                               //if (BLI_ghash_haskey(visithash, &tstkey))
+                               //      continue;
+                               
+                               key = BLI_memarena_alloc(arena, sizeof(edgepairkey));
+                               *key = tstkey;
+                               BLI_ghash_insert(visithash, key, NULL);
+
+                               sub_v3_v3v3(p1, verts[j], verts[j2]);
+                               sub_v3_v3v3(p2, verts[k+3], verts[k2+3]);
+                               
+                               cross_v3_v3v3(off, p1, p2);
+                               normalize_v3(off);
+
+                               if (dot_v3v3(n2, off) < 0.0)
+                                       negate_v3(off);
+                               
+                               mul_v3_fl(off,  epsilon1 + epsilon2 + ALMOST_ZERO);
+                               copy_v3_v3(p1, verts[k+3]);
+                               copy_v3_v3(p2, verts[k2+3]);
+                               add_v3_v3(p1, off);
+                               add_v3_v3(p2, off);
+                               
+                               ret = eltopo_line_line_moving_isect_v3v3_f(verts[j], table[j], verts[j2], table[j2], 
+                                                                                                                  p1, table[k+3], p2, table[k2+3], 
+                                                                                                                  no, uv, &t, &relnor);
+                               /*cloth vert versus coll face*/
+                               if (ret) {
+                                       collpair->ap1 = table[j]; collpair->ap2 = table[j2]; 
+                                       collpair->bp1 = table[k+3]; collpair->bp2 = table[k2+3];
+                                       
+                                       /*I'm not sure if this is correct, but hopefully it's 
+                                         better then simply ignoring back edges*/
+                                       if (dot_v3v3(n2, no) < 0.0) {
+                                               negate_v3(no);
+                                       }
+                                       
+                                       copy_v3_v3(collpair->normal, no);
+                                       mul_v3_v3fl(collpair->vector, collpair->normal, relnor);
+                                       collpair->distance = relnor;
+                                       collpair->time = t;
+                                       
+                                       copy_v2_v2(collpair->bary, uv);
+                                       
+                                       collpair->flag = COLLISION_IS_EDGES;
+                                       collpair++;
+                               }
+                       }
+               }
+       }
+       
+       return collpair;
+}
+
+static int cloth_edge_collision_response_moving ( ClothModifierData *clmd, CollisionModifierData *collmd, CollPair *collpair, CollPair *collision_end )
+{
+       int result = 0;
+       Cloth *cloth1;
+       float w1, w2;
+       float v1[3], v2[3], relativeVelocity[3];
+       float magrelVel, pimpulse[3];
+
+       cloth1 = clmd->clothObject;
+
+       for ( ; collpair != collision_end; collpair++ )
+       {
+               if (!(collpair->flag & COLLISION_IS_EDGES))
+                       continue;
+               
+               // was: txold
+               w1 = collpair->bary[0]; w2 = collpair->bary[1];                 
+               
+               // Calculate relative "velocity".
+               VECADDFAC(v1, cloth1->verts[collpair->ap1].tv, cloth1->verts[collpair->ap2].tv, w1);
+               VECADDFAC(v2, collmd->current_v[collpair->bp1].co, collmd->current_v[collpair->bp2].co, w2);
+               
+               VECSUB ( relativeVelocity, v2, v1);
+               
+               // Calculate the normal component of the relative velocity (actually only the magnitude - the direction is stored in 'normal').
+               magrelVel = INPR ( relativeVelocity, collpair->normal );
+
+               // If v_n_mag < 0 the edges are approaching each other.
+               if ( magrelVel > ALMOST_ZERO )
+               {
+                       // Calculate Impulse magnitude to stop all motion in normal direction.
+                       float magtangent = 0, repulse = 0, d = 0;
+                       double impulse = 0.0;
+                       float vrel_t_pre[3];
+                       float temp[3], spf;
+                       
+                       zero_v3(pimpulse);
+                       
+                       // calculate tangential velocity
+                       VECCOPY ( temp, collpair->normal );
+                       mul_v3_fl( temp, magrelVel );
+                       VECSUB ( vrel_t_pre, relativeVelocity, temp );
+
+                       // Decrease in magnitude of relative tangential velocity due to coulomb friction
+                       // in original formula "magrelVel" should be the "change of relative velocity in normal direction"
+                       magtangent = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel,sqrt ( INPR ( vrel_t_pre,vrel_t_pre ) ) );
+
+                       // Apply friction impulse.
+                       if ( magtangent > ALMOST_ZERO )
+                       {
+                               normalize_v3( vrel_t_pre );
+
+                               impulse = magtangent; 
+                               VECADDMUL ( pimpulse, vrel_t_pre, impulse);
+                       }
+
+                       // Apply velocity stopping impulse
+                       // I_c = m * v_N / 2.0
+                       // no 2.0 * magrelVel normally, but looks nicer DG
+                       impulse =  magrelVel;
+                       
+                       mul_v3_fl(collpair->normal, 0.5);
+                       VECADDMUL ( pimpulse, collpair->normal, impulse);
+
+                       // Apply repulse impulse if distance too short
+                       // I_r = -min(dt*kd, m(0,1d/dt - v_n))
+                       spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale;
+
+                       d = collpair->distance;
+                       if ( ( magrelVel < 0.1*d*spf && ( d > ALMOST_ZERO ) ) )
+                       {
+                               repulse = MIN2 ( d*1.0/spf, 0.1*d*spf - magrelVel );
+
+                               // stay on the safe side and clamp repulse
+                               if ( impulse > ALMOST_ZERO )
+                                       repulse = MIN2 ( repulse, 5.0*impulse );
+                               repulse = MAX2 ( impulse, repulse );
+
+                               impulse = repulse / ( 5.0 ); // original 2.0 / 0.25
+                               VECADDMUL ( pimpulse, collpair->normal, impulse);
+                       }
+                       
+                       w2 = 1.0f-w1;
+                       if (w1 < 0.5)
+                               w1 *= 2.0;
+                       else
+                               w2 *= 2.0;
+                       
+                       VECADDFAC(cloth1->verts[collpair->ap1].impulse, cloth1->verts[collpair->ap1].impulse, pimpulse, w1*2.0);
+                       VECADDFAC(cloth1->verts[collpair->ap2].impulse, cloth1->verts[collpair->ap2].impulse, pimpulse, w2*2.0);
+                       
+                       cloth1->verts[collpair->ap1].impulse_count++;
+                       cloth1->verts[collpair->ap2].impulse_count++;
+                       
+                       result = 1;
+               }
+       } 
+       
+       return result;
+}
+
+static int cloth_collision_response_moving ( ClothModifierData *clmd, CollisionModifierData *collmd, CollPair *collpair, CollPair *collision_end )
+{
+       int result = 0;
+       Cloth *cloth1;
+       float w1, w2, w3, u1, u2, u3;
+       float v1[3], v2[3], relativeVelocity[3];
+       float magrelVel;
+       float epsilon2 = BLI_bvhtree_getepsilon ( collmd->bvhtree );
+       
+       cloth1 = clmd->clothObject;
+
+       for ( ; collpair != collision_end; collpair++ )
+       {
+               if (collpair->flag & COLLISION_IS_EDGES)
+                       continue;
+               
+               if ( collpair->flag & COLLISION_USE_COLLFACE ) {
+                       // was: txold
+                       w1 = collpair->bary[0]; w2 = collpair->bary[1]; w3 = collpair->bary[2];                 
+
+                       // Calculate relative "velocity".
+                       collision_interpolateOnTriangle ( v1, collmd->current_v[collpair->bp1].co, collmd->current_v[collpair->bp2].co, collmd->current_v[collpair->bp3].co, w1, w2, w3);
+                       
+                       VECSUB ( relativeVelocity, v1, cloth1->verts[collpair->collp].tv);
+                       
+                       // Calculate the normal component of the relative velocity (actually only the magnitude - the direction is stored in 'normal').
+                       magrelVel = INPR ( relativeVelocity, collpair->normal );
+       
+                       // If v_n_mag < 0 the edges are approaching each other.
+                       if ( magrelVel > ALMOST_ZERO )
+                       {
+                               // Calculate Impulse magnitude to stop all motion in normal direction.
+                               float magtangent = 0, repulse = 0, d = 0;
+                               double impulse = 0.0;
+                               float vrel_t_pre[3];
+                               float temp[3], spf;
+       
+                               // calculate tangential velocity
+                               VECCOPY ( temp, collpair->normal );
+                               mul_v3_fl( temp, magrelVel );
+                               VECSUB ( vrel_t_pre, relativeVelocity, temp );
+       
+                               // Decrease in magnitude of relative tangential velocity due to coulomb friction
+                               // in original formula "magrelVel" should be the "change of relative velocity in normal direction"
+                               magtangent = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel,sqrt ( INPR ( vrel_t_pre,vrel_t_pre ) ) );
+       
+                               // Apply friction impulse.
+                               if ( magtangent > ALMOST_ZERO )
+                               {
+                                       normalize_v3( vrel_t_pre );
+       
+                                       impulse = magtangent; // 2.0 * 
+                                       VECADDMUL ( cloth1->verts[collpair->collp].impulse, vrel_t_pre, impulse);
+                               }
+       
+                               // Apply velocity stopping impulse
+                               // I_c = m * v_N / 2.0
+                               // no 2.0 * magrelVel normally, but looks nicer DG
+                               impulse =  magrelVel/2.0;
+       
+                               VECADDMUL ( cloth1->verts[collpair->collp].impulse, collpair->normal, impulse);
+                               cloth1->verts[collpair->collp].impulse_count++;
+       
+                               // Apply repulse impulse if distance too short
+                               // I_r = -min(dt*kd, m(0,1d/dt - v_n))
+                               spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale;
+       
+                               d = -collpair->distance;
+                               if ( ( magrelVel < 0.1*d*spf ) && ( d > ALMOST_ZERO ) )
+                               {
+                                       repulse = MIN2 ( d*1.0/spf, 0.1*d*spf - magrelVel );
+       
+                                       // stay on the safe side and clamp repulse
+                                       if ( impulse > ALMOST_ZERO )
+                                               repulse = MIN2 ( repulse, 5.0*impulse );
+                                       repulse = MAX2 ( impulse, repulse );
+       
+                                       impulse = repulse / ( 5.0 ); // original 2.0 / 0.25
+                                       VECADDMUL ( cloth1->verts[collpair->collp].impulse, collpair->normal, impulse);
+                               }
+       
+                               result = 1;
+                       }
+               } else {        
+                       w1 = collpair->bary[0]; w2 = collpair->bary[1]; w3 = collpair->bary[2];                 
+
+                       // Calculate relative "velocity".
+                       collision_interpolateOnTriangle ( v1, cloth1->verts[collpair->ap1].tv, cloth1->verts[collpair->ap2].tv, cloth1->verts[collpair->ap3].tv, w1, w2, w3 );
+       
+                       VECSUB ( relativeVelocity, collmd->current_v[collpair->collp].co, v1);
+                       
+                       // Calculate the normal component of the relative velocity (actually only the magnitude - the direction is stored in 'normal').
+                       magrelVel = INPR ( relativeVelocity, collpair->normal );
+       
+                       // If v_n_mag < 0 the edges are approaching each other.
+                       if ( magrelVel > ALMOST_ZERO )
+                       {
+                               // Calculate Impulse magnitude to stop all motion in normal direction.
+                               float magtangent = 0, repulse = 0, d = 0;
+                               double impulse = 0.0;
+                               float vrel_t_pre[3], pimpulse[3] = {0.0f, 0.0f, 0.0f};
+                               float temp[3], spf;
+       
+                               // calculate tangential velocity
+                               VECCOPY ( temp, collpair->normal );
+                               mul_v3_fl( temp, magrelVel );
+                               VECSUB ( vrel_t_pre, relativeVelocity, temp );
+       
+                               // Decrease in magnitude of relative tangential velocity due to coulomb friction
+                               // in original formula "magrelVel" should be the "change of relative velocity in normal direction"
+                               magtangent = MIN2 ( clmd->coll_parms->friction * 0.01 * magrelVel,sqrt ( INPR ( vrel_t_pre,vrel_t_pre ) ) );
+       
+                               // Apply friction impulse.
+                               if ( magtangent > ALMOST_ZERO )
+                               {
+                                       normalize_v3( vrel_t_pre );
+       
+                                       impulse = magtangent; // 2.0 * 
+                                       VECADDMUL ( pimpulse, vrel_t_pre, impulse);
+                               }
+       
+                               // Apply velocity stopping impulse
+                               // I_c = m * v_N / 2.0
+                               // no 2.0 * magrelVel normally, but looks nicer DG
+                               impulse =  magrelVel/2.0;
+       
+                               VECADDMUL ( pimpulse, collpair->normal, impulse);
+       
+                               // Apply repulse impulse if distance too short
+                               // I_r = -min(dt*kd, m(0,1d/dt - v_n))
+                               spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale;
+       
+                               d = -collpair->distance;
+                               if ( ( magrelVel < 0.1*d*spf ) && ( d > ALMOST_ZERO ) )
+                               {
+                                       repulse = MIN2 ( d*1.0/spf, 0.1*d*spf - magrelVel );
+       
+                                       // stay on the safe side and clamp repulse
+                                       if ( impulse > ALMOST_ZERO )
+                                               repulse = MIN2 ( repulse, 5.0*impulse );
+                                       repulse = MAX2 ( impulse, repulse );
+       
+                                       impulse = repulse / ( 2.0 ); // original 2.0 / 0.25
+                                       VECADDMUL ( pimpulse, collpair->normal, impulse);
+                               }
+                               
+                               if (w1 < 0.5) w1 *= 2.0;
+                               if (w2 < 0.5) w2 *= 2.0;
+                               if (w3 < 0.5) w3 *= 2.0;
+                               
+                               VECADDMUL(cloth1->verts[collpair->ap1].impulse, pimpulse, w1*2.0);
+                               VECADDMUL(cloth1->verts[collpair->ap2].impulse, pimpulse, w2*2.0);
+                               VECADDMUL(cloth1->verts[collpair->ap3].impulse, pimpulse, w3*2.0);;
+                               cloth1->verts[collpair->ap1].impulse_count++;
+                               cloth1->verts[collpair->ap2].impulse_count++;
+                               cloth1->verts[collpair->ap3].impulse_count++;
+                               
+                               result = 1;
+                       }
+               }
+       } 
+       
+       return result;
+}
+
+
+typedef struct tripairkey {
+       int p, a1, a2, a3;
+} tripairkey;
+
+unsigned int tripair_hash(void *vkey)
+{
+       tripairkey *key = vkey;
+       int keys[4] = {key->p, key->a1, key->a2, key->a3};
+       int i, j;
+       
+       for (i=0; i<4; i++) {
+               for (j=0; j<3; j++) {
+                       if (keys[j] >= keys[j+1]) {
+                               SWAP(int, keys[j], keys[j+1]);
+                       }
+               }
+       }
+       
+       return keys[0]*101 + keys[1]*72 + keys[2]*53 + keys[3]*34;
+}
+
+int tripair_cmp(const void *va, const void *vb)
+{
+       tripairkey *a = va, *b = vb;
+       int keysa[4] = {a->p, a->a1, a->a2, a->a3};
+       int keysb[4] = {b->p, b->a1, b->a2, b->a3};
+       int i;
+       
+       for (i=0; i<4; i++) {
+               int j, ok=0;
+               for (j=0; j<4; j++) {
+                       if (keysa[i] == keysa[j]) {
+                               ok = 1;
+                               break;
+                       }
+               }
+               if (!ok)
+                       return -1;
+       }
+       
+       return 0;
+}
+
+static void get_tripairkey(tripairkey *key, int p, int a1, int a2, int a3)
+{
+       key->a1 = a1;
+       key->a2 = a2;
+       key->a3 = a3;
+       key->p = p;
+}
+
+static int checkvisit(MemArena *arena, GHash *gh, int p, int a1, int a2, int a3)
+{
+       tripairkey key, *key2;
+       
+       get_tripairkey(&key, p, a1, a2, a3);
+       if (BLI_ghash_haskey(gh, &key))
+               return 1;
+       
+       key2 = BLI_memarena_alloc(arena, sizeof(*key2));
+       *key2 = key;
+       BLI_ghash_insert(gh, key2, NULL);
+       
+       return 0;
+}
+
+int cloth_point_tri_moving_v3v3_f(float v1[2][3], int i1, float v2[2][3], int i2,
+                                   float v3[2][3],  int i3, float v4[2][3], int i4,
+                                   float normal[3], float bary[3], float *t, 
+                                                                  float *relnor, GHash *gh, MemArena *arena)
+{
+       if (checkvisit(arena, gh, i1, i2, i3, i4))
+               return 0;
+       
+       return eltopo_point_tri_moving_v3v3_f(v1, i1, v2, i2, v3, i3, v4, i4, normal, bary, t, relnor);
+}
+
+static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, BVHTreeOverlap *overlap, 
+                                                                  CollPair *collpair, double dt, GHash *gh, MemArena *arena)
+{
+       ClothModifierData *clmd = ( ClothModifierData * ) md1;
+       CollisionModifierData *collmd = ( CollisionModifierData * ) md2;
+       MFace *face1=NULL, *face2 = NULL;
+       ClothVertex *verts1 = clmd->clothObject->verts;
+       double distance = 0;
+       float epsilon1 = clmd->coll_parms->epsilon;
+       float epsilon2 = BLI_bvhtree_getepsilon ( collmd->bvhtree );
+       float no[3], uv[3], t, relnor;
+       int i, i1, i2, i3, i4, i5, i6;
+       Cloth *cloth = clmd->clothObject;
+       float n1[3], sdis, p[3], l, n2[3], off[3], v1[2][3], v2[2][3], v3[2][3], v4[2][3], v5[2][3], v6[2][3];
+       int j, ret, bp1, bp2, bp3, ap1, ap2, ap3;
+       
+       face1 = & ( clmd->clothObject->mfaces[overlap->indexA] );
+       face2 = & ( collmd->mfaces[overlap->indexB] );
+
+       // check all 4 possible collisions
+       for ( i = 0; i < 4; i++ )
+       {
+               if ( i == 0 )
+               {
+                       // fill faceA
+                       ap1 = face1->v1;
+                       ap2 = face1->v2;
+                       ap3 = face1->v3;
+
+                       // fill faceB
+                       bp1 = face2->v1;
+                       bp2 = face2->v2;
+                       bp3 = face2->v3;
+               }
+               else if ( i == 1 )
+               {
+                       if ( face1->v4 )
+                       {
+                               // fill faceA
+                               ap1 = face1->v1;
+                               ap2 = face1->v3;
+                               ap3 = face1->v4;
+
+                               // fill faceB
+                               bp1 = face2->v1;
+                               bp2 = face2->v2;
+                               bp3 = face2->v3;
+                       }
+                       else {
+                               continue;
+                       }
+               }
+               if ( i == 2 )
+               {
+                       if ( face2->v4 )
+                       {
+                               // fill faceA
+                               ap1 = face1->v1;
+                               ap2 = face1->v2;
+                               ap3 = face1->v3;
+
+                               // fill faceB
+                               bp1 = face2->v1;
+                               bp2 = face2->v3;
+                               bp3 = face2->v4;
+                       }
+                       else {
+                               continue;
+                       }
+               }
+               else if ( i == 3 )
+               {
+                       if ( face1->v4 && face2->v4 )
+                       {
+                               // fill faceA
+                               ap1 = face1->v1;
+                               ap2 = face1->v3;
+                               ap3 = face1->v4;
+
+                               // fill faceB
+                               bp1 = face2->v1;
+                               bp2 = face2->v3;
+                               bp3 = face2->v4;
+                       }
+                       else {
+                               continue;
+                       }
+               }
+               
+               copy_v3_v3(v1[0], cloth->verts[ap1].txold); 
+               copy_v3_v3(v1[1], cloth->verts[ap1].tx);
+               copy_v3_v3(v2[0], cloth->verts[ap2].txold);
+               copy_v3_v3(v2[1], cloth->verts[ap2].tx);
+               copy_v3_v3(v3[0], cloth->verts[ap3].txold);
+               copy_v3_v3(v3[1], cloth->verts[ap3].tx);
+               
+               copy_v3_v3(v4[0], collmd->current_x[bp1].co);
+               copy_v3_v3(v4[1], collmd->current_xnew[bp1].co);
+               copy_v3_v3(v5[0], collmd->current_x[bp2].co);
+               copy_v3_v3(v5[1], collmd->current_xnew[bp2].co);
+               copy_v3_v3(v6[0], collmd->current_x[bp3].co);
+               copy_v3_v3(v6[1], collmd->current_xnew[bp3].co);
+               
+               normal_tri_v3(n2, v4[1], v5[1], v6[1]);
+               
+               sdis = clmd->coll_parms->distance_repel + epsilon2 + FLT_EPSILON;
+
+               /*apply a repulsion force, to help the solver along*/
+               copy_v3_v3(off, n2);
+               negate_v3(off);
+               if (isect_ray_plane_v3(v1[1], off, v4[1], v5[1], v6[1], &l, 0)) {
+                       if (l >= 0.0 && l < sdis) {
+                               mul_v3_fl(off, (l-sdis)*cloth->verts[ap1].mass*dt*clmd->coll_parms->repel_force*0.1);
+
+                               add_v3_v3(cloth->verts[ap1].tv, off);
+                               add_v3_v3(cloth->verts[ap2].tv, off);
+                               add_v3_v3(cloth->verts[ap3].tv, off);
+                       }
+               }
+
+               /*offset new positions a bit, to account for margins*/
+               copy_v3_v3(off, n2);
+               mul_v3_fl(off,  epsilon1 + epsilon2 + ALMOST_ZERO);
+               add_v3_v3(v4[1], off); add_v3_v3(v5[1], off); add_v3_v3(v6[1], off);
+               
+               i1 = ap1; i2 = ap2; i3 = ap3;
+               i4 = bp1+cloth->numverts; i5 = bp2+cloth->numverts; i6 = bp3+cloth->numverts;
+               
+               for (j=0; j<6; j++) {
+                       int collp;
+
+                       switch (j) {
+                       case 0:
+                               ret = cloth_point_tri_moving_v3v3_f(v1, i1, v4, i4, v5, i5, v6, i6, no, uv, &t, &relnor, gh, arena);
+                               collp = ap1;
+                               break;
+                       case 1:
+                               collp = ap2;
+                               ret = cloth_point_tri_moving_v3v3_f(v2, i2, v4, i4, v5, i5, v6, i6, no, uv, &t, &relnor, gh, arena);
+                               break;
+                       case 2:
+                               collp = ap3;
+                               ret = cloth_point_tri_moving_v3v3_f(v3, i3, v4, i4, v5, i5, v6, i6, no, uv, &t, &relnor, gh, arena);
+                               break;
+                       case 3:
+                               collp = bp1;
+                               ret = cloth_point_tri_moving_v3v3_f(v4, i4, v1, i1, v2, i2, v3, i3, no, uv, &t, &relnor, gh, arena);
+                               break;
+                       case 4:
+                               collp = bp2;                            
+                               ret = cloth_point_tri_moving_v3v3_f(v5, i5, v1, i1, v2, i2, v3, i3, no, uv, &t, &relnor, gh, arena);
+                               break;
+                       case 5:
+                               collp = bp3;
+                               ret = cloth_point_tri_moving_v3v3_f(v6, i6, v1, i1, v2, i2, v3, i3, no, uv, &t, &relnor, gh, arena);
+                               break;
+                       }
+                       
+                       /*cloth vert versus coll face*/
+                       if (ret && j < 3) {
+                               collpair->bp1 = bp1; collpair->bp2 = bp2; collpair->bp3 = bp3;
+                               collpair->collp = collp;
+                               
+                               copy_v3_v3(collpair->normal, no);
+                               mul_v3_v3fl(collpair->vector, collpair->normal, relnor);
+                               collpair->distance = relnor;
+                               collpair->time = t;
+                               
+                               copy_v3_v3(collpair->bary, uv);
+                               
+                               collpair->flag = COLLISION_USE_COLLFACE;
+                               collpair++;
+                       } else if (ret && j >= 3) { /*coll vert versus cloth face*/
+                               collpair->ap1 = ap1; collpair->ap2 = ap2; collpair->ap3 = ap3;
+                               collpair->collp = collp;
+                               
+                               copy_v3_v3(collpair->normal, no);
+                               mul_v3_v3fl(collpair->vector, collpair->normal, relnor);
+                               collpair->distance = relnor;
+                               collpair->time = t;
+                               
+                               copy_v3_v3(collpair->bary, uv);
+
+                               collpair->flag = 0;
+                               collpair++;
+                       }
+               }
+       }
+       
+       return collpair;
+}
+
+static void machine_epsilon_offset(Cloth *cloth) {
+       ClothVertex *cv;
+       int i, j;
+       
+       cv = cloth->verts;
+       for (i=0; i<cloth->numverts; i++, cv++) {
+               /*aggrevatingly enough, it's necassary to offset the coordinates
+                by a multiple of the 32-bit floating point epsilon when switching
+                into doubles*/
+               #define RNDSIGN (float)(-1*(BLI_rand()%2==0)|1)
+               for (j=0; j<3; j++) {
+                       cv->tx[j] += FLT_EPSILON*30.0f*RNDSIGN;
+                       cv->txold[j] += FLT_EPSILON*30.0f*RNDSIGN;
+                       cv->tv[j] += FLT_EPSILON*30.0f*RNDSIGN;
+               }               
+       }
+}
+
+#else /* !WITH_ELTOPO */
 
 //Determines collisions on overlap, collisions are written to collpair[i] and collision+number_collision_found is returned
-static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, BVHTreeOverlap *overlap, CollPair *collpair )
+static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, 
+       BVHTreeOverlap *overlap, CollPair *collpair, float dt )
 {
        ClothModifierData *clmd = ( ClothModifierData * ) md1;
        CollisionModifierData *collmd = ( CollisionModifierData * ) md2;
+       Cloth *cloth = clmd->clothObject;
        MFace *face1=NULL, *face2 = NULL;
 #ifdef USE_BULLET
        ClothVertex *verts1 = clmd->clothObject->verts;
@@ -614,6 +1408,7 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, BVHTree
        double distance = 0;
        float epsilon1 = clmd->coll_parms->epsilon;
        float epsilon2 = BLI_bvhtree_getepsilon ( collmd->bvhtree );
+       float n2[3], sdis, l;
        int i;
 
        face1 = & ( clmd->clothObject->mfaces[overlap->indexA] );
@@ -685,7 +1480,28 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, BVHTree
                        else
                                break;
                }
+               
+               normal_tri_v3(n2, collmd->current_xnew[collpair->bp1].co, 
+                       collmd->current_xnew[collpair->bp2].co, 
+                       collmd->current_xnew[collpair->bp3].co);
+               
+               sdis = clmd->coll_parms->distance_repel + epsilon2 + FLT_EPSILON;
+               
+               /*apply a repulsion force, to help the solver along.
+          this is kindof crude, it only tests one vert of the triangle*/
+               if (isect_ray_plane_v3(cloth->verts[collpair->ap1].tx, n2, collmd->current_xnew[collpair->bp1].co, 
+                       collmd->current_xnew[collpair->bp2].co,
+                       collmd->current_xnew[collpair->bp3].co, &l, 0))
+               {
+                       if (l >= 0.0 && l < sdis) {
+                               mul_v3_fl(n2, (l-sdis)*cloth->verts[collpair->ap1].mass*dt*clmd->coll_parms->repel_force*0.1);
 
+                               add_v3_v3(cloth->verts[collpair->ap1].tv, n2);
+                               add_v3_v3(cloth->verts[collpair->ap2].tv, n2);
+                               add_v3_v3(cloth->verts[collpair->ap3].tv, n2);
+                       }
+               }
+               
 #ifdef USE_BULLET
                // calc distance + normal
                distance = plNearestPoints (
@@ -741,6 +1557,8 @@ static CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, BVHTree
        }
        return collpair;
 }
+#endif /* WITH_ELTOPO */
+
 
 #if 0
 static int cloth_collision_response_moving( ClothModifierData *clmd, CollisionModifierData *collmd, CollPair *collpair, CollPair *collision_end )
@@ -1446,17 +2264,45 @@ void free_collider_cache(ListBase **colliders)
        }
 }
 
-static void cloth_bvh_objcollisions_nearcheck ( ClothModifierData * clmd, CollisionModifierData *collmd, CollPair **collisions, CollPair **collisions_index, int numresult, BVHTreeOverlap *overlap)
+
+static void cloth_bvh_objcollisions_nearcheck ( ClothModifierData * clmd, CollisionModifierData *collmd,
+       CollPair **collisions, CollPair **collisions_index, int numresult, BVHTreeOverlap *overlap, double dt)
 {
        int i;
+#ifdef WITH_ELTOPO
+       GHash *visithash = BLI_ghash_new(edgepair_hash, edgepair_cmp, "visthash, collision.c");
+       GHash *tri_visithash = BLI_ghash_new(tripair_hash, tripair_cmp, "tri_visthash, collision.c");
+       MemArena *arena = BLI_memarena_new(1<<16, "edge hash arena, collision.c");
+#endif
        
-       *collisions = ( CollPair* ) MEM_mallocN ( sizeof ( CollPair ) * numresult * 4, "collision array" ); //*4 since cloth_collision_static can return more than 1 collision
+       *collisions = ( CollPair* ) MEM_mallocN ( sizeof ( CollPair ) * numresult * 64, "collision array" ); //*4 since cloth_collision_static can return more than 1 collision
        *collisions_index = *collisions;
+       
+#ifdef WITH_ELTOPO
+       machine_epsilon_offset(clmd->clothObject);
+
+       for ( i = 0; i < numresult; i++ )
+       {
+               *collisions_index = cloth_collision ( ( ModifierData * ) clmd, ( ModifierData * ) collmd,
+                                                                                         overlap+i, *collisions_index, dt, tri_visithash, arena );
+       }
 
        for ( i = 0; i < numresult; i++ )
        {
-               *collisions_index = cloth_collision ( ( ModifierData * ) clmd, ( ModifierData * ) collmd, overlap+i, *collisions_index );
+               *collisions_index = cloth_edge_collision ( ( ModifierData * ) clmd, ( ModifierData * ) collmd,
+                                                                                                  overlap+i, *collisions_index, visithash, arena );
        }
+       BLI_ghash_free(visithash, NULL, NULL);
+       BLI_ghash_free(tri_visithash, NULL, NULL);
+       BLI_memarena_free(arena);
+#else /* WITH_ELTOPO */
+       for ( i = 0; i < numresult; i++ )
+       {
+               *collisions_index = cloth_collision ( ( ModifierData * ) clmd, ( ModifierData * ) collmd,
+                                                                                         overlap+i, *collisions_index, dt );
+       }
+#endif /* WITH_ELTOPO */
+
 }
 
 static int cloth_bvh_objcollisions_resolve ( ClothModifierData * clmd, CollisionModifierData *collmd, CollPair *collisions, CollPair *collisions_index)
@@ -1481,11 +2327,19 @@ static int cloth_bvh_objcollisions_resolve ( ClothModifierData * clmd, Collision
 
                if ( collmd->bvhtree )
                {
+#ifdef WITH_ELTOPO
+                       result += cloth_collision_response_moving(clmd, collmd, collisions, collisions_index);
+                       result += cloth_edge_collision_response_moving(clmd, collmd, collisions, collisions_index);
+#else
                        result += cloth_collision_response_static ( clmd, collmd, collisions, collisions_index );
-
+#endif
+#ifdef WITH_ELTOPO
+                       {
+#else
                        // apply impulses in parallel
                        if ( result )
                        {
+#endif
                                for ( i = 0; i < numverts; i++ )
                                {
                                        // calculate "velocities" (just xnew = xold + v; no dt in v)
@@ -1518,7 +2372,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
 
        if ((clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_COLLOBJ) || cloth_bvh==NULL)
                return 0;
-
+       
        verts = cloth->verts;
        numfaces = cloth->numfaces;
        numverts = cloth->numverts;
@@ -1557,6 +2411,7 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
                                continue;
                        
                        /* move object to position (step) in time */
+                       
                        collision_move_object ( collmd, step + dt, step );
                        
                        /* search for overlapping collision pairs */
@@ -1565,7 +2420,8 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
                        // go to next object if no overlap is there
                        if( result && overlap ) {
                                /* check if collisions really happen (costly near check) */
-                               cloth_bvh_objcollisions_nearcheck ( clmd, collmd, &collisions[i], &collisions_index[i], result, overlap);
+                               cloth_bvh_objcollisions_nearcheck ( clmd, collmd, &collisions[i], 
+                                       &collisions_index[i], result, overlap, dt/(float)clmd->coll_parms->loop_count);
                        
                                // resolve nearby collisions
                                ret += cloth_bvh_objcollisions_resolve ( clmd, collmd, collisions[i],  collisions_index[i]);
@@ -1721,5 +2577,5 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
        if(collobjs)
                MEM_freeN(collobjs);
 
-       return MIN2 ( ret, 1 );
+       return 1|MIN2 ( ret, 1 );
 }
index d2e48edc7ced4680606de6e37c05fea81c8a9165..d3c14a9dd12c57f3f836b4f9e94578ae98a5709d 100644 (file)
@@ -4019,7 +4019,9 @@ bConstraintTypeInfo *constraint_get_typeinfo (bConstraint *con)
  
 /* ---------- Data Management ------- */
 
-/* Free data of a specific constraint if it has any info */
+/* Free data of a specific constraint if it has any info.
+ * be sure to run BIK_clear_data() when freeing an IK constraint,
+ * unless DAG_scene_sort is called. */
 void free_constraint_data (bConstraint *con)
 {
        if (con->data) {
index 4e5a1977ab01da24b2d861ce4cb772f58d4991c5..2aeb726f623304bff7bf1282c6b4b7dc0429502c 100644 (file)
@@ -451,11 +451,10 @@ static int ctx_data_get(bContext *C, const char *member, bContextDataResult *res
 
                C->data.recursion= 1;
 
-               for(entry=C->wm.store->entries.first; entry; entry=entry->next) {
-                       if(strcmp(entry->name, member) == 0) {
-                               result->ptr= entry->ptr;
-                               done= 1;
-                       }
+               entry= BLI_rfindstring(&C->wm.store->entries, member, offsetof(bContextStoreEntry, name));
+               if(entry) {
+                       result->ptr= entry->ptr;
+                       done= 1;
                }
        }
        if(done!=1 && recursion < 2 && C->wm.region) {
@@ -649,7 +648,7 @@ int CTX_data_equals(const char *member, const char *str)
 
 int CTX_data_dir(const char *member)
 {
-       return (strcmp(member, "") == 0);
+       return member[0] == '\0';
 }
 
 void CTX_data_id_pointer_set(bContextDataResult *result, ID *id)
index 96391a36b34402a1f6188c13315fdedea76505fd..72df926b9a7644c1030c7abf81910fdc311c6a4d 100644 (file)
@@ -1926,7 +1926,9 @@ static void dag_scene_flush_layers(Scene *sce, int lay)
        }
 
        /* ensure cameras are set as if they are on a visible layer, because
-          they ared still used for rendering or setting the camera view */
+        * they ared still used for rendering or setting the camera view
+        *
+        * XXX, this wont work for local view / unlocked camera's */
        if(sce->camera) {
                node= dag_get_node(sce->theDag, sce->camera);
                node->scelay |= lay;
index 0c722d81f45e6d0c84cbfd822371e6140ffdc2ee..6898615c7537b045cbd1eff58b979599715ee2d1 100644 (file)
@@ -386,7 +386,7 @@ VFont *load_vfont(const char *name)
                        vfont->data = vfd;
 
                        /* if there's a font name, use it for the ID name */
-                       if (strcmp(vfd->name, "")!=0) {
+                       if (vfd->name[0] != '\0') {
                                BLI_strncpy(vfont->id.name+2, vfd->name, sizeof(vfont->id.name)-2);
                        }
                        BLI_strncpy(vfont->name, name, sizeof(vfont->name));
index 80962de973046fb66f2a19401ff6cbf55b0a9758..04fc41e41cc957b303b1705d2d3354fc7e001f01 100644 (file)
@@ -426,35 +426,30 @@ static IDProperty *IDP_CopyGroup(IDProperty *prop)
  * When values name and types match, copy the values, else ignore */
 void IDP_SyncGroupValues(IDProperty *dest, IDProperty *src)
 {
-       IDProperty *loop, *prop;
+       IDProperty *other, *prop;
        for (prop=src->data.group.first; prop; prop=prop->next) {
-               for (loop=dest->data.group.first; loop; loop=loop->next) {
-                       if (strcmp(loop->name, prop->name)==0) {
-                               if(prop->type==loop->type) {
-
-                                       switch (prop->type) {
-                                               case IDP_INT:
-                                               case IDP_FLOAT:
-                                               case IDP_DOUBLE:
-                                                       loop->data= prop->data;
-                                                       break;
-                                               case IDP_GROUP:
-                                                       IDP_SyncGroupValues(loop, prop);
-                                                       break;
-                                               default:
-                                               {
-                                                       IDProperty *tmp= loop;
-                                                       IDProperty *copy= IDP_CopyProperty(prop);
-
-                                                       BLI_insertlinkafter(&dest->data.group, loop, copy);
-                                                       BLI_remlink(&dest->data.group, tmp);
-
-                                                       IDP_FreeProperty(tmp);
-                                                       MEM_freeN(tmp);
-                                               }
-                                       }
+               other= BLI_findstring(&dest->data.group, prop->name, offsetof(IDProperty, name));
+               if (other && prop->type==other->type) {
+                       switch (prop->type) {
+                               case IDP_INT:
+                               case IDP_FLOAT:
+                               case IDP_DOUBLE:
+                                       other->data= prop->data;
+                                       break;
+                               case IDP_GROUP:
+                                       IDP_SyncGroupValues(other, prop);
+                                       break;
+                               default:
+                               {
+                                       IDProperty *tmp= other;
+                                       IDProperty *copy= IDP_CopyProperty(prop);
+
+                                       BLI_insertlinkafter(&dest->data.group, other, copy);
+                                       BLI_remlink(&dest->data.group, tmp);
+
+                                       IDP_FreeProperty(tmp);
+                                       MEM_freeN(tmp);
                                }
-                               break;
                        }
                }
        }
index c44634fed34beca15e13026fa66ae9efdbdd589f..22d19c5484f349802b0545075ad90f5308261908 100644 (file)
@@ -675,8 +675,10 @@ void BKE_image_all_free_anim_ibufs(int cfra)
 
 int BKE_imtype_to_ftype(int imtype)
 {
-       if(imtype==0)
+       if(imtype==R_TARGA)
                return TGA;
+       else if(imtype==R_RAWTGA)
+               return RAWTGA;
        else if(imtype== R_IRIS) 
                return IMAGIC;
 #ifdef WITH_HDR
@@ -703,10 +705,6 @@ int BKE_imtype_to_ftype(int imtype)
        else if (imtype==R_DPX)
                return DPX;
 #endif
-       else if (imtype==R_TARGA)
-               return TGA;
-       else if(imtype==R_RAWTGA)
-               return RAWTGA;
 #ifdef WITH_OPENJPEG
        else if(imtype==R_JP2)
                return JP2;
@@ -880,7 +878,7 @@ typedef struct StampData {
        char    rendertime[64];
 } StampData;
 
-static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix)
+static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int do_prefix)
 {
        char text[256];
        struct tm *tl;
@@ -959,14 +957,14 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix)
        }
 
        if (scene->r.stamp & R_STAMP_CAMERA) {
-               BLI_snprintf(stamp_data->camera, sizeof(stamp_data->camera), do_prefix ? "Camera %s":"%s", scene->camera ? scene->camera->id.name+2 : "<none>");
+               BLI_snprintf(stamp_data->camera, sizeof(stamp_data->camera), do_prefix ? "Camera %s":"%s", camera ? camera->id.name+2 : "<none>");
        } else {
                stamp_data->camera[0] = '\0';
        }
 
        if (scene->r.stamp & R_STAMP_CAMERALENS) {
-               if (scene->camera && scene->camera->type == OB_CAMERA) {
-                       BLI_snprintf(text, sizeof(text), "%.2f", ((Camera *)scene->camera->data)->lens);
+               if (camera && camera->type == OB_CAMERA) {
+                       BLI_snprintf(text, sizeof(text), "%.2f", ((Camera *)camera->data)->lens);
                }
                else            strcpy(text, "<none>");
 
@@ -1006,18 +1004,21 @@ static void stampdata(Scene *scene, StampData *stamp_data, int do_prefix)
        }
 }
 
-void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, int height, int channels)
+void BKE_stamp_buf(Scene *scene, Object *camera, unsigned char *rect, float *rectf, int width, int height, int channels)
 {
        struct StampData stamp_data;
        float w, h, pad;
-       int x, y;
+       int x, y, y_ofs;
        float h_fixed;
        const int mono= blf_mono_font_render; // XXX
-       
+
+#define BUFF_MARGIN_X 2
+#define BUFF_MARGIN_Y 1
+
        if (!rect && !rectf)
                return;
        
-       stampdata(scene, &stamp_data, 1);
+       stampdata(scene, camera, &stamp_data, 1);
 
        /* TODO, do_versions */
        if(scene->r.stamp_font_id < 8)
@@ -1028,15 +1029,11 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
        
        BLF_buffer(mono, rectf, rect, width, height, channels);
        BLF_buffer_col(mono, scene->r.fg_stamp[0], scene->r.fg_stamp[1], scene->r.fg_stamp[2], 1.0);
-       pad= BLF_width(mono, "--");
+       pad= BLF_width_max(mono);
 
        /* use 'h_fixed' rather then 'h', aligns better */
-       // BLF_width_and_height(mono, "^|/_AgPpJjlYy", &w, &h_fixed);
-       {
-               rctf box;
-               BLF_boundbox(mono, "^|/_AgPpJjlYy", &box);
-               h_fixed= box.ymax - box.ymin;
-       }
+       h_fixed= BLF_height_max(mono);
+       y_ofs = -BLF_descender(mono);
 
        x= 0;
        y= height;
@@ -1047,14 +1044,14 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                y -= h;
 
                /* also a little of space to the background. */
-               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y-3, w+3, y+h+2);
+               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x-BUFF_MARGIN_X, y-BUFF_MARGIN_Y, w+BUFF_MARGIN_X, y+h+BUFF_MARGIN_Y);
 
                /* and draw the text. */
-               BLF_position(mono, x, y, 0.0);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.file);
 
                /* the extra pixel for background. */
-               y -= 4;
+               y -= BUFF_MARGIN_Y * 2;
        }
 
        /* Top left corner, below File */
@@ -1063,13 +1060,13 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                y -= h;
 
                /* and space for background. */
-               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y-3, w+3, y+h+2);
+               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y-BUFF_MARGIN_Y, w+BUFF_MARGIN_X, y+h+BUFF_MARGIN_Y);
 
-               BLF_position(mono, x, y+1, 0.0);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.note);
 
                /* the extra pixel for background. */
-               y -= 4;
+               y -= BUFF_MARGIN_Y * 2;
        }
        
        /* Top left corner, below File (or Note) */
@@ -1078,13 +1075,13 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                y -= h;
 
                /* and space for background. */
-               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y-3, w+3, y+h+2);
+               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y-BUFF_MARGIN_Y, w+BUFF_MARGIN_X, y+h+BUFF_MARGIN_Y);
 
-               BLF_position(mono, x, y, 0.0);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.date);
 
                /* the extra pixel for background. */
-               y -= 4;
+               y -= BUFF_MARGIN_Y * 2;
        }
 
        /* Top left corner, below File, Date or Note */
@@ -1093,9 +1090,9 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                y -= h;
 
                /* and space for background. */
-               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y-3, w+3, y+h+2);
+               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, 0, y-BUFF_MARGIN_Y, w+BUFF_MARGIN_X, y+h+BUFF_MARGIN_Y);
 
-               BLF_position(mono, x, y, 0.0);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.rendertime);
        }
 
@@ -1107,10 +1104,10 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                BLF_width_and_height(mono, stamp_data.marker, &w, &h); h= h_fixed;
 
                /* extra space for background. */
-               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, w+2, y+h+2);
+               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x-BUFF_MARGIN_X, y-BUFF_MARGIN_Y, w+BUFF_MARGIN_X, y+h+BUFF_MARGIN_Y);
 
                /* and pad the text. */
-               BLF_position(mono, x, y+3, 0.0);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.marker);
 
                /* space width. */
@@ -1122,10 +1119,10 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                BLF_width_and_height(mono, stamp_data.time, &w, &h); h= h_fixed;
 
                /* extra space for background */
-               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+2);
+               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x-BUFF_MARGIN_X, y, x+w+BUFF_MARGIN_X, y+h+BUFF_MARGIN_Y);
 
                /* and pad the text. */
-               BLF_position(mono, x, y+3, 0.0);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.time);
 
                /* space width. */
@@ -1136,10 +1133,10 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                BLF_width_and_height(mono, stamp_data.frame, &w, &h); h= h_fixed;
 
                /* extra space for background. */
-               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+2);
+               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x-BUFF_MARGIN_X, y-BUFF_MARGIN_Y, x+w+BUFF_MARGIN_X, y+h+BUFF_MARGIN_Y);
 
                /* and pad the text. */
-               BLF_position(mono, x, y+3, 0.0);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.frame);
 
                /* space width. */
@@ -1150,8 +1147,8 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                BLF_width_and_height(mono, stamp_data.camera, &w, &h); h= h_fixed;
 
                /* extra space for background. */
-               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+2);
-               BLF_position(mono, x, y+3, 0.0);
+               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x-BUFF_MARGIN_X, y-BUFF_MARGIN_Y, x+w+BUFF_MARGIN_X, y+h+BUFF_MARGIN_Y);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.camera);
 
                /* space width. */
@@ -1162,8 +1159,8 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                BLF_width_and_height(mono, stamp_data.cameralens, &w, &h); h= h_fixed;
 
                /* extra space for background. */
-               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+2, y+h+2);
-               BLF_position(mono, x, y+3, 0.0);
+               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x-BUFF_MARGIN_X, y-BUFF_MARGIN_Y, x+w+BUFF_MARGIN_X, y+h+BUFF_MARGIN_Y);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.cameralens);
        }
        
@@ -1174,10 +1171,10 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                x= width - w - 2;
 
                /* extra space for background. */
-               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y, x+w+3, y+h+2);
+               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x-BUFF_MARGIN_X, y-BUFF_MARGIN_Y, x+w+BUFF_MARGIN_X, y+h+BUFF_MARGIN_Y);
 
                /* and pad the text. */
-               BLF_position(mono, x, y+3, 0.0);
+               BLF_position(mono, x, y+y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.scene);
        }
        
@@ -1189,24 +1186,27 @@ void BKE_stamp_buf(Scene *scene, unsigned char *rect, float *rectf, int width, i
                y= height - h;
 
                /* extra space for background. */
-               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x, y-3, x+w+pad, y+h+2);
+               buf_rectfill_area(rect, rectf, width, height, scene->r.bg_stamp, x-BUFF_MARGIN_X, y-BUFF_MARGIN_Y, x+w+BUFF_MARGIN_X, y+h+BUFF_MARGIN_Y);
 
-               BLF_position(mono, x, y, 0.0);
+               BLF_position(mono, x, y + y_ofs, 0.0);
                BLF_draw_buffer(mono, stamp_data.strip);
        }
 
        /* cleanup the buffer. */
        BLF_buffer(mono, NULL, NULL, 0, 0, 0);
+
+#undef BUFF_MARGIN_X
+#undef BUFF_MARGIN_Y
 }
 
-void BKE_stamp_info(Scene *scene, struct ImBuf *ibuf)
+void BKE_stamp_info(Scene *scene, Object *camera, struct ImBuf *ibuf)
 {
        struct StampData stamp_data;
 
        if (!ibuf)      return;
        
        /* fill all the data values, no prefix */
-       stampdata(scene, &stamp_data, 0);
+       stampdata(scene, camera, &stamp_data, 0);
        
        if (stamp_data.file[0])         IMB_metadata_change_field (ibuf, "File",                stamp_data.file);
        if (stamp_data.note[0])         IMB_metadata_change_field (ibuf, "Note",                stamp_data.note);
@@ -1244,7 +1244,7 @@ int BKE_alphatest_ibuf(ImBuf *ibuf)
        return FALSE;
 }
 
-int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality)
+int BKE_write_ibuf(ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality)
 {
        int ok;
        (void)subimtype; /* quies unused warnings */
@@ -1339,9 +1339,6 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, const char *name, int imtype, int
        }
        
        BLI_make_existing_file(name);
-
-       if(scene && scene->r.stamp & R_STAMP_ALL)
-               BKE_stamp_info(scene, ibuf);
        
        ok = IMB_saveiff(ibuf, name, IB_rect | IB_zbuf | IB_zbuffloat);
        if (ok == 0) {
@@ -1351,6 +1348,14 @@ int BKE_write_ibuf(Scene *scene, ImBuf *ibuf, const char *name, int imtype, int
        return(ok);
 }
 
+int BKE_write_ibuf_stamp(Scene *scene, struct Object *camera, ImBuf *ibuf, const char *name, int imtype, int subimtype, int quality)
+{
+       if(scene && scene->r.stamp & R_STAMP_ALL)
+               BKE_stamp_info(scene, camera, ibuf);
+
+       return BKE_write_ibuf(ibuf, name, imtype, subimtype, quality);
+}
+
 
 void BKE_makepicstring(char *string, const char *base, int frame, int imtype, const short use_ext, const short use_frames)
 {
@@ -1660,8 +1665,15 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int frame)
 
        /* read ibuf */
        ibuf = IMB_loadiffname(name, flag);
-       if(G.f & G_DEBUG) printf("loaded %s\n", name);
-       
+
+#if 0
+       if(ibuf) {
+               printf(AT" loaded %s\n", name);
+       } else {
+               printf(AT" missed %s\n", name);
+       }
+#endif
+
        if (ibuf) {
 #ifdef WITH_OPENEXR
                /* handle multilayer case, don't assign ibuf. will be handled in BKE_image_get_ibuf */
@@ -2217,21 +2229,19 @@ void BKE_image_release_ibuf(Image *ima, void *lock)
 /* warning, this can allocate generated images */
 ImBuf *BKE_image_get_ibuf(Image *ima, ImageUser *iuser)
 {
+       /* here (+fie_ima/2-1) makes sure that division happens correctly */
        return BKE_image_acquire_ibuf(ima, iuser, NULL);
 }
 
-void BKE_image_user_calc_frame(ImageUser *iuser, int cfra, int fieldnr)
+int BKE_image_user_get_frame(const ImageUser *iuser, int cfra, int fieldnr)
 {
-       int len;
-       
-       /* here (+fie_ima/2-1) makes sure that division happens correctly */
-       len= (iuser->fie_ima*iuser->frames)/2;
-       
+       const int len= (iuser->fie_ima*iuser->frames)/2;
+
        if(len==0) {
-               iuser->framenr= 0;
+               return 0;
        }
        else {
-               int imanr;
+               int framenr;
                cfra= cfra - iuser->sfra+1;
 
                /* cyclic */
@@ -2240,31 +2250,38 @@ void BKE_image_user_calc_frame(ImageUser *iuser, int cfra, int fieldnr)
                        if(cfra < 0) cfra+= len;
                        if(cfra==0) cfra= len;
                }
-               
+
                if(cfra<0) cfra= 0;
                else if(cfra>len) cfra= len;
-               
+
                /* convert current frame to current field */
                cfra= 2*(cfra);
                if(fieldnr) cfra++;
-               
+
                /* transform to images space */
-               imanr= (cfra+iuser->fie_ima-2)/iuser->fie_ima;
-               if(imanr>iuser->frames) imanr= iuser->frames;
-               imanr+= iuser->offset;
-               
+               framenr= (cfra+iuser->fie_ima-2)/iuser->fie_ima;
+               if(framenr>iuser->frames) framenr= iuser->frames;
+               framenr+= iuser->offset;
+
                if(iuser->cycl) {
-                       imanr= ( (imanr) % len );
-                       while(imanr < 0) imanr+= len;
-                       if(imanr==0) imanr= len;
+                       framenr= ( (framenr) % len );
+                       while(framenr < 0) framenr+= len;
+                       if(framenr==0) framenr= len;
                }
-       
-               /* allows image users to handle redraws */
-               if(iuser->flag & IMA_ANIM_ALWAYS)
-                       if(imanr!=iuser->framenr)
-                               iuser->flag |= IMA_ANIM_REFRESHED;
-               
-               iuser->framenr= imanr;
-               if(iuser->ok==0) iuser->ok= 1;
+
+               return framenr;
        }
 }
+
+void BKE_image_user_calc_frame(ImageUser *iuser, int cfra, int fieldnr)
+{
+       const int framenr= BKE_image_user_get_frame(iuser, cfra, fieldnr);
+
+       /* allows image users to handle redraws */
+       if(iuser->flag & IMA_ANIM_ALWAYS)
+               if(framenr!=iuser->framenr)
+                       iuser->flag |= IMA_ANIM_REFRESHED;
+
+       iuser->framenr= framenr;
+       if(iuser->ok==0) iuser->ok= 1;
+}
index 7f0292b2f22a915917f64b73a6ddc1de77b546d0..099661f791436a464681c6e9d2340f81aee8f296 100644 (file)
@@ -50,7 +50,7 @@
 #include "BKE_global.h"
 
 
-#define CLOTH_OPENMP_LIMIT 25
+#define CLOTH_OPENMP_LIMIT 512
 
 #ifdef _WIN32
 #include <windows.h>
@@ -939,7 +939,7 @@ static int  cg_filtered(lfVector *ldV, fmatrix3x3 *lA, lfVector *lB, lfVector *z
        s = dot_lfvector(r, r, numverts);
        starget = s * sqrt(conjgrad_epsilon);
 
-       while((s>starget && conjgrad_loopcount < conjgrad_looplimit))
+       while(s>starget && conjgrad_loopcount < conjgrad_looplimit)
        {       
                // Mul(q,A,d); // q = A*d;
                mul_bfmatrix_lfvector(q, lA, d);
@@ -1749,15 +1749,93 @@ static void simulate_implicit_euler(lfVector *Vnew, lfVector *UNUSED(lX), lfVect
        del_lfvector(dFdXmV);
 }
 
+/*computes where the cloth would be if it were subject to perfectly stiff edges
+  (edge distance constraints) in a lagrangian solver.  then add forces to help
+  guide the implicit solver to that state.  this function is called after
+  collisions*/
+int cloth_calc_helper_forces(Object *UNUSED(ob), ClothModifierData * clmd, float (*initial_cos)[3], float UNUSED(step), float dt)
+{
+       Cloth *cloth= clmd->clothObject;
+       float (*cos)[3] = MEM_callocN(sizeof(float)*3*cloth->numverts, "cos cloth_calc_helper_forces");
+       float *masses = MEM_callocN(sizeof(float)*cloth->numverts, "cos cloth_calc_helper_forces");
+       LinkNode *node;
+       ClothSpring *spring;
+       ClothVertex *cv;
+       int i, steps;
+       
+       cv = cloth->verts;
+       for (i=0; i<cloth->numverts; i++, cv++) {
+               copy_v3_v3(cos[i], cv->tx);
+               
+               if (cv->goal == 1.0f || len_v3v3(initial_cos[i], cv->tx) != 0.0) {
+                       masses[i] = 1e+10;      
+               } else {
+                       masses[i] = cv->mass;
+               }
+       }
+       
+       steps = 55;
+       for (i=0; i<steps; i++) {
+               for (node=cloth->springs; node; node=node->next) {
+                       ClothVertex *cv1, *cv2;
+                       int v1, v2;
+                       float len, c, l, vec[3];
+                       
+                       spring = node->link;
+                       if (spring->type != CLOTH_SPRING_TYPE_STRUCTURAL && spring->type != CLOTH_SPRING_TYPE_SHEAR) 
+                               continue;
+                       
+                       v1 = spring->ij; v2 = spring->kl;
+                       cv1 = cloth->verts + v1;
+                       cv2 = cloth->verts + v2;
+                       len = len_v3v3(cos[v1], cos[v2]);
+                       
+                       sub_v3_v3v3(vec, cos[v1], cos[v2]);
+                       normalize_v3(vec);
+                       
+                       c = (len - spring->restlen);
+                       if (c == 0.0)
+                               continue;
+                       
+                       l = c / ((1.0/masses[v1]) + (1.0/masses[v2]));
+                       
+                       mul_v3_fl(vec, -(1.0/masses[v1])*l);
+                       add_v3_v3(cos[v1], vec);
+       
+                       sub_v3_v3v3(vec, cos[v2], cos[v1]);
+                       normalize_v3(vec);
+                       
+                       mul_v3_fl(vec, -(1.0/masses[v2])*l);
+                       add_v3_v3(cos[v2], vec);
+               }
+       }
+       
+       cv = cloth->verts;
+       for (i=0; i<cloth->numverts; i++, cv++) {
+               float vec[3];
+               
+               /*compute forces*/
+               sub_v3_v3v3(vec, cos[i], cv->tx);
+               mul_v3_fl(vec, cv->mass*dt*20.0);
+               add_v3_v3(cv->tv, vec);
+               //copy_v3_v3(cv->tx, cos[i]);
+       }
+       
+       MEM_freeN(cos);
+       MEM_freeN(masses);
+       
+       return 1;
+}
 int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase *effectors)
 {              
        unsigned int i=0;
        float step=0.0f, tf=clmd->sim_parms->timescale;
        Cloth *cloth = clmd->clothObject;
-       ClothVertex *verts = cloth->verts;
+       ClothVertex *verts = cloth->verts, *cv;
        unsigned int numverts = cloth->numverts;
        float dt = clmd->sim_parms->timescale / clmd->sim_parms->stepsPerFrame;
        float spf = (float)clmd->sim_parms->stepsPerFrame / clmd->sim_parms->timescale;
+       float (*initial_cos)[3] = MEM_callocN(sizeof(float)*3*cloth->numverts, "initial_cos implicit.c");
        Implicit_Data *id = cloth->implicit;
        int do_extra_solve;
 
@@ -1817,15 +1895,26 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
                                VECCOPY(verts[i].v, verts[i].tv);
                        }
 
+                       for (i=0, cv=cloth->verts; i<cloth->numverts; i++, cv++) {
+                               copy_v3_v3(initial_cos[i], cv->tx);
+                       }
+                       
                        // call collision function
                        // TODO: check if "step" or "step+dt" is correct - dg
                        do_extra_solve = cloth_bvh_objcollision(ob, clmd, step/clmd->sim_parms->timescale, dt/clmd->sim_parms->timescale);
-                       
+                                               
                        // copy corrected positions back to simulation
                        for(i = 0; i < numverts; i++)
                        {               
                                // correct velocity again, just to be sure we had to change it due to adaptive collisions
                                VECSUB(verts[i].tv, verts[i].tx, id->X[i]);
+                       }
+
+                       //if (do_extra_solve)
+                       //      cloth_calc_helper_forces(ob, clmd, initial_cos, step/clmd->sim_parms->timescale, dt/clmd->sim_parms->timescale);
+                       
+                       for(i = 0; i < numverts; i++)
+                       {               
 
                                if(do_extra_solve)
                                {
@@ -1886,6 +1975,8 @@ int implicit_solver (Object *ob, float frame, ClothModifierData *clmd, ListBase
                }
        }
        
+       MEM_freeN(initial_cos);
+       
        return 1;
 }
 
index e2d64a78c1891051fd7a1c2438ea2c2bb2a50d0d..0b07f40cad66a338c6bf8b5db6430d87f77a985b 100644 (file)
@@ -1381,7 +1381,7 @@ void text_idbutton(struct ID *id, char *text)
        if(id) {
                if(GS(id->name)==ID_SCE)
                        strcpy(text, "SCE: ");
-               else if(GS(id->name)==ID_SCE)
+               else if(GS(id->name)==ID_SCR)
                        strcpy(text, "SCR: ");
                else if(GS(id->name)==ID_MA && ((Material*)id)->use_nodes)
                        strcpy(text, "NT: ");
index 9f9af8e4c6f6ebdbfb1648bb72ac88eacd26b289..16fbf38eca17e9ee4ff5a0a1568a0574fb46a977 100644 (file)
@@ -1205,7 +1205,9 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree)
                newtree= MEM_dupallocN(ntree);
                copy_libblock_data(&newtree->id, &ntree->id, TRUE); /* copy animdata and ID props */
        }
-       
+
+       id_us_plus((ID *)newtree->gpd);
+
        /* in case a running nodetree is copied */
        newtree->init &= ~(NTREE_EXEC_INIT);
        newtree->threadstack= NULL;
@@ -1447,6 +1449,8 @@ void ntreeFreeTree(bNodeTree *ntree)
        
        BKE_free_animdata((ID *)ntree);
 
+       id_us_min((ID *)ntree->gpd);
+
        BLI_freelistN(&ntree->links);   /* do first, then unlink_node goes fast */
        
        for(node= ntree->nodes.first; node; node= next) {
@@ -2418,13 +2422,18 @@ static void tex_end_exec(bNodeTree *ntree)
        bNodeStack *ns;
        int th, a;
        
-       if(ntree->threadstack)
-               for(th=0; th<BLENDER_MAX_THREADS; th++)
-                       for(nts=ntree->threadstack[th].first; nts; nts=nts->next)
-                               for(ns= nts->stack, a=0; a<ntree->stacksize; a++, ns++)
-                                       if(ns->data)
+       if(ntree->threadstack) {
+               for(th=0; th<BLENDER_MAX_THREADS; th++) {
+                       for(nts=ntree->threadstack[th].first; nts; nts=nts->next) {
+                               for(ns= nts->stack, a=0; a<ntree->stacksize; a++, ns++) {
+                                       if(ns->data) {
                                                MEM_freeN(ns->data);
-                                               
+                                               ns->data= NULL;
+                                       }
+                               }
+                       }
+               }
+       }
 }
 
 void ntreeBeginExecTree(bNodeTree *ntree)
index d869cb513cd65b39c50aa2e84114541f6c80710b..5eca8e11c0fce3d241ef5d3d76c9deffe63ab169 100644 (file)
@@ -1583,7 +1583,10 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
                ob->rotmode= target->rotmode;
                mul_m4_m4m4(ob->obmat, target->obmat, gob->obmat);
                if(gob->dup_group) { /* should always be true */
-                       sub_v3_v3(ob->obmat[3], gob->dup_group->dupli_ofs);
+                       float tvec[3];
+                       copy_v3_v3(tvec, gob->dup_group->dupli_ofs);
+                       mul_mat3_m4_v3(ob->obmat, tvec);
+                       sub_v3_v3(ob->obmat[3], tvec);
                }
                object_apply_mat4(ob, ob->obmat, FALSE, TRUE);
        }
@@ -1633,6 +1636,10 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
                
                armature_set_id_extern(ob);
        }
+       else if (target->type == OB_EMPTY) {
+               ob->empty_drawtype = target->empty_drawtype;
+               ob->empty_drawsize = target->empty_drawsize;
+       }
 
        /* copy IDProperties */
        if(ob->id.properties) {
index 5b58372090530d8f028dd182a3028f1dff4be037..5ec4c36177f644d7dc5d79c6fb0d523e90bee789 100644 (file)
@@ -3030,7 +3030,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
 
        psys->totcached = totpart;
 
-       if(psys && psys->lattice){
+       if(psys->lattice){
                end_latt_deform(psys->lattice);
                psys->lattice= NULL;
        }
index 179aab064b40e486ad77513b06b8b9ea478ccd28..64893bb0b5bbdc983bc1ad9ab38b3e4af8e51ecf 100644 (file)
@@ -938,7 +938,7 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p
                len = ptcache_path(pid, filename);
                newname += len;
        }
-       if(strcmp(pid->cache->name, "")==0 && (pid->cache->flag & PTCACHE_EXTERNAL)==0) {
+       if(pid->cache->name[0] == '\0' && (pid->cache->flag & PTCACHE_EXTERNAL)==0) {
                idname = (pid->ob->id.name+2);
                /* convert chars to hex so they are always a valid filename */
                while('\0' != *idname) {
@@ -1382,7 +1382,7 @@ static void ptcache_find_frames_around(PTCacheID *pid, unsigned int frame, int *
                        }
                }
 
-               if(pm && !pm2) {
+               if(!pm2) {
                        *fra1 = 0;
                        *fra2 = pm->frame;
                }
@@ -1844,7 +1844,8 @@ static int ptcache_write(PTCacheID *pid, int cfra, int overwrite)
        if(cache->flag & PTCACHE_DISK_CACHE) {
                error += !ptcache_mem_frame_to_disk(pid, pm);
 
-               if(pm) {
+               // if(pm) /* pm is always set */
+               {
                        ptcache_data_free(pm);
                        ptcache_extra_free(pm);
                        MEM_freeN(pm);
index b2e6f5290c30a21c1d8bf10dcc52744e04187bb0..e3639dd1c51279fe5002818b61e34b8655ff573d 100644 (file)
@@ -1858,7 +1858,7 @@ static ImBuf * seq_render_scene_strip_impl(
        ImBuf * ibuf = NULL;
        float frame= seq->sfra + nr + seq->anim_startofs;
        float oldcfra;
-       Object *oldcamera;
+       Object *camera;
        ListBase oldmarkers;
        
        /* Old info:
@@ -1896,59 +1896,65 @@ static ImBuf * seq_render_scene_strip_impl(
        int doseq;
        int doseq_gl= G.rendering ? /*(scene->r.seq_flag & R_SEQ_GL_REND)*/ 0 : /*(scene->r.seq_flag & R_SEQ_GL_PREV)*/ 1;
        int have_seq= FALSE;
-       Scene *sce= seq->scene; /* dont refer to seq->scene above this point!, it can be NULL */
-       int sce_valid= FALSE;
+       Scene *scene;
 
-       if(sce) {
-               have_seq= (sce->r.scemode & R_DOSEQ) && sce->ed && sce->ed->seqbase.first;
-               sce_valid= (sce->camera || have_seq);
+       /* dont refer to seq->scene above this point!, it can be NULL */
+       if(seq->scene == NULL) {
+               return NULL;
        }
 
-       if (!sce_valid)
-               return NULL;
+       scene= seq->scene;
+
+       have_seq= (scene->r.scemode & R_DOSEQ) && scene->ed && scene->ed->seqbase.first;
 
-       oldcfra= seq->scene->r.cfra;
-       oldcamera= seq->scene->camera;
+       oldcfra= scene->r.cfra; 
+       scene->r.cfra= frame;
+
+       if(seq->scene_camera)   
+               camera= seq->scene_camera;
+       else {  
+               scene_camera_switch_update(scene);
+               camera= scene->camera;
+       }
+
+       if(have_seq==FALSE && camera==NULL) {
+               scene->r.cfra= oldcfra;
+               return NULL;
+       }
 
        /* prevent eternal loop */
        doseq= context.scene->r.scemode & R_DOSEQ;
        context.scene->r.scemode &= ~R_DOSEQ;
        
-       seq->scene->r.cfra= frame;
-       if(seq->scene_camera)   
-               seq->scene->camera= seq->scene_camera;
-       else    
-               scene_camera_switch_update(seq->scene);
-       
 #ifdef DURIAN_CAMERA_SWITCH
        /* stooping to new low's in hackyness :( */
-       oldmarkers= seq->scene->markers;
-       seq->scene->markers.first= seq->scene->markers.last= NULL;
+       oldmarkers= scene->markers;
+       scene->markers.first= scene->markers.last= NULL;
 #endif
        
-       if(sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (seq->scene == context.scene || have_seq==0) && seq->scene->camera) {
+       if(sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (scene == context.scene || have_seq==0) && camera) {
                char err_out[256]= "unknown";
                /* for old scened this can be uninitialized, should probably be added to do_versions at some point if the functionality stays */
                if(context.scene->r.seq_prev_type==0)
                        context.scene->r.seq_prev_type = 3 /* ==OB_SOLID */; 
 
                /* opengl offscreen render */
-               scene_update_for_newframe(context.bmain, seq->scene, seq->scene->lay);
-               ibuf= sequencer_view3d_cb(seq->scene, context.rectx, context.recty, IB_rect, context.scene->r.seq_prev_type, err_out);
+               scene_update_for_newframe(context.bmain, scene, scene->lay);
+               ibuf= sequencer_view3d_cb(scene, camera, context.rectx, context.recty, IB_rect, context.scene->r.seq_prev_type, err_out);
                if(ibuf == NULL) {
                        fprintf(stderr, "seq_render_scene_strip_impl failed to get opengl buffer: %s\n", err_out);
                }
        }
        else {
-               Render *re = RE_GetRender(sce->id.name);
+               Render *re = RE_GetRender(scene->id.name);
                RenderResult rres;
 
                /* XXX: this if can be removed when sequence preview rendering uses the job system */
-               if(rendering || context.scene != sce) {
+               if(rendering || context.scene != scene) {
                        if(re==NULL)
-                               re= RE_NewRender(sce->id.name);
+                               re= RE_NewRender(scene->id.name);
                        
-                       RE_BlenderFrame(re, context.bmain, sce, NULL, sce->lay, frame, FALSE);
+                       RE_BlenderFrame(re, context.bmain, scene, NULL, camera, scene->lay, frame, FALSE);
 
                        /* restore previous state after it was toggled on & off by RE_BlenderFrame */
                        G.rendering = rendering;
@@ -1981,14 +1987,14 @@ static ImBuf * seq_render_scene_strip_impl(
        /* restore */
        context.scene->r.scemode |= doseq;
        
-       seq->scene->r.cfra = oldcfra;
-       seq->scene->camera= oldcamera;
+       scene->r.cfra = oldcfra;
+
        if(frame != oldcfra)
-               scene_update_for_newframe(context.bmain, seq->scene, seq->scene->lay);
+               scene_update_for_newframe(context.bmain, scene, scene->lay);
        
 #ifdef DURIAN_CAMERA_SWITCH
        /* stooping to new low's in hackyness :( */
-       seq->scene->markers= oldmarkers;
+       scene->markers= oldmarkers;
 #endif
 
        return ibuf;
index 05a653d7c953be72fe271f8dcac37d4c2c6a3a4b..a66caf8879f2b79679d9d9032e51ac108a864b4b 100644 (file)
@@ -74,6 +74,7 @@
 static int ccgDM_getVertMapIndex(CCGSubSurf *ss, CCGVert *v);
 static int ccgDM_getEdgeMapIndex(CCGSubSurf *ss, CCGEdge *e);
 static int ccgDM_getFaceMapIndex(CCGSubSurf *ss, CCGFace *f);
+static int ccgDM_use_grid_pbvh(CCGDerivedMesh *ccgdm);
 
 ///
 
@@ -1157,7 +1158,7 @@ static void ccgDM_drawVerts(DerivedMesh *dm) {
 
 static void ccgdm_pbvh_update(CCGDerivedMesh *ccgdm)
 {
-       if(ccgdm->pbvh) {
+       if(ccgdm->pbvh && ccgDM_use_grid_pbvh(ccgdm)) {
                CCGFace **faces;
                int totface;
 
@@ -2249,10 +2250,22 @@ static ListBase *ccgDM_getFaceMap(Object *ob, DerivedMesh *dm)
        return ccgdm->fmap;
 }
 
+static int ccgDM_use_grid_pbvh(CCGDerivedMesh *ccgdm)
+{
+       MultiresModifierData *mmd= ccgdm->multires.mmd;
+
+       /* both of multires and subsurm modifiers are CCG, but
+          grids should only be used when sculpting on multires */
+       if(!mmd)
+               return 0;
+
+       return 1;
+}
+
 static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm)
 {
        CCGDerivedMesh *ccgdm= (CCGDerivedMesh*)dm;
-       int gridSize, numGrids;
+       int gridSize, numGrids, grid_pbvh;
 
        if(!ob) {
                ccgdm->pbvh= NULL;
@@ -2262,13 +2275,17 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm)
        if(!ob->sculpt)
                return NULL;
 
+       grid_pbvh= ccgDM_use_grid_pbvh(ccgdm);
+
        if(ob->sculpt->pbvh) {
-          /* pbvh's grids, gridadj and gridfaces points to data inside ccgdm
-                 but this can be freed on ccgdm release, this updates the pointers
-                 when the ccgdm gets remade, the assumption is that the topology
-                 does not change. */
-               ccgdm_create_grids(dm);
-               BLI_pbvh_grids_update(ob->sculpt->pbvh, ccgdm->gridData, ccgdm->gridAdjacency, (void**)ccgdm->gridFaces);
+               if(grid_pbvh) {
+                       /* pbvh's grids, gridadj and gridfaces points to data inside ccgdm
+                          but this can be freed on ccgdm release, this updates the pointers
+                          when the ccgdm gets remade, the assumption is that the topology
+                          does not change. */
+                       ccgdm_create_grids(dm);
+                       BLI_pbvh_grids_update(ob->sculpt->pbvh, ccgdm->gridData, ccgdm->gridAdjacency, (void**)ccgdm->gridFaces);
+               }
 
                ccgdm->pbvh = ob->sculpt->pbvh;
        }
@@ -2279,14 +2296,21 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm)
        /* no pbvh exists yet, we need to create one. only in case of multires
           we build a pbvh over the modified mesh, in other cases the base mesh
           is being sculpted, so we build a pbvh from that. */
-       ccgdm_create_grids(dm);
+       if(grid_pbvh) {
+               ccgdm_create_grids(dm);
 
-       gridSize = ccgDM_getGridSize(dm);
-       numGrids = ccgDM_getNumGrids(dm);
+               gridSize = ccgDM_getGridSize(dm);
+               numGrids = ccgDM_getNumGrids(dm);
 
-       ob->sculpt->pbvh= ccgdm->pbvh = BLI_pbvh_new();
-       BLI_pbvh_build_grids(ccgdm->pbvh, ccgdm->gridData, ccgdm->gridAdjacency,
-               numGrids, gridSize, (void**)ccgdm->gridFaces);
+               ob->sculpt->pbvh= ccgdm->pbvh = BLI_pbvh_new();
+               BLI_pbvh_build_grids(ccgdm->pbvh, ccgdm->gridData, ccgdm->gridAdjacency,
+                       numGrids, gridSize, (void**)ccgdm->gridFaces);
+       } else if(ob->type == OB_MESH) {
+               Mesh *me= ob->data;
+               ob->sculpt->pbvh= ccgdm->pbvh = BLI_pbvh_new();
+               BLI_pbvh_build_mesh(ccgdm->pbvh, me->mface, me->mvert,
+                                  me->totface, me->totvert);
+       }
 
        return ccgdm->pbvh;
 }
index 672fd06f95dfddaba0f7b4769a2ba102e48017d3..866874ee5c86b5acc2fadabb0dcf4b7039bf4a8c 100644 (file)
@@ -73,7 +73,7 @@
 #include "BKE_icons.h"
 #include "BKE_node.h"
 #include "BKE_animsys.h"
-
+#include "BKE_colortools.h"
 
 /* ------------------------------------------------------------------------- */
 
@@ -762,9 +762,8 @@ Tex *copy_texture(Tex *tex)
        
        if(texn->coba) texn->coba= MEM_dupallocN(texn->coba);
        if(texn->env) texn->env= BKE_copy_envmap(texn->env);
-       if(texn->pd) texn->pd= MEM_dupallocN(texn->pd);
+       if(texn->pd) texn->pd= BKE_copy_pointdensity(texn->pd);
        if(texn->vd) texn->vd= MEM_dupallocN(texn->vd);
-       
        if(tex->preview) texn->preview = BKE_previewimg_copy(tex->preview);
 
        if(tex->nodetree) {
@@ -795,14 +794,7 @@ Tex *localize_texture(Tex *tex)
                texn->env= BKE_copy_envmap(texn->env);
                id_us_min(&texn->env->ima->id);
        }
-       if(texn->pd) {
-               texn->pd= MEM_dupallocN(texn->pd);
-               if(texn->pd->coba) {
-                       texn->pd->point_tree = NULL;
-                       texn->pd->coba= MEM_dupallocN(texn->pd->coba);
-               }
-
-       }
+       if(texn->pd) texn->pd= BKE_copy_pointdensity(texn->pd);
        if(texn->vd) {
                texn->vd= MEM_dupallocN(texn->vd);
                if(texn->vd->dataset)
@@ -1367,6 +1359,13 @@ PointDensity *BKE_add_pointdensity(void)
        pd->object = NULL;
        pd->psys = 0;
        pd->psys_cache_space= TEX_PD_WORLDSPACE;
+       pd->falloff_curve = curvemapping_add(1, 0, 0, 1, 1);
+
+       pd->falloff_curve->preset = CURVE_PRESET_LINE;
+       pd->falloff_curve->cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
+       curvemap_reset(pd->falloff_curve->cm, &pd->falloff_curve->clipr, pd->falloff_curve->preset, CURVEMAP_SLOPE_POSITIVE);
+       curvemapping_changed(pd->falloff_curve, 0);
+
        return pd;
 } 
 
@@ -1378,7 +1377,7 @@ PointDensity *BKE_copy_pointdensity(PointDensity *pd)
        pdn->point_tree = NULL;
        pdn->point_data = NULL;
        if(pdn->coba) pdn->coba= MEM_dupallocN(pdn->coba);
-       
+       pdn->falloff_curve = curvemapping_copy(pdn->falloff_curve); /* can be NULL */
        return pdn;
 }
 
@@ -1396,6 +1395,8 @@ void BKE_free_pointdensitydata(PointDensity *pd)
                MEM_freeN(pd->coba);
                pd->coba = NULL;
        }
+
+       curvemapping_free(pd->falloff_curve); /* can be NULL */
 }
 
 void BKE_free_pointdensity(PointDensity *pd)
index 73af9a3738c2bc0dde15db31650eb814975c0a02..90556ea4b053e087969f024b86cea68a910d0324 100644 (file)
@@ -45,9 +45,16 @@ extern "C" {
 void BLI_insertlink(struct ListBase *listbase, void *vprevlink, void *vnewlink);
 void *BLI_findlink(const struct ListBase *listbase, int number);
 int BLI_findindex(const struct ListBase *listbase, void *vlink);
+int BLI_findstringindex(const struct ListBase *listbase, const char *id, const int offset);
+
+/* find forwards */
 void *BLI_findstring(const struct ListBase *listbase, const char *id, const int offset);
 void *BLI_findstring_ptr(const struct ListBase *listbase, const char *id, const int offset);
-int BLI_findstringindex(const struct ListBase *listbase, const char *id, const int offset);
+
+/* find backwards */
+void *BLI_rfindstring(const struct ListBase *listbase, const char *id, const int offset);
+void *BLI_rfindstring_ptr(const struct ListBase *listbase, const char *id, const int offset);
+
 void BLI_freelistN(struct ListBase *listbase);
 void BLI_addtail(struct ListBase *listbase, void *vlink);
 void BLI_remlink(struct ListBase *listbase, void *vlink);
index 8937612b41bfdbfa55be686050deb52e9cc1580e..756d1501536a041b61ec7d3b67cfa886818a4d90 100644 (file)
@@ -91,6 +91,11 @@ int isect_line_line_v3(const float v1[3], const float v2[3],
 int isect_line_line_strict_v3(const float v1[3], const float v2[3],
        const float v3[3], const float v4[3], float vi[3], float *lambda);
 
+/*if clip is nonzero, will only return true if lambda is >= 0.0
+  (i.e. intersection point is along positive d)*/
+int isect_ray_plane_v3(float p1[3], float d[3], float v0[3], 
+                                          float v1[3], float v2[3], float *lambda, int clip);
+
 /* line/ray triangle */
 int isect_line_tri_v3(const float p1[3], const float p2[3],
        const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2]);
index 3e86079dcad62547e725097a05ac35e64d6664f8..dd4ae7818329ea7422c16b42b8dfb54303481e9e 100644 (file)
@@ -109,15 +109,15 @@ void BLI_make_file_string(const char *relabase, char *string,  const char *dir,
 void BLI_make_exist(char *dir);
 void BLI_make_existing_file(const char *name);
 void BLI_split_dirfile(const char *string, char *dir, char *file);
-void BLI_join_dirfile(char *string, const int maxlen, const char *dir, const char *file);
+void BLI_join_dirfile(char *string, const size_t maxlen, const char *dir, const char *file);
 char *BLI_path_basename(char *path);
-int BKE_rebase_path(char *abs, int abs_size, char *rel, int rel_size, const char *base_dir, const char *src_dir, const char *dest_dir);
+int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const char *base_dir, const char *src_dir, const char *dest_dir);
 char *BLI_last_slash(const char *string);
 int      BLI_add_slash(char *string);
 void  BLI_del_slash(char *string);
 char *BLI_first_slash(char *string);
 
-void BLI_getlastdir(const char* dir, char *last, int maxlen);
+void BLI_getlastdir(const char* dir, char *last, const size_t maxlen);
 int BLI_testextensie(const char *str, const char *ext);
 int BLI_testextensie_array(const char *str, const char **ext_array);
 int BLI_testextensie_glob(const char *str, const char *ext_fnmatch);
@@ -195,9 +195,8 @@ void BLI_char_switch(char *string, char from, char to);
         * @param fullname The full path and full name of the executable
         * @param name The name of the executable (usually argv[0]) to be checked
         */
-void BLI_where_am_i(char *fullname, const int maxlen, const char *name);
+void BLI_where_am_i(char *fullname, const size_t maxlen, const char *name);
 
-char *get_install_dir(void);
        /**
         * Gets the temp directory when blender first runs.
         * If the default path is not found, use try $TEMP
@@ -206,7 +205,7 @@ char *get_install_dir(void);
         *
         * @param fullname The full path to the temp directory
         */
-void BLI_where_is_temp(char *fullname, const int maxlen, int usertemp);
+void BLI_where_is_temp(char *fullname, const size_t maxlen, int usertemp);
 
 
 #ifdef WITH_ICONV
index 176e7319bf78fa60f1d8da7a0a0788d6a26188e8..d0eb3c7d67d3d6a4713cf87c146cc9ac80ab4ec4 100644 (file)
@@ -127,7 +127,6 @@ typedef struct _DIR {
        struct dirent direntry;
 } DIR;
 
-int IsConsoleEmpty(void);
 void RegisterBlendExtension(void);
 DIR *opendir (const char *path);
 struct dirent *readdir(DIR *dp);
index 15bdb4a446fc1d2b3fb626c617a1070cf14adf74..05f71e0c01fa2f264e9a2494bc045ef080af30e4 100644 (file)
@@ -366,14 +366,30 @@ void *BLI_findstring(const ListBase *listbase, const char *id, const int offset)
 
        if (listbase == NULL) return NULL;
 
-       link= listbase->first;
-       while (link) {
+       for (link= listbase->first; link; link= link->next) {
                id_iter= ((const char *)link) + offset;
 
-               if(id[0] == id_iter[0] && strcmp(id, id_iter)==0)
+               if (id[0] == id_iter[0] && strcmp(id, id_iter)==0) {
                        return link;
+               }
+       }
 
-               link= link->next;
+       return NULL;
+}
+/* same as above but find reverse */
+void *BLI_rfindstring(const ListBase *listbase, const char *id, const int offset)
+{
+       Link *link= NULL;
+       const char *id_iter;
+
+       if (listbase == NULL) return NULL;
+
+       for (link= listbase->last; link; link= link->prev) {
+               id_iter= ((const char *)link) + offset;
+
+               if (id[0] == id_iter[0] && strcmp(id, id_iter)==0) {
+                       return link;
+               }
        }
 
        return NULL;
@@ -386,15 +402,32 @@ void *BLI_findstring_ptr(const ListBase *listbase, const char *id, const int off
 
        if (listbase == NULL) return NULL;
 
-       link= listbase->first;
-       while (link) {
+       for (link= listbase->first; link; link= link->next) {
                /* exact copy of BLI_findstring(), except for this line */
                id_iter= *((const char **)(((const char *)link) + offset));
 
-               if(id[0] == id_iter[0] && strcmp(id, id_iter)==0)
+               if (id[0] == id_iter[0] && strcmp(id, id_iter)==0) {
                        return link;
+               }
+       }
 
-               link= link->next;
+       return NULL;
+}
+/* same as above but find reverse */
+void *BLI_rfindstring_ptr(const ListBase *listbase, const char *id, const int offset)
+{
+       Link *link= NULL;
+       const char *id_iter;
+
+       if (listbase == NULL) return NULL;
+
+       for (link= listbase->last; link; link= link->prev) {
+               /* exact copy of BLI_rfindstring(), except for this line */
+               id_iter= *((const char **)(((const char *)link) + offset));
+
+               if (id[0] == id_iter[0] && strcmp(id, id_iter)==0) {
+                       return link;
+               }
        }
 
        return NULL;
index 4af56c66dde01e36c8fcee6f3d033912b4962410..afce5a602ed11ac8aa2971d3b28ee6d330638bf2 100644 (file)
@@ -486,7 +486,6 @@ int isect_line_tri_v3(const float p1[3], const float p2[3], const float v0[3], c
        
        return 1;
 }
-
 /* moved from effect.c
    test if the ray starting at p1 going in d direction intersects the triangle v0..v2
    return non zero if it does 
@@ -527,6 +526,35 @@ int isect_ray_tri_v3(const float p1[3], const float d[3], const float v0[3], con
        return 1;
 }
 
+int isect_ray_plane_v3(float p1[3], float d[3], float v0[3], float v1[3], float v2[3], float *lambda, int clip)
+{
+       float p[3], s[3], e1[3], e2[3], q[3];
+       float a, f, u, v;
+       
+       sub_v3_v3v3(e1, v1, v0);
+       sub_v3_v3v3(e2, v2, v0);
+       
+       cross_v3_v3v3(p, d, e2);
+       a = dot_v3v3(e1, p);
+       /* note: these values were 0.000001 in 2.4x but for projection snapping on
+        * a human head (1BU==1m), subsurf level 2, this gave many errors - campbell */
+       if ((a > -0.00000001f) && (a < 0.00000001f)) return 0;
+       f = 1.0f/a;
+       
+       sub_v3_v3v3(s, p1, v0);
+       
+       u = f * dot_v3v3(s, p);
+
+       cross_v3_v3v3(q, s, e1);
+       
+       v = f * dot_v3v3(d, q);
+
+       *lambda = f * dot_v3v3(e2, q);
+       if (clip && (*lambda < 0.0f)) return 0;
+
+       return 1;
+}
+
 int isect_ray_tri_epsilon_v3(const float p1[3], const float d[3], const float v0[3], const float v1[3], const float v2[3], float *lambda, float uv[2], const float epsilon)
 {
        float p[3], s[3], e1[3], e2[3], q[3];
index 1a47a93ab510ac2776cf32c08317266663d433e5..e8e8127be0c7ac9085c37c46bb1e59aad75fadb6 100644 (file)
@@ -763,7 +763,7 @@ void BLI_splitdirstring(char *di, char *fi)
        }
 }
 
-void BLI_getlastdir(const char* dir, char *last, int maxlen)
+void BLI_getlastdir(const char* dir, char *last, const size_t maxlen)
 {
        const char *s = dir;
        const char *lslash = NULL;
@@ -1441,7 +1441,7 @@ void BLI_split_dirfile(const char *string, char *dir, char *file)
 }
 
 /* simple appending of filename to dir, does not check for valid path! */
-void BLI_join_dirfile(char *string, const int maxlen, const char *dir, const char *file)
+void BLI_join_dirfile(char *string, const size_t maxlen, const char *dir, const char *file)
 {
        int sl_dir;
        
@@ -1491,7 +1491,7 @@ char *BLI_path_basename(char *path)
   that a user gets his images in one place. It'll also provide
   consistent behaviour across exporters.
  */
-int BKE_rebase_path(char *abs, int abs_size, char *rel, int rel_size, const char *base_dir, const char *src_dir, const char *dest_dir)
+int BKE_rebase_path(char *abs, size_t abs_len, char *rel, size_t rel_len, const char *base_dir, const char *src_dir, const char *dest_dir)
 {
        char path[FILE_MAX];
        char dir[FILE_MAX];
@@ -1547,11 +1547,11 @@ int BKE_rebase_path(char *abs, int abs_size, char *rel, int rel_size, const char
        }
 
        if (abs)
-               BLI_strncpy(abs, dest_path, abs_size);
+               BLI_strncpy(abs, dest_path, abs_len);
 
        if (rel) {
-               strncat(rel, rel_dir, rel_size);
-               strncat(rel, base, rel_size);
+               strncat(rel, rel_dir, rel_len);
+               strncat(rel, base, rel_len);
        }
 
        /* return 2 if src=dest */
@@ -1667,7 +1667,7 @@ static int add_win32_extension(char *name)
 }
 
 /* filename must be FILE_MAX length minimum */
-void BLI_where_am_i(char *fullname, const int maxlen, const char *name)
+void BLI_where_am_i(char *fullname, const size_t maxlen, const char *name)
 {
        char filename[FILE_MAXDIR+FILE_MAXFILE];
        const char *path = NULL, *temp;
@@ -1756,7 +1756,7 @@ void BLI_where_am_i(char *fullname, const int maxlen, const char *name)
        }
 }
 
-void BLI_where_is_temp(char *fullname, const int maxlen, int usertemp)
+void BLI_where_is_temp(char *fullname, const size_t maxlen, int usertemp)
 {
        fullname[0] = '\0';
        
@@ -1802,26 +1802,6 @@ void BLI_where_is_temp(char *fullname, const int maxlen, int usertemp)
        }
 }
 
-char *get_install_dir(void) {
-       char *tmpname = BLI_strdup(bprogname);
-       char *cut;
-
-#ifdef __APPLE__
-       cut = strstr(tmpname, ".app");
-       if (cut) cut[0] = 0;
-#endif
-
-       cut = BLI_last_slash(tmpname);
-
-       if (cut) {
-               cut[0] = 0;
-               return tmpname;
-       } else {
-               MEM_freeN(tmpname);
-               return NULL;
-       }
-}
-
 #ifdef WITH_ICONV
 
 void BLI_string_to_utf8(char *original, char *utf_8, const char *code)
index 596ab2b04703eb6fe89777f71fbd64e4f91e907b..66080ed2a8516673adbaafab6d8156b64667b00d 100644 (file)
@@ -66,14 +66,6 @@ int BLI_getInstallationDir( char * str ) {
        return 1;
 }
 
-int IsConsoleEmpty(void)
-{
-       CONSOLE_SCREEN_BUFFER_INFO csbi = {{0}};
-       HANDLE hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
-
-       return GetConsoleScreenBufferInfo(hStdOutput, &csbi) && csbi.dwCursorPosition.X == 0 && csbi.dwCursorPosition.Y == 0;
-}
-
 void RegisterBlendExtension_Fail(HKEY root)
 {
        printf("failed\n");
index abc469a5355dcea2f4aca84be96249a747844b53..39fab1929da6b8eb7fc3206ff1aaa929c10dcba0 100644 (file)
@@ -206,8 +206,6 @@ LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *to
                        }
                } else if (bhead->code==ENDB) {
                        break;
-               } else if (bhead->code==DATA) {
-                       /* DATA blocks between IDBlock and Preview */
                } else {
                        looking = 0;
                        new_prv = NULL;
index 02c77a7e1a40638ee8efb6b3f5d551dfd638975d..8246dd2170e685aee54fa077310003949bb3603c 100644 (file)
@@ -2992,6 +2992,10 @@ static void direct_link_texture(FileData *fd, Tex *tex)
        if(tex->pd) {
                tex->pd->point_tree = NULL;
                tex->pd->coba= newdataadr(fd, tex->pd->coba);
+               tex->pd->falloff_curve= newdataadr(fd, tex->pd->falloff_curve);
+               if(tex->pd->falloff_curve) {
+                       direct_link_curvemapping(fd, tex->pd->falloff_curve);
+               }
        }
        
        tex->vd= newdataadr(fd, tex->vd);
@@ -3794,7 +3798,12 @@ static void lib_link_object(FileData *fd, Main *main)
                                }
                                else if(act->type==ACT_OBJECT) {
                                        bObjectActuator *oa= act->data;
-                                       oa->reference= newlibadr(fd, ob->id.lib, oa->reference);
+                                       if(oa==NULL) {
+                                               init_actuator(act);
+                                       }
+                                       else {
+                                               oa->reference= newlibadr(fd, ob->id.lib, oa->reference);
+                                       }
                                }
                                else if(act->type==ACT_EDIT_OBJECT) {
                                        bEditObjectActuator *eoa= act->data;
@@ -3806,15 +3815,6 @@ static void lib_link_object(FileData *fd, Main *main)
                                                eoa->me= newlibadr(fd, ob->id.lib, eoa->me);
                                        }
                                }
-                               else if(act->type==ACT_OBJECT) {
-                                       bObjectActuator *oa= act->data;
-                                       if(oa==NULL) {
-                                               init_actuator(act);
-                                       }
-                                       else {
-                                               oa->reference= newlibadr(fd, ob->id.lib, oa->reference);
-                                       }
-                               }
                                else if(act->type==ACT_SCENE) {
                                        bSceneActuator *sa= act->data;
                                        sa->camera= newlibadr(fd, ob->id.lib, sa->camera);
@@ -4151,6 +4151,13 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
                                                SWITCH_INT(mmd->bindcos[a])
                        }
                }
+               else if (md->type==eModifierType_Warp) {
+                       WarpModifierData *tmd = (WarpModifierData *) md;
+
+                       tmd->curfalloff= newdataadr(fd, tmd->curfalloff);
+                       if(tmd->curfalloff)
+                               direct_link_curvemapping(fd, tmd->curfalloff);
+               }
        }
 }
 
@@ -8760,11 +8767,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                ima->gen_x= 256; ima->gen_y= 256;
                                ima->gen_type= 1;
                                
-                               if(0==strncmp(ima->id.name+2, "Viewer Node", sizeof(ima->id.name+2))) {
+                               if(0==strncmp(ima->id.name+2, "Viewer Node", sizeof(ima->id.name)-2)) {
                                        ima->source= IMA_SRC_VIEWER;
                                        ima->type= IMA_TYPE_COMPOSITE;
                                }
-                               if(0==strncmp(ima->id.name+2, "Render Result", sizeof(ima->id.name+2))) {
+                               if(0==strncmp(ima->id.name+2, "Render Result", sizeof(ima->id.name)-2)) {
                                        ima->source= IMA_SRC_VIEWER;
                                        ima->type= IMA_TYPE_R_RESULT;
                                }
@@ -11639,32 +11646,57 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
        /* put compatibility code here until next subversion bump */
 
        {
-               ARegion *ar;
-               /* screen view2d settings were not properly initialized [#27164] */
+               /* screen view2d settings were not properly initialized [#27164]
+                * v2d->scroll caused the bug but best reset other values too which are in old blend files only.
+                * need to make less ugly - possibly an iterator? */
                bScreen *screen;
                for(screen= main->screen.first; screen; screen= screen->id.next) {
                        ScrArea *sa;
                        /* add regions */
                        for(sa= screen->areabase.first; sa; sa= sa->next) {
-                               SpaceLink *sl;
+                               SpaceLink *sl= sa->spacedata.first;
+                               if(sl->spacetype==SPACE_IMAGE) {
+                                       ARegion *ar;
+                                       for (ar=sa->regionbase.first; ar; ar= ar->next) {
+                                               if(ar->regiontype == RGN_TYPE_WINDOW) {
+                                                       View2D *v2d= &ar->v2d;
+                                                       v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0;
+                                               }
+                                       }
+                               }
                                for (sl= sa->spacedata.first; sl; sl= sl->next) {
                                        if(sl->spacetype==SPACE_IMAGE) {
-                                               for (ar=sa->regionbase.first; ar; ar= ar->next) {
+                                               ARegion *ar;
+                                               for (ar=sl->regionbase.first; ar; ar= ar->next) {
                                                        if(ar->regiontype == RGN_TYPE_WINDOW) {
                                                                View2D *v2d= &ar->v2d;
-                                                               v2d->minzoom= 0;
-                                                               v2d->maxzoom= 0;
-                                                               v2d->scroll= 0; /* cause of bug, but set others just incase */
-                                                               v2d->keeptot= 0;
-                                                               v2d->keepzoom= 0;
-                                                               v2d->keepofs= 0;
-                                                               v2d->align= 0;
+                                                               v2d->minzoom= v2d->maxzoom= v2d->scroll= v2d->keeptot= v2d->keepzoom= v2d->keepofs= v2d->align= 0;
                                                        }
                                                }
                                        }
                                }
                        }
                }
+
+               {
+                       /* Initialize texture point density curve falloff */
+                       Tex *tex;
+                       for(tex= main->tex.first; tex; tex= tex->id.next) {
+                               if(tex->pd) {
+                                       if (tex->pd->falloff_speed_scale == 0.0)
+                                               tex->pd->falloff_speed_scale = 100.0;
+
+                                       if (!tex->pd->falloff_curve) {
+                                               tex->pd->falloff_curve = curvemapping_add(1, 0, 0, 1, 1);
+
+                                               tex->pd->falloff_curve->preset = CURVE_PRESET_LINE;
+                                               tex->pd->falloff_curve->cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE;
+                                               curvemap_reset(tex->pd->falloff_curve->cm, &tex->pd->falloff_curve->clipr, tex->pd->falloff_curve->preset, CURVEMAP_SLOPE_POSITIVE);
+                                               curvemapping_changed(tex->pd->falloff_curve, 0);
+                                       }
+                               }
+                       }
+               }
        }
        
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
index 56db4d2a26e3e47c034e3209c14bca370a3a1a8b..783a59b7e34402a3655bb9cf137025ad250ea4e1 100644 (file)
@@ -1274,6 +1274,12 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
                        writestruct(wd, DATA, "MDefInfluence", mmd->totinfluence, mmd->dyninfluences);
                        writedata(wd, DATA, sizeof(int)*mmd->totvert, mmd->dynverts);
                }
+               else if (md->type==eModifierType_Warp) {
+                       WarpModifierData *tmd = (WarpModifierData*) md;
+                       if(tmd->curfalloff) {
+                               write_curvemapping(wd, tmd->curfalloff);
+                       }
+               }
        }
 }
 
@@ -1698,6 +1704,7 @@ static void write_textures(WriteData *wd, ListBase *idbase)
                        if(tex->type == TEX_POINTDENSITY && tex->pd) {
                                writestruct(wd, DATA, "PointDensity", 1, tex->pd);
                                if(tex->pd->coba) writestruct(wd, DATA, "ColorBand", 1, tex->pd->coba);
+                               if(tex->pd->falloff_curve) write_curvemapping(wd, tex->pd->falloff_curve);
                        }
                        if(tex->type == TEX_VOXELDATA && tex->vd) writestruct(wd, DATA, "VoxelData", 1, tex->vd);
                        
@@ -2623,187 +2630,3 @@ int BLO_write_file_mem(Main *mainvar, MemFile *compare, MemFile *current, int wr
        if(err==0) return 1;
        return 0;
 }
-
-
-       /* Runtime writing */
-
-static char *get_runtime_path(char *exename) {
-       char *installpath= get_install_dir();
-
-       if (!installpath) {
-               return NULL;
-       }
-       else {
-               char *path= BLI_sprintfN("%s%c%s", installpath, SEP, exename);
-
-               if (path == NULL) {
-                       MEM_freeN(installpath);
-                       return NULL;
-               }
-
-               MEM_freeN(installpath);
-
-               return path;
-       }
-}
-
-#ifdef __APPLE__
-
-static int recursive_copy_runtime(const char *outname, char *exename, ReportList *reports)
-{
-       char *runtime = get_runtime_path(exename);
-       char command[2 * (FILE_MAXDIR+FILE_MAXFILE) + 32];
-       int progfd = -1, error= 0;
-
-       if (!runtime) {
-               BKE_report(reports, RPT_ERROR, "Unable to find runtime");
-               error= 1;
-               goto cleanup;
-       }
-       //printf("runtimepath %s\n", runtime);
-               
-       progfd= open(runtime, O_BINARY|O_RDONLY, 0);
-       if (progfd==-1) {
-               BKE_report(reports, RPT_ERROR, "Unable to find runtime");
-               error= 1;
-               goto cleanup;
-       }
-
-       sprintf(command, "/bin/cp -R \"%s\" \"%s\"", runtime, outname);
-       //printf("command %s\n", command);
-       if (system(command) == -1) {
-               BKE_report(reports, RPT_ERROR, "Couldn't copy runtime");
-               error= 1;
-       }
-
-cleanup:
-       if (progfd!=-1)
-               close(progfd);
-       if (runtime)
-               MEM_freeN(runtime);
-
-       return !error;
-}
-
-int BLO_write_runtime(Main *mainvar, const char *file, char *exename, ReportList *reports) 
-{
-       char gamename[FILE_MAXDIR+FILE_MAXFILE];
-       int outfd = -1, error= 0;
-
-       // remove existing file / bundle
-       //printf("Delete file %s\n", file);
-       BLI_delete(file, 0, TRUE);
-
-       if (!recursive_copy_runtime(file, exename, reports)) {
-               error= 1;
-               goto cleanup;
-       }
-
-       BLI_snprintf(gamename, sizeof(gamename), "%s/Contents/Resources/game.blend", file);
-       //printf("gamename %s\n", gamename);
-       outfd= open(gamename, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, 0777);
-       if (outfd != -1) {
-
-               write_file_handle(mainvar, outfd, NULL,NULL, 0, G.fileflags, NULL);
-
-               if (write(outfd, " ", 1) != 1) {
-                       BKE_report(reports, RPT_ERROR, "Unable to write to output file.");
-                       error= 1;
-                       goto cleanup;
-               }
-       } else {
-               BKE_report(reports, RPT_ERROR, "Unable to open blenderfile.");
-               error= 1;
-       }
-
-cleanup:
-       if (outfd!=-1)
-               close(outfd);
-
-       BKE_reports_prepend(reports, "Unable to make runtime: ");
-       return !error;
-}
-
-#else /* !__APPLE__ */
-
-static int handle_append_runtime(int handle, char *exename, ReportList *reports)
-{
-       char *runtime= get_runtime_path(exename);
-       unsigned char buf[1024];
-       int count, progfd= -1, error= 0;
-
-       if (!BLI_exists(runtime)) {
-               BKE_report(reports, RPT_ERROR, "Unable to find runtime.");
-               error= 1;
-               goto cleanup;
-       }
-
-       progfd= open(runtime, O_BINARY|O_RDONLY, 0);
-       if (progfd==-1) {
-               BKE_report(reports, RPT_ERROR, "Unable to find runtime.@");
-               error= 1;
-               goto cleanup;
-       }
-
-       while ((count= read(progfd, buf, sizeof(buf)))>0) {
-               if (write(handle, buf, count)!=count) {
-                       BKE_report(reports, RPT_ERROR, "Unable to write to output file.");
-                       error= 1;
-                       goto cleanup;
-               }
-       }
-
-cleanup:
-       if (progfd!=-1)
-               close(progfd);
-       if (runtime)
-               MEM_freeN(runtime);
-
-       return !error;
-}
-
-static int handle_write_msb_int(int handle, int i) 
-{
-       unsigned char buf[4];
-       buf[0]= (i>>24)&0xFF;
-       buf[1]= (i>>16)&0xFF;
-       buf[2]= (i>>8)&0xFF;
-       buf[3]= (i>>0)&0xFF;
-
-       return (write(handle, buf, 4)==4);
-}
-
-int BLO_write_runtime(Main *mainvar, const char *file, char *exename, ReportList *reports)
-{
-       int outfd= open(file, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, 0777);
-       int datastart, error= 0;
-
-       if (!outfd) {
-               BKE_report(reports, RPT_ERROR, "Unable to open output file.");
-               error= 1;
-               goto cleanup;
-       }
-       if (!handle_append_runtime(outfd, exename, reports)) {
-               error= 1;
-               goto cleanup;
-       }
-
-       datastart= lseek(outfd, 0, SEEK_CUR);
-
-       write_file_handle(mainvar, outfd, NULL,NULL, 0, G.fileflags, NULL);
-
-       if (!handle_write_msb_int(outfd, datastart) || (write(outfd, "BRUNTIME", 8)!=8)) {
-               BKE_report(reports, RPT_ERROR, "Unable to write to output file.");
-               error= 1;
-               goto cleanup;
-       }
-
-cleanup:
-       if (outfd!=-1)
-               close(outfd);
-
-       BKE_reports_prepend(reports, "Unable to make runtime: ");
-       return !error;
-}
-
-#endif /* !__APPLE__ */
index f0f33ec3258f29c381ed9eb01ae1c13a1cda2c59..f4e9c7c5d3e3635db5b7c660d67225f648b019e1 100644 (file)
@@ -804,7 +804,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann
                                                
                                                for (ct= targets.first; ct; ct= ct->next) {
                                                        if (ct->tar == srcArm) {
-                                                               if (strcmp(ct->subtarget, "")==0) {
+                                                               if (ct->subtarget[0] == '\0') {
                                                                        ct->tar = tarArm;
                                                                }
                                                                else if (strcmp(ct->subtarget, pchan->name)==0) {
@@ -851,7 +851,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann
                                        
                                        for (ct= targets.first; ct; ct= ct->next) {
                                                if (ct->tar == srcArm) {
-                                                       if (strcmp(ct->subtarget, "")==0) {
+                                                       if (ct->subtarget[0] == '\0') {
                                                                ct->tar = tarArm;
                                                        }
                                                        else if (strcmp(ct->subtarget, pchan->name)==0) {
index 9bae4ea6569f4c09119ee4d5fef03b0f00baccfd..cb73f20fe7b54478d7e32a5504cd2453f08433ce 100644 (file)
@@ -1234,7 +1234,6 @@ void make_editNurb(Object *obedit)
        Nurb *nu, *newnu, *nu_act= NULL;
        KeyBlock *actkey;
 
-       if(obedit==NULL) return;
 
        set_actNurb(obedit, NULL);
 
@@ -1591,7 +1590,7 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
        BPoint *bp, *bpn, *newbp;
        int a, b, newu, newv, sel;
 
-       if(obedit && obedit->type==OB_SURF);
+       if(obedit->type==OB_SURF);
        else return OPERATOR_CANCELLED;
 
        cu->lastsel= NULL;
index 1a9ef4be70fa17bead51b05deb28a97bbc16f0b4..b93e4b0730202328084bdde43f60107ba6a96a30 100644 (file)
@@ -486,7 +486,7 @@ static void gp_draw_strokes (bGPDframe *gpf, int offsx, int offsy, int winx, int
        bGPDstroke *gps;
        
        /* set color first (may need to reset it again later too) */
-       glColor4f(color[0], color[1], color[2], color[3]);
+       glColor4fv(color);
        
        for (gps= gpf->strokes.first; gps; gps= gps->next) {
                /* check if stroke can be drawn - checks here generally fall into pairs */
@@ -579,7 +579,7 @@ static void gp_draw_data (bGPdata *gpd, int offsx, int offsy, int winx, int winy
                glLineWidth(lthick);
                QUATCOPY(color, gpl->color); // just for copying 4 array elements
                QUATCOPY(tcolor, gpl->color); // additional copy of color (for ghosting)
-               glColor4f(color[0], color[1], color[2], color[3]);
+               glColor4fv(color);
                glPointSize((float)(gpl->thickness + 2));
                
                /* apply xray layer setting */
@@ -620,7 +620,7 @@ static void gp_draw_data (bGPdata *gpd, int offsx, int offsy, int winx, int winy
                                }       
                                
                                /* restore alpha */
-                               glColor4f(color[0], color[1], color[2], color[3]);
+                               glColor4fv(color);
                        }
                        else {
                                /* draw the strokes for the ghost frames (at half of the alpha set by user) */
@@ -635,7 +635,7 @@ static void gp_draw_data (bGPdata *gpd, int offsx, int offsy, int winx, int winy
                                }
                                
                                /* restore alpha */
-                               glColor4f(color[0], color[1], color[2], color[3]);
+                               glColor4fv(color);
                        }
                }
                
index 04391d0c53187ffc96daa250bce72706f0ea4ebe..5763fcde7057443c5a4598adfab448cf0454871b 100644 (file)
@@ -1124,21 +1124,29 @@ static void gp_paint_initstroke (tGPsdata *p, short paintmode)
        /* set 'initial run' flag, which is only used to denote when a new stroke is starting */
        p->flags |= GP_PAINTFLAG_FIRSTRUN;
        
+
+       /* when drawing in the camera view, in 2D space, set the subrect */
+       if (!(p->gpd->flag & GP_DATA_VIEWALIGN)) {
+               if (p->sa->spacetype == SPACE_VIEW3D) {
+                       View3D *v3d= p->sa->spacedata.first;
+                       RegionView3D *rv3d= p->ar->regiondata;
+
+                       /* for camera view set the subrect */
+                       if (rv3d->persp == RV3D_CAMOB) {
+                               view3d_calc_camera_border(p->scene, p->ar, NULL, v3d, &p->subrect_data, -1); /* negative shift */
+                               p->subrect= &p->subrect_data;
+                       }
+               }
+       }
+
        /* check if points will need to be made in view-aligned space */
        if (p->gpd->flag & GP_DATA_VIEWALIGN) {
                switch (p->sa->spacetype) {
                        case SPACE_VIEW3D:
                        {
-                               View3D *v3d= p->sa->spacedata.first;
                                RegionView3D *rv3d= p->ar->regiondata;
                                float rvec[3];
                                
-                               /* for camera view set the subrect */
-                               if (rv3d->persp == RV3D_CAMOB) {
-                                       view3d_calc_camera_border(p->scene, p->ar, NULL, v3d, &p->subrect_data, -1); /* negative shift */
-                                       p->subrect= &p->subrect_data;
-                               }
-                               
                                /* get reference point for 3d space placement */
                                gp_get_3d_reference(p, rvec);
                                initgrabz(rv3d, rvec[0], rvec[1], rvec[2]);
index b975be54f5f1275d48293082af3c624d75b92224..f6106e62533da86601fb45eea3e21d200385a494 100644 (file)
 #ifndef ED_UVEDIT_H
 #define ED_UVEDIT_H
 
-struct bContext;
-struct Scene;
-struct Object;
-struct MTFace;
+struct ARegionType;
 struct EditFace;
 struct Image;
+struct MTFace;
+struct Object;
+struct Scene;
+struct bContext;
 struct wmKeyConfig;
 
 /* uvedit_ops.c */
@@ -77,5 +78,8 @@ void ED_unwrap_lscm(struct Scene *scene, struct Object *obedit, const short sel)
 /* uvedit_draw.c */
 void draw_uvedit_main(struct SpaceImage *sima, struct ARegion *ar, struct Scene *scene, struct Object *obedit);
 
+/* uvedit_buttons.c */
+void ED_uvedit_buttons_register(struct ARegionType *art);
+
 #endif /* ED_UVEDIT_H */
 
index c84c0e83626c01277a8ab8a8161f903677066288..297bd234edd2d9ac806f0533fedf883212b68dcb 100644 (file)
@@ -163,6 +163,8 @@ int lasso_inside_edge(short mcords[][2], short moves, int x0, int y0, int x1, in
 
 /* get 3d region from context, also if mouse is in header or toolbar */
 struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C);
+struct ARegion *ED_view3d_context_region_unlock(struct bContext *C);
+int ED_operator_rv3d_unlock_poll(struct bContext *C);
 
 void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d);
 
@@ -173,7 +175,7 @@ void ED_view3d_draw_offscreen(struct Scene *scene, struct View3D *v3d, struct AR
        int winx, int winy, float viewmat[][4], float winmat[][4]);
 
 struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, unsigned int flag, char err_out[256]);
-struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, unsigned int flag, int drawtype, char err_out[256]);
+struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, struct Object *camera, int width, int height, unsigned int flag, int drawtype, char err_out[256]);
 
 
 Base *ED_view3d_give_base_under_cursor(struct bContext *C, const short mval[2]);
index b8d92f44025d707fe73093a4cf9815271984e17b..c2836710e1778a15ed675bb29295178049b25551 100644 (file)
@@ -716,6 +716,7 @@ void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *i
 void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C);
 void uiTemplateOperatorSearch(uiLayout *layout);
 void uiTemplateHeader3D(uiLayout *layout, struct bContext *C);
+void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C);
 void uiTemplateTextureImage(uiLayout *layout, struct bContext *C, struct Tex *tex);
 void uiTemplateReportsBanner(uiLayout *layout, struct bContext *C);
 
index 108f06a5cb624f294e420828a00189e915ab7a53..e70b793cfb01e2510e441b84c8c1ad4d42c704d7 100644 (file)