Merging r45810 through r45876 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 23 Apr 2012 10:19:59 +0000 (10:19 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 23 Apr 2012 10:19:59 +0000 (10:19 +0000)
245 files changed:
CMakeLists.txt
build_files/cmake/macros.cmake
build_files/scons/config/win32-mingw-config.py
doc/python_api/examples/bpy.types.Mesh.py [new file with mode: 0644]
doc/python_api/rst/include__bmesh.rst
doc/python_api/rst/info_gotcha.rst
doc/python_api/sphinx_doc_gen.py
intern/elbeem/intern/ntl_world.cpp
intern/elbeem/intern/solver_init.cpp
release/scripts/startup/bl_operators/mesh.py
release/scripts/startup/bl_operators/object.py
release/scripts/startup/bl_operators/presets.py
release/scripts/startup/bl_operators/uvcalc_follow_active.py
release/scripts/startup/bl_operators/uvcalc_lightmap.py
release/scripts/startup/bl_operators/uvcalc_smart_project.py
release/scripts/startup/bl_ui/properties_data_armature.py
release/scripts/startup/bl_ui/properties_game.py
release/scripts/startup/bl_ui/properties_particle.py
release/scripts/startup/bl_ui/properties_physics_fluid.py
source/blender/blenkernel/BKE_armature.h
source/blender/blenkernel/BKE_mesh.h
source/blender/blenkernel/BKE_particle.h
source/blender/blenkernel/BKE_pointcache.h
source/blender/blenkernel/BKE_subsurf.h
source/blender/blenkernel/intern/CCGSubSurf.c
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/action.c
source/blender/blenkernel/intern/anim.c
source/blender/blenkernel/intern/boids.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/cloth.c
source/blender/blenkernel/intern/collision.c
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/editderivedmesh.c
source/blender/blenkernel/intern/effect.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/implicit.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/material.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/mesh_validate.c
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/multires.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/paint.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/seqeffects.c
source/blender/blenkernel/intern/sequencer.c
source/blender/blenkernel/intern/shrinkwrap.c
source/blender/blenkernel/intern/softbody.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenkernel/intern/texture.c
source/blender/blenkernel/intern/unit.c
source/blender/blenkernel/intern/writeffmpeg.c
source/blender/blenkernel/intern/writeframeserver.c
source/blender/blenlib/BLI_array.h
source/blender/blenlib/BLI_pbvh.h
source/blender/blenlib/intern/BLI_kdopbvh.c
source/blender/blenlib/intern/BLI_kdtree.c
source/blender/blenlib/intern/fileops.c
source/blender/blenlib/intern/fnmatch.c
source/blender/blenlib/intern/math_color_inline.c
source/blender/blenlib/intern/math_geom.c
source/blender/blenlib/intern/pbvh.c
source/blender/blenlib/intern/rand.c
source/blender/blenlib/intern/scanfill.c
source/blender/blenlib/intern/storage.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/bmesh/CMakeLists.txt
source/blender/bmesh/SConscript
source/blender/bmesh/intern/bmesh_core.c
source/blender/bmesh/intern/bmesh_marking.c
source/blender/bmesh/intern/bmesh_mesh.c
source/blender/bmesh/intern/bmesh_mesh.h
source/blender/bmesh/intern/bmesh_mesh_conv.c
source/blender/bmesh/intern/bmesh_mods.c
source/blender/bmesh/intern/bmesh_mods.h
source/blender/bmesh/intern/bmesh_opdefines.c
source/blender/bmesh/intern/bmesh_operator_api.h
source/blender/bmesh/intern/bmesh_operators.h
source/blender/bmesh/intern/bmesh_polygon.c
source/blender/bmesh/intern/bmesh_polygon.h
source/blender/bmesh/intern/bmesh_private.h
source/blender/bmesh/intern/bmesh_queries.c
source/blender/bmesh/intern/bmesh_queries.h
source/blender/bmesh/operators/bmo_create.c
source/blender/bmesh/operators/bmo_dissolve.c
source/blender/bmesh/operators/bmo_extrude.c
source/blender/bmesh/operators/bmo_inset.c
source/blender/bmesh/operators/bmo_primitive.c
source/blender/bmesh/operators/bmo_removedoubles.c
source/blender/bmesh/operators/bmo_slide.c
source/blender/bmesh/operators/bmo_subdivide.c
source/blender/bmesh/operators/bmo_subdivide.h
source/blender/bmesh/operators/bmo_triangulate.c
source/blender/bmesh/operators/bmo_utils.c
source/blender/bmesh/tools/BME_bevel.c
source/blender/editors/armature/meshlaplacian.c
source/blender/editors/armature/poselib.c
source/blender/editors/curve/editcurve.c
source/blender/editors/include/BIF_glutil.h
source/blender/editors/include/ED_mesh.h
source/blender/editors/include/ED_numinput.h
source/blender/editors/include/ED_view3d.h
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_templates.c
source/blender/editors/interface/interface_utils.c
source/blender/editors/interface/view2d.c
source/blender/editors/mesh/editface.c
source/blender/editors/mesh/editmesh_knife.c
source/blender/editors/mesh/editmesh_loopcut.c
source/blender/editors/mesh/editmesh_rip.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/mesh/mesh_data.c
source/blender/editors/mesh/mesh_intern.h
source/blender/editors/mesh/mesh_ops.c
source/blender/editors/object/object_bake.c
source/blender/editors/object/object_hook.c
source/blender/editors/object/object_relations.c
source/blender/editors/object/object_select.c
source/blender/editors/object/object_vgroup.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/render/render_internal.c
source/blender/editors/render/render_opengl.c
source/blender/editors/render/render_preview.c
source/blender/editors/render/render_update.c
source/blender/editors/screen/glutil.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/sculpt_paint/paint_hide.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/sculpt_paint/sculpt_uv.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_image/image_buttons.c
source/blender/editors/space_image/space_image.c
source/blender/editors/space_logic/logic_window.c
source/blender/editors/space_node/node_draw.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_node/node_select.c
source/blender/editors/space_outliner/outliner_tools.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_sequencer/sequencer_scopes.c
source/blender/editors/space_sequencer/sequencer_select.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/space_view3d/view3d_view.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/util/ed_util.c
source/blender/editors/util/undo.c
source/blender/editors/uvedit/uvedit_draw.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/editors/uvedit/uvedit_parametrizer.c
source/blender/editors/uvedit/uvedit_smart_stitch.c
source/blender/editors/uvedit/uvedit_unwrap_ops.c
source/blender/gpu/intern/gpu_buffers.c
source/blender/gpu/intern/gpu_codegen.c
source/blender/gpu/intern/gpu_extensions.c
source/blender/gpu/intern/gpu_material.c
source/blender/ikplugin/intern/iksolver_plugin.c
source/blender/imbuf/intern/anim_movie.c
source/blender/imbuf/intern/bmp.c
source/blender/imbuf/intern/indexer.c
source/blender/imbuf/intern/jp2.c
source/blender/imbuf/intern/png.c
source/blender/imbuf/intern/util.c
source/blender/makesdna/DNA_key_types.h
source/blender/makesdna/DNA_meshdata_types.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_sequence_types.h
source/blender/makesdna/intern/makesdna.c
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_actuator.c
source/blender/makesrna/intern/rna_brush.c
source/blender/makesrna/intern/rna_curve.c
source/blender/makesrna/intern/rna_image.c
source/blender/makesrna/intern/rna_image_api.c
source/blender/makesrna/intern/rna_key.c
source/blender/makesrna/intern/rna_main_api.c
source/blender/makesrna/intern/rna_mesh.c
source/blender/makesrna/intern/rna_meta.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_object_api.c
source/blender/makesrna/intern/rna_particle.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_sequencer_api.c
source/blender/makesrna/intern/rna_texture.c
source/blender/makesrna/intern/rna_tracking.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/modifiers/intern/MOD_array.c
source/blender/modifiers/intern/MOD_explode.c
source/blender/modifiers/intern/MOD_shrinkwrap.c
source/blender/modifiers/intern/MOD_weightvg_util.c
source/blender/nodes/composite/nodes/node_composite_image.c
source/blender/nodes/composite/nodes/node_composite_math.c
source/blender/nodes/intern/node_common.c
source/blender/nodes/shader/nodes/node_shader_geom.c
source/blender/python/bmesh/bmesh_py_types.c
source/blender/python/bmesh/bmesh_py_utils.c
source/blender/python/intern/bpy.c
source/blender/python/intern/bpy_interface.c
source/blender/python/mathutils/mathutils.c
source/blender/python/mathutils/mathutils.h
source/blender/python/mathutils/mathutils_geometry.c
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/rayshade.c
source/blender/render/intern/source/render_texture.c
source/blender/render/intern/source/renderdatabase.c
source/blender/render/intern/source/shadbuf.c
source/blender/render/intern/source/shadeinput.c
source/blender/render/intern/source/shadeoutput.c
source/blender/render/intern/source/sss.c
source/blender/render/intern/source/strand.c
source/blender/render/intern/source/volume_precache.c
source/blender/windowmanager/intern/wm_keymap.c
source/blender/windowmanager/intern/wm_operators.c
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Converter/KX_BlenderSceneConverter.cpp
source/gameengine/Ketsji/KX_ObstacleSimulation.h
source/gameengine/Ketsji/KX_PhysicsEngineEnums.h
source/gameengine/Ketsji/KX_PolygonMaterial.cpp
source/gameengine/Ketsji/KX_PolygonMaterial.h
source/gameengine/Ketsji/KX_SteeringActuator.cpp
source/gameengine/Ketsji/KX_SteeringActuator.h
source/gameengine/Rasterizer/RAS_FramingManager.h
source/gameengine/SceneGraph/SG_ParentRelation.h
source/tests/bl_mesh_modifiers.py

index 2669f2ff93f95f70bdc1ca8f144339cfbd289f04..1595e78ea4ceb7c172413720544bb3cca1967bef 100644 (file)
@@ -370,11 +370,6 @@ if(MINGW)
                                    "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)
@@ -740,14 +735,18 @@ elseif(WIN32)
        # this file is included anyway when building under Windows with cl.exe
        #  include(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
 
-       set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows)
+       if(CMAKE_COMPILER_IS_GNUCC)
+               set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32)
+       else()
+               set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/windows)
 
-       # Setup 64bit and 64bit windows systems
-       if(CMAKE_CL_64)
-               message("64 bit compiler detected.")
-               set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win64)
+               # Setup 64bit and 64bit windows systems
+               if(CMAKE_CL_64)
+                       message("64 bit compiler detected.")
+                       set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win64)
+               endif()
        endif()
-
+               
        add_definitions(-DWIN32)
 
        if(WITH_INTERNATIONAL)
@@ -995,25 +994,26 @@ elseif(WIN32)
 
                set(PLATFORM_LINKFLAGS_DEBUG "/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
 
-       else()
-               # keep GCC specific stuff here
-               if(CMAKE_COMPILER_IS_GNUCC)
-                       set(PLATFORM_LINKLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi")
-                       set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
+       elseif(CMAKE_COMPILER_IS_GNUCC)
+       # keep GCC specific stuff here
+               set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32)
+               
+               set(PLATFORM_LINKLIBS "-lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32 -lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi")
+               set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
+
+               add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
 
-                       add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
-               endif()
 
                add_definitions(-DFREE_WINDOWS)
 
                if(WITH_INTERNATIONAL)
-                       set(GETTEXT ${LIBDIR}/gcc/gettext)
+                       set(GETTEXT ${LIBDIR}/gettext)
                        set(GETTEXT_INCLUDE_DIRS ${GETTEXT}/include)
                        set(GETTEXT_LIBPATH ${GETTEXT}/lib)
                        set(GETTEXT_LIBRARIES intl)
                endif()
                
-               set(PNG "${LIBDIR}/gcc/png")
+               set(PNG "${LIBDIR}/png")
                set(PNG_INCLUDE_DIR "${PNG}/include")
                set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
 
@@ -1030,26 +1030,26 @@ elseif(WIN32)
                set(PTHREADS_LIBPATH ${PTHREADS}/lib)
                set(PTHREADS_LIBRARIES pthreadGC2)
 
-               set(FREETYPE ${LIBDIR}/gcc/freetype)
+               set(FREETYPE ${LIBDIR}/freetype)
                set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
                set(FREETYPE_LIBPATH ${FREETYPE}/lib)
                set(FREETYPE_LIBRARY freetype)
 
                if(WITH_FFTW3)
-                       set(FFTW3 ${LIBDIR}/gcc/fftw3)
+                       set(FFTW3 ${LIBDIR}/fftw3)
                        set(FFTW3_LIBRARIES fftw3)
                        set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
                        set(FFTW3_LIBPATH ${FFTW3}/lib)
                endif()
 
                if(WITH_OPENCOLLADA)
-                       set(OPENCOLLADA ${LIBDIR}/gcc/opencollada)
+                       set(OPENCOLLADA ${LIBDIR}/opencollada)
                        set(OPENCOLLADA_INCLUDE_DIRS
-                               ${LIBDIR}/gcc/opencollada/include/COLLADAStreamWriter/include
-                               ${LIBDIR}/gcc/opencollada/include/COLLADABaseUtils/include
-                               ${LIBDIR}/gcc/opencollada/include/COLLADAFramework/include
-                               ${LIBDIR}/gcc/opencollada/include/COLLADASaxFrameworkLoader/include
-                               ${LIBDIR}/gcc/opencollada/include/GeneratedSaxParser/include
+                               ${LIBDIR}/opencollada/include/COLLADAStreamWriter/include
+                               ${LIBDIR}/opencollada/include/COLLADABaseUtils/include
+                               ${LIBDIR}/opencollada/include/COLLADAFramework/include
+                               ${LIBDIR}/opencollada/include/COLLADASaxFrameworkLoader/include
+                               ${LIBDIR}/opencollada/include/GeneratedSaxParser/include
                        )
                        set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib ${OPENCOLLADA}/lib)
                        set(OPENCOLLADA_LIBRARIES OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver expat pcre buffer ftoa)
@@ -1064,14 +1064,14 @@ elseif(WIN32)
                endif()
 
                if(WITH_IMAGE_OPENEXR)
-                       set(OPENEXR ${LIBDIR}/gcc/openexr)
+                       set(OPENEXR ${LIBDIR}/openexr)
                        set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
                        set(OPENEXR_LIBRARIES Half IlmImf Imath IlmThread Iex)
                        set(OPENEXR_LIBPATH ${OPENEXR}/lib)
                endif()
 
                if(WITH_IMAGE_TIFF)
-                       set(TIFF ${LIBDIR}/gcc/tiff)
+                       set(TIFF ${LIBDIR}/tiff)
                        set(TIFF_LIBRARY tiff)
                        set(TIFF_INCLUDE_DIR ${TIFF}/include)
                        set(TIFF_LIBPATH ${TIFF}/lib)
@@ -1108,12 +1108,12 @@ elseif(WIN32)
                                boost_regex-${BOOST_POSTFIX} boost_system-${BOOST_POSTFIX} boost_thread-${BOOST_POSTFIX}
                                debug boost_date_time-${BOOST_DEBUG_POSTFIX} boost_filesystem-${BOOST_DEBUG_POSTFIX}
                                boost_regex-${BOOST_DEBUG_POSTFIX} boost_system-${BOOST_DEBUG_POSTFIX} boost_thread-${BOOST_DEBUG_POSTFIX})
-                       set(BOOST_LIBPATH ${BOOST}/lib/gcc)
+                       set(BOOST_LIBPATH ${BOOST}/lib)
                        set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB -DBOOST_THREAD_USE_LIB ")
                endif()
                        
                if(WITH_OPENIMAGEIO)
-                       set(OPENIMAGEIO ${LIBDIR}/gcc/openimageio)
+                       set(OPENIMAGEIO ${LIBDIR}/openimageio)
                        set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
                        set(OPENIMAGEIO_LIBRARIES OpenImageIO)
                        set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
@@ -1137,7 +1137,7 @@ elseif(APPLE)
                set(WITH_LIBS10.5 ON CACHE BOOL "Use 10.5 libs" FORCE) # valid also for 10.6/10.7
        endif()
 
-       if(${XCODE_VERSION} LESS 4.3)
+       if(${XCODE_VERSION} VERSION_LESS 4.3)
                SET(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk CACHE PATH "" FORCE ) # use guaranteed existing sdk
        else()
                # note: i don't use xcode-select path on purpose, cause also /Applications/Xcode.app would be allowed
index 406f2537dce748b622f243394cf99f24f20f35a8..eeefcf730c85812e66cbe2d58ebbe867a732f834 100644 (file)
@@ -212,11 +212,9 @@ macro(setup_liblinks
        target_link_libraries(${target}
                        ${OPENGL_gl_LIBRARY}
                        ${OPENGL_glu_LIBRARY}
-                       ${JPEG_LIBRARIES}
                        ${PNG_LIBRARIES}
                        ${ZLIB_LIBRARIES}
-                       ${FREETYPE_LIBRARY}
-                       ${PLATFORM_LINKLIBS})
+                       ${FREETYPE_LIBRARY})
 
        # since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
        if(WITH_PYTHON)  # AND NOT WITH_PYTHON_MODULE  # WIN32 needs
