Merging r45620 through r45692 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 16 Apr 2012 12:47:34 +0000 (12:47 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 16 Apr 2012 12:47:34 +0000 (12:47 +0000)
166 files changed:
CMakeLists.txt
SConstruct
build_files/cmake/project_info.py
build_files/scons/tools/btools.py
intern/cycles/app/cycles_xml.cpp
intern/cycles/kernel/kernel_bvh.h
intern/cycles/kernel/kernel_camera.h
intern/cycles/kernel/kernel_mbvh.h
intern/cycles/kernel/kernel_object.h
intern/cycles/kernel/kernel_passes.h
intern/cycles/kernel/kernel_path.h
intern/cycles/kernel/kernel_qbvh.h
intern/cycles/kernel/svm/svm_camera.h
intern/cycles/kernel/svm/svm_mapping.h
intern/cycles/kernel/svm/svm_tex_coord.h
intern/cycles/render/buffers.cpp
intern/cycles/render/camera.cpp
intern/cycles/render/light.cpp
intern/cycles/render/object.cpp
intern/cycles/subd/subd_dice.cpp
intern/cycles/subd/subd_split.cpp
intern/cycles/util/util_boundbox.h
intern/cycles/util/util_transform.h
intern/dualcon/intern/Projections.h
intern/dualcon/intern/dualcon_c_api.cpp
intern/elbeem/intern/solver_init.cpp
release/freedesktop/blender.desktop
release/scripts/presets/fluid/honey.py [new file with mode: 0644]
release/scripts/presets/fluid/oil.py [new file with mode: 0644]
release/scripts/presets/fluid/water.py [new file with mode: 0644]
release/scripts/startup/bl_operators/console.py
release/scripts/startup/bl_operators/presets.py
release/scripts/startup/bl_operators/uvcalc_lightmap.py
release/scripts/startup/bl_operators/wm.py
release/scripts/startup/bl_ui/properties_game.py
release/scripts/startup/bl_ui/properties_physics_cloth.py
release/scripts/startup/bl_ui/properties_physics_fluid.py
source/blender/avi/intern/avi.c
source/blender/avi/intern/options.c
source/blender/blenfont/BLF_translation.h
source/blender/blenkernel/BKE_blender.h
source/blender/blenkernel/BKE_context.h
source/blender/blenkernel/BKE_multires.h
source/blender/blenkernel/BKE_sequencer.h
source/blender/blenkernel/SConscript
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/editderivedmesh.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/multires.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/screen.c
source/blender/blenkernel/intern/unit.c
source/blender/blenlib/BLI_scanfill.h
source/blender/blenlib/BLI_threads.h
source/blender/blenlib/BLI_winstuff.h
source/blender/blenlib/intern/fileops.c
source/blender/blenlib/intern/scanfill.c
source/blender/blenlib/intern/storage.c
source/blender/blenlib/intern/threads.c
source/blender/blenloader/intern/readblenentry.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/runtime.c
source/blender/blenloader/intern/writefile.c
source/blender/bmesh/intern/bmesh_mesh_conv.c
source/blender/bmesh/intern/bmesh_opdefines.c
source/blender/bmesh/intern/bmesh_operators_private.h
source/blender/bmesh/intern/bmesh_polygon.c
source/blender/bmesh/intern/bmesh_polygon.h
source/blender/bmesh/operators/bmo_dissolve.c
source/blender/bmesh/operators/bmo_mirror.c
source/blender/bmesh/operators/bmo_removedoubles.c
source/blender/bmesh/operators/bmo_slide.c
source/blender/bmesh/operators/bmo_triangulate.c
source/blender/bmesh/operators/bmo_utils.c
source/blender/editors/curve/editcurve.c
source/blender/editors/include/ED_curve.h
source/blender/editors/include/ED_uvedit.h
source/blender/editors/interface/interface_icons.c
source/blender/editors/mesh/editmesh_knife.c
source/blender/editors/mesh/editmesh_select.c
source/blender/editors/mesh/editmesh_slide.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/editmesh_utils.c
source/blender/editors/physics/physics_fluid.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_utils.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/space_clip/tracking_ops.c
source/blender/editors/space_console/space_console.c
source/blender/editors/space_file/file_draw.c
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_file/filesel.c
source/blender/editors/space_file/fsmenu.c
source/blender/editors/space_node/node_buttons.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_node/node_intern.h
source/blender/editors/space_outliner/CMakeLists.txt
source/blender/editors/space_outliner/SConscript
source/blender/editors/space_outliner/outliner_edit.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_text/text_header.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/transform/transform_snap.c
source/blender/editors/util/CMakeLists.txt
source/blender/editors/util/SConscript
source/blender/editors/uvedit/uvedit_ops.c
source/blender/editors/uvedit/uvedit_parametrizer.c
source/blender/editors/uvedit/uvedit_parametrizer.h
source/blender/editors/uvedit/uvedit_unwrap_ops.c
source/blender/gpu/SConscript
source/blender/gpu/intern/gpu_extensions.c
source/blender/imbuf/intern/openexr/openexr_api.cpp
source/blender/imbuf/intern/thumbs.c
source/blender/makesdna/DNA_node_types.h
source/blender/makesdna/DNA_object_fluidsim.h
source/blender/makesrna/RNA_access.h
source/blender/makesrna/RNA_types.h
source/blender/makesrna/SConscript
source/blender/makesrna/intern/SConscript
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_armature.c
source/blender/makesrna/intern/rna_boid.c
source/blender/makesrna/intern/rna_constraint.c
source/blender/makesrna/intern/rna_fcurve.c
source/blender/makesrna/intern/rna_fluidsim.c
source/blender/makesrna/intern/rna_modifier.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_nodetree_types.h
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_object_force.c
source/blender/makesrna/intern/rna_particle.c
source/blender/makesrna/intern/rna_render.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_tracking.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/modifiers/intern/MOD_fluidsim_util.c
source/blender/modifiers/intern/MOD_remesh.c
source/blender/python/bmesh/bmesh_py_api.c
source/blender/python/bmesh/bmesh_py_types.c
source/blender/python/generic/idprop_py_api.c
source/blender/python/generic/idprop_py_api.h
source/blender/python/intern/bpy_interface.c
source/blender/python/mathutils/mathutils.c
source/blender/python/mathutils/mathutils_Color.c
source/blender/python/mathutils/mathutils_Euler.c
source/blender/python/mathutils/mathutils_Matrix.c
source/blender/python/mathutils/mathutils_Quaternion.c
source/blender/python/mathutils/mathutils_Vector.c
source/blender/render/SConscript
source/blender/render/extern/include/RE_render_ext.h
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/shadeoutput.c
source/blender/windowmanager/WM_types.h
source/blender/windowmanager/intern/wm_dragdrop.c
source/blender/windowmanager/intern/wm_files.c
source/blender/windowmanager/intern/wm_gesture.c
source/blender/windowmanager/intern/wm_init_exit.c
source/blender/windowmanager/intern/wm_keymap.c
source/blender/windowmanager/intern/wm_operators.c
source/creator/creator.c
source/gameengine/Physics/Bullet/CcdPhysicsController.cpp

index e3ce376ff7d3f74606d50b7505cf43a7e736f72f..2669f2ff93f95f70bdc1ca8f144339cfbd289f04 100644 (file)
@@ -153,7 +153,7 @@ if(UNIX AND NOT APPLE)
 else()
        set(PLATFORM_DEFAULT OFF)
 endif()
-option(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" PLATFORM_DEFAULT)
+option(WITH_OPENMP        "Enable OpenMP (has to be supported by the compiler)" ${PLATFORM_DEFAULT})
 unset(PLATFORM_DEFAULT)
 
 
@@ -194,7 +194,14 @@ option(WITH_IMAGE_REDCODE       "Enable RedCode Image Support" OFF)
 option(WITH_IMAGE_FRAMESERVER   "Enable image FrameServer Support for rendering" ON)
 
 # Audio/Video format support
-option(WITH_CODEC_FFMPEG        "Enable FFMPeg Support (http://ffmpeg.org)" OFF)
+if(MINGW)
+       set(PLATFORM_DEFAULT ON)
+else()
+       set(PLATFORM_DEFAULT OFF)
+endif()
+option(WITH_CODEC_FFMPEG        "Enable FFMPeg Support (http://ffmpeg.org)" ${PLATFORM_DEFAULT})
+unset(PLATFORM_DEFAULT)
+
 option(WITH_CODEC_SNDFILE       "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
 if(APPLE OR (WIN32 AND NOT UNIX))
        option(WITH_CODEC_QUICKTIME     "Enable Quicktime Support" OFF)
@@ -357,6 +364,19 @@ if(WITH_GHOST_SDL OR WITH_HEADLESS)
        set(WITH_GHOST_XDND OFF)
 endif()
 
+if(MINGW)
+       if(WITH_CODEC_QUICKTIME)
+               message(FATAL_ERROR "MINGW requires WITH_CODEC_QUICKTIME to be OFF "
+                                   "because it is currently unsupported, remove this "
+                                   "line if youre a developer who wants to add support.")
+       endif()
+
+       if((NOT WITH_CODEC_FFMPEG) AND (WITH_CYCLES OR WITH_IMAGE_OPENEXR OR WITH_IMAGE_TIFF))
+               message(FATAL_ERROR "MINGW has a problem with: WITH_CYCLES/WITH_IMAGE_OPENEXR/WITH_IMAGE_TIFF "
+                                   "when WITH_CODEC_FFMPEG is disabled, enable FFMPEG or disable CYCLES/EXR/TIFF.")
+       endif()
+endif()
+
 TEST_SSE_SUPPORT(COMPILER_SSE_FLAG COMPILER_SSE2_FLAG)
 
 
index ff668a974836cb7168cd3a277988cdc45f743601..e73d654a0c8e06438f6b0bcb066fe75ec5a31b3f 100644 (file)
@@ -251,6 +251,7 @@ if 'blenderlite' in B.targets:
     target_env_defs['WITH_BF_REDCODE'] = False
     target_env_defs['WITH_BF_DDS'] = False
     target_env_defs['WITH_BF_CINEON'] = False
+    target_env_defs['WITH_BF_FRAMESERVER'] = False
     target_env_defs['WITH_BF_HDR'] = False
     target_env_defs['WITH_BF_ZLIB'] = False
     target_env_defs['WITH_BF_SDL'] = False
@@ -261,6 +262,7 @@ if 'blenderlite' in B.targets:
     target_env_defs['BF_BUILDINFO'] = False
     target_env_defs['WITH_BF_FLUID'] = False
     target_env_defs['WITH_BF_OCEANSIM'] = False
+    target_env_defs['WITH_BF_SMOKE'] = False
     target_env_defs['WITH_BF_DECIMATE'] = False
     target_env_defs['WITH_BF_BOOLEAN'] = False
     target_env_defs['WITH_BF_REMESH'] = False
index 77574f17e2e4f336fde3c262d0fcffd4a8a4ea39..3f64ac51a4d374a29a6294fd0b786e4d5469af63 100755 (executable)
@@ -231,8 +231,13 @@ def project_name_get(path, fallback="Blender", prefix="Blender_"):
         return fallback
 
     import subprocess
-    info = subprocess.Popen(["svn", "info", path],
-                            stdout=subprocess.PIPE).communicate()[0]
+    try:
+        info = subprocess.Popen(["svn", "info", path],
+                                stdout=subprocess.PIPE).communicate()[0]
+    except:
+        # possibly 'svn' isnt found/installed
+        return fallback
+
     # string version, we only want the URL
     info = info.decode(encoding="utf-8", errors="ignore")
 
index bb1948b2c167d6a7a893cd769b8be28c98c67774..544f7f066ce04a6abc89a3afe734f0595a0aa590 100644 (file)
@@ -107,6 +107,7 @@ def validate_arguments(args, bc):
             'WITH_BF_FFMPEG', 'BF_FFMPEG_LIB','BF_FFMPEG_EXTRA', 'BF_FFMPEG',  'BF_FFMPEG_INC', 'BF_FFMPEG_DLL',
             'WITH_BF_STATICFFMPEG', 'BF_FFMPEG_LIB_STATIC',
             'WITH_BF_OGG', 'BF_OGG', 'BF_OGG_LIB',
+            'WITH_BF_FRAMESERVER',
             'WITH_BF_JPEG', 'BF_JPEG', 'BF_JPEG_INC', 'BF_JPEG_LIB', 'BF_JPEG_LIBPATH',
             'WITH_BF_OPENJPEG', 'BF_OPENJPEG', 'BF_OPENJPEG_INC', 'BF_OPENJPEG_LIB', 'BF_OPENJPEG_LIBPATH',
             'WITH_BF_REDCODE', 'BF_REDCODE', 'BF_REDCODE_INC', 'BF_REDCODE_LIB', 'BF_REDCODE_LIBPATH',
@@ -154,6 +155,7 @@ def validate_arguments(args, bc):
             'WITH_BF_BOOLEAN',
             'WITH_BF_REMESH',
             'WITH_BF_OCEANSIM',
+            'WITH_BF_SMOKE',
             'WITH_BF_CXX_GUARDEDALLOC',
             'WITH_BF_JEMALLOC', 'WITH_BF_STATICJEMALLOC', 'BF_JEMALLOC', 'BF_JEMALLOC_INC', 'BF_JEMALLOC_LIBPATH', 'BF_JEMALLOC_LIB', 'BF_JEMALLOC_LIB_STATIC',
             'BUILDBOT_BRANCH',
@@ -264,6 +266,7 @@ def read_opts(env, cfg, args):
         (BoolVariable('WITH_BF_BOOLEAN', 'Build with boolean modifier', True)),
         (BoolVariable('WITH_BF_REMESH', 'Build with remesh modifier', True)),
         (BoolVariable('WITH_BF_OCEANSIM', 'Build with ocean simulation', False)),
+        (BoolVariable('WITH_BF_SMOKE', 'Build with smoke simulation', True)),
         ('BF_PROFILE_FLAGS', 'Profiling compiler flags', ''),
         (BoolVariable('WITH_BF_OPENAL', 'Use OpenAL if true', False)),
         ('BF_OPENAL', 'Base path for OpenAL', ''),
@@ -311,6 +314,8 @@ def read_opts(env, cfg, args):
         (BoolVariable('WITH_BF_CINEON', 'Support CINEON and DPX image formats if true', True)),
 
         (BoolVariable('WITH_BF_HDR', 'Support HDR image formats if true', True)),
+        
+        (BoolVariable('WITH_BF_FRAMESERVER', 'Support export to a frameserver', True)),
 
         (BoolVariable('WITH_BF_FFMPEG', 'Use FFMPEG if true', False)),
         ('BF_FFMPEG', 'FFMPEG base path', ''),
index b93f61b98d509e4cbd8ca2f395d651e09f75e8a1..b954ff45e2781db68001b58b351df06567e81adc 100644 (file)
@@ -724,7 +724,7 @@ static void xml_read_patch(const XMLReadState& state, pugi::xml_node node)
                        LinearQuadPatch *bpatch = new LinearQuadPatch();
 
                        for(int i = 0; i < 4; i++)
-                               P[i] = transform(&state.tfm, P[i]);
+                               P[i] = transform_point(&state.tfm, P[i]);
                        memcpy(bpatch->hull, &P[0], sizeof(bpatch->hull));
 
                        patch = bpatch;
@@ -738,7 +738,7 @@ static void xml_read_patch(const XMLReadState& state, pugi::xml_node node)
                        BicubicPatch *bpatch = new BicubicPatch();
 
                        for(int i = 0; i < 16; i++)
-                               P[i] = transform(&state.tfm, P[i]);
+                               P[i] = transform_point(&state.tfm, P[i]);
                        memcpy(bpatch->hull, &P[0], sizeof(bpatch->hull));
 
                        patch = bpatch;
@@ -777,7 +777,7 @@ static void xml_read_light(const XMLReadState& state, pugi::xml_node node)
        Light *light = new Light();
        light->shader = state.shader;
        xml_read_float3(&light->co, node, "P");
-       light->co = transform(&state.tfm, light->co);
+       light->co = transform_point(&state.tfm, light->co);
 
        state.scene->lights.push_back(light);
 }
index 35215fd0f9fd1de4b58cb491cd5209ddf42486bb..523ae8ae92621fb92d7167ee24418c7889e12904 100644 (file)
@@ -59,7 +59,7 @@ __device_inline void bvh_instance_push(KernelGlobals *kg, int object, const Ray
 {
        Transform tfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM);
 
-       *P = transform(&tfm, ray->P);
+       *P = transform_point(&tfm, ray->P);
 
        float3 dir = transform_direction(&tfm, ray->D);
 
@@ -351,7 +351,7 @@ __device_inline float3 bvh_triangle_refine(KernelGlobals *kg, const Intersection
        if(isect->object != ~0) {
                Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_INVERSE_TRANSFORM);
 
-               P = transform(&tfm, P);
+               P = transform_point(&tfm, P);
                D = transform_direction(&tfm, D*t);
                D = normalize_len(D, &t);
        }
@@ -367,7 +367,7 @@ __device_inline float3 bvh_triangle_refine(KernelGlobals *kg, const Intersection
 
        if(isect->object != ~0) {
                Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_TRANSFORM);
-               P = transform(&tfm, P);
+               P = transform_point(&tfm, P);
        }
 
        return P;
index 0460765fe862552b91eebd4cda69e22f819d5dc9..58c482212df8142d19567b5b08c9f5d04f5c8b9e 100644 (file)
@@ -39,7 +39,7 @@ __device void camera_sample_perspective(KernelGlobals *kg, float raster_x, float
 {
        /* create ray form raster position */
        Transform rastertocamera = kernel_data.cam.rastertocamera;
-       float3 Pcamera = transform(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
+       float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
 
        ray->P = make_float3(0.0f, 0.0f, 0.0f);
        ray->D = Pcamera;
@@ -63,7 +63,7 @@ __device void camera_sample_perspective(KernelGlobals *kg, float raster_x, float
        /* transform ray from camera to world */
        Transform cameratoworld = kernel_data.cam.cameratoworld;
 
-       ray->P = transform(&cameratoworld, ray->P);
+       ray->P = transform_point(&cameratoworld, ray->P);
        ray->D = transform_direction(&cameratoworld, ray->D);
        ray->D = normalize(ray->D);
 
@@ -93,7 +93,7 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa
 {
        /* create ray form raster position */
        Transform rastertocamera = kernel_data.cam.rastertocamera;
-       float3 Pcamera = transform(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
+       float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
 
        ray->P = Pcamera;
        ray->D = make_float3(0.0f, 0.0f, 1.0f);
@@ -101,7 +101,7 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa
        /* transform ray from camera to world */
        Transform cameratoworld = kernel_data.cam.cameratoworld;
 
-       ray->P = transform(&cameratoworld, ray->P);
+       ray->P = transform_point(&cameratoworld, ray->P);
        ray->D = transform_direction(&cameratoworld, ray->D);
        ray->D = normalize(ray->D);
 
@@ -127,7 +127,7 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa
 __device void camera_sample_environment(KernelGlobals *kg, float raster_x, float raster_y, Ray *ray)
 {
        Transform rastertocamera = kernel_data.cam.rastertocamera;
-       float3 Pcamera = transform(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
+       float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
 
        /* create ray form raster position */
        ray->P = make_float3(0.0, 0.0f, 0.0f);
@@ -136,7 +136,7 @@ __device void camera_sample_environment(KernelGlobals *kg, float raster_x, float
        /* transform ray from camera to world */
        Transform cameratoworld = kernel_data.cam.cameratoworld;
 
-       ray->P = transform(&cameratoworld, ray->P);
+       ray->P = transform_point(&cameratoworld, ray->P);
        ray->D = transform_direction(&cameratoworld, ray->D);
        ray->D = normalize(ray->D);
 
@@ -145,10 +145,10 @@ __device void camera_sample_environment(KernelGlobals *kg, float raster_x, float
        ray->dP.dx = make_float3(0.0f, 0.0f, 0.0f);
        ray->dP.dy = make_float3(0.0f, 0.0f, 0.0f);
 
-       Pcamera = transform(&rastertocamera, make_float3(raster_x + 1.0f, raster_y, 0.0f));
+       Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x + 1.0f, raster_y, 0.0f));
        ray->dD.dx = normalize(transform_direction(&cameratoworld, equirectangular_to_direction(Pcamera.x, Pcamera.y))) - ray->D;
 
-       Pcamera = transform(&rastertocamera, make_float3(raster_x, raster_y + 1.0f, 0.0f));
+       Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y + 1.0f, 0.0f));
        ray->dD.dy = normalize(transform_direction(&cameratoworld, equirectangular_to_direction(Pcamera.x, Pcamera.y))) - ray->D;
 #endif
 
index 3995e782abd16044b5b8b7bb85da1917d9e1a2d9..ccbd3d069b4215311b6879709076747f7f1378c1 100644 (file)
@@ -61,7 +61,7 @@ __device void mbvh_instance_push(KernelGlobals *kg, int object, MBVHRay *ray)
 {
        Transform tfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM);
 
-       ray->P = transform(&tfm, ray->origP);
+       ray->P = transform_point(&tfm, ray->origP);
 
        float3 dir = ray->origD;
 
index 318a6fea489cdb7ff88f6b77b4b74dd1d6000829..b676f58e5d4fd74251ee4c83dc6a8818c9f70feb 100644 (file)
@@ -42,7 +42,7 @@ __device_inline Transform object_fetch_transform(KernelGlobals *kg, int object,
 __device_inline void object_position_transform(KernelGlobals *kg, int object, float3 *P)
 {
        Transform tfm = object_fetch_transform(kg, object, OBJECT_TRANSFORM);
-       *P = transform(&tfm, *P);
+       *P = transform_point(&tfm, *P);
 }
 
 __device_inline void object_normal_transform(KernelGlobals *kg, int object, float3 *N)
index d195af293b7454e97f1d537a6df19cd53e77f775..fd4ee17cdc1120e5e69aa012c43a2057c8766726 100644 (file)
@@ -53,7 +53,7 @@ __device_inline void kernel_write_data_passes(KernelGlobals *kg, __global float
                if(sample == 0) {
                        if(flag & PASS_DEPTH) {
                                Transform tfm = kernel_data.cam.worldtocamera;
-                               float depth = len(transform(&tfm, sd->P));
+                               float depth = len(transform_point(&tfm, sd->P));
 
                                kernel_write_pass_float(buffer + kernel_data.film.pass_depth, sample, depth);
                        }
index 53ce374e15072632badb4edbf995accd980d3893..ff12e85375ca6f447210dc20a21c5ad290930833 100644 (file)
@@ -147,14 +147,14 @@ __device_inline float path_state_terminate_probability(KernelGlobals *kg, PathSt
 
 __device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *ray, float3 *shadow)
 {
+       *shadow = make_float3(1.0f, 1.0f, 1.0f);
+
        if(ray->t == 0.0f)
                return false;
        
        Intersection isect;
        bool result = scene_intersect(kg, ray, PATH_RAY_SHADOW_OPAQUE, &isect);
 
-       *shadow = make_float3(1.0f, 1.0f, 1.0f);
-
 #ifdef __TRANSPARENT_SHADOWS__
        if(result && kernel_data.integrator.transparent_shadows) {
                /* transparent shadows work in such a way to try to minimize overhead
index 96e68d797ddd67b9280ad7a8f64beafde747993c..525b616921d02062a729115642f53991aadfe1c1 100644 (file)
@@ -50,7 +50,7 @@ __device_inline void qbvh_instance_push(KernelGlobals *kg, int object, const Ray
 {
        Transform tfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM);
 
-       *P = transform(&tfm, ray->P);
+       *P = transform_point(&tfm, ray->P);
 
        float3 dir = transform_direction(&tfm, ray->D);
 
@@ -384,7 +384,7 @@ __device_inline float3 bvh_triangle_refine(KernelGlobals *kg, const Intersection
        if(isect->object != ~0) {
                Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_INVERSE_TRANSFORM);
 
-               P = transform(&tfm, P);
+               P = transform_point(&tfm, P);
                D = transform_direction(&tfm, D*t);
                D = normalize_len(D, &t);
        }
@@ -400,7 +400,7 @@ __device_inline float3 bvh_triangle_refine(KernelGlobals *kg, const Intersection
 
        if(isect->object != ~0) {
                Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_TRANSFORM);
-               P = transform(&tfm, P);
+               P = transform_point(&tfm, P);
        }
 
        return P;
index cf161ddcd8cf67f96b4cc2e7975ad889396749d2..f13cefb77640797aed3a7a69bbe557102451cdfe 100644 (file)
@@ -25,7 +25,7 @@ __device void svm_node_camera(KernelGlobals *kg, ShaderData *sd, float *stack, u
        float3 vector;
 
        Transform tfm = kernel_data.cam.worldtocamera;
-       vector = transform(&tfm, sd->P);
+       vector = transform_point(&tfm, sd->P);
        zdepth = vector.z;
        distance = len(vector);
 
index 7633c3e783b128d188108a8485ab9cd15b13ed03..6dc74aece085f35d970c4ab83b6844b9ee6d7c7f 100644 (file)
@@ -30,7 +30,7 @@ __device void svm_node_mapping(KernelGlobals *kg, ShaderData *sd, float *stack,
        tfm.z = read_node_float(kg, offset);
        tfm.w = read_node_float(kg, offset);
 
-       float3 r = transform(&tfm, v);
+       float3 r = transform_point(&tfm, v);
        stack_store_float3(stack, out_offset, r);
 }
 
index bcf3716ae57095250dea095383eefaa7efe86568..f494b6d66e1c9b6c6e70b2b057b651c00432fa7d 100644 (file)
@@ -34,7 +34,7 @@ __device void svm_node_tex_coord(KernelGlobals *kg, ShaderData *sd, float *stack
                case NODE_TEXCO_OBJECT: {
                        if(sd->object != ~0) {
                                Transform tfm = object_fetch_transform(kg, sd->object, OBJECT_INVERSE_TRANSFORM);
-                               data = transform(&tfm, sd->P);
+                               data = transform_point(&tfm, sd->P);
                        }
                        else
                                data = sd->P;
@@ -44,18 +44,18 @@ __device void svm_node_tex_coord(KernelGlobals *kg, ShaderData *sd, float *stack
                        Transform tfm = kernel_data.cam.worldtocamera;
 
                        if(sd->object != ~0)
-                               data = transform(&tfm, sd->P);
+                               data = transform_point(&tfm, sd->P);
                        else
-                               data = transform(&tfm, sd->P + svm_background_offset(kg));
+                               data = transform_point(&tfm, sd->P + svm_background_offset(kg));
                        break;
                }
                case NODE_TEXCO_WINDOW: {
                        Transform tfm = kernel_data.cam.worldtondc;
 
                        if(sd->object != ~0)
-                               data = transform(&tfm, sd->P);
+                               data = transform_perspective(&tfm, sd->P);
                        else
-                               data = transform(&tfm, sd->P + svm_background_offset(kg));
+                               data = transform_perspective(&tfm, sd->P + svm_background_offset(kg));
                        break;
                }
                case NODE_TEXCO_REFLECTION: {
@@ -79,7 +79,7 @@ __device void svm_node_tex_coord_bump_dx(KernelGlobals *kg, ShaderData *sd, floa
                case NODE_TEXCO_OBJECT: {
                        if(sd->object != ~0) {
                                Transform tfm = object_fetch_transform(kg, sd->object, OBJECT_INVERSE_TRANSFORM);
-                               data = transform(&tfm, sd->P + sd->dP.dx);
+                               data = transform_point(&tfm, sd->P + sd->dP.dx);
                        }
                        else
                                data = sd->P + sd->dP.dx;
@@ -89,18 +89,18 @@ __device void svm_node_tex_coord_bump_dx(KernelGlobals *kg, ShaderData *sd, floa
                        Transform tfm = kernel_data.cam.worldtocamera;
 
                        if(sd->object != ~0)
-                               data = transform(&tfm, sd->P + sd->dP.dx);
+                               data = transform_point(&tfm, sd->P + sd->dP.dx);
                        else
-                               data = transform(&tfm, sd->P + sd->dP.dx + svm_background_offset(kg));
+                               data = transform_point(&tfm, sd->P + sd->dP.dx + svm_background_offset(kg));
                        break;
                }
                case NODE_TEXCO_WINDOW: {
                        Transform tfm = kernel_data.cam.worldtondc;
 
                        if(sd->object != ~0)
-                               data = transform(&tfm, sd->P + sd->dP.dx);
+                               data = transform_perspective(&tfm, sd->P + sd->dP.dx);
                        else
-                               data = transform(&tfm, sd->P + sd->dP.dx + svm_background_offset(kg));
+                               data = transform_perspective(&tfm, sd->P + sd->dP.dx + svm_background_offset(kg));
                        break;
                }
                case NODE_TEXCO_REFLECTION: {
@@ -127,7 +127,7 @@ __device void svm_node_tex_coord_bump_dy(KernelGlobals *kg, ShaderData *sd, floa
                case NODE_TEXCO_OBJECT: {
                        if(sd->object != ~0) {
                                Transform tfm = object_fetch_transform(kg, sd->object, OBJECT_INVERSE_TRANSFORM);
-                               data = transform(&tfm, sd->P + sd->dP.dy);
+                               data = transform_point(&tfm, sd->P + sd->dP.dy);
                        }
                        else
                                data = sd->P + sd->dP.dy;
@@ -137,18 +137,18 @@ __device void svm_node_tex_coord_bump_dy(KernelGlobals *kg, ShaderData *sd, floa
                        Transform tfm = kernel_data.cam.worldtocamera;
 
                        if(sd->object != ~0)
-                               data = transform(&tfm, sd->P + sd->dP.dy);
+                               data = transform_point(&tfm, sd->P + sd->dP.dy);
                        else
-                               data = transform(&tfm, sd->P + sd->dP.dy + svm_background_offset(kg));
+                               data = transform_point(&tfm, sd->P + sd->dP.dy + svm_background_offset(kg));
                        break;
                }
                case NODE_TEXCO_WINDOW: {
                        Transform tfm = kernel_data.cam.worldtondc;
 
                        if(sd->object != ~0)
-                               data = transform(&tfm, sd->P + sd->dP.dy);
+                               data = transform_perspective(&tfm, sd->P + sd->dP.dy);
                        else
-                               data = transform(&tfm, sd->P + sd->dP.dy + svm_background_offset(kg));
+                               data = transform_perspective(&tfm, sd->P + sd->dP.dy + svm_background_offset(kg));
                        break;
                }
                case NODE_TEXCO_REFLECTION: {
index 62a322b3a0f5cff46c77d8a1f7ab446f99bcaaa7..bda20a8ab9d6ab3cd084c07b56ceec8794566574 100644 (file)
@@ -119,7 +119,7 @@ void RenderBuffers::reset(Device *device, BufferParams& params_)
        
        for(x=0; x<width; x++)
                for(y=0; y<height; y++)
-                       init_state[x + y*width] = hash_int_2d(x, y);
+                       init_state[x + y*width] = hash_int_2d(params.full_x+x, params.full_y+y);
 
        device->mem_alloc(rng_state, MEM_READ_WRITE);
        device->mem_copy_to(rng_state);
index 6edf9c66f1d7f37d605cbab5c17d5e5bbcedbfde..f9290dfc83544d59da2b6a451c65cd20b69b448c 100644 (file)
@@ -107,10 +107,10 @@ void Camera::update()
                dy = transform_direction(&rastertocamera, make_float3(0, 1, 0));
        }
        else if(type == CAMERA_PERSPECTIVE) {
-               dx = transform(&rastertocamera, make_float3(1, 0, 0)) -
-                    transform(&rastertocamera, make_float3(0, 0, 0));
-               dy = transform(&rastertocamera, make_float3(0, 1, 0)) -
-                    transform(&rastertocamera, make_float3(0, 0, 0));
+               dx = transform_perspective(&rastertocamera, make_float3(1, 0, 0)) -
+                    transform_perspective(&rastertocamera, make_float3(0, 0, 0));
+               dy = transform_perspective(&rastertocamera, make_float3(0, 1, 0)) -
+                    transform_perspective(&rastertocamera, make_float3(0, 0, 0));
        }
        else {
                dx = make_float3(0, 0, 0);
index bd3acb00f6d8c863b7f1eff352c89b474db7f46d..316e5cec9aa7bf9c19dea81673c2a085a54cffeb 100644 (file)
@@ -213,9 +213,9 @@ void LightManager::device_update_distribution(Device *device, DeviceScene *dscen
                                        offset++;
 
                                        Mesh::Triangle t = mesh->triangles[i];
-                                       float3 p1 = transform(&tfm, mesh->verts[t.v[0]]);
-                                       float3 p2 = transform(&tfm, mesh->verts[t.v[1]]);
-                                       float3 p3 = transform(&tfm, mesh->verts[t.v[2]]);
+                                       float3 p1 = transform_point(&tfm, mesh->verts[t.v[0]]);
+                                       float3 p2 = transform_point(&tfm, mesh->verts[t.v[1]]);
+                                       float3 p3 = transform_point(&tfm, mesh->verts[t.v[2]]);
 
                                        totarea += triangle_area(p1, p2, p3);
                                }
index f83c85c632d03d3b43f1f0c674354084a99e3ce9..5f7a5810c0982227c0db590e7c9a2a10e169e97b 100644 (file)
@@ -54,7 +54,7 @@ void Object::apply_transform()
                return;
        
        for(size_t i = 0; i < mesh->verts.size(); i++)
-               mesh->verts[i] = transform(&tfm, mesh->verts[i]);
+               mesh->verts[i] = transform_point(&tfm, mesh->verts[i]);
 
        Attribute *attr_fN = mesh->attributes.find(Attribute::STD_FACE_NORMAL);
        Attribute *attr_vN = mesh->attributes.find(Attribute::STD_VERTEX_NORMAL);
@@ -159,9 +159,9 @@ void ObjectManager::device_update_transforms(Device *device, DeviceScene *dscene
                }
                else {
                        foreach(Mesh::Triangle& t, mesh->triangles) {
-                               float3 p1 = transform(&tfm, mesh->verts[t.v[0]]);
-                               float3 p2 = transform(&tfm, mesh->verts[t.v[1]]);
-                               float3 p3 = transform(&tfm, mesh->verts[t.v[2]]);
+                               float3 p1 = transform_point(&tfm, mesh->verts[t.v[0]]);
+                               float3 p2 = transform_point(&tfm, mesh->verts[t.v[1]]);
+                               float3 p3 = transform_point(&tfm, mesh->verts[t.v[2]]);
 
                                surface_area += triangle_area(p1, p2, p3);
                        }
index 086b7b246d3d40b36c9c14ecccc9aef0d3cf51de..6b29d1ca51a21481ed111bbba93883ecac72287a 100644 (file)
@@ -141,7 +141,7 @@ float3 QuadDice::eval_projected(SubPatch& sub, float u, float v)
 
        sub.patch->eval(&P, NULL, NULL, uv.x, uv.y);
        if(camera)
-               P = transform(&camera->worldtoraster, P);
+               P = transform_perspective(&camera->worldtoraster, P);
 
        return P;
 }
index d61a42e4dcf0600fcb048539e755f6d6430b61ac..f0b87200f08c753d2ef8c051c365ff47db1395ad 100644 (file)
@@ -57,7 +57,7 @@ float3 DiagSplit::project(Patch *patch, float2 uv)
 
        patch->eval(&P, NULL, NULL, uv.x, uv.y);
        if(camera)
-               P = transform(&camera->worldtoraster, P);
+               P = transform_perspective(&camera->worldtoraster, P);
 
        return P;
 }
index 0114a9a26a5af2f41c173b66eb98c7f2e0c9c8b4..bb1df0b220f974a43b5d69ea663f8f3c1fbfa5a2 100644 (file)
@@ -76,8 +76,8 @@ public:
        bool valid(void) const
        {
                return (min.x <= max.x) && (min.y <= max.y) && (min.z <= max.z) &&
-                      !(isnan(min.x) || isnan(min.y) || isnan(min.z)) &&
-                      !(isnan(max.x) || isnan(max.y) || isnan(max.z));
+                      (isfinite(min.x) && isfinite(min.y) && isfinite(min.z)) &&
+                      (isfinite(max.x) && isfinite(max.y) && isfinite(max.z));
        }
 
        BoundBox transformed(const Transform *tfm)
@@ -91,7 +91,7 @@ public:
                        p.y = (i & 2)? min.y: max.y;
                        p.z = (i & 4)? min.z: max.z;
 
-                       result.grow(transform(tfm, p));
+                       result.grow(transform_point(tfm, p));
                }
 
                return result;
index 07db52f6392b6b5a29ec96b34b880e61de4cc851..aeaef7b0e216c72e8356b202423a2fc804a3ce70 100644 (file)
@@ -37,7 +37,7 @@ typedef struct Transform {
 #endif
 } Transform;
 
-__device_inline float3 transform(const Transform *t, const float3 a)
+__device_inline float3 transform_perspective(const Transform *t, const float3 a)
 {
        float4 b = make_float4(a.x, a.y, a.z, 1.0f);
        float3 c = make_float3(dot(t->x, b), dot(t->y, b), dot(t->z, b));
@@ -46,6 +46,14 @@ __device_inline float3 transform(const Transform *t, const float3 a)
        return (w != 0.0f)? c/w: make_float3(0.0f, 0.0f, 0.0f);
 }
 
+__device_inline float3 transform_point(const Transform *t, const float3 a)
+{
+       float4 b = make_float4(a.x, a.y, a.z, 1.0f);
+       float3 c = make_float3(dot(t->x, b), dot(t->y, b), dot(t->z, b));
+
+       return c;
+}
+
 __device_inline float3 transform_direction(const Transform *t, const float3 a)
 {
        float4 b = make_float4(a.x, a.y, a.z, 0.0f);
index a01b4dffdb0b2daffd81973381a9d789f7506bcd..18533b218ffebf487f63db388667feac4703bb13 100644 (file)
@@ -30,6 +30,7 @@
 #define GRID_DIMENSION 20
 
 #if defined(_WIN32) && !defined(__MINGW32__)
+#define isnan(n) _isnan(n)
 #define LONG __int64
 #else
 #include <stdint.h>
index d710ada48bcd29e190d1863aff0cba6b3982224c..af5ada71146f633b08be337dd96b6a3517a0c5e9 100644 (file)
 #include "octree.h"
 
 #include <cstdio>
+#include <float.h>
+
+#if defined(_WIN32) && !defined(__MINGW32__)
+#define isnan(n) _isnan(n)
+#endif
 
 void veccopy(float dst[3], const float src[3])
 {
@@ -113,6 +118,15 @@ public:
                        curface++;
                }
 
+               /* remove triangle if it contains invalid coords */
+               for(int i = 0; i < 3; i++) {
+                       const float *co = t->vt[i];
+                       if(isnan(co[0]) || isnan(co[1]) || isnan(co[2])) {
+                               delete t;
+                               return getNextTriangle();
+                       }
+               }
+
                return t;
        }
 
index 7e9f5e7f4202e0d085d925623ecb05e74ceaae3b..58f45e4fbfb4ef839515911efa96c9c932b750d1 100644 (file)
@@ -1453,7 +1453,9 @@ void LbmFsgrSolver::initMovingObstacles(bool staticInit) {
                        //errMsg("GEOACTT"," obj "<<obj->getName()<<" a:"<<active<<","<<wasActive<<"  s"<<sourceTime<<" t"<<targetTime <<" v"<<mObjectSpeeds[OId] );
                        // skip inactive in/out flows
                        if(ntype==CFInvalid){ errMsg("LbmFsgrSolver::initMovingObstacles","Invalid obj type "<<obj->getGeoInitType()); continue; }
-                       if((!active) && (otype&(CFMbndOutflow|CFMbndInflow)) ) continue;
+                       /* DG: only inflows/outlfows could be activated/deactivated, test new code that everything can be activated
+                       if((!active) && (otype&(CFMbndOutflow|CFMbndInflow)) ) continue; */
+                       if((!active) /* && (otype&(CFMbndOutflow|CFMbndInflow)) */ ) continue;
 
                        // copied from  recalculateObjectSpeeds
                        mObjectSpeeds[OId] = vec2L(mpParam->calculateLattVelocityFromRw( vec2P( (*mpGiObjects)[OId]->getInitialVelocity(mSimulationTime) )));
index 34b2b9bb0af03a2c38e2586945a1683eb73b3e39..1620815517ef887a65bf85c80f589b8525e0a7bf 100644 (file)
@@ -2,11 +2,12 @@
 Name=Blender
 GenericName=3D modeller
 GenericName[es]=modelador 3D
-GenericName[de]=3D Modellierer
+GenericName[de]=3D-Modellierer
 GenericName[fr]=modeleur 3D
 GenericName[ru]=Редактор 3D-моделей
 Comment=3D modeling, animation, rendering and post-production
 Comment[es]=modelado 3D, animación, renderizado y post-producción
+Comment[de]=3D-Modellierung, Animation, Rendering und Nachbearbeitung
 Exec=blender
 Icon=blender
 Terminal=false
diff --git a/release/scripts/presets/fluid/honey.py b/release/scripts/presets/fluid/honey.py
new file mode 100644 (file)
index 0000000..fbeb7f2
--- /dev/null
@@ -0,0 +1,3 @@
+import bpy
+bpy.context.fluid.settings.viscosity_base = 2.0
+bpy.context.fluid.settings.viscosity_exponent = 3
diff --git a/release/scripts/presets/fluid/oil.py b/release/scripts/presets/fluid/oil.py
new file mode 100644 (file)
index 0000000..3d73de9
--- /dev/null
@@ -0,0 +1,3 @@
+import bpy
+bpy.context.fluid.settings.viscosity_base = 5.0
+bpy.context.fluid.settings.viscosity_exponent = 5
diff --git a/release/scripts/presets/fluid/water.py b/release/scripts/presets/fluid/water.py
new file mode 100644 (file)
index 0000000..0b68ad2
--- /dev/null
@@ -0,0 +1,3 @@
+import bpy
+bpy.context.fluid.settings.viscosity_base = 1.0
+bpy.context.fluid.settings.viscosity_exponent = 6
index 8afcdf5f67e9d637ce2ccfa83152146f325b8072..099cb02564d9ff73ae2c3ecce8cf488ad64dc9e8 100644 (file)
@@ -23,15 +23,19 @@ from bpy.types import Operator
 from bpy.props import StringProperty
 
 
+def _lang_module_get(sc):
+    return __import__("console_" + sc.language)
+
+
 class ConsoleExec(Operator):
-    '''Execute the current console line as a python expression'''
+    """Execute the current console line as a python expression"""
     bl_idname = "console.execute"
     bl_label = "Console Execute"
 
     def execute(self, context):
         sc = context.space_data
 
-        module = __import__("console_" + sc.language)
+        module = _lang_module_get(sc)
         execute = getattr(module, "execute", None)
 
         if execute:
@@ -50,7 +54,7 @@ class ConsoleAutocomplete(Operator):
 
     def execute(self, context):
         sc = context.space_data
-        module = __import__("console_" + sc.language)
+        module = _lang_module_get(sc)
         autocomplete = getattr(module, "autocomplete", None)
 
         if autocomplete:
@@ -62,7 +66,7 @@ class ConsoleAutocomplete(Operator):
 
 
 class ConsoleBanner(Operator):
-    '''Print a message when the terminal initializes'''
+    """Print a message when the terminal initializes"""
     bl_idname = "console.banner"
     bl_label = "Console Banner"
 
@@ -73,7 +77,7 @@ class ConsoleBanner(Operator):
         if not sc.language:
             sc.language = 'python'
 
-        module = __import__("console_" + sc.language)
+        module = _lang_module_get(sc)
         banner = getattr(module, "banner", None)
 
         if banner:
@@ -85,7 +89,7 @@ class ConsoleBanner(Operator):
 
 
 class ConsoleLanguage(Operator):
-    '''Set the current language for this console'''
+    """Set the current language for this console"""
     bl_idname = "console.language"
     bl_label = "Console Language"
 
index da6ef7483f242c12a8d1b253d06125d20b4f805a..2c92fccf3b4eae43bcf985a9b6d29335a84e37c8 100644 (file)
@@ -294,6 +294,23 @@ class AddPresetCloth(AddPresetBase, Operator):
 
     preset_subdir = "cloth"
 
+class AddPresetFluid(AddPresetBase, Operator):
+    '''Add a Fluid Preset'''
+    bl_idname = "fluid.preset_add"
+    bl_label = "Add Fluid Preset"
+    preset_menu = "FLUID_MT_presets"
+    
+    preset_defines = [
+    "fluid = bpy.context.fluid"
+    ]
+    
+    preset_values = [
+    "fluid.settings.viscosity_base",
+    "fluid.settings.viscosity_exponent",
+    ]
+    
+    preset_subdir = "fluid"
+
 
 class AddPresetSunSky(AddPresetBase, Operator):
     '''Add a Sky & Atmosphere Preset'''
index 08f471e9022adae9c861f960584fa0c3fbdb8739..3074db17d0fecb446e613e790c16fe0ec888b584 100644 (file)
@@ -89,7 +89,7 @@ class prettyface(object):
 
         else:  # blender face
             uv_layer = data.id_data.uv_loop_layers.active.data
-            self.uv = [uv_layer[i].uv for i in data.loops]
+            self.uv = [uv_layer[i].uv for i in data.loop_indices]
 
             # cos = [v.co for v in data]
             cos = [data.id_data.vertices[v].co for v in data.vertices]  # XXX25
@@ -245,7 +245,7 @@ def lightmap_uvpack(meshes,
             print("\tWarning, less then 4 faces, skipping")
             continue
 
-        pretty_faces = [prettyface(f) for f in face_sel if len(f.vertices) == 4]
+        pretty_faces = [prettyface(f) for f in face_sel if f.loop_total == 4]
 
         # Do we have any triangles?
         if len(pretty_faces) != len(face_sel):
@@ -269,7 +269,7 @@ def lightmap_uvpack(meshes,
 
                 return f, lens, lens_order
 
-            tri_lengths = [trylens(f) for f in face_sel if len(f.vertices) == 3]
+            tri_lengths = [trylens(f) for f in face_sel if f.loop_total == 3]
             del trylens
 
             def trilensdiff(t1, t2):
@@ -549,7 +549,6 @@ class LightMapPack(Operator):
     '''Follow UVs from active quads along continuous face loops'''
     bl_idname = "uv.lightmap_pack"
     bl_label = "Lightmap Pack"
-    bl_options = {'REGISTER', 'UNDO'}
 
     PREF_CONTEXT = bpy.props.EnumProperty(
             name="Selection",
index 78f14137ad1e6f31ee0e20bdcfd4aff38d2ec666..926ad9b94f7318738e1d49d63e225a9c076ca0d2 100644 (file)
@@ -1195,7 +1195,7 @@ class WM_OT_copy_prev_settings(Operator):
 class WM_OT_blenderplayer_start(Operator):
     '''Launch the blender-player with the current blend-file'''
     bl_idname = "wm.blenderplayer_start"
-    bl_label = "Start"
+    bl_label = "Start Game In Player"
 
     def execute(self, context):
         import os
@@ -1212,6 +1212,10 @@ class WM_OT_blenderplayer_start(Operator):
         if sys.platform == "darwin":
             player_path = os.path.join(blender_bin_dir, "../../../blenderplayer.app/Contents/MacOS/blenderplayer")
 
+        if not os.path.exists(player_path):
+            self.report({'ERROR'}, "Player path: %r not found" % player_path)
+            return {'CANCELLED'}
+
         filepath = os.path.join(bpy.app.tempdir, "game.blend")
         bpy.ops.wm.save_as_mainfile(filepath=filepath, check_existing=False, copy=True)
         subprocess.call([player_path, filepath])
index cc3e8a8e57d576c8b4ba2b7758e9d8cfc6935424..36941cdfbbf031e3ff2f203b8e3aeec5f6e5fd2e 100644 (file)
@@ -166,7 +166,12 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, Panel):
             subsub.active = game.use_anisotropic_friction
             subsub.prop(game, "friction_coefficients", text="", slider=True)
 
-        elif physics_type in {'SENSOR', 'INVISIBLE', 'NO_COLLISION', 'OCCLUDE'}:
+        elif physics_type =='SENSOR':
+            col = layout.column()
+            col.prop(game, "use_actor", text="Detect Actors")
+            col.prop(ob, "hide_render", text="Invisible")
+
+        elif physics_type in {'INVISIBLE', 'NO_COLLISION', 'OCCLUDE'}:
             layout.prop(ob, "hide_render", text="Invisible")
 
         elif physics_type == 'NAVMESH':
index 14c7b381ee79809b565d2e78702fc4744fc2a242..e313112d61a36ee0e0eca9df751def01fbcfa0f0 100644 (file)
@@ -31,9 +31,6 @@ def cloth_panel_enabled(md):
 
 
 class CLOTH_MT_presets(Menu):
-    '''
-    Creates the menu items by scanning scripts/templates
-    '''
     bl_label = "Cloth Presets"
     preset_subdir = "cloth"
     preset_operator = "script.execute_preset"
index d334671292a4dd4beb3a1f98ba59ce6c6a696b9f..23b7a12753fb09751c7e60a4c18fad562fe756e0 100644 (file)
 
 # <pep8 compliant>
 import bpy
-from bpy.types import Panel
+from bpy.types import Panel, Menu
+
+class FLUID_MT_presets(Menu):
+    bl_label = "Fluid Presets"
+    preset_subdir = "fluid"
+    preset_operator = "script.execute_preset"
+    draw = Menu.draw_preset
 
 
 class PhysicButtonsPanel():
@@ -222,16 +228,14 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, Panel):
 
         col = split.column()
         col.label(text="Viscosity Presets:")
-        sub = col.column(align=True)
-        sub.prop(fluid, "viscosity_preset", text="")
-
-        if fluid.viscosity_preset == 'MANUAL':
-            sub.prop(fluid, "viscosity_base", text="Base")
-            sub.prop(fluid, "viscosity_exponent", text="Exponent", slider=True)
-        else:
-            # just for padding to prevent jumping around
-            sub.separator()
-            sub.separator()
+        sub = col.row(align=True)
+        sub.menu("FLUID_MT_presets", text=bpy.types.FLUID_MT_presets.bl_label)
+        sub.operator("fluid.preset_add", text="", icon='ZOOMIN')
+        sub.operator("fluid.preset_add", text="", icon='ZOOMOUT').remove_active = True
+        
+        subsub = col.column(align=True)
+        subsub.prop(fluid, "viscosity_base", text="Base")
+        subsub.prop(fluid, "viscosity_exponent", text="Exponent", slider=True)
 
         col.label(text="Optimization:")
         col.prop(fluid, "grid_levels", slider=True)
index 0658317a0bd8f1ce506283d7b4540ff3f3ad52fb..59ce879520edaeb63d3fef7e53bad1c843d0d8ae 100644 (file)
@@ -43,7 +43,9 @@
 #include "MEM_guardedalloc.h"
 #include "MEM_sys_types.h"
 
-#include "BLI_winstuff.h"
+#ifdef WIN32
+#  include "BLI_winstuff.h"
+#endif
 
 #include "AVI_avi.h"
 #include "avi_intern.h"
index 483b708bee65375270dcef2ac5907214d4233c01..a2fd756ddaacf72dee6e5b88662a7579d3918195 100644 (file)
  *  \ingroup avi
  */
 
-
 #include "AVI_avi.h"
 #include "avi_intern.h"
 #include "endian.h"
 
-#include "BLI_winstuff.h"
+#ifdef WIN32
+#  include "BLI_winstuff.h"
+#endif
 
 /* avi_set_compress_options gets its own file... now don't WE feel important? */
 
index 5e2fee36af0f9a27ed5f9a7ff14e9339fee72c6f..2c786f87521c869eec35b17980244cd6989ef75e 100644 (file)
@@ -67,6 +67,7 @@ const char *BLF_translate_do_tooltip(const char *contex, const char *msgid);
 
 /* The "translation-marker" macro. */
 #define N_(msgid) msgid
+#define CTX_N_(context, msgid) msgid
 /* Those macros should be used everywhere in UI code. */
 #ifdef WITH_INTERNATIONAL
 /*     #define _(msgid) BLF_gettext(msgid) */
@@ -82,4 +83,18 @@ const char *BLF_translate_do_tooltip(const char *contex, const char *msgid);
        #define CTX_TIP_(context, msgid) msgid
 #endif
 
+/******************************************************************************
+ * All i18n contexts must be defined here.
+ * This is a nice way to be sure not to use a context twice for different
+ * things, and limit the number of existing contexts!
+ */
+
+/* Default, void context. Just in case... */
+#define BLF_I18NCONTEXT_DEFAULT ""
+
+/* Default context for operator names/labels. */
+#define BLF_I18NCONTEXT_OPERATOR_DEFAULT "Operator"
+
+
+
 #endif /* __BLF_TRANSLATION_H__ */
index ffabbcf32f00d24d49c9ef399f2b857705e3f483..296461e61c8f369f093b1db27d383787b5a330d3 100644 (file)
@@ -42,7 +42,7 @@ extern "C" {
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION                        262
-#define BLENDER_SUBVERSION             3
+#define BLENDER_SUBVERSION             4
 
 #define BLENDER_MINVERSION             250
 #define BLENDER_MINSUBVERSION  0
index 944cce675ccf5e2469f3d99fc7485fd5e0e15e99..b2bd840a09ad622a6b27179709cd9aaa138022bf 100644 (file)
@@ -212,8 +212,11 @@ void CTX_data_list_add(bContextDataResult *result, void *data);
                ListBase ctx_data_list;                                               \
                CollectionPointerLink *ctx_link;                                      \
                CTX_data_##member(C, &ctx_data_list);                                 \
-               for(ctx_link=ctx_data_list.first; ctx_link; ctx_link=ctx_link->next) {\
-                       Type instance= ctx_link->ptr.data;
+               for (ctx_link = ctx_data_list.first;                                  \
+                    ctx_link;                                                        \
+                    ctx_link = ctx_link->next)                                       \
+               {                                                                     \
+                       Type instance = ctx_link->ptr.data;
 
 #define CTX_DATA_END                                                          \
                }                                                                     \
index 69482706da61e41b496b94bc881f49f254c321a1..bc34b0131bf56a2a0c67dd300d1f371ad79e979d 100644 (file)
@@ -99,7 +99,7 @@ void multiresModifier_prepare_join(struct Scene *scene, struct Object *ob, struc
 int multires_mdisp_corners(struct MDisps *s);
 
 /* update multires data after topology changing */
-void multires_topology_changed(struct Scene *scene, struct Object *ob);
+void multires_topology_changed(struct Mesh *me);
 
 /**** interpolation stuff ****/
 void old_mdisps_bilinear(float out[3], float (*disps)[3], const int st, float u, float v);
index 7a84e71c763f862a20b0814c122e6b04b7840027..598d1b681bc66a1de66dc45c18302b78832c1a15 100644 (file)
@@ -69,14 +69,14 @@ void seq_array(struct Editing *ed, struct Sequence ***seqarray, int *tot, int us
 #define SEQP_BEGIN(ed, _seq)                                                  \
 {                                                                             \
        SeqIterator iter;                                                         \
-               for(seq_begin(ed, &iter, 1); iter.valid; seq_next(&iter)) {           \
-                       _seq= iter.seq;
+               for (seq_begin(ed, &iter, 1); iter.valid; seq_next(&iter)) {          \
+                       _seq = iter.seq;
                        
 #define SEQ_BEGIN(ed, _seq)                                                   \
        {                                                                         \
                SeqIterator iter;                                                     \
-               for(seq_begin(ed, &iter, 0); iter.valid; seq_next(&iter)) {           \
-                       _seq= iter.seq;
+               for (seq_begin(ed, &iter, 0); iter.valid; seq_next(&iter)) {          \
+                       _seq = iter.seq;
 
 #define SEQ_END                                                               \
                }                                                                     \
@@ -138,12 +138,10 @@ struct SeqEffectHandle {
        int (*early_out)(struct Sequence *seq, float facf0, float facf1); 
        
        /* stores the y-range of the effect IPO */
-       void (*store_icu_yrange)(struct Sequence * seq,
-                                 short adrcode, float *ymin, float *ymax);
+       void (*store_icu_yrange)(struct Sequence * seq, short adrcode, float *ymin, float *ymax);
        
        /* stores the default facf0 and facf1 if no IPO is present */
-       void (*get_default_fac)(struct Sequence *seq, float cfra,
-                                float * facf0, float * facf1);
+       void (*get_default_fac)(struct Sequence *seq, float cfra, float * facf0, float * facf1);
        
        /* execute the effect
         * sequence effects are only required to either support
index 684c3d8683b0e53fe75551e5fe1c5fe39d3283df..00c2cf1696e2ecacdfca28c3ba5dd9dbbb72a04b 100644 (file)
@@ -23,8 +23,11 @@ incs += ' ' + env['BF_ZLIB_INC']
 
 defs = [ 'GLEW_STATIC' ]
 
-defs.append('WITH_SMOKE')  # TODO, make optional
-defs.append('WITH_FRAMESERVER')  # TODO, make optional
+if env['WITH_BF_SMOKE']:
+    defs.append('WITH_SMOKE')
+
+if env['WITH_BF_FRAMESERVER']:
+    defs.append('WITH_FRAMESERVER')
 
 if env['WITH_BF_PYTHON']:
     incs += ' ../python'
index 7a39cf1b9163f097d70236e0f07d234362dc5a65..ed561a58cceb71e2d5c7a9df5d391d9c5ff04537 100644 (file)
@@ -1989,13 +1989,6 @@ static DerivedMesh *cddm_copy_ex(DerivedMesh *source, int faces_from_tessfaces)
        cddm->mloop = CustomData_get_layer(&dm->loopData, CD_MLOOP);
        cddm->mpoly = CustomData_get_layer(&dm->polyData, CD_MPOLY);
 
-       /* any callers that need tessface data can calculate it - campbell */
-#if 0
-       /* BMESH_TODO: Find out why this is necessary (or else find a way to remove
-        * it). If it is necessary, add a comment explaining why. */
-       CDDM_recalc_tessellation((DerivedMesh *)cddm);
-#endif
-
        return dm;
 }
 
index 39fa5d2f7e7e4423cd0d4fd5cbf30154f5f5edcd..366e808d32c22ba39037a68df9ee6dc552e10a4a 100644 (file)
 
 #include "MEM_guardedalloc.h"
 
-#include "BLI_winstuff.h"
+#ifdef WIN32
+#  include "BLI_winstuff.h"
+#endif
+
 #include "BLI_utildefines.h"
 #include "BLI_listbase.h"
 #include "BLI_ghash.h"
index c54461a5a130d7ec6c7c1b16679bbbc5769bebbf..01d5d6ef2adbd4d1044ac8bf1cf776fce174f08b 100644 (file)
@@ -416,6 +416,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
 
 void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
 {
+       ScanFillContext sf_ctx;
        ScanFillVert *eve, *v1, *vlast;
        ScanFillFace *efa;
        DispList *dlnew=NULL, *dl;
@@ -431,7 +432,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
                totvert= 0;
                nextcol= 0;
                
-               BLI_begin_edgefill();
+               BLI_begin_edgefill(&sf_ctx);
                
                dl= dispbase->first;
                while (dl) {
@@ -448,18 +449,18 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
                                                while (a--) {
                                                        vlast= eve;
 
-                                                       eve= BLI_addfillvert(f1);
+                                                       eve = BLI_addfillvert(&sf_ctx, f1);
                                                        totvert++;
 
                                                        if (vlast==NULL) v1= eve;
                                                        else {
-                                                               BLI_addfilledge(vlast, eve);
+                                                               BLI_addfilledge(&sf_ctx, vlast, eve);
                                                        }
                                                        f1+=3;
                                                }
 
                                                if (eve!=NULL && v1!=NULL) {
-                                                       BLI_addfilledge(eve, v1);
+                                                       BLI_addfilledge(&sf_ctx, eve, v1);
                                                }
                                        }
                                        else if (colnr<dl->col) {
@@ -472,7 +473,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
                        dl= dl->next;
                }
                
-               if (totvert && (tot= BLI_edgefill(0))) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) {
+               if (totvert && (tot= BLI_edgefill(&sf_ctx, FALSE))) { // XXX (obedit && obedit->actcol)?(obedit->actcol-1):0)) {
                        if (tot) {
                                dlnew= MEM_callocN(sizeof(DispList), "filldisplist");
                                dlnew->type= DL_INDEX3;
@@ -486,7 +487,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
                                /* vert data */
                                f1= dlnew->verts;
                                totvert= 0;
-                               eve= fillvertbase.first;
+                               eve= sf_ctx.fillvertbase.first;
                                while (eve) {
                                        copy_v3_v3(f1, eve->co);
                                        f1+= 3;
@@ -499,7 +500,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
                                }
                                
                                /* index data */
-                               efafillfacebase.first;
+                               efa = sf_ctx.fillfacebase.first;
                                index= dlnew->index;
                                while (efa) {
                                        index[0]= (intptr_t)efa->v1->tmp.l;
@@ -517,7 +518,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
                        BLI_addhead(to, dlnew);
                        
                }
-               BLI_end_edgefill();
+               BLI_end_edgefill(&sf_ctx);
 
                if (nextcol) {
                        /* stay at current char but fill polys with next material */
index abc74983d2b6307a3f9eeef9cb69ea1194ca6192..07a43db8560aab080cc15199c0f9e1f5677eeb8c 100644 (file)
@@ -120,6 +120,8 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
        BMLoop *l;
        int i = 0, j;
 
+       ScanFillContext sf_ctx;
+
 #if 0
        /* note, we could be clever and re-use this array but would need to ensure
         * its realloced at some point, for now just free it */
@@ -195,18 +197,18 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
                        ScanFillFace *efa;
                        int totfilltri;
 
-                       BLI_begin_edgefill();
+                       BLI_begin_edgefill(&sf_ctx);
                        /*scanfill time*/
                        l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f);
                        for (j=0; l; l=BM_iter_step(&liter), j++) {
                                /*mark order*/
                                BM_elem_index_set(l, j); /* set_loop */
 
-                               v = BLI_addfillvert(l->v->co);
+                               v = BLI_addfillvert(&sf_ctx, l->v->co);
                                v->tmp.p = l;
 
                                if (lastv) {
-                                       /* e = */ BLI_addfilledge(lastv, v);
+                                       /* e = */ BLI_addfilledge(&sf_ctx, lastv, v);
                                }
 
                                lastv = v;
@@ -214,12 +216,12 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
                        }
 
                        /*complete the loop*/
-                       BLI_addfilledge(firstv, v);
+                       BLI_addfilledge(&sf_ctx, firstv, v);
 
-                       totfilltri = BLI_edgefill(2);
+                       totfilltri = BLI_edgefill(&sf_ctx, FALSE);
                        BLI_array_growitems(looptris, totfilltri);
 
-                       for (efa = fillfacebase.first; efa; efa=efa->next) {
+                       for (efa = sf_ctx.fillfacebase.first; efa; efa=efa->next) {
                                BMLoop *l1= efa->v1->tmp.p;
                                BMLoop *l2= efa->v2->tmp.p;
                                BMLoop *l3= efa->v3->tmp.p;
@@ -234,7 +236,7 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
                                i += 1;
                        }
 
-                       BLI_end_edgefill();
+                       BLI_end_edgefill(&sf_ctx);
                }
        }
 
@@ -1492,35 +1494,49 @@ static void *emDM_getTessFaceDataArray(DerivedMesh *dm, int type)
 {
        EditDerivedBMesh *bmdm= (EditDerivedBMesh*) dm;
        BMesh *bm= bmdm->tc->bm;
-       BMFace *efa;
-       char *data, *bmdata;
        void *datalayer;
-       int index /*, offset*/ /*UNUSED */, size, i;
 
        datalayer = DM_get_tessface_data_layer(dm, type);
        if (datalayer)
                return datalayer;
 
-       /* layers are store per face for editmesh, we convert to a tbmporary
+       /* layers are store per face for editmesh, we convert to a temporary
         * data layer array in the derivedmesh when these are requested */
        if (type == CD_MTFACE || type == CD_MCOL) {
-               index = CustomData_get_layer_index(&bm->pdata, type);
+               const int type_from = (type == CD_MTFACE) ? CD_MTEXPOLY : CD_MLOOPCOL;
+               int index;
+               char *data, *bmdata;
+               index = CustomData_get_layer_index(&bm->pdata, type_from);
 
                if (index != -1) {
                        /* offset = bm->pdata.layers[index].offset; */ /* UNUSED */
-                       size = CustomData_sizeof(type);
+                       const int size = CustomData_sizeof(type);
+                       int i, j;
 
                        DM_add_tessface_layer(dm, type, CD_CALLOC, NULL);
                        index = CustomData_get_layer_index(&dm->faceData, type);
                        dm->faceData.layers[index].flag |= CD_FLAG_TEMPORARY;
 
                        data = datalayer = DM_get_tessface_data_layer(dm, type);
-                       for (i=0; i<bmdm->tc->tottri; i++, data+=size) {
-                               efa = bmdm->tc->looptris[i][0]->f;
-                               /* BMESH_TODO: need to still add tface data,
-                                * derived from the loops.*/
-                               bmdata = CustomData_bmesh_get(&bm->pdata, efa->head.data, type);
-                               memcpy(data, bmdata, size);
+
+                       if (type == CD_MTFACE) {
+                               for (i = 0; i < bmdm->tc->tottri; i++, data += size) {
+                                       BMFace *efa = bmdm->tc->looptris[i][0]->f;
+                                       bmdata = CustomData_bmesh_get(&bm->pdata, efa->head.data, CD_MTEXPOLY);
+                                       ME_MTEXFACE_CPY(((MTFace *)data), ((MTexPoly *)bmdata));
+                                       for (j = 0; j < 3; j++) {
+                                               bmdata = CustomData_bmesh_get(&bm->ldata, bmdm->tc->looptris[i][j]->head.data, CD_MLOOPUV);
+                                               copy_v2_v2(((MTFace *)data)->uv[j], ((MLoopUV *)bmdata)->uv);
+                                       }
+                               }
+                       }
+                       else {
+                               for (i = 0; i < bmdm->tc->tottri; i++, data += size) {
+                                       for (j = 0; j < 3; j++) {
+                                               bmdata = CustomData_bmesh_get(&bm->ldata, bmdm->tc->looptris[i][j]->head.data, CD_MLOOPCOL);
+                                               MESH_MLOOPCOL_TO_MCOL(((MLoopCol *)bmdata), (((MCol *)data) + j));
+                                       }
+                               }
                        }
                }
        }
index 9a10a00bf456fbc3c713c073067e77e795c97634..b7b9f6b21f44d2c1dc02b3bc2f0380c0eed2a523 100644 (file)
@@ -2354,7 +2354,6 @@ int mesh_recalcTessellation(CustomData *fdata,
                             * we can skip copying here */
                            const int do_face_nor_cpy)
 {
-
        /* use this to avoid locking pthread for _every_ polygon
         * and calling the fill function */
 
@@ -2368,6 +2367,7 @@ int mesh_recalcTessellation(CustomData *fdata,
        MLoop *ml, *mloop;
        MFace *mface = NULL, *mf;
        BLI_array_declare(mface);
+       ScanFillContext sf_ctx;
        ScanFillVert *v, *lastv, *firstv;
        ScanFillFace *f;
        int *mface_orig_index = NULL;
@@ -2461,24 +2461,24 @@ int mesh_recalcTessellation(CustomData *fdata,
 
                        ml = mloop + mp->loopstart;
                        
-                       BLI_begin_edgefill();
+                       BLI_begin_edgefill(&sf_ctx);
                        firstv = NULL;
                        lastv = NULL;
                        for (j=0; j<mp->totloop; j++, ml++) {
-                               v = BLI_addfillvert(mvert[ml->v].co);
+                               v = BLI_addfillvert(&sf_ctx, mvert[ml->v].co);
        
                                v->keyindex = mp->loopstart + j;
        
                                if (lastv)
-                                       BLI_addfilledge(lastv, v);
+                                       BLI_addfilledge(&sf_ctx, lastv, v);
        
                                if (!firstv)
                                        firstv = v;
                                lastv = v;
                        }
-                       BLI_addfilledge(lastv, firstv);
+                       BLI_addfilledge(&sf_ctx, lastv, firstv);
                        
-                       totfilltri = BLI_edgefill(2);
+                       totfilltri = BLI_edgefill(&sf_ctx, FALSE);
                        if (totfilltri) {
                                BLI_array_growitems(mface_to_poly_map, totfilltri);
                                BLI_array_growitems(mface, totfilltri);
@@ -2486,7 +2486,7 @@ int mesh_recalcTessellation(CustomData *fdata,
                                        BLI_array_growitems(mface_orig_index, totfilltri);
                                }
 
-                               for (f = fillfacebase.first; f; f = f->next, mf++) {
+                               for (f = sf_ctx.fillfacebase.first; f; f = f->next, mf++) {
                                        mface_to_poly_map[mface_index] = poly_index;
                                        mf= &mface[mface_index];
 
@@ -2511,7 +2511,7 @@ int mesh_recalcTessellation(CustomData *fdata,
                                }
                        }
        
-                       BLI_end_edgefill();
+                       BLI_end_edgefill(&sf_ctx);
                }
        }
 
index d8117aa1344d63c5b55fb8e46eca16d0329d2ebc..2167495ef080d9bbc1fd73474306386dd7408af6 100644 (file)
@@ -2166,58 +2166,38 @@ void multiresModifier_prepare_join(Scene *scene, Object *ob, Object *to_ob)
 }
 
 /* update multires data after topology changing */
-#if 0 // BMESH_TODO
-void multires_topology_changed(Scene *scene, Object *ob)
+void multires_topology_changed(Mesh *me)
 {
-       Mesh *me= (Mesh*)ob->data;
-       MDisps *mdisp= NULL, *cur= NULL;
-       int i, grid= 0, corners;
-       MultiresModifierData *mmd= get_multires_modifier(scene, ob, 1);
-
-       if (mmd)
-               multires_set_tot_mdisps(me, mmd->totlvl);
+       MDisps *mdisp = NULL, *cur = NULL;
+       int i, grid = 0;
 
-       CustomData_external_read(&me->fdata, &me->id, CD_MASK_MDISPS, me->totface);
-       mdisp= CustomData_get_layer(&me->fdata, CD_MDISPS);
+       CustomData_external_read(&me->ldata, &me->id, CD_MASK_MDISPS, me->totface);
+       mdisp = CustomData_get_layer(&me->ldata, CD_MDISPS);
 
-       if (!mdisp) return;
+       if (!mdisp)
+               return;
 
-       cur= mdisp;
-       for (i = 0; i < me->totface; i++, cur++) {
-               if (mdisp->totdisp) {
-                       corners= multires_mdisp_corners(mdisp);
-                       grid= mdisp->totdisp / corners;
+       cur = mdisp;
+       for (i = 0; i < me->totloop; i++, cur++) {
+               if (cur->totdisp) {
+                       grid = mdisp->totdisp;
 
                        break;
                }
        }
 
-       for (i = 0; i < me->totface; i++, mdisp++) {
-               int nvert= me->mface[i].v4 ? 4 : 3;
-
+       for (i = 0; i < me->totloop; i++, mdisp++) {
                /* allocate memory for mdisp, the whole disp layer would be erased otherwise */
                if (!mdisp->totdisp || !mdisp->disps) {
                        if (grid) {
-                               mdisp->totdisp= nvert*grid;
-                               mdisp->disps= MEM_callocN(mdisp->totdisp*sizeof(float)*3, "mdisp topology");
+                               mdisp->totdisp = grid;
+                               mdisp->disps = MEM_callocN(3 * mdisp->totdisp * sizeof(float), "mdisp topology");
                        }
 
                        continue;
                }
-
-               corners= multires_mdisp_corners(mdisp);
-
-               if (corners!=nvert) {
-                       mdisp->totdisp= (mdisp->totdisp/corners)*nvert;
-
-                       if (mdisp->disps)
-                               MEM_freeN(mdisp->disps);
-
-                       mdisp->disps= MEM_callocN(mdisp->totdisp*sizeof(float)*3, "mdisp topology");
-               }
        }
 }
-#endif // BMESH_TODO
 
 /***************** Multires interpolation stuff *****************/
 
index cbdbf0317b4774ac395a8dd2196c5d308d2c82af..b50969d01075b3889fdf6c7bc1980581e97f1dda 100644 (file)
@@ -1367,7 +1367,7 @@ void nodeSetActive(bNodeTree *ntree, bNode *node)
 
 int nodeSocketIsHidden(bNodeSocket *sock)
 {
-       return ((sock->flag & (SOCK_HIDDEN | SOCK_AUTO_HIDDEN | SOCK_UNAVAIL)) != 0);
+       return ((sock->flag & (SOCK_HIDDEN | SOCK_UNAVAIL)) != 0);
 }
 
 void nodeSocketSetType(bNodeSocket *sock, int type)
index 7c242da9aff7492b1bbcf8800e005861dbb4a67a..c950a6ccdb59557142282d345ed00945e9bb322c 100644 (file)
@@ -123,6 +123,12 @@ Scene *copy_scene(Scene *sce, int type)
                lb= scen->r.layers;
                scen->r= sce->r;
                scen->r.layers= lb;
+               scen->unit= sce->unit;
+               scen->physics_settings= sce->physics_settings;
+               scen->gm= sce->gm;
+               scen->audio= sce->audio;
+
+               MEM_freeN(scen->toolsettings);
        }
        else {
                scen= copy_libblock(&sce->id);
@@ -137,37 +143,9 @@ Scene *copy_scene(Scene *sce, int type)
                scen->ed= NULL;
                scen->theDag= NULL;
                scen->obedit= NULL;
-               scen->toolsettings= MEM_dupallocN(sce->toolsettings);
                scen->stats= NULL;
                scen->fps_info= NULL;
 
-               ts= scen->toolsettings;
-               if (ts) {
-                       if (ts->vpaint) {
-                               ts->vpaint= MEM_dupallocN(ts->vpaint);
-                               ts->vpaint->paintcursor= NULL;
-                               ts->vpaint->vpaint_prev= NULL;
-                               ts->vpaint->wpaint_prev= NULL;
-                               copy_paint(&ts->vpaint->paint, &ts->vpaint->paint);
-                       }
-                       if (ts->wpaint) {
-                               ts->wpaint= MEM_dupallocN(ts->wpaint);
-                               ts->wpaint->paintcursor= NULL;
-                               ts->wpaint->vpaint_prev= NULL;
-                               ts->wpaint->wpaint_prev= NULL;
-                               copy_paint(&ts->wpaint->paint, &ts->wpaint->paint);
-                       }
-                       if (ts->sculpt) {
-                               ts->sculpt= MEM_dupallocN(ts->sculpt);
-                               copy_paint(&ts->sculpt->paint, &ts->sculpt->paint);
-                       }
-
-                       copy_paint(&ts->imapaint.paint, &ts->imapaint.paint);
-                       ts->imapaint.paintcursor= NULL;
-
-                       ts->particle.paintcursor= NULL;
-               }
-               
                BLI_duplicatelist(&(scen->markers), &(sce->markers));
                BLI_duplicatelist(&(scen->transform_spaces), &(sce->transform_spaces));
                BLI_duplicatelist(&(scen->r.layers), &(sce->r.layers));
@@ -188,6 +166,35 @@ Scene *copy_scene(Scene *sce, int type)
                        base= base->next;
                }
        }
+
+       /* tool settings */
+       scen->toolsettings= MEM_dupallocN(sce->toolsettings);
+
+       ts= scen->toolsettings;
+       if (ts) {
+               if (ts->vpaint) {
+                       ts->vpaint= MEM_dupallocN(ts->vpaint);
+                       ts->vpaint->paintcursor= NULL;
+                       ts->vpaint->vpaint_prev= NULL;
+                       ts->vpaint->wpaint_prev= NULL;
+                       copy_paint(&ts->vpaint->paint, &ts->vpaint->paint);
+               }
+               if (ts->wpaint) {
+                       ts->wpaint= MEM_dupallocN(ts->wpaint);
+                       ts->wpaint->paintcursor= NULL;
+                       ts->wpaint->vpaint_prev= NULL;
+                       ts->wpaint->wpaint_prev= NULL;
+                       copy_paint(&ts->wpaint->paint, &ts->wpaint->paint);
+               }
+               if (ts->sculpt) {
+                       ts->sculpt= MEM_dupallocN(ts->sculpt);
+                       copy_paint(&ts->sculpt->paint, &ts->sculpt->paint);
+               }
+
+               copy_paint(&ts->imapaint.paint, &ts->imapaint.paint);
+               ts->imapaint.paintcursor= NULL;
+               ts->particle.paintcursor= NULL;
+       }
        
        /* make a private copy of the avicodecdata */
        if (sce->r.avicodecdata) {
index 158fc91c03c2d18a99c196035fc8151f9dd1b221..af0c5eae9a8c03f75ca46042c7db02742a57172a 100644 (file)
@@ -30,7 +30,9 @@
  *  \ingroup bke
  */
 
-#include "BLI_winstuff.h"
+#ifdef WIN32
+#  include "BLI_winstuff.h"
+#endif
 
 #include <string.h>
 #include <stdio.h>
index b3c979afac4a114deb1fe57f9d80c237e3c71f1c..7a71853641d941a43ec7caff47eaa4982dc478f6 100644 (file)
 #include "BLI_math.h"
 #include "BLI_string.h"
 #include "BLI_string_utf8.h"
-#include "BLI_winstuff.h"
+
+#ifdef WIN32
+#  include "BLI_winstuff.h"
+#endif
 
 #define TEMP_STR_SIZE 256
 
index 1fe71bffba8179c77ffd72844cbfaaf0bb63e792..67ff9a88700e55c3d4d1fdccdc37fd09ce4ce5d7 100644 (file)
  *  \brief Filling meshes.
  */
 
-/**
- * \attention Defined in scanfill.c
- */
-extern struct ListBase fillvertbase;
-extern struct ListBase filledgebase;
-extern struct ListBase fillfacebase;
-
 struct ScanFillVert;
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+typedef struct ScanFillContext
+{
+       ListBase fillvertbase;
+       ListBase filledgebase;
+       ListBase fillfacebase;
+
+       /* simple optimization for allocating thousands of small memory blocks
+        * only to be used within loops, and not by one function at a time
+        * free in the end, with argument '-1'
+        */
+       #define MEM_ELEM_BLOCKSIZE 16384
+       struct mem_elements *melem__cur;
+       int melem__offs;                   /* the current free address */
+       ListBase melem__lb;
+
+       /* private */
+       struct ScanFillVertLink *_scdata;
+} ScanFillContext;
+
 /* note; changing this also might affect the undo copy in editmesh.c */
 typedef struct ScanFillVert
 {
@@ -57,7 +69,8 @@ typedef struct ScanFillVert
                void            *p;
                intptr_t         l;
        } tmp;
-       float co[3]; /*vertex location */
+       float co[3]; /* vertex location */
+       float xy[2]; /* 2D copy of vertex location (using dominant axis) */
        int keyindex; /* original index #, for restoring  key information */
        short poly_nr;
        unsigned char f, h;
@@ -78,16 +91,16 @@ typedef struct ScanFillFace
 } ScanFillFace;
 
 /* scanfill.c: used in displist only... */
-struct ScanFillVert *BLI_addfillvert(const float vec[3]);
-struct ScanFillEdge *BLI_addfilledge(struct ScanFillVert *v1, struct ScanFillVert *v2);
+struct ScanFillVert *BLI_addfillvert(ScanFillContext *sf_ctx, const float vec[3]);
+struct ScanFillEdge *BLI_addfilledge(ScanFillContext *sf_ctx, struct ScanFillVert *v1, struct ScanFillVert *v2);
 
 /* Optionally set ScanFillEdge f to this to mark original boundary edges.
  * Only needed if there are internal diagonal edges passed to BLI_edgefill. */
 #define FILLBOUNDARY 1
 
-int BLI_begin_edgefill(void);
-int BLI_edgefill(short mat_nr);
-void BLI_end_edgefill(void);
+int BLI_begin_edgefill(ScanFillContext *sf_ctx);
+int BLI_edgefill(ScanFillContext *sf_ctx, const short do_quad_tri_speedup);
+void BLI_end_edgefill(ScanFillContext *sf_ctx);
 
 /* These callbacks are needed to make the lib finction properly */
 
@@ -109,8 +122,6 @@ void BLI_setErrorCallBack(void (*f)(const char*));
  */
 void BLI_setInterruptCallBack(int (*f)(void));
 
-void BLI_scanfill_free(void);
-
 #ifdef __cplusplus
 }
 #endif
index 03bf375a8942f698ea5ff22ef46182ed0817dada..8e75a2db6290f02c6f366d1d0497e12339ecbc37 100644 (file)
@@ -76,7 +76,6 @@ int           BLI_system_thread_count(void); /* gets the number of threads the system can
 #define LOCK_OPENGL            5
 #define LOCK_NODES             6
 #define LOCK_MOVIECLIP 7
-#define LOCK_SCANFILL  8
 
 void   BLI_lock_thread(int type);
 void   BLI_unlock_thread(int type);
index 821946727f22e0e10b5dd609875ffb1c62637571..33ca7d235fa6dcdc910a6eb7f10d2eea9fb960fd 100644 (file)
  *  \brief Compatibility-like things for windows.
  */
 
-#ifdef _WIN32
+#ifndef _WIN32
+#  error "This include is for Windows only!"
+#endif
 
 #ifndef FREE_WINDOWS
-#pragma warning(once: 4761 4305 4244 4018)
+#  pragma warning(once: 4761 4305 4244 4018)
 #else
-#ifdef WINVER
-#undef WINVER
-#endif
+#  ifdef WINVER
+#    undef WINVER
+#  endif
 
 /* Some stuff requires WINVER 0x500, but mingw's default is 0x400 */
-#define WINVER 0x0501
+#  define WINVER 0x0501
 #endif
 
 #define WIN32_LEAN_AND_MEAN
 
 #ifndef WIN32_SKIP_HKEY_PROTECTION
-#undef HKEY
-#define HKEY WIN32_HKEY                                // prevent competing definitions
-#include <windows.h>
-#undef HKEY
+#  undef HKEY
+#  define HKEY WIN32_HKEY                              // prevent competing definitions
+#  include <windows.h>
+#  undef HKEY
 #else
-#include <windows.h>
+#  include <windows.h>
 #endif
 
 #undef near
@@ -83,10 +85,10 @@ extern "C" {
 #define MAXPATHLEN MAX_PATH
 
 #ifndef S_ISREG
-#define S_ISREG(x) (((x)&_S_IFREG) == _S_IFREG)
+#  define S_ISREG(x) (((x)&_S_IFREG) == _S_IFREG)
 #endif
 #ifndef S_ISDIR
-#define S_ISDIR(x) (((x)&_S_IFDIR) == _S_IFDIR)
+#  define S_ISDIR(x) (((x)&_S_IFDIR) == _S_IFDIR)
 #endif
 
 /* defines for using ISO C++ conformant names */
@@ -98,21 +100,21 @@ typedef unsigned int mode_t;
 
 /* use functions that take a 64 bit offset for files larger than 4GB */
 #ifndef FREE_WINDOWS
-#include <stdio.h>
-#define fseek(stream, offset, origin) _fseeki64(stream, offset, origin)
-#define ftell(stream) _ftelli64(stream)
-#define lseek(fd, offset, origin) _lseeki64(fd, offset, origin)
-#define tell(fd) _telli64(fd)
+#  include <stdio.h>
+#  define fseek(stream, offset, origin) _fseeki64(stream, offset, origin)
+#  define ftell(stream) _ftelli64(stream)
+#  define lseek(fd, offset, origin) _lseeki64(fd, offset, origin)
+#  define tell(fd) _telli64(fd)
 #endif
 
 /* mingw using _SSIZE_T_ to declare ssize_t type */
 #ifndef _SSIZE_T_
-#define _SSIZE_T_
+#  define _SSIZE_T_
 /* python uses HAVE_SSIZE_T */
-#ifndef HAVE_SSIZE_T
-#define HAVE_SSIZE_T 1
+#  ifndef HAVE_SSIZE_T
+#    define HAVE_SSIZE_T 1
 typedef long ssize_t;
-#endif
+#  endif
 #endif
 
 struct dirent {
@@ -148,7 +150,5 @@ int BLI_getInstallationDir(char *str);
 }
 #endif
 
-#endif /* _WIN32 */
-
 #endif /* __BLI_WINSTUFF_H__ */
 
index 1b734c674e29bf4067d1c62918868ff0a9f94197..93312f046928f42a7c71b4cbe3a6edba9fe17b0b 100644 (file)
 
 #ifdef WIN32
 #include <io.h>
-#include "BLI_winstuff.h"
-#include "BLI_callbacks.h"
-#include "utf_winfunc.h"
-#include "utfconv.h"
+#  include "BLI_winstuff.h"
+#  include "BLI_callbacks.h"
+#  include "utf_winfunc.h"
+#  include "utfconv.h"
 #else
-#include <unistd.h> // for read close
-#include <sys/param.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
+#  include <unistd.h> // for read close
+#  include <sys/param.h>
+#  include <dirent.h>
+#  include <unistd.h>
+#  include <sys/stat.h>
 #endif
 
 #include "MEM_guardedalloc.h"
index 641d0373a64773b74d98df4418d23ba4c3501b80..69b8f3f3ee7abbbab323fcd4e81e9fb3a78a851d 100644 (file)
 #include "BLI_math.h"
 #include "BLI_scanfill.h"
 #include "BLI_utildefines.h"
-#include "BLI_threads.h"
 
 /* callbacks for errors and interrupts and some goo */
-static void (*BLI_localErrorCallBack)(const char*) = NULL;
+static void (*BLI_localErrorCallBack)(const char *) = NULL;
 static int (*BLI_localInterruptCallBack)(void) = NULL;
 
 void BLI_setErrorCallBack(void (*f)(const char *))
@@ -59,7 +58,7 @@ void BLI_setInterruptCallBack(int (*f)(void))
 }
 
 /* just flush the error to /dev/null if the error handler is missing */
-void callLocalErrorCallBack(const charmsg)
+void callLocalErrorCallBack(const char *msg)
 {
        if (BLI_localErrorCallBack) {
                BLI_localErrorCallBack(msg);
@@ -81,9 +80,9 @@ static int callLocalInterruptCallBack(void)
 
 /* local types */
 typedef struct PolyFill {
-       int edges,verts;
-       float min[3],max[3];
-       short f,nr;
+       int edges, verts;
+       float min_xy[2], max_xy[2];
+       short f, nr;
 } PolyFill;
 
 typedef struct ScanFillVertLink {
@@ -94,99 +93,82 @@ typedef struct ScanFillVertLink {
 
 /* local funcs */
 
-#define COMPLIMIT      0.00003
+#define COMPLIMIT   0.00003f
 
-static ScanFillVertLink *scdata;
-
-ListBase fillvertbase = {NULL, NULL};
-ListBase filledgebase = {NULL, NULL};
-ListBase fillfacebase = {NULL, NULL};
-
-static int cox, coy;
-
-/* ****  FUBCTIONS FOR QSORT *************************** */
+/* ****  FUNCTIONS FOR QSORT *************************** */
 
 
 static int vergscdata(const void *a1, const void *a2)
 {
-       const ScanFillVertLink *x1=a1,*x2=a2;
+       const ScanFillVertLink *x1 = a1, *x2 = a2;
        
-       if ( x1->v1->co[coy] < x2->v1->co[coy] ) return 1;
-       else if ( x1->v1->co[coy] > x2->v1->co[coy]) return -1;
-       else if ( x1->v1->co[cox] > x2->v1->co[cox] ) return 1;
-       else if ( x1->v1->co[cox] < x2->v1->co[cox]) return -1;
+       if      (x1->v1->xy[1] < x2->v1->xy[1]) return  1;
+       else if (x1->v1->xy[1] > x2->v1->xy[1]) return -1;
+       else if (x1->v1->xy[0] > x2->v1->xy[0]) return  1;
+       else if (x1->v1->xy[0] < x2->v1->xy[0]) return -1;
 
        return 0;
 }
 
 static int vergpoly(const void *a1, const void *a2)
 {
-       const PolyFill *x1=a1, *x2=a2;
+       const PolyFill *x1 = a1, *x2 = a2;
 
-       if ( x1->min[cox] > x2->min[cox] ) return 1;
-       else if ( x1->min[cox] < x2->min[cox] ) return -1;
-       else if ( x1->min[coy] > x2->min[coy] ) return 1;
-       else if ( x1->min[coy] < x2->min[coy] ) return -1;
+       if      (x1->min_xy[0] > x2->min_xy[0]) return  1;
+       else if (x1->min_xy[0] < x2->min_xy[0]) return -1;
+       else if (x1->min_xy[1] > x2->min_xy[1]) return  1;
+       else if (x1->min_xy[1] < x2->min_xy[1]) return -1;
        
        return 0;
 }
 
 /* ************* MEMORY MANAGEMENT ************* */
 
+/* memory management */
 struct mem_elements {
        struct mem_elements *next, *prev;
        char *data;
 };
 
-
-/* simple optimization for allocating thousands of small memory blocks
- * only to be used within loops, and not by one function at a time
- * free in the end, with argument '-1'
- */
-#define MEM_ELEM_BLOCKSIZE 16384
-static struct mem_elements *  melem__cur= NULL;
-static int                    melem__offs= 0; /* the current free address */
-static ListBase               melem__lb= {NULL, NULL};
-
-static void *mem_element_new(int size)
+static void *mem_element_new(ScanFillContext *sf_ctx, int size)
 {
-       BLI_assert(!(size>10000 || size==0)); /* this is invalid use! */
+       BLI_assert(!(size > 10000 || size == 0)); /* this is invalid use! */
 
-       size = (size + 3 ) & ~3;        /* allocate in units of 4 */
+       size = (size + 3) & ~3;     /* allocate in units of 4 */
        
-       if (melem__cur && (size + melem__offs < MEM_ELEM_BLOCKSIZE)) {
-               void *adr= (void *) (melem__cur->data+melem__offs);
-                melem__offs+= size;
+       if (sf_ctx->melem__cur && (size + sf_ctx->melem__offs < MEM_ELEM_BLOCKSIZE)) {
+               void *adr = (void *) (sf_ctx->melem__cur->data + sf_ctx->melem__offs);
+               sf_ctx->melem__offs += size;
                return adr;
        }
        else {
-               melem__cur= MEM_callocN( sizeof(struct mem_elements), "newmem");
-               melem__cur->data= MEM_callocN(MEM_ELEM_BLOCKSIZE, "newmem");
-               BLI_addtail(&melem__lb, melem__cur);
+               sf_ctx->melem__cur = MEM_callocN(sizeof(struct mem_elements), "newmem");
+               sf_ctx->melem__cur->data = MEM_callocN(MEM_ELEM_BLOCKSIZE, "newmem");
+               BLI_addtail(&sf_ctx->melem__lb, sf_ctx->melem__cur);
 
-               melem__offs= size;
-               return melem__cur->data;
+               sf_ctx->melem__offs = size;
+               return sf_ctx->melem__cur->data;
        }
 }
-static void mem_element_reset(int keep_first)
+static void mem_element_reset(ScanFillContext *sf_ctx, int keep_first)
 {
        struct mem_elements *first;
 
-       if ((firstmelem__lb.first)) { /* can be false if first fill fails */
+       if ((first = sf_ctx->melem__lb.first)) { /* can be false if first fill fails */
                if (keep_first) {
-                       BLI_remlink(&melem__lb, first);
+                       BLI_remlink(&sf_ctx->melem__lb, first);
                }
 
-               melem__cur= melem__lb.first;
-               while (melem__cur) {
-                       MEM_freeN(melem__cur->data);
-                       melem__cur= melem__cur->next;
+               sf_ctx->melem__cur = sf_ctx->melem__lb.first;
+               while (sf_ctx->melem__cur) {
+                       MEM_freeN(sf_ctx->melem__cur->data);
+                       sf_ctx->melem__cur = sf_ctx->melem__cur->next;
                }
-               BLI_freelistN(&melem__lb);
+               BLI_freelistN(&sf_ctx->melem__lb);
 
                /*reset the block we're keeping*/
                if (keep_first) {
-                       BLI_addtail(&melem__lb, first);
+                       BLI_addtail(&sf_ctx->melem__lb, first);
                        memset(first->data, 0, MEM_ELEM_BLOCKSIZE);
                }
                else {
@@ -195,34 +177,27 @@ static void mem_element_reset(int keep_first)
                }
        }
 
-       melem__cur= first;
-       melem__offs= 0;
+       sf_ctx->melem__cur = first;
+       sf_ctx->melem__offs = 0;
 }
 
-void BLI_end_edgefill(void)
+void BLI_end_edgefill(ScanFillContext *sf_ctx)
 {
-       mem_element_reset(TRUE);
+        mem_element_reset(sf_ctx, FALSE);
        
-       fillvertbase.first= fillvertbase.last= 0;
-       filledgebase.first= filledgebase.last= 0;
-       fillfacebase.first= fillfacebase.last= 0;
-       
-       BLI_unlock_thread(LOCK_SCANFILL);       
-}
-
-void BLI_scanfill_free(void)
-{
-       mem_element_reset(FALSE);
+       sf_ctx->fillvertbase.first = sf_ctx->fillvertbase.last = NULL;
+       sf_ctx->filledgebase.first = sf_ctx->filledgebase.last = NULL;
+       sf_ctx->fillfacebase.first = sf_ctx->fillfacebase.last = NULL;
 }
 
 /* ****  FILL ROUTINES *************************** */
 
-ScanFillVert *BLI_addfillvert(const float vec[3])
+ScanFillVert *BLI_addfillvert(ScanFillContext *sf_ctx, const float vec[3])
 {
        ScanFillVert *eve;
        
-       eve= mem_element_new(sizeof(ScanFillVert));
-       BLI_addtail(&fillvertbase, eve);
+       eve = mem_element_new(sf_ctx, sizeof(ScanFillVert));
+       BLI_addtail(&sf_ctx->fillvertbase, eve);
        
        eve->co[0] = vec[0];
        eve->co[1] = vec[1];
@@ -231,30 +206,30 @@ ScanFillVert *BLI_addfillvert(const float vec[3])
        return eve;     
 }
 
-ScanFillEdge *BLI_addfilledge(ScanFillVert *v1, ScanFillVert *v2)
+ScanFillEdge *BLI_addfilledge(ScanFillContext *sf_ctx, ScanFillVert *v1, ScanFillVert *v2)
 {
        ScanFillEdge *newed;
 
-       newed= mem_element_new(sizeof(ScanFillEdge));
-       BLI_addtail(&filledgebase, newed);
+       newed = mem_element_new(sf_ctx, sizeof(ScanFillEdge));
+       BLI_addtail(&sf_ctx->filledgebase, newed);
        
-       newed->v1= v1;
-       newed->v2= v2;
+       newed->v1 = v1;
+       newed->v2 = v2;
 
        return newed;
 }
 
-static void addfillface(ScanFillVert *v1, ScanFillVert *v2, ScanFillVert *v3)
+static void addfillface(ScanFillContext *sf_ctx, ScanFillVert *v1, ScanFillVert *v2, ScanFillVert *v3)
 {
        /* does not make edges */
        ScanFillFace *evl;
 
-       evl= mem_element_new(sizeof(ScanFillFace));
-       BLI_addtail(&fillfacebase, evl);
+       evl = mem_element_new(sf_ctx, sizeof(ScanFillFace));
+       BLI_addtail(&sf_ctx->fillfacebase, evl);
        
-       evl->v1= v1;
-       evl->v2= v2;
-       evl->v3= v3;
+       evl->v1 = v1;
+       evl->v2 = v2;
+       evl->v3 = v3;
 }
 
 static int boundisect(PolyFill *pf2, PolyFill *pf1)
@@ -262,60 +237,62 @@ static int boundisect(PolyFill *pf2, PolyFill *pf1)
        /* has pf2 been touched (intersected) by pf1 ? with bounding box */
        /* test first if polys exist */
 
-       if (pf1->edges==0 || pf2->edges==0) return 0;
+       if (pf1->edges == 0 || pf2->edges == 0) return 0;
 
-       if (pf2->max[cox] < pf1->min[cox] ) return 0;
-       if (pf2->max[coy] < pf1->min[coy] ) return 0;
+       if (pf2->max_xy[0] < pf1->min_xy[0]) return 0;
+       if (pf2->max_xy[1] < pf1->min_xy[1]) return 0;
 
-       if (pf2->min[cox] > pf1->max[cox] ) return 0;
-       if (pf2->min[coy] > pf1->max[coy] ) return 0;
+       if (pf2->min_xy[0] > pf1->max_xy[0]) return 0;
+       if (pf2->min_xy[1] > pf1->max_xy[1]) return 0;
 
        /* join */
-       if (pf2->max[cox]<pf1->max[cox]) pf2->max[cox]= pf1->max[cox];
-       if (pf2->max[coy]<pf1->max[coy]) pf2->max[coy]= pf1->max[coy];
+       if (pf2->max_xy[0] < pf1->max_xy[0]) pf2->max_xy[0] = pf1->max_xy[0];
+       if (pf2->max_xy[1] < pf1->max_xy[1]) pf2->max_xy[1] = pf1->max_xy[1];
 
-       if (pf2->min[cox]>pf1->min[cox]) pf2->min[cox]= pf1->min[cox];
-       if (pf2->min[coy]>pf1->min[coy]) pf2->min[coy]= pf1->min[coy];
+       if (pf2->min_xy[0] > pf1->min_xy[0]) pf2->min_xy[0] = pf1->min_xy[0];
+       if (pf2->min_xy[1] > pf1->min_xy[1]) pf2->min_xy[1] = pf1->min_xy[1];
 
        return 1;
 }
 
 
-static void mergepolysSimp(PolyFill *pf1, PolyFill *pf2)       /* add pf2 to pf1 */
+static void mergepolysSimp(ScanFillContext *sf_ctx, PolyFill *pf1, PolyFill *pf2)    /* add pf2 to pf1 */
 {
        ScanFillVert *eve;
        ScanFillEdge *eed;
 
        /* replace old poly numbers */
-       evefillvertbase.first;
+       eve = sf_ctx->fillvertbase.first;
        while (eve) {
                if (eve->poly_nr == pf2->nr) eve->poly_nr = pf1->nr;
-               eve= eve->next;
+               eve = eve->next;
        }
-       eedfilledgebase.first;
+       eed = sf_ctx->filledgebase.first;
        while (eed) {
                if (eed->poly_nr == pf2->nr) eed->poly_nr = pf1->nr;
-               eed= eed->next;
+               eed = eed->next;
        }
 
-       pf1->verts+= pf2->verts;
-       pf1->edges+= pf2->edges;
-       pf2->verts= pf2->edges= 0;
-       pf1->f= (pf1->f | pf2->f);
+       pf1->verts += pf2->verts;
+       pf1->edges += pf2->edges;
+       pf2->verts = pf2->edges = 0;
+       pf1->f = (pf1->f | pf2->f);
 }
 
-static short testedgeside(const float v1[3], const float v2[3], const float v3[3])
+static short testedgeside(const float v1[2], const float v2[2], const float v3[2])
 /* is v3 to the right of v1-v2 ? With exception: v3==v1 || v3==v2 */
 {
        float inp;
 
-       inp= (v2[cox]-v1[cox])*(v1[coy]-v3[coy])
-               +(v1[coy]-v2[coy])*(v1[cox]-v3[cox]);
+       inp = (v2[0] - v1[0]) * (v1[1] - v3[1]) +
+             (v1[1] - v2[1]) * (v1[0] - v3[0]);
 
-       if (inp < 0.0f) return 0;
-       else if (inp==0) {
-               if (v1[cox]==v3[cox] && v1[coy]==v3[coy]) return 0;
-               if (v2[cox]==v3[cox] && v2[coy]==v3[coy]) return 0;
+       if (inp < 0.0f) {
+               return 0;
+       }
+       else if (inp == 0) {
+               if (v1[0] == v3[0] && v1[1] == v3[1]) return 0;
+               if (v2[0] == v3[0] && v2[1] == v3[1]) return 0;
        }
        return 1;
 }
@@ -324,73 +301,75 @@ static short addedgetoscanvert(ScanFillVertLink *sc, ScanFillEdge *eed)
 {
        /* find first edge to the right of eed, and insert eed before that */
        ScanFillEdge *ed;
-       float fac,fac1,x,y;
+       float fac, fac1, x, y;
 
-       if (sc->first==0) {
-               sc->first= sc->last= eed;
-               eed->prev= eed->next=0;
+       if (sc->first == NULL) {
+               sc->first = sc->last = eed;
+               eed->prev = eed->next = NULL;
                return 1;
        }
 
-       x= eed->v1->co[cox];
-       y= eed->v1->co[coy];
+       x = eed->v1->xy[0];
+       y = eed->v1->xy[1];
 
-       fac1= eed->v2->co[coy]-y;
-       if (fac1==0.0f) {
-               fac1= 1.0e10f*(eed->v2->co[cox]-x);
+       fac1 = eed->v2->xy[1] - y;
+       if (fac1 == 0.0f) {
+               fac1 = 1.0e10f * (eed->v2->xy[0] - x);
 
        }
-       else fac1= (x-eed->v2->co[cox])/fac1;
+       else fac1 = (x - eed->v2->xy[0]) / fac1;
 
-       ed= sc->first;
+       ed = sc->first;
        while (ed) {
 
-               if (ed->v2==eed->v2) return 0;
-
-               fac= ed->v2->co[coy]-y;
-               if (fac==0.0f) {
-                       fac= 1.0e10f*(ed->v2->co[cox]-x);
+               if (ed->v2 == eed->v2) return 0;
 
+               fac = ed->v2->xy[1] - y;
+               if (fac == 0.0f) {
+                       fac = 1.0e10f * (ed->v2->xy[0] - x);
+               }
+               else {
+                       fac = (x - ed->v2->xy[0]) / fac;
                }
-               else fac= (x-ed->v2->co[cox])/fac;
-               if (fac>fac1) break;
 
-               ed= ed->next;
+               if (fac > fac1) break;
+
+               ed = ed->next;
        }
        if (ed) BLI_insertlinkbefore((ListBase *)&(sc->first), ed, eed);
-       else BLI_addtail((ListBase *)&(sc->first),eed);
+       else BLI_addtail((ListBase *)&(sc->first), eed);
 
        return 1;
 }
 
 
-static ScanFillVertLink *addedgetoscanlist(ScanFillEdge *eed, int len)
+static ScanFillVertLink *addedgetoscanlist(ScanFillContext *sf_ctx, ScanFillEdge *eed, int len)
 {
        /* inserts edge at correct location in ScanFillVertLink list */
        /* returns sc when edge already exists */
-       ScanFillVertLink *sc,scsearch;
+       ScanFillVertLink *sc, scsearch;
        ScanFillVert *eve;
 
        /* which vert is left-top? */
-       if (eed->v1->co[coy] == eed->v2->co[coy]) {
-               if (eed->v1->co[cox] > eed->v2->co[cox]) {
-                       eve= eed->v1;
-                       eed->v1= eed->v2;
-                       eed->v2= eve;
+       if (eed->v1->xy[1] == eed->v2->xy[1]) {
+               if (eed->v1->xy[0] > eed->v2->xy[0]) {
+                       eve = eed->v1;
+                       eed->v1 = eed->v2;
+                       eed->v2 = eve;
                }
        }
-       else if (eed->v1->co[coy] < eed->v2->co[coy]) {
-               eve= eed->v1;
-               eed->v1= eed->v2;
-               eed->v2= eve;
+       else if (eed->v1->xy[1] < eed->v2->xy[1]) {
+               eve = eed->v1;
+               eed->v1 = eed->v2;
+               eed->v2 = eve;
        }
        /* find location in list */
-       scsearch.v1= eed->v1;
-       sc= (ScanFillVertLink *)bsearch(&scsearch,scdata,len,
-               sizeof(ScanFillVertLink), vergscdata);
+       scsearch.v1 = eed->v1;
+       sc = (ScanFillVertLink *)bsearch(&scsearch, sf_ctx->_scdata, len,
+                                        sizeof(ScanFillVertLink), vergscdata);
 
-       if (sc==0) printf("Error in search edge: %p\n", (void *)eed);
-       else if (addedgetoscanvert(sc,eed)==0) return sc;
+       if (sc == 0) printf("Error in search edge: %p\n", (void *)eed);
+       else if (addedgetoscanvert(sc, eed) == 0) return sc;
 
        return 0;
 }
@@ -398,230 +377,230 @@ static ScanFillVertLink *addedgetoscanlist(ScanFillEdge *eed, int len)
 static short boundinsideEV(ScanFillEdge *eed, ScanFillVert *eve)
 /* is eve inside boundbox eed */
 {
-       float minx,maxx,miny,maxy;
+       float minx, maxx, miny, maxy;
 
-       if (eed->v1->co[cox]<eed->v2->co[cox]) {
-               minx= eed->v1->co[cox];
-               maxx= eed->v2->co[cox];
+       if (eed->v1->xy[0] < eed->v2->xy[0]) {
+               minx = eed->v1->xy[0];
+               maxx = eed->v2->xy[0];
        }
        else {
-               minx= eed->v2->co[cox];
-               maxx= eed->v1->co[cox];
+               minx = eed->v2->xy[0];
+               maxx = eed->v1->xy[0];
        }
-       if (eve->co[cox]>=minx && eve->co[cox]<=maxx) {
-               if (eed->v1->co[coy]<eed->v2->co[coy]) {
-                       miny= eed->v1->co[coy];
-                       maxy= eed->v2->co[coy];
+       if (eve->xy[0] >= minx && eve->xy[0] <= maxx) {
+               if (eed->v1->xy[1] < eed->v2->xy[1]) {
+                       miny = eed->v1->xy[1];
+                       maxy = eed->v2->xy[1];
                }
                else {
-                       miny= eed->v2->co[coy];
-                       maxy= eed->v1->co[coy];
+                       miny = eed->v2->xy[1];
+                       maxy = eed->v1->xy[1];
                }
-               if (eve->co[coy]>=miny && eve->co[coy]<=maxy) return 1;
+               if (eve->xy[1] >= miny && eve->xy[1] <= maxy) return 1;
        }
        return 0;
 }
 
 
-static void testvertexnearedge(void)
+static void testvertexnearedge(ScanFillContext *sf_ctx)
 {
        /* only vertices with ->h==1 are being tested for
         * being close to an edge, if true insert */
 
        ScanFillVert *eve;
-       ScanFillEdge *eed,*ed1;
-       float dist,vec1[2],vec2[2],vec3[2];
+       ScanFillEdge *eed, *ed1;
+       float dist, vec1[2], vec2[2], vec3[2];
 
-       evefillvertbase.first;
+       eve = sf_ctx->fillvertbase.first;
        while (eve) {
-               if (eve->h==1) {
-                       vec3[0]= eve->co[cox];
-                       vec3[1]= eve->co[coy];
+               if (eve->h == 1) {
+                       vec3[0] = eve->xy[0];
+                       vec3[1] = eve->xy[1];
                        /* find the edge which has vertex eve */
-                       ed1filledgebase.first;
+                       ed1 = sf_ctx->filledgebase.first;
                        while (ed1) {
-                               if (ed1->v1==eve || ed1->v2==eve) break;
-                               ed1= ed1->next;
+                               if (ed1->v1 == eve || ed1->v2 == eve) break;
+                               ed1 = ed1->next;
                        }
-                       if (ed1->v1==eve) {
-                               ed1->v1= ed1->v2;
-                               ed1->v2= eve;
+                       if (ed1->v1 == eve) {
+                               ed1->v1 = ed1->v2;
+                               ed1->v2 = eve;
                        }
-                       eedfilledgebase.first;
+                       eed = sf_ctx->filledgebase.first;
                        while (eed) {
                                if (eve != eed->v1 && eve != eed->v2 && eve->poly_nr == eed->poly_nr) {
-                                       if (compare_v3v3(eve->co,eed->v1->co, COMPLIMIT)) {
-                                               ed1->v2= eed->v1;
+                                       if (compare_v3v3(eve->co, eed->v1->co, COMPLIMIT)) {
+                                               ed1->v2 = eed->v1;
                                                eed->v1->h++;
-                                               eve->h= 0;
+                                               eve->h = 0;
                                                break;
                                        }
-                                       else if (compare_v3v3(eve->co,eed->v2->co, COMPLIMIT)) {
-                                               ed1->v2= eed->v2;
+                                       else if (compare_v3v3(eve->co, eed->v2->co, COMPLIMIT)) {
+                                               ed1->v2 = eed->v2;
                                                eed->v2->h++;
-                                               eve->h= 0;
+                                               eve->h = 0;
                                                break;
                                        }
                                        else {
-                                               vec1[0]= eed->v1->co[cox];
-                                               vec1[1]= eed->v1->co[coy];
-                                               vec2[0]= eed->v2->co[cox];
-                                               vec2[1]= eed->v2->co[coy];
-                                               if (boundinsideEV(eed,eve)) {
-                                                       dist= dist_to_line_v2(vec1,vec2,vec3);
-                                                       if (dist<(float)COMPLIMIT) {
+                                               vec1[0] = eed->v1->xy[0];
+                                               vec1[1] = eed->v1->xy[1];
+                                               vec2[0] = eed->v2->xy[0];
+                                               vec2[1] = eed->v2->xy[1];
+                                               if (boundinsideEV(eed, eve)) {
+                                                       dist = dist_to_line_v2(vec1, vec2, vec3);
+                                                       if (dist < COMPLIMIT) {
                                                                /* new edge */
-                                                               ed1= BLI_addfilledge(eed->v1, eve);
+                                                               ed1 = BLI_addfilledge(sf_ctx, eed->v1, eve);
                                                                
                                                                /* printf("fill: vertex near edge %x\n",eve); */
-                                                               ed1->f= 0;
+                                                               ed1->f = 0;
                                                                ed1->poly_nr = eed->poly_nr;
-                                                               eed->v1= eve;
-                                                               eve->h= 3;
+                                                               eed->v1 = eve;
+                                                               eve->h = 3;
                                                                break;
                                                        }
                                                }
                                        }
                                }
-                               eed= eed->next;
+                               eed = eed->next;
                        }
                }
-               eve= eve->next;
+               eve = eve->next;
        }
 }
 
-static void splitlist(ListBase *tempve, ListBase *temped, short nr)
+static void splitlist(ScanFillContext *sf_ctx, ListBase *tempve, ListBase *temped, short nr)
 {
        /* everything is in templist, write only poly nr to fillist */
-       ScanFillVert *eve,*nextve;
-       ScanFillEdge *eed,*nexted;
+       ScanFillVert *eve, *nextve;
+       ScanFillEdge *eed, *nexted;
 
-       BLI_movelisttolist(tempve,&fillvertbase);
-       BLI_movelisttolist(temped,&filledgebase);
+       BLI_movelisttolist(tempve, &sf_ctx->fillvertbase);
+       BLI_movelisttolist(temped, &sf_ctx->filledgebase);
 
-       eve= tempve->first;
+       eve = tempve->first;
        while (eve) {
-               nextve= eve->next;
+               nextve = eve->next;
                if (eve->poly_nr == nr) {
-                       BLI_remlink(tempve,eve);
-                       BLI_addtail(&fillvertbase,eve);
+                       BLI_remlink(tempve, eve);
+                       BLI_addtail(&sf_ctx->fillvertbase, eve);
                }
-               eve= nextve;
+               eve = nextve;
        }
-       eed= temped->first;
+       eed = temped->first;
        while (eed) {
-               nexted= eed->next;
-               if (eed->poly_nr==nr) {
-                       BLI_remlink(temped,eed);
-                       BLI_addtail(&filledgebase,eed);
+               nexted = eed->next;
+               if (eed->poly_nr == nr) {
+                       BLI_remlink(temped, eed);
+                       BLI_addtail(&sf_ctx->filledgebase, eed);
                }
-               eed= nexted;
+               eed = nexted;
        }
 }
 
 
-static int scanfill(PolyFill *pf)
+static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf)
 {
        ScanFillVertLink *sc = NULL, *sc1;
-       ScanFillVert *eve,*v1,*v2,*v3;
-       ScanFillEdge *eed,*nexted,*ed1,*ed2,*ed3;
+       ScanFillVert *eve, *v1, *v2, *v3;
+       ScanFillEdge *eed, *nexted, *ed1, *ed2, *ed3;
        float miny = 0.0;
-       int a,b,verts, maxface, totface;
-       short nr, test, twoconnected=0;
+       int a, b, verts, maxface, totface;
+       short nr, test, twoconnected = 0;
 
-       nr= pf->nr;
+       nr = pf->nr;
 
        /* PRINTS */
 #if 0
-       verts= pf->verts;
-       evefillvertbase.first;
+       verts = pf->verts;
+       eve = sf_ctx->fillvertbase.first;
        while (eve) {
-               printf("vert: %x co: %f %f\n",eve,eve->co[cox],eve->co[coy]);
-               eve= eve->next;
+               printf("vert: %x co: %f %f\n", eve, eve->xy[0], eve->xy[1]);
+               eve = eve->next;
        }       
-       eedfilledgebase.first;
+       eed = sf_ctx->filledgebase.first;
        while (eed) {
-               printf("edge: %x  verts: %x %x\n",eed,eed->v1,eed->v2);
-               eed= eed->next;
+               printf("edge: %x  verts: %x %x\n", eed, eed->v1, eed->v2);
+               eed = eed->next;
        }
 #endif
 
        /* STEP 0: remove zero sized edges */
-       eedfilledgebase.first;
+       eed = sf_ctx->filledgebase.first;
        while (eed) {
-               if (eed->v1->co[cox]==eed->v2->co[cox]) {
-                       if (eed->v1->co[coy]==eed->v2->co[coy]) {
-                               if (eed->v1->f==255 && eed->v2->f!=255) {
-                                       eed->v2->f= 255;
-                                       eed->v2->tmp.v= eed->v1->tmp.v;
+               if (eed->v1->xy[0] == eed->v2->xy[0]) {
+                       if (eed->v1->xy[1] == eed->v2->xy[1]) {
+                               if (eed->v1->f == 255 && eed->v2->f != 255) {
+                                       eed->v2->f = 255;
+                                       eed->v2->tmp.v = eed->v1->tmp.v;
                                }
-                               else if (eed->v2->f==255 && eed->v1->f!=255) {
-                                       eed->v1->f= 255;
-                                       eed->v1->tmp.v= eed->v2->tmp.v;
+                               else if (eed->v2->f == 255 && eed->v1->f != 255) {
+                                       eed->v1->f = 255;
+                                       eed->v1->tmp.v = eed->v2->tmp.v;
                                }
-                               else if (eed->v2->f==255 && eed->v1->f==255) {
-                                       eed->v1->tmp.v= eed->v2->tmp.v;
+                               else if (eed->v2->f == 255 && eed->v1->f == 255) {
+                                       eed->v1->tmp.v = eed->v2->tmp.v;
                                }
                                else {
-                                       eed->v2->f= 255;
+                                       eed->v2->f = 255;
                                        eed->v2->tmp.v = eed->v1;
                                }
                        }
                }
-               eed= eed->next;
+               eed = eed->next;
        }
 
        /* STEP 1: make using FillVert and FillEdge lists a sorted
         * ScanFillVertLink list
         */
-       sc= scdata= (ScanFillVertLink *)MEM_callocN(pf->verts*sizeof(ScanFillVertLink),"Scanfill1");
-       evefillvertbase.first;
-       verts= 0;
+       sc = sf_ctx->_scdata = (ScanFillVertLink *)MEM_callocN(pf->verts * sizeof(ScanFillVertLink), "Scanfill1");
+       eve = sf_ctx->fillvertbase.first;
+       verts = 0;
        while (eve) {
                if (eve->poly_nr == nr) {
                        if (eve->f != 255) {
                                verts++;
-                               eve->f= 0;      /* flag for connectedges later on */
-                               sc->v1= eve;
+                               eve->f = 0;  /* flag for connectedges later on */
+                               sc->v1 = eve;
                                sc++;
                        }
                }
-               eve= eve->next;
+               eve = eve->next;
        }
 
-       qsort(scdata, verts, sizeof(ScanFillVertLink), vergscdata);
+       qsort(sf_ctx->_scdata, verts, sizeof(ScanFillVertLink), vergscdata);
 
-       eedfilledgebase.first;
+       eed = sf_ctx->filledgebase.first;
        while (eed) {
-               nexted= eed->next;
-               BLI_remlink(&filledgebase,eed);
+               nexted = eed->next;
+               BLI_remlink(&sf_ctx->filledgebase, eed);
                /* This code is for handling zero-length edges that get
                 * collapsed in step 0. It was removed for some time to
                 * fix trunk bug #4544, so if that comes back, this code
                 * may need some work, or there will have to be a better
                 * fix to #4544. */
-               if (eed->v1->f==255) {
-                       v1= eed->v1;
+               if (eed->v1->f == 255) {
+                       v1 = eed->v1;
                        while ((eed->v1->f == 255) && (eed->v1->tmp.v != v1)) 
                                eed->v1 = eed->v1->tmp.v;
                }
-               if (eed->v2->f==255) {
-                       v2= eed->v2;
+               if (eed->v2->f == 255) {
+                       v2 = eed->v2;
                        while ((eed->v2->f == 255) && (eed->v2->tmp.v != v2))
                                eed->v2 = eed->v2->tmp.v;
                }
-               if (eed->v1!=eed->v2) addedgetoscanlist(eed,verts);
+               if (eed->v1 != eed->v2) addedgetoscanlist(sf_ctx, eed, verts);
 
-               eed= nexted;
+               eed = nexted;
        }
 #if 0
-       sc= scdata;
-       for (a=0;a<verts;a++) {
-               printf("\nscvert: %x\n",sc->v1);
-               eed= sc->first;
+       sc = scdata;
+       for (a = 0; a < verts; a++) {
+               printf("\nscvert: %x\n", sc->v1);
+               eed = sc->first;
                while (eed) {
-                       printf(" ed %x %x %x\n",eed,eed->v1,eed->v2);
-                       eed= eed->next;
+                       printf(" ed %x %x %x\n", eed, eed->v1, eed->v2);
+                       eed = eed->next;
                }
                sc++;
        }
@@ -630,70 +609,70 @@ static int scanfill(PolyFill *pf)
 
        /* STEP 2: FILL LOOP */
 
-       if (pf->f==0) twoconnected= 1;
+       if (pf->f == 0) twoconnected = 1;
 
        /* (temporal) security: never much more faces than vertices */
-       totface= 0;
-       maxface= 2*verts;               /* 2*verts: based at a filled circle within a triangle */
+       totface = 0;
+       maxface = 2 * verts;       /* 2*verts: based at a filled circle within a triangle */
 
-       scscdata;
-       for (a=0;a<verts;a++) {
+       sc = sf_ctx->_scdata;
+       for (a = 0; a < verts; a++) {
                /* printf("VERTEX %d %x\n",a,sc->v1); */
-               ed1= sc->first;
-               while (ed1) {   /* set connectflags  */
-                       nexted= ed1->next;
-                       if (ed1->v1->h==1 || ed1->v2->h==1) {
-                               BLI_remlink((ListBase *)&(sc->first),ed1);
-                               BLI_addtail(&filledgebase,ed1);
-                               if (ed1->v1->h>1) ed1->v1->h--;
-                               if (ed1->v2->h>1) ed1->v2->h--;
+               ed1 = sc->first;
+               while (ed1) {   /* set connectflags  */
+                       nexted = ed1->next;
+                       if (ed1->v1->h == 1 || ed1->v2->h == 1) {
+                               BLI_remlink((ListBase *)&(sc->first), ed1);
+                               BLI_addtail(&sf_ctx->filledgebase, ed1);
+                               if (ed1->v1->h > 1) ed1->v1->h--;
+                               if (ed1->v2->h > 1) ed1->v2->h--;
                        }
-                       else ed1->v2->f= 1;
+                       else ed1->v2->f = 1;
 
-                       ed1= nexted;
+                       ed1 = nexted;
                }
-               while (sc->first) {     /* for as long there are edges */
-                       ed1= sc->first;
-                       ed2= ed1->next;
+               while (sc->first) { /* for as long there are edges */
+                       ed1 = sc->first;
+                       ed2 = ed1->next;
                        
                        /* commented out... the ESC here delivers corrupted memory (and doesnt work during grab) */
                        /* if (callLocalInterruptCallBack()) break; */
-                       if (totface>maxface) {
+                       if (totface > maxface) {
                                /* printf("Fill error: endless loop. Escaped at vert %d,  tot: %d.\n", a, verts); */
-                               a= verts;
+                               a = verts;
                                break;
                        }
-                       if (ed2==0) {
-                               sc->first=sc->last= 0;
+                       if (ed2 == 0) {
+                               sc->first = sc->last = NULL;
                                /* printf("just 1 edge to vert\n"); */
-                               BLI_addtail(&filledgebase,ed1);
-                               ed1->v2->f= 0;
+                               BLI_addtail(&sf_ctx->filledgebase, ed1);
+                               ed1->v2->f = 0;
                                ed1->v1->h--; 
                                ed1->v2->h--;
                        }
                        else {
                                /* test rest of vertices */
-                               v1= ed1->v2;
-                               v2= ed1->v1;
-                               v3= ed2->v2;
+                               v1 = ed1->v2;
+                               v2 = ed1->v1;
+                               v3 = ed2->v2;
                                /* this happens with a serial of overlapping edges */
-                               if (v1==v2 || v2==v3) break;
+                               if (v1 == v2 || v2 == v3) break;
                                /* printf("test verts %x %x %x\n",v1,v2,v3); */
-                               miny = ( (v1->co[coy])<(v3->co[coy]) ? (v1->co[coy]) : (v3->co[coy]) );
-                               /*  miny= MIN2(v1->co[coy],v3->co[coy]); */
-                               sc1= sc+1;
-                               test= 0;
-
-                               for (b=a+1;b<verts;b++) {
-                                       if (sc1->v1->f==0) {
-                                               if (sc1->v1->co[coy] <= miny) break;
-
-                                               if (testedgeside(v1->co,v2->co,sc1->v1->co))
-                                                       if (testedgeside(v2->co,v3->co,sc1->v1->co))
-                                                               if (testedgeside(v3->co,v1->co,sc1->v1->co)) {
+                               miny = ( (v1->xy[1]) < (v3->xy[1]) ? (v1->xy[1]) : (v3->xy[1]) );
+                               /*  miny= MIN2(v1->xy[1],v3->xy[1]); */
+                               sc1 = sc + 1;
+                               test = 0;
+
+                               for (b = a + 1; b < verts; b++) {
+                                       if (sc1->v1->f == 0) {
+                                               if (sc1->v1->xy[1] <= miny) break;
+
+                                               if (testedgeside(v1->xy, v2->xy, sc1->v1->xy))
+                                                       if (testedgeside(v2->xy, v3->xy, sc1->v1->xy))
+                                                               if (testedgeside(v3->xy, v1->xy, sc1->v1->xy)) {
                                                                        /* point in triangle */
                                                                
-                                                                       test= 1;
+                                                                       test = 1;
                                                                        break;
                                                                }
                                        }
@@ -703,96 +682,97 @@ static int scanfill(PolyFill *pf)
                                        /* make new edge, and start over */
                                        /* printf("add new edge %x %x and start again\n",v2,sc1->v1); */
 
-                                       ed3= BLI_addfilledge(v2, sc1->v1);
-                                       BLI_remlink(&filledgebase, ed3);
+                                       ed3 = BLI_addfilledge(sf_ctx, v2, sc1->v1);
+                                       BLI_remlink(&sf_ctx->filledgebase, ed3);
                                        BLI_insertlinkbefore((ListBase *)&(sc->first), ed2, ed3);
-                                       ed3->v2->f= 1;
-                                       ed3->f= 2;
+                                       ed3->v2->f = 1;
+                                       ed3->f = 2;
                                        ed3->v1->h++; 
                                        ed3->v2->h++;
                                }
                                else {
                                        /* new triangle */
                                        /* printf("add face %x %x %x\n",v1,v2,v3); */
-                                       addfillface(v1, v2, v3);
+                                       addfillface(sf_ctx, v1, v2, v3);
                                        totface++;
-                                       BLI_remlink((ListBase *)&(sc->first),ed1);
-                                       BLI_addtail(&filledgebase,ed1);
-                                       ed1->v2->f= 0;
+                                       BLI_remlink((ListBase *)&(sc->first), ed1);
+                                       BLI_addtail(&sf_ctx->filledgebase, ed1);
+                                       ed1->v2->f = 0;
                                        ed1->v1->h--; 
                                        ed1->v2->h--;
                                        /* ed2 can be removed when it's a boundary edge */
                                        if ((ed2->f == 0 && twoconnected) || (ed2->f == FILLBOUNDARY)) {
-                                               BLI_remlink((ListBase *)&(sc->first),ed2);
-                                               BLI_addtail(&filledgebase,ed2);
-                                               ed2->v2->f= 0;
+                                               BLI_remlink((ListBase *)&(sc->first), ed2);
+                                               BLI_addtail(&sf_ctx->filledgebase, ed2);
+                                               ed2->v2->f = 0;
                                                ed2->v1->h--; 
                                                ed2->v2->h--;
                                        }
 
                                        /* new edge */
-                                       ed3= BLI_addfilledge(v1, v3);
-                                       BLI_remlink(&filledgebase, ed3);
-                                       ed3->f= 2;
+                                       ed3 = BLI_addfilledge(sf_ctx, v1, v3);
+                                       BLI_remlink(&sf_ctx->filledgebase, ed3);
+                                       ed3->f = 2;
                                        ed3->v1->h++; 
                                        ed3->v2->h++;
                                        
                                        /* printf("add new edge %x %x\n",v1,v3); */
-                                       sc1= addedgetoscanlist(ed3, verts);
+                                       sc1 = addedgetoscanlist(sf_ctx, ed3, verts);
                                        
-                                       if (sc1) {      /* ed3 already exists: remove if a boundary */
+                                       if (sc1) {  /* ed3 already exists: remove if a boundary */
                                                /* printf("Edge exists\n"); */
                                                ed3->v1->h--; 
                                                ed3->v2->h--;
 
-                                               ed3= sc1->first;
+                                               ed3 = sc1->first;
                                                while (ed3) {
-                                                       if ( (ed3->v1==v1 && ed3->v2==v3) || (ed3->v1==v3 && ed3->v2==v1) ) {
-                                                               if (twoconnected || ed3->f==FILLBOUNDARY) {
-                                                                       BLI_remlink((ListBase *)&(sc1->first),ed3);
-                                                                       BLI_addtail(&filledgebase,ed3);
+                                                       if ( (ed3->v1 == v1 && ed3->v2 == v3) || (ed3->v1 == v3 && ed3->v2 == v1) ) {
+                                                               if (twoconnected || ed3->f == FILLBOUNDARY) {
+                                                                       BLI_remlink((ListBase *)&(sc1->first), ed3);
+                                                                       BLI_addtail(&sf_ctx->filledgebase, ed3);
                                                                        ed3->v1->h--; 
                                                                        ed3->v2->h--;
                                                                }
                                                                break;
                                                        }
-                                                       ed3= ed3->next;
+                                                       ed3 = ed3->next;
                                                }
                                        }
 
                                }
                        }
                        /* test for loose edges */
-                       ed1= sc->first;
+                       ed1 = sc->first;
                        while (ed1) {
-                               nexted= ed1->next;
-                               if (ed1->v1->h<2 || ed1->v2->h<2) {
-                                       BLI_remlink((ListBase *)&(sc->first),ed1);
-                                       BLI_addtail(&filledgebase,ed1);
-                                       if (ed1->v1->h>1) ed1->v1->h--;
-                                       if (ed1->v2->h>1) ed1->v2->h--;
+                               nexted = ed1->next;
+                               if (ed1->v1->h < 2 || ed1->v2->h < 2) {
+                                       BLI_remlink((ListBase *)&(sc->first), ed1);
+                                       BLI_addtail(&sf_ctx->filledgebase, ed1);
+                                       if (ed1->v1->h > 1) ed1->v1->h--;
+                                       if (ed1->v2->h > 1) ed1->v2->h--;
                                }
 
-                               ed1= nexted;
+                               ed1 = nexted;
                        }
                }
                sc++;
        }
 
-       MEM_freeN(scdata);
+       MEM_freeN(sf_ctx->_scdata);
+       sf_ctx->_scdata = NULL;
 
        return totface;
 }
 
 
-int BLI_begin_edgefill(void)
+int BLI_begin_edgefill(ScanFillContext *sf_ctx)
 {
-       BLI_lock_thread(LOCK_SCANFILL);
+       memset(sf_ctx, 0, sizeof(*sf_ctx));
 
        return 1;
 }
 
-int BLI_edgefill(short mat_nr)
+int BLI_edgefill(ScanFillContext *sf_ctx, const short do_quad_tri_speedup)
 {
        /*
         * - fill works with its own lists, so create that first (no faces!)
@@ -804,87 +784,82 @@ int BLI_edgefill(short mat_nr)
         */
        ListBase tempve, temped;
        ScanFillVert *eve;
-       ScanFillEdge *eed,*nexted;
-       PolyFill *pflist,*pf;
-       float limit, *minp, *maxp, *v1, *v2, norm[3], len;
-       short a,c,poly=0,ok=0,toggle=0;
-       int totfaces= 0; /* total faces added */
+       ScanFillEdge *eed, *nexted;
+       PolyFill *pflist, *pf;
+       float limit, *min_xy_p, *max_xy_p, *v1, *v2, norm[3], len;
+       short a, c, poly = 0, ok = 0, toggle = 0;
+       int totfaces = 0; /* total faces added */
+       int co_x, co_y;
 
        /* reset variables */
-       evefillvertbase.first;
+       eve = sf_ctx->fillvertbase.first;
        a = 0;
        while (eve) {
-               eve->f= 0;
-               eve->poly_nr= 0;
-               eve->h= 0;
-               eve= eve->next;
+               eve->f = 0;
+               eve->poly_nr = 0;
+               eve->h = 0;
+               eve = eve->next;
                a += 1;
        }
 
-       if (a == 3 && (mat_nr & 2)) {
-               eve = fillvertbase.first;
+       if (do_quad_tri_speedup && (a == 3)) {
+               eve = sf_ctx->fillvertbase.first;
 
-               addfillface(eve, eve->next, eve->next->next);
+               addfillface(sf_ctx, eve, eve->next, eve->next->next);
                return 1;
        }
-       else if (a == 4 && (mat_nr & 2)) {
+       else if (do_quad_tri_speedup && (a == 4)) {
                float vec1[3], vec2[3];
 
-               eve = fillvertbase.first;
+               eve = sf_ctx->fillvertbase.first;
                /* no need to check 'eve->next->next->next' is valid, already counted */
-               if (1) { //BMESH_TODO) {
-                       /*use shortest diagonal for quad*/
-                       sub_v3_v3v3(vec1, eve->co, eve->next->next->co);
-                       sub_v3_v3v3(vec2, eve->next->co, eve->next->next->next->co);
-                       
-                       if (dot_v3v3(vec1, vec1) < dot_v3v3(vec2, vec2)) {
-                               addfillface(eve, eve->next, eve->next->next);
-                               addfillface(eve->next->next, eve->next->next->next, eve);
-                       }
-                       else {
-                               addfillface(eve->next, eve->next->next, eve->next->next->next);
-                               addfillface(eve->next->next->next, eve, eve->next);
-                       }
+               /*use shortest diagonal for quad*/
+               sub_v3_v3v3(vec1, eve->co, eve->next->next->co);
+               sub_v3_v3v3(vec2, eve->next->co, eve->next->next->next->co);
+
+               if (dot_v3v3(vec1, vec1) < dot_v3v3(vec2, vec2)) {
+                       addfillface(sf_ctx, eve, eve->next, eve->next->next);
+                       addfillface(sf_ctx, eve->next->next, eve->next->next->next, eve);
                }
                else {
-                               addfillface(eve, eve->next, eve->next->next);
-                               addfillface(eve->next->next, eve->next->next->next, eve);
+                       addfillface(sf_ctx, eve->next, eve->next->next, eve->next->next->next);
+                       addfillface(sf_ctx, eve->next->next->next, eve, eve->next);
                }
                return 2;
        }
 
        /* first test vertices if they are in edges */
        /* including resetting of flags */
-       eedfilledgebase.first;
+       eed = sf_ctx->filledgebase.first;
        while (eed) {
-               eed->poly_nr= 0;
-               eed->v1->f= 1;
-               eed->v2->f= 1;
+               eed->poly_nr = 0;
+               eed->v1->f = 1;
+               eed->v2->f = 1;
 
-               eed= eed->next;
+               eed = eed->next;
        }
 
-       evefillvertbase.first;
+       eve = sf_ctx->fillvertbase.first;
        while (eve) {
                if (eve->f & 1) {
-                       ok=1; 
+                       ok = 1;
                        break;
                }
-               eve= eve->next;
+               eve = eve->next;
        }
 
-       if (ok==0) return 0;
+       if (ok == 0) return 0;
 
        /* NEW NEW! define projection: with 'best' normal */
        /* just use the first three different vertices */
        
        /* THIS PART STILL IS PRETTY WEAK! (ton) */
 
-       evefillvertbase.last;
-       len= 0.0;
-       v1= eve->co;
-       v2= 0;
-       evefillvertbase.first;
+       eve = sf_ctx->fillvertbase.last;
+       len = 0.0;
+       v1 = eve->co;
+       v2 = 0;
+       eve = sf_ctx->fillvertbase.first;
        limit = 1e-8f;
 
        while (eve) {
@@ -895,69 +870,72 @@ int BLI_edgefill(short mat_nr)
 
                                if (inner > limit) {
                                        limit = inner;
-                                       len= normal_tri_v3(norm, v1, v2, eve->co);
+                                       len = normal_tri_v3(norm, v1, v2, eve->co);
                                }
                        }
                }
                else if (!compare_v3v3(v1, eve->co, COMPLIMIT))
-                       v2= eve->co;
+                       v2 = eve->co;
 
-               eve= eve->next;
+               eve = eve->next;
        }
 
-       if (len==0.0f) return 0;        /* no fill possible */
+       if (len == 0.0f) return 0;  /* no fill possible */
 
-       axis_dominant_v3(&cox, &coy, norm);
+       axis_dominant_v3(&co_x, &co_y, norm);
 
        /* STEP 1: COUNT POLYS */
-       evefillvertbase.first;
+       eve = sf_ctx->fillvertbase.first;
        while (eve) {
+               eve->xy[0] = eve->co[co_x];
+               eve->xy[1] = eve->co[co_y];
+
                /* get first vertex with no poly number */
-               if (eve->poly_nr==0) {
+               if (eve->poly_nr == 0) {
                        poly++;
                        /* now a sortof select connected */
-                       ok= 1;
+                       ok = 1;
                        eve->poly_nr = poly;
                        
                        while (ok) {
                                
-                               ok= 0;
+                               ok = 0;
                                toggle++;
-                               if (toggle & 1) eedfilledgebase.first;
-                               else eedfilledgebase.last;
+                               if (toggle & 1) eed = sf_ctx->filledgebase.first;
+                               else eed = sf_ctx->filledgebase.last;
 
                                while (eed) {
                                        if (eed->v1->poly_nr == 0 && eed->v2->poly_nr == poly) {
                                                eed->v1->poly_nr = poly;
-                                               eed->poly_nr= poly;
-                                               ok= 1;
+                                               eed->poly_nr = poly;
+                                               ok = 1;
                                        }
                                        else if (eed->v2->poly_nr == 0 && eed->v1->poly_nr == poly) {
                                                eed->v2->poly_nr = poly;
-                                               eed->poly_nr= poly;
-                                               ok= 1;
+                                               eed->poly_nr = poly;
+                                               ok = 1;
                                        }
                                        else if (eed->poly_nr == 0) {
                                                if (eed->v1->poly_nr == poly && eed->v2->poly_nr == poly) {
-                                                       eed->poly_nr= poly;
-                                                       ok= 1;
+                                                       eed->poly_nr = poly;
+                                                       ok = 1;
                                                }
                                        }
-                                       if (toggle & 1) eed= eed->next;
-                                       else eed= eed->prev;
+                                       if (toggle & 1) eed = eed->next;
+                                       else eed = eed->prev;
                                }
                        }
                }
-               eve= eve->next;
+               eve = eve->next;
        }
        /* printf("amount of poly's: %d\n",poly); */
 
        /* STEP 2: remove loose edges and strings of edges */
-       eedfilledgebase.first;
+       eed = sf_ctx->filledgebase.first;
        while (eed) {
-               if (eed->v1->h++ >250) break;
-               if (eed->v2->h++ >250) break;
-               eed= eed->next;
+               if (eed->v1->h++ > 250) break;
+               if (eed->v2->h++ > 250) break;
+               eed = eed->next;
        }
        if (eed) {
                /* otherwise it's impossible to be sure you can clear vertices */
@@ -966,33 +944,33 @@ int BLI_edgefill(short mat_nr)
        }
        
        /* does it only for vertices with ->h==1 */
-       testvertexnearedge();
+       testvertexnearedge(sf_ctx);
 
-       ok= 1;
+       ok = 1;
        while (ok) {
-               ok= 0;
+               ok = 0;
                toggle++;
-               if (toggle & 1) eedfilledgebase.first;
-               else eedfilledgebase.last;
+               if (toggle & 1) eed = sf_ctx->filledgebase.first;
+               else eed = sf_ctx->filledgebase.last;
                while (eed) {
-                       if (toggle & 1) nexted= eed->next;
-                       else nexted= eed->prev;
-                       if (eed->v1->h==1) {
+                       if (toggle & 1) nexted = eed->next;
+                       else nexted = eed->prev;
+                       if (eed->v1->h == 1) {
                                eed->v2->h--;
-                               BLI_remlink(&fillvertbase,eed->v1); 
-                               BLI_remlink(&filledgebase,eed); 
-                               ok= 1;
+                               BLI_remlink(&sf_ctx->fillvertbase, eed->v1);
+                               BLI_remlink(&sf_ctx->filledgebase, eed);
+                               ok = 1;
                        }
-                       else if (eed->v2->h==1) {
+                       else if (eed->v2->h == 1) {
                                eed->v1->h--;
-                               BLI_remlink(&fillvertbase,eed->v2); 
-                               BLI_remlink(&filledgebase,eed); 
-                               ok= 1;
+                               BLI_remlink(&sf_ctx->fillvertbase, eed->v2);
+                               BLI_remlink(&sf_ctx->filledgebase, eed);
+                               ok = 1;
                        }
-                       eed= nexted;
+                       eed = nexted;
                }
        }
-       if (filledgebase.first==0) {
+       if (sf_ctx->filledgebase.first == 0) {
                /* printf("All edges removed\n"); */
                return 0;
        }
@@ -1010,33 +988,33 @@ int BLI_edgefill(short mat_nr)
 
 
        /* STEP 3: MAKE POLYFILL STRUCT */
-       pflist= (PolyFill *)MEM_callocN(poly*sizeof(PolyFill),"edgefill");
-       pf= pflist;
-       for (a=1;a<=poly;a++) {
-               pf->nr= a;
-               pf->min[0]=pf->min[1]=pf->min[2]= 1.0e20;
-               pf->max[0]=pf->max[1]=pf->max[2]= -1.0e20;
+       pflist = (PolyFill *)MEM_callocN(poly * sizeof(PolyFill), "edgefill");
+       pf = pflist;
+       for (a = 1; a <= poly; a++) {
+               pf->nr = a;
+               pf->min_xy[0] = pf->min_xy[1] =  1.0e20;
+               pf->max_xy[0] = pf->max_xy[1] = -1.0e20;
                pf++;
        }
-       eedfilledgebase.first;
+       eed = sf_ctx->filledgebase.first;
        while (eed) {
-               pflist[eed->poly_nr-1].edges++;
-               eed= eed->next;
+               pflist[eed->poly_nr - 1].edges++;
+               eed = eed->next;
        }
 
-       evefillvertbase.first;
+       eve = sf_ctx->fillvertbase.first;
        while (eve) {
-               pflist[eve->poly_nr-1].verts++;
-               minp= pflist[eve->poly_nr-1].min;
-               maxp= pflist[eve->poly_nr-1].max;
+               pflist[eve->poly_nr - 1].verts++;
+               min_xy_p = pflist[eve->poly_nr - 1].min_xy;
+               max_xy_p = pflist[eve->poly_nr - 1].max_xy;
 
-               minp[cox]= (minp[cox])<(eve->co[cox]) ? (minp[cox]) : (eve->co[cox]);
-               minp[coy]= (minp[coy])<(eve->co[coy]) ? (minp[coy]) : (eve->co[coy]);
-               maxp[cox]= (maxp[cox])>(eve->co[cox]) ? (maxp[cox]) : (eve->co[cox]);
-               maxp[coy]= (maxp[coy])>(eve->co[coy]) ? (maxp[coy]) : (eve->co[coy]);
-               if (eve->h > 2) pflist[eve->poly_nr-1].f = 1;
+               min_xy_p[0] = (min_xy_p[0]) < (eve->xy[0]) ? (min_xy_p[0]) : (eve->xy[0]);
+               min_xy_p[1] = (min_xy_p[1]) < (eve->xy[1]) ? (min_xy_p[1]) : (eve->xy[1]);
+               max_xy_p[0] = (max_xy_p[0]) > (eve->xy[0]) ? (max_xy_p[0]) : (eve->xy[0]);
+               max_xy_p[1] = (max_xy_p[1]) > (eve->xy[1]) ? (max_xy_p[1]) : (eve->xy[1]);
+               if (eve->h > 2) pflist[eve->poly_nr - 1].f = 1;
 
-               eve= eve->next;
+               eve = eve->next;
        }
 
        /* STEP 4: FIND HOLES OR BOUNDS, JOIN THEM
@@ -1044,40 +1022,40 @@ int BLI_edgefill(short mat_nr)
         *    the edgefill itself has good auto-hole detection)
         * WATCH IT: ONLY WORKS WITH SORTED POLYS!!! */
        
-       if (poly>1) {
+       if (poly > 1) {
                short *polycache, *pc;
 
                /* so, sort first */
                qsort(pflist, poly, sizeof(PolyFill), vergpoly);
 
 #if 0
-               pf= pflist;
-               for (a=1;a<=poly;a++) {
-                       printf("poly:%d edges:%d verts:%d flag: %d\n",a,pf->edges,pf->verts,pf->f);
+               pf = pflist;
+               for (a = 1; a <= poly; a++) {
+                       printf("poly:%d edges:%d verts:%d flag: %d\n", a, pf->edges, pf->verts, pf->f);
                        PRINT2(f, f, pf->min[0], pf->min[1]);
                        pf++;
                }
 #endif
        
-               polycache= pc= MEM_callocN(sizeof(short)*poly, "polycache");
-               pf= pflist;
-               for (a=0; a<poly; a++, pf++) {
-                       for (c=a+1;c<poly;c++) {
+               polycache = pc = MEM_callocN(sizeof(short) * poly, "polycache");
+               pf = pflist;
+               for (a = 0; a < poly; a++, pf++) {
+                       for (c = a + 1; c < poly; c++) {
                                
                                /* if 'a' inside 'c': join (bbox too)
                                 * Careful: 'a' can also be inside another poly.
                                 */
-                               if (boundisect(pf, pflist+c)) {
-                                       *pc= c;
+                               if (boundisect(pf, pflist + c)) {
+                                       *pc = c;
                                        pc++;
                                }
                                /* only for optimize! */
-                               /* else if (pf->max[cox] < (pflist+c)->min[cox]) break; */
+                               /* else if (pf->max_xy[0] < (pflist+c)->min[cox]) break; */
                                
                        }
-                       while (pc!=polycache) {
+                       while (pc != polycache) {
                                pc--;
-                               mergepolysSimp(pf, pflist+ *pc);
+                               mergepolysSimp(sf_ctx, pf, pflist + *pc);
                        }
                }
                MEM_freeN(polycache);
@@ -1085,32 +1063,32 @@ int BLI_edgefill(short mat_nr)
 
 #if 0
        printf("after merge\n");
-       pf= pflist;
-       for (a=1;a<=poly;a++) {
-               printf("poly:%d edges:%d verts:%d flag: %d\n",a,pf->edges,pf->verts,pf->f);
+       pf = pflist;
+       for (a = 1; a <= poly; a++) {
+               printf("poly:%d edges:%d verts:%d flag: %d\n", a, pf->edges, pf->verts, pf->f);
                pf++;
        }
 #endif
 
        /* STEP 5: MAKE TRIANGLES */
 
-       tempve.firstfillvertbase.first;
-       tempve.lastfillvertbase.last;
-       temped.firstfilledgebase.first;
-       temped.lastfilledgebase.last;
-       fillvertbase.first=fillvertbase.last= 0;
-       filledgebase.first=filledgebase.last= 0;
-
-       pf= pflist;
-       for (a=0;a<poly;a++) {
-               if (pf->edges>1) {
-                       splitlist(&tempve,&temped,pf->nr);
-                       totfaces += scanfill(pf);
+       tempve.first = sf_ctx->fillvertbase.first;
+       tempve.last = sf_ctx->fillvertbase.last;
+       temped.first = sf_ctx->filledgebase.first;
+       temped.last = sf_ctx->filledgebase.last;
+       sf_ctx->fillvertbase.first = sf_ctx->fillvertbase.last = NULL;
+       sf_ctx->filledgebase.first = sf_ctx->filledgebase.last = NULL;
+
+       pf = pflist;
+       for (a = 0; a < poly; a++) {
+               if (pf->edges > 1) {
+                       splitlist(sf_ctx, &tempve, &temped, pf->nr);
+                       totfaces += scanfill(sf_ctx, pf);
                }
                pf++;
        }
-       BLI_movelisttolist(&fillvertbase,&tempve);
-       BLI_movelisttolist(&filledgebase,&temped);
+       BLI_movelisttolist(&sf_ctx->fillvertbase, &tempve);
+       BLI_movelisttolist(&sf_ctx->filledgebase, &temped);
 
        /* FREE */
 
index b0c0f106f06ebdbae5d1fd0d8e00b8a9e7bc249b..9bcbdcce12e44ddddf54651dd7288614b981cd6a 100644 (file)
 #include <fcntl.h>
 #include <string.h>                    /* strcpy etc.. */
 
-#ifndef WIN32
-#include <sys/ioctl.h>
-#include <unistd.h>                    /*  */
-#include <pwd.h>
-#endif
-
 #ifdef WIN32
-#include <io.h>
-#include <direct.h>
-#include "BLI_winstuff.h"
-#include "utfconv.h"
+#  include <io.h>
+#  include <direct.h>
+#  include "BLI_winstuff.h"
+#  include "utfconv.h"
+#else
+#  include <sys/ioctl.h>
+#  include <unistd.h>
+#  include <pwd.h>
 #endif
 
-
 /* lib includes */
 #include "MEM_guardedalloc.h"
 
index 19d9c2a9c65e3d5fbba44db0e59f73b7b452526d..05d8ded7764467ae0e7afbf7ae5f18cb086b2f7c 100644 (file)
@@ -115,7 +115,6 @@ static pthread_mutex_t _rcache_lock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_mutex_t _opengl_lock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_mutex_t _nodes_lock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_mutex_t _movieclip_lock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t _scanfill_lock = PTHREAD_MUTEX_INITIALIZER;
 static pthread_t mainid;
 static int thread_levels= 0;   /* threads can be invoked inside threads */
 
@@ -354,8 +353,6 @@ void BLI_lock_thread(int type)
                pthread_mutex_lock(&_nodes_lock);
        else if (type==LOCK_MOVIECLIP)
                pthread_mutex_lock(&_movieclip_lock);
-       else if (type == LOCK_SCANFILL)
-               pthread_mutex_lock(&_scanfill_lock);
 }
 
 void BLI_unlock_thread(int type)
@@ -376,8 +373,6 @@ void BLI_unlock_thread(int type)
                pthread_mutex_unlock(&_nodes_lock);
        else if (type==LOCK_MOVIECLIP)
                pthread_mutex_unlock(&_movieclip_lock);
-       else if (type == LOCK_SCANFILL)
-               pthread_mutex_unlock(&_scanfill_lock);
 }
 
 /* Mutex Locks */
index ccf0c2265703fd28f73971333ef7fa5effbc8d9d..49990a953f6ecc44578f20f51668df2d82d92cdc 100644 (file)
@@ -64,8 +64,8 @@
 
 #include "BLO_sys_types.h" // needed for intptr_t
 
-#ifdef _WIN32
-#include "BLI_winstuff.h"
+#ifdef WIN32
+#  include "BLI_winstuff.h"
 #endif
 
 /* local prototypes --------------------- */
index f82f10e83f56a7e927a20744dd12ea1421deda4b..93cf4f2037b418a3451dbe3474b58bafe7f22c1a 100644 (file)
 #include <stdarg.h> /* for va_start/end */
 
 #ifndef WIN32
-       #include <unistd.h> // for read close
+#  include <unistd.h> // for read close
 #else
-       #include <io.h> // for open close read
-#include "winsock2.h"
-#include "BLI_winstuff.h"
+#  include <io.h> // for open close read
+#  include "winsock2.h"
+#  include "BLI_winstuff.h"
 #endif
 
 /* allow readfile to use deprecated functionality */
@@ -7673,32 +7673,6 @@ static void do_versions_nodetree_socket_use_flags_2_62(bNodeTree *ntree)
        }
 }
 
-/* set the SOCK_AUTO_HIDDEN flag on collapsed nodes */
-static void do_versions_nodetree_socket_auto_hidden_flags_2_62(bNodeTree *ntree)
-{
-       bNode *node;
-       bNodeSocket *sock;
-       
-       for (node=ntree->nodes.first; node; node=node->next) {
-               if (node->flag & NODE_HIDDEN) {
-                       for (sock=node->inputs.first; sock; sock=sock->next) {
-                               if (sock->link==NULL)
-                                       sock->flag |= SOCK_AUTO_HIDDEN;
-                       }
-                       for (sock=node->outputs.first; sock; sock= sock->next) {
-                               if (nodeCountSocketLinks(ntree, sock)==0)
-                                       sock->flag |= SOCK_AUTO_HIDDEN;
-                       }
-               }
-               else {
-                       for (sock=node->inputs.first; sock; sock= sock->next)
-                               sock->flag &= ~SOCK_AUTO_HIDDEN;
-                       for (sock=node->outputs.first; sock; sock= sock->next)
-                               sock->flag &= ~SOCK_AUTO_HIDDEN;
-               }
-       }
-}
-
 static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNodeTree *ntree)
 {
        bNode *node;
@@ -13121,38 +13095,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                }
                        }
                }
-               {
-                       /* set the SOCK_AUTO_HIDDEN flag on collapsed nodes */
-                       Scene *sce;
-                       Material *mat;
-                       Tex *tex;
-                       Lamp *lamp;
-                       World *world;
-                       bNodeTree *ntree;
-
-                       for (sce=main->scene.first; sce; sce=sce->id.next)
-                               if (sce->nodetree)
-                                       do_versions_nodetree_socket_auto_hidden_flags_2_62(sce->nodetree);
-
-                       for (mat=main->mat.first; mat; mat=mat->id.next)
-                               if (mat->nodetree)
-                                       do_versions_nodetree_socket_auto_hidden_flags_2_62(mat->nodetree);
-
-                       for (tex=main->tex.first; tex; tex=tex->id.next)
-                               if (tex->nodetree)
-                                       do_versions_nodetree_socket_auto_hidden_flags_2_62(tex->nodetree);
-
-                       for (lamp=main->lamp.first; lamp; lamp=lamp->id.next)
-                               if (lamp->nodetree)
-                                       do_versions_nodetree_socket_auto_hidden_flags_2_62(lamp->nodetree);
-
-                       for (world=main->world.first; world; world=world->id.next)
-                               if (world->nodetree)
-                                       do_versions_nodetree_socket_auto_hidden_flags_2_62(world->nodetree);
-
-                       for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next)
-                               do_versions_nodetree_socket_auto_hidden_flags_2_62(ntree);
-               }
        }
 
        if (main->versionfile < 261 || (main->versionfile == 261 && main->subversionfile < 2))
@@ -13324,6 +13266,30 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                }
        }
 
+       if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 4))
+       {
+               /* Read Viscosity presets from older files */
+               Object *ob;
+
+               for (ob = main->object.first; ob; ob = ob->id.next) {
+                       ModifierData *md;
+                       for (md = ob->modifiers.first; md; md = md->next) {
+                               if (md->type == eModifierType_Fluidsim) {
+                                       FluidsimModifierData *fmd = (FluidsimModifierData *)md;
+                                       if(fmd->fss->viscosityMode == 3) {
+                                               fmd->fss->viscosityValue = 5.0;
+                                               fmd->fss->viscosityExponent = 5;
+                                       }
+                                       else if(fmd->fss->viscosityMode == 4) {
+                                               fmd->fss->viscosityValue = 2.0;
+                                               fmd->fss->viscosityExponent = 3;
+                                       }
+                               }
+                       }
+               }
+       }
+
+
 
        {
                /* Default for old files is to save particle rotations to pointcache */
index 814061b731818dab4fef0ea9e14377e558e75cd3..2f86c810da0370d0c043d876a474301e5165fa84 100644 (file)
 #include <errno.h>
 
 #ifdef WIN32
-#include <io.h>                // read, open
-#include "BLI_winstuff.h"
+#  include <io.h>              // read, open
+#  include "BLI_winstuff.h"
 #else // ! WIN32
-#include <unistd.h>            // read
+#  include <unistd.h>          // read
 #endif
 
 #include "BLO_readfile.h"
index 7f2bb72bf492374891912c7e904f67e9b9f59924..dc5546d38dd1e2df46da47a32b493be22bd7a662 100644 (file)
@@ -81,12 +81,12 @@ Any case: direct data is ALWAYS after the lib block
 #include "zlib.h"
 
 #ifndef WIN32
-#include <unistd.h>
+#  include <unistd.h>
 #else
-#include "winsock2.h"
-#include <io.h>
-#include <process.h> // for getpid
-#include "BLI_winstuff.h"
+#  include "winsock2.h"
+#  include <io.h>
+#  include <process.h> // for getpid
+#  include "BLI_winstuff.h"
 #endif
 
 /* allow writefile to use deprecated functionality (for forward compatibility code) */
index 2be9d4c7490543145cb9ec3ad233cb08f202e2c0..c8876e554315c80a82b82fd2f8c51dae3d864011 100644 (file)
@@ -89,6 +89,7 @@
 
 #include "BKE_mesh.h"
 #include "BKE_customdata.h"
+#include "BKE_multires.h"
 
 #include "BKE_global.h" /* ugh - for looping over all objects */
 #include "BKE_main.h"
@@ -854,4 +855,7 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess)
        }
 
        if (oldverts) MEM_freeN(oldverts);
+
+       /* topology could be changed, ensure mdisps are ok */
+       multires_topology_changed(me);
 }
index 3352df71414d925fde66d0be46f5f167cd0a0f52..5896a18223a2e913d05eedec2c72e96e323f548a 100644 (file)
@@ -1110,14 +1110,14 @@ static BMOpDefine bmo_inset_def = {
  *
  * Translates vertes along an edge
  */
-static BMOpDefine bmo_vert_slide_def = {
-"vertslide",
+static BMOpDefine bmo_vertex_slide_def = {
+       "vertex_slide",
        {{BMO_OP_SLOT_ELEMENT_BUF, "vert"},
         {BMO_OP_SLOT_ELEMENT_BUF, "edge"},
         {BMO_OP_SLOT_ELEMENT_BUF, "vertout"},
         {BMO_OP_SLOT_FLT, "distance_t"},
         {0} /* null-terminating sentinel */},
-       bmo_vert_slide_exec,
+       bmo_vertex_slide_exec,
        BMO_OP_FLAG_UNTAN_MULTIRES
 };
 
@@ -1189,7 +1189,7 @@ BMOpDefine *opdefines[] = {
        &bmo_bridge_loops_def,
        &bmo_solidify_def,
        &bmo_inset_def,
-       &bmo_vert_slide_def,
+       &bmo_vertex_slide_def,
 };
 
 int bmesh_total_ops = (sizeof(opdefines) / sizeof(void *));
index c4b4f01b5b52e58f1e5022969c27bf6c86c01c68..62cabe88b055ff6e264648fe3d75efa3ebf0375f 100644 (file)
@@ -43,7 +43,7 @@ void bmo_dissolve_faces_exec(BMesh *bmesh, BMOperator *op);
 void bmo_dissolve_verts_exec(BMesh *bmesh, BMOperator *op);
 void bmo_dissolve_limit_exec(BMesh *bmesh, BMOperator *op);
 void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op);
-void bmo_vert_slide_exec(BMesh *bm, BMOperator *op);
+void bmo_vertex_slide_exec(BMesh *bm, BMOperator *op);
 void bmo_connectverts_exec(BMesh *bm, BMOperator *op);
 void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op);
 void bmo_mesh_to_bmesh_exec(BMesh *bm, BMOperator *op);
index 33549660cb35e6e53e1b6eab82fad4db49cf1613..67e3d24ade193a8486d97ee08107a2fbb4aede81 100644 (file)
@@ -190,6 +190,22 @@ float BM_face_area_calc(BMesh *bm, BMFace *f)
        return area;
 }
 
+/**
+ * compute the perimeter of an ngon
+ */
+float BM_face_perimeter_calc(BMesh *UNUSED(bm), BMFace *f)
+{
+       BMLoop *l_iter, *l_first;
+       float perimeter = 0.0f;
+
+       l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+       do {
+               perimeter += len_v3v3(l_iter->v->co, l_iter->next->v->co);
+       } while ((l_iter = l_iter->next) != l_first);
+
+       return perimeter;
+}
+
 /**
  * computes center of face in 3d.  uses center of bounding box.
  */
index 3c8f3dc333999e4ef8c13490f9134179ede63a4a..71387f18ce2b5dee99edd65c9063dbe310627132 100644 (file)
@@ -28,6 +28,7 @@
  */
 
 float BM_face_area_calc(BMesh *bm, BMFace *f);
+float BM_face_perimeter_calc(BMesh *bm, BMFace *f);
 void  BM_face_center_bounds_calc(BMesh *bm, BMFace *f, float center[3]);
 void  BM_face_center_mean_calc(BMesh *bm, BMFace *f, float center[3]);
 
index 7edacb45b34701e356d633c630a6b52e735b1139..f08b2bffdc6361d599795197d6e3a6b9d83c890a 100644 (file)
@@ -52,7 +52,7 @@ static int UNUSED_FUNCTION(check_hole_in_region)(BMesh *bm, BMFace *f)
 
        BMW_init(&regwalker, bm, BMW_ISLAND,
                 BMW_MASK_NOP, BMW_MASK_NOP, FACE_MARK,
-                BMW_FLAG_NOP, /* BMESH_TODO - should be BMW_FLAG_TEST_HIDDEN ? */
+                BMW_FLAG_NOP,
                 BMW_NIL_LAY);
 
        f2 = BMW_begin(&regwalker, f);
@@ -110,10 +110,9 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op)
                BLI_array_empty(faces);
                faces = NULL; /* forces different allocatio */
 
-               /* yay, walk */
                BMW_init(&regwalker, bm, BMW_ISLAND,
                         BMW_MASK_NOP, BMW_MASK_NOP, FACE_MARK,
-                        BMW_FLAG_NOP, /* BMESH_TODO - should be BMW_FLAG_TEST_HIDDEN ? */
+                        BMW_FLAG_NOP, /* no need to check BMW_FLAG_TEST_HIDDEN, faces are already marked by the bmo */
                         BMW_NIL_LAY);
 
                f2 = BMW_begin(&regwalker, f);
index 28c9c53fa8afff25adc628e3d661792250cbf461..1b6d64073c0069c500f4cb299fd429c22ff3eb63 100644 (file)
@@ -73,11 +73,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op)
        BMO_ITER(v, &siter, bm, &dupeop, "newout", BM_VERT) {
                BLI_array_growone(vmap);
                vmap[i] = v;
-
-               /* BMESH_TODO, double check this is being used, calling following operators will overwrite anyway - campbell */
-               BM_elem_index_set(v2, i); /* set_dirty! */
                v2 = BM_iter_step(&iter);
-
                i++;
        }
        bm->elem_index_dirty |= BM_VERT;
index aad0089b1d7a2721fd18ffa04a2b2c56432d873d..d126da52b22ba249d09802964f02c7d9d7417c82 100644 (file)
@@ -381,7 +381,7 @@ void bmo_collapse_exec(BMesh *bm, BMOperator *op)
 
        BMW_init(&walker, bm, BMW_SHELL,
                 BMW_MASK_NOP, EDGE_MARK, BMW_MASK_NOP,
-                BMW_FLAG_NOP, /* BMESH_TODO - should be BMW_FLAG_TEST_HIDDEN ? */
+                BMW_FLAG_NOP, /* no need to use BMW_FLAG_TEST_HIDDEN, already marked data */
                 BMW_NIL_LAY);
 
        BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
@@ -441,7 +441,7 @@ static void bmo_collapsecon_do_layer(BMesh *bm, BMOperator *op, int layer)
 
        BMW_init(&walker, bm, BMW_LOOPDATA_ISLAND,
                 BMW_MASK_NOP, EDGE_MARK, BMW_MASK_NOP,
-                BMW_FLAG_NOP, /* BMESH_TODO - should be BMW_FLAG_TEST_HIDDEN ? */
+                BMW_FLAG_NOP, /* no need to use BMW_FLAG_TEST_HIDDEN, already marked data */
                 layer);
 
        BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) {
index 9414c7308b64e24d666070416650941bb163032a..7b7b0638a3f35f04aeb2c0b05a153cfb9792602d 100644 (file)
@@ -40,7 +40,7 @@
  * Slides a vertex along a connected edge
  *
  */
-void bmo_vert_slide_exec(BMesh *bm, BMOperator *op)
+void bmo_vertex_slide_exec(BMesh *bm, BMOperator *op)
 {
        BMOIter oiter;
        BMIter iter;
@@ -60,8 +60,10 @@ void bmo_vert_slide_exec(BMesh *bm, BMOperator *op)
 
 
        if (!vertex) {
-               if (G.debug & G_DEBUG)
-                       fprintf(stderr, "vertslide: No vertex selected...");
+               if (G.debug & G_DEBUG) {
+                       fprintf(stderr, "vertex_slide: No vertex selected...");
+               }
+               BMO_error_raise(bm, op, BMERR_INVALID_SELECTION, "Vertex Slide Error: Invalid selection.");
                return;
        }
 
@@ -78,8 +80,10 @@ void bmo_vert_slide_exec(BMesh *bm, BMOperator *op)
 
        /* Only allow sliding if an edge is selected */
        if (selected_edges == 0) {
-               if (G.debug & G_DEBUG)
-                       fprintf(stderr, "vertslide: select a single edge\n");
+               if (G.debug & G_DEBUG) {
+                       fprintf(stderr, "vertex_slide: select a single edge\n");
+               }
+               BMO_error_raise(bm, op, BMERR_INVALID_SELECTION, "Vertex Slide Error: Invalid selection.");
                return;
        }
 
@@ -102,9 +106,6 @@ void bmo_vert_slide_exec(BMesh *bm, BMOperator *op)
                interp_v3_v3v3(vertex->co, vertex->co, other->co, distance_t);
        }
 
-       /* Deselect the edges */
-       BMO_slot_buffer_hflag_disable(bm, op, "edge", BM_ALL, BM_ELEM_SELECT, TRUE);
-
        /* Return the new edge. The same previously marked with VERT_MARK */
        BMO_slot_buffer_from_enabled_flag(bm, op, "vertout", BM_VERT, VERT_MARK);
        return;
index dd23bc604be3a43cd26add547c2293d4488719f9..7d07dc075da7c4e1c9e40d1f289f72edd8de7004 100644 (file)
  */
 
 #include "MEM_guardedalloc.h"
+#include "DNA_listBase.h"
 
-#include "BLI_scanfill.h"
 #include "BLI_math.h"
 #include "BLI_array.h"
 #include "BLI_smallhash.h"
+#include "BLI_scanfill.h"
 
 #include "bmesh.h"
 #include "intern/bmesh_private.h"
@@ -164,6 +165,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
        BMOIter siter;
        BMEdge *e;
        BMOperator bmop;
+       ScanFillContext sf_ctx;
        /* ScanFillEdge *eed; */ /* UNUSED */
        ScanFillVert *eve, *v1, *v2;
        ScanFillFace *efa;
@@ -171,32 +173,32 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
 
        BLI_smallhash_init(&hash);
        
-       BLI_begin_edgefill();
+       BLI_begin_edgefill(&sf_ctx);
        
        BMO_ITER(e, &siter, bm, op, "edges", BM_EDGE) {
                BMO_elem_flag_enable(bm, e, EDGE_MARK);
                
                if (!BLI_smallhash_haskey(&hash, (uintptr_t)e->v1)) {
-                       eve = BLI_addfillvert(e->v1->co);
+                       eve = BLI_addfillvert(&sf_ctx, e->v1->co);
                        eve->tmp.p = e->v1;
                        BLI_smallhash_insert(&hash, (uintptr_t)e->v1, eve);
                }
                
                if (!BLI_smallhash_haskey(&hash, (uintptr_t)e->v2)) {
-                       eve = BLI_addfillvert(e->v2->co);
+                       eve = BLI_addfillvert(&sf_ctx, e->v2->co);
                        eve->tmp.p = e->v2;
                        BLI_smallhash_insert(&hash, (uintptr_t)e->v2, eve);
                }
                
                v1 = BLI_smallhash_lookup(&hash, (uintptr_t)e->v1);
                v2 = BLI_smallhash_lookup(&hash, (uintptr_t)e->v2);
-               /* eed = */ BLI_addfilledge(v1, v2);
+               /* eed = */ BLI_addfilledge(&sf_ctx, v1, v2);
                /* eed->tmp.p = e; */ /* UNUSED */
        }
        
-       BLI_edgefill(0);
+       BLI_edgefill(&sf_ctx, FALSE);
        
-       for (efa = fillfacebase.first; efa; efa = efa->next) {
+       for (efa = sf_ctx.fillfacebase.first; efa; efa = efa->next) {
                BMFace *f = BM_face_create_quad_tri(bm,
                                                    efa->v1->tmp.p, efa->v2->tmp.p, efa->v3->tmp.p, NULL,
                                                    NULL, TRUE);
@@ -211,7 +213,7 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
                }
        }
        
-       BLI_end_edgefill();
+       BLI_end_edgefill(&sf_ctx);
        BLI_smallhash_release(&hash);
        
        /* clean up fill */
index c359d530f7362a1cdeffb72a096bb0bbbeb402dd..ea1fc5171e51b75696da9a67bfe1949d43ff07d4 100644 (file)
@@ -458,36 +458,6 @@ void bmo_vertexsmooth_exec(BMesh *bm, BMOperator *op)
        BLI_array_free(cos);
 }
 
-/*
- * compute the perimeter of an ngon
- *
- * NOTE: This should probably go to bmesh_polygon.c
- */
-static float ngon_perimeter(BMesh *bm, BMFace *f)
-{
-       BMIter  liter;
-       BMLoop *l;
-       int     num_verts = 0;
-       float   v[3], sv[3];
-       float   perimeter = 0.0f;
-
-       BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) {
-               if (num_verts == 0) {
-                       copy_v3_v3(v, l->v->co);
-                       copy_v3_v3(sv, l->v->co);
-               }
-               else {
-                       perimeter += len_v3v3(v, l->v->co);
-                       copy_v3_v3(v, l->v->co);
-               }
-               num_verts++;
-       }
-
-       perimeter += len_v3v3(v, sv);
-
-       return perimeter;
-}
-
 /*
  * compute the fake surface of an ngon
  * This is done by decomposing the ngon into triangles who share the centroid of the ngon
@@ -593,7 +563,7 @@ void bmo_similarfaces_exec(BMesh *bm, BMOperator *op)
                        switch (type) {
                                case SIMFACE_PERIMETER:
                                        /* set the perimeter */
-                                       f_ext[i].perim = ngon_perimeter(bm, f_ext[i].f);
+                                       f_ext[i].perim = BM_face_perimeter_calc(bm, f_ext[i].f);
                                        break;
 
                                case SIMFACE_COPLANAR:
index 9190cd940d690b8c054aa12a798939887aa02de0..2e9aa8ec675d4c4939834ace651211c36abea8f4 100644 (file)
@@ -1015,9 +1015,8 @@ static void calc_shapeKeys(Object *obedit)
 
 /* ********************* Amimation data *************** */
 
-static int curve_is_animated(Object *ob)
+static int curve_is_animated(Curve *cu)
 {
-       Curve *cu= (Curve*)ob->data;
        AnimData *ad= BKE_animdata_from_id(&cu->id);
 
        return ad && (ad->action || ad->drivers.first);
@@ -1063,10 +1062,9 @@ static void fcurve_remove(AnimData *ad, ListBase *orig_curves, FCurve *fcu)
        free_fcurve(fcu);
 }
 
-static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves)
+static void curve_rename_fcurves(Curve *cu, ListBase *orig_curves)
 {
        int nu_index= 0, a, pt_index;
-       Curve *cu= (Curve*)obedit->data;
        EditNurb *editnurb= cu->editnurb;
        Nurb *nu= editnurb->nurbs.first;
        CVKeyIndex *keyIndex;
@@ -1178,17 +1176,16 @@ static void curve_rename_fcurves(Object *obedit, ListBase *orig_curves)
 }
 
 /* return 0 if animation data wasn't changed, 1 otherwise */
-int ED_curve_updateAnimPaths(Object *obedit)
+int ED_curve_updateAnimPaths(Curve *cu)
 {
-       Curve *cu= (Curve*)obedit->data;
        AnimData *ad= BKE_animdata_from_id(&cu->id);
 
-       if (!curve_is_animated(obedit)) return 0;
+       if (!curve_is_animated(cu)) return 0;
 
        if (ad->action)
-               curve_rename_fcurves(obedit, &ad->action->curves);
+               curve_rename_fcurves(cu, &ad->action->curves);
 
-       curve_rename_fcurves(obedit, &ad->drivers);
+       curve_rename_fcurves(cu, &ad->drivers);
 
        return 1;
 }
@@ -1221,7 +1218,7 @@ void load_editNurb(Object *obedit)
                cu->nurb= newnurb;
 
                calc_shapeKeys(obedit);
-               ED_curve_updateAnimPaths(obedit);
+               ED_curve_updateAnimPaths(obedit->data);
 
                freeNurblist(&oldnurb);
        }
@@ -1702,7 +1699,7 @@ static int deleteflagNurb(bContext *C, wmOperator *UNUSED(op), int flag)
                nu= next;
        }
 
-       if (ED_curve_updateAnimPaths(obedit))
+       if (ED_curve_updateAnimPaths(obedit->data))
                WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
 
        return OPERATOR_FINISHED;
@@ -2017,7 +2014,7 @@ static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
                        keyData_switchDirectionNurb(cu, nu);
                }
 
-       if (ED_curve_updateAnimPaths(obedit))
+       if (ED_curve_updateAnimPaths(obedit->data))
                WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
 
        DAG_id_tag_update(obedit->data, 0);
@@ -3191,7 +3188,7 @@ static int subdivide_exec(bContext *C, wmOperator *op)
 
        subdividenurb(obedit, number_cuts);
 
-       if (ED_curve_updateAnimPaths(obedit))
+       if (ED_curve_updateAnimPaths(obedit->data))
                WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
 
        WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -3512,7 +3509,7 @@ static int set_spline_type_exec(bContext *C, wmOperator *op)
        }
 
        if (changed) {
-               if (ED_curve_updateAnimPaths(obedit))
+               if (ED_curve_updateAnimPaths(obedit->data))
                        WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
 
                DAG_id_tag_update(obedit->data, 0);
@@ -4104,7 +4101,7 @@ static int make_segment_exec(bContext *C, wmOperator *op)
                return OPERATOR_CANCELLED;
        }
 
-       if (ED_curve_updateAnimPaths(obedit))
+       if (ED_curve_updateAnimPaths(obedit->data))
                WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
 
        WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -4323,7 +4320,7 @@ static int spin_exec(bContext *C, wmOperator *op)
                return OPERATOR_CANCELLED;
        }
 
-       if (ED_curve_updateAnimPaths(obedit))
+       if (ED_curve_updateAnimPaths(obedit->data))
                WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
 
        WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -4626,7 +4623,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
        if (ok) {
                test2DNurb(nu);
 
-               if (ED_curve_updateAnimPaths(obedit))
+               if (ED_curve_updateAnimPaths(obedit->data))
                        WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
 
                WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -4719,7 +4716,7 @@ static int extrude_exec(bContext *C, wmOperator *UNUSED(op))
        }
        else {
                if (extrudeflagNurb(editnurb, 1)) { /* '1'= flag */
-                       if (ED_curve_updateAnimPaths(obedit))
+                       if (ED_curve_updateAnimPaths(obedit->data))
                                WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
 
                        WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -5640,7 +5637,7 @@ static int delete_exec(bContext *C, wmOperator *op)
                        keyIndex_delNurbList(editnurb, nubase);
                        freeNurblist(nubase);
 
-                       if (ED_curve_updateAnimPaths(obedit))
+                       if (ED_curve_updateAnimPaths(obedit->data))
                                WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
                }
 
@@ -5941,7 +5938,7 @@ static int delete_exec(bContext *C, wmOperator *op)
                freeNurblist(nubase);
        }
 
-       if (ED_curve_updateAnimPaths(obedit))
+       if (ED_curve_updateAnimPaths(obedit->data))
                WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, obedit);
 
        WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -6987,10 +6984,7 @@ static void undoCurve_to_editCurve(void *ucu, void *UNUSED(edata), void *cu_v)
 
        cu->lastsel= lastsel;
        cu->actnu= undoCurve->actnu;
-       /* BMESH_TODO */
-#if 0
-       ED_curve_updateAnimPaths(obedit);
-#endif
+       ED_curve_updateAnimPaths(cu);
 }
 
 static void *editCurve_to_undoCurve(void *UNUSED(edata), void *cu_v)
index bffb55434600e08c2c1486eaff71a9a80fe643e6..50e43c46de5786e4852eb85c0d0c56e14047085f 100644 (file)
@@ -87,7 +87,7 @@ int CU_select_nth(struct Object *obedit, int nth);
 void ED_curve_beztcpy(struct EditNurb *editnurb, struct BezTriple *dst, struct BezTriple *src, int count);
 void ED_curve_bpcpy(struct EditNurb *editnurb, struct BPoint *dst, struct BPoint *src, int count);
 
-int ED_curve_updateAnimPaths(struct Object *obedit);
+int ED_curve_updateAnimPaths(struct Curve *cu);
 
 int ED_curve_actSelection(struct Curve *cu, float center[3]);
 
index f122987b4e10e607e8926d53b39c9325346bccab..dfdbb1969cf34a24f33ef085358517abf49bf5ec 100644 (file)
@@ -78,6 +78,8 @@ void ED_uvedit_live_unwrap_begin(struct Scene *scene, struct Object *obedit);
 void ED_uvedit_live_unwrap_re_solve(void);
 void ED_uvedit_live_unwrap_end(short cancel);
 
+void ED_uvedit_live_unwrap(struct Scene *scene, struct Object *obedit);
+
 /* single call up unwrap using scene settings, used for edge tag unwrapping */
 void ED_unwrap_lscm(struct Scene *scene, struct Object *obedit, const short sel);
 
index ba7c12d164b3020a50f9585344736d6b0239fd38..e20b60cd77e10ddb537c74452d8e8074b244588f 100644 (file)
 #include <string.h>
 
 #ifndef WIN32
-#include <unistd.h>
+#  include <unistd.h>
 #else
-#include <io.h>
-#include <direct.h>
-#include "BLI_winstuff.h"
-#endif   
+#  include <io.h>
+#  include <direct.h>
+#  include "BLI_winstuff.h"
+#endif
+
 #include "MEM_guardedalloc.h"
 
 #include "GPU_extensions.h"
index f33e1271e4e1288cad4d87575bdb1fd40092583c..bba5578ccc1e26c346eaaf2a0b4cb9fd172dd696 100644 (file)
@@ -1610,7 +1610,7 @@ static void rnd_offset_co(float co[3], float scale)
        int i;
 
        for (i = 0; i < 3; i++) {
-               co[i] += (BLI_drand() - 0.5) * scale;
+               co[i] += (BLI_frand() - 0.5) * scale;
        }
 }
 
@@ -1809,6 +1809,8 @@ static void knifenet_fill_faces(knifetool_opdata *kcd)
                }
        }
 
+       BLI_srand(0);
+
        for (i = 0; i < totface; i++) {
                SmallHash *hash = &shash;
                ScanFillFace *efa;
@@ -1822,11 +1824,11 @@ static void knifenet_fill_faces(knifetool_opdata *kcd)
                if (face_nets[i].first)
                        BMO_elem_flag_enable(bm, f, DEL);
 
-               BLI_begin_edgefill();
+               BLI_begin_edgefill(&sf_ctx);
 
                for (entry = face_nets[i].first; entry; entry = entry->next) {
                        if (!BLI_smallhash_haskey(hash, (intptr_t)entry->kfe->v1)) {
-                               eve = BLI_addfillvert(entry->kfe->v1->v->co);
+                               eve = BLI_addfillvert(&sf_ctx, entry->kfe->v1->v->co);
                                eve->poly_nr = 0;
                                rnd_offset_co(eve->co, rndscale);
                                eve->tmp.p = entry->kfe->v1->v;
@@ -1834,7 +1836,7 @@ static void knifenet_fill_faces(knifetool_opdata *kcd)
                        }
 
                        if (!BLI_smallhash_haskey(hash, (intptr_t)entry->kfe->v2)) {
-                               eve = BLI_addfillvert(entry->kfe->v2->v->co);
+                               eve = BLI_addfillvert(&sf_ctx, entry->kfe->v2->v->co);
                                eve->poly_nr = 0;
                                rnd_offset_co(eve->co, rndscale);
                                eve->tmp.p = entry->kfe->v2->v;
@@ -1856,7 +1858,7 @@ static void knifenet_fill_faces(knifetool_opdata *kcd)
 
                        if (eve->poly_nr > 1 && lasteve->poly_nr > 1) {
                                ScanFillEdge *eed;
-                               eed = BLI_addfilledge(lasteve, eve);
+                               eed = BLI_addfilledge(&sf_ctx, lasteve, eve);
                                if (entry->kfe->oe)
                                        eed->f = FILLBOUNDARY;  /* mark as original boundary edge */
 
@@ -1871,7 +1873,7 @@ static void knifenet_fill_faces(knifetool_opdata *kcd)
                        }
                }
 
-               BLI_edgefill(0);
+               BLI_edgefill(&sf_ctx, FALSE);
 
                for (efa = fillfacebase.first; efa; efa = efa->next) {
                        BMVert *v1 = efa->v3->tmp.p, *v2 = efa->v2->tmp.p, *v3 = efa->v1->tmp.p;
index 355d64a9fe19f7fdf96bf490d7ba481c54690131..00835b7959369081b68bdb44c38ec9244800fb52 100644 (file)
@@ -56,6 +56,7 @@
 
 #include "ED_mesh.h"
 #include "ED_screen.h"
+#include "ED_uvedit.h"
 #include "ED_view3d.h"
 
 #include "BIF_gl.h"
@@ -871,12 +872,12 @@ void MESH_OT_select_similar(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Select Similar";
        ot->idname = "MESH_OT_select_similar";
+       ot->description = "Select similar vertices, edges or faces by property types";
        
        /* api callbacks */
        ot->invoke = WM_menu_invoke;
        ot->exec = edbm_select_similar_exec;
        ot->poll = ED_operator_editmesh;
-       ot->description = "Select similar vertices, edges or faces by property types";
        
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -974,11 +975,11 @@ void MESH_OT_loop_multi_select(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Multi Select Loops";
        ot->idname = "MESH_OT_loop_multi_select";
+       ot->description = "Select a loop of connected edges by connection type";
        
        /* api callbacks */
        ot->exec = edbm_loop_multiselect_exec;
        ot->poll = ED_operator_editmesh;
-       ot->description = "Select a loop of connected edges by connection type";
        
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -1079,12 +1080,11 @@ void MESH_OT_loop_select(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Loop Select";
        ot->idname = "MESH_OT_loop_select";
-       ot->description = "Select a loop";
+       ot->description = "Select a loop of connected edges";
        
        /* api callbacks */
        ot->invoke = edbm_select_loop_invoke;
        ot->poll = ED_operator_editmesh_region_view3d;
-       ot->description = "Select a loop of connected edges";
        
        /* flags */
        ot->flag = OPTYPE_UNDO;
@@ -1221,9 +1221,7 @@ static int edgetag_shortest_path(Scene *scene, BMEditMesh *em, BMEdge *source, B
        /* note, would pass BM_EDGE except we are looping over all edges anyway */
        BM_mesh_elem_index_ensure(em->bm, BM_VERT /* | BM_EDGE */);
 
-       BM_ITER(e, &iter, em->bm, BM_EDGES_OF_MESH, NULL)
-       {
-               e->oflags[0].f = 0; /* XXX, whats this for, BMESH_TODO, double check if this is needed */
+       BM_ITER(e, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
                if (BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
                        BLI_smallhash_insert(&visithash, (uintptr_t)e, NULL);
                }
@@ -1277,15 +1275,6 @@ static int edgetag_shortest_path(Scene *scene, BMEditMesh *em, BMEdge *source, B
         * by the shortest path found so far to the edge.
         */
 
-#if 0 /* UNUSED */ /* this block does nothing, not sure why its here? - campbell */
-       for (i = 0; i < totvert; i++) {
-               int start = nedges[i], end = nedges[i + 1], cur;
-               for (cur = start; cur < end; cur++) {
-                       BMEdge *e = EDBM_edge_at_index(em, edges[cur]);
-               }
-       }
-#endif
-
        /* regular dijkstra shortest path, but over edges instead of vertices */
        heap = BLI_heap_new();
        BLI_heap_insert(heap, 0.0f, SET_INT_IN_POINTER(BM_elem_index_get(source)));
@@ -1399,6 +1388,7 @@ static void mouse_mesh_shortest_path(bContext *C, int mval[2])
                        
                        case EDGE_MODE_TAG_SEAM:
                                me->drawflag |= ME_DRAWSEAMS;
+                               ED_uvedit_live_unwrap(vc.scene, vc.obedit);
                                break;
                        case EDGE_MODE_TAG_SHARP:
                                me->drawflag |= ME_DRAWSHARP;
@@ -1431,11 +1421,11 @@ void MESH_OT_select_shortest_path(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Shortest Path Select";
        ot->idname = "MESH_OT_select_shortest_path";
+       ot->description = "Select shortest path between two selections";
        
        /* api callbacks */
        ot->invoke = edbm_shortest_path_select_invoke;
        ot->poll = ED_operator_editmesh;
-       ot->description = "Select shortest path between two selections";
        
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -1847,11 +1837,11 @@ void MESH_OT_select_linked_pick(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Select Linked";
        ot->idname = "MESH_OT_select_linked_pick";
+       ot->description = "(De)select all vertices linked to the edge under the mouse cursor";
        
        /* api callbacks */
        ot->invoke = edbm_select_linked_pick_invoke;
        ot->poll = ED_operator_editmesh;
-       ot->description = "(De)select all vertices linked to the edge under the mouse cursor";
        
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -1894,7 +1884,7 @@ static int edbm_select_linked_exec(bContext *C, wmOperator *op)
 
                BMW_init(&walker, bm, BMW_ISLAND,
                         BMW_MASK_NOP, limit ? BM_ELEM_SELECT : BMW_MASK_NOP, BMW_MASK_NOP,
-                        BMW_FLAG_NOP, /* BMESH_TODO - should be BMW_FLAG_TEST_HIDDEN ? */
+                        BMW_FLAG_TEST_HIDDEN,
                         BMW_NIL_LAY);
 
                BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
@@ -1945,11 +1935,11 @@ void MESH_OT_select_linked(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Select Linked All";
        ot->idname = "MESH_OT_select_linked";
+       ot->description = "Select all vertices linked to the active mesh";
        
        /* api callbacks */
        ot->exec = edbm_select_linked_exec;
        ot->poll = ED_operator_editmesh;
-       ot->description = "Select all vertices linked to the active mesh";
        
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -2065,7 +2055,7 @@ static void walker_deselect_nth(BMEditMesh *em, int nth, int offset, BMHeader *h
        /* Walk over selected elements starting at active */
        BMW_init(&walker, bm, walktype,
                 mask_vert, mask_edge, mask_face,
-                BMW_FLAG_NOP, /* BMESH_TODO - should be BMW_FLAG_TEST_HIDDEN ? */
+                BMW_FLAG_NOP, /* don't use BMW_FLAG_TEST_HIDDEN here since we want to desel all */
                 BMW_NIL_LAY);
 
        BLI_assert(walker.order == BMW_BREADTH_FIRST);
@@ -2185,8 +2175,8 @@ void MESH_OT_select_nth(wmOperatorType *ot)
 {
        /* identifiers */
        ot->name = "Select Nth";
-       ot->description = "";
        ot->idname = "MESH_OT_select_nth";
+       ot->description = "Select every Nth element starting from a selected vertex, edge or face";
 
        /* api callbacks */
        ot->exec = edbm_select_nth_exec;
@@ -2511,7 +2501,7 @@ void MESH_OT_select_next_loop(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Select Next Loop";
        ot->idname = "MESH_OT_select_next_loop";
-       ot->description = "";
+       ot->description = "Select next edge loop adjacent to a selected loop";
 
        /* api callbacks */
        ot->exec = edbm_select_next_loop_exec;
@@ -2579,6 +2569,7 @@ void MESH_OT_region_to_loop(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Select Boundary Loop";
        ot->idname = "MESH_OT_region_to_loop";
+       ot->description = "Select boundary edges around the selected faces";
 
        /* api callbacks */
        ot->exec = edbm_region_to_loop_exec;
@@ -2760,6 +2751,7 @@ void MESH_OT_loop_to_region(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Select Loop Inner-Region";
        ot->idname = "MESH_OT_loop_to_region";
+       ot->description = "Select region of faces inside of a selected loop of edges";
 
        /* api callbacks */
        ot->exec = edbm_loop_to_region_exec;
index 94c546f0f1b42867afd18ff755f89d891d563dad..266117ec9a530edc3928d843b50efff5183bb977 100644 (file)
@@ -55,7 +55,7 @@
 
 #include "mesh_intern.h"
 
-#define VTX_SLIDE_SNAP_THRSH 0.15
+#define VTX_SLIDE_SNAP_THRSH 15
 
 /* Cusom VertexSlide Operator data */
 typedef struct VertexSlideOp {
@@ -99,9 +99,9 @@ typedef struct VertexSlideOp {
 } VertexSlideOp;
 
 static void vtx_slide_draw(const bContext *C, ARegion *ar, void *arg);
-static int edbm_vert_slide_exec(bContext *C, wmOperator *op);
+static int edbm_vertex_slide_exec(bContext *C, wmOperator *op);
 static void vtx_slide_exit(const bContext *C, wmOperator *op);
-static void vtx_slide_set_frame(VertexSlideOp *vso);
+static int vtx_slide_set_frame(VertexSlideOp *vso);
 
 static int vtx_slide_init(bContext *C, wmOperator *op)
 {
@@ -158,9 +158,6 @@ static int vtx_slide_init(bContext *C, wmOperator *op)
 
        vso->snap_threshold = 0.2f;
 
-       /* Add handler for the vertex sliding */
-       WM_event_add_modal_handler(C, op);
-
        /* Notify the viewport */
        view3d_operator_needs_opengl(C);
 
@@ -178,7 +175,14 @@ static int vtx_slide_init(bContext *C, wmOperator *op)
        vso->obj = obedit;
 
        /* Init frame */
-       vtx_slide_set_frame(vso);
+       if (!vtx_slide_set_frame(vso)) {
+               BKE_report(op->reports, RPT_ERROR_INVALID_INPUT, "Vertex Slide: Can't find starting vertex!");
+               vtx_slide_exit(C, op);
+               return FALSE;
+       }
+
+       /* Add handler for the vertex sliding */
+       WM_event_add_modal_handler(C, op);
 
        /* Tag for redraw */
        ED_region_tag_redraw(vso->active_region);
@@ -196,7 +200,7 @@ static void vtx_slide_confirm(bContext *C, wmOperator *op)
        BM_edge_select_set(bm, vso->sel_edge, TRUE);
 
        /* Invoke operator */
-       edbm_vert_slide_exec(C, op);
+       edbm_vertex_slide_exec(C, op);
 
        if (vso->snap_n_merge) {
                float other_d;
@@ -260,6 +264,7 @@ static void vtx_slide_exit(const bContext *C, wmOperator *op)
 
        MEM_freeN(vso);
        vso = NULL;
+       op->customdata = NULL;
 
        /* Clear the header */
        ED_area_headerprint(CTX_wm_area(C), NULL);
@@ -273,7 +278,9 @@ static void vtx_slide_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
        if (vso && vso->sel_edge) {
                /* Get 3d view */
                View3D *view3d = CTX_wm_view3d(C);
-               const int outline_w = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 1;
+               const float outline_w = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.8f;
+               const float pt_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) + 1.5;
+
                int i = 0;
 
                if (view3d && view3d->zbuf)
@@ -286,17 +293,7 @@ static void vtx_slide_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
 
                glEnable(GL_BLEND);
                glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-
-               /* Draw selected edge
-                * Add color offset and reduce alpha */
-               UI_ThemeColorShadeAlpha(TH_EDGE_SELECT, 50, -50);
-
-               glLineWidth(outline_w);
-
-               glBegin(GL_LINES);
-               bglVertex3fv(vso->sel_edge->v1->co);
-               bglVertex3fv(vso->sel_edge->v2->co);
-               glEnd();
+                       
 
                if (vso->slide_mode && vso->disk_edges > 0) {
                        /* Draw intermediate edge frame */
@@ -310,10 +307,21 @@ static void vtx_slide_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
                        }
                }
 
+                       /* Draw selected edge
+                * Add color offset and reduce alpha */
+               UI_ThemeColorShadeAlpha(TH_EDGE_SELECT, 40, -50);
+
+               glLineWidth(outline_w);
+
+               glBegin(GL_LINES);
+               bglVertex3fv(vso->sel_edge->v1->co);
+               bglVertex3fv(vso->sel_edge->v2->co);
+               glEnd();
+
                if (vso->slide_mode) {
                        /* Draw interpolated vertex */
-                       int pt_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) + 2;
-                       UI_ThemeColorShadeAlpha(TH_FACE_DOT, -90, -50);
+                       
+                       UI_ThemeColorShadeAlpha(TH_FACE_DOT, -80, -50);
 
                        glPointSize(pt_size);
 
@@ -377,17 +385,12 @@ static void vtx_slide_find_edge(VertexSlideOp *vso, wmEvent *event)
        if (nst_edge) {
                /* Find a connected edge */
                if (BM_vert_in_edge(nst_edge, vso->start_vtx)) {
-                       float edge_len;
 
                        /* Save mouse coords */
                        copy_v2_v2_int(vso->m_co, event->mval);
 
                        /* Set edge */
                        vso->sel_edge = nst_edge;
-                       
-                       /* Set snap threshold to be proportional to edge length */
-                       edge_len = len_v3v3(nst_edge->v1->co, nst_edge->v2->co);
-                       vso->snap_threshold = edge_len * VTX_SLIDE_SNAP_THRSH;
                }
        }
 }
@@ -403,6 +406,7 @@ static void vtx_slide_update(VertexSlideOp *vso, wmEvent *event)
        if (edge) {
                float edge_other_proj[3];
                float start_vtx_proj[3];
+               float edge_len;
                BMVert *other;
 
                float interp[3];
@@ -426,6 +430,16 @@ static void vtx_slide_update(VertexSlideOp *vso, wmEvent *event)
 
                t_val = line_point_factor_v2(closest_2d, start_vtx_proj, edge_other_proj);
 
+               /* Set snap threshold to be proportional to edge length */
+               edge_len = len_v3v3(start_vtx_proj, edge_other_proj);
+               
+               if (edge_len <= 0.0f)
+                       edge_len = VTX_SLIDE_SNAP_THRSH;
+
+               edge_len =  (len_v3v3(edge->v1->co, edge->v2->co) * VTX_SLIDE_SNAP_THRSH) / edge_len;
+
+               vso->snap_threshold =  edge_len;
+
                /* Snap to mid */
                if (vso->snap_to_mid) {
                        t_val = 0.5f;
@@ -463,11 +477,12 @@ static void vtx_slide_update(VertexSlideOp *vso, wmEvent *event)
 }
 
 /* Sets the outline frame */
-static void vtx_slide_set_frame(VertexSlideOp *vso)
+static int vtx_slide_set_frame(VertexSlideOp *vso)
 {
        BMEdge *edge;
        float (*vtx_frame)[3] = NULL;
        BMEdge** edge_frame = NULL;
+       BMVert *curr_vert = NULL;
        BLI_array_declare(vtx_frame);
        BLI_array_declare(edge_frame);
        BMIter iter;
@@ -491,12 +506,15 @@ static void vtx_slide_set_frame(VertexSlideOp *vso)
        /* Iterate over edges of vertex and copy them */
        BM_ITER_INDEX(edge, &iter, bm, BM_EDGES_OF_VERT, sel_vtx, idx)
        {
-               BLI_array_growone(vtx_frame);
+               curr_vert = BM_edge_other_vert(edge, sel_vtx);
+               if (curr_vert) {
+                       BLI_array_growone(vtx_frame);
 
-               copy_v3_v3(vtx_frame[idx], BM_edge_other_vert(edge, sel_vtx)->co);
+                       copy_v3_v3(vtx_frame[idx], curr_vert->co);
 
-               BLI_array_append(edge_frame, edge);
-               vso->disk_edges++;
+                       BLI_array_append(edge_frame, edge);
+                       vso->disk_edges++;
+               }
        }
 
        vso->edge_frame = edge_frame;
@@ -504,11 +522,17 @@ static void vtx_slide_set_frame(VertexSlideOp *vso)
 
        /* Set the interp at starting vtx */
        copy_v3_v3(vso->interp, sel_vtx->co);
+
+       return vso->disk_edges > 0;
 }
 
-static int edbm_vert_slide_modal(bContext *C, wmOperator *op, wmEvent *event)
+static int edbm_vertex_slide_modal(bContext *C, wmOperator *op, wmEvent *event)
 {
        VertexSlideOp *vso = op->customdata;
+       char buff[128];
+
+       if (!vso)
+               return OPERATOR_CANCELLED;
 
        /* Notify the viewport */
        view3d_operator_needs_opengl(C);
@@ -588,13 +612,14 @@ static int edbm_vert_slide_modal(bContext *C, wmOperator *op, wmEvent *event)
                }
                case MOUSEMOVE:
                {
+                       sprintf(buff, "Vertex Slide: %f", vso->distance);
                        if (!vso->slide_mode) {
                                vtx_slide_find_edge(vso, event);
                        }
                        else {
                                vtx_slide_update(vso, event);
                        }
-
+                       ED_area_headerprint(CTX_wm_area(C), buff);
                        ED_region_tag_redraw(vso->active_region);
                        break;
                }
@@ -603,7 +628,7 @@ static int edbm_vert_slide_modal(bContext *C, wmOperator *op, wmEvent *event)
        return OPERATOR_RUNNING_MODAL;
 }
 
-static int edbm_vert_slide_cancel(bContext *C, wmOperator *op)
+static int edbm_vertex_slide_cancel(bContext *C, wmOperator *op)
 {
        /* Exit the modal */
        vtx_slide_exit(C, op);
@@ -611,7 +636,7 @@ static int edbm_vert_slide_cancel(bContext *C, wmOperator *op)
        return OPERATOR_CANCELLED;
 }
 
-static int edbm_vert_slide_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+static int edbm_vertex_slide_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
        /* Initialize the operator */
        if (vtx_slide_init(C, op))
@@ -621,20 +646,20 @@ static int edbm_vert_slide_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(e
 }
 
 /* Vertex Slide */
-static int edbm_vert_slide_exec(bContext *C, wmOperator *op)
+static int edbm_vertex_slide_exec(bContext *C, wmOperator *op)
 {
        Object *obedit = CTX_data_edit_object(C);
        BMEditMesh *em = BMEdit_FromObject(obedit);
        BMesh *bm = em->bm;
        BMVert *start_vert;
        BMOperator bmop;
-       BMEditSelection *ese = em->bm->selected.last;
+       BMEditSelection *ese = (BMEditSelection *)em->bm->selected.last;
 
        float distance_t = 0.0f;
 
        /* Invoked modally? */
-       if (op->type->modal == edbm_vert_slide_modal && op->customdata) {
-               VertexSlideOp *vso = op->customdata;
+       if (op->type->modal == edbm_vertex_slide_modal && op->customdata) {
+               VertexSlideOp *vso = (VertexSlideOp *)op->customdata;
 
                if (bm->totedgesel > 1) {
                        /* Reset selections */
@@ -644,7 +669,7 @@ static int edbm_vert_slide_exec(bContext *C, wmOperator *op)
 
                        EDBM_editselection_store(em, &vso->sel_edge->head);
                        EDBM_editselection_store(em, &vso->start_vtx->head);                    
-                       ese = em->bm->selected.last;
+                       ese = (BMEditSelection *)em->bm->selected.last;
                }
                distance_t = vso->distance;
                RNA_float_set(op->ptr, "distance_t", distance_t);
@@ -663,13 +688,16 @@ static int edbm_vert_slide_exec(bContext *C, wmOperator *op)
        start_vert = (BMVert *)ese->ele;
 
        /* Prepare operator */
-       if (!EDBM_op_init(em, &bmop, op, "vertslide vert=%e edge=%hev distance_t=%f", start_vert, BM_ELEM_SELECT, distance_t))  {
+       if (!EDBM_op_init(em, &bmop, op, "vertex_slide vert=%e edge=%hev distance_t=%f", start_vert, BM_ELEM_SELECT, distance_t))  {
                return OPERATOR_CANCELLED;
        }
        /* Execute operator */
        BMO_op_exec(bm, &bmop);
 
-       /* Select the edge */
+       /* Deselect the input edges */
+       BMO_slot_buffer_hflag_disable(bm, &bmop, "edge", BM_ALL, BM_ELEM_SELECT, TRUE);
+
+       /* Select the output vert */
        BMO_slot_buffer_hflag_enable(bm, &bmop, "vertout", BM_ALL, BM_ELEM_SELECT, TRUE);
 
        /* Flush the select buffers */
@@ -695,12 +723,12 @@ void MESH_OT_vert_slide(wmOperatorType *ot)
        ot->description = "Vertex slide";
 
        /* api callback */
-       ot->invoke = edbm_vert_slide_invoke;
-       ot->modal = edbm_vert_slide_modal;
-       ot->cancel = edbm_vert_slide_cancel;
+       ot->invoke = edbm_vertex_slide_invoke;
+       ot->modal = edbm_vertex_slide_modal;
+       ot->cancel = edbm_vertex_slide_cancel;
        ot->poll = ED_operator_editmesh_region_view3d;
 
-       /* ot->exec = edbm_vert_slide_exec;
+       /* ot->exec = edbm_vertex_slide_exec;
         * ot->poll = ED_operator_editmesh; */
 
        /* flags */
index 4cbce3c3764c1f6d7acce26a828d96477a1ab1cc..5b6811fcc5cba40f868fcd4d1857d0c661e3157f 100644 (file)
 #include "WM_types.h"
 
 #include "ED_mesh.h"
-#include "ED_view3d.h"
+#include "ED_object.h"
 #include "ED_screen.h"
 #include "ED_transform.h"
-#include "ED_object.h"
+#include "ED_uvedit.h"
+#include "ED_view3d.h"
 
 #include "RE_render_ext.h"
 
@@ -142,8 +143,7 @@ void MESH_OT_subdivide(wmOperatorType *ot)
        /* avoid re-using last var because it can cause _very_ high poly meshes and annoy users (or worse crash) */
        RNA_def_property_flag(prop, PROP_SKIP_SAVE);
 
-       /* BMESH_TODO, this currently does nothing, just add to stop UI from erroring out! */
-       RNA_def_float(ot->srna, "smoothness", 0.0f, 0.0f, FLT_MAX, "Smoothness", "Smoothness factor (BMESH TODO)", 0.0f, 1.0f);
+       RNA_def_float(ot->srna, "smoothness", 0.0f, 0.0f, FLT_MAX, "Smoothness", "Smoothness factor", 0.0f, 1.0f);
 
        RNA_def_boolean(ot->srna, "quadtri", 0, "Quad/Tri Mode", "Tries to prevent ngons");
        RNA_def_enum(ot->srna, "quadcorner", prop_mesh_cornervert_types, SUBD_STRAIGHT_CUT,
@@ -537,6 +537,7 @@ void MESH_OT_extrude_region(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Extrude Region";
        ot->idname = "MESH_OT_extrude_region";
+       ot->description = "Extrude region of faces";
        
        /* api callbacks */
        //ot->invoke = mesh_extrude_region_invoke;
@@ -567,6 +568,7 @@ void MESH_OT_extrude_verts_indiv(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Extrude Only Vertices";
        ot->idname = "MESH_OT_extrude_verts_indiv";
+       ot->description = "Extrude individual vertices only";
        
        /* api callbacks */
        ot->exec = edbm_extrude_verts_exec;
@@ -597,6 +599,7 @@ void MESH_OT_extrude_edges_indiv(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Extrude Only Edges";
        ot->idname = "MESH_OT_extrude_edges_indiv";
+       ot->description = "Extrude individual edges only";
        
        /* api callbacks */
        ot->exec = edbm_extrude_edges_exec;
@@ -627,6 +630,7 @@ void MESH_OT_extrude_faces_indiv(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Extrude Individual Faces";
        ot->idname = "MESH_OT_extrude_faces_indiv";
+       ot->description = "Extrude individual faces only";
        
        /* api callbacks */
        ot->exec = edbm_extrude_faces_exec;
@@ -882,10 +886,10 @@ void MESH_OT_dupli_extrude_cursor(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Duplicate or Extrude at 3D Cursor";
        ot->idname = "MESH_OT_dupli_extrude_cursor";
+       ot->description = "Duplicate and extrude selected vertices, edges or faces towards the mouse cursor";
        
        /* api callbacks */
        ot->invoke = edbm_dupli_extrude_cursor_invoke;
-       ot->description = "Duplicate and extrude selected vertices, edges or faces towards the mouse cursor";
        ot->poll = ED_operator_editmesh;
        
        /* flags */
@@ -1056,6 +1060,7 @@ void MESH_OT_edge_face_add(wmOperatorType *ot)
 
 static int edbm_mark_seam(bContext *C, wmOperator *op)
 {
+       Scene *scene = CTX_data_scene(C);
        Object *obedit = CTX_data_edit_object(C);
        Mesh *me = ((Mesh *)obedit->data);
        BMEditMesh *em = BMEdit_FromObject(obedit);
@@ -1085,6 +1090,7 @@ static int edbm_mark_seam(bContext *C, wmOperator *op)
                }
        }
 
+       ED_uvedit_live_unwrap(scene, obedit);
        EDBM_update_generic(C, em, TRUE);
 
        return OPERATOR_FINISHED;
@@ -1095,7 +1101,7 @@ void MESH_OT_mark_seam(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Mark Seam";
        ot->idname = "MESH_OT_mark_seam";
-       ot->description = "(un)mark selected edges as a seam";
+       ot->description = "(Un)mark selected edges as a seam";
        
        /* api callbacks */
        ot->exec = edbm_mark_seam;
@@ -1149,7 +1155,7 @@ void MESH_OT_mark_sharp(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Mark Sharp";
        ot->idname = "MESH_OT_mark_sharp";
-       ot->description = "(un)mark selected edges as sharp";
+       ot->description = "(Un)mark selected edges as sharp";
        
        /* api callbacks */
        ot->exec = edbm_mark_sharp;
@@ -1189,7 +1195,7 @@ void MESH_OT_vert_connect(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Vertex Connect";
        ot->idname = "MESH_OT_vert_connect";
-       ot->description = "Connect 2 vertices in a face with by an edge, splitting the face in half";
+       ot->description = "Connect 2 vertices of a face by an edge, splitting the face in two";
        
        /* api callbacks */
        ot->exec = edbm_vert_connect;
@@ -1414,11 +1420,11 @@ void MESH_OT_hide(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Hide Selection";
        ot->idname = "MESH_OT_hide";
+       ot->description = "Hide (un)selected vertices, edges or faces";
        
        /* api callbacks */
        ot->exec = edbm_hide_exec;
        ot->poll = ED_operator_editmesh;
-       ot->description = "Hide (un)selected vertices, edges or faces";
 
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -1744,6 +1750,7 @@ void MESH_OT_uvs_rotate(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Rotate UVs";
        ot->idname = "MESH_OT_uvs_rotate";
+       ot->description = "Rotate UV coordinates inside faces";
 
        /* api callbacks */
        ot->exec = edbm_rotate_uvs_exec;
@@ -1762,6 +1769,7 @@ void MESH_OT_uvs_reverse(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Reverse UVs";
        ot->idname = "MESH_OT_uvs_reverse";
+       ot->description = "Flip direction of UV coordinates inside faces";
 
        /* api callbacks */
        ot->exec = edbm_reverse_uvs_exec;
@@ -1779,6 +1787,7 @@ void MESH_OT_colors_rotate(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Rotate Colors";
        ot->idname = "MESH_OT_colors_rotate";
+       ot->description = "Rotate vertex colors inside faces";
 
        /* api callbacks */
        ot->exec = edbm_rotate_colors_exec;
@@ -1796,6 +1805,7 @@ void MESH_OT_colors_reverse(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Reverse Colors";
        ot->idname = "MESH_OT_colors_reverse";
+       ot->description = "Flip direction of vertex colors inside faces";
 
        /* api callbacks */
        ot->exec = edbm_reverse_colors_exec;
@@ -2110,6 +2120,7 @@ void MESH_OT_select_vertex_path(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Select Vertex Path";
        ot->idname = "MESH_OT_select_vertex_path";
+       ot->description = "Selected vertex path between two vertices";
 
        /* api callbacks */
        ot->exec = edbm_select_vertex_path_exec;
@@ -4553,11 +4564,11 @@ void MESH_OT_inset(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Inset Faces";
        ot->idname = "MESH_OT_inset";
+       ot->description = "Inset new faces into selected faces";
 
        /* api callbacks */
        ot->exec = edbm_inset_exec;
        ot->poll = ED_operator_editmesh;
-       ot->description = "";
 
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
index 56c7fae00296e439a27452d375287b7ef12e2e33..6511cc713e35756e9e520b712f371921e67f0063 100644 (file)
@@ -313,7 +313,6 @@ void EDBM_mesh_load(Object *ob)
 #ifdef USE_TESSFACE_DEFAULT
        BKE_mesh_tessface_calc(me);
 #endif
-
 }
 
 void EDBM_mesh_free(BMEditMesh *tm)
@@ -517,7 +516,6 @@ static void *getEditMesh(bContext *C)
 typedef struct UndoMesh {
        Mesh me;
        int selectmode;
-       char obname[MAX_ID_NAME - 2];
 } UndoMesh;
 
 /* undo simply makes copies of a bmesh */
@@ -527,7 +525,6 @@ static void *editbtMesh_to_undoMesh(void *emv, void *obdata)
        Mesh *obme = obdata;
        
        UndoMesh *um = MEM_callocN(sizeof(UndoMesh), "undo Mesh");
-       BLI_strncpy(um->obname, em->ob->id.name + 2, sizeof(um->obname));
        
        /* make sure shape keys work */
        um->me.key = obme->key ? copy_key_nolib(obme->key) : NULL;
@@ -544,12 +541,10 @@ static void *editbtMesh_to_undoMesh(void *emv, void *obdata)
 static void undoMesh_to_editbtMesh(void *umv, void *em_v, void *UNUSED(obdata))
 {
        BMEditMesh *em = em_v, *em_tmp;
-       Object *ob;
+       Object *ob = em->ob;
        UndoMesh *um = umv;
        BMesh *bm;
 
-       /* BMESH_TODO - its possible the name wont be found right?, should fallback */
-       ob = (Object *)find_id("OB", um->obname);
        ob->shapenr = em->bm->shapenr;
 
        BMEdit_Free(em);
index 6a074a542c35202e77a3007ffd5d3ab53f611bf9..20fa4c5753f4cf8b88a96cd21c3beb648d8eac22 100644 (file)
 
 static float get_fluid_viscosity(FluidsimSettings *settings)
 {
-       switch (settings->viscosityMode) {
-               case 0:         /* unused */
-                       return -1.0;
-               case 2:         /* water */
-                       return 1.0e-6;
-               case 3:         /* some (thick) oil */
-                       return 5.0e-5;
-               case 4:         /* ca. honey */
-                       return 2.0e-3;
-               case 1:         /* manual */
-               default:
-                       return (1.0f/powf(10.0f, settings->viscosityExponent)) * settings->viscosityValue;
-       }
+       return (1.0f/powf(10.0f, settings->viscosityExponent)) * settings->viscosityValue;
 }
 
 static float get_fluid_rate(FluidsimSettings *settings)
index 18f3094fa318afb684292a0900279ea89be8816b..9f7cc7a75b19bd844b63170b6c8e6ed1624f24a7 100644 (file)
@@ -41,8 +41,9 @@
 #include "MEM_guardedalloc.h"
 
 #ifdef WIN32
-#include "BLI_winstuff.h"
+#  include "BLI_winstuff.h"
 #endif
+
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
 #include "BLI_dynstr.h"
index 6a31e96b51b0ca489fb499796d84eb6390fb78f2..89a46272a8f80feefa42188c0bec55da2ec22638 100644 (file)
@@ -388,8 +388,6 @@ void BRUSH_OT_curve_preset(wmOperatorType *ot)
        ot->exec = brush_curve_preset_exec;
        ot->poll = brush_curve_preset_poll;
 
-       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-
        RNA_def_enum(ot->srna, "shape", prop_shape_items, CURVE_PRESET_SMOOTH, "Mode", "");
 }
 
index 1aeaad1bfabe4aa9964ca62e080880ca376541b6..aad0a778d4b36acd27fc076cceaefc95457f3167 100644 (file)
@@ -2770,9 +2770,7 @@ static void vpaint_paint_face(VPaint *vp, VPaintData *vpd, Object *ob,
 
 static void vpaint_paint_poly(VPaint *vp, VPaintData *vpd, Object *ob,
                               const unsigned int index, const float mval[2],
-                              const float brush_size_pressure, const float brush_alpha_pressure,
-                              int UNUSED(flip)
-                              )
+                              const float brush_size_pressure, const float brush_alpha_pressure)
 {
        ViewContext *vc = &vpd->vc;
        Brush *brush = paint_brush(&vp->paint);
@@ -2871,7 +2869,7 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
        Mesh *me = ob->data;
        float mat[4][4];
        int *indexar = vpd->indexar;
-       int totindex, index, flip;
+       int totindex, index;
        float mval[2];
 
        const float pressure = RNA_float_get(itemptr, "pressure");
@@ -2879,9 +2877,6 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
        const float brush_alpha_pressure = brush_alpha(scene, brush) * (brush_use_alpha_pressure(scene, brush) ? pressure : 1.0f);
 
        RNA_float_get_array(itemptr, "mouse", mval);
-       flip = RNA_boolean_get(itemptr, "pen_flip");
-
-       (void)flip; /* BMESH_TODO */
 
        view3d_operator_needs_opengl(C);
                        
@@ -2932,7 +2927,7 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
        for (index = 0; index < totindex; index++) {
                                
                if (indexar[index] && indexar[index] <= me->totpoly) {
-                       vpaint_paint_poly(vp, vpd, ob, indexar[index] - 1, mval, brush_size_pressure, brush_alpha_pressure, flip);
+                       vpaint_paint_poly(vp, vpd, ob, indexar[index] - 1, mval, brush_size_pressure, brush_alpha_pressure);
                }
        }
                
index 336ff07a1ad65d153f6df3ba88f826cda6ce929e..fa2085ac9303e6af7c33f75dcab0cc43a8d657f2 100644 (file)
@@ -2452,7 +2452,7 @@ void CLIP_OT_set_plane(wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
        /* properties */
-       RNA_def_enum(ot->srna, "plane", plane_items, 0, "Plane", "Plane to be sued for orientation");
+       RNA_def_enum(ot->srna, "plane", plane_items, 0, "Plane", "Plane to be used for orientation");
 }
 
 /********************** set axis operator *********************/
@@ -3536,8 +3536,10 @@ void CLIP_OT_clean_tracks(wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
 
        /* properties */
-       RNA_def_int(ot->srna, "frames", 0, 0, INT_MAX, "Tracked Frames", "Effect on tracks which are tracked less than specified amount of frames", 0, INT_MAX);
-       RNA_def_float(ot->srna, "error", 0.0f, 0.0f, FLT_MAX, "Reprojection Error", "Effect on tracks with have got larger re-projection error", 0.0f, 100.0f);
+       RNA_def_int(ot->srna, "frames", 0, 0, INT_MAX, "Tracked Frames",
+                   "Effect on tracks which are tracked less than specified amount of frames", 0, INT_MAX);
+       RNA_def_float(ot->srna, "error", 0.0f, 0.0f, FLT_MAX, "Reprojection Error",
+                     "Effect on tracks which have got larger re-projection error", 0.0f, 100.0f);
        RNA_def_enum(ot->srna, "action", actions_items, 0, "Action", "Cleanup action to execute");
 }
 
index b71ca6c36c4f8fcb0a1d8a524f17c10e0e499a6a..39757aa393a588e74f7c9ca14f5d39a13b8b6e2c 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdio.h>