@@ -271,6 +269,7 @@ macro(setup_liblinks
        if(WITH_BOOST)
                target_link_libraries(${target} ${BOOST_LIBRARIES})
        endif()
+       target_link_libraries(${target} ${JPEG_LIBRARIES})
        if(WITH_IMAGE_OPENEXR)
                if(WIN32 AND NOT UNIX AND NOT CMAKE_COMPILER_IS_GNUCC)
                        file_list_suffix(OPENEXR_LIBRARIES_DEBUG "${OPENEXR_LIBRARIES}" "_d")
@@ -328,6 +327,8 @@ macro(setup_liblinks
        if(WIN32 AND NOT UNIX)
                target_link_libraries(${target} ${PTHREADS_LIBRARIES})
        endif()
+
+       target_link_libraries(${target} ${PLATFORM_LINKLIBS})
 endmacro()
 
 macro(TEST_SSE_SUPPORT
@@ -677,4 +678,4 @@ macro(set_lib_path
        endif()
 
 
-endmacro()
\ No newline at end of file
+endmacro()
index 855f643129a23ccb5163da45ae65176ff0ed125a..576415559878a83fda2837bcef0e3d0fc11680e7 100644 (file)
@@ -1,4 +1,4 @@
-LCGDIR = '#../lib/windows'
+LCGDIR = '#../lib/mingw32'
 LIBDIR = "${LCGDIR}"
 
 BF_PYTHON = LIBDIR + '/python'
@@ -48,7 +48,7 @@ BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
 
 WITH_BF_OPENEXR = True
 WITH_BF_STATICOPENEXR = False
-BF_OPENEXR = LIBDIR + '/gcc/openexr'
+BF_OPENEXR = LIBDIR + '/openexr'
 BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
 BF_OPENEXR_LIB = 'Half IlmImf Imath IlmThread Iex'
 BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
@@ -64,13 +64,13 @@ BF_JPEG_LIB = 'liblibjpeg'
 BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
 
 WITH_BF_PNG = True
-BF_PNG = LIBDIR + '/gcc/png'
+BF_PNG = LIBDIR + '/png'
 BF_PNG_INC = '${BF_PNG}/include'
 BF_PNG_LIB = 'png'
 BF_PNG_LIBPATH = '${BF_PNG}/lib'
 
 WITH_BF_TIFF = True
-BF_TIFF = LIBDIR + '/gcc/tiff'
+BF_TIFF = LIBDIR + '/tiff'
 BF_TIFF_INC = '${BF_TIFF}/include'
 BF_TIFF_LIB = 'tiff'
 BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
@@ -83,7 +83,7 @@ BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
 
 WITH_BF_INTERNATIONAL = True
 
-BF_GETTEXT = LIBDIR + '/gcc/gettext'
+BF_GETTEXT = LIBDIR + '/gettext'
 BF_GETTEXT_INC = '${BF_GETTEXT}/include'
 BF_GETTEXT_LIB = 'intl'
 BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
@@ -95,7 +95,7 @@ BF_OPENJPEG_INC = '${BF_OPENJPEG}'
 BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
 
 WITH_BF_FFTW3 = True
-BF_FFTW3 = LIBDIR + '/gcc/fftw3'
+BF_FFTW3 = LIBDIR + '/fftw3'
 BF_FFTW3_INC = '${BF_FFTW3}/include'
 BF_FFTW3_LIB = 'fftw3'
 BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
@@ -112,7 +112,7 @@ BF_BULLET_LIB = 'extern_bullet'
 BF_WINTAB = LIBDIR + '/wintab'
 BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
 
-BF_FREETYPE = LIBDIR + '/gcc/freetype'
+BF_FREETYPE = LIBDIR + '/freetype'
 BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
 BF_FREETYPE_LIB = 'freetype'
 BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
@@ -145,7 +145,7 @@ BF_COLLADA = '#source/blender/collada'
 BF_COLLADA_INC = '${BF_COLLADA}'
 BF_COLLADA_LIB = 'bf_collada'
 
-BF_OPENCOLLADA = LIBDIR + '/gcc/opencollada'
+BF_OPENCOLLADA = LIBDIR + '/opencollada'
 BF_OPENCOLLADA_INC = '${BF_OPENCOLLADA}/include'
 BF_OPENCOLLADA_LIB = 'OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver expat pcre buffer ftoa'
 BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
@@ -154,7 +154,7 @@ BF_OPENCOLLADA_LIBPATH = '${BF_OPENCOLLADA}/lib'
 WITH_BF_CYCLES = True 
 
 WITH_BF_OIIO = True
-BF_OIIO = LIBDIR + '/gcc/openimageio'
+BF_OIIO = LIBDIR + '/openimageio'
 BF_OIIO_INC = BF_OIIO + '/include'
 BF_OIIO_LIB = 'OpenImageIO'
 BF_OIIO_LIBPATH = BF_OIIO + '/lib'
@@ -163,7 +163,7 @@ WITH_BF_BOOST = True
 BF_BOOST = LIBDIR + '/boost'
 BF_BOOST_INC = BF_BOOST + '/include'
 BF_BOOST_LIB = 'boost_date_time-mgw46-mt-s-1_47 boost_filesystem-mgw46-mt-s-1_47 boost_regex-mgw46-mt-s-1_47 boost_system-mgw46-mt-s-1_47 boost_thread-mgw46-mt-s-1_47'
-BF_BOOST_LIBPATH = BF_BOOST + '/lib/gcc'
+BF_BOOST_LIBPATH = BF_BOOST + '/lib'
 
 #Ray trace optimization
 WITH_BF_RAYOPTIMIZATION = True
diff --git a/doc/python_api/examples/bpy.types.Mesh.py b/doc/python_api/examples/bpy.types.Mesh.py
new file mode 100644 (file)
index 0000000..69edf2c
--- /dev/null
@@ -0,0 +1,41 @@
+"""
+Mesh Data
++++++++++
+
+The mesh data is accessed in object mode and intended for compact storage,
+for more flexible mesh editing from python see :mod:`bmesh`.
+
+Blender stores 4 main arrays to define mesh geometry.
+
+* :class:`Mesh.vertices` (3 points in space)
+* :class:`Mesh.edges` (reference 2 vertices)
+* :class:`Mesh.loops` (reference a single vertex and edge)
+* :class:`Mesh.polygons`: (reference a range of loops)
+
+
+Each polygon reference a slice in the loop array, this way, polygons do not store vertices or corner data such as UV's directly,
+only a reference to loops that the polygon uses.
+
+:class:`Mesh.loops`, :class:`Mesh.uv_layers` :class:`Mesh.vertex_colors` are all aligned so the same polygon loop
+indicies can be used to find the UV's and vertex colors as with as the vertices.
+
+To compare mesh API options see: :ref:`NGons and Tessellation Faces <info_gotcha_mesh_faces>`
+
+
+This example script prints the vertices and UV's for each polygon, assumes the active object is a mesh with UVs.
+"""
+
+import bpy
+
+me = bpy.context.object.data
+uv_layer = me.uv.layers.active.data
+
+for poly in me.polygons:
+    print("Polygon index: %d, length: %d" % (poly.index, poly.loop_total))
+
+    # range is used here to show how the polygons reference loops,
+    # for convenience 'poly.loop_indices' can be used instead.
+    for loop_index in range(poly.loop_start, poly.loop_start + poly.loop_total):
+        print("    Vertex: %d" % me.loops[loop_index].vertex_index)
+        print("    UV: %r" % uv_layer[loop_index].uv)
+    
index 24f113e7b50e60faf7384be8d392713e3420b65d..212ab4e4708466c3092375b79ca6b00ba0061758 100644 (file)
@@ -32,12 +32,11 @@ For an overview of BMesh data types and how they reference each other see:
 
 .. warning::
 
-   TODO Items Are
+   TODO items are...
 
    * add access to BMesh **walkers**
-   * add a way to re-tessellate an editmode bmesh.
-   * add deform vert custom-data access.
-
+   * add api for calling BMesh operators (unrelated to bpy.ops)
+   * add custom-data manipulation functions add/remove/rename.
 
 Example Script
 --------------
@@ -110,8 +109,8 @@ Here are some examples ...
    shape_lay = bm.verts.layers.shape["Key.001"]
 
    for vert in bm.verts:
-               shape = vert[shape_lay]
-        print("Vert Shape: %f, %f, %f" % (shape.x, shape.y, shape.z))
+       shape = vert[shape_lay]
+       print("Vert Shape: %f, %f, %f" % (shape.x, shape.y, shape.z))
 
 
 .. code-block:: python
@@ -125,7 +124,7 @@ Here are some examples ...
 
    for vert in bm.verts:
        dvert = vert[dvert_lay]
-               
+
        if group_index in dvert:
            print("Weight %f" % dvert[group_index])
        else:
index 25ef5175976fa90c5f899bf7ad127984d92ccbc2..eb312799b41a59a85d8e495942f8b9ef97a6c1d1 100644 (file)
@@ -132,6 +132,8 @@ write useful tools in python which are also fast to execute while in edit-mode.
 For the time being this limitation just has to be worked around but we're aware its frustrating needs to be addressed.
 
 
+.. _info_gotcha_mesh_faces:
+
 NGons and Tessellation Faces
 ============================
 
index cb03907c194330d330f11563a2731c917915b320..bfef94b35d7d79df486ad0c28e32c9178ead6537 100644 (file)
@@ -131,7 +131,7 @@ def handle_args():
                         dest="sphinx_theme",
                         type=str,
                         default='default',
-                        help =
+                        help=
                         # see SPHINX_THEMES below
                         "Sphinx theme (default='default')\n"
                         "Available themes\n"
@@ -230,10 +230,10 @@ if not ARGS.partial:
 
 else:
     # can manually edit this too:
-    FILTER_BPY_OPS = ("import.scene", )  # allow
-    FILTER_BPY_TYPES = ("bpy_struct", "Operator", "ID")  # allow
+    #FILTER_BPY_OPS = ("import.scene", )  # allow
+    #FILTER_BPY_TYPES = ("bpy_struct", "Operator", "ID")  # allow
     EXCLUDE_INFO_DOCS = True
-    EXCLUDE_MODULES = (
+    EXCLUDE_MODULES = [
         "aud",
         "bge",
         "bge.constraints",
@@ -261,7 +261,7 @@ else:
         "mathutils",
         "mathutils.geometry",
         "mathutils.noise",
-    )
+        ]
 
     # ------
     # Filter
@@ -269,7 +269,18 @@ else:
     # TODO, support bpy.ops and bpy.types filtering
     import fnmatch
     m = None
-    EXCLUDE_MODULES = tuple([m for m in EXCLUDE_MODULES if not fnmatch.fnmatchcase(m, ARGS.partial)])
+    EXCLUDE_MODULES = [m for m in EXCLUDE_MODULES if not fnmatch.fnmatchcase(m, ARGS.partial)]
+
+    # special support for bpy.types.XXX
+    FILTER_BPY_OPS = tuple([m[8:] for m in ARGS.partial.split(":") if m.startswith("bpy.ops.")])
+    if FILTER_BPY_OPS:
+        EXCLUDE_MODULES.remove("bpy.ops")
+
+    FILTER_BPY_TYPES = tuple([m[10:] for m in ARGS.partial.split(":") if m.startswith("bpy.types.")])
+    if FILTER_BPY_TYPES:
+        EXCLUDE_MODULES.remove("bpy.types")
+
+    print(FILTER_BPY_TYPES)
 
     EXCLUDE_INFO_DOCS = (not fnmatch.fnmatchcase("info", ARGS.partial))
 
index 42ee94b2cf59d32db33af75106f9e0f09465982b..3b649c9f5b9fe265280f0ffe07a0493daf81f54a 100644 (file)
@@ -400,8 +400,8 @@ int ntlWorld::advanceSims(int framenum)
        bool done = false;
        bool allPanic = true;
 
-       // stop/quit, dont display/render
-       if(getElbeemState()==SIMWORLD_STOP) { 
+       // stop/quit (abort), dont display/render
+       if(!isSimworldOk()) { 
                return 1;
        }
 
@@ -411,6 +411,9 @@ int ntlWorld::advanceSims(int framenum)
        // time stopped? nothing else to do...
        if( (*mpSims)[mFirstSim]->getFrameTime(framenum) <= 0.0 ){ 
                done=true; allPanic=false; 
+
+               /* DG: Need to check for user cancel here (fix for [#30298]) */
+               (*mpSims)[mFirstSim]->checkCallerStatus(FLUIDSIM_CBSTATUS_STEP, 0);
        }
 
        int gstate = 0;
index 58f45e4fbfb4ef839515911efa96c9c932b750d1..7e9f5e7f4202e0d085d925623ecb05e74ceaae3b 100644 (file)
@@ -1453,9 +1453,7 @@ 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; }
-                       /* 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;
+                       if((!active) && (otype&(CFMbndOutflow|CFMbndInflow)) ) continue;
 
                        // copied from  recalculateObjectSpeeds
                        mObjectSpeeds[OId] = vec2L(mpParam->calculateLattVelocityFromRw( vec2P( (*mpGiObjects)[OId]->getInitialVelocity(mSimulationTime) )));
index 2d4c703dbf23a5f5b72ec2457601b6d5460437eb..4ed43a68e4811d02b5d5e4983132d8b16cc31094 100644 (file)
@@ -79,7 +79,7 @@ class MeshMirrorUV(Operator):
         polys = mesh.polygons
         loops = mesh.loops
         verts = mesh.vertices
-        uv_loops = mesh.uv_loop_layers.active.data
+        uv_loops = mesh.uv_layers.active.data
         nbr_polys = len(polys)
 
         mirror_pm = {}
@@ -100,7 +100,7 @@ class MeshMirrorUV(Operator):
             vidxs[i] = tuple(sorted(l.vertex_index
                                     for l in loops[lstart:lend]))
             # As we have no poly.center yet...
-            pcents[i] = tuple(map(lambda x : x / p.loop_total,
+            pcents[i] = tuple(map(lambda x: x / p.loop_total,
                                   map(sum, zip(*(verts[idx].co
                                                  for idx in vidxs[i])))))
             # Preparing next step finding matching polys.
index 4ade55c0af678872a0f0d2a36bedfe0d877f6629..8268d7a9514ff55f03545cf82b9fd89debbd2926 100644 (file)
@@ -489,7 +489,7 @@ class JoinUVs(Operator):
 
             # seems to be the fastest way to create an array
             uv_array = array.array('f', [0.0] * 2) * nbr_loops
-            mesh.uv_loop_layers.active.data.foreach_get("uv", uv_array)
+            mesh.uv_layers.active.data.foreach_get("uv", uv_array)
 
             objects = context.selected_editable_objects[:]
 
@@ -516,10 +516,10 @@ class JoinUVs(Operator):
                                                ),
                                            )
                             else:
-                                uv_other = mesh_other.uv_loop_layers.active
+                                uv_other = mesh_other.uv_layers.active
                                 if not uv_other:
                                     mesh_other.uv_textures.new()
-                                    uv_other = mesh_other.uv_loop_layers.active
+                                    uv_other = mesh_other.uv_layers.active
                                     if not uv_other:
                                         self.report({'ERROR'}, "Could not add "
                                                     "a new UV map tp object "
index 2c92fccf3b4eae43bcf985a9b6d29335a84e37c8..6297945f8bd073bdb2b28859c844e1de10607fe2 100644 (file)
@@ -294,21 +294,22 @@ 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"
 
 
index 99ae5a3e436960a0bba9d6aa861e8596bc914e9b..d6f657683a58d65caf876ba63b1b959dc9c567ad 100644 (file)
@@ -59,7 +59,7 @@ def extend(obj, operator, EXTEND_MODE):
         vidx_source = face_source.vertices
         vidx_target = face_target.vertices
 
-        uv_layer = me.uv_loop_layers.active.data
+        uv_layer = me.uv_layers.active.data
         uvs_source = [uv_layer[i].uv for i in face_source.loop_indices]
         uvs_target = [uv_layer[i].uv for i in face_target.loop_indices]
 
index 417ae89218c7545984df914eab6fdcd4b457bff8..3bd0d6fa4ccbc7a62267fec41fae8d91f65befb2 100644 (file)
@@ -88,7 +88,7 @@ class prettyface(object):
             self.children = []
 
         else:  # blender face
-            uv_layer = data.id_data.uv_loop_layers.active.data
+            uv_layer = data.id_data.uv_layers.active.data
             self.uv = [uv_layer[i].uv for i in data.loop_indices]
 
             # cos = [v.co for v in data]
@@ -158,7 +158,7 @@ class prettyface(object):
                 I = [i for a, i in angles_co]
 
                 #~ fuv = f.uv
-                uv_layer = f.id_data.uv_loop_layers.active.data
+                uv_layer = f.id_data.uv_layers.active.data
                 fuv = [uv_layer[i].uv for i in f.loops]  # XXX25
 
                 if self.rot:
index bb3086f711be03d90580b898d072386eb755bba1..1e18825a155ea63a21267ad32488011e13b62645 100644 (file)
@@ -889,7 +889,7 @@ def main(context,
         if not me.uv_textures: # Mesh has no UV Coords, don't bother.
             me.uv_textures.new()
 
-        uv_layer = me.uv_loop_layers.active.data
+        uv_layer = me.uv_layers.active.data
         me_verts = list(me.vertices)
 
         if USER_ONLY_SELECTED_FACES:
index b94af13af7e2078ce4d66a8b5153fe8105b0ef0b..08529a0423d13ec46149fe635db53d36445b3128 100644 (file)
@@ -204,7 +204,7 @@ class DATA_PT_pose_library(ArmatureButtonsPanel, Panel):
             pose_marker_active = poselib.pose_markers.active
 
             if pose_marker_active is not None:
-                col.operator("poselib.pose_remove", icon='ZOOMOUT', text="").pose = pose_marker_active.name
+                col.operator("poselib.pose_remove", icon='ZOOMOUT', text="")
                 col.operator("poselib.apply_pose", icon='ZOOM_SELECTED', text="").pose_index = poselib.pose_markers.active_index
 
             col.operator("poselib.action_sanitise", icon='HELP', text="")  # XXX: put in menu?
index 36941cdfbbf031e3ff2f203b8e3aeec5f6e5fd2e..c3f1c42d8a81935c1ae8c91d3b09031e037fcb54 100644 (file)
@@ -166,7 +166,7 @@ class PHYSICS_PT_game_physics(PhysicsButtonsPanel, Panel):
             subsub.active = game.use_anisotropic_friction
             subsub.prop(game, "friction_coefficients", text="", slider=True)
 
-        elif physics_type =='SENSOR':
+        elif physics_type == 'SENSOR':
             col = layout.column()
             col.prop(game, "use_actor", text="Detect Actors")
             col.prop(ob, "hide_render", text="Invisible")
index 74abc8fe5591bdccbcf2e796fdc47f6fc5760114..9200c688394a37d07607e2bad587d72608a10436 100644 (file)
@@ -1185,7 +1185,7 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, Panel):
         psys = context.particle_system
 
         split = layout.split(percentage=0.85)
-        
+
         col = split.column()
         col.label(text="Vertex Group:")
         col.prop_search(psys, "vertex_group_density", ob, "vertex_groups", text="Density")
@@ -1195,7 +1195,7 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, Panel):
         col.prop_search(psys, "vertex_group_roughness_1", ob, "vertex_groups", text="Roughness 1")
         col.prop_search(psys, "vertex_group_roughness_2", ob, "vertex_groups", text="Roughness 2")
         col.prop_search(psys, "vertex_group_roughness_end", ob, "vertex_groups", text="Roughness End")
-        
+
         col = split.column()
         col.label(text="Negate:")
         col.alignment = 'RIGHT'
@@ -1206,7 +1206,7 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, Panel):
         col.prop(psys, "invert_vertex_group_roughness_1", text="")
         col.prop(psys, "invert_vertex_group_roughness_2", text="")
         col.prop(psys, "invert_vertex_group_roughness_end", text="")
-        
+
         # Commented out vertex groups don't work and are still waiting for better implementation
         # row = layout.row()
         # row.prop_search(psys, "vertex_group_velocity", ob, "vertex_groups", text="Velocity")
index 23b7a12753fb09751c7e60a4c18fad562fe756e0..beb525bbd076bfa484f581cf16461ff641929b1b 100644 (file)
@@ -20,6 +20,7 @@
 import bpy
 from bpy.types import Panel, Menu
 
+
 class FLUID_MT_presets(Menu):
     bl_label = "Fluid Presets"
     preset_subdir = "fluid"
@@ -54,11 +55,11 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel):
             return
 
         col.prop(fluid, "type")
-        if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID'}:
+        if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID', 'OBSTACLE'}:
             col.prop(fluid, "use")
 
         layout = layout.column()
-        if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID'}:
+        if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID', 'OBSTACLE'}:
             layout.active = fluid.use
 
         if fluid.type == 'DOMAIN':
@@ -232,7 +233,7 @@ class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, Panel):
         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)
index e4802cfa37faef82dbc396a7b6703a7e3d03a374..1334528c035bb4953cad17cf8deb8ba6b821b3c9 100644 (file)
@@ -136,7 +136,6 @@ Mat4 *b_bone_spline_setup(struct bPoseChannel *pchan, int rest);
 
 /* like EBONE_VISIBLE */
 #define PBONE_VISIBLE(arm, bone) (((bone)->layer & (arm)->layer) && !((bone)->flag & BONE_HIDDEN_P))
-#define _BONE_VISIBLE(arm, bone) (((bone)->layer & (arm)->layer) && !((bone)->flag & BONE_HIDDEN_P))
 
 #ifdef __cplusplus
 }
index 2d0719a78fae5694c6ff3c355ad1fef8008b2cd0..742e6ef0b8967994ff5c92da399a3733464830ff 100644 (file)
@@ -112,7 +112,7 @@ int poly_get_adj_loops_from_vert(unsigned adj_r[3], const struct MPoly *poly,
                                                                 const struct MLoop *mloop, unsigned vert);
 
 /* update the hide flag for edges and polys from the corresponding
  flag in verts */
* flag in verts */
 void mesh_flush_hidden_from_verts(const struct MVert *mvert,
                                                                  const struct MLoop *mloop,
                                                                  struct MEdge *medge, int totedge,
index 3e0180a84aac3b664d49dc30d9d9e3ebcefbc2ae..67dba6fd7a7713883bfec9028800b1a5fe7da2b9 100644 (file)
@@ -85,7 +85,7 @@ typedef struct ParticleSimulationData {
        float courant_num;
 } ParticleSimulationData;
 
-typedef struct ParticleTexture{
+typedef struct ParticleTexture {
        float ivel;                                                     /* used in reset */
        float time, life, exist, size;          /* used in init */
        float damp, gravity, field;                     /* used in physics */
@@ -93,13 +93,13 @@ typedef struct ParticleTexture{
        float rough1, rough2, roughe;           /* used in path caching */
 } ParticleTexture;
 
-typedef struct ParticleSeam{
+typedef struct ParticleSeam {
        float v0[3], v1[3];
        float nor[3], dir[3], tan[3];
        float length2;
 } ParticleSeam;
 
-typedef struct ParticleCacheKey{
+typedef struct ParticleCacheKey {
        float co[3];
        float vel[3];
        float rot[4];
index eba5c1171995e8b906b058b94d61e6f227fd37cb..d7d7324dd56ab4ceb6e44d591b4f3a7fabf6dfea 100644 (file)
@@ -187,7 +187,7 @@ typedef struct PTCacheBaker {
 #define PEK_HIDE               4
 #define PEK_USE_WCO            8
 
-typedef struct PTCacheEditKey{
+typedef struct PTCacheEditKey {
        float *co;
        float *vel;
        float *rot;
index 7f9881926a60a113a115a71536ebee568ab10551..8179c688580d7ef52f75f35e151f415cf6f4615d 100644 (file)
@@ -68,7 +68,7 @@ void subsurf_calculate_limit_positions(struct Mesh *me, float (*positions_r)[3])
 int ccg_gridsize(int level);
 
 /* x/y grid coordinates at 'low_level' can be multiplied by the result
  of this function to convert to grid coordinates at 'high_level' */
* of this function to convert to grid coordinates at 'high_level' */
 int ccg_factor(int low_level, int high_level);
 
 void subsurf_copy_grid_hidden(struct DerivedMesh *dm,
@@ -78,7 +78,7 @@ void subsurf_copy_grid_hidden(struct DerivedMesh *dm,
 
 typedef enum MultiresModifiedFlags {
        /* indicates the grids have been sculpted on, so MDisps
-          have to be updated */
+        * have to be updated */
        MULTIRES_COORDS_MODIFIED = 1,
        /* indicates elements have been hidden or unhidden */
        MULTIRES_HIDDEN_MODIFIED = 2
index 9b55785d1a499d62f669a014da19a6f35ab2ab80..f5718974f9ffcd4afac59fd2598c91fc34f3b875 100644 (file)
@@ -27,7 +27,7 @@
 
 /***/
 
-typedef unsigned char  byte;
+typedef unsigned char byte;
 
 /***/
 
@@ -50,10 +50,13 @@ typedef struct _EHash {
        CCGAllocatorHDL allocator;
 } EHash;
 
-#define EHASH_alloc(eh, nb)                    ((eh)->allocatorIFC.alloc((eh)->allocator, nb))
-#define EHASH_free(eh, ptr)                    ((eh)->allocatorIFC.free((eh)->allocator, ptr))
+#define EHASH_alloc(eh, nb)     ((eh)->allocatorIFC.alloc((eh)->allocator, nb))
+#define EHASH_free(eh, ptr)     ((eh)->allocatorIFC.free((eh)->allocator, ptr))
 
-#define EHASH_hash(eh, item)   (((uintptr_t) (item))%((unsigned int) (eh)->curSize))
+#define EHASH_hash(eh, item)    (((uintptr_t) (item)) % ((unsigned int) (eh)->curSize))
+
+static void ccgSubSurf__sync(CCGSubSurf *ss);
+static int _edge_isBoundary(const CCGEdge *e);
 
 static EHash *_ehash_new(int estimatedNumEntries, CCGAllocatorIFC *allocatorIFC, CCGAllocatorHDL allocator)
 {
@@ -107,7 +110,7 @@ static void _ehash_insert(EHash *eh, EHEntry *entry)
                memset(eh->buckets, 0, eh->curSize * sizeof(*eh->buckets));
 
                while (numBuckets--) {
-                       for (entry = oldBuckets[numBuckets]; entry;) {
+                       for (entry = oldBuckets[numBuckets]; entry; ) {
                                EHEntry *next = entry->next;
                                
                                hash = EHASH_hash(eh, entry->key);
@@ -125,12 +128,12 @@ static void _ehash_insert(EHash *eh, EHEntry *entry)
 static void *_ehash_lookupWithPrev(EHash *eh, void *key, void ***prevp_r)
 {
        int hash = EHASH_hash(eh, key);
-       void **prevp = (void**) &eh->buckets[hash];
+       void **prevp = (void **) &eh->buckets[hash];
        EHEntry *entry;
        
-       for (; (entry = *prevp); prevp = (void**) &entry->next) {
+       for (; (entry = *prevp); prevp = (void **) &entry->next) {
                if (entry->key == key) {
-                       *prevp_r = (void**) prevp;
+                       *prevp_r = (void **) prevp;
                        return entry;
                }
        }
@@ -279,7 +282,7 @@ static int VertDataEqual(const float *a, const float *b)
 #define VertDataCopy(av, bv) { float *_a = (float *)av, *_b = (float *) bv; _a[0]  = _b[0]; _a[1]  = _b[1]; _a[2]  = _b[2]; }
 #define VertDataAdd(av, bv)  { float *_a = (float *)av, *_b = (float *) bv; _a[0] += _b[0]; _a[1] += _b[1]; _a[2] += _b[2]; }
 #define VertDataSub(av, bv)  { float *_a = (float *)av, *_b = (float *) bv; _a[0] -= _b[0]; _a[1] -= _b[1]; _a[2] -= _b[2]; }
-#define VertDataMulN(av, n)  { float *_a = (float *)av; _a[0]*=n; _a[1]*=n; _a[2] *=n; }
+#define VertDataMulN(av, n)  { float *_a = (float *)av; float _n = n; _a[0] *= _n; _a[1] *= _n; _a[2] *= _n; }
 #define VertDataAvg4(tv, av, bv, cv, dv) \
        { \
                float *_t = (float *) tv, *_a = (float *) av, *_b = (float *) bv, *_c = (float *) cv, *_d = (float *) dv; \
@@ -291,9 +294,6 @@ static int VertDataEqual(const float *a, const float *b)
 #define NormCopy(av, bv) { float *_a = (float *) av, *_b = (float *) bv; _a[0]  = _b[0]; _a[1]  = _b[1]; _a[2]  = _b[2]; }
 #define NormAdd(av, bv)  { float *_a = (float *) av, *_b = (float *) bv; _a[0] += _b[0]; _a[1] += _b[1]; _a[2] += _b[2]; }
 
-
-static int _edge_isBoundary(const CCGEdge *e);
-
 /***/
 
 enum {
@@ -309,8 +309,8 @@ enum {
 } /*FaceFlags*/;
 
 struct CCGVert {
-       CCGVert         *next;  /* EHData.next */
-       CCGVertHDL      vHDL;   /* EHData.key */
+       CCGVert     *next;  /* EHData.next */
+       CCGVertHDL vHDL;    /* EHData.key */
 
        short numEdges, numFaces, flags, pad;
 
@@ -322,17 +322,17 @@ struct CCGVert {
 
 static CCG_INLINE byte *VERT_getLevelData(CCGVert *v)
 {
-       return (byte*)(&(v)[1]);
+       return (byte *)(&(v)[1]);
 }
 
 struct CCGEdge {
-       CCGEdge         *next;  /* EHData.next */
-       CCGEdgeHDL      eHDL;   /* EHData.key */
+       CCGEdge     *next;  /* EHData.next */
+       CCGEdgeHDL eHDL;    /* EHData.key */
 
        short numFaces, flags;
        float crease;
 
-       CCGVert *v0,*v1;
+       CCGVert *v0, *v1;
        CCGFace **faces;
 
 //     byte *levelData;
@@ -341,12 +341,12 @@ struct CCGEdge {
 
 static CCG_INLINE byte *EDGE_getLevelData(CCGEdge *e)
 {
-       return (byte*)(&(e)[1]);
+       return (byte *)(&(e)[1]);
 }
 
 struct CCGFace {
-       CCGFace         *next;  /* EHData.next */
-       CCGFaceHDL      fHDL;   /* EHData.key */
+       CCGFace     *next;  /* EHData.next */
+       CCGFaceHDL fHDL;    /* EHData.key */
 
        short numVerts, flags, pad1, pad2;
 
@@ -359,17 +359,17 @@ struct CCGFace {
 
 static CCG_INLINE CCGVert **FACE_getVerts(CCGFace *f)
 {
-       return (CCGVert**)(&f[1]);
+       return (CCGVert **)(&f[1]);
 }
 
 static CCG_INLINE CCGEdge **FACE_getEdges(CCGFace *f)
 {
-       return (CCGEdge**)(&(FACE_getVerts(f)[f->numVerts]));
+       return (CCGEdge **)(&(FACE_getVerts(f)[f->numVerts]));
 }
 
 static CCG_INLINE byte *FACE_getCenterData(CCGFace *f)
 {
-       return (byte*)(&(FACE_getEdges(f)[(f)->numVerts]));
+       return (byte *)(&(FACE_getEdges(f)[(f)->numVerts]));
 }
 
 typedef enum {
@@ -381,9 +381,9 @@ typedef enum {
 } SyncState;
 
 struct CCGSubSurf {
-       EHash *vMap;    /* map of CCGVertHDL -> Vert */
-       EHash *eMap;    /* map of CCGEdgeHDL -> Edge */
-       EHash *fMap;    /* map of CCGFaceHDL -> Face */
+       EHash *vMap;    /* map of CCGVertHDL -> Vert */
+       EHash *eMap;    /* map of CCGEdgeHDL -> Edge */
+       EHash *fMap;    /* map of CCGFaceHDL -> Face */
 
        CCGMeshIFC meshIFC;
        
@@ -398,18 +398,18 @@ struct CCGSubSurf {
 
        void *q, *r;
                
-               // data for calc vert normals
+       /* data for calc vert normals */
        int calcVertNormals;
        int normalDataOffset;
 
-               // data for age'ing (to debug sync)
+       /* data for age'ing (to debug sync) */
        int currentAge;
        int useAgeCounts;
        int vertUserAgeOffset;
        int edgeUserAgeOffset;
        int faceUserAgeOffset;
 
-               // data used during syncing
+       /* data used during syncing */
        SyncState syncState;
 
        EHash *oldVMap, *oldEMap, *oldFMap;
@@ -418,9 +418,9 @@ struct CCGSubSurf {
        CCGEdge **tempEdges;
 };
 
-#define CCGSUBSURF_alloc(ss, nb)                       ((ss)->allocatorIFC.alloc((ss)->allocator, nb))
-#define CCGSUBSURF_realloc(ss, ptr, nb, ob)    ((ss)->allocatorIFC.realloc((ss)->allocator, ptr, nb, ob))
-#define CCGSUBSURF_free(ss, ptr)                       ((ss)->allocatorIFC.free((ss)->allocator, ptr))
+#define CCGSUBSURF_alloc(ss, nb)            ((ss)->allocatorIFC.alloc((ss)->allocator, nb))
+#define CCGSUBSURF_realloc(ss, ptr, nb, ob) ((ss)->allocatorIFC.realloc((ss)->allocator, ptr, nb, ob))
+#define CCGSUBSURF_free(ss, ptr)            ((ss)->allocatorIFC.free((ss)->allocator, ptr))
 
 /***/
 
@@ -428,9 +428,9 @@ static CCGVert *_vert_new(CCGVertHDL vHDL, CCGSubSurf *ss)
 {
        int num_vert_data = ss->subdivLevels + 1;
        CCGVert *v = CCGSUBSURF_alloc(ss,
-                                                                 sizeof(CCGVert) +
-                                                                 ss->meshIFC.vertDataSize * num_vert_data +
-                                                                 ss->meshIFC.vertUserSize);
+                                     sizeof(CCGVert) +
+                                     ss->meshIFC.vertDataSize * num_vert_data +
+                                     ss->meshIFC.vertUserSize);
        byte *userData;
 
        v->vHDL = vHDL;
@@ -441,7 +441,7 @@ static CCGVert *_vert_new(CCGVertHDL vHDL, CCGSubSurf *ss)
 
        userData = ccgSubSurf_getVertUserData(ss, v);
        memset(userData, 0, ss->meshIFC.vertUserSize);
-       if (ss->useAgeCounts) *((int*) &userData[ss->vertUserAgeOffset]) = ss->currentAge;
+       if (ss->useAgeCounts) *((int *) &userData[ss->vertUserAgeOffset]) = ss->currentAge;
 
        return v;
 }
@@ -541,7 +541,7 @@ static CCGEdge *_edge_new(CCGEdgeHDL eHDL, CCGVert *v0, CCGVert *v1, float creas
 
        userData = ccgSubSurf_getEdgeUserData(ss, e);
        memset(userData, 0, ss->meshIFC.edgeUserSize);
-       if (ss->useAgeCounts) *((int*) &userData[ss->edgeUserAgeOffset]) = ss->currentAge;
+       if (ss->useAgeCounts) *((int *) &userData[ss->edgeUserAgeOffset]) = ss->currentAge;
 
        return e;
 }
@@ -562,7 +562,7 @@ static void _edge_addFace(CCGEdge *e, CCGFace *f, CCGSubSurf *ss)
 }
 static int _edge_isBoundary(const CCGEdge *e)
 {
-       return e->numFaces<2;
+       return e->numFaces < 2;
 }
 
 static CCGVert *_edge_getOtherVert(CCGEdge *e, CCGVert *vQ)
@@ -626,11 +626,11 @@ static CCGFace *_face_new(CCGFaceHDL fHDL, CCGVert **verts, CCGEdge **edges, int
 {
        int maxGridSize = ccg_gridsize(ss->subdivLevels);
        int num_face_data = (numVerts * maxGridSize +
-                                                numVerts * maxGridSize * maxGridSize + 1);
+                            numVerts * maxGridSize * maxGridSize + 1);
        CCGFace *f = CCGSUBSURF_alloc(ss,
                                      sizeof(CCGFace) +
-                                     sizeof(CCGVert*) * numVerts +
-                                     sizeof(CCGEdge*) * numVerts +
+                                     sizeof(CCGVert *) * numVerts +
+                                     sizeof(CCGEdge *) * numVerts +
                                      ss->meshIFC.vertDataSize * num_face_data +
                                      ss->meshIFC.faceUserSize);
        byte *userData;
@@ -649,7 +649,7 @@ static CCGFace *_face_new(CCGFaceHDL fHDL, CCGVert **verts, CCGEdge **edges, int
 
        userData = ccgSubSurf_getFaceUserData(ss, f);
        memset(userData, 0, ss->meshIFC.faceUserSize);
-       if (ss->useAgeCounts) *((int*) &userData[ss->faceUserAgeOffset]) = ss->currentAge;
+       if (ss->useAgeCounts) *((int *) &userData[ss->faceUserAgeOffset]) = ss->currentAge;
 
        return f;
 }
@@ -690,30 +690,36 @@ static int _face_getVertIndex(CCGFace *f, CCGVert *v)
                        return i;
        return -1;
 }
-static CCG_INLINE void *_face_getIFCoEdge(CCGFace *f, CCGEdge *e, int lvl, int eX, int eY, int levels, int dataSize)
+static int _face_getEdgeIndex(CCGFace *f, CCGEdge *e)
+{
+       int i;
+       for (i = 0; i < f->numVerts; i++)
+               if (FACE_getEdges(f)[i] == e)
+                       return i;
+       return -1;
+}
+static CCG_INLINE void *_face_getIFCoEdge(CCGFace *f, CCGEdge *e, int f_ed_idx, int lvl, int eX, int eY, int levels, int dataSize)
 {
        int maxGridSize = ccg_gridsize(levels);
        int spacing = ccg_spacing(levels, lvl);
-       int S, x, y, cx, cy;
+       int x, y, cx, cy;
 
-       for (S = 0; S < f->numVerts; S++)
-               if (FACE_getEdges(f)[S] == e)
-                       break;
+       BLI_assert(f_ed_idx == _face_getEdgeIndex(f, e));
 
        eX = eX * spacing;
        eY = eY * spacing;
-       if (e->v0!=FACE_getVerts(f)[S]) {
+       if (e->v0 != FACE_getVerts(f)[f_ed_idx]) {
                eX = (maxGridSize * 2 - 1) - 1 - eX;
        }
        y = maxGridSize - 1 - eX;
        x = maxGridSize - 1 - eY;
-       if (x<0) {
-               S = (S + f->numVerts - 1) % f->numVerts;
+       if (x < 0) {
+               f_ed_idx = (f_ed_idx + f->numVerts - 1) % f->numVerts;
                cx = y;
                cy = -x;
        }
        else if (y < 0) {
-               S = (S + 1) % f->numVerts;
+               f_ed_idx = (f_ed_idx + 1) % f->numVerts;
                cx = -y;
                cy = x;
        }
@@ -721,11 +727,11 @@ static CCG_INLINE void *_face_getIFCoEdge(CCGFace *f, CCGEdge *e, int lvl, int e
                cx = x;
                cy = y;
        }
-       return _face_getIFCo(f, levels, S, cx, cy, levels, dataSize);
+       return _face_getIFCo(f, levels, f_ed_idx, cx, cy, levels, dataSize);
 }
-static float *_face_getIFNoEdge(CCGFace *f, CCGEdge *e, int lvl, int eX, int eY, int levels, int dataSize, int normalDataOffset)
+static float *_face_getIFNoEdge(CCGFace *f, CCGEdge *e, int f_ed_idx, int lvl, int eX, int eY, int levels, int dataSize, int normalDataOffset)
 {
-       return (float *) ((byte *) _face_getIFCoEdge(f, e, lvl, eX, eY, levels, dataSize) + normalDataOffset);
+       return (float *) ((byte *) _face_getIFCoEdge(f, e, f_ed_idx, lvl, eX, eY, levels, dataSize) + normalDataOffset);
 }
 static void _face_calcIFNo(CCGFace *f, int lvl, int S, int x, int y, float *no, int levels, int dataSize)
 {
@@ -733,8 +739,8 @@ static void _face_calcIFNo(CCGFace *f, int lvl, int S, int x, int y, float *no,
        float *b = _face_getIFCo(f, lvl, S, x + 1, y + 0, levels, dataSize);
        float *c = _face_getIFCo(f, lvl, S, x + 1, y + 1, levels, dataSize);
        float *d = _face_getIFCo(f, lvl, S, x + 0, y + 1, levels, dataSize);
-       float a_cX = c[0]-a[0], a_cY = c[1]-a[1], a_cZ = c[2]-a[2];
-       float b_dX = d[0]-b[0], b_dY = d[1]-b[1], b_dZ = d[2]-b[2];
+       float a_cX = c[0] - a[0], a_cY = c[1] - a[1], a_cZ = c[2] - a[2];
+       float b_dX = d[0] - b[0], b_dY = d[1] - b[1], b_dZ = d[2] - b[2];
        float length;
 
        no[0] = b_dY * a_cZ - b_dZ * a_cY;
@@ -779,7 +785,7 @@ CCGSubSurf *ccgSubSurf_new(CCGMeshIFC *ifc, int subdivLevels, CCGAllocatorIFC *a
                allocator = NULL;
        }
 
-       if (subdivLevels<1) {
+       if (subdivLevels < 1) {
                return NULL;
        }
        else {
@@ -881,10 +887,10 @@ void ccgSubSurf_getAllowEdgeCreation(CCGSubSurf *ss, int *allowEdgeCreation_r, f
 
 CCGError ccgSubSurf_setSubdivisionLevels(CCGSubSurf *ss, int subdivisionLevels)
 {
-       if (subdivisionLevels<=0) {
+       if (subdivisionLevels <= 0) {
                return eCCGError_InvalidValue;
        }
-       else if (subdivisionLevels!=ss->subdivLevels) {
+       else if (subdivisionLevels != ss->subdivLevels) {
                ss->numGrids = 0;
                ss->subdivLevels = subdivisionLevels;
                _ehash_free(ss->vMap, (EHEntryFreeFP) _vert_free, ss);
@@ -934,7 +940,7 @@ CCGError ccgSubSurf_setUseAgeCounts(CCGSubSurf *ss, int useAgeCounts, int vertUs
 CCGError ccgSubSurf_setCalcVertexNormals(CCGSubSurf *ss, int useVertNormals, int normalDataOffset)
 {
        if (useVertNormals) {
-               if (normalDataOffset<0 || normalDataOffset + 12>ss->meshIFC.vertDataSize) {
+               if (normalDataOffset < 0 || normalDataOffset + 12 > ss->meshIFC.vertDataSize) {
                        return eCCGError_InvalidValue;
                }
                else {
@@ -954,7 +960,7 @@ CCGError ccgSubSurf_setCalcVertexNormals(CCGSubSurf *ss, int useVertNormals, int
 
 CCGError ccgSubSurf_initFullSync(CCGSubSurf *ss)
 {
-       if (ss->syncState!=eSyncState_None) {
+       if (ss->syncState != eSyncState_None) {
                return eCCGError_InvalidSyncState;
        }
 
@@ -981,7 +987,7 @@ CCGError ccgSubSurf_initFullSync(CCGSubSurf *ss)
 
 CCGError ccgSubSurf_initPartialSync(CCGSubSurf *ss)
 {
-       if (ss->syncState!=eSyncState_None) {
+       if (ss->syncState != eSyncState_None) {
                return eCCGError_InvalidSyncState;
        }
 
@@ -994,7 +1000,7 @@ CCGError ccgSubSurf_initPartialSync(CCGSubSurf *ss)
 
 CCGError ccgSubSurf_syncVertDel(CCGSubSurf *ss, CCGVertHDL vHDL)
 {
-       if (ss->syncState!=eSyncState_Partial) {
+       if (ss->syncState != eSyncState_Partial) {
                return eCCGError_InvalidSyncState;
        }
        else {
@@ -1015,7 +1021,7 @@ CCGError ccgSubSurf_syncVertDel(CCGSubSurf *ss, CCGVertHDL vHDL)
 
 CCGError ccgSubSurf_syncEdgeDel(CCGSubSurf *ss, CCGEdgeHDL eHDL)
 {
-       if (ss->syncState!=eSyncState_Partial) {
+       if (ss->syncState != eSyncState_Partial) {
                return eCCGError_InvalidSyncState;
        }
        else {
@@ -1036,7 +1042,7 @@ CCGError ccgSubSurf_syncEdgeDel(CCGSubSurf *ss, CCGEdgeHDL eHDL)
 
 CCGError ccgSubSurf_syncFaceDel(CCGSubSurf *ss, CCGFaceHDL fHDL)
 {
-       if (ss->syncState!=eSyncState_Partial) {
+       if (ss->syncState != eSyncState_Partial) {
                return eCCGError_InvalidSyncState;
        }
        else {
@@ -1059,21 +1065,21 @@ CCGError ccgSubSurf_syncVert(CCGSubSurf *ss, CCGVertHDL vHDL, const void *vertDa
 {
        void **prevp;
        CCGVert *v = NULL;
-       short seamflag = (seam)? Vert_eSeam: 0;
+       short seamflag = (seam) ? Vert_eSeam : 0;
        
        if (ss->syncState == eSyncState_Partial) {
                v = _ehash_lookupWithPrev(ss->vMap, vHDL, &prevp);
                if (!v) {
                        v = _vert_new(vHDL, ss);
-                       VertDataCopy(_vert_getCo(v,0,ss->meshIFC.vertDataSize), vertData);
-                       _ehash_insert(ss->vMap, (EHEntry*) v);
-                       v->flags = Vert_eEffected|seamflag;
+                       VertDataCopy(_vert_getCo(v, 0, ss->meshIFC.vertDataSize), vertData);
+                       _ehash_insert(ss->vMap, (EHEntry *) v);
+                       v->flags = Vert_eEffected | seamflag;
                }
                else if (!VertDataEqual(vertData, _vert_getCo(v, 0, ss->meshIFC.vertDataSize)) || ((v->flags & Vert_eSeam) != seamflag)) {
                        int i, j;
 
-                       VertDataCopy(_vert_getCo(v,0,ss->meshIFC.vertDataSize), vertData);
-                       v->flags = Vert_eEffected|seamflag;
+                       VertDataCopy(_vert_getCo(v, 0, ss->meshIFC.vertDataSize), vertData);
+                       v->flags = Vert_eEffected | seamflag;
 
                        for (i = 0; i < v->numEdges; i++) {
                                CCGEdge *e = v->edges[i];
@@ -1089,26 +1095,26 @@ CCGError ccgSubSurf_syncVert(CCGSubSurf *ss, CCGVertHDL vHDL, const void *vertDa
                }
        }
        else {
-               if (ss->syncState!=eSyncState_Vert) { 
+               if (ss->syncState != eSyncState_Vert) {
                        return eCCGError_InvalidSyncState;
                }
 
                v = _ehash_lookupWithPrev(ss->oldVMap, vHDL, &prevp);
                if (!v) {
                        v = _vert_new(vHDL, ss);
-                       VertDataCopy(_vert_getCo(v,0,ss->meshIFC.vertDataSize), vertData);
-                       _ehash_insert(ss->vMap, (EHEntry*) v);
-                       v->flags = Vert_eEffected|seamflag;
+                       VertDataCopy(_vert_getCo(v, 0, ss->meshIFC.vertDataSize), vertData);
+                       _ehash_insert(ss->vMap, (EHEntry *) v);
+                       v->flags = Vert_eEffected | seamflag;
                }
                else if (!VertDataEqual(vertData, _vert_getCo(v, 0, ss->meshIFC.vertDataSize)) || ((v->flags & Vert_eSeam) != seamflag)) {
                        *prevp = v->next;
-                       _ehash_insert(ss->vMap, (EHEntry*) v);
-                       VertDataCopy(_vert_getCo(v,0,ss->meshIFC.vertDataSize), vertData);
-                       v->flags = Vert_eEffected|Vert_eChanged|seamflag;
+                       _ehash_insert(ss->vMap, (EHEntry *) v);
+                       VertDataCopy(_vert_getCo(v, 0, ss->meshIFC.vertDataSize), vertData);
+                       v->flags = Vert_eEffected | Vert_eChanged | seamflag;
                }
                else {
                        *prevp = v->next;
-                       _ehash_insert(ss->vMap, (EHEntry*) v);
+                       _ehash_insert(ss->vMap, (EHEntry *) v);
                        v->flags = 0;
                }
        }
@@ -1124,7 +1130,7 @@ CCGError ccgSubSurf_syncEdge(CCGSubSurf *ss, CCGEdgeHDL eHDL, CCGVertHDL e_vHDL0
 
        if (ss->syncState == eSyncState_Partial) {
                e = _ehash_lookupWithPrev(ss->eMap, eHDL, &prevp);
-               if (!e || e->v0->vHDL!=e_vHDL0 || e->v1->vHDL!=e_vHDL1 || crease!=e->crease) {
+               if (!e || e->v0->vHDL != e_vHDL0 || e->v1->vHDL != e_vHDL1 || crease != e->crease) {
                        CCGVert *v0 = _ehash_lookup(ss->vMap, e_vHDL0);
                        CCGVert *v1 = _ehash_lookup(ss->vMap, e_vHDL1);
 
@@ -1137,7 +1143,7 @@ CCGError ccgSubSurf_syncEdge(CCGSubSurf *ss, CCGEdgeHDL eHDL, CCGVertHDL e_vHDL0
                                _edge_unlinkMarkAndFree(e, ss);
                        }
                        else {
-                               _ehash_insert(ss->eMap, (EHEntry*) eNew);
+                               _ehash_insert(ss->eMap, (EHEntry *) eNew);
                        }
 
                        eNew->v0->flags |= Vert_eEffected;
@@ -1148,24 +1154,24 @@ CCGError ccgSubSurf_syncEdge(CCGSubSurf *ss, CCGEdgeHDL eHDL, CCGVertHDL e_vHDL0
                if (ss->syncState == eSyncState_Vert) {
                        ss->syncState = eSyncState_Edge;
                }
-               else if (ss->syncState!=eSyncState_Edge) {
+               else if (ss->syncState != eSyncState_Edge) {
                        return eCCGError_InvalidSyncState;
                }
 
                e = _ehash_lookupWithPrev(ss->oldEMap, eHDL, &prevp);
-               if (!e || e->v0->vHDL!=e_vHDL0 || e->v1->vHDL!=e_vHDL1|| e->crease!=crease) {
+               if (!e || e->v0->vHDL != e_vHDL0 || e->v1->vHDL != e_vHDL1 || e->crease != crease) {
                        CCGVert *v0 = _ehash_lookup(ss->vMap, e_vHDL0);
                        CCGVert *v1 = _ehash_lookup(ss->vMap, e_vHDL1);
                        e = _edge_new(eHDL, v0, v1, crease, ss);
-                       _ehash_insert(ss->eMap, (EHEntry*) e);
+                       _ehash_insert(ss->eMap, (EHEntry *) e);
                        e->v0->flags |= Vert_eEffected;
                        e->v1->flags |= Vert_eEffected;
                }
                else {
                        *prevp = e->next;
-                       _ehash_insert(ss->eMap, (EHEntry*) e);
+                       _ehash_insert(ss->eMap, (EHEntry *) e);
                        e->flags = 0;
-                       if ((e->v0->flags|e->v1->flags)&Vert_eChanged) {
+                       if ((e->v0->flags | e->v1->flags) & Vert_eChanged) {
                                e->v0->flags |= Vert_eEffected;
                                e->v1->flags |= Vert_eEffected;
                        }
@@ -1199,10 +1205,12 @@ CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGV
                }
 
                if (f) {
-                       if (    f->numVerts!=numVerts ||
-                                       memcmp(FACE_getVerts(f), ss->tempVerts, sizeof(*ss->tempVerts) * numVerts) ||
-                                       memcmp(FACE_getEdges(f), ss->tempEdges, sizeof(*ss->tempEdges) * numVerts))
+                       if (f->numVerts != numVerts ||
+                           memcmp(FACE_getVerts(f), ss->tempVerts, sizeof(*ss->tempVerts) * numVerts) ||
+                           memcmp(FACE_getEdges(f), ss->tempEdges, sizeof(*ss->tempEdges) * numVerts))
+                       {
                                topologyChanged = 1;
+                       }
                }
 
                if (!f || topologyChanged) {
@@ -1218,7 +1226,7 @@ CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGV
                        }
                        else {
                                ss->numGrids += numVerts;
-                               _ehash_insert(ss->fMap, (EHEntry*) fNew);
+                               _ehash_insert(ss->fMap, (EHEntry *) fNew);
                        }
 
                        for (k = 0; k < numVerts; k++)
@@ -1229,7 +1237,7 @@ CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGV
                if (ss->syncState == eSyncState_Vert || ss->syncState == eSyncState_Edge) {
                        ss->syncState = eSyncState_Face;
                }
-               else if (ss->syncState!=eSyncState_Face) {
+               else if (ss->syncState != eSyncState_Face) {
                        return eCCGError_InvalidSyncState;
                }
 
@@ -1246,8 +1254,8 @@ CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGV
 
                        if (!ss->tempEdges[k]) {
                                if (ss->allowEdgeCreation) {
-                                       CCGEdge *e = ss->tempEdges[k] = _edge_new((CCGEdgeHDL) -1, ss->tempVerts[k], ss->tempVerts[(k + 1) % numVerts], ss->defaultCreaseValue, ss);
-                                       _ehash_insert(ss->eMap, (EHEntry*) e);
+                                       CCGEdge *e = ss->tempEdges[k] = _edge_new((CCGEdgeHDL) - 1, ss->tempVerts[k], ss->tempVerts[(k + 1) % numVerts], ss->defaultCreaseValue, ss);
+                                       _ehash_insert(ss->eMap, (EHEntry *) e);
                                        e->v0->flags |= Vert_eEffected;
                                        e->v1->flags |= Vert_eEffected;
                                        if (ss->meshIFC.edgeUserSize) {
@@ -1261,15 +1269,15 @@ CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGV
                }
 
                if (f) {
-                       if (    f->numVerts!=numVerts ||
-                                       memcmp(FACE_getVerts(f), ss->tempVerts, sizeof(*ss->tempVerts) * numVerts) ||
-                                       memcmp(FACE_getEdges(f), ss->tempEdges, sizeof(*ss->tempEdges) * numVerts))
+                       if (f->numVerts != numVerts ||
+                           memcmp(FACE_getVerts(f), ss->tempVerts, sizeof(*ss->tempVerts) * numVerts) ||
+                           memcmp(FACE_getEdges(f), ss->tempEdges, sizeof(*ss->tempEdges) * numVerts))
                                topologyChanged = 1;
                }
 
                if (!f || topologyChanged) {
                        f = _face_new(fHDL, ss->tempVerts, ss->tempEdges, numVerts, ss);
-                       _ehash_insert(ss->fMap, (EHEntry*) f);
+                       _ehash_insert(ss->fMap, (EHEntry *) f);
                        ss->numGrids += numVerts;
 
                        for (k = 0; k < numVerts; k++)
@@ -1277,7 +1285,7 @@ CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGV
                }
                else {
                        *prevp = f->next;
-                       _ehash_insert(ss->fMap, (EHEntry*) f);
+                       _ehash_insert(ss->fMap, (EHEntry *) f);
                        f->flags = 0;
                        ss->numGrids += f->numVerts;
 
@@ -1295,7 +1303,6 @@ CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGV
        return eCCGError_None;
 }
 
-static void ccgSubSurf__sync(CCGSubSurf *ss);
 CCGError ccgSubSurf_processSync(CCGSubSurf *ss)
 {
        if (ss->syncState == eSyncState_Partial) {
@@ -1327,15 +1334,17 @@ CCGError ccgSubSurf_processSync(CCGSubSurf *ss)
        return eCCGError_None;
 }
 
-#define VERT_getNo(e, lvl)                                     _vert_getNo(e, lvl, vertDataSize, normalDataOffset)
-#define EDGE_getNo(e, lvl, x)                          _edge_getNo(e, lvl, x, vertDataSize, normalDataOffset)
-#define FACE_getIFNo(f, lvl, S, x, y)          _face_getIFNo(f, lvl, S, x, y, subdivLevels, vertDataSize, normalDataOffset)
-#define FACE_calcIFNo(f, lvl, S, x, y, no)     _face_calcIFNo(f, lvl, S, x, y, no, subdivLevels, vertDataSize)
-#define FACE_getIENo(f, lvl, S, x)                     _face_getIENo(f, lvl, S, x, subdivLevels, vertDataSize, normalDataOffset)
+#define VERT_getNo(e, lvl)                  _vert_getNo(e, lvl, vertDataSize, normalDataOffset)
+#define EDGE_getNo(e, lvl, x)               _edge_getNo(e, lvl, x, vertDataSize, normalDataOffset)
+#define FACE_getIFNo(f, lvl, S, x, y)       _face_getIFNo(f, lvl, S, x, y, subdivLevels, vertDataSize, normalDataOffset)
+#define FACE_calcIFNo(f, lvl, S, x, y, no)  _face_calcIFNo(f, lvl, S, x, y, no, subdivLevels, vertDataSize)
+#define FACE_getIENo(f, lvl, S, x)          _face_getIENo(f, lvl, S, x, subdivLevels, vertDataSize, normalDataOffset)
+
 static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
-       CCGVert **effectedV, CCGEdge **effectedE, CCGFace **effectedF,
-       int numEffectedV, int numEffectedE, int numEffectedF) {
-       int i,ptrIdx;
+                                        CCGVert **effectedV, CCGEdge **effectedE, CCGFace **effectedF,
+                                        int numEffectedV, int numEffectedE, int numEffectedF)
+{
+       int i, ptrIdx;
        int subdivLevels = ss->subdivLevels;
        int lvl = ss->subdivLevels;
        int edgeSize = ccg_edgesize(lvl);
@@ -1345,7 +1354,7 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
 
        #pragma omp parallel for private(ptrIdx) if (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT)
        for (ptrIdx = 0; ptrIdx < numEffectedF; ptrIdx++) {
-               CCGFace *f = (CCGFace*) effectedF[ptrIdx];
+               CCGFace *f = (CCGFace *) effectedF[ptrIdx];
                int S, x, y;
                float no[3];
 
@@ -1354,19 +1363,19 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
                                for (x = 0; x < gridSize - 1; x++)
                                        NormZero(FACE_getIFNo(f, lvl, S, x, y));
 
-                       if (FACE_getEdges(f)[(S - 1+f->numVerts)%f->numVerts]->flags&Edge_eEffected)
+                       if (FACE_getEdges(f)[(S - 1 + f->numVerts) % f->numVerts]->flags & Edge_eEffected)
                                for (x = 0; x < gridSize - 1; x++)
                                        NormZero(FACE_getIFNo(f, lvl, S, x, gridSize - 1));
-                       if (FACE_getEdges(f)[S]->flags&Edge_eEffected)
+                       if (FACE_getEdges(f)[S]->flags & Edge_eEffected)
                                for (y = 0; y < gridSize - 1; y++)
                                        NormZero(FACE_getIFNo(f, lvl, S, gridSize - 1, y));
-                       if (FACE_getVerts(f)[S]->flags&Vert_eEffected)
+                       if (FACE_getVerts(f)[S]->flags & Vert_eEffected)
                                NormZero(FACE_getIFNo(f, lvl, S, gridSize - 1, gridSize - 1));
                }
 
                for (S = 0; S < f->numVerts; S++) {
                        int yLimit = !(FACE_getEdges(f)[(S - 1 + f->numVerts) % f->numVerts]->flags & Edge_eEffected);
-                       int xLimit = !(FACE_getEdges(f)[S]->flags&Edge_eEffected);
+                       int xLimit = !(FACE_getEdges(f)[S]->flags & Edge_eEffected);
                        int yLimitNext = xLimit;
                        int xLimitPrev = yLimit;
                        
@@ -1391,13 +1400,13 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
                                        if (x == 0 && y == 0) {
                                                int K;
 
-                                               if (!yLimitNext || 1<gridSize - 1)
+                                               if (!yLimitNext || 1 < gridSize - 1)
                                                        NormAdd(FACE_getIFNo(f, lvl, (S + 1) % f->numVerts, 0, 1), no);
-                                               if (!xLimitPrev || 1<gridSize - 1)
+                                               if (!xLimitPrev || 1 < gridSize - 1)
                                                        NormAdd(FACE_getIFNo(f, lvl, (S - 1 + f->numVerts) % f->numVerts, 1, 0), no);
 
                                                for (K = 0; K < f->numVerts; K++) {
-                                                       if (K!=S) {
+                                                       if (K != S) {
                                                                NormAdd(FACE_getIFNo(f, lvl, K, 0, 0), no);
                                                        }
                                                }
@@ -1416,22 +1425,22 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
                        }
                }
        }
-               // XXX can I reduce the number of normalisations here?
+       /* XXX can I reduce the number of normalisations here? */
        for (ptrIdx = 0; ptrIdx < numEffectedV; ptrIdx++) {
-               CCGVert *v = (CCGVert*) effectedV[ptrIdx];
+               CCGVert *v = (CCGVert *) effectedV[ptrIdx];
                float length, *no = _vert_getNo(v, lvl, vertDataSize, normalDataOffset);
 
                NormZero(no);
 
                for (i = 0; i < v->numFaces; i++) {
                        CCGFace *f = v->faces[i];
-                       NormAdd(no, FACE_getIFNo(f, lvl, _face_getVertIndex(f,v), gridSize - 1, gridSize - 1));
+                       NormAdd(no, FACE_getIFNo(f, lvl, _face_getVertIndex(f, v), gridSize - 1, gridSize - 1));
                }
 
                length = sqrtf(no[0] * no[0] + no[1] * no[1] + no[2] * no[2]);
 
                if (length > EPSILON) {
-                       float invLength = 1.0f/length;
+                       float invLength = 1.0f / length;
                        no[0] *= invLength;
                        no[1] *= invLength;
                        no[2] *= invLength;
@@ -1442,11 +1451,11 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
 
                for (i = 0; i < v->numFaces; i++) {
                        CCGFace *f = v->faces[i];
-                       NormCopy(FACE_getIFNo(f, lvl, _face_getVertIndex(f,v), gridSize - 1, gridSize - 1), no);
+                       NormCopy(FACE_getIFNo(f, lvl, _face_getVertIndex(f, v), gridSize - 1, gridSize - 1), no);
                }
        }
        for (ptrIdx = 0; ptrIdx < numEffectedE; ptrIdx++) {
-               CCGEdge *e = (CCGEdge*) effectedE[ptrIdx];
+               CCGEdge *e = (CCGEdge *) effectedE[ptrIdx];
 
                if (e->numFaces) {
                        CCGFace *fLast = e->faces[e->numFaces - 1];
@@ -1454,19 +1463,23 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
 
                        for (i = 0; i < e->numFaces - 1; i++) {
                                CCGFace *f = e->faces[i];
+                               const int f_ed_idx = _face_getEdgeIndex(f, e);
+                               const int f_ed_idx_last = _face_getEdgeIndex(fLast, e);
 
                                for (x = 1; x < edgeSize - 1; x++) {
-                                       NormAdd(_face_getIFNoEdge(fLast, e, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset),
-                                                       _face_getIFNoEdge(f, e, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset));
+                                       NormAdd(_face_getIFNoEdge(fLast, e, f_ed_idx_last, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset),
+                                               _face_getIFNoEdge(f, e, f_ed_idx, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset));
                                }
                        }
 
                        for (i = 0; i < e->numFaces - 1; i++) {
                                CCGFace *f = e->faces[i];
+                               const int f_ed_idx = _face_getEdgeIndex(f, e);
+                               const int f_ed_idx_last = _face_getEdgeIndex(fLast, e);
 
                                for (x = 1; x < edgeSize - 1; x++) {
-                                       NormCopy(_face_getIFNoEdge(f, e, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset),
-                                                       _face_getIFNoEdge(fLast, e, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset));
+                                       NormCopy(_face_getIFNoEdge(f, e, f_ed_idx, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset),
+                                                _face_getIFNoEdge(fLast, e, f_ed_idx_last, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset));
                                }
                        }
                }
@@ -1474,7 +1487,7 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
 
        #pragma omp parallel for private(ptrIdx) if (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT)
        for (ptrIdx = 0; ptrIdx < numEffectedF; ptrIdx++) {
-               CCGFace *f = (CCGFace*) effectedF[ptrIdx];
+               CCGFace *f = (CCGFace *) effectedF[ptrIdx];
                int S, x, y;
 
                for (S = 0; S < f->numVerts; S++) {
@@ -1489,7 +1502,7 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
                                        float length = sqrtf(no[0] * no[0] + no[1] * no[1] + no[2] * no[2]);
 
                                        if (length > EPSILON) {
-                                               float invLength = 1.0f/length;
+                                               float invLength = 1.0f / length;
                                                no[0] *= invLength;
                                                no[1] *= invLength;
                                                no[2] *= invLength;
@@ -1501,24 +1514,25 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
                        }
 
                        VertDataCopy((float *)((byte *)FACE_getCenterData(f) + normalDataOffset),
-                               FACE_getIFNo(f, lvl, S, 0, 0));
+                                    FACE_getIFNo(f, lvl, S, 0, 0));
 
                        for (x = 1; x < gridSize - 1; x++)
                                NormCopy(FACE_getIENo(f, lvl, S, x),
-                                       FACE_getIFNo(f, lvl, S, x, 0));
+                                        FACE_getIFNo(f, lvl, S, x, 0));
                }
        }
 
        for (ptrIdx = 0; ptrIdx < numEffectedE; ptrIdx++) {
-               CCGEdge *e = (CCGEdge*) effectedE[ptrIdx];
+               CCGEdge *e = (CCGEdge *) effectedE[ptrIdx];
 
                if (e->numFaces) {
                        CCGFace *f = e->faces[0];
                        int x;
+                       const int f_ed_idx = _face_getEdgeIndex(f, e);
 
                        for (x = 0; x < edgeSize; x++)
                                NormCopy(EDGE_getNo(e, lvl, x),
-                                       _face_getIFNoEdge(f, e, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset));
+                                        _face_getIFNoEdge(f, e, f_ed_idx, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset));
                }
                else {
                        /* set to zero here otherwise the normals are uninitialized memory
@@ -1535,10 +1549,10 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
 }
 #undef FACE_getIFNo
 
-#define VERT_getCo(v, lvl)                             _vert_getCo(v, lvl, vertDataSize)
-#define EDGE_getCo(e, lvl, x)                  _edge_getCo(e, lvl, x, vertDataSize)
-#define FACE_getIECo(f, lvl, S, x)             _face_getIECo(f, lvl, S, x, subdivLevels, vertDataSize)
-#define FACE_getIFCo(f, lvl, S, x, y)  _face_getIFCo(f, lvl, S, x, y, subdivLevels, vertDataSize)
+#define VERT_getCo(v, lvl)              _vert_getCo(v, lvl, vertDataSize)
+#define EDGE_getCo(e, lvl, x)           _edge_getCo(e, lvl, x, vertDataSize)
+#define FACE_getIECo(f, lvl, S, x)      _face_getIECo(f, lvl, S, x, subdivLevels, vertDataSize)
+#define FACE_getIFCo(f, lvl, S, x, y)   _face_getIFCo(f, lvl, S, x, y, subdivLevels, vertDataSize)
 
 static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
                                         CCGVert **effectedV, CCGEdge **effectedE, CCGFace **effectedF,
@@ -1554,17 +1568,17 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
 
        #pragma omp parallel for private(ptrIdx) if (numEffectedF * edgeSize * edgeSize * 4 >= CCG_OMP_LIMIT)
        for (ptrIdx = 0; ptrIdx < numEffectedF; ptrIdx++) {
-               CCGFace *f = (CCGFace*) effectedF[ptrIdx];
+               CCGFace *f = (CCGFace *) effectedF[ptrIdx];
                int S, x, y;
 
-                       /* interior face midpoints
-                        *  o old interior face points
-                        */
+               /* interior face midpoints
+                * - old interior face points
+                */
                for (S = 0; S < f->numVerts; S++) {
                        for (y = 0; y < gridSize - 1; y++) {
                                for (x = 0; x < gridSize - 1; x++) {
-                                       int fx = 1 + 2*x;
-                                       int fy = 1 + 2*y;
+                                       int fx = 1 + 2 * x;
+                                       int fy = 1 + 2 * y;
                                        void *co0 = FACE_getIFCo(f, curLvl, S, x + 0, y + 0);
                                        void *co1 = FACE_getIFCo(f, curLvl, S, x + 1, y + 0);
                                        void *co2 = FACE_getIFCo(f, curLvl, S, x + 1, y + 1);
@@ -1576,10 +1590,10 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
                        }
                }
 
-                       /* interior edge midpoints
-                        *  o old interior edge points
-                        *  o new interior face midpoints
-                        */
+               /* interior edge midpoints
+                * - old interior edge points
+                * - new interior face midpoints
+                */
                for (S = 0; S < f->numVerts; S++) {
                        for (x = 0; x < gridSize - 1; x++) {
                                int fx = x * 2 + 1;
@@ -1592,12 +1606,12 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
                                VertDataAvg4(co, co0, co1, co2, co3);
                        }
 
-                                       /* interior face interior edge midpoints
-                                        *  o old interior face points
-                                        *  o new interior face midpoints
-                                        */
+                       /* interior face interior edge midpoints
+                        * - old interior face points
+                        * - new interior face midpoints
+                        */
 
-                               /* vertical */
+                       /* vertical */
                        for (x = 1; x < gridSize - 1; x++) {
                                for (y = 0; y < gridSize - 1; y++) {
                                        int fx = x * 2;
@@ -1612,7 +1626,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
                                }
                        }
 
-                               /* horizontal */
+                       /* horizontal */
                        for (y = 1; y < gridSize - 1; y++) {
                                for (x = 0; x < gridSize - 1; x++) {
                                        int fx = x * 2 + 1;
@@ -1629,12 +1643,12 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
                }
        }
 
-               /* exterior edge midpoints
-                *  o old exterior edge points
-                *  o new interior face midpoints
-                */
+       /* exterior edge midpoints
+        * - old exterior edge points
+        * - new interior face midpoints
+        */
        for (ptrIdx = 0; ptrIdx < numEffectedE; ptrIdx++) {
-               CCGEdge *e = (CCGEdge*) effectedE[ptrIdx];
+               CCGEdge *e = (CCGEdge *) effectedE[ptrIdx];
                float sharpness = EDGE_getSharpness(e, curLvl);
                int x, j;
 
@@ -1663,7 +1677,8 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
 
                                for (j = 0; j < e->numFaces; j++) {
                                        CCGFace *f = e->faces[j];
-                                       VertDataAdd(q, _face_getIFCoEdge(f, e, nextLvl, fx, 1, subdivLevels, vertDataSize));
+                                       const int f_ed_idx = _face_getEdgeIndex(f, e);
+                                       VertDataAdd(q, _face_getIFCoEdge(f, e, f_ed_idx, nextLvl, fx, 1, subdivLevels, vertDataSize));
                                        numFaces++;
                                }
 
@@ -1681,13 +1696,13 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
                }
        }
 
-               /* exterior vertex shift
-                *  o old vertex points (shifting)
-                *  o old exterior edge points
-                *  o new interior face midpoints
-                */
+       /* exterior vertex shift
+        * - old vertex points (shifting)
+        * - old exterior edge points
+        * - new interior face midpoints
+        */
        for (ptrIdx = 0; ptrIdx < numEffectedV; ptrIdx++) {
-               CCGVert *v = (CCGVert*) effectedV[ptrIdx];
+               CCGVert *v = (CCGVert *) effectedV[ptrIdx];
                void *co = VERT_getCo(v, curLvl);
                void *nCo = VERT_getCo(v, nextLvl);
                int sharpCount = 0, allSharp = 1;
@@ -1701,7 +1716,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
                        if (seam && _edge_isBoundary(e))
                                seamEdges++;
 
-                       if (sharpness!=0.0f) {
+                       if (sharpness != 0.0f) {
                                sharpCount++;
                                avgSharpness += sharpness;
                        }
@@ -1737,7 +1752,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
 
                        VertDataCopy(nCo, co);
                        VertDataMulN(nCo, 0.75f);
-                       VertDataMulN(r, 0.25f/numBoundary);
+                       VertDataMulN(r, 0.25f / numBoundary);
                        VertDataAdd(nCo, r);
                }
                else {
@@ -1747,26 +1762,26 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
                        VertDataZero(q);
                        for (j = 0; j < v->numFaces; j++) {
                                CCGFace *f = v->faces[j];
-                               VertDataAdd(q, FACE_getIFCo(f, nextLvl, _face_getVertIndex(f,v), cornerIdx, cornerIdx));
+                               VertDataAdd(q, FACE_getIFCo(f, nextLvl, _face_getVertIndex(f, v), cornerIdx, cornerIdx));
                                numFaces++;
                        }
-                       VertDataMulN(q, 1.0f/numFaces);
+                       VertDataMulN(q, 1.0f / numFaces);
                        VertDataZero(r);
                        for (j = 0; j < v->numEdges; j++) {
                                CCGEdge *e = v->edges[j];
-                               VertDataAdd(r, _edge_getCoVert(e, v, curLvl, 1,vertDataSize));
+                               VertDataAdd(r, _edge_getCoVert(e, v, curLvl, 1, vertDataSize));
                                numEdges++;
                        }
-                       VertDataMulN(r, 1.0f/numEdges);
+                       VertDataMulN(r, 1.0f / numEdges);
 
                        VertDataCopy(nCo, co);
                        VertDataMulN(nCo, numEdges - 2.0f);
                        VertDataAdd(nCo, q);
                        VertDataAdd(nCo, r);
-                       VertDataMulN(nCo, 1.0f/numEdges);
+                       VertDataMulN(nCo, 1.0f / numEdges);
                }
 
-               if ((sharpCount>1 && v->numFaces) || seam) {
+               if ((sharpCount > 1 && v->numFaces) || seam) {
                        VertDataZero(q);
 
                        if (seam) {
@@ -1788,42 +1803,42 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
                                }
                        }
 
-                       VertDataMulN(q, (float) 1/sharpCount);
+                       VertDataMulN(q, (float) 1 / sharpCount);
 
-                       if (sharpCount!=2 || allSharp) {
-                                       // q = q + (co-q) * avgSharpness
+                       if (sharpCount != 2 || allSharp) {
+                               /* q = q + (co - q) * avgSharpness */
                                VertDataCopy(r, co);
                                VertDataSub(r, q);
                                VertDataMulN(r, avgSharpness);
                                VertDataAdd(q, r);
                        }
 
-                               // r = co*.75 + q*.25
+                       /* r = co * 0.75 + q * 0.25 */
                        VertDataCopy(r, co);
                        VertDataMulN(r, .75f);
                        VertDataMulN(q, .25f);
                        VertDataAdd(r, q);
 
-                               // nCo = nCo  + (r-nCo) * avgSharpness
+                       /* nCo = nCo  + (r - nCo) * avgSharpness */
                        VertDataSub(r, nCo);
                        VertDataMulN(r, avgSharpness);
                        VertDataAdd(nCo, r);
                }
        }
 
-               /* exterior edge interior shift
-                *  o old exterior edge midpoints (shifting)
-                *  o old exterior edge midpoints
-                *  o new interior face midpoints
-                */
+       /* exterior edge interior shift
+        * - old exterior edge midpoints (shifting)
+        * - old exterior edge midpoints
+        * - new interior face midpoints
+        */
        for (ptrIdx = 0; ptrIdx < numEffectedE; ptrIdx++) {
-               CCGEdge *e = (CCGEdge*) effectedE[ptrIdx];
+               CCGEdge *e = (CCGEdge *) effectedE[ptrIdx];
                float sharpness = EDGE_getSharpness(e, curLvl);
                int sharpCount = 0;
                float avgSharpness = 0.0;
                int x, j;
 
-               if (sharpness!=0.0f) {
+               if (sharpness != 0.0f) {
                        sharpCount = 2;
                        avgSharpness += sharpness;
 
@@ -1836,7 +1851,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
                        avgSharpness = 0;
                }
 
-               if (_edge_isBoundary(e) && (!e->numFaces || sharpCount<2)) {
+               if (_edge_isBoundary(e) && (!e->numFaces || sharpCount < 2)) {
                        for (x = 1; x < edgeSize - 1; x++) {
                                int fx = x * 2;
                                void *co = EDGE_getCo(e, curLvl, x);
@@ -1863,10 +1878,11 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
                                VertDataAdd(r, EDGE_getCo(e, curLvl, x + 1));
                                for (j = 0; j < e->numFaces; j++) {
                                        CCGFace *f = e->faces[j];
-                                       VertDataAdd(q, _face_getIFCoEdge(f, e, nextLvl, fx - 1, 1, subdivLevels, vertDataSize));
-                                       VertDataAdd(q, _face_getIFCoEdge(f, e, nextLvl, fx + 1, 1, subdivLevels, vertDataSize));
+                                       int f_ed_idx = _face_getEdgeIndex(f, e);
+                                       VertDataAdd(q, _face_getIFCoEdge(f, e, f_ed_idx, nextLvl, fx - 1, 1, subdivLevels, vertDataSize));
+                                       VertDataAdd(q, _face_getIFCoEdge(f, e, f_ed_idx, nextLvl, fx + 1, 1, subdivLevels, vertDataSize));
 
-                                       VertDataAdd(r, _face_getIFCoEdge(f, e, curLvl, x, 1, subdivLevels, vertDataSize));
+                                       VertDataAdd(r, _face_getIFCoEdge(f, e, f_ed_idx, curLvl, x, 1, subdivLevels, vertDataSize));
                                        numFaces++;
                                }
                                VertDataMulN(q, 1.0f / (numFaces * 2.0f));
@@ -1883,7 +1899,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
                                        VertDataMulN(q, 6.0f);
                                        VertDataAdd(q, EDGE_getCo(e, curLvl, x - 1));
                                        VertDataAdd(q, EDGE_getCo(e, curLvl, x + 1));
-                                       VertDataMulN(q, 1/8.0f);
+                                       VertDataMulN(q, 1 / 8.0f);
 
                                        VertDataSub(q, nCo);
                                        VertDataMulN(q, avgSharpness);
@@ -1905,36 +1921,36 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
 
                #pragma omp for schedule(static)
                for (ptrIdx = 0; ptrIdx < numEffectedF; ptrIdx++) {
-                       CCGFace *f = (CCGFace*) effectedF[ptrIdx];
+                       CCGFace *f = (CCGFace *) effectedF[ptrIdx];
                        int S, x, y;
 
-                               /* interior center point shift
-                                *  o old face center point (shifting)
-                                *  o old interior edge points
-                                *  o new interior face midpoints
-                                */
+                       /* interior center point shift
+                        * - old face center point (shifting)
+                        * - old interior edge points
+                        * - new interior face midpoints
+                        */
                        VertDataZero(q);
                        for (S = 0; S < f->numVerts; S++) {
                                VertDataAdd(q, FACE_getIFCo(f, nextLvl, S, 1, 1));
                        }
-                       VertDataMulN(q, 1.0f/f->numVerts);
+                       VertDataMulN(q, 1.0f / f->numVerts);
                        VertDataZero(r);
                        for (S = 0; S < f->numVerts; S++) {
                                VertDataAdd(r, FACE_getIECo(f, curLvl, S, 1));
                        }
-                       VertDataMulN(r, 1.0f/f->numVerts);
+                       VertDataMulN(r, 1.0f / f->numVerts);
 
                        VertDataMulN(FACE_getCenterData(f), f->numVerts - 2.0f);
                        VertDataAdd(FACE_getCenterData(f), q);
                        VertDataAdd(FACE_getCenterData(f), r);
-                       VertDataMulN(FACE_getCenterData(f), 1.0f/f->numVerts);
+                       VertDataMulN(FACE_getCenterData(f), 1.0f / f->numVerts);
 
                        for (S = 0; S < f->numVerts; S++) {
-                                       /* interior face shift
-                                        *  o old interior face point (shifting)
-                                        *  o new interior edge midpoints
-                                        *  o new interior face midpoints
-                                        */
+                               /* interior face shift
+                                * - old interior face point (shifting)
+                                * - new interior edge midpoints
+                                * - new interior face midpoints
+                                */
                                for (x = 1; x < gridSize - 1; x++) {
                                        for (y = 1; y < gridSize - 1; y++) {
                                                int fx = x * 2;
@@ -1961,11 +1977,11 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
                                        }
                                }
 
-                                       /* interior edge interior shift
-                                        *  o old interior edge point (shifting)
-                                        *  o new interior edge midpoints
-                                        *  o new interior face midpoints
-                                        */
+                               /* interior edge interior shift
+                                * - old interior edge point (shifting)
+                                * - new interior edge midpoints
+                                * - new interior face midpoints
+                                */
                                for (x = 1; x < gridSize - 1; x++) {
                                        int fx = x * 2;
                                        void *co = FACE_getIECo(f, curLvl, S, x);
@@ -1974,8 +1990,8 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
                                        VertDataAvg4(q,
                                                     FACE_getIFCo(f, nextLvl, (S + 1) % f->numVerts, 1, fx - 1),
                                                     FACE_getIFCo(f, nextLvl, (S + 1) % f->numVerts, 1, fx + 1),
-                                                    FACE_getIFCo(f, nextLvl, S, fx + 1, + 1),
-                                                    FACE_getIFCo(f, nextLvl, S, fx - 1, + 1));
+                                                    FACE_getIFCo(f, nextLvl, S, fx + 1, +1),
+                                                    FACE_getIFCo(f, nextLvl, S, fx - 1, +1));
 
                                        VertDataAvg4(r,
                                                     FACE_getIECo(f, nextLvl, S, fx - 1),
@@ -1998,7 +2014,7 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
                }
        }
 
-               /* copy down */
+       /* copy down */
        edgeSize = ccg_edgesize(nextLvl);
        gridSize = ccg_gridsize(nextLvl);
        cornerIdx = gridSize - 1;
@@ -2030,8 +2046,8 @@ static void ccgSubSurf__calcSubdivLevel(CCGSubSurf *ss,
                        }
                        for (x = 0; x < gridSize - 1; x++) {
                                int eI = gridSize - 1 - x;
-                               VertDataCopy(FACE_getIFCo(f, nextLvl, S, cornerIdx, x), _edge_getCoVert(e, FACE_getVerts(f)[S], nextLvl, eI,vertDataSize));
-                               VertDataCopy(FACE_getIFCo(f, nextLvl, S, x, cornerIdx), _edge_getCoVert(prevE, FACE_getVerts(f)[S], nextLvl, eI,vertDataSize));
+                               VertDataCopy(FACE_getIFCo(f, nextLvl, S, cornerIdx, x), _edge_getCoVert(e, FACE_getVerts(f)[S], nextLvl, eI, vertDataSize));
+                               VertDataCopy(FACE_getIFCo(f, nextLvl, S, x, cornerIdx), _edge_getCoVert(prevE, FACE_getVerts(f)[S], nextLvl, eI, vertDataSize));
                        }
                }
        }
@@ -2055,14 +2071,14 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
        effectedF = MEM_mallocN(sizeof(*effectedF) * ss->fMap->numEntries, "CCGSubsurf effectedF");
        numEffectedV = numEffectedE = numEffectedF = 0;
        for (i = 0; i < ss->vMap->curSize; i++) {
-               CCGVert *v = (CCGVert*) ss->vMap->buckets[i];
+               CCGVert *v = (CCGVert *) ss->vMap->buckets[i];
                for (; v; v = v->next) {
-                       if (v->flags&Vert_eEffected) {
+                       if (v->flags & Vert_eEffected) {
                                effectedV[numEffectedV++] = v;
 
                                for (j = 0; j < v->numEdges; j++) {
                                        CCGEdge *e = v->edges[j];
-                                       if (!(e->flags&Edge_eEffected)) {
+                                       if (!(e->flags & Edge_eEffected)) {
                                                effectedE[numEffectedE++] = e;
                                                e->flags |= Edge_eEffected;
                                        }
@@ -2070,7 +2086,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
 
                                for (j = 0; j < v->numFaces; j++) {
                                        CCGFace *f = v->faces[j];
-                                       if (!(f->flags&Face_eEffected)) {
+                                       if (!(f->flags & Face_eEffected)) {
                                                effectedF[numEffectedF++] = f;
                                                f->flags |= Face_eEffected;
                                        }
@@ -2089,7 +2105,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
                for (i = 0; i < f->numVerts; i++) {
                        VertDataAdd(co, VERT_getCo(FACE_getVerts(f)[i], curLvl));
                }
-               VertDataMulN(co, 1.0f/f->numVerts);
+               VertDataMulN(co, 1.0f / f->numVerts);
 
                f->flags = 0;
        }
@@ -2141,7 +2157,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
                        if (seam && _edge_isBoundary(e))
                                seamEdges++;
 
-                       if (sharpness!=0.0f) {
+                       if (sharpness != 0.0f) {
                                sharpCount++;
                                avgSharpness += sharpness;
                        }
@@ -2176,7 +2192,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
                        }
                        VertDataCopy(nCo, co);
                        VertDataMulN(nCo, 0.75f);
-                       VertDataMulN(r, 0.25f/numBoundary);
+                       VertDataMulN(r, 0.25f / numBoundary);
                        VertDataAdd(nCo, r);
                }
                else {
@@ -2188,23 +2204,23 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
                                VertDataAdd(q, FACE_getCenterData(f));
                                numFaces++;
                        }
-                       VertDataMulN(q, 1.0f/numFaces);
+                       VertDataMulN(q, 1.0f / numFaces);
                        VertDataZero(r);
                        for (i = 0; i < v->numEdges; i++) {
                                CCGEdge *e = v->edges[i];
                                VertDataAdd(r, VERT_getCo(_edge_getOtherVert(e, v), curLvl));
                                numEdges++;
                        }
-                       VertDataMulN(r, 1.0f/numEdges);
+                       VertDataMulN(r, 1.0f / numEdges);
 
                        VertDataCopy(nCo, co);
                        VertDataMulN(nCo, numEdges - 2.0f);
                        VertDataAdd(nCo, q);
                        VertDataAdd(nCo, r);
-                       VertDataMulN(nCo, 1.0f/numEdges);
+                       VertDataMulN(nCo, 1.0f / numEdges);
                }
 
-               if (sharpCount>1 || seam) {
+               if (sharpCount > 1 || seam) {
                        VertDataZero(q);
 
                        if (seam) {
@@ -2229,23 +2245,23 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
                                }
                        }
 
-                       VertDataMulN(q, (float) 1/sharpCount);
+                       VertDataMulN(q, (float) 1 / sharpCount);
 
-                       if (sharpCount!=2 || allSharp) {
-                                       // q = q + (co-q) * avgSharpness
+                       if (sharpCount != 2 || allSharp) {
+                               /* q = q + (co - q) * avgSharpness */
                                VertDataCopy(r, co);
                                VertDataSub(r, q);
                                VertDataMulN(r, avgSharpness);
                                VertDataAdd(q, r);
                        }
 
-                               // r = co*.75 + q*.25
+                       /* r = co * 0.75 + q * 0.25 */
                        VertDataCopy(r, co);
                        VertDataMulN(r, 0.75f);
                        VertDataMulN(q, 0.25f);
                        VertDataAdd(r, q);
 
-                               // nCo = nCo  + (r-nCo) * avgSharpness
+                       /* nCo = nCo  + (r - nCo) * avgSharpness */
                        VertDataSub(r, nCo);
                        VertDataMulN(r, avgSharpness);
                        VertDataAdd(nCo, r);
@@ -2258,19 +2274,19 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
                for (i = 0; i < numEffectedV; i++) {
                        CCGVert *v = effectedV[i];
                        byte *userData = ccgSubSurf_getVertUserData(ss, v);
-                       *((int*) &userData[ss->vertUserAgeOffset]) = ss->currentAge;
+                       *((int *) &userData[ss->vertUserAgeOffset]) = ss->currentAge;
                }
 
                for (i = 0; i < numEffectedE; i++) {
                        CCGEdge *e = effectedE[i];
                        byte *userData = ccgSubSurf_getEdgeUserData(ss, e);
-                       *((int*) &userData[ss->edgeUserAgeOffset]) = ss->currentAge;
+                       *((int *) &userData[ss->edgeUserAgeOffset]) = ss->currentAge;
                }
 
                for (i = 0; i < numEffectedF; i++) {
                        CCGFace *f = effectedF[i];
                        byte *userData = ccgSubSurf_getFaceUserData(ss, f);
-                       *((int*) &userData[ss->faceUserAgeOffset]) = ss->currentAge;
+                       *((int *) &userData[ss->faceUserAgeOffset]) = ss->currentAge;
                }
        }
 
@@ -2297,14 +2313,14 @@ static void ccgSubSurf__sync(CCGSubSurf *ss)
 
        for (curLvl = 1; curLvl < subdivLevels; curLvl++) {
                ccgSubSurf__calcSubdivLevel(ss,
-                       effectedV, effectedE, effectedF,
-                       numEffectedV, numEffectedE, numEffectedF, curLvl);
+                                           effectedV, effectedE, effectedF,
+                                           numEffectedV, numEffectedE, numEffectedF, curLvl);
        }
 
        if (ss->calcVertNormals)
                ccgSubSurf__calcVertNormals(ss,
-                       effectedV, effectedE, effectedF,
-                       numEffectedV, numEffectedE, numEffectedF);
+                                           effectedV, effectedE, effectedF,
+                                           numEffectedV, numEffectedE, numEffectedF);
 
        for (ptrIdx = 0; ptrIdx < numEffectedV; ptrIdx++) {
                CCGVert *v = effectedV[ptrIdx];
@@ -2329,7 +2345,7 @@ static void ccgSubSurf__allFaces(CCGSubSurf *ss, CCGFace ***faces, int *numFaces
                array = MEM_mallocN(sizeof(*array) * ss->fMap->numEntries, "CCGSubsurf allFaces");
                num = 0;
                for (i = 0; i < ss->fMap->curSize; i++) {
-                       CCGFace *f = (CCGFace*) ss->fMap->buckets[i];
+                       CCGFace *f = (CCGFace *) ss->fMap->buckets[i];
 
                        for (; f; f = f->next)
                                array[num++] = f;
@@ -2360,7 +2376,7 @@ static void ccgSubSurf__effectedFaceNeighbours(CCGSubSurf *ss, CCGFace **faces,
        }
 
        for (i = 0; i < ss->vMap->curSize; i++) {
-               CCGVert *v = (CCGVert*) ss->vMap->buckets[i];
+               CCGVert *v = (CCGVert *) ss->vMap->buckets[i];
 
                for (; v; v = v->next) {
                        for (j = 0; j < v->numFaces; j++)
@@ -2375,7 +2391,7 @@ static void ccgSubSurf__effectedFaceNeighbours(CCGSubSurf *ss, CCGFace **faces,
        }
 
        for (i = 0; i < ss->eMap->curSize; i++) {
-               CCGEdge *e = (CCGEdge*) ss->eMap->buckets[i];
+               CCGEdge *e = (CCGEdge *) ss->eMap->buckets[i];
 
                for (; e; e = e->next) {
                        for (j = 0; j < e->numFaces; j++)
@@ -2402,7 +2418,7 @@ CCGError ccgSubSurf_updateFromFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF
        int vertDataSize = ss->meshIFC.vertDataSize, freeF;
 
        subdivLevels = ss->subdivLevels;
-       lvl = (lvl)? lvl: subdivLevels;
+       lvl = (lvl) ? lvl : subdivLevels;
        gridSize = ccg_gridsize(lvl);
        cornerIdx = gridSize - 1;
 
@@ -2423,8 +2439,8 @@ CCGError ccgSubSurf_updateFromFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF
 
                        for (x = 0; x < gridSize; x++) {
                                int eI = gridSize - 1 - x;
-                               VertDataCopy(_edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI,vertDataSize), FACE_getIFCo(f, lvl, S, cornerIdx, x));
-                               VertDataCopy(_edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI,vertDataSize), FACE_getIFCo(f, lvl, S, x, cornerIdx));
+                               VertDataCopy(_edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI, vertDataSize), FACE_getIFCo(f, lvl, S, cornerIdx, x));
+                               VertDataCopy(_edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI, vertDataSize), FACE_getIFCo(f, lvl, S, x, cornerIdx));
                        }
                }
        }
@@ -2441,7 +2457,7 @@ CCGError ccgSubSurf_updateToFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF,
        int vertDataSize = ss->meshIFC.vertDataSize, freeF;
 
        subdivLevels = ss->subdivLevels;
-       lvl = (lvl)? lvl: subdivLevels;
+       lvl = (lvl) ? lvl : subdivLevels;
        gridSize = ccg_gridsize(lvl);
        cornerIdx = gridSize - 1;
 
@@ -2457,8 +2473,8 @@ CCGError ccgSubSurf_updateToFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF,
 
                        for (x = 0; x < gridSize; x++) {
                                int eI = gridSize - 1 - x;
-                               VertDataCopy(FACE_getIFCo(f, lvl, S, cornerIdx, x), _edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI,vertDataSize));
-                               VertDataCopy(FACE_getIFCo(f, lvl, S, x, cornerIdx), _edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI,vertDataSize));
+                               VertDataCopy(FACE_getIFCo(f, lvl, S, cornerIdx, x), _edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI, vertDataSize));
+                               VertDataCopy(FACE_getIFCo(f, lvl, S, x, cornerIdx), _edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI, vertDataSize));
                        }
 
                        for (x = 1; x < gridSize - 1; x++) {
@@ -2487,14 +2503,14 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in
        int vertDataSize = ss->meshIFC.vertDataSize;
 
        subdivLevels = ss->subdivLevels;
-       lvl = (lvl)? lvl: subdivLevels;
+       lvl = (lvl) ? lvl : subdivLevels;
        gridSize = ccg_gridsize(lvl);
        edgeSize = ccg_edgesize(lvl);
        cornerIdx = gridSize - 1;
 
        ccgSubSurf__allFaces(ss, &effectedF, &numEffectedF, &freeF);
        ccgSubSurf__effectedFaceNeighbours(ss, effectedF, numEffectedF,
-               &effectedV, &numEffectedV, &effectedE, &numEffectedE);
+                                          &effectedV, &numEffectedV, &effectedE, &numEffectedE);
 
        /* zero */
        for (i = 0; i < numEffectedV; i++) {
@@ -2527,7 +2543,7 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in
                        CCGEdge *prevE = FACE_getEdges(f)[prevS];
 
                        VertDataAdd(FACE_getCenterData(f), FACE_getIFCo(f, lvl, S, 0, 0));
-                       if (FACE_getVerts(f)[S]->flags&Vert_eEffected)
+                       if (FACE_getVerts(f)[S]->flags & Vert_eEffected)
                                VertDataAdd(VERT_getCo(FACE_getVerts(f)[S], lvl), FACE_getIFCo(f, lvl, S, cornerIdx, cornerIdx));
 
                        for (x = 1; x < gridSize - 1; x++) {
@@ -2537,11 +2553,11 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in
 
                        for (x = 0; x < gridSize - 1; x++) {
                                int eI = gridSize - 1 - x;
-                               if (FACE_getEdges(f)[S]->flags&Edge_eEffected)
-                                       VertDataAdd(_edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI,vertDataSize), FACE_getIFCo(f, lvl, S, cornerIdx, x));
-                               if (FACE_getEdges(f)[prevS]->flags&Edge_eEffected)
+                               if (FACE_getEdges(f)[S]->flags & Edge_eEffected)
+                                       VertDataAdd(_edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI, vertDataSize), FACE_getIFCo(f, lvl, S, cornerIdx, x));
+                               if (FACE_getEdges(f)[prevS]->flags & Edge_eEffected)
                                        if (x != 0)
-                                               VertDataAdd(_edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI,vertDataSize), FACE_getIFCo(f, lvl, S, x, cornerIdx));
+                                               VertDataAdd(_edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI, vertDataSize), FACE_getIFCo(f, lvl, S, x, cornerIdx));
                        }
                }
        }
@@ -2550,7 +2566,7 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in
        for (i = 0; i < numEffectedV; i++) {
                CCGVert *v = effectedV[i];
                if (v->numFaces)
-                       VertDataMulN(VERT_getCo(v, lvl), 1.0f/v->numFaces);
+                       VertDataMulN(VERT_getCo(v, lvl), 1.0f / v->numFaces);
        }
 
        for (i = 0; i < numEffectedE; i++) {
@@ -2561,14 +2577,14 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in
 
                if (e->numFaces)
                        for (x = 1; x < edgeSize - 1; x++)
-                               VertDataMulN(EDGE_getCo(e, lvl, x), 1.0f/e->numFaces);
+                               VertDataMulN(EDGE_getCo(e, lvl, x), 1.0f / e->numFaces);
        }
 
        /* copy */
        for (i = 0; i < numEffectedF; i++) {
                CCGFace *f = effectedF[i];
 
-               VertDataMulN(FACE_getCenterData(f), 1.0f/f->numVerts);
+               VertDataMulN(FACE_getCenterData(f), 1.0f / f->numVerts);
 
                for (S = 0; S < f->numVerts; S++)
                        for (x = 1; x < gridSize - 1; x++)
@@ -2589,8 +2605,8 @@ CCGError ccgSubSurf_stitchFaces(CCGSubSurf *ss, int lvl, CCGFace **effectedF, in
 
                        for (x = 0; x < gridSize - 1; x++) {
                                int eI = gridSize - 1 - x;
-                               VertDataCopy(FACE_getIFCo(f, lvl, S, cornerIdx, x), _edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI,vertDataSize));
-                               VertDataCopy(FACE_getIFCo(f, lvl, S, x, cornerIdx), _edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI,vertDataSize));
+                               VertDataCopy(FACE_getIFCo(f, lvl, S, cornerIdx, x), _edge_getCoVert(e, FACE_getVerts(f)[S], lvl, eI, vertDataSize));
+                               VertDataCopy(FACE_getIFCo(f, lvl, S, x, cornerIdx), _edge_getCoVert(prevE, FACE_getVerts(f)[S], lvl, eI, vertDataSize));
                        }
 
                        VertDataCopy(FACE_getIECo(f, lvl, S, 0), FACE_getCenterData(f));
@@ -2621,12 +2637,12 @@ CCGError ccgSubSurf_updateNormals(CCGSubSurf *ss, CCGFace **effectedF, int numEf
 
        ccgSubSurf__allFaces(ss, &effectedF, &numEffectedF, &freeF);
        ccgSubSurf__effectedFaceNeighbours(ss, effectedF, numEffectedF,
-               &effectedV, &numEffectedV, &effectedE, &numEffectedE);
+                                          &effectedV, &numEffectedV, &effectedE, &numEffectedE);
 
        if (ss->calcVertNormals)
                ccgSubSurf__calcVertNormals(ss,
-                       effectedV, effectedE, effectedF,
-                       numEffectedV, numEffectedE, numEffectedF);
+                                           effectedV, effectedE, effectedF,
+                                           numEffectedV, numEffectedE, numEffectedF);
 
        for (i = 0; i < numEffectedV; i++)
                effectedV[i]->flags = 0;
@@ -2654,12 +2670,12 @@ CCGError ccgSubSurf_updateLevels(CCGSubSurf *ss, int lvl, CCGFace **effectedF, i
 
        ccgSubSurf__allFaces(ss, &effectedF, &numEffectedF, &freeF);
        ccgSubSurf__effectedFaceNeighbours(ss, effectedF, numEffectedF,
-               &effectedV, &numEffectedV, &effectedE, &numEffectedE);
+                                          &effectedV, &numEffectedV, &effectedE, &numEffectedE);
 
        for (curLvl = lvl; curLvl < subdivLevels; curLvl++) {
                ccgSubSurf__calcSubdivLevel(ss,
-                       effectedV, effectedE, effectedF,
-                       numEffectedV, numEffectedE, numEffectedF, curLvl);
+                                           effectedV, effectedE, effectedF,
+                                           numEffectedV, numEffectedE, numEffectedF, curLvl);
        }
 
        for (i = 0; i < numEffectedV; i++)
@@ -2698,15 +2714,15 @@ int ccgSubSurf_getNumFaces(const CCGSubSurf *ss)
 
 CCGVert *ccgSubSurf_getVert(CCGSubSurf *ss, CCGVertHDL v)
 {
-       return (CCGVert*) _ehash_lookup(ss->vMap, v);
+       return (CCGVert *) _ehash_lookup(ss->vMap, v);
 }
 CCGEdge *ccgSubSurf_getEdge(CCGSubSurf *ss, CCGEdgeHDL e)
 {
-       return (CCGEdge*) _ehash_lookup(ss->eMap, e);
+       return (CCGEdge *) _ehash_lookup(ss->eMap, e);
 }
 CCGFace *ccgSubSurf_getFace(CCGSubSurf *ss, CCGFaceHDL f)
 {
-       return (CCGFace*) _ehash_lookup(ss->fMap, f);
+       return (CCGFace *) _ehash_lookup(ss->fMap, f);
 }
 
 int ccgSubSurf_getSubdivisionLevels(const CCGSubSurf *ss)
@@ -2719,7 +2735,7 @@ int ccgSubSurf_getEdgeSize(const CCGSubSurf *ss)
 }
 int ccgSubSurf_getEdgeLevelSize(const CCGSubSurf *ss, int level)
 {
-       if (level<1 || level > ss->subdivLevels) {
+       if (level < 1 || level > ss->subdivLevels) {
                return -1;
        }
        else {
@@ -2732,7 +2748,7 @@ int ccgSubSurf_getGridSize(const CCGSubSurf *ss)
 }
 int ccgSubSurf_getGridLevelSize(const CCGSubSurf *ss, int level)
 {
-       if (level<1 || level > ss->subdivLevels) {
+       if (level < 1 || level > ss->subdivLevels) {
                return -1;
        }
        else {
@@ -2750,7 +2766,7 @@ int ccgSubSurf_getVertAge(CCGSubSurf *ss, CCGVert *v)
 {
        if (ss->useAgeCounts) {
                byte *userData = ccgSubSurf_getVertUserData(ss, v);
-               return ss->currentAge - *((int*) &userData[ss->vertUserAgeOffset]);
+               return ss->currentAge - *((int *) &userData[ss->vertUserAgeOffset]);
        }
        else {
                return 0;
@@ -2766,7 +2782,7 @@ int ccgSubSurf_getVertNumFaces(CCGVert *v)
 }
 CCGFace *ccgSubSurf_getVertFace(CCGVert *v, int index)
 {
-       if (index<0 || index>=v->numFaces) {
+       if (index < 0 || index >= v->numFaces) {
                return NULL;
        }
        else {
@@ -2779,7 +2795,7 @@ int ccgSubSurf_getVertNumEdges(CCGVert *v)
 }
 CCGEdge *ccgSubSurf_getVertEdge(CCGVert *v, int index)
 {
-       if (index<0 || index>=v->numEdges) {
+       if (index < 0 || index >= v->numEdges) {
                return NULL;
        }
        else {
@@ -2792,7 +2808,7 @@ void *ccgSubSurf_getVertData(CCGSubSurf *ss, CCGVert *v)
 }
 void *ccgSubSurf_getVertLevelData(CCGSubSurf *ss, CCGVert *v, int level)
 {
-       if (level<0 || level > ss->subdivLevels) {
+       if (level < 0 || level > ss->subdivLevels) {
                return NULL;
        }
        else {
@@ -2810,7 +2826,7 @@ int ccgSubSurf_getEdgeAge(CCGSubSurf *ss, CCGEdge *e)
 {
        if (ss->useAgeCounts) {
                byte *userData = ccgSubSurf_getEdgeUserData(ss, e);
-               return ss->currentAge - *((int*) &userData[ss->edgeUserAgeOffset]);
+               return ss->currentAge - *((int *) &userData[ss->edgeUserAgeOffset]);
        }
        else {
                return 0;
@@ -2819,7 +2835,7 @@ int ccgSubSurf_getEdgeAge(CCGSubSurf *ss, CCGEdge *e)
 void *ccgSubSurf_getEdgeUserData(CCGSubSurf *ss, CCGEdge *e)
 {
        return (EDGE_getLevelData(e) +
-                       ss->meshIFC.vertDataSize * ccg_edgebase(ss->subdivLevels + 1));
+               ss->meshIFC.vertDataSize * ccg_edgebase(ss->subdivLevels + 1));
 }
 int ccgSubSurf_getEdgeNumFaces(CCGEdge *e)
 {
@@ -2827,7 +2843,7 @@ int ccgSubSurf_getEdgeNumFaces(CCGEdge *e)
 }
 CCGFace *ccgSubSurf_getEdgeFace(CCGEdge *e, int index)
 {
-       if (index<0 || index>=e->numFaces) {
+       if (index < 0 || index >= e->numFaces) {
                return NULL;
        }
        else {
@@ -2852,7 +2868,7 @@ void *ccgSubSurf_getEdgeData(CCGSubSurf *ss, CCGEdge *e, int x)
 }
 void *ccgSubSurf_getEdgeLevelData(CCGSubSurf *ss, CCGEdge *e, int x, int level)
 {
-       if (level<0 || level > ss->subdivLevels) {
+       if (level < 0 || level > ss->subdivLevels) {
                return NULL;
        }
        else {
@@ -2874,7 +2890,7 @@ int ccgSubSurf_getFaceAge(CCGSubSurf *ss, CCGFace *f)
 {
        if (ss->useAgeCounts) {
                byte *userData = ccgSubSurf_getFaceUserData(ss, f);
-               return ss->currentAge - *((int*) &userData[ss->faceUserAgeOffset]);
+               return ss->currentAge - *((int *) &userData[ss->faceUserAgeOffset]);
        }
        else {
                return 0;
@@ -2891,7 +2907,7 @@ int ccgSubSurf_getFaceNumVerts(CCGFace *f)
 }
 CCGVert *ccgSubSurf_getFaceVert(CCGFace *f, int index)
 {
-       if (index<0 || index>=f->numVerts) {
+       if (index < 0 || index >= f->numVerts) {
                return NULL;
        }
        else {
@@ -2900,7 +2916,7 @@ CCGVert *ccgSubSurf_getFaceVert(CCGFace *f, int index)
 }
 CCGEdge *ccgSubSurf_getFaceEdge(CCGFace *f, int index)
 {
-       if (index<0 || index>=f->numVerts) {
+       if (index < 0 || index >= f->numVerts) {
                return NULL;
        }
        else {
@@ -2943,66 +2959,66 @@ void *ccgSubSurf_getFaceGridData(CCGSubSurf *ss, CCGFace *f, int gridIndex, int
 
 CCGVertIterator *ccgSubSurf_getVertIterator(CCGSubSurf *ss)
 {
-       return (CCGVertIterator*) _ehashIterator_new(ss->vMap);
+       return (CCGVertIterator *) _ehashIterator_new(ss->vMap);
 }
 CCGEdgeIterator *ccgSubSurf_getEdgeIterator(CCGSubSurf *ss)
 {
-       return (CCGEdgeIterator*) _ehashIterator_new(ss->eMap);
+       return (CCGEdgeIterator *) _ehashIterator_new(ss->eMap);
 }
 CCGFaceIterator *ccgSubSurf_getFaceIterator(CCGSubSurf *ss)
 {
-       return (CCGFaceIterator*) _ehashIterator_new(ss->fMap);
+       return (CCGFaceIterator *) _ehashIterator_new(ss->fMap);
 }
 
 CCGVert *ccgVertIterator_getCurrent(CCGVertIterator *vi)
 {
-       return (CCGVert*) _ehashIterator_getCurrent((EHashIterator*) vi);
+       return (CCGVert *) _ehashIterator_getCurrent((EHashIterator *) vi);
 }
 int ccgVertIterator_isStopped(CCGVertIterator *vi)
 {
-       return _ehashIterator_isStopped((EHashIterator*) vi);
+       return _ehashIterator_isStopped((EHashIterator *) vi);
 }
 void ccgVertIterator_next(CCGVertIterator *vi)
 {
-       _ehashIterator_next((EHashIterator*) vi); 
+       _ehashIterator_next((EHashIterator *) vi);
 }
 void ccgVertIterator_free(CCGVertIterator *vi)
 {
-       _ehashIterator_free((EHashIterator*) vi);
+       _ehashIterator_free((EHashIterator *) vi);
 }
 
 CCGEdge *ccgEdgeIterator_getCurrent(CCGEdgeIterator *vi)
 {
-       return (CCGEdge*) _ehashIterator_getCurrent((EHashIterator*) vi);
+       return (CCGEdge *) _ehashIterator_getCurrent((EHashIterator *) vi);
 }
 int ccgEdgeIterator_isStopped(CCGEdgeIterator *vi)
 {
-       return _ehashIterator_isStopped((EHashIterator*) vi);
+       return _ehashIterator_isStopped((EHashIterator *) vi);
 }
 void ccgEdgeIterator_next(CCGEdgeIterator *vi)
 {
-       _ehashIterator_next((EHashIterator*) vi); 
+       _ehashIterator_next((EHashIterator *) vi);
 }
 void ccgEdgeIterator_free(CCGEdgeIterator *vi)
 {
-       _ehashIterator_free((EHashIterator*) vi);
+       _ehashIterator_free((EHashIterator *) vi);
 }
 
 CCGFace *ccgFaceIterator_getCurrent(CCGFaceIterator *vi)
 {
-       return (CCGFace*) _ehashIterator_getCurrent((EHashIterator*) vi);
+       return (CCGFace *) _ehashIterator_getCurrent((EHashIterator *) vi);
 }
 int ccgFaceIterator_isStopped(CCGFaceIterator *vi)
 {
-       return _ehashIterator_isStopped((EHashIterator*) vi);
+       return _ehashIterator_isStopped((EHashIterator *) vi);
 }
 void ccgFaceIterator_next(CCGFaceIterator *vi)
 {
-       _ehashIterator_next((EHashIterator*) vi); 
+       _ehashIterator_next((EHashIterator *) vi);
 }
 void ccgFaceIterator_free(CCGFaceIterator *vi)
 {
-       _ehashIterator_free((EHashIterator*) vi);
+       _ehashIterator_free((EHashIterator *) vi);
 }
 
 /*** Extern API final vert/edge/face interface ***/
index 94aed7c7a01669c2346077da1167e4faa20c8234..c28958d5b0db4291d90277a8c94e562811ed61fe 100644 (file)
@@ -274,7 +274,7 @@ void DM_init_funcs(DerivedMesh *dm)
 }
 
 void DM_init(DerivedMesh *dm, DerivedMeshType type, int numVerts, int numEdges,
-            int numTessFaces, int numLoops, int numPolys)
+             int numTessFaces, int numLoops, int numPolys)
 {
        dm->type = type;
        dm->numVertData = numVerts;
@@ -2137,7 +2137,7 @@ static void mesh_build_data(Scene *scene, Object *ob, CustomDataMask dataMask,
 
        if ((ob->mode & OB_MODE_SCULPT) && ob->sculpt) {
                /* create PBVH immediately (would be created on the fly too,
-                  but this avoids waiting on first stroke) */
+                * but this avoids waiting on first stroke) */
                ob->sculpt->pbvh= ob->derivedFinal->getPBVH(ob, ob->derivedFinal);
        }
 }
@@ -2769,7 +2769,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
        for (b = 0; b < gattribs->totlayer; b++) {
                if (gattribs->layer[b].type == CD_MTFACE) {
                        /* uv coordinates */
-                       if(dm->type == DM_TYPE_EDITBMESH) {
+                       if (dm->type == DM_TYPE_EDITBMESH) {
                                /* exception .. */
                                CustomData *ldata = dm->getLoopDataLayout(dm);
 
@@ -2806,7 +2806,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
                        }
                }
                else if (gattribs->layer[b].type == CD_MCOL) {
-                       if(dm->type == DM_TYPE_EDITBMESH) {
+                       if (dm->type == DM_TYPE_EDITBMESH) {
                                /* exception .. */
                                CustomData *ldata = dm->getLoopDataLayout(dm);
 
index c77e384a2640bd9ab7989df19d503a6eef70efaa..93401a528ab88c3bcf15ed784810daa942c6390a 100644 (file)
@@ -1561,7 +1561,7 @@ static void do_nla(Scene *scene, Object *ob, int blocktype)
                                                }
                                        }
                                        /* To handle repeat, we add 0.1 frame extra to make sure the last frame is included */
-                                       else  {
+                                       else {
                                                
                                                /* Mod to repeat */
                                                if (strip->repeat!=1.0f) {
index b547fedebb50619e700e8351983cffcc31be8e2b..1ec9f7d8a109bdcbf2babb71242fd180604e15a1 100644 (file)
@@ -635,7 +635,7 @@ int where_on_path(Object *ob, float ctime, float vec[4], float dir[3], float qua
        p3= pp + s3;
 
        /* note, commented out for follow constraint */
-       //if(cu->flag & CU_FOLLOW) {
+       //if (cu->flag & CU_FOLLOW) {
 
                key_curve_tangent_weights(1.0f-fac, data, KEY_BSPLINE);
 
index a14988d78b1bd83cddb97b638476ca4bd74c5d86..a556c99dc7dc0ba3954497ecbbcf03cb8d4802b9 100644 (file)
@@ -1254,7 +1254,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
 
        madd_v3_v3fl(pa->state.vel, acc, dtime);
 
-       //if(bpa->data.mode != eBoidMode_InAir)
+       //if (bpa->data.mode != eBoidMode_InAir)
        bpa->ground = boid_find_ground(bbd, pa, ground_co, ground_nor);
 
        /* change modes, constrain movement & keep track of down vector */
index 2d764142d269679c99704942283151c505036f42..474aa84fec68b3cf0018c0397e4dfcb7986b3a19 100644 (file)
@@ -412,8 +412,9 @@ static void cdDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges
                DEBUG_VBO( "Using legacy code. cdDM_drawEdges\n" );
                glBegin(GL_LINES);
                for (i = 0; i < dm->numEdgeData; i++, medge++) {
-                       if ((drawAllEdges || (medge->flag&ME_EDGEDRAW))
-                          && (drawLooseEdges || !(medge->flag&ME_LOOSEEDGE))) {
+                       if ((drawAllEdges || (medge->flag & ME_EDGEDRAW)) &&
+                           (drawLooseEdges || !(medge->flag & ME_LOOSEEDGE)))
+                       {
                                glVertex3fv(mvert[medge->v1].co);
                                glVertex3fv(mvert[medge->v2].co);
                        }
@@ -423,17 +424,18 @@ static void cdDM_drawEdges(DerivedMesh *dm, int drawLooseEdges, int drawAllEdges
        else {  /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */
                int prevstart = 0;
                int prevdraw = 1;
-               int draw = 1;
+               int draw = TRUE;
 
                GPU_edge_setup(dm);
-               if ( !GPU_buffer_legacy(dm) ) {
+               if (!GPU_buffer_legacy(dm)) {
                        for (i = 0; i < dm->numEdgeData; i++, medge++) {
-                               if ((drawAllEdges || (medge->flag&ME_EDGEDRAW))
-                                  && (drawLooseEdges || !(medge->flag&ME_LOOSEEDGE))) {
-                                       draw = 1;
+                               if ((drawAllEdges || (medge->flag & ME_EDGEDRAW)) &&
+                                   (drawLooseEdges || !(medge->flag & ME_LOOSEEDGE)))
+                               {
+                                       draw = TRUE;
                                } 
                                else {
-                                       draw = 0;
+                                       draw = FALSE;
                                }
                                if ( prevdraw != draw ) {
                                        if ( prevdraw > 0 && (i-prevstart) > 0 ) {
@@ -538,8 +540,7 @@ static void cdDM_drawFacesSolid(DerivedMesh *dm,
                        new_matnr = mface->mat_nr + 1;
                        new_shademodel = (mface->flag & ME_SMOOTH)?GL_SMOOTH:GL_FLAT;
                        
-                       if (new_glmode != glmode || new_matnr != matnr
-                          || new_shademodel != shademodel) {
+                       if (new_glmode != glmode || new_matnr != matnr || new_shademodel != shademodel) {
                                glEnd();
 
                                drawCurrentMat = setMaterial(matnr = new_matnr, NULL);
@@ -700,14 +701,17 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
                GPU_normal_setup( dm );
                GPU_uv_setup( dm );
                if ( col != NULL ) {
-                       /*if( realcol && dm->drawObject->colType == CD_TEXTURE_MCOL ) {
+#if 0
+                       if ( realcol && dm->drawObject->colType == CD_TEXTURE_MCOL ) {
                                col = 0;
                        }
                        else if ( mcol && dm->drawObject->colType == CD_MCOL ) {
                                col = 0;
                        }
                        
-                       if ( col != 0 ) {*/
+                       if ( col != 0 )
+#endif
+                       {
                                unsigned char *colors = MEM_mallocN(dm->getNumTessFaces(dm)*4*3*sizeof(unsigned char), "cdDM_drawFacesTex_common");
                                for ( i=0; i < dm->getNumTessFaces(dm); i++ ) {
                                        for ( j=0; j < 4; j++ ) {
@@ -723,7 +727,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
                                        dm->drawObject->colType = CD_TEXTURE_MCOL;
                                else if (mcol)
                                        dm->drawObject->colType = CD_MCOL;
-                       //}
+                       }
                        GPU_color_setup( dm );
                }
 
index 7dedd71b2e04a6c3d5fc68d4a6832013e5506d29..a0c273cf962a70335bb68a2e0b20ff6f2294a629 100644 (file)
@@ -446,9 +446,9 @@ void clothModifier_do(ClothModifierData *clmd, Scene *scene, Object *ob, Derived
        BKE_ptcache_id_time(&pid, scene, framenr, &startframe, &endframe, &timescale);
        clmd->sim_parms->timescale= timescale;
 
-       if (clmd->sim_parms->reset
-               || (framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0)
-               || (clmd->clothObject && dm->getNumVerts(dm) != clmd->clothObject->numverts))
+       if (clmd->sim_parms->reset ||
+           (framenr == (startframe - clmd->sim_parms->preroll) && clmd->sim_parms->preroll != 0) ||
+           (clmd->clothObject && dm->getNumVerts(dm) != clmd->clothObject->numverts))
        {
                clmd->sim_parms->reset = 0;
                cache->flag |= PTCACHE_OUTDATED;
@@ -1176,8 +1176,8 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
                                
                                // check for existing spring
                                // check also if startpoint is equal to endpoint
-                               if ( !BLI_edgehash_haskey ( edgehash, MIN2(tspring2->ij, index2), MAX2(tspring2->ij, index2) )
-                               && ( index2!=tspring2->ij ) )
+                               if (!BLI_edgehash_haskey(edgehash, MIN2(tspring2->ij, index2), MAX2(tspring2->ij, index2)) &&
+                                   (index2 != tspring2->ij))
                                {
                                        spring = ( ClothSpring * ) MEM_callocN ( sizeof ( ClothSpring ), "cloth spring" );
                                        
index f6a6ef068d6b6e067306c7a51ec2e8286c5000f0..7195fb9c425783d9c427c7b7bba776d2dfae18da 100644 (file)
@@ -2502,8 +2502,8 @@ int cloth_bvh_objcollision (Object *ob, ClothModifierData * clmd, float step, fl
        
                                                if ( clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL )
                                                {
-                                                       if ( ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED )
-                                                                               && ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED ) )
+                                                       if ( ( cloth->verts [i].flags & CLOTH_VERT_FLAG_PINNED ) &&
+                                                            ( cloth->verts [j].flags & CLOTH_VERT_FLAG_PINNED ) )
                                                        {
                                                                continue;
                                                        }
index 536d4d9c823ababe40fcd9781836e732c9eea9e2..afb5e85ffa8d027fc53d09d98315f19f51cf7b38 100644 (file)
@@ -1810,9 +1810,9 @@ void CustomData_copy_data(const CustomData *source, CustomData *dest,
                /* find the first dest layer with type >= the source type
                 * (this should work because layers are ordered by type)
                 */
-               while (dest_i < dest->totlayer
-                         && dest->layers[dest_i].type < source->layers[src_i].type)
+               while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
                        ++dest_i;
+               }
 
                /* if there are no more dest layers, we're done */
                if (dest_i >= dest->totlayer) return;
@@ -1901,9 +1901,9 @@ void CustomData_interp(const CustomData *source, CustomData *dest,
                /* find the first dest layer with type >= the source type
                 * (this should work because layers are ordered by type)
                 */
-               while (dest_i < dest->totlayer
-                         && dest->layers[dest_i].type < source->layers[src_i].type)
+               while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
                        ++dest_i;
+               }
 
                /* if there are no more dest layers, we're done */
                if (dest_i >= dest->totlayer) return;
@@ -2056,7 +2056,7 @@ void CustomData_set(const CustomData *data, int index, int type, void *source)
 /*Bmesh functions*/
 /*needed to convert to/from different face reps*/
 void CustomData_to_bmeshpoly(CustomData *fdata, CustomData *pdata, CustomData *ldata,
-                            int totloop, int totpoly)
+                             int totloop, int totpoly)
 {
        int i;
        for (i=0; i < fdata->totlayer; i++) {
@@ -2167,7 +2167,7 @@ void CustomData_bmesh_merge(CustomData *source, CustomData *dest,
        int t;
 
        /* copy old layer description so that old data can be copied into
-          the new allocation */
+        * the new allocation */
        destold = *dest;
        if (destold.layers) destold.layers = MEM_dupallocN(destold.layers);
        
@@ -2272,9 +2272,9 @@ void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest,
                /* find the first dest layer with type >= the source type
                 * (this should work because layers are ordered by type)
                 */
-               while (dest_i < dest->totlayer
-                         && dest->layers[dest_i].type < source->layers[src_i].type)
+               while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
                        ++dest_i;
+               }
 
                /* if there are no more dest layers, we're done */
                if (dest_i >= dest->totlayer) return;
@@ -2504,9 +2504,9 @@ void CustomData_to_bmesh_block(const CustomData *source, CustomData *dest,
                /* find the first dest layer with type >= the source type
                 * (this should work because layers are ordered by type)
                 */
-               while (dest_i < dest->totlayer
-                         && dest->layers[dest_i].type < source->layers[src_i].type)
+               while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
                        ++dest_i;
+               }
 
                /* if there are no more dest layers, we're done */
                if (dest_i >= dest->totlayer) return;
@@ -2547,9 +2547,9 @@ void CustomData_from_bmesh_block(const CustomData *source, CustomData *dest,
                /* find the first dest layer with type >= the source type
                 * (this should work because layers are ordered by type)
                 */
-               while (dest_i < dest->totlayer
-                         && dest->layers[dest_i].type < source->layers[src_i].type)
+               while (dest_i < dest->totlayer && dest->layers[dest_i].type < source->layers[src_i].type) {
                        ++dest_i;
+               }
 
                /* if there are no more dest layers, we're done */
                if (dest_i >= dest->totlayer) return;
index 366e808d32c22ba39037a68df9ee6dc552e10a4a..aa6d42977caa5dcb8185b2de8e5ef02b0f90bc06 100644 (file)
@@ -1309,11 +1309,11 @@ DagNodeQueue * graph_dfs(void)
                                                /* is_cycle = 1; */ /* UNUSED */
                                        }
                                        else if (itA->node->color == DAG_BLACK) {
-                                               ;
                                                /* already processed node but we may want later to change distance either to shorter to longer.
                                                 * DFS_dist is the first encounter  
                                                 */
-                                               /*if (node->DFS_dist >= itA->node->DFS_dist)
+#if 0
+                                               if (node->DFS_dist >= itA->node->DFS_dist)
                                                        itA->node->DFS_dist = node->DFS_dist + 1;
 
                                                        fprintf(stderr,"dfs forward or cross edge :%15s %i-%i %15s %i-%i\n",
@@ -1323,7 +1323,7 @@ DagNodeQueue * graph_dfs(void)
                                                                ((ID *) itA->node->ob)->name, 
                                                                itA->node->DFS_dvtm,
                                                                itA->node->DFS_fntm);
-                                       */
+#endif
                                        }
                                        else
                                                fprintf(stderr,"dfs unknown edge\n");
@@ -1579,6 +1579,7 @@ struct DagNodeQueue *get_all_childs(struct DagForest      *dag, void *ob)
 }
 
 /* unused */
+#if 0
 short  are_obs_related(struct DagForest        *dag, void *ob1, void *ob2)
 {
        DagNode * node;
@@ -1595,6 +1596,7 @@ short     are_obs_related(struct DagForest        *dag, void *ob1, void *ob2)
        }
        return DAG_NO_RELATION;
 }
+#endif
 
 int    is_acyclic( DagForest   *dag)
 {
@@ -1803,7 +1805,7 @@ void DAG_scene_sort(Main *bmain, Scene *sce)
        while (base) {
                BLI_remlink(&sce->base,base);
                BLI_addhead(&tempbase,base);
-               //if(G.debug & G_DEBUG)
+               //if (G.debug & G_DEBUG)
                        printf("cyclic %s\n", base->object->id.name);
                base = sce->base.first;
        }
index 872f678d456e8381b40decbab6c9457585a0f7ee..943c8a2099072307f40eab996b28873e5c5e7fd5 100644 (file)
@@ -1844,8 +1844,7 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene
                                BKE_ptcache_id_time(&pid, scene, (float)scene->r.cfra, NULL, NULL, NULL);
 
                                /* reset non-baked cache at first frame */
-                               if ((int)scene->r.cfra == surface->start_frame && !(cache->flag & PTCACHE_BAKED))
-                               {
+                               if ((int)scene->r.cfra == surface->start_frame && !(cache->flag & PTCACHE_BAKED)) {
                                        cache->flag |= PTCACHE_REDO_NEEDED;
                                        BKE_ptcache_id_reset(scene, &pid, PTCACHE_RESET_OUTDATED);
                                        cache->flag &= ~PTCACHE_REDO_NEEDED;
@@ -1856,8 +1855,7 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene
                                        BKE_ptcache_validate(cache, (int)scene->r.cfra);
                                }
                                /* if read failed and we're on surface range do recalculate */
-                               else if ((int)scene->r.cfra == current_frame
-                                       && !(cache->flag & PTCACHE_BAKED)) {
+                               else if ((int)scene->r.cfra == current_frame && !(cache->flag & PTCACHE_BAKED)) {
                                        /* calculate surface frame */
                                        canvas->flags |= MOD_DPAINT_BAKING;
                                        dynamicPaint_calculateFrame(surface, scene, ob, current_frame);
@@ -3337,7 +3335,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
                                                                else if (brush->ray_dir == MOD_DPAINT_RAY_BRUSH_AVG) {
                                                                        copy_v3_v3(proj_ray, avg_brushNor);
                                                                }
-                                                               else  { /* MOD_DPAINT_RAY_ZPLUS */
+                                                               else { /* MOD_DPAINT_RAY_ZPLUS */
                                                                        proj_ray[2] = 1.0f;
                                                                }
                                                                hit.index = -1;
index b6aebcddd4c22ab6bd8d1a3bee84396bb4e57862..857f6e75e2c97b2c26ef8b939de079a22f154cdd 100644 (file)
@@ -1320,7 +1320,7 @@ static void emDM_getVert(DerivedMesh *dm, int index, MVert *vert_r)
        ev = BM_vert_at_index(bmdm->tc->bm, index); /* warning, does list loop, _not_ ideal */
 
        bmvert_to_mvert(bmdm->tc->bm, ev, vert_r);
-       if(bmdm->vertexCos)
+       if (bmdm->vertexCos)
                copy_v3_v3(vert_r->co, bmdm->vertexCos[index]);
 }
 
index cb8220c8fb39b644dc695f35370dbff314167d21..4f320b411843cea3436fb2770418e0f077c930d3 100644 (file)
@@ -622,7 +622,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin
                        ret = psys_get_particle_state(&sim, *efd->index, &state, 0);
 
                        /* TODO */
-                       //if(eff->pd->forcefiled == PFIELD_HARMONIC && ret==0) {
+                       //if (eff->pd->forcefiled == PFIELD_HARMONIC && ret==0) {
                        //      if (pa->dietime < eff->psys->cfra)
                        //              eff->flag |= PE_VELOCITY_TO_IMPULSE;
                        //}
index 3b91afbc126a70601c456a81acc6134585c8533d..27779ef81077bb36f02a9db23ab226a18e920366 100644 (file)
@@ -1148,8 +1148,9 @@ int BKE_add_image_extension(char *string, const char imtype)
        if (extension) {
                /* prefer this in many cases to avoid .png.tga, but in certain cases it breaks */
                /* remove any other known image extension */
-               if (BLI_testextensie_array(string, imb_ext_image)
-                                 || (G.have_quicktime && BLI_testextensie_array(string, imb_ext_image_qt))) {
+               if (BLI_testextensie_array(string, imb_ext_image) ||
+                   (G.have_quicktime && BLI_testextensie_array(string, imb_ext_image_qt)))
+               {
                        return BLI_replace_extension(string, FILE_MAX, extension);
                }
                else {
index 23aa03b0331989bd7e35c74c4d501a9a7bace4cc..a4edc1e531ab9705a0e79e00ca7a7ddfbfe3ae56 100644 (file)
@@ -1260,8 +1260,8 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
                /*
                if (length>L)
                {
-               if ((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED) 
-               && ((((length-L)*100.0f/L) > clmd->sim_parms->maxspringlen))) // cut spring!
+               if ((clmd->sim_parms->flags & CSIMSETT_FLAG_TEARING_ENABLED) &&
+                   ((((length-L)*100.0f/L) > clmd->sim_parms->maxspringlen))) // cut spring!
                {
                s->flags |= CSPRING_FLAG_DEACTIVATE;
                return;
@@ -1424,9 +1424,9 @@ typedef struct HairGridVert {
 #define HAIR_GRID_INDEX(vec, min, max, axis) (int)((vec[axis] - min[axis]) / (max[axis] - min[axis]) * 9.99f)
 /* Smoothing of hair velocities:
  * adapted from
              Volumetric Methods for Simulation and Rendering of Hair
              by Lena Petrovic, Mark Henne and John Anderson
- *             Pixar Technical Memo #06-08, Pixar Animation Studios
*      Volumetric Methods for Simulation and Rendering of Hair
*      by Lena Petrovic, Mark Henne and John Anderson
+ *      Pixar Technical Memo #06-08, Pixar Animation Studios
  */
 static void hair_velocity_smoothing(ClothModifierData *clmd, lfVector *lF, lfVector *lX, lfVector *lV, unsigned int numverts)
 {
@@ -1591,8 +1591,8 @@ static void cloth_calc_force(ClothModifierData *clmd, float UNUSED(frame), lfVec
                hair_velocity_smoothing(clmd, lF, lX, lV, numverts);
 
        /* multiply lF with mass matrix
-       // force = mass * acceleration (in this case: gravity)
-       */
+        * force = mass * acceleration (in this case: gravity)
+        */
        for (i = 0; i < numverts; i++)
        {
                float temp[3];
@@ -1745,10 +1745,10 @@ static void simulate_implicit_euler(lfVector *Vnew, lfVector *UNUSED(lX), lfVect
        del_lfvector(dFdXmV);
 }
 
-/*computes where the cloth would be if it were subject to perfectly stiff edges
-  (edge distance constraints) in a lagrangian solver.  then add forces to help
-  guide the implicit solver to that state.  this function is called after
-  collisions*/
+/* computes where the cloth would be if it were subject to perfectly stiff edges
* (edge distance constraints) in a lagrangian solver.  then add forces to help
* guide the implicit solver to that state.  this function is called after
* collisions*/
 int cloth_calc_helper_forces(Object *UNUSED(ob), ClothModifierData * clmd, float (*initial_cos)[3], float UNUSED(step), float dt)
 {
        Cloth *cloth= clmd->clothObject;
index 0506d60660761318e7d6d22e44316de415ddd6e5..7e756e853b16708b06d7f193d35b92f5288d827e 100644 (file)
@@ -1055,6 +1055,7 @@ void IDnames_to_pupstring(const char **str, const char *title, const char *extra
 }
 
 /* skips viewer images */
+#if 0 /* unused */
 void IMAnames_to_pupstring(const char **str, const char *title, const char *extraops, ListBase *lb, ID *link, short *nr)
 {
        DynStr *pupds= BLI_dynstr_new();
@@ -1075,6 +1076,7 @@ void IMAnames_to_pupstring(const char **str, const char *title, const char *extr
        *str= BLI_dynstr_get_cstring(pupds);
        BLI_dynstr_free(pupds);
 }
+#endif
 
 void id_sort_by_name(ListBase *lb, ID *id)
 {
index f7351887b55dafc1368da183566046238b6b45e0..6d44282c60a8d8778af202dc3c49fd0a9a9c1792 100644 (file)
@@ -1052,7 +1052,7 @@ int material_in_material(Material *parmat, Material *mat)
 }
        
 /* ****************** */
-
+#if 0 /* UNUSED */
 static char colname_array[125][20]= {
 "Black","DarkRed","HalfRed","Red","Red",
 "DarkGreen","DarkOlive","Brown","Chocolate","OrangeRed",
@@ -1098,7 +1098,7 @@ void automatname(Material *ma)
        new_id(&G.main->mat, (ID *)ma, colname_array[nr]);
        
 }
-
+#endif
 
 int object_remove_material_slot(Object *ob)
 {
index b7b9f6b21f44d2c1dc02b3bc2f0380c0eed2a523..7280af18493ecdc175a6c46831eb8a21f33d591f 100644 (file)
@@ -1058,7 +1058,7 @@ void mesh_strip_loose_polysloops(Mesh *me)
        MLoop *l;
        int a, b;
        /* New loops idx! */
-       int *new_idx = MEM_mallocN(sizeof(int) * me->totloop, "strip_loose_polysloops old2new idx mapping for polys.");
+       int *new_idx = MEM_mallocN(sizeof(int) * me->totloop, __func__);
 
        for (a = b = 0, p = me->mpoly; a < me->totpoly; a++, p++) {
                int invalid = FALSE;
@@ -1119,6 +1119,8 @@ void mesh_strip_loose_polysloops(Mesh *me)
        for (a = 0, p = me->mpoly; a < me->totpoly; a++, p++) {
                p->loopstart = new_idx[p->loopstart];
        }
+
+       MEM_freeN(new_idx);
 }
 
 void mesh_strip_loose_edges(Mesh *me)
@@ -1224,7 +1226,10 @@ int nurbs_to_mdata(Object *ob, MVert **allvert, int *totvert,
        int *totloop, int *totpoly)
 {
        return nurbs_to_mdata_customdb(ob, &ob->disp,
-               allvert, totvert, alledge, totedge, allloop, allpoly, totloop, totpoly);
+                                      allvert, totvert,
+                                      alledge, totedge,
+                                      allloop, allpoly,
+                                      totloop, totpoly);
 }
 
 /* BMESH: this doesn't calculate all edges from polygons,
@@ -1232,9 +1237,11 @@ int nurbs_to_mdata(Object *ob, MVert **allvert, int *totvert,
 
 /* Initialize mverts, medges and, faces for converting nurbs to mesh and derived mesh */
 /* use specified dispbase  */
-int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, MVert **allvert, int *_totvert,
-       MEdge **alledge, int *_totedge, MLoop **allloop, MPoly **allpoly,
-       int *_totloop, int *_totpoly)
+int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase,
+                            MVert **allvert, int *_totvert,
+                            MEdge **alledge, int *_totedge,
+                            MLoop **allloop, MPoly **allpoly,
+                            int *_totloop, int *_totpoly)
 {
        DispList *dl;
        Curve *cu;
@@ -1316,7 +1323,7 @@ int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, MVert **allvert, int
                                for (b=1; b<dl->nr; b++) {
                                        medge->v1= startvert+ofs+b-1;
                                        medge->v2= startvert+ofs+b;
-                                       medge->flag = ME_LOOSEEDGE|ME_EDGERENDER;
+                                       medge->flag = ME_LOOSEEDGE | ME_EDGERENDER | ME_EDGEDRAW;
 
                                        medge++;
                                }
@@ -1341,7 +1348,7 @@ int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, MVert **allvert, int
                                                medge->v1= startvert+ofs+b;
                                                if (b==dl->nr-1) medge->v2= startvert+ofs;
                                                else medge->v2= startvert+ofs+b+1;
-                                               medge->flag = ME_LOOSEEDGE|ME_EDGERENDER;
+                                               medge->flag = ME_LOOSEEDGE | ME_EDGERENDER | ME_EDGEDRAW;
                                                medge++;
                                        }
                                }
@@ -1466,7 +1473,7 @@ void nurbs_to_mesh(Object *ob)
        cu= ob->data;
 
        if (dm == NULL) {
-               if (nurbs_to_mdata (ob, &allvert, &totvert, &alledge, &totedge, &allloop, &allpoly, &totloop, &totpoly) != 0) {
+               if (nurbs_to_mdata(ob, &allvert, &totvert, &alledge, &totedge, &allloop, &allpoly, &totloop, &totpoly) != 0) {
                        /* Error initializing */
                        return;
                }
@@ -2054,8 +2061,11 @@ void BKE_mesh_convert_mfaces_to_mpolys(Mesh *mesh)
 
        /*build edge hash*/
        me = mesh->medge;
-       for (i=0; i<mesh->totedge; i++, me++) {
+       for (i = 0; i < mesh->totedge; i++, me++) {
                BLI_edgehash_insert(eh, me->v1, me->v2, SET_INT_IN_POINTER(i));
+
+               /* unrelated but avoid having the FGON flag enabled, so we can reuse it later for something else */
+               me->flag &= ~ME_FGON;
        }
 
        j = 0; /*current loop index*/
@@ -2070,7 +2080,7 @@ void BKE_mesh_convert_mfaces_to_mpolys(Mesh *mesh)
                mp->mat_nr = mf->mat_nr;
                mp->flag = mf->flag;
                
-               #define ML(v1, v2) {ml->v = mf->v1; ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(eh, mf->v1, mf->v2)); ml++; j++;}
+#              define ML(v1, v2) {ml->v = mf->v1; ml->e = GET_INT_FROM_POINTER(BLI_edgehash_lookup(eh, mf->v1, mf->v2)); ml++; j++;}
                
                ML(v1, v2);
                ML(v2, v3);
@@ -2082,7 +2092,7 @@ void BKE_mesh_convert_mfaces_to_mpolys(Mesh *mesh)
                        ML(v3, v1);
                }
                
-               #undef ML
+#              undef ML
 
                bm_corners_to_loops(mesh, i, mp->loopstart, numTex, numCol);
        }
@@ -3031,7 +3041,7 @@ int poly_get_adj_loops_from_vert(unsigned adj_r[3], const MPoly *poly,
 }
 
 /* update the hide flag for edges and faces from the corresponding
  flag in verts */
* flag in verts */
 void mesh_flush_hidden_from_verts(const MVert *mvert,
                                                                  const MLoop *mloop,
                                                                  MEdge *medge, int totedge,
index c5c2060d5c0b8f955fb4728e4629102d6779ba2c..aebbcd4208d3450139fab68ce60ef547c61753ee 100644 (file)
@@ -309,7 +309,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
                                                        prev_v = v;
                                                }
                                        }
-                                       if (v - prev_v > 1) { /* Dont forget final verts! */
+                                       if (v - prev_v > 1) { /* Don't forget final verts! */
                                                PRINT("    poly %u is invalid, it multi-uses vertex %u (%u times)\n",
                                                      sp->index, *prev_v, (int)(v - prev_v));
                                                sp->invalid = TRUE;
@@ -420,7 +420,7 @@ int BKE_mesh_validate_arrays(Mesh *mesh,
                                        /* DO NOT REMOVE ITS LOOPS!!!
                                         * As already invalid polys are at the end of the SortPoly list, the loops they
                                         * were the only users have already been tagged as "to remove" during previous
-                                        * iterations, and we dont want to remove some loops that may be used by
+                                        * iterations, and we don't want to remove some loops that may be used by
                                         * another valid poly! */
                                }
                        }
index 6c855b8f2428a9e2ede1b52b1ae5113673f7dfed..12aa6232cb06cb1cf7ea81ad91d2b3e942da9744 100644 (file)
@@ -76,7 +76,7 @@ ModifierTypeInfo *modifierType_getInfo(ModifierType type)
                types_init= 0;
        }
 
-       /* type unsigned, no need to chech < 0 */
+       /* type unsigned, no need to check < 0 */
        if (type < NUM_MODIFIER_TYPES && types[type]->name[0] != '\0') {
                return types[type];
        }
index 2167495ef080d9bbc1fd73474306386dd7408af6..7580f2eee4dce6da2ed27ef45f7df424ab75fa80 100644 (file)
@@ -104,7 +104,7 @@ static BLI_bitmap multires_mdisps_upsample_hidden(BLI_bitmap lo_hidden,
                                                                                                  int hi_level,
                                                                         
                                                                                                  /* assumed to be at hi_level (or
-                                                                                                        null) */
+                                                                                                  *  null) */
                                                                                                  BLI_bitmap prev_hidden)
 {
        BLI_bitmap subd;
@@ -144,8 +144,8 @@ static BLI_bitmap multires_mdisps_upsample_hidden(BLI_bitmap lo_hidden,
 
                                        if (prev_hidden) {
                                                /* If prev_hidden is available, copy it to
-                                                  subd, except when the equivalent element in
-                                                  lo_hidden is different */
+                                                * subd, except when the equivalent element in
+                                                * lo_hidden is different */
                                                if (lo_val != prev_hidden[hi_ndx])
                                                        BLI_BITMAP_MODIFY(subd, hi_ndx, lo_val);
                                                else
@@ -215,7 +215,7 @@ static void multires_output_hidden_to_ccgdm(CCGDerivedMesh *ccgdm,
 }
 
 /* subdivide mdisps.hidden if needed (assumes that md.level reflects
  the current level of md.hidden) */
* the current level of md.hidden) */
 static void multires_mdisps_subdivide_hidden(MDisps *md, int new_level)
 {
        BLI_bitmap subd;
index 3271a623584ee1a13db367e9fda91d758287f705..bc9411b7e029eae73308929a69c60579423b4d47 100644 (file)
@@ -2631,9 +2631,11 @@ void object_handle_update(Scene *scene, Object *ob)
                                        if (psys_check_enabled(ob, psys)) {
                                                /* check use of dupli objects here */
                                                if (psys->part && (psys->part->draw_as == PART_DRAW_REND || G.rendering) &&
-                                                       ((psys->part->ren_as == PART_DRAW_OB && psys->part->dup_ob)
-                                                       || (psys->part->ren_as == PART_DRAW_GR && psys->part->dup_group)))
+                                                   ((psys->part->ren_as == PART_DRAW_OB && psys->part->dup_ob) ||
+                                                    (psys->part->ren_as == PART_DRAW_GR && psys->part->dup_group)))
+                                               {
                                                        ob->transflag |= OB_DUPLIPARTS;
+                                               }
 
                                                particle_system_update(scene, ob, psys);
                                                psys= psys->next;
@@ -2664,9 +2666,11 @@ void object_handle_update(Scene *scene, Object *ob)
                        BKE_ptcache_ids_from_object(&pidlist, ob, scene, MAX_DUPLI_RECUR);
 
                        for (pid=pidlist.first; pid; pid=pid->next) {
-                               if ((pid->cache->flag & PTCACHE_BAKED)
-                                       || (pid->cache->flag & PTCACHE_QUICK_CACHE)==0)
+                               if ((pid->cache->flag & PTCACHE_BAKED) ||
+                                   (pid->cache->flag & PTCACHE_QUICK_CACHE) == 0)
+                               {
                                        continue;
+                               }
 
                                if (pid->cache->flag & PTCACHE_OUTDATED || (pid->cache->flag & PTCACHE_SIMULATION_VALID)==0) {
                                        scene->physics_settings.quick_cache_step =
index 975602c2918722992fa7c464f60a9f227efaf178..27f5f7d9eb1adb31781ee22d20f3b5656c91d250 100644 (file)
@@ -151,7 +151,7 @@ void copy_paint(Paint *src, Paint *tar)
 }
 
 /* returns non-zero if any of the face's vertices
  are hidden, zero otherwise */
* are hidden, zero otherwise */
 int paint_is_face_hidden(const MFace *f, const MVert *mvert)
 {
        return ((mvert[f->v1].flag & ME_HIDE) ||
@@ -161,8 +161,8 @@ int paint_is_face_hidden(const MFace *f, const MVert *mvert)
 }
 
 /* returns non-zero if any of the corners of the grid
  face whose inner corner is at (x,y) are hidden,
  zero otherwise */
* face whose inner corner is at (x,y) are hidden,
* zero otherwise */
 int paint_is_grid_face_hidden(const unsigned int *grid_hidden,
                                                          int gridsize, int x, int y)
 {
index a851c44023009c41654a84e1cfd6106f89ba0767..a154a1f8926bcc2e1071cf4fc808413f45f2934a 100644 (file)
@@ -201,6 +201,8 @@ void psys_set_current_num(Object *ob, int index)
                        psys->flag &= ~PSYS_CURRENT;
        }
 }
+
+#if 0 /* UNUSED */
 Object *psys_find_object(Scene *scene, ParticleSystem *psys)
 {
        Base *base;
@@ -215,6 +217,8 @@ Object *psys_find_object(Scene *scene, ParticleSystem *psys)
 
        return NULL;
 }
+#endif
+
 Object *psys_get_lattice(ParticleSimulationData *sim)
 {
        Object *lattice=NULL;
@@ -1695,7 +1699,7 @@ static int psys_map_index_on_dm(DerivedMesh *dm, int from, int index, int index_
 
                        *mapindex = index;
                }
-               else  { /* FROM_FACE/FROM_VOLUME */
+               else { /* FROM_FACE/FROM_VOLUME */
                        if (index >= dm->getNumTessFaces(dm))
                                return 0;
 
@@ -1713,7 +1717,7 @@ static int psys_map_index_on_dm(DerivedMesh *dm, int from, int index, int index_
 
                        *mapindex = index_dmcache;
                }
-               else  { /* FROM_FACE/FROM_VOLUME */
+               else { /* FROM_FACE/FROM_VOLUME */
                        /* find a face on the derived mesh that uses this face */
                        MFace *mface;
                        OrigSpaceFace *osface;
@@ -4276,10 +4280,13 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
 
                        state->time = psys_get_child_time(psys, cpa, cfra, NULL, NULL);
 
-                       if (!always)
-                               if ((state->time < 0.0f && !(part->flag & PART_UNBORN))
-                                       || (state->time > 1.0f && !(part->flag & PART_DIED)))
+                       if (!always) {
+                               if ((state->time < 0.0f && !(part->flag & PART_UNBORN)) ||
+                                   (state->time > 1.0f && !(part->flag & PART_DIED)))
+                               {
                                        return 0;
+                               }
+                       }
 
                        state->time= (cfra - (part->sta + (part->end - part->sta) * PSYS_FRAND(p + 23))) / (part->lifetime * PSYS_FRAND(p + 24));
 
@@ -4296,10 +4303,13 @@ int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *sta
        }
 
        if (pa) {
-               if (!always)
-                       if ((cfra < pa->time && (part->flag & PART_UNBORN)==0)
-                               || (cfra > pa->dietime && (part->flag & PART_DIED)==0))
+               if (!always) {
+                       if ((cfra < pa->time    && (part->flag & PART_UNBORN) == 0) ||
+                           (cfra > pa->dietime && (part->flag & PART_DIED)   == 0))
+                       {
                                return 0;
+                       }
+               }
 
                cfra = MIN2(cfra, pa->dietime);
        }
index aadd9d675b0478607a23b6a9045fb56e2aebef03..4ce24953c894c326a973b41d54890060c45d8558 100644 (file)
@@ -126,10 +126,12 @@ static int psys_get_current_display_percentage(ParticleSystem *psys)
 {
        ParticleSettings *part=psys->part;
 
-       if ((psys->renderdata && !particles_are_dynamic(psys)) /* non-dynamic particles can be rendered fully */
-               || (part->child_nbr && part->childtype) /* display percentage applies to children */
-               || (psys->pointcache->flag & PTCACHE_BAKING)) /* baking is always done with full amount */
+       if ((psys->renderdata && !particles_are_dynamic(psys)) ||  /* non-dynamic particles can be rendered fully */
+           (part->child_nbr && part->childtype)  ||    /* display percentage applies to children */
+           (psys->pointcache->flag & PTCACHE_BAKING))  /* baking is always done with full amount */
+       {
                return 100;
+       }
 
        return psys->part->disp;
 }
@@ -1479,7 +1481,7 @@ void psys_threads_free(ParticleThread *threads)
        if (ctx->index) MEM_freeN(ctx->index);
        if (ctx->skip) MEM_freeN(ctx->skip);
        if (ctx->seams) MEM_freeN(ctx->seams);
-       //if(ctx->vertpart) MEM_freeN(ctx->vertpart);
+       //if (ctx->vertpart) MEM_freeN(ctx->vertpart);
        BLI_kdtree_free(ctx->tree);
 
        /* threads */
@@ -1862,9 +1864,11 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
                /* and gravity in r_ve */
                bpa->gravity[0] = bpa->gravity[1] = 0.0f;
                bpa->gravity[2] = -1.0f;
-               if ((sim->scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY)
-                       && sim->scene->physics_settings.gravity[2]!=0.0f)
+               if ((sim->scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) &&
+                   (sim->scene->physics_settings.gravity[2] != 0.0f))
+               {
                        bpa->gravity[2] = sim->scene->physics_settings.gravity[2];
+               }
 
                bpa->data.health = part->boids->health;
                bpa->data.mode = eBoidMode_InAir;
@@ -2375,6 +2379,7 @@ typedef struct SPHRangeData
        float massfac;
        int use_size;
 } SPHRangeData;
+
 typedef struct SPHData {
        ParticleSystem *psys[10];
        ParticleData *pa;
@@ -2390,7 +2395,7 @@ typedef struct SPHData {
        /* Integrator callbacks. This allows different SPH implementations. */
        void (*force_cb) (void *sphdata_v, ParticleKey *state, float *force, float *impulse);
        void (*density_cb) (void *rangedata_v, int index, float squared_dist);
-}SPHData;
+} SPHData;
 
 static void sph_density_accum_cb(void *userdata, int index, float squared_dist)
 {
@@ -2682,9 +2687,10 @@ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, floa
        efdata.sim = sim;
 
        /* add global acceleration (gravitation) */
-       if (psys_uses_gravity(sim)
+       if (psys_uses_gravity(sim) &&
                /* normal gravity is too strong for hair so it's disabled by default */
-               && (part->type != PART_HAIR || part->effector_weights->flag & EFF_WEIGHT_DO_HAIR)) {
+               (part->type != PART_HAIR || part->effector_weights->flag & EFF_WEIGHT_DO_HAIR))
+       {
                zero_v3(gr);
                madd_v3_v3fl(gr, sim->scene->physics_settings.gravity, part->effector_weights->global_gravity * efdata.ptex.gravity);
                gravity = gr;
@@ -3891,11 +3897,12 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra)
                }
 
                /* only reset unborn particles if they're shown or if the particle is born soon*/
-               if (pa->alive==PARS_UNBORN
-                       && (part->flag & PART_UNBORN || cfra + psys->pointcache->step > pa->time))
+               if (pa->alive==PARS_UNBORN && (part->flag & PART_UNBORN || (cfra + psys->pointcache->step > pa->time))) {
                        reset_particle(sim, pa, dtime, cfra);
-               else if (part->phystype == PART_PHYS_NO)
+               }
+               else if (part->phystype == PART_PHYS_NO) {
                        reset_particle(sim, pa, dtime, cfra);
+               }
 
                if (ELEM(pa->alive, PARS_ALIVE, PARS_DYING)==0 || (pa->flag & (PARS_UNEXIST|PARS_NO_DISP)))
                        pa->state.time = -1.f;
@@ -4125,7 +4132,7 @@ static void particles_fluid_step(ParticleSimulationData *sim, int UNUSED(cfra))
                                        pa->dietime = sim->scene->r.efra + 1;
                                        pa->lifetime = sim->scene->r.efra;
                                        pa->alive = PARS_ALIVE;
-                                       //if(a<25) fprintf(stderr,"FSPARTICLE debug set %s , a%d = %f,%f,%f , life=%f\n", filename, a, pa->co[0],pa->co[1],pa->co[2], pa->lifetime );
+                                       //if (a < 25) fprintf(stderr,"FSPARTICLE debug set %s , a%d = %f,%f,%f , life=%f\n", filename, a, pa->co[0],pa->co[1],pa->co[2], pa->lifetime );
                                }
                                else {
                                        // skip...
index 100bd485c36f00eb19320c129841ddf54364450b..dbcef9ad4c8394eeb8ff8358355ce01620b85e0b 100644 (file)
@@ -821,9 +821,12 @@ void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *p
        if (psys->part->flag & PART_ROTATIONS) {
                pid->data_types|= (1<<BPHYS_DATA_ROTATION);
 
-               if (psys->part->rotmode!=PART_ROT_VEL
-                       || psys->part->avemode==PART_AVE_RAND || psys->part->avefac!=0.0f)
-                       pid->data_types|= (1<<BPHYS_DATA_AVELOCITY);
+               if (psys->part->rotmode != PART_ROT_VEL  ||
+                   psys->part->avemode == PART_AVE_RAND ||
+                   psys->part->avefac  != 0.0f)
+               {
+                       pid->data_types |= (1 << BPHYS_DATA_AVELOCITY);
+               }
        }
 
        pid->info_types= (1<<BPHYS_DATA_TIMES);
index c950a6ccdb59557142282d345ed00945e9bb322c..01ab574525659751b69b1717c17756f1c39a34b6 100644 (file)
@@ -418,7 +418,6 @@ Scene *add_scene(const char *name)
        sce->toolsettings->segments = 32;
        sce->toolsettings->rings = 32;
        sce->toolsettings->vertices = 32;
-       sce->toolsettings->editbutflag = 1;
        sce->toolsettings->uvcalc_radius = 1.0f;
        sce->toolsettings->uvcalc_cubesize = 1.0f;
        sce->toolsettings->uvcalc_mapdir = 1;
index 3aadfa309c5d6af603d0f4fcf2234370bd4a14e9..8015e53e4c96647e068da2d92ab273eaa3048f93 100644 (file)
@@ -1781,7 +1781,7 @@ static float check_zone(WipeZone *wipezone, int x, int y,
        /* BOX WIPE IS NOT WORKING YET */
        /* case DO_CROSS_WIPE: */
        /* BOX WIPE IS NOT WORKING YET */
-       /* 
+#if 0
                case DO_BOX_WIPE: 
                        if (invert)facf0 = 1-facf0;
 
@@ -1843,7 +1843,7 @@ static float check_zone(WipeZone *wipezone, int x, int y,
                        }
 
                break;
-*/
+#endif
                case DO_IRIS_WIPE:
                        if (xo > yo) yo = xo;
                        else xo = yo;
@@ -3076,8 +3076,9 @@ void sequence_effect_speed_rebuild_map(Scene *scene, Sequence * seq, int force)
        fallback_fac = 1.0;
 
        if (seq->flag & SEQ_USE_EFFECT_DEFAULT_FADE) {
-               if (seq->seq1->enddisp != seq->seq1->start
-                   && seq->seq1->len != 0) {
+               if ((seq->seq1->enddisp != seq->seq1->start) &&
+                   (seq->seq1->len != 0))
+               {
                        fallback_fac = (float) seq->seq1->len / 
                                (float) (seq->seq1->enddisp - seq->seq1->start);
                        flags = SEQ_SPEED_INTEGRATE;
index 99fc2242f9fc93526f216f1d249ca22ce69ca37e..2d4397d16cded9bae7f0fd8f2bee8c9dc926c70b 100644 (file)
@@ -1352,7 +1352,8 @@ static void seq_proxy_build_frame(SeqRenderData context,
        IMB_freeImBuf(ibuf);
 }
 
-struct SeqIndexBuildContext *seq_proxy_rebuild_context(Main *bmain, Scene *scene, Sequence *seq){
+struct SeqIndexBuildContext *seq_proxy_rebuild_context(Main *bmain, Scene *scene, Sequence *seq)
+{
        SeqIndexBuildContext *context;
        Sequence *nseq;
 
@@ -2191,7 +2192,7 @@ static ImBuf *seq_render_strip(SeqRenderData context, Sequence *seq, float cfra)
        ibuf = seq_stripelem_cache_get(context, seq, cfra, SEQ_STRIPELEM_IBUF);
 
        /* currently, we cache preprocessed images in SEQ_STRIPELEM_IBUF,
-       * but not(!) on SEQ_STRIPELEM_IBUF_ENDSTILL and ..._STARTSTILL */
+        * but not(!) on SEQ_STRIPELEM_IBUF_ENDSTILL and ..._STARTSTILL */
        if (ibuf)
                use_preprocess = FALSE;
 
@@ -2684,10 +2685,10 @@ static void seq_start_threads(Scene *scene)
        seq_last_given_monoton_cfra = monoton_cfra = 0;
 
        /* since global structures are modified during the processing
-          of one frame, only one render thread is currently possible... 
-
-          (but we code, in the hope, that we can remove this restriction
-          soon...)
+        * of one frame, only one render thread is currently possible...
+        *
+        * (but we code, in the hope, that we can remove this restriction
+        * soon...)
         */
 
        fprintf(stderr, "SEQ-THREAD: seq_start_threads\n");
@@ -2941,7 +2942,7 @@ void free_imbuf_seq(Scene *scene, ListBase *seqbase, int check_mem_usage,
                }
                if (seq->type == SEQ_SCENE) {
                        /* FIXME: recurs downwards, 
-                          but do recurs protection somehow! */
+                        * but do recurs protection somehow! */
                }
        }
        
@@ -3066,10 +3067,10 @@ void seq_tx_set_final_right(Sequence *seq, int val)
  * since they work a bit differently to normal image seq's (during transform) */
 int seq_single_check(Sequence *seq)
 {
-       return (seq->len == 1 && (
-                   seq->type == SEQ_IMAGE
-                   || ((seq->type & SEQ_EFFECT) &&
-                       get_sequence_effect_num_inputs(seq->type) == 0)));
+       return ((seq->len == 1) &&
+               (seq->type == SEQ_IMAGE ||
+                ((seq->type & SEQ_EFFECT) &&
+                 get_sequence_effect_num_inputs(seq->type) == 0)));
 }
 
 /* check if the selected seq's reference unselected seq's */
@@ -3393,7 +3394,7 @@ static void seq_update_muting_recursive(ListBase *seqbasep, Sequence *metaseq, i
        int seqmute;
 
        /* for sound we go over full meta tree to update muted state,
-        since sound is played outside of evaluating the imbufs, */
+        * since sound is played outside of evaluating the imbufs, */
        for (seq = seqbasep->first; seq; seq = seq->next) {
                seqmute = (mute || (seq->flag & SEQ_MUTE));
 
@@ -3778,7 +3779,7 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
        sound = sound_new_file(CTX_data_main(C), seq_load->path); /* handles relative paths */
 
        if (sound == NULL || sound->playback_handle == NULL) {
-               //if(op)
+               //if (op)
                //      BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
                return NULL;
        }
@@ -3787,7 +3788,7 @@ Sequence *sequencer_add_sound_strip(bContext *C, ListBase *seqbasep, SeqLoadInfo
 
        if (info.specs.channels == AUD_CHANNELS_INVALID) {
                sound_delete(bmain, sound);
-               //if(op)
+               //if (op)
                //      BKE_report(op->reports, RPT_ERROR, "Unsupported audio format");
                return NULL;
        }
index 6513399c9620580bbf7159ecee8b3d4eda761f3d..4006837efd6521579d1ecdcc5c218a1387945c22 100644 (file)
@@ -325,8 +325,8 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
        }
 
        //After sucessufuly build the trees, start projection vertexs
-       if ( bvhtree_from_mesh_faces(&treeData, calc->target, 0.0, 4, 6)
-       &&  (auxMesh == NULL || bvhtree_from_mesh_faces(&auxData, auxMesh, 0.0, 4, 6)))
+       if (bvhtree_from_mesh_faces(&treeData, calc->target, 0.0, 4, 6) &&
+           (auxMesh == NULL || bvhtree_from_mesh_faces(&auxData, auxMesh, 0.0, 4, 6)))
        {
 
 #ifndef __APPLE__
index dc7a211a3c1836c8bddbcdb666d570ff4179e133..01930cc28da79adbfd782991b2c99a9f10cc54f7 100644 (file)
@@ -113,7 +113,7 @@ typedef struct ReferenceVert {
 typedef struct ReferenceState {
        float com[3]; /* center of mass*/
        ReferenceVert *ivert; /* list of intial values */
-}ReferenceState;
+} ReferenceState;
 
 
 /*private scratch pad for caching and other data only needed when alive*/
@@ -125,7 +125,7 @@ typedef struct SBScratch {
        int totface;
        float aabbmin[3],aabbmax[3];
        ReferenceState Ref;
-}SBScratch;
+} SBScratch;
 
 typedef struct  SB_thread_context {
                Scene *scene;
@@ -140,7 +140,7 @@ typedef struct  SB_thread_context {
                float windfactor;
                int nr;
                int tot;
-}SB_thread_context;
+} SB_thread_context;
 
 #define NLF_BUILD  1
 #define NLF_SOLVE  2
@@ -267,9 +267,9 @@ float operations still
 */
 static const int CCD_SAVETY = 190561;
 
-typedef struct ccdf_minmax{
-float minx,miny,minz,maxx,maxy,maxz;
-}ccdf_minmax;
+typedef struct ccdf_minmax {
+       float minx, miny, minz, maxx, maxy, maxz;
+} ccdf_minmax;
 
 
 
@@ -283,7 +283,7 @@ typedef struct ccd_Mesh {
        /* Axis Aligned Bounding Box AABB */
        float bbmin[3];
        float bbmax[3];
-}ccd_Mesh;
+} ccd_Mesh;
 
 
 
@@ -1358,7 +1358,7 @@ static void scan_for_ext_face_forces(Object *ob,float timenow)
 /*---edges intruding*/
 
 /*+++ close vertices*/
-                       if  (( bf->flag & BFF_INTERSECT)==0) {
+                       if (( bf->flag & BFF_INTERSECT)==0) {
                                bf->flag &= ~BFF_CLOSEVERT;
                                tune = -1.0f;
                                feedback[0]=feedback[1]=feedback[2]=0.0f;
@@ -2190,7 +2190,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
        }
 
 /* debugerin */
-       if  (sb->totpoint < ifirst) {
+       if (sb->totpoint < ifirst) {
                printf("Aye 998");
                return (998);
        }
@@ -2960,7 +2960,7 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
 
                        /* the freezer coming sooner or later */
                        /*
-                       if  ((dot_v3v3(dx,dx)<freezeloc )&&(dot_v3v3(bp->force,bp->force)<freezeforce )) {
+                       if ((dot_v3v3(dx,dx)<freezeloc )&&(dot_v3v3(bp->force,bp->force)<freezeforce )) {
                                bp->frozen /=2;
                        }
                        else {
index fdbc45ebfb45aafeb10a0dd57685cb0855f78881..83a24f6afdc92d564800ace445ee0e53bad6a370 100644 (file)
@@ -120,7 +120,7 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, CCGFlags fl
        int useAging = !!(flags & CCG_USE_AGING);
        int useArena = flags & CCG_USE_ARENA;
 
-               /* subdivLevels==0 is not allowed */
+       /* subdivLevels==0 is not allowed */
        subdivLevels = MAX2(subdivLevels, 1);
 
        if (prevSS) {
@@ -128,7 +128,7 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, CCGFlags fl
 
                ccgSubSurf_getUseAgeCounts(prevSS, &oldUseAging, NULL, NULL, NULL);
 
-               if (oldUseAging!=useAging) {
+               if (oldUseAging != useAging) {
                        ccgSubSurf_free(prevSS);
                }
                else {
@@ -148,7 +148,7 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, CCGFlags fl
 
        if (useArena) {
                CCGAllocatorIFC allocatorIFC;
-               CCGAllocatorHDL allocator = BLI_memarena_new((1<<16), "subsurf arena");
+               CCGAllocatorHDL allocator = BLI_memarena_new((1 << 16), "subsurf arena");
 
                allocatorIFC.alloc = arena_alloc;
                allocatorIFC.realloc = arena_realloc;
@@ -177,81 +177,81 @@ static int getEdgeIndex(CCGSubSurf *ss, CCGEdge *e, int x, int edgeSize)
 {
        CCGVert *v0 = ccgSubSurf_getEdgeVert0(e);
        CCGVert *v1 = ccgSubSurf_getEdgeVert1(e);
-       int v0idx = *((int*) ccgSubSurf_getVertUserData(ss, v0));
-       int v1idx = *((int*) ccgSubSurf_getVertUserData(ss, v1));
-       int edgeBase = *((int*) ccgSubSurf_getEdgeUserData(ss, e));
+       int v0idx = *((int *) ccgSubSurf_getVertUserData(ss, v0));
+       int v1idx = *((int *) ccgSubSurf_getVertUserData(ss, v1));
+       int edgeBase = *((int *) ccgSubSurf_getEdgeUserData(ss, e));
 
-       if (x==0) {
+       if (x == 0) {
                return v0idx;
        }
-       else if (x==edgeSize-1) {
+       else if (x == edgeSize - 1) {
                return v1idx;
        }
        else {
-               return edgeBase + x-1;
+               return edgeBase + x - 1;
        }
 }
 
 static int getFaceIndex(CCGSubSurf *ss, CCGFace *f, int S, int x, int y, int edgeSize, int gridSize)
 {
-       int faceBase = *((int*) ccgSubSurf_getFaceUserData(ss, f));
+       int faceBase = *((int *) ccgSubSurf_getFaceUserData(ss, f));
        int numVerts = ccgSubSurf_getFaceNumVerts(f);
 
-       if (x==gridSize-1 && y==gridSize-1) {
+       if (x == gridSize - 1 && y == gridSize - 1) {
                CCGVert *v = ccgSubSurf_getFaceVert(f, S);
-               return *((int*) ccgSubSurf_getVertUserData(ss, v));
+               return *((int *) ccgSubSurf_getVertUserData(ss, v));
        }
-       else if (x==gridSize-1) {
+       else if (x == gridSize - 1) {
                CCGVert *v = ccgSubSurf_getFaceVert(f, S);
                CCGEdge *e = ccgSubSurf_getFaceEdge(f, S);
-               int edgeBase = *((int*) ccgSubSurf_getEdgeUserData(ss, e));
-               if (v==ccgSubSurf_getEdgeVert0(e)) {
-                       return edgeBase + (gridSize-1-y)-1;
+               int edgeBase = *((int *) ccgSubSurf_getEdgeUserData(ss, e));
+               if (v == ccgSubSurf_getEdgeVert0(e)) {
+                       return edgeBase + (gridSize - 1 - y) - 1;
                }
                else {
-                       return edgeBase + (edgeSize-2-1)-((gridSize-1-y)-1);
+                       return edgeBase + (edgeSize - 2 - 1) - ((gridSize - 1 - y) - 1);
                }
        }
-       else if (y==gridSize-1) {
+       else if (y == gridSize - 1) {
                CCGVert *v = ccgSubSurf_getFaceVert(f, S);
-               CCGEdge *e = ccgSubSurf_getFaceEdge(f, (S+numVerts-1)%numVerts);
-               int edgeBase = *((int*) ccgSubSurf_getEdgeUserData(ss, e));
-               if (v==ccgSubSurf_getEdgeVert0(e)) {
-                       return edgeBase + (gridSize-1-x)-1;
+               CCGEdge *e = ccgSubSurf_getFaceEdge(f, (S + numVerts - 1) % numVerts);
+               int edgeBase = *((int *) ccgSubSurf_getEdgeUserData(ss, e));
+               if (v == ccgSubSurf_getEdgeVert0(e)) {
+                       return edgeBase + (gridSize - 1 - x) - 1;
                }
                else {
-                       return edgeBase + (edgeSize-2-1)-((gridSize-1-x)-1);
+                       return edgeBase + (edgeSize - 2 - 1) - ((gridSize - 1 - x) - 1);
                }
        }
-       else if (x==0 && y==0) {
+       else if (x == 0 && y == 0) {
                return faceBase;
        }
-       else if (x==0) {
-               S = (S+numVerts-1)%numVerts;
-               return faceBase + 1 + (gridSize-2)*S + (y-1);
+       else if (x == 0) {
+               S = (S + numVerts - 1) % numVerts;
+               return faceBase + 1 + (gridSize - 2) * S + (y - 1);
        }
-       else if (y==0) {
-               return faceBase + 1 + (gridSize-2)*S + (x-1);
+       else if (y == 0) {
+               return faceBase + 1 + (gridSize - 2) * S + (x - 1);
        }
        else {
-               return faceBase + 1 + (gridSize-2)*numVerts + S*(gridSize-2)*(gridSize-2) + (y-1)*(gridSize-2) + (x-1);
+               return faceBase + 1 + (gridSize - 2) * numVerts + S * (gridSize - 2) * (gridSize - 2) + (y - 1) * (gridSize - 2) + (x - 1);
        }
 }
 
 static void get_face_uv_map_vert(UvVertMap *vmap, struct MPoly *mpoly, struct MLoop *ml, int fi, CCGVertHDL *fverts)
 {
        UvMapVert *v, *nv;
-       int j, nverts= mpoly[fi].totloop;
+       int j, nverts = mpoly[fi].totloop;
 
-       for (j=0; j<nverts; j++) {
-               for (nv=v=get_uv_map_vert(vmap, ml[j].v); v; v=v->next) {
+       for (j = 0; j < nverts; j++) {
+               for (nv = v = get_uv_map_vert(vmap, ml[j].v); v; v = v->next) {
                        if (v->separate)
-                               nv= v;
+                               nv = v;
                        if (v->f == fi)
                                break;
                }
 
-               fverts[j]= SET_INT_IN_POINTER(mpoly[nv->f].loopstart + nv->tfindex);
+               fverts[j] = SET_INT_IN_POINTER(mpoly[nv->f].loopstart + nv->tfindex);
        }
 }
 
@@ -266,31 +266,31 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
        UvMapVert *v;
        UvVertMap *vmap;
        float limit[2];
-       CCGVertHDL *fverts= NULL;
+       CCGVertHDL *fverts = NULL;
        BLI_array_declare(fverts);
        EdgeHash *ehash;
        float creaseFactor = (float)ccgSubSurf_getSubdivisionLevels(ss);
-       float uv[3]= {0.0f, 0.0f, 0.0f}; /* only first 2 values are written into */
+       float uv[3] = {0.0f, 0.0f, 0.0f}; /* only first 2 values are written into */
 
-       limit[0]= limit[1]= STD_UV_CONNECT_LIMIT;
-       vmap= make_uv_vert_map(mpoly, mloop, mloopuv, totface, totvert, 0, limit);
+       limit[0] = limit[1] = STD_UV_CONNECT_LIMIT;
+       vmap = make_uv_vert_map(mpoly, mloop, mloopuv, totface, totvert, 0, limit);
        if (!vmap)
                return 0;
        
        ccgSubSurf_initFullSync(ss);
 
        /* create vertices */
-       for (i=0; i<totvert; i++) {
+       for (i = 0; i < totvert; i++) {
                if (!get_uv_map_vert(vmap, i))
                        continue;
 
-               for (v=get_uv_map_vert(vmap, i)->next; v; v=v->next)
+               for (v = get_uv_map_vert(vmap, i)->next; v; v = v->next)
                        if (v->separate)
                                break;
 
-               seam = (v != NULL) || ((mvert+i)->flag & ME_VERT_MERGED);
+               seam = (v != NULL) || ((mvert + i)->flag & ME_VERT_MERGED);
 
-               for (v=get_uv_map_vert(vmap, i); v; v=v->next) {
+               for (v = get_uv_map_vert(vmap, i); v; v = v->next) {
                        if (v->separate) {
                                CCGVert *ssv;
                                int loopid = mpoly[v->f].loopstart + v->tfindex;
@@ -306,35 +306,35 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
        /* create edges */
        ehash = BLI_edgehash_new();
 
-       for (i=0; i<totface; i++) {
-               MPoly *mp = &((MPoly*) mpoly)[i];
-               int nverts= mp->totloop;
-               CCGFace *origf= ccgSubSurf_getFace(origss, SET_INT_IN_POINTER(i));
+       for (i = 0; i < totface; i++) {
+               MPoly *mp = &((MPoly *) mpoly)[i];
+               int nverts = mp->totloop;
+               CCGFace *origf = ccgSubSurf_getFace(origss, SET_INT_IN_POINTER(i));
                /* unsigned int *fv = &mp->v1; */
-               MLoop *ml= mloop + mp->loopstart;
+               MLoop *ml = mloop + mp->loopstart;
 
                BLI_array_empty(fverts);
                BLI_array_growitems(fverts, nverts);
 
                get_face_uv_map_vert(vmap, mpoly, ml, i, fverts);
 
-               for (j=0; j<nverts; j++) {
+               for (j = 0; j < nverts; j++) {
                        int v0 = GET_INT_FROM_POINTER(fverts[j]);
-                       int v1 = GET_INT_FROM_POINTER(fverts[(j+1)%nverts]);
-                       MVert *mv0 = mvert + (ml[ j ]. v);
-                       MVert *mv1 = mvert + (ml[ ((j+1)%nverts) ].v);
+                       int v1 = GET_INT_FROM_POINTER(fverts[(j + 1) % nverts]);
+                       MVert *mv0 = mvert + (ml[j].v);
+                       MVert *mv1 = mvert + (ml[((j + 1) % nverts)].v);
 
                        if (!BLI_edgehash_haskey(ehash, v0, v1)) {
-                               CCGEdge *e, *orige= ccgSubSurf_getFaceEdge(origf, j);
-                               CCGEdgeHDL ehdl= SET_INT_IN_POINTER(mp->loopstart + j);
+                               CCGEdge *e, *orige = ccgSubSurf_getFaceEdge(origf, j);
+                               CCGEdgeHDL ehdl = SET_INT_IN_POINTER(mp->loopstart + j);
                                float crease;
 
-                               if ((mv0->flag&mv1->flag) & ME_VERT_MERGED)
+                               if ((mv0->flag & mv1->flag) & ME_VERT_MERGED)
                                        crease = creaseFactor;
                                else
                                        crease = ccgSubSurf_getEdgeCrease(orige);
 
-                               ccgSubSurf_syncEdge(ss, ehdl, fverts[j], fverts[(j+1)%nverts], crease, &e);
+                               ccgSubSurf_syncEdge(ss, ehdl, fverts[j], fverts[(j + 1) % nverts], crease, &e);
                                BLI_edgehash_insert(ehash, v0, v1, NULL);
                        }
                }
@@ -343,10 +343,10 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm,
        BLI_edgehash_free(ehash, NULL);
 
        /* create faces */
-       for (i=0; i<totface; i++) {
+       for (i = 0; i < totface; i++) {
                MPoly *mp = &mpoly[i];
-               MLoop *ml= &mloop[mp->loopstart];
-               int nverts= mp->totloop;
+               MLoop *ml = &mloop[mp->loopstart];
+               int nverts = mp->totloop;
                CCGFace *f;
 
                BLI_array_empty(fverts);
@@ -396,7 +396,7 @@ static void set_subsurf_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result,
        gridFaces = gridSize - 1;
 
        /* make a map from original faces to CCGFaces */
-       faceMap = MEM_mallocN(totface*sizeof(*faceMap), "facemapuv");
+       faceMap = MEM_mallocN(totface * sizeof(*faceMap), "facemapuv");
 
        fi = ccgSubSurf_getFaceIterator(uvss);
        for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) {
@@ -406,22 +406,22 @@ static void set_subsurf_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result,
        ccgFaceIterator_free(fi);
 
        /* load coordinates from uvss into tface */
-       tf= tface;
-       mluv= mloopuv;
+       tf = tface;
+       mluv = mloopuv;
 
        for (index = 0; index < totface; index++) {
                CCGFace *f = faceMap[index];
                int numVerts = ccgSubSurf_getFaceNumVerts(f);
 
-               for (S=0; S<numVerts; S++) {
-                       float (*faceGridData)[3]= ccgSubSurf_getFaceGridDataArray(uvss, f, S);
+               for (S = 0; S < numVerts; S++) {
+                       float (*faceGridData)[3] = ccgSubSurf_getFaceGridDataArray(uvss, f, S);
 
                        for (y = 0; y < gridFaces; y++) {
                                for (x = 0; x < gridFaces; x++) {
-                                       float *a = faceGridData[(y + 0)*gridSize + x + 0];
-                                       float *b = faceGridData[(y + 0)*gridSize + x + 1];
-                                       float *c = faceGridData[(y + 1)*gridSize + x + 1];
-                                       float *d = faceGridData[(y + 1)*gridSize + x + 0];
+                                       float *a = faceGridData[(y + 0) * gridSize + x + 0];
+                                       float *b = faceGridData[(y + 0) * gridSize + x + 1];
+                                       float *c = faceGridData[(y + 1) * gridSize + x + 1];
+                                       float *d = faceGridData[(y + 1) * gridSize + x + 0];
 
                                        if (tf) {
                                                copy_v2_v2(tf->uv[0], a);
@@ -466,41 +466,41 @@ static float *get_ss_weights(WeightTable *wtable, int gridCuts, int faceLen)
        float *w, w1, w2, w4, fac, fac2, fx, fy;
 
        if (wtable->len <= faceLen) {
-               void *tmp = MEM_callocN(sizeof(FaceVertWeightEntry)*(faceLen+1), "weight table alloc 2");
+               void *tmp = MEM_callocN(sizeof(FaceVertWeightEntry) * (faceLen + 1), "weight table alloc 2");
                
                if (wtable->len) {
-                       memcpy(tmp, wtable->weight_table, sizeof(FaceVertWeightEntry)*wtable->len);
+                       memcpy(tmp, wtable->weight_table, sizeof(FaceVertWeightEntry) * wtable->len);
                        MEM_freeN(wtable->weight_table);
                }
                
                wtable->weight_table = tmp;
-               wtable->len = faceLen+1;
+               wtable->len = faceLen + 1;
        }
 
        if (!wtable->weight_table[faceLen].valid) {
                wtable->weight_table[faceLen].valid = 1;
-               wtable->weight_table[faceLen].w = w = MEM_callocN(sizeof(float)*faceLen*faceLen*(gridCuts+2)*(gridCuts+2), "weight table alloc");
+               wtable->weight_table[faceLen].w = w = MEM_callocN(sizeof(float) * faceLen * faceLen * (gridCuts + 2) * (gridCuts + 2), "weight table alloc");
                fac = 1.0f / (float)faceLen;
 
-               for (i=0; i<faceLen; i++) {
-                       for (x=0; x<gridCuts+2; x++) {
-                               for (y=0; y<gridCuts+2; y++) {
-                                       fx = 0.5f - (float)x / (float)(gridCuts+1) / 2.0f;
-                                       fy = 0.5f - (float)y / (float)(gridCuts+1) / 2.0f;
+               for (i = 0; i < faceLen; i++) {
+                       for (x = 0; x < gridCuts + 2; x++) {
+                               for (y = 0; y < gridCuts + 2; y++) {
+                                       fx = 0.5f - (float)x / (float)(gridCuts + 1) / 2.0f;
+                                       fy = 0.5f - (float)y / (float)(gridCuts + 1) / 2.0f;
                                
                                        fac2 = faceLen - 4;
-                                       w1 = (1.0f - fx) * (1.0f - fy) + (-fac2*fx*fy*fac);
-                                       w2 = (1.0f - fx + fac2*fx*-fac) * (fy);
-                                       w4 = (fx) * (1.0f - fy + -fac2*fy*fac);
-                                       
-                                       fac2 = 1.0f - (w1+w2+w4);
-                                       fac2 = fac2 / (float)(faceLen-3);
-                                       for (j=0; j<faceLen; j++)
+                                       w1 = (1.0f - fx) * (1.0f - fy) + (-fac2 * fx * fy * fac);
+                                       w2 = (1.0f - fx + fac2 * fx * -fac) * (fy);
+                                       w4 = (fx) * (1.0f - fy + -fac2 * fy * fac);
+
+                                       fac2 = 1.0f - (w1 + w2 + w4);
+                                       fac2 = fac2 / (float)(faceLen - 3);
+                                       for (j = 0; j < faceLen; j++)
                                                w[j] = fac2;
                                        
                                        w[i] = w1;
-                                       w[(i-1+faceLen)%faceLen] = w2;
-                                       w[(i+1)%faceLen] = w4;
+                                       w[(i - 1 + faceLen) % faceLen] = w2;
+                                       w[(i + 1) % faceLen] = w4;
 
                                        w += faceLen;
                                }
@@ -515,7 +515,7 @@ static void free_ss_weights(WeightTable *wtable)
 {
        int i;
 
-       for (i=0; i<wtable->len; i++) {
+       for (i = 0; i < wtable->len; i++) {
                if (wtable->weight_table[i].valid)
                        MEM_freeN(wtable->weight_table[i].w);
        }
@@ -525,7 +525,7 @@ static void free_ss_weights(WeightTable *wtable)
 }
 
 static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm,
-                                                                        float (*vertexCos)[3], int useFlatSubdiv)
+                                     float (*vertexCos)[3], int useFlatSubdiv)
 {
        float creaseFactor = (float) ccgSubSurf_getSubdivisionLevels(ss);
        CCGVertHDL *fVerts = NULL;
@@ -559,7 +559,7 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm,
                        ccgSubSurf_syncVert(ss, SET_INT_IN_POINTER(i), mv->co, 0, &v);
                }
 
-               ((int*)ccgSubSurf_getVertUserData(ss, v))[1] = (index)? *index++: i;
+               ((int *)ccgSubSurf_getVertUserData(ss, v))[1] = (index) ? *index++ : i;
        }
 
        me = medge;
@@ -569,24 +569,24 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm,
                float crease;
 
                crease = useFlatSubdiv ? creaseFactor :
-                                                                me->crease * creaseFactor / 255.0f;
+                        me->crease * creaseFactor / 255.0f;
 
                ccgSubSurf_syncEdge(ss, SET_INT_IN_POINTER(i), SET_INT_IN_POINTER(me->v1),
-                                                       SET_INT_IN_POINTER(me->v2), crease, &e);
+                                   SET_INT_IN_POINTER(me->v2), crease, &e);
 
-               ((int*)ccgSubSurf_getEdgeUserData(ss, e))[1] = (index)? *index++: i;
+               ((int *)ccgSubSurf_getEdgeUserData(ss, e))[1] = (index) ? *index++ : i;
        }
 
        mp = mpoly;
        index = DM_get_poly_data_layer(dm, CD_ORIGINDEX);
-       for (i=0; i<dm->numPolyData; i++, mp++) {
+       for (i = 0; i < dm->numPolyData; i++, mp++) {
                CCGFace *f;
 
                BLI_array_empty(fVerts);
                BLI_array_growitems(fVerts, mp->totloop);
 
                ml = mloop + mp->loopstart;
-               for (j=0; j<mp->totloop; j++, ml++) {
+               for (j = 0; j < mp->totloop; j++, ml++) {
                        fVerts[j] = SET_INT_IN_POINTER(ml->v);
                }
 
@@ -595,7 +595,7 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm,
                 * other parts of code significantly to handle missing faces.
                 * since this really shouldn't even be possible we just bail.*/
                if (ccgSubSurf_syncFace(ss, SET_INT_IN_POINTER(i), mp->totloop,
-                                                          fVerts, &f) == eCCGError_InvalidValue) {
+                                       fVerts, &f) == eCCGError_InvalidValue) {
                        static int hasGivenError = 0;
 
                        if (!hasGivenError) {
@@ -608,7 +608,7 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm,
                        return;
                }
 
-               ((int*)ccgSubSurf_getFaceUserData(ss, f))[1] = (index)? *index++: i;
+               ((int *)ccgSubSurf_getFaceUserData(ss, f))[1] = (index) ? *index++ : i;
        }
 
        ccgSubSurf_processSync(ss);
@@ -620,22 +620,22 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm,
 
 static int ccgDM_getVertMapIndex(CCGSubSurf *ss, CCGVert *v)
 {
-       return ((int*) ccgSubSurf_getVertUserData(ss, v))[1];
+       return ((int *) ccgSubSurf_getVertUserData(ss, v))[1];
 }
 
 static int ccgDM_getEdgeMapIndex(CCGSubSurf *ss, CCGEdge *e)
 {
-       return ((int*) ccgSubSurf_getEdgeUserData(ss, e))[1];
+       return ((int *) ccgSubSurf_getEdgeUserData(ss, e))[1];
 }
 
 static int ccgDM_getFaceMapIndex(CCGSubSurf *ss, CCGFace *f)
 {
-       return ((int*) ccgSubSurf_getFaceUserData(ss, f))[1];
+       return ((int *) ccgSubSurf_getFaceUserData(ss, f))[1];
 }
 
 static void ccgDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3])
 {
-       CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
+       CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
        CCGSubSurf *ss = ccgdm->ss;
        CCGVertIterator *vi = ccgSubSurf_getVertIterator(ss);
        CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss);
@@ -657,7 +657,7 @@ static void ccgDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3])
                CCGEdge *e = ccgEdgeIterator_getCurrent(ei);
                DMGridData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e);
 
-               for (i=0; i<edgeSize; i++)
+               for (i = 0; i < edgeSize; i++)
                        DO_MINMAX(edgeData[i].co, min_r, max_r);
        }
 
@@ -665,12 +665,12 @@ static void ccgDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3])
                CCGFace *f = ccgFaceIterator_getCurrent(fi);
                int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f);
 
-               for (S=0; S<numVerts; S++) {
+               for (S = 0; S < numVerts; S++) {
                        DMGridData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S);
 
-                       for (y=0; y<gridSize; y++)
-                               for (x=0; x<gridSize; x++)
-                                       DO_MINMAX(faceGridData[y*gridSize + x].co, min_r, max_r);
+                       for (y = 0; y < gridSize; y++)
+                               for (x = 0; x < gridSize; x++)
+                                       DO_MINMAX(faceGridData[y * gridSize + x].co, min_r, max_r);
                }
        }