Merged revision(s) 58241-58355 from trunk/blender into soc-2013-dingto.
authorThomas Dinges <blender@dingto.org>
Wed, 17 Jul 2013 21:43:38 +0000 (21:43 +0000)
committerThomas Dinges <blender@dingto.org>
Wed, 17 Jul 2013 21:43:38 +0000 (21:43 +0000)
127 files changed:
CMakeLists.txt
build_files/cmake/macros.cmake
extern/libredcode/codec.c
extern/libredcode/codec.h
extern/libredcode/debayer.c
extern/libredcode/debayer.h
extern/libredcode/format.c
extern/libredcode/format.h
intern/bsp/CMakeLists.txt
intern/cycles/kernel/kernel_light.h
intern/ghost/intern/GHOST_DropTargetWin32.h
intern/ghost/intern/GHOST_DropTargetX11.cpp
intern/ghost/intern/GHOST_DropTargetX11.h
intern/iksolver/CMakeLists.txt
intern/opencl/OCL_opencl.h
intern/opencl/intern/OCL_opencl.c
intern/opencl/intern/clew.c
intern/smoke/CMakeLists.txt
release/scripts/modules/bl_i18n_utils/utils_spell_check.py
release/scripts/startup/bl_operators/node.py
source/blender/blenkernel/BKE_dynamicpaint.h
source/blender/blenkernel/BKE_mesh.h
source/blender/blenkernel/BKE_sequencer.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/brush.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/effect.c
source/blender/blenkernel/intern/font.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/sequencer.c
source/blender/blenkernel/intern/smoke.c
source/blender/blenlib/BLI_listbase.h
source/blender/blenlib/BLI_string.h
source/blender/blenlib/intern/fileops.c
source/blender/blenlib/intern/listbase.c
source/blender/blenlib/intern/math_matrix.c
source/blender/blenlib/intern/string.c
source/blender/blenlib/intern/string_utf8.c
source/blender/bmesh/operators/bmo_bridge.c
source/blender/bmesh/operators/bmo_subdivide_edgering.c
source/blender/collada/AnimationImporter.cpp
source/blender/collada/ArmatureImporter.cpp
source/blender/collada/ArmatureImporter.h
source/blender/collada/DocumentImporter.cpp
source/blender/compositor/intern/COM_WorkScheduler.cpp
source/blender/compositor/nodes/COM_TextureNode.cpp
source/blender/compositor/operations/COM_KeyingScreenOperation.h
source/blender/compositor/operations/COM_TextureOperation.cpp
source/blender/compositor/operations/COM_TextureOperation.h
source/blender/compositor/operations/COM_TrackPositionOperation.h
source/blender/editors/armature/armature_select.c
source/blender/editors/armature/armature_utils.c
source/blender/editors/curve/editfont.c
source/blender/editors/include/ED_armature.h
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_panel.c
source/blender/editors/mesh/mesh_data.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_transform.c
source/blender/editors/object/object_vgroup.c
source/blender/editors/physics/dynamicpaint_ops.c
source/blender/editors/render/render_internal.c
source/blender/editors/render/render_opengl.c
source/blender/editors/render/render_shading.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/sculpt_paint/sculpt_intern.h
source/blender/editors/space_clip/clip_ops.c
source/blender/editors/space_clip/tracking_ops.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_outliner/outliner_select.c
source/blender/editors/space_outliner/outliner_tree.c
source/blender/editors/space_sequencer/sequencer_add.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_view3d/drawmesh.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_buttons.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_select.c
source/blender/editors/transform/transform_orientations.c
source/blender/imbuf/intern/cineon/logImageCore.c
source/blender/makesdna/DNA_curve_types.h
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_dynamicpaint.c
source/blender/makesrna/intern/rna_main_api.c
source/blender/makesrna/intern/rna_texture_api.c
source/blender/makesrna/intern/rna_wm_api.c
source/blender/modifiers/intern/MOD_cast.c
source/blender/modifiers/intern/MOD_cloth.c
source/blender/modifiers/intern/MOD_displace.c
source/blender/modifiers/intern/MOD_hook.c
source/blender/modifiers/intern/MOD_laplaciansmooth.c
source/blender/modifiers/intern/MOD_meshdeform.c
source/blender/modifiers/intern/MOD_particlesystem.c
source/blender/modifiers/intern/MOD_shrinkwrap.c
source/blender/modifiers/intern/MOD_simpledeform.c
source/blender/modifiers/intern/MOD_skin.c
source/blender/modifiers/intern/MOD_smooth.c
source/blender/modifiers/intern/MOD_surface.c
source/blender/modifiers/intern/MOD_util.c
source/blender/modifiers/intern/MOD_util.h
source/blender/modifiers/intern/MOD_warp.c
source/blender/modifiers/intern/MOD_wave.c
source/blender/modifiers/intern/MOD_weightvg_util.c
source/blender/render/extern/include/RE_shader_ext.h
source/blender/render/intern/source/render_texture.c
source/blender/windowmanager/intern/wm_operators.c
source/gameengine/BlenderRoutines/CMakeLists.txt
source/gameengine/Converter/CMakeLists.txt
source/gameengine/Expressions/CMakeLists.txt
source/gameengine/GameLogic/CMakeLists.txt
source/gameengine/GamePlayer/common/CMakeLists.txt
source/gameengine/GamePlayer/ghost/CMakeLists.txt
source/gameengine/Ketsji/CMakeLists.txt
source/gameengine/Ketsji/KXNetwork/CMakeLists.txt
source/gameengine/Network/CMakeLists.txt
source/gameengine/Physics/Bullet/CMakeLists.txt
source/gameengine/Physics/Dummy/CMakeLists.txt
source/gameengine/Rasterizer/CMakeLists.txt
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
source/gameengine/SceneGraph/CMakeLists.txt
source/gameengine/VideoTexture/CMakeLists.txt

index acd01f43fcdc0f5ba8ab99956ea8f086d6510324..b1a7830434e4198f8e88bcfadcbef79546dcdd2e 100644 (file)
@@ -2053,6 +2053,20 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
        ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_PARAMETER -Wno-unused-parameter)
        ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_MACROS    -Wno-unused-macros)
 
+       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_VARIABLE_DECLARATIONS -Wno-missing-variable-declarations)
+       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNUSED_FUNCTION -Wno-unused-function)
+       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_INT_TO_VOID_POINTER_CAST -Wno-int-to-void-pointer-cast)
+       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_PROTOTYPES -Wno-missing-prototypes)
+       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_DUPLICATE_ENUM -Wno-duplicate-enum)
+       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_UNDEF -Wno-undef)
+       ADD_CHECK_C_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS C_WARN_NO_MISSING_NORETURN -Wno-missing-noreturn)
+
+       ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_PRIVATE_FIELD -Wno-unused-private-field)
+       ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_CXX11_NARROWING -Wno-c++11-narrowing)
+       ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_NON_VIRTUAL_DTOR -Wno-non-virtual-dtor)
+       ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_UNUSED_MACROS -Wno-unused-macros)
+       ADD_CHECK_CXX_COMPILER_FLAG(CC_REMOVE_STRICT_FLAGS CXX_WARN_NO_REORDER -Wno-reorder)
+
 elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
 
        ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_ALL -Wall)
index 109d9244b3a08d3512f1920e8b6d8aee94e09981..854609f1665a06345fa52c163a3d2127bfd87569 100644 (file)
@@ -530,7 +530,9 @@ macro(remove_strict_flags_file
 
        foreach(_SOURCE ${ARGV})
 
-               if(CMAKE_COMPILER_IS_GNUCC)
+               if(CMAKE_COMPILER_IS_GNUCC OR
+                 (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
+
                        set_source_files_properties(${_SOURCE}
                                PROPERTIES
                                        COMPILE_FLAGS "${CC_REMOVE_STRICT_FLAGS}"
index 4a2dcdd6f5bf8d372d2137651b06782d365b5d8e..70c875ca991f4415241aeb3bd9d7adc799fe4ce3 100644 (file)
@@ -1,3 +1,25 @@
+/* ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * Copyright 2008 Peter Schlaile
+ *
+ * This file is part of libredcode.
+ *
+ * Libredcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Libredcode is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with libredcode; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****/
+
 #include "codec.h"
 #include "format.h"
 #include "debayer.h"
index dd239180c10c3fcb4f24d5b309aa29ca71db9caf..6f7092672eeff3c9632bab379a3e7b8b72559a28 100644 (file)
@@ -1,3 +1,25 @@
+/* ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * Copyright 2008 Peter Schlaile
+ *
+ * This file is part of libredcode.
+ *
+ * Libredcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Libredcode is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Libredcode; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****/
+
 #ifndef __CODEC_H__
 #define __CODEC_H__
 
index de7bec510cb9a61edd2bfdb3270b7b21e20718a2..a236fed174953026b093193fdde2c53a98225035 100644 (file)
@@ -1,3 +1,25 @@
+/* ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * Copyright 2008 Peter Schlaile
+ *
+ * This file is part of libredcode.
+ *
+ * Libredcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Libredcode is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Libredcode; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****/
+
 #include "debayer.h"
 
 /* pretty simple but astonishingly very effective "debayer" function 
index 43564240cc2a5c337e303a46612d03ceb9437bf3..31f3dd01fea5ddf1fc091c7d2c032a84e410e0bb 100644 (file)
@@ -1,3 +1,25 @@
+/* ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * Copyright 2008 Peter Schlaile
+ *
+ * This file is part of libredcode.
+ *
+ * Libredcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Libredcode is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Libredcode; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****/
+
 #ifndef __DEBAYER_H__
 #define __DEBAYER_H__
 
index cf8f9d5faa72c0bb8c1a6b2c496d7e6c0e0004f2..8c6cae5234e1422c5efa9c371109c9c92c0c19f1 100644 (file)
@@ -1,3 +1,25 @@
+/* ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * Copyright 2008 Peter Schlaile
+ *
+ * This file is part of libredcode.
+ *
+ * Libredcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Libredcode is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Libredcode; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****/
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 3cee804aa9d5fa2a635b2a982c68efa5c205a506..473a2b1a8d9f36e7391afa9811886984fb50f627 100644 (file)
@@ -1,3 +1,25 @@
+/* ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * Copyright 2008 Peter Schlaile
+ *
+ * This file is part of libredcode.
+ *
+ * Libredcode is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Libredcode is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Libredcode; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****/
+
 #ifndef __FORMAT_H__
 #define __FORMAT_H__
 
index e3907c5273dcf6881224ba7a0f3deb07e9d920c8..5a2e3538e0aee97c286a1d699d41aa4ddedd5afd 100644 (file)
@@ -28,10 +28,10 @@ set(INC
        ../container
        ../guardedalloc
        ../memutil
-       ../moto/include
 )
 
 set(INC_SYS
+       ../moto/include
        ../../extern/carve/include
 )
 
index 4983122fb346b2f2a11dcd5042b6f98be99528c7..5091eac41db6f4a34ee93de0fa11129161a2f767 100644 (file)
@@ -271,7 +271,7 @@ __device void lamp_light_sample(KernelGlobals *kg, int lamp,
                        ls->pdf = invarea;
 
                        if(type == LIGHT_SPOT) {
-                               /* spot light attentuation */
+                               /* spot light attenuation */
                                float4 data2 = kernel_tex_fetch(__light_data, lamp*LIGHT_SIZE + 2);
                                ls->eval_fac *= spot_light_attenuation(data1, data2, ls);
                        }
index f746a50d4690afae235a8dab20e6ea41c1ea62a5..56bae1fd1b2945a572f3222ee479d5a44268003b 100644 (file)
@@ -152,6 +152,10 @@ private:
        GHOST_SystemWin32 *m_system;
        /* Data type of the dragged object */
        GHOST_TDragnDropTypes m_draggedObjectType;
+
+#ifdef WITH_CXX_GUARDEDALLOC
+       MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_DropTargetWin32")
+#endif
 };
 
 #endif  // __GHOST_DROPTARGETWIN32_H__
index e2e15277a99bdeb7f5fd848a4639b778b532c0c9..df50012244908407696c65f05ff41e77bcd8eb96 100644 (file)
@@ -84,6 +84,9 @@ void GHOST_DropTargetX11::Initialize(void)
 void GHOST_DropTargetX11::Uninitialize(void)
 {
        xdnd_shut(&m_dndClass);
+
+       delete[] m_dndActions;
+       delete[] m_dndTypes;
 }
 
 GHOST_DropTargetX11::GHOST_DropTargetX11(GHOST_WindowX11 *window, GHOST_SystemX11 *system)
index 3fed57986116d39753602c2bbbc63fbcc655ed95..0254139bcd820c615033c878702ae5033c22a30d 100644 (file)
@@ -130,6 +130,10 @@ private:
 
        /* counter of references to global XDND structures */
        static int m_refCounter;
+
+#ifdef WITH_CXX_GUARDEDALLOC
+       MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_DropTargetX11")
+#endif
 };
 
 #endif  // __GHOST_DROPTARGETX11_H__
index 711a70ff2600f09b8ca4d95687f35b6c14caf7e1..9476e0379e9d22cce0fccef1997bcdfac4ad57fc 100644 (file)
 set(INC
        intern
        ../memutil
-       ../moto/include
 )
 
 set(INC_SYS
-
+       ../moto/include
 )
 
 set(SRC
index 4ee167b2fb43af597666fe86cc627f40009564c7..733e3527197416d16895d54761db44ad609556cf 100644 (file)
@@ -28,7 +28,7 @@ extern "C" {
 #endif
 
 #include "intern/clew.h"
-void OCL_init(void);
+int OCL_init(void);
 
 #ifdef __cplusplus
 }
index e3130e16bde7aae3ff833acf4c95a86f460f8083..33a936896fd7eaadd0d828238cf79c5630d75661 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "OCL_opencl.h"
 
-void OCL_init(void)
+int OCL_init(void)
 {
 #ifdef _WIN32
        const char *path = "OpenCL.dll";
@@ -32,6 +32,6 @@ void OCL_init(void)
        const char *path = "libOpenCL.so";
 #endif
 
-       clewInit(path);
+       return (clewInit(path) == CLEW_SUCCESS);
 }
 
index d68eb17288f532e8d490b273f5a562ce42658f6a..1e31ebced0a042a083daf0b7433b904eed06949e 100644 (file)
@@ -227,6 +227,11 @@ int clewInit(const char* path)
     __oclEnqueueWaitForEvents          = (PFNCLENQUEUEWAITFOREVENTS        )CLCC_DYNLIB_IMPORT(module, "clEnqueueWaitForEvents");
     __oclEnqueueBarrier                = (PFNCLENQUEUEBARRIER              )CLCC_DYNLIB_IMPORT(module, "clEnqueueBarrier");
     __oclGetExtensionFunctionAddress   = (PFNCLGETEXTENSIONFUNCTIONADDRESS )CLCC_DYNLIB_IMPORT(module, "clGetExtensionFunctionAddress");
+       
+       if(__oclGetPlatformIDs == NULL) return CLEW_ERROR_OPEN_FAILED;
+       if(__oclGetPlatformInfo == NULL) return CLEW_ERROR_OPEN_FAILED;
+       if(__oclGetDeviceIDs == NULL) return CLEW_ERROR_OPEN_FAILED;
+       if(__oclGetDeviceInfo == NULL) return CLEW_ERROR_OPEN_FAILED;
 
     return CLEW_SUCCESS;
 }
index b6338f90ebcb4efba02e33f8618fe8faaefaf9ae..2ca423dc73efecf0570ab744998a4b0d7edc2d06 100644 (file)
@@ -95,7 +95,7 @@ endif()
 
 if(WITH_FFTW3)
        add_definitions(-DWITH_FFTW3)
-       list(APPEND INC
+       list(APPEND INC_SYS
                ${FFTW3_INCLUDE_DIRS}
        )
 endif()
index 8c237840d9637aca49a8ac356843cab5e73416c2..1da45a9f415994fed477316ec0aa3c88bb2c12b7 100644 (file)
@@ -40,6 +40,7 @@ class SpellChecker():
         "derivate",
         "doesn",  # doesn't
         "fader",
+        "globbing",
         "hasn",  # hasn't
         "hoc",  # ad-hoc
         "indices",
@@ -59,6 +60,7 @@ class SpellChecker():
         "autoclip",
         "autocomplete",
         "autoexec",
+        "autoexecution",
         "autoname",
         "autosave",
         "autoscale",
index cc1fa93ec2c660ca3856e7e866ea20d8e40e4d27..c70b5832bfb9e853fe240a453778a5678a070305 100644 (file)
@@ -66,8 +66,12 @@ class NodeAddOperator():
 
         # convert mouse position to the View2D for later node placement
         if context.region.type == 'WINDOW':
+            # XXX, temp fix for [#35920], still fails for (U.pixelsize != 1)
+            dpi_fac = context.user_preferences.system.dpi / 72.0
             space.cursor_location = v2d.region_to_view(event.mouse_region_x,
                                                        event.mouse_region_y)
+            space.cursor_location /= dpi_fac
+
         else:
             space.cursor_location = tree.view_center
 
index ffce16f39fff3b83b489f3e448c8a948a12550dd..62715c205002caf137cc9285ee5bf0f5b271df4a 100644 (file)
@@ -29,6 +29,7 @@
 
 struct bContext;
 struct wmOperator;
+struct Scene;
 
 /* Actual surface point        */
 typedef struct PaintSurfaceData {
@@ -69,8 +70,8 @@ void dynamicPaint_Modifier_copy(struct DynamicPaintModifierData *pmd, struct Dyn
 
 int dynamicPaint_createType(struct DynamicPaintModifierData *pmd, int type, struct Scene *scene);
 struct DynamicPaintSurface *dynamicPaint_createNewSurface(struct DynamicPaintCanvasSettings *canvas, struct Scene *scene);
-void dynamicPaint_clearSurface(struct DynamicPaintSurface *surface);
-int  dynamicPaint_resetSurface(struct DynamicPaintSurface *surface);
+void dynamicPaint_clearSurface(struct Scene *scene, struct DynamicPaintSurface *surface);
+int  dynamicPaint_resetSurface(struct Scene *scene, struct DynamicPaintSurface *surface);
 void dynamicPaint_freeSurface(struct DynamicPaintSurface *surface);
 void dynamicPaint_freeCanvas(struct DynamicPaintModifierData *pmd);
 void dynamicPaint_freeBrush(struct DynamicPaintModifierData *pmd);
@@ -85,7 +86,7 @@ void dynamicPaint_resetPreview(struct DynamicPaintCanvasSettings *canvas);
 struct DynamicPaintSurface *get_activeSurface(struct DynamicPaintCanvasSettings *canvas);
 
 /* image sequence baking */
-int dynamicPaint_createUVSurface(struct DynamicPaintSurface *surface);
+int dynamicPaint_createUVSurface(struct Scene *scene, struct DynamicPaintSurface *surface);
 int dynamicPaint_calculateFrame(struct DynamicPaintSurface *surface, struct Scene *scene, struct Object *cObject, int frame);
 void dynamicPaint_outputSurfaceImage(struct DynamicPaintSurface *surface, char *filename, short output_layer);
 
index 11c9c00613f3141c51d00e499cbdcebc31258292..1c88a5c45dd06706ba2d18b97da2a719adb7acd5 100644 (file)
@@ -209,6 +209,7 @@ const char *BKE_mesh_cmp(struct Mesh *me1, struct Mesh *me2, float thresh);
 
 struct BoundBox *BKE_mesh_boundbox_get(struct Object *ob);
 void BKE_mesh_texspace_get(struct Mesh *me, float r_loc[3], float r_rot[3], float r_size[3]);
+void BKE_mesh_texspace_copy_from_object(struct Mesh *me, struct Object *ob);
 
 /* if old, it converts mface->edcode to edge drawflags */
 void BKE_mesh_make_edges(struct Mesh *me, const bool use_old);
index 9fc0812fff7ca27756f9b5f8eeb9194d7bd97bc2..4494d127082091e498b0966b19523194f0662510 100644 (file)
@@ -334,7 +334,7 @@ typedef struct SeqLoadInfo {
        int tot_success;
        int tot_error;
        int len;        /* only for image strips */
-       char path[512];
+       char path[1024]; /* 1024 = FILE_MAX */
        char name[64];
 } SeqLoadInfo;
 
index 99104ad6b836bd416087365f2ed8ba321359fed4..8f91c1cb2d904735329041a9906dd227f1c8a797 100644 (file)
@@ -484,8 +484,6 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask)
        Mesh tmp = *me;
        int totvert, totedge /*, totface */ /* UNUSED */, totloop, totpoly;
        int did_shapekeys = 0;
-       float *texloc, *texrot, *texsize;
-       short *texflag;
        
        CustomData_reset(&tmp.vdata);
        CustomData_reset(&tmp.edata);
@@ -533,12 +531,7 @@ void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask)
        }
 
        /* copy texture space */
-       if (BKE_object_obdata_texspace_get(ob, &texflag, &texloc, &texsize, &texrot)) {
-               tmp.texflag = *texflag;
-               copy_v3_v3(tmp.loc, texloc);
-               copy_v3_v3(tmp.size, texsize);
-               copy_v3_v3(tmp.rot, texrot);
-       }
+       BKE_mesh_texspace_copy_from_object(&tmp, ob);
        
        /* not all DerivedMeshes store their verts/edges/faces in CustomData, so
         * we set them here in case they are missing */
index 8130f6e646cc693481e38174105c27fa79c811f0..70b5d90120de9ea86905f2283f92fec1b2ade36a 100644 (file)
@@ -993,7 +993,8 @@ unsigned int *BKE_brush_gen_texture_cache(Brush *br, int half_side)
                                co[2] = 0.0f;
 
                                /* This is copied from displace modifier code */
-                               hasrgb = multitex_ext(mtex->tex, co, NULL, NULL, 0, &texres, NULL);
+                               /* TODO(sergey): brush are always cacheing with CM enabled for now. */
+                               hasrgb = multitex_ext(mtex->tex, co, NULL, NULL, 0, &texres, NULL, true);
 
                                /* if the texture gave an RGB value, we assume it didn't give a valid
                                 * intensity, so calculate one (formula from do_material_tex).
index 3b9fbbb1c4d98948dfbb57ee9ff707250fbc7089..00a479b8b880364073059cd53774ce9df3eea771 100644 (file)
@@ -2323,6 +2323,7 @@ void BKE_curve_bevelList_make(Object *ob)
                        bl = MEM_callocN(sizeof(BevList) + 1 * sizeof(BevPoint), "makeBevelList1");
                        BLI_addtail(&(cu->bev), bl);
                        bl->nr = 0;
+                       bl->charidx = nu->charidx;
                }
                else {
                        if (G.is_rendering && cu->resolu_ren != 0)
@@ -2335,10 +2336,10 @@ void BKE_curve_bevelList_make(Object *ob)
                                bl = MEM_callocN(sizeof(BevList) + len * sizeof(BevPoint), "makeBevelList2");
                                BLI_addtail(&(cu->bev), bl);
 
-                               if (nu->flagu & CU_NURB_CYCLIC) bl->poly = 0;
-                               else bl->poly = -1;
+                               bl->poly = (nu->flagu & CU_NURB_CYCLIC) ? 0 : -1;
                                bl->nr = len;
                                bl->dupe_nr = 0;
+                               bl->charidx = nu->charidx;
                                bevp = (BevPoint *)(bl + 1);
                                bp = nu->bp;
 
@@ -2358,8 +2359,8 @@ void BKE_curve_bevelList_make(Object *ob)
                                bl = MEM_callocN(sizeof(BevList) + len * sizeof(BevPoint), "makeBevelBPoints");
                                BLI_addtail(&(cu->bev), bl);
 
-                               if (nu->flagu & CU_NURB_CYCLIC) bl->poly = 0;
-                               else bl->poly = -1;
+                               bl->poly = (nu->flagu & CU_NURB_CYCLIC) ? 0 : -1;
+                               bl->charidx = nu->charidx;
                                bevp = (BevPoint *)(bl + 1);
 
                                a = nu->pntsu - 1;
@@ -2445,8 +2446,8 @@ void BKE_curve_bevelList_make(Object *ob)
                                        BLI_addtail(&(cu->bev), bl);
                                        bl->nr = len;
                                        bl->dupe_nr = 0;
-                                       if (nu->flagu & CU_NURB_CYCLIC) bl->poly = 0;
-                                       else bl->poly = -1;
+                                       bl->poly = (nu->flagu & CU_NURB_CYCLIC) ? 0 : -1;
+                                       bl->charidx = nu->charidx;
                                        bevp = (BevPoint *)(bl + 1);
 
                                        BKE_nurb_makeCurve(nu, &bevp->vec[0],
@@ -2572,9 +2573,11 @@ void BKE_curve_bevelList_make(Object *ob)
                        bl = sd->bl;     /* is bl a hole? */
                        sd1 = sortdata + (a - 1);
                        for (b = a - 1; b >= 0; b--, sd1--) { /* all polys to the left */
-                               if (bevelinside(sd1->bl, bl)) {
-                                       bl->hole = 1 - sd1->bl->hole;
-                                       break;
+                               if (sd1->bl->charidx == bl->charidx) { /* for text, only check matching char */
+                                       if (bevelinside(sd1->bl, bl)) {
+                                               bl->hole = 1 - sd1->bl->hole;
+                                               break;
+                                       }
                                }
                        }
                }
index 83685477725d7bc0f024a53aef949821412079cf..e08474e22c992b129547fc6ebcf918b0d0c4b464 100644 (file)
@@ -1729,16 +1729,19 @@ bool CustomData_free_layer(CustomData *data, int type, int totelem, int index)
        data->totlayer--;
 
        /* if layer was last of type in array, set new active layer */
-       if ((index >= data->totlayer) || (data->layers[index].type != type)) {
-               i = CustomData_get_layer_index__notypemap(data, type);
-               
-               if (i >= 0)
-                       for (; i < data->totlayer && data->layers[i].type == type; i++) {
-                               data->layers[i].active--;
-                               data->layers[i].active_rnd--;
-                               data->layers[i].active_clone--;
-                               data->layers[i].active_mask--;
-                       }
+       i = CustomData_get_layer_index__notypemap(data, type);
+
+       if (i != -1) {
+               /* don't decrement zero index */
+               const int index_nonzero = index ? index : 1;
+               CustomDataLayer *layer;
+
+               for (layer = &data->layers[i]; i < data->totlayer && layer->type == type; i++, layer++) {
+                       if (layer->active       >= index_nonzero) layer->active--;
+                       if (layer->active_rnd   >= index_nonzero) layer->active_rnd--;
+                       if (layer->active_clone >= index_nonzero) layer->active_clone--;
+                       if (layer->active_mask  >= index_nonzero) layer->active_mask--;
+               }
        }
 
        if (data->totlayer <= data->maxlayer - CUSTOMDATA_GROW)
index a6811af1a9459f1a224c9b92eb3ab954125cfa65..1d5eaf3a1fccbe8bed28ba5bf20e6d8a407b055e 100644 (file)
@@ -1449,12 +1449,13 @@ static void dynamicPaint_initAdjacencyData(DynamicPaintSurface *surface, int for
        MEM_freeN(temp_data);
 }
 
-static void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
+static void dynamicPaint_setInitialColor(Scene *scene, DynamicPaintSurface *surface)
 {
        PaintSurfaceData *sData = surface->data;
        PaintPoint *pPoint = (PaintPoint *)sData->type_data;
        DerivedMesh *dm = surface->canvas->dm;
        int i;
+       bool scene_color_manage = BKE_scene_check_color_management_enabled(scene);
 
        if (surface->type != MOD_DPAINT_SURFACE_T_PAINT)
                return;
@@ -1503,7 +1504,7 @@ static void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
                                        uv[0] = tface[i].uv[j][0] * 2.0f - 1.0f;
                                        uv[1] = tface[i].uv[j][1] * 2.0f - 1.0f;
 
-                                       multitex_ext_safe(tex, uv, &texres, pool);
+                                       multitex_ext_safe(tex, uv, &texres, pool, scene_color_manage);
 
                                        if (texres.tin > pPoint[*vert].alpha) {
                                                copy_v3_v3(pPoint[*vert].color, &texres.tr);
@@ -1536,8 +1537,8 @@ static void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
                                /* remap to -1.0 to 1.0 */
                                uv_final[0] = uv_final[0] * 2.0f - 1.0f;
                                uv_final[1] = uv_final[1] * 2.0f - 1.0f;
-                                       
-                               multitex_ext_safe(tex, uv_final, &texres, NULL);
+
+                               multitex_ext_safe(tex, uv_final, &texres, NULL, scene_color_manage);
 
                                /* apply color */
                                copy_v3_v3(pPoint[i].color, &texres.tr);
@@ -1596,7 +1597,7 @@ static void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
 }
 
 /* clears surface data back to zero */
-void dynamicPaint_clearSurface(DynamicPaintSurface *surface)
+void dynamicPaint_clearSurface(Scene *scene, DynamicPaintSurface *surface)
 {
        PaintSurfaceData *sData = surface->data;
        if (sData && sData->type_data) {
@@ -1613,7 +1614,7 @@ void dynamicPaint_clearSurface(DynamicPaintSurface *surface)
 
                /* set initial color */
                if (surface->type == MOD_DPAINT_SURFACE_T_PAINT)
-                       dynamicPaint_setInitialColor(surface);
+                       dynamicPaint_setInitialColor(scene, surface);
 
                if (sData->bData)
                        sData->bData->clear = 1;
@@ -1621,7 +1622,7 @@ void dynamicPaint_clearSurface(DynamicPaintSurface *surface)
 }
 
 /* completely (re)initializes surface (only for point cache types)*/
-int dynamicPaint_resetSurface(DynamicPaintSurface *surface)
+int dynamicPaint_resetSurface(Scene *scene, DynamicPaintSurface *surface)
 {
        int numOfPoints = dynamicPaint_surfaceNumOfPoints(surface);
        /* free existing data */
@@ -1642,16 +1643,16 @@ int dynamicPaint_resetSurface(DynamicPaintSurface *surface)
 
        /* set initial color */
        if (surface->type == MOD_DPAINT_SURFACE_T_PAINT)
-               dynamicPaint_setInitialColor(surface);
+               dynamicPaint_setInitialColor(scene, surface);
 
        return 1;
 }
 
 /* make sure allocated surface size matches current requirements */
-static int dynamicPaint_checkSurfaceData(DynamicPaintSurface *surface)
+static int dynamicPaint_checkSurfaceData(Scene *scene, DynamicPaintSurface *surface)
 {
        if (!surface->data || ((dynamicPaint_surfaceNumOfPoints(surface) != surface->data->total_points))) {
-               return dynamicPaint_resetSurface(surface);
+               return dynamicPaint_resetSurface(scene, surface);
        }
        return 1;
 }
@@ -1953,7 +1954,7 @@ static void dynamicPaint_frameUpdate(DynamicPaintModifierData *pmd, Scene *scene
 
                        /* make sure surface is valid */
                        no_surface_data = surface->data == NULL;
-                       if (!dynamicPaint_checkSurfaceData(surface)) continue;
+                       if (!dynamicPaint_checkSurfaceData(scene, surface)) continue;
 
                        /* limit frame range */
                        CLAMP(current_frame, surface->start_frame, surface->end_frame);
@@ -2225,7 +2226,7 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh
 /*
  *     Create a surface for uv image sequence format
  */
-int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
+int dynamicPaint_createUVSurface(Scene *scene, DynamicPaintSurface *surface)
 {
        /* Antialias jitter point relative coords       */
        float jitter5sample[10] =  {0.0f, 0.0f,
@@ -2676,7 +2677,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
                }
 
 #endif
-               dynamicPaint_setInitialColor(surface);
+               dynamicPaint_setInitialColor(scene, surface);
        }
 
        return (error == 0);
index 02d1621e408b0fe547fe9de1e6c178e9fee99bb7..0df8684044a082efb64133faedfa810eb6a50b20 100644 (file)
@@ -744,6 +744,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
        float nabla = eff->pd->tex_nabla;
        int hasrgb;
        short mode = eff->pd->tex_mode;
+       bool scene_color_manage;
 
        if (!eff->pd->tex)
                return;
@@ -763,7 +764,9 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
                mul_m4_v3(eff->ob->imat, tex_co);
        }
 
-       hasrgb = multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result, NULL);
+       scene_color_manage = BKE_scene_check_color_management_enabled(eff->scene);
+
+       hasrgb = multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result, NULL, scene_color_manage);
 
        if (hasrgb && mode==PFIELD_TEX_RGB) {
                force[0] = (0.5f - result->tr) * strength;
@@ -774,15 +777,15 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
                strength/=nabla;
 
                tex_co[0] += nabla;
-               multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+1, NULL);
+               multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+1, NULL, scene_color_manage);
 
                tex_co[0] -= nabla;
                tex_co[1] += nabla;
-               multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+2, NULL);
+               multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+2, NULL, scene_color_manage);
 
                tex_co[1] -= nabla;
                tex_co[2] += nabla;
-               multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+3, NULL);
+               multitex_ext(eff->pd->tex, tex_co, NULL, NULL, 0, result+3, NULL, scene_color_manage);
 
                if (mode == PFIELD_TEX_GRAD || !hasrgb) { /* if we don't have rgb fall back to grad */
                        /* generate intensity if texture only has rgb value */
index b3edeb67928355faa610ad118e8bb3c0598243d3..7c23438f93d1f7186d7123e2afb3ea4ad5298750 100644 (file)
@@ -516,7 +516,7 @@ struct CharTrans *BKE_vfont_to_curve(Main *bmain, Scene *scene, Object *ob, int
 
        /* Create unicode string */
        utf8len = BLI_strlen_utf8(cu->str);
-       mem = MEM_callocN(((utf8len + 1) * sizeof(wchar_t)), "convertedmem");
+       mem = MEM_mallocN(((utf8len + 1) * sizeof(wchar_t)), "convertedmem");
 
        BLI_strncpy_wchar_from_utf8(mem, cu->str, utf8len + 1);
 
index f34053816c5b7ed854703dc29dac858de9ed2ed5..135d847cce7c8a48f9e8840da11b349a5ff776cc 100644 (file)
@@ -633,7 +633,7 @@ Image *BKE_image_load_exists(const char *filepath)
        for (ima = G.main->image.first; ima; ima = ima->id.next) {
                if (ima->source != IMA_SRC_VIEWER && ima->source != IMA_SRC_GENERATED) {
                        BLI_strncpy(strtest, ima->name, sizeof(ima->name));
-                       BLI_path_abs(strtest, G.main->name);
+                       BLI_path_abs(strtest, ID_BLEND_PATH(G.main, &ima->id));
 
                        if (BLI_path_cmp(strtest, str) == 0) {
                                if (ima->anim == NULL || ima->id.us == 0) {
index b40c3475df523e3f2488ac04b93e4072578586d4..f24a55dcc44dd30aeeaaa38ac0ed4607985f01ff 100644 (file)
@@ -702,6 +702,19 @@ void BKE_mesh_texspace_get(Mesh *me, float r_loc[3], float r_rot[3], float r_siz
        if (r_size) copy_v3_v3(r_size, me->size);
 }
 
+void BKE_mesh_texspace_copy_from_object(Mesh *me, Object *ob)
+{
+       float *texloc, *texrot, *texsize;
+       short *texflag;
+
+       if (BKE_object_obdata_texspace_get(ob, &texflag, &texloc, &texsize, &texrot)) {
+               me->texflag = *texflag;
+               copy_v3_v3(me->loc, texloc);
+               copy_v3_v3(me->size, texsize);
+               copy_v3_v3(me->rot, texrot);
+       }
+}
+
 float (*BKE_mesh_orco_verts_get(Object *ob))[3]
 {
        Mesh *me = ob->data;
@@ -2450,10 +2463,11 @@ void BKE_mesh_vert_poly_map_create(MeshElemMap **r_map, int **r_mem,
                                    int totvert, int totpoly, int totloop)
 {
        MeshElemMap *map = MEM_callocN(sizeof(MeshElemMap) * totvert, "vert poly map");
-       int *indices = MEM_mallocN(sizeof(int) * totloop, "vert poly map mem");
-
+       int *indices, *index_iter;
        int i, j;
 
+       indices = index_iter = MEM_mallocN(sizeof(int) * totloop, "vert poly map mem");
+
        /* Count number of polys for each vertex */
        for (i = 0; i < totpoly; i++) {
                const MPoly *p = &mpoly[i];
@@ -2464,8 +2478,8 @@ void BKE_mesh_vert_poly_map_create(MeshElemMap **r_map, int **r_mem,
 
        /* Assign indices mem */
        for (i = 0; i < totvert; i++) {
-               map[i].indices = indices;
-               indices += map[i].count;
+               map[i].indices = index_iter;
+               index_iter += map[i].count;
 
                /* Reset 'count' for use as index in last loop */
                map[i].count = 0;
@@ -2495,6 +2509,7 @@ void BKE_mesh_vert_edge_map_create(MeshElemMap **r_map, int **r_mem,
 {
        MeshElemMap *map = MEM_callocN(sizeof(MeshElemMap) * totvert, "vert-edge map");
        int *indices = MEM_mallocN(sizeof(int) * totedge * 2, "vert-edge map mem");
+       int *i_pt = indices;
 
        int i;
 
@@ -2506,8 +2521,8 @@ void BKE_mesh_vert_edge_map_create(MeshElemMap **r_map, int **r_mem,
 
        /* Assign indices mem */
        for (i = 0; i < totvert; i++) {
-               map[i].indices = indices;
-               indices += map[i].count;
+               map[i].indices = i_pt;
+               i_pt += map[i].count;
 
                /* Reset 'count' for use as index in last loop */
                map[i].count = 0;
index 6f77d63d90f3887f370f3469b137d85c57603a2a..06748dfc44d63e08e87c5e8f6fd827d0dfadfbb2 100644 (file)
@@ -2800,7 +2800,7 @@ int  BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode)
                        smokeModifier_reset_turbulence(pid->calldata);
 #endif
                else if (pid->type == PTCACHE_TYPE_DYNAMICPAINT)
-                       dynamicPaint_clearSurface((DynamicPaintSurface*)pid->calldata);
+                       dynamicPaint_clearSurface(scene, (DynamicPaintSurface*)pid->calldata);
        }
        if (clear)
                BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);
index aa68d2ac67b35e1018e2e5e10d35436070431b28..1874523dac9908ffaf4089999885dbddd2771512 100644 (file)
@@ -1479,6 +1479,16 @@ void BKE_scene_disable_color_management(Scene *scene)
 
 int BKE_scene_check_color_management_enabled(const Scene *scene)
 {
+       /* TODO(sergey): shouldn't be needed. but we're currently far to close to the release,
+        *               so better be extra-safe than sorry.
+        *
+        *               Will remove the check after the release.
+        */
+       if (!scene) {
+               BLI_assert(!"Shouldn't happen!");
+               return TRUE;
+       }
+
        return strcmp(scene->display_settings.display_device, "None") != 0;
 }
 
index 68fac399c51cbedd4c05828e65bd6874e8614e62..e81afc7efb61d979f650d673a571eef455813310 100644 (file)
@@ -50,6 +50,7 @@
 #include "BLI_listbase.h"
 #include "BLI_path_util.h"
 #include "BLI_string.h"
+#include "BLI_string_utf8.h"
 #include "BLI_threads.h"
 #include "BLI_utildefines.h"
 
@@ -3111,8 +3112,18 @@ static void sequence_invalidate_cache(Scene *scene, Sequence *seq, int invalidat
        Editing *ed = scene->ed;
 
        /* invalidate cache for current sequence */
-       if (invalidate_self)
+       if (invalidate_self) {
+               if (seq->anim) {
+                       /* Animation structure holds some buffers inside,
+                        * so for proper cache invalidation we need to
+                        * re-open the animation.
+                        */
+                       IMB_free_anim(seq->anim);
+                       seq->anim = NULL;
+               }
+
                BKE_sequencer_cache_cleanup_sequence(seq);
+       }
 
        /* if invalidation is invoked from sequence free routine, effectdata would be NULL here */
        if (seq->effectdata && seq->type == SEQ_TYPE_SPEED)
@@ -3938,7 +3949,8 @@ Mask *BKE_sequencer_mask_get(Scene *scene)
 static void seq_load_apply(Scene *scene, Sequence *seq, SeqLoadInfo *seq_load)
 {
        if (seq) {
-               BLI_strncpy(seq->name + 2, seq_load->name, sizeof(seq->name) - 2);
+               BLI_strncpy_utf8(seq->name + 2, seq_load->name, sizeof(seq->name) - 2);
+               BLI_utf8_invalid_strip(seq->name + 2, sizeof(seq->name) - 2);
                BKE_sequence_base_unique_name_recursive(&scene->ed->seqbase, seq);
 
                if (seq_load->flag & SEQ_LOAD_FRAME_ADVANCE) {
index 05c3550d81016b34aab21103449ab582766e4e40..b2c0a45cbc4e80c2d36919c2a0b7f02306022bb3 100644 (file)
@@ -1413,12 +1413,14 @@ static void emit_from_particles(Object *flow_ob, SmokeDomainSettings *sds, Smoke
        }
 }
 
+/* TODO(sergey): de-duplicate with get_texture_value from modifier utils */
+/* NOTE: Skips color management, because result is only used for value now, not for color. */
 static void get_texture_value(Tex *texture, float tex_co[3], TexResult *texres)
 {
        int result_type;
 
        /* no node textures for now */
-       result_type = multitex_ext_safe(texture, tex_co, texres, NULL);
+       result_type = multitex_ext_safe(texture, tex_co, texres, NULL, false);
 
        /* if the texture gave an RGB value, we assume it didn't give a valid
         * intensity, since this is in the context of modifiers don't use perceptual color conversion.
@@ -2100,7 +2102,7 @@ static void update_flowsfluids(Scene *scene, Object *ob, SmokeDomainSettings *sd
                        /* sample subframes */
                        else {
                                int scene_frame = scene->r.cfra;
-                               float scene_subframe = scene->r.subframe;
+                               // float scene_subframe = scene->r.subframe;  // UNUSED
                                int subframe;
                                for (subframe = 0; subframe <= subframes; subframe++) {
                                        EmissionMap em_temp = {0};
index 767f61b29dde152af1c40e6056b4e02241ccd3c8..4c7ddf7ba6643064354308e1f8603a5450d041f6 100644 (file)
@@ -72,7 +72,7 @@ void BLI_freelinkN(struct ListBase *listbase, void *vlink);
 void BLI_movelisttolist(struct ListBase *dst, struct ListBase *src);
 void BLI_duplicatelist(struct ListBase *dst, const struct ListBase *src);
 void BLI_reverselist(struct ListBase *lb);
-void BLI_rotatelist(struct ListBase *lb, LinkData *vlink);
+void BLI_rotatelist(struct ListBase *lb, void *vlink);
 
 /* create a generic list node containing link to provided data */
 struct LinkData *BLI_genericNodeN(void *data);
index c6f0bc49c9b1933e79e8eaada5303cb2c118a02f..02eb0734f8cf6a6bcc56d232de72b2037410c351 100644 (file)
@@ -93,14 +93,14 @@ __attribute__((nonnull))
 #endif
 ;
 
-size_t BLI_snprintf(char *__restrict buffer, size_t len, const char *__restrict format, ...)
+size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format, ...)
 #ifdef __GNUC__
 __attribute__ ((format(printf, 3, 4)))
 __attribute__((nonnull))
 #endif
 ;
 
-size_t BLI_vsnprintf(char *__restrict buffer, size_t count, const char *__restrict format, va_list arg)
+size_t BLI_vsnprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format, va_list arg)
 #ifdef __GNUC__
 __attribute__ ((format(printf, 3, 0)))
 #endif
index 26fe0f21cd520d9ec4579d03e2b76ba5ad4bad14..26b9e08c7f66386924a5dc126323038c5c2c2e44 100644 (file)
@@ -199,7 +199,7 @@ bool BLI_file_touch(const char *file)
 {
        FILE *f = BLI_fopen(file, "r+b");
        if (f != NULL) {
-               char c = getc(f);
+               int c = getc(f);
                rewind(f);
                putc(c, f);
        }
index f060a2771fe57a2012bd5bc1571a03af92d65967..ded4f31ae05ac52c484b40d36b66c5c9c2e2bd60 100644 (file)
@@ -557,14 +557,14 @@ void BLI_reverselist(ListBase *lb)
 /**
  * \param vlink Link to make first.
  */
-void BLI_rotatelist(ListBase *lb, LinkData *vlink)
+void BLI_rotatelist(ListBase *lb, void *vlink)
 {
        /* make circular */
        ((LinkData *)lb->first)->prev = lb->last;
        ((LinkData *)lb->last)->next = lb->first;
 
        lb->first = vlink;
-       lb->last = vlink->prev;
+       lb->last = ((LinkData *)vlink)->prev;
 
        ((LinkData *)lb->first)->prev = NULL;
        ((LinkData *)lb->last)->next = NULL;
index 5efa4e4acf35bedc7cdcf726f440f43108452580..cd7dfdc6d2f7d8817c99b48038bf9e8a2565f556 100644 (file)
@@ -836,6 +836,7 @@ void orthogonalize_m3(float mat[3][3], int axis)
                                normalize_v3(mat[0]);
                                cross_v3_v3v3(mat[1], mat[2], mat[0]);
                        }
+                       break;
                default:
                        BLI_assert(0);
        }
index 03bed428c0715b31b35f1013b1582f1d959b292c..24e14d04c682665567a95679df62181a608b4887 100644 (file)
@@ -47,6 +47,8 @@
 #  pragma GCC diagnostic error "-Wsign-conversion"
 #endif
 
+// #define DEBUG_STRSIZE
+
 /**
  * Duplicates the first \a len bytes of cstring \a str
  * into a newly mallocN'd string and returns it. \a str
@@ -111,6 +113,10 @@ char *BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t
        size_t srclen = BLI_strnlen(src, maxncpy - 1);
        BLI_assert(maxncpy != 0);
 
+#ifdef DEBUG_STRSIZE
+       memset(dst, 0xff, sizeof(*dst) * maxncpy);
+#endif
+
        memcpy(dst, src, srclen);
        dst[srclen] = '\0';
        return dst;
@@ -134,6 +140,10 @@ size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, const
        size_t srclen = BLI_strnlen(src, maxncpy - 1);
        BLI_assert(maxncpy != 0);
 
+#ifdef DEBUG_STRSIZE
+       memset(dst, 0xff, sizeof(*dst) * maxncpy);
+#endif
+
        memcpy(dst, src, srclen);
        dst[srclen] = '\0';
        return srclen;
@@ -149,21 +159,21 @@ size_t BLI_strcpy_rlen(char *__restrict dst, const char *__restrict src)
 /**
  * Portable replacement for #vsnprintf
  */
-size_t BLI_vsnprintf(char *__restrict buffer, size_t count, const char *__restrict format, va_list arg)
+size_t BLI_vsnprintf(char *__restrict buffer, size_t maxncpy, const char *__restrict format, va_list arg)
 {
        size_t n;
 
        BLI_assert(buffer != NULL);
-       BLI_assert(count > 0);
+       BLI_assert(maxncpy > 0);
        BLI_assert(format != NULL);
 
-       n = (size_t)vsnprintf(buffer, count, format, arg);
+       n = (size_t)vsnprintf(buffer, maxncpy, format, arg);
 
-       if (n != -1 && n < count) {
+       if (n != -1 && n < maxncpy) {
                buffer[n] = '\0';
        }
        else {
-               buffer[count - 1] = '\0';
+               buffer[maxncpy - 1] = '\0';
        }
 
        return n;
@@ -172,13 +182,17 @@ size_t BLI_vsnprintf(char *__restrict buffer, size_t count, const char *__restri
 /**
  * Portable replacement for #snprintf
  */
-size_t BLI_snprintf(char *__restrict buffer, size_t count, const char *__restrict format, ...)
+size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format, ...)
 {
        size_t n;
        va_list arg;
 
+#ifdef DEBUG_STRSIZE
+       memset(dst, 0xff, sizeof(*dst) * maxncpy);
+#endif
+
        va_start(arg, format);
-       n = BLI_vsnprintf(buffer, count, format, arg);
+       n = BLI_vsnprintf(dst, maxncpy, format, arg);
        va_end(arg);
 
        return n;
index ab0073a7585c00293eee8a445c394742d27554ca..d435ed8f6e7730c7ce1000d0eb86bd76ef65483f 100644 (file)
@@ -45,6 +45,8 @@
 #  pragma GCC diagnostic error "-Wsign-conversion"
 #endif
 
+// #define DEBUG_STRSIZE
+
 /* from libswish3, originally called u8_isvalid(),
  * modified to return the index of the bad character (byte index not utf).
  * http://svn.swish-e.org/libswish3/trunk/src/libswish3/utf8.c r3044 - campbell */
@@ -195,6 +197,10 @@ char *BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t
 
        BLI_assert(maxncpy != 0);
 
+#ifdef DEBUG_STRSIZE
+       memset(dst, 0xff, sizeof(*dst) * maxncpy);
+#endif
+
        /* note: currently we don't attempt to deal with invalid utf8 chars */
        BLI_STR_UTF8_CPY(dst, src, maxncpy);
 
@@ -208,6 +214,10 @@ char *BLI_strncat_utf8(char *__restrict dst, const char *__restrict src, size_t
                maxncpy--;
        }
 
+#ifdef DEBUG_STRSIZE
+       memset(dst, 0xff, sizeof(*dst) * maxncpy);
+#endif
+
        BLI_STR_UTF8_CPY(dst, src, maxncpy);
 
        return dst;
@@ -220,11 +230,16 @@ char *BLI_strncat_utf8(char *__restrict dst, const char *__restrict src, size_t
 
 size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst, const wchar_t *__restrict src, const size_t maxncpy)
 {
+       const size_t maxlen = maxncpy - 1;
        size_t len = 0;
 
        BLI_assert(maxncpy != 0);
 
-       while (*src && len < maxncpy) { /* XXX can still run over the buffer because utf8 size isn't known :| */
+#ifdef DEBUG_STRSIZE
+       memset(dst, 0xff, sizeof(*dst) * maxncpy);
+#endif
+
+       while (*src && len < maxlen) { /* XXX can still run over the buffer because utf8 size isn't known :| */
                len += BLI_str_utf8_from_unicode((unsigned int)*src++, dst + len);
        }
 
@@ -300,13 +315,16 @@ size_t BLI_strnlen_utf8(const char *strc, const size_t maxlen)
 
 size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w, const char *__restrict src_c, const size_t maxncpy)
 {
+       const size_t maxlen = maxncpy - 1;
        size_t len = 0;
 
-       if (dst_w == NULL || src_c == NULL) {
-               return 0;
-       }
+       BLI_assert(maxncpy != 0);
+
+#ifdef DEBUG_STRSIZE
+       memset(dst_w, 0xff, sizeof(*dst_w) * maxncpy);
+#endif
 
-       while (*src_c && len < maxncpy) {
+       while (*src_c && len != maxlen) {
                size_t step = 0;
                unsigned int unicode = BLI_str_utf8_as_unicode_and_size(src_c, &step);
                if (unicode != BLI_UTF8_ERR) {
@@ -320,6 +338,9 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w, const char *__rest
                dst_w++;
                len++;
        }
+
+       *dst_w = 0;
+
        return len;
 }
 
index 61421b0bec24cc84720b882f58507787e673e20f..5b046524e9537a45052c3547c76cae5f2727f3a9 100644 (file)
@@ -162,7 +162,7 @@ static void bridge_loop_pair(BMesh *bm,
        }
 
        if (use_merge) {
-               BLI_assert((el_store_a_len == el_store_a_len));
+               BLI_assert((el_store_a_len == el_store_b_len));
        }
 
        if (el_store_a_len != el_store_b_len) {
index d9555c409f6e3cf9c3b575675aa19068beb6a198..44d4b63f5c40c51bbb1a8c37193d1a000a842418 100644 (file)
@@ -893,7 +893,7 @@ static void bm_edgering_pair_order(BMesh *bm,
        /* before going much further, get ourselves in order
         * - align loops (not strictly necessary but handy)
         * - ensure winding is set for both loops */
-       if (BM_edgeloop_is_closed(el_store_a) && BM_edgeloop_is_closed(el_store_a)) {
+       if (BM_edgeloop_is_closed(el_store_a) && BM_edgeloop_is_closed(el_store_b)) {
                BMIter eiter;
                BMEdge *e;
                BMVert *v_other;
index 643b2cdc2b0148fb437396b33d9575031f07632e..445199dbdef46fc3d20089f2717fc2e04fc142d2 100644 (file)
@@ -1687,6 +1687,18 @@ void AnimationImporter::evaluate_transform_at_frame(float mat[4][4], COLLADAFW::
        }
 }
 
+static void report_class_type_unsupported(const char *path, 
+                                         const COLLADAFW::AnimationList::AnimationClass animclass,
+                                         const COLLADAFW::Transformation::TransformationType type) 
+{
+       if (animclass == COLLADAFW::AnimationList::UNKNOWN_CLASS) {
+               fprintf(stderr, "%s: UNKNOWN animation class\n", path);
+       }
+       else {
+               fprintf(stderr, "%s: animation class %d is not supported yet for transformation type %d\n", path, animclass, type);
+       }
+}
+
 // return true to indicate that mat contains a sane value
 bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float mat[4][4], float fra, const char *node_id)
 {
@@ -1741,11 +1753,6 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
                                        break;
                        }
 
-                       if (animclass == COLLADAFW::AnimationList::UNKNOWN_CLASS) {
-                               fprintf(stderr, "%s: UNKNOWN animation class\n", path);
-                               //continue;
-                       }
-
                        if (type == COLLADAFW::Transformation::ROTATE) {
                                if (curves.size() != 1) {
                                        fprintf(stderr, "expected 1 curve, got %d\n", (int)curves.size());
@@ -1754,7 +1761,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
 
                                // TODO support other animclasses
                                if (animclass != COLLADAFW::AnimationList::ANGLE) {
-                                       fprintf(stderr, "%s: animation class %d is not supported yet\n", path, animclass);
+                                       report_class_type_unsupported(path, animclass, type);
                                        return false;
                                }
 
@@ -1793,7 +1800,7 @@ bool AnimationImporter::evaluate_animation(COLLADAFW::Transformation *tm, float
                                                vec[2] = evaluate_fcurve(curves[2], fra);
                                                break;
                                        default:
-                                               fprintf(stderr, "%s: animation class %d is not supported yet\n", path, animclass);
+                                               report_class_type_unsupported(path, animclass, type);
                                                break;
                                }
                        }
index 121e4d1d605cd6141e80e0e332ee0e333fb50159..eb92b089f481dca9f93a9769f75f3babaded659c 100644 (file)
@@ -133,24 +133,28 @@ void ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::Node *node, EditBo
        add_v3_v3v3(bone->tail, bone->head, vec);
 
        // set parent tail
-       if (parent && totchild == 1) {
-               copy_v3_v3(parent->tail, bone->head);
-
-               // not setting BONE_CONNECTED because this would lock child bone location with respect to parent
-               bone->flag |= BONE_CONNECTED;
+       if (parent) {
 
                // XXX increase this to prevent "very" small bones?
                const float epsilon = 0.000001f;
 
                // derive leaf bone length
-               float length = len_v3v3(parent->head, parent->tail);
+               float length = len_v3v3(parent->head, bone->head);
                if ((length < leaf_bone_length || totbone == 0) && length > epsilon) {
                        leaf_bone_length = length;
                }
 
-               // treat zero-sized bone like a leaf bone
-               if (length <= epsilon) {
-                       add_leaf_bone(parent_mat, parent, node);
+               if (totchild == 1) {
+                       copy_v3_v3(parent->tail, bone->head);
+
+                       // not setting BONE_CONNECTED because this would lock child bone location with respect to parent
+                       bone->flag |= BONE_CONNECTED;
+
+
+                       // treat zero-sized bone like a leaf bone
+                       if (length <= epsilon) {
+                               add_leaf_bone(parent_mat, parent, node);
+                       }
                }
 
        }
@@ -166,7 +170,7 @@ void ArmatureImporter::create_bone(SkinInfo *skin, COLLADAFW::Node *node, EditBo
        }
 
        bone->length = len_v3v3(bone->head, bone->tail);
-
+       joint_by_uid[node->getUniqueId()] = node;
        finished_joints.push_back(node);
 }
 
@@ -517,16 +521,11 @@ void ArmatureImporter::set_pose(Object *ob_arm,  COLLADAFW::Node *root_node, con
 // root - if this joint is the top joint in hierarchy, if a joint
 // is a child of a node (not joint), root should be true since
 // this is where we build armature bones from
-void ArmatureImporter::add_joint(COLLADAFW::Node *node, bool root, Object *parent)
+void ArmatureImporter::add_root_joint(COLLADAFW::Node *node, Object *parent)
 {
-       joint_by_uid[node->getUniqueId()] = node;
-       if (root) {
-               root_joints.push_back(node);
-
-               if (parent) {
-                                       
-                       joint_parent_map[node->getUniqueId()] = parent;
-               }
+       root_joints.push_back(node);
+       if (parent) {
+               joint_parent_map[node->getUniqueId()] = parent;
        }
 }
 
index bd17a925f3a533b8f41cee9261e0c21c7b82a451..beeac85cc4d69fbbdfe9e46a8a8a38fce23dad27 100644 (file)
@@ -140,11 +140,7 @@ public:
        ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh, Scene *sce);
        ~ArmatureImporter();
 
-       void add_joint(COLLADAFW::Node *node, bool root, Object *parent);
-
-#if 0
-       void add_root_joint(COLLADAFW::Node *node);
-#endif
+       void add_root_joint(COLLADAFW::Node *node, Object *parent);
 
        // here we add bones to armatures, having armatures previously created in write_controller
        void make_armatures(bContext *C);
index af1113b337a258174cb0eea838ac1d9d1115bf4c..80bde1842dd93780ba0b6f0cb9095b04831c3aa7 100644 (file)
@@ -311,11 +311,6 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW
 #endif
        unsigned int i;
 
-
-       //for (i = 0; i < 4; i++)
-       //    ob =
-       anim_importer.translate_Animations(node, root_map, object_map, FW_object_map);
-
        if (node->getType() == COLLADAFW::Node::JOINT && par == NULL) {
                // For Skeletons without root node we have to simulate the
                // root node here and recursively enter the same function
@@ -323,6 +318,7 @@ void DocumentImporter::translate_anim_recursive(COLLADAFW::Node *node, COLLADAFW
                translate_anim_recursive(node, node, parob);
        }
        else {
+               anim_importer.translate_Animations(node, root_map, object_map, FW_object_map);
                COLLADAFW::NodePointerArray &children = node->getChildNodes();
                for (i = 0; i < children.getCount(); i++) {
                        translate_anim_recursive(children[i], node, NULL);
@@ -480,7 +476,9 @@ std::vector<Object *> *DocumentImporter::write_node(COLLADAFW::Node *node, COLLA
                        object_map.insert(std::pair<COLLADAFW::UniqueId, Object *>(node->getUniqueId(), par));
                        node_map[node->getUniqueId()] = node;
                }
-               armature_importer.add_joint(node, parent_node == NULL || parent_node->getType() != COLLADAFW::Node::JOINT, par);
+               if (parent_node == NULL || parent_node->getType() != COLLADAFW::Node::JOINT) {
+                       armature_importer.add_root_joint(node, par);
+               }
 
                if (parent_node == NULL) {
                        // for skeletons without root node all has been done above.
index 402fa28e210c856a1eced34cd09a1cae322dae74..e0ac767b6287e1201579f351f8db597a3bb198e0 100644 (file)
@@ -304,7 +304,8 @@ void WorkScheduler::initialize(bool use_opencl)
                g_context = NULL;
                g_program = NULL;
 
-               OCL_init(); /* this will check and skip if already initialized */
+               if (!OCL_init()) /* this will check for errors and skip if already initialized */
+                       return;
 
                if (clCreateContextFromType) {
                        cl_uint numberOfPlatforms = 0;
index 5b386a504e473d62845116011ff74a680296f5a5..6f2baa63b0e5ec2087d1f0b288dafa351ae293f4 100644 (file)
@@ -34,11 +34,14 @@ void TextureNode::convertToOperations(ExecutionSystem *system, CompositorContext
        bNode *editorNode = this->getbNode();
        Tex *texture = (Tex *)editorNode->id;
        TextureOperation *operation = new TextureOperation();
+       const ColorManagedDisplaySettings *displaySettings = context->getDisplaySettings();
+       bool sceneColorManage = strcmp(displaySettings->display_device, "None") != 0;
        this->getOutputSocket(1)->relinkConnections(operation->getOutputSocket());
        this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, system);
        this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, system);
        operation->setTexture(texture);
        operation->setRenderData(context->getRenderData());
+       operation->setSceneColorManage(sceneColorManage);
        system->addOperation(operation);
        addPreviewOperation(system, context, operation->getOutputSocket());
 
@@ -49,6 +52,7 @@ void TextureNode::convertToOperations(ExecutionSystem *system, CompositorContext
                addLink(system, operation->getInputSocket(1)->getConnection()->getFromSocket(), alphaOperation->getInputSocket(1));
                alphaOperation->setTexture(texture);
                alphaOperation->setRenderData(context->getRenderData());
+               alphaOperation->setSceneColorManage(sceneColorManage);
                system->addOperation(alphaOperation);
        }
 }
index 8b1128a4da30cdc1b381b96b39cccbfc5c51da65..fa22ba668b9c1cbc418567d38ac7b62cdc0b2111 100644 (file)
@@ -32,6 +32,7 @@
 #include "DNA_movieclip_types.h"
 
 #include "BLI_listbase.h"
+#include "BLI_string.h"
 
 extern "C" {
        #include "BLI_voronoi.h"
@@ -76,7 +77,7 @@ public:
        void deinitializeTileData(rcti *rect, void *data);
 
        void setMovieClip(MovieClip *clip) {this->m_movieClip = clip;}
-       void setTrackingObject(const char *object) {strncpy(this->m_trackingObject, object, sizeof(this->m_trackingObject));}
+       void setTrackingObject(const char *object) { BLI_strncpy(this->m_trackingObject, object, sizeof(this->m_trackingObject)); }
        void setFramenumber(int framenumber) {this->m_framenumber = framenumber;}
 
        void executePixel(float output[4], int x, int y, void *data);
index 08f6f8ada4af2661f33d09750ccaab486747f4c2..bbb7c8b52891489a3225d8ec0e65f42e97ceb876 100644 (file)
@@ -33,6 +33,8 @@ TextureBaseOperation::TextureBaseOperation() : SingleThreadedNodeOperation()
        this->m_inputSize = NULL;
        this->m_inputOffset = NULL;
        this->m_rd = NULL;
+       this->m_pool = NULL;
+       this->m_sceneColorManage = false;
 }
 TextureOperation::TextureOperation() : TextureBaseOperation()
 {
@@ -101,7 +103,7 @@ void TextureBaseOperation::executePixel(float output[4], float x, float y, Pixel
        vec[1] = textureSize[1] * (v + textureOffset[1]);
        vec[2] = textureSize[2] * textureOffset[2];
 
-       retval = multitex_ext(this->m_texture, vec, NULL, NULL, 0, &texres, m_pool);
+       retval = multitex_ext(this->m_texture, vec, NULL, NULL, 0, &texres, m_pool, m_sceneColorManage);
 
        if (texres.talpha)
                output[3] = texres.ta;
index fc9369099a6426280a2ec1771a6359b4cf8c5de3..b776f6f2493ee1d8d6824c98c227bcd9252d09ae 100644 (file)
@@ -46,6 +46,7 @@ private:
        SocketReader *m_inputSize;
        SocketReader *m_inputOffset;
        struct ImagePool *m_pool;
+       bool m_sceneColorManage;
 
 protected:
 
@@ -67,6 +68,7 @@ public:
        void initExecution();
        void deinitExecution();
        void setRenderData(const RenderData *rd) { this->m_rd = rd; }
+       void setSceneColorManage(bool sceneColorManage) { this->m_sceneColorManage = sceneColorManage; }
 };
 
 class TextureOperation : public TextureBaseOperation {
index 3f05b907ea036275f13da40606c8bee0749de103..b5499ab76b71d71084586e0e5ec83727404b40cc 100644 (file)
@@ -33,6 +33,7 @@
 #include "DNA_tracking_types.h"
 
 #include "BLI_listbase.h"
+#include "BLI_string.h"
 
 /**
  * Class with implementation of green screen gradient rasterization
@@ -60,8 +61,8 @@ public:
        TrackPositionOperation();
 
        void setMovieClip(MovieClip *clip) {this->m_movieClip = clip;}
-       void setTrackingObject(char *object) {strncpy(this->m_trackingObjectName, object, sizeof(this->m_trackingObjectName));}
-       void setTrackName(char *track) {strncpy(this->m_trackName, track, sizeof(this->m_trackName));}
+       void setTrackingObject(char *object) { BLI_strncpy(this->m_trackingObjectName, object, sizeof(this->m_trackingObjectName)); }
+       void setTrackName(char *track) { BLI_strncpy(this->m_trackName, track, sizeof(this->m_trackName)); }
        void setFramenumber(int framenumber) {this->m_framenumber = framenumber;}
        void setAxis(int value) {this->m_axis = value;}
        void setPosition(int value) {this->m_position = value;}
index bbdc0df41a77c4c78268c785fa09bcb54beac1d5..53d561c7736c642e9f5a1d6b1e2a99d2414a8510 100644 (file)
@@ -434,7 +434,7 @@ void ED_armature_deselect_all_visible(Object *obedit)
 
        for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
                /* first and foremost, bone must be visible and selected */
-               if (EBONE_SELECTABLE(arm, ebone)) {
+               if (EBONE_VISIBLE(arm, ebone)) {
                        ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
                }
        }
@@ -597,38 +597,48 @@ static int armature_de_select_all_exec(bContext *C, wmOperator *op)
        int action = RNA_enum_get(op->ptr, "action");
 
        if (action == SEL_TOGGLE) {
-               action = SEL_SELECT;
                /* Determine if there are any selected bones
                 * And therefore whether we are selecting or deselecting */
-               if (CTX_DATA_COUNT(C, selected_bones) > 0)
-                       action = SEL_DESELECT;
+               action = SEL_SELECT;
+               CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones)
+               {
+                       if (ebone->flag & (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL)) {
+                               action = SEL_DESELECT;
+                               break;
+                       }
+               }
+               CTX_DATA_END;
        }
        
        /*      Set the flags */
        CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones)
        {
                /* ignore bone if selection can't change */
-               if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
-                       switch (action) {
-                               case SEL_SELECT:
+               switch (action) {
+                       case SEL_SELECT:
+                               if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
                                        ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
-                                       if (ebone->parent)
+                                       if (ebone->parent) {
                                                ebone->parent->flag |= (BONE_TIPSEL);
-                                       break;
-                               case SEL_DESELECT:
-                                       ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
-                                       break;
-                               case SEL_INVERT:
-                                       if (ebone->flag & BONE_SELECTED) {
-                                               ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
                                        }
-                                       else {
+                               }
+                               break;
+                       case SEL_DESELECT:
+                               ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
+                               break;
+                       case SEL_INVERT:
+                               if (ebone->flag & BONE_SELECTED) {
+                                       ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
+                               }
+                               else {
+                                       if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
                                                ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
-                                               if (ebone->parent)
+                                               if (ebone->parent) {
                                                        ebone->parent->flag |= (BONE_TIPSEL);
+                                               }
                                        }
-                                       break;
-                       }
+                               }
+                               break;
                }
        }
        CTX_DATA_END;
@@ -672,16 +682,6 @@ static EnumPropertyItem prop_similar_types[] = {
        {0, NULL, 0, NULL, NULL}
 };
 
-/* could be used in more places */
-static void ED_armature_edit_bone_select(EditBone *ebone)
-{
-       BLI_assert((ebone->flag & BONE_UNSELECTABLE) == 0);
-       ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
-
-       if ((ebone->flag & BONE_CONNECTED) && (ebone->parent != NULL)) {
-               ebone->parent->flag |= BONE_TIPSEL;
-       }
-}
 
 static void select_similar_length(bArmature *arm, EditBone *ebone_act, const float thresh)
 {
@@ -696,7 +696,7 @@ static void select_similar_length(bArmature *arm, EditBone *ebone_act, const flo
                        if ((ebone->length >= len_min) &&
                            (ebone->length <= len_max))
                        {
-                               ED_armature_edit_bone_select(ebone);
+                               ED_armature_ebone_select_set(ebone, true);
                        }
                }
        }
@@ -714,7 +714,7 @@ static void select_similar_direction(bArmature *arm, EditBone *ebone_act, const
                        sub_v3_v3v3(dir, ebone->head, ebone->tail);
 
                        if (angle_v3v3(dir_act, dir) / (float)M_PI < thresh) {
-                               ED_armature_edit_bone_select(ebone);
+                               ED_armature_ebone_select_set(ebone, true);
                        }
                }
        }
@@ -727,7 +727,7 @@ static void select_similar_layer(bArmature *arm, EditBone *ebone_act)
        for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
                if (EBONE_SELECTABLE(arm, ebone)) {
                        if (ebone->layer & ebone_act->layer) {
-                               ED_armature_edit_bone_select(ebone);
+                               ED_armature_ebone_select_set(ebone, true);
                        }
                }
        }
@@ -750,8 +750,8 @@ static void select_similar_prefix(bArmature *arm, EditBone *ebone_act)
                if (EBONE_SELECTABLE(arm, ebone)) {
                        char prefix_other[MAX_VGROUP_NAME];
                        BKE_deform_split_prefix(ebone->name, prefix_other, body_tmp);
-                       if (!strcmp(prefix_act, prefix_other)) {
-                               ED_armature_edit_bone_select(ebone);
+                       if (STREQ(prefix_act, prefix_other)) {
+                               ED_armature_ebone_select_set(ebone, true);
                        }
                }
        }
@@ -774,8 +774,8 @@ static void select_similar_suffix(bArmature *arm, EditBone *ebone_act)
                if (EBONE_SELECTABLE(arm, ebone)) {
                        char suffix_other[MAX_VGROUP_NAME];
                        BKE_deform_split_suffix(ebone->name, body_tmp, suffix_other);
-                       if (!strcmp(suffix_act, suffix_other)) {
-                               ED_armature_edit_bone_select(ebone);
+                       if (STREQ(suffix_act, suffix_other)) {
+                               ED_armature_ebone_select_set(ebone, true);
                        }
                }
        }
index cfee6c346000251afab6beb5950d0cfc6302acde..0e93a00b01db52c71a7581ec1d17c62e778f2284 100644 (file)
@@ -337,18 +337,9 @@ EditBone *make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent, Bone
                }
                else {
                        /* if the bone is not selected, but connected to its parent
-                        *  copy the parents tip selection state */
+                        * always use the parents tip selection state */
                        if (eBone->parent && (eBone->flag & BONE_CONNECTED)) {
-                               /* selecting with the mouse gives this behavior */
-                               if (eBone->parent->flag & BONE_TIPSEL) {
-                                       eBone->flag |= BONE_ROOTSEL;
-                               }
-                               else {
-                                       eBone->flag &= ~BONE_ROOTSEL;
-                               }
-                               
-                               /* probably not selected but just in case */
-                               eBone->flag &= ~BONE_TIPSEL;
+                               eBone->flag &= ~BONE_ROOTSEL;
                        }
                }
                
@@ -713,3 +704,62 @@ void undo_push_armature(bContext *C, const char *name)
        // XXX solve getdata()
        undo_editmode_push(C, name, get_armature_edit, free_undoBones, undoBones_to_editBones, editBones_to_undoBones, NULL);
 }
+
+/* *************************************************************** */
+/* Low level selection functions which hide connected-parent
+ * flag behavior which gets tricky to handle in selection operators.
+ * (no flushing in ED_armature_ebone_select.*, that should be explicit) */
+
+int ED_armature_ebone_selectflag_get(const EditBone *ebone)
+{
+       if (ebone->parent && (ebone->flag & BONE_CONNECTED)) {
+               return ((ebone->flag & (BONE_SELECTED | BONE_TIPSEL)) |
+                       ((ebone->parent->flag & BONE_TIPSEL) ? BONE_ROOTSEL : 0));
+       }
+       else {
+               return (ebone->flag & (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL));
+       }
+}
+
+void ED_armature_ebone_selectflag_set(EditBone *ebone, int flag)
+{
+       flag = flag & (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL);
+
+       if (ebone->parent && (ebone->flag & BONE_CONNECTED)) {
+               ebone->flag &= ~(BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL);
+               ebone->parent->flag &= ~BONE_TIPSEL;
+
+               ebone->flag |= flag;
+               ebone->parent->flag |= (flag & BONE_ROOTSEL) ? BONE_TIPSEL : 0;
+       }
+       else {
+               ebone->flag &= ~(BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL);
+               ebone->flag |= flag;
+       }
+}
+
+void ED_armature_ebone_selectflag_enable(EditBone *ebone, int flag)
+{
+       BLI_assert((flag & (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL)) != 0);
+       ED_armature_ebone_selectflag_set(ebone, ebone->flag | flag);
+}
+
+void ED_armature_ebone_selectflag_disable(EditBone *ebone, int flag)
+{
+       BLI_assert((flag & (BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL)) != 0);
+       ED_armature_ebone_selectflag_set(ebone, ebone->flag & ~flag);
+}
+
+/* could be used in more places */
+void ED_armature_ebone_select_set(EditBone *ebone, bool select)
+{
+       int flag;
+       if (select) {
+               BLI_assert((ebone->flag & BONE_UNSELECTABLE) == 0);
+               flag = (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
+       }
+       else {
+               flag = 0;
+       }
+       ED_armature_ebone_selectflag_set(ebone, flag);
+}
index 5b2cc49d1068614338c4f57ac611bec9da7152fe..db4e4dc85009c6ffc3f00005145d32dd065420e4 100644 (file)
@@ -380,7 +380,7 @@ static int paste_file(bContext *C, ReportList *reports, const char *filename)
 
        if (cu->len + filelen < MAXTEXT) {
                int tmplen;
-               wchar_t *mem = MEM_callocN((sizeof(wchar_t) * filelen) + (4 * sizeof(wchar_t)), "temporary");
+               wchar_t *mem = MEM_mallocN((sizeof(wchar_t) * filelen) + (4 * sizeof(wchar_t)), "temporary");
                tmplen = BLI_strncpy_wchar_from_utf8(mem, strp, filelen + 1);
                wcscat(ef->textbuf, mem);
                MEM_freeN(mem);
@@ -1273,7 +1273,7 @@ static int insert_text_invoke(bContext *C, wmOperator *op, const wmEvent *event)
                                accentcode = 0;
                        }
                        else if (event->utf8_buf[0]) {
-                               BLI_strncpy_wchar_from_utf8(inserted_text, event->utf8_buf, 1);
+                               BLI_strncpy_wchar_from_utf8(inserted_text, event->utf8_buf, 2);
                                ascii = inserted_text[0];
                                insert_into_textbuf(obedit, ascii);
                                accentcode = 0;
index 801fa12d444d8331b94b3a54290e646e9cae35b1..9b9a4c154db39058d8d5ba0084277b64f3d43b69 100644 (file)
@@ -153,6 +153,13 @@ void ED_armature_bone_rename(struct bArmature *arm, const char *oldnamep, const
 
 void undo_push_armature(struct bContext *C, const char *name);
 
+/* low level selection functions which handle */
+int  ED_armature_ebone_selectflag_get(const EditBone *ebone);
+void ED_armature_ebone_selectflag_set(EditBone *ebone, int flag);
+void ED_armature_ebone_select_set(EditBone *ebone, bool select);
+void ED_armature_ebone_selectflag_enable(EditBone *ebone, int flag);
+void ED_armature_ebone_selectflag_disable(EditBone *ebone, int flag);
+
 /* poseobject.c */
 void ED_armature_exit_posemode(struct bContext *C, struct Base *base);
 void ED_armature_enter_posemode(struct bContext *C, struct Base *base);
index 097f042d6c9a2dff2cb33f11711e64943c25bac1..b59e06cbc0e3bcce4405824dff6ba6001d10a039 100644 (file)
@@ -962,10 +962,10 @@ static bool ui_but_event_property_operator_string(const bContext *C, uiBut *but,
                                                data_path = BLI_sprintfN("scene.%s", path);
                                                MEM_freeN(path);
                                        }
-                                       else {
+                                       /*else {
                                                printf("ERROR in %s(): Couldn't get path for scene property - %s\n", 
                                                       __func__, RNA_property_identifier(but->rnaprop));
-                                       }
+                                       }*/
                                }
                        }
                        else {
index b13de64d0c7e48613798b6df527182f03bc69710..3fe11ad3a6bd274c0c1ae73e05bbfa75518fe112 100644 (file)
@@ -255,7 +255,7 @@ Panel *uiBeginPanel(ScrArea *sa, ARegion *ar, uiBlock *block, PanelType *pt, int
                pa->sizey = 0;
        }
 
-       BLI_strncpy(pa->drawname, drawname, UI_MAX_NAME_STR);
+       BLI_strncpy(pa->drawname, drawname, sizeof(pa->drawname));
 
        /* if a new panel is added, we insert it right after the panel
         * that was last added. this way new panels are inserted in the
index 21fe51c03ef40cb223e79db4c8aea292e8ae9914..b825de58678f84f7bbf1e59a06b63cf5dca4b589 100644 (file)
@@ -125,98 +125,22 @@ static CustomData *mesh_customdata_get_type(Mesh *me, const char htype, int *r_t
 #define GET_CD_DATA(me, data) (me->edit_btmesh ? &me->edit_btmesh->bm->data : &me->data)
 static void delete_customdata_layer(Mesh *me, CustomDataLayer *layer)
 {
+       const int type = layer->type;
        CustomData *data;
-       void *actlayerdata, *rndlayerdata, *clonelayerdata, *stencillayerdata, *layerdata = layer->data;
-       int type = layer->type;
-       int index;
-       int i, actindex, rndindex, cloneindex, stencilindex, tot;
+       int layer_index, tot, n;
 
-       if (layer->type == CD_MLOOPCOL || layer->type == CD_MLOOPUV) {
-               data = mesh_customdata_get_type(me, BM_LOOP, &tot);
-       }
-       else {
-               data = mesh_customdata_get_type(me, BM_FACE, &tot);
-       }
-       
-       index = CustomData_get_layer_index(data, type);
-
-       /* ok, deleting a non-active layer needs to preserve the active layer indices.
-        * to do this, we store a pointer to the .data member of both layer and the active layer,
-        * (to detect if we're deleting the active layer or not), then use the active
-        * layer data pointer to find where the active layer has ended up.
-        *
-        * this is necessary because the deletion functions only support deleting the active
-        * layer. */
-       actlayerdata = data->layers[CustomData_get_active_layer_index(data, type)].data;
-       rndlayerdata = data->layers[CustomData_get_render_layer_index(data, type)].data;
-       clonelayerdata = data->layers[CustomData_get_clone_layer_index(data, type)].data;
-       stencillayerdata = data->layers[CustomData_get_stencil_layer_index(data, type)].data;
-       CustomData_set_layer_active(data, type, layer - &data->layers[index]);
+       data = mesh_customdata_get_type(me, (ELEM(type, CD_MLOOPUV, CD_MLOOPCOL)) ? BM_LOOP : BM_FACE, &tot);
+       layer_index = CustomData_get_layer_index(data, type);
+       n = (layer - &data->layers[layer_index]);
+       BLI_assert(n >= 0 && (n + layer_index) < data->totlayer);
 
        if (me->edit_btmesh) {
-               BM_data_layer_free(me->edit_btmesh->bm, data, type);
+               BM_data_layer_free_n(me->edit_btmesh->bm, data, type, n);
        }
        else {
-               CustomData_free_layer_active(data, type, tot);
+               CustomData_free_layer(data, type, tot, n);
                BKE_mesh_update_customdata_pointers(me, true);
        }
-
-       /* reconstruct active layer */
-       if (actlayerdata != layerdata) {
-               /* find index */
-               actindex = CustomData_get_layer_index(data, type);
-               for (i = actindex; i < data->totlayer; i++) {
-                       if (data->layers[i].data == actlayerdata) {
-                               actindex = i - actindex;
-                               break;
-                       }
-               }
-               
-               /* set index */
-               CustomData_set_layer_active(data, type, actindex);
-       }
-       
-       if (rndlayerdata != layerdata) {
-               /* find index */
-               rndindex = CustomData_get_layer_index(data, type);
-               for (i = rndindex; i < data->totlayer; i++) {
-                       if (data->layers[i].data == rndlayerdata) {
-                               rndindex = i - rndindex;
-                               break;
-                       }
-               }
-               
-               /* set index */
-               CustomData_set_layer_render(data, type, rndindex);
-       }
-       
-       if (clonelayerdata != layerdata) {
-               /* find index */
-               cloneindex = CustomData_get_layer_index(data, type);
-               for (i = cloneindex; i < data->totlayer; i++) {
-                       if (data->layers[i].data == clonelayerdata) {
-                               cloneindex = i - cloneindex;
-                               break;
-                       }
-               }
-               
-               /* set index */
-               CustomData_set_layer_clone(data, type, cloneindex);
-       }
-       
-       if (stencillayerdata != layerdata) {
-               /* find index */
-               stencilindex = CustomData_get_layer_index(data, type);
-               for (i = stencilindex; i < data->totlayer; i++) {
-                       if (data->layers[i].data == stencillayerdata) {
-                               stencilindex = i - stencilindex;
-                               break;
-                       }
-               }
-               
-               /* set index */
-               CustomData_set_layer_stencil(data, type, stencilindex);
-       }
 }
 
 static void mesh_uv_reset_array(float **fuv, const int len)
index f563451f64188cadba524e7f54c23bc0d61c60b2..5b100d7b6c2dc73dc8739eb42551fa1f6b546e5e 100644 (file)
@@ -226,7 +226,7 @@ float ED_object_new_primitive_matrix(bContext *C, Object *obedit,
                return dia;
        }
 
-       return 1.0f;
+       // return 1.0f;
 }
 
 /********************* Add Object Operator ********************/
index 424333810a80c35713da71a3a3b8371b465dd92d..366aa72f2b85bf9995318054867644684ac44485 100644 (file)
@@ -682,12 +682,17 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 {
        Main *bmain = CTX_data_main(C);
        Scene *scene = CTX_data_scene(C);
+       Object *obact = CTX_data_active_object(C);
        Object *obedit = CTX_data_edit_object(C);
        Object *tob;
        float cursor[3], cent[3], cent_neg[3], centn[3];
        int centermode = RNA_enum_get(op->ptr, "type");
        int around = RNA_enum_get(op->ptr, "center"); /* initialized from v3d->around */
 
+       ListBase ctx_data_list;
+       CollectionPointerLink *ctx_ob;
+       CollectionPointerLink *ctx_ob_act = NULL;
+
        /* keep track of what is changed */
        int tot_change = 0, tot_lib_error = 0, tot_multiuser_arm_error = 0;
 
@@ -746,12 +751,25 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
                }
        }
 
+       CTX_data_selected_editable_objects(C, &ctx_data_list);
+
        /* reset flags */
-       CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
+       for (ctx_ob = ctx_data_list.first;
+            ctx_ob;
+            ctx_ob = ctx_ob->next)
        {
+               Object *ob = ctx_ob->ptr.data;
                ob->flag &= ~OB_DONE;
+
+               /* move active first */
+               if (ob == obact) {
+                       ctx_ob_act = ctx_ob;
+               }
+       }
+
+       if (ctx_ob_act) {
+               BLI_rotatelist(&ctx_data_list, (LinkData *)ctx_ob_act);
        }
-       CTX_DATA_END;
 
        for (tob = bmain->object.first; tob; tob = tob->id.next) {
                if (tob->data)
@@ -760,8 +778,12 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
                        ((ID *)tob->dup_group)->flag &= ~LIB_DOIT;
        }
 
-       CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
+       for (ctx_ob = ctx_data_list.first;
+            ctx_ob;
+            ctx_ob = ctx_ob->next)
        {
+               Object *ob = ctx_ob->ptr.data;
+
                if ((ob->flag & OB_DONE) == 0) {
                        int do_inverse_offset = FALSE;
                        ob->flag |= OB_DONE;
@@ -992,7 +1014,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
                        }
                }
        }
-       CTX_DATA_END;
+       BLI_freelistN(&ctx_data_list);
 
        for (tob = bmain->object.first; tob; tob = tob->id.next)
                if (tob->data && (((ID *)tob->data)->flag & LIB_DOIT))
index 5c5352f1671197d0784f12fa6738a7765e9011dd..965aba5799baf348c86b331569f13d3636428f95 100644 (file)
@@ -3073,7 +3073,7 @@ void OBJECT_OT_vertex_group_remove(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Remove Vertex Group";
        ot->idname = "OBJECT_OT_vertex_group_remove";
-       ot->description = "Delete the active vertex group";
+       ot->description = "Delete the active or all vertex groups from the active object";
        
        /* api callbacks */
        ot->poll = vertex_group_poll;
@@ -3457,7 +3457,8 @@ void OBJECT_OT_vertex_group_lock(wmOperatorType *ot)
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
-       RNA_def_enum(ot->srna, "action", vgroup_lock_actions, VGROUP_TOGGLE, "Action", "Lock action to execute on vertex groups");
+       RNA_def_enum(ot->srna, "action", vgroup_lock_actions, VGROUP_TOGGLE, "Action",
+                    "Lock action to execute on vertex groups");
 }
 
 static int vertex_group_invert_exec(bContext *C, wmOperator *op)
@@ -3593,7 +3594,7 @@ void OBJECT_OT_vertex_group_clean(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Clean Vertex Group";
        ot->idname = "OBJECT_OT_vertex_group_clean";
-       ot->description = "Remove Vertex Group assignments which aren't required";
+       ot->description = "Remove vertex group assignments which are not required";
 
        /* api callbacks */
        ot->poll = vertex_group_poll;
@@ -3730,7 +3731,7 @@ void OBJECT_OT_vertex_group_copy_to_linked(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Copy Vertex Groups to Linked";
        ot->idname = "OBJECT_OT_vertex_group_copy_to_linked";
-       ot->description = "Copy Vertex Groups to all users of the same Geometry data";
+       ot->description = "Copy vertex groups to all users of the same geometry data";
 
        /* api callbacks */
        ot->poll = vertex_group_poll;
@@ -3757,7 +3758,7 @@ static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op)
 
        if ((change == 0 && fail == 0) || fail) {
                BKE_reportf(op->reports, RPT_ERROR,
-                           "Copy VGroups to Selected warning, %d done, %d failed (object data must have matching indices)",
+                           "Copy vertex groups to selected: %d done, %d failed (object data must have matching indices)",
                            change, fail);
        }
 
@@ -3769,7 +3770,7 @@ void OBJECT_OT_vertex_group_copy_to_selected(wmOperatorType *ot)
        /* identifiers */
        ot->name = "Copy Vertex Group to Selected";
        ot->idname = "OBJECT_OT_vertex_group_copy_to_selected";
-       ot->description = "Copy Vertex Groups to other selected objects with matching indices";
+       ot->description = "Copy vertex groups to other selected objects with matching indices";
 
        /* api callbacks */
        ot->poll = vertex_group_poll;
@@ -3887,7 +3888,7 @@ static int vertex_group_transfer_weight_exec(bContext *C, wmOperator *op)
        }
        else {
                if (op->reports->list.first == NULL) {
-                       BKE_report(op->reports, RPT_WARNING, "Failed, no other selected objects with vertex groups found.");
+                       BKE_report(op->reports, RPT_WARNING, "Failed, no other selected objects with vertex groups found");
                }
 
                return OPERATOR_FINISHED; /* to get the chance to make changes in the redo panel */
@@ -4107,7 +4108,7 @@ void OBJECT_OT_vertex_group_sort(wmOperatorType *ot)
 {
        ot->name = "Sort Vertex Groups";
        ot->idname = "OBJECT_OT_vertex_group_sort";
-       ot->description = "Sorts vertex groups alphabetically";
+       ot->description = "Sort vertex groups alphabetically";
 
        /* api callbacks */
        ot->poll = vertex_group_poll;
@@ -4251,12 +4252,12 @@ static bool check_vertex_group_accessible(wmOperator *op, Object *ob, int def_nr
        bDeformGroup *dg = BLI_findlink(&ob->defbase, def_nr);
 
        if (!dg) {
-               BKE_report(op->reports, RPT_ERROR, "Invalid Weight Group Index");
+               BKE_report(op->reports, RPT_ERROR, "Invalid vertex group index");
                return false;
        }
 
        if (dg->flag & DG_LOCK_WEIGHT) {
-               BKE_report(op->reports, RPT_ERROR, "Weight Group is locked");
+               BKE_report(op->reports, RPT_ERROR, "Vertex group is locked");
                return false;
        }
 
@@ -4284,9 +4285,9 @@ void OBJECT_OT_vertex_weight_paste(wmOperatorType *ot)
 {
        PropertyRNA *prop;
 
-       ot->name = "Paste weight to Selected";
+       ot->name = "Paste Weight to Selected";
        ot->idname = "OBJECT_OT_vertex_weight_paste";
-       ot->description = "Copy this group's weight to other selected verts (disabled if vertex Group is locked)";
+       ot->description = "Copy this group's weight to other selected verts (disabled if vertex group is locked)";
 
        /* api callbacks */
        ot->poll = vertex_group_vert_select_mesh_poll;
@@ -4296,7 +4297,7 @@ void OBJECT_OT_vertex_weight_paste(wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        prop = RNA_def_int(ot->srna, "weight_group", -1, -1, INT_MAX, "Weight Index",
-                          "Index of source weight in active Weight Group", -1, INT_MAX);
+                          "Index of source weight in active vertex group", -1, INT_MAX);
        RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN);
 }
 
@@ -4323,7 +4324,7 @@ void OBJECT_OT_vertex_weight_delete(wmOperatorType *ot)
 
        ot->name = "Delete Weight";
        ot->idname = "OBJECT_OT_vertex_weight_delete";
-       ot->description = "Delete this weight from the vertex (disabled if vertex Group is locked)";
+       ot->description = "Delete this weight from the vertex (disabled if vertex group is locked)";
 
        /* api callbacks */
        ot->poll = vertex_group_vert_select_mesh_poll;
@@ -4333,7 +4334,7 @@ void OBJECT_OT_vertex_weight_delete(wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        prop = RNA_def_int(ot->srna, "weight_group", -1, -1, INT_MAX, "Weight Index",
-                          "Index of source weight in active Weight Group", -1, INT_MAX);
+                          "Index of source weight in active vertex group", -1, INT_MAX);
        RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN);
 }
 
@@ -4357,7 +4358,7 @@ void OBJECT_OT_vertex_weight_set_active(wmOperatorType *ot)
 
        ot->name = "Set Active Group";
        ot->idname = "OBJECT_OT_vertex_weight_set_active";
-       ot->description = "Set as active Vertex Group";
+       ot->description = "Set as active vertex group";
 
        /* api callbacks */
        ot->poll = vertex_group_vert_select_mesh_poll;
@@ -4367,7 +4368,7 @@ void OBJECT_OT_vertex_weight_set_active(wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        prop = RNA_def_int(ot->srna, "weight_group", -1, -1, INT_MAX, "Weight Index",
-                          "Index of source weight in active Weight Group", -1, INT_MAX);
+                          "Index of source weight in active vertex group", -1, INT_MAX);
        RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN);
 }
 
@@ -4390,7 +4391,7 @@ void OBJECT_OT_vertex_weight_normalize_active_vertex(wmOperatorType *ot)
 
        ot->name = "Normalize Active";
        ot->idname = "OBJECT_OT_vertex_weight_normalize_active_vertex";
-       ot->description = "Normalize Active Vert Weights";
+       ot->description = "Normalize active vertex's weights";
 
        /* api callbacks */
        ot->poll = vertex_group_vert_select_mesh_poll;
@@ -4419,7 +4420,7 @@ void OBJECT_OT_vertex_weight_copy(wmOperatorType *ot)
 
        ot->name = "Copy Active";
        ot->idname = "OBJECT_OT_vertex_weight_copy";
-       ot->description = "Copy weights from Active to selected";
+       ot->description = "Copy weights from active to selected";
 
        /* api callbacks */
        ot->poll = vertex_group_vert_select_mesh_poll;
index 9634acd701a32e7573c3d74fba084bf1f12dffd8..5cb74e1ca09b73a1c204ed71f94d1da950da7ad4 100644 (file)
@@ -294,7 +294,7 @@ static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surf
        ED_update_for_newframe(CTX_data_main(C), scene, 1);
 
        /* Init surface */
-       if (!dynamicPaint_createUVSurface(surface)) return 0;
+       if (!dynamicPaint_createUVSurface(scene, surface)) return 0;
 
        /* Loop through selected frames */
        for (frame = surface->start_frame; frame <= surface->end_frame; frame++) {
index b9653da47e6fd034584d2d29c21c0f261e051b23..bc4ca82392f70b9762fd987b099ca8c284b22851 100644 (file)
@@ -831,9 +831,10 @@ static void render_view3d_renderinfo_cb(void *rjp, RenderStats *rs)
        RenderPreview *rp = rjp;
 
        /* during render, rv3d->engine can get freed */
-       if (rp->rv3d->render_engine == NULL)
+       if (rp->rv3d->render_engine == NULL) {
                *rp->stop = 1;
-       else if (rp->engine->text) {
+       }
+       else {
                make_renderinfo_string(rs, rp->scene, false, rp->engine->text);
        
                /* make jobs timer to send notifier */
index 13379425258dd06126957ec5c27cd90a4e4ed27f..93ae913cee0481f11fa53c279a96c86695ec60af 100644 (file)
@@ -107,6 +107,10 @@ typedef struct OGLRender {
        bMovieHandle *mh;
        int cfrao, nfra;
 
+       /* wm vars for timer and progress cursor */
+       wmWindowManager *wm;
+       wmWindow *win;
+
        wmTimer *timer; /* use to check if running modal or not (invoke'd or exec'd)*/
 } OGLRender;
 
@@ -327,6 +331,9 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
 static int screen_opengl_render_init(bContext *C, wmOperator *op)
 {
        /* new render clears all callbacks */
+       wmWindowManager *wm = CTX_wm_manager(C);
+       wmWindow *win = CTX_wm_window(C);
+
        Scene *scene = CTX_data_scene(C);
        ScrArea *prevsa = CTX_wm_area(C);
        ARegion *prevar = CTX_wm_region(C);
@@ -353,7 +360,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
        }
 
        /* only one render job at a time */
-       if (WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_RENDER))
+       if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER))
                return 0;
        
        if (!is_view_context && scene->camera == NULL) {
@@ -367,7 +374,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
        }
 
        /* stop all running jobs, except screen one. currently previews frustrate Render */
-       WM_jobs_kill_all_except(CTX_wm_manager(C), CTX_wm_screen(C));
+       WM_jobs_kill_all_except(wm, CTX_wm_screen(C));
 
        /* create offscreen buffer */
        sizex = (scene->r.size * scene->r.xsch) / 100;
@@ -381,9 +388,6 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
                return 0;
        }
 
-       /* handle UI stuff */
-       WM_cursor_wait(1);
-
        /* allocate opengl render */
        oglrender = MEM_callocN(sizeof(OGLRender), "OGLRender");
        op->customdata = oglrender;
@@ -441,6 +445,10 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
                rr->rectf = MEM_callocN(sizeof(float) * 4 * sizex * sizey, "screen_opengl_render_init rect");
        RE_ReleaseResult(oglrender->re);
 
+       /* wm vars */
+       oglrender->wm = wm;
+       oglrender->win = win;
+
        return 1;
 }
 
@@ -458,10 +466,13 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender)
                scene->r.cfra = oglrender->cfrao;
                BKE_scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender));
 
-               WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), oglrender->timer);
+               WM_event_remove_timer(oglrender->wm, oglrender->win, oglrender->timer);
+       }
+
+       if (oglrender->win) {
+               WM_cursor_restore(oglrender->win);
        }
 
-       WM_cursor_wait(0);
        WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, oglrender->scene);
 
        U.obcenter_dia = oglrender->obcenter_dia_back;
@@ -549,6 +560,10 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
                }
        }
 
+       if (oglrender->win) {
+               WM_cursor_time(oglrender->win, scene->r.cfra);
+       }
+
        BKE_scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender));
 
        if (view_context) {
@@ -714,7 +729,7 @@ static int screen_opengl_render_invoke(bContext *C, wmOperator *op, const wmEven
        render_view_open(C, event->x, event->y);
        
        WM_event_add_modal_handler(C, op);
-       oglrender->timer = WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
+       oglrender->timer = WM_event_add_timer(oglrender->wm, oglrender->win, TIMER, 0.01f);
        
        return OPERATOR_RUNNING_MODAL;
 }
index 7a274396e86bf470138e2baee362a35f20a997ca..3cdc2c771fc7c64a22dc98eda5331c85e537b7c4 100644 (file)
@@ -110,6 +110,7 @@ static int material_slot_add_exec(bContext *C, wmOperator *UNUSED(op))
        object_add_material_slot(ob);
        WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
        WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, ob);
+       WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_PREVIEW, ob);
        
        return OPERATOR_FINISHED;
 }
@@ -146,6 +147,7 @@ static int material_slot_remove_exec(bContext *C, wmOperator *op)
        DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
        WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
        WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, ob);
+       WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_PREVIEW, ob);
        
        return OPERATOR_FINISHED;
 }
index 8e2a29964ee4f6e7b4459680db7693ace8ac23a4..c7f8161c7edb206709b439407448d9f8e6940eb2 100644 (file)
@@ -3534,7 +3534,14 @@ int sculpt_mode_poll(bContext *C)
 
 int sculpt_mode_poll_view3d(bContext *C)
 {
-       return (sculpt_mode_poll(C) && CTX_wm_region_view3d(C));
+       return (sculpt_mode_poll(C) &&
+               CTX_wm_region_view3d(C));
+}
+
+int sculpt_poll_view3d(bContext *C)
+{
+       return (sculpt_poll(C) &&
+               CTX_wm_region_view3d(C));
 }
 
 int sculpt_poll(bContext *C)
@@ -4951,7 +4958,7 @@ static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op))
 
                BKE_paint_init(&ts->sculpt->paint, PAINT_CURSOR_SCULPT);
 
-               paint_cursor_start(C, sculpt_mode_poll_view3d);
+               paint_cursor_start(C, sculpt_poll_view3d);
        }
 
        WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene);
index 1060999e13f55729a93e45e10df0fff135d342f4..13f97c50dc76b91c9ca56c1167412ce6e8788d3d 100644 (file)
@@ -56,7 +56,9 @@ struct MultiresModifierData *sculpt_multires_active(struct Scene *scene, struct
 
 int sculpt_mode_poll(struct bContext *C);
 int sculpt_mode_poll_view3d(struct bContext *C);
+/* checks for a brush, not just sculpt mode */
 int sculpt_poll(struct bContext *C);
+int sculpt_poll_view3d(struct bContext *C);
 void sculpt_update_mesh_elements(struct Scene *scene, struct Sculpt *sd, struct Object *ob,
                                  int need_pmap, int need_mask);
 
index 7a6da5d8896ff8714aa42fa8d8df5179c8e8e894..de19df9abe249259785a6815b0687fcb923314c2 100644 (file)
@@ -50,6 +50,7 @@
 #include "BLI_math.h"
 #include "BLI_rect.h"
 #include "BLI_threads.h"
+#include "BLI_string.h"
 
 #include "BLF_translation.h"
 
@@ -250,13 +251,13 @@ static int open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)
                clip = ED_space_clip_get_clip(sc);
 
        if (clip) {
-               strncpy(path, clip->name, sizeof(path));
+               BLI_strncpy(path, clip->name, sizeof(path));
 
                BLI_path_abs(path, G.main->name);
                BLI_parent_dir(path);
        }
        else {
-               strncpy(path, U.textudir, sizeof(path));
+               BLI_strncpy(path, U.textudir, sizeof(path));
        }
 
        if (RNA_struct_property_is_set(op->ptr, "files"))
index 49b16a68dfc52515613e966a014e877e8937a32f..7899f9faf905d89e3a35ba1dcebc95b2dcd7ecc8 100644 (file)
@@ -420,7 +420,6 @@ static int mouse_on_slide_zone(SpaceClip *sc, MovieTrackingMarker *marker,
                                float padding, int width, int height)
 {
        const float size = 12.0f;
-       int inside = 0;
        float min[2], max[2];
        float dx, dy;
 
@@ -445,8 +444,6 @@ static int mouse_on_slide_zone(SpaceClip *sc, MovieTrackingMarker *marker,
 
        return IN_RANGE_INCL(co[0], slide_zone[0] - dx, slide_zone[0] + dx) &&
               IN_RANGE_INCL(co[1], slide_zone[1] - dy, slide_zone[1] + dy);
-
-       return inside;
 }
 
 static int mouse_on_corner(SpaceClip *sc, MovieTrackingMarker *marker,
index 7d7dccdf0e69970221d76b51d229a3506f3628d8..4d904ab6551e19d87ae2707dc18c5c5ca769fd1b 100644 (file)
@@ -463,10 +463,7 @@ void folderlist_pushdir(ListBase *folderlist, const char *dir)
 
        /* create next folder element */
        folder = (FolderList *)MEM_mallocN(sizeof(FolderList), "FolderList");
-       folder->foldername = (char *)MEM_mallocN(sizeof(char) * (strlen(dir) + 1), "foldername");
-       folder->foldername[0] = '\0';
-
-       BLI_strncpy(folder->foldername, dir, FILE_MAXDIR);
+       folder->foldername = BLI_strdup(dir);
 
        /* add it to the end of the list */
        BLI_addtail(folderlist, folder);
index 4dbd7792a29d13a0725620e92f5452203c2cda7d..2da3f3adb67ead60332ee3a2890703ca01c13f8f 100644 (file)
@@ -1898,6 +1898,8 @@ static int image_invert_exec(bContext *C, wmOperator *op)
 
 void IMAGE_OT_invert(wmOperatorType *ot)
 {
+       PropertyRNA *prop;
+
        /* identifiers */
        ot->name = "Invert Channels";
        ot->idname = "IMAGE_OT_invert";
@@ -1908,10 +1910,14 @@ void IMAGE_OT_invert(wmOperatorType *ot)
        ot->poll = image_invert_poll;
        
        /* properties */
-       RNA_def_boolean(ot->srna, "invert_r", 0, "Red", "Invert Red Channel");
-       RNA_def_boolean(ot->srna, "invert_g", 0, "Green", "Invert Green Channel");
-       RNA_def_boolean(ot->srna, "invert_b", 0, "Blue", "Invert Blue Channel");
-       RNA_def_boolean(ot->srna, "invert_a", 0, "Alpha", "Invert Alpha Channel");
+       prop = RNA_def_boolean(ot->srna, "invert_r", 0, "Red", "Invert Red Channel");
+       RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+       prop = RNA_def_boolean(ot->srna, "invert_g", 0, "Green", "Invert Green Channel");
+       RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+       prop = RNA_def_boolean(ot->srna, "invert_b", 0, "Blue", "Invert Blue Channel");
+       RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+       prop = RNA_def_boolean(ot->srna, "invert_a", 0, "Alpha", "Invert Alpha Channel");
+       RNA_def_property_flag(prop, PROP_SKIP_SAVE);
        
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
index 3f06db22f59b88b7bf2d9b24f8c87a6db8b10456..9720d981e85e1a465aec551ebda6759cedf7827a 100644 (file)
@@ -704,7 +704,7 @@ static int tree_element_active_sequence_dup(Scene *scene, TreeElement *te, TreeS
 // XXX select_single_seq(seq, 1);
        p = ed->seqbasep->first;
        while (p) {
-               if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
+               if ((!p->strip) || (!p->strip->stripdata) || (p->strip->stripdata->name[0] == '\0')) {
                        p = p->next;
                        continue;
                }
index b5c74eea30e0a89dec1066c555ab7ce07b19118d..08d32defd98669ec7ebadf092a96bcc216435987 100644 (file)
@@ -957,7 +957,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
        else if (type == TSE_SEQ_STRIP) {
                Strip *strip = (Strip *)idv;
 
-               if (strip->dir)
+               if (strip->dir[0] != '\0')
                        te->name = strip->dir;
                else
                        te->name = IFACE_("Strip None");
@@ -1171,7 +1171,7 @@ static void outliner_add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *t
 
        p = seq;
        while (p) {
-               if ((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
+               if ((!p->strip) || (!p->strip->stripdata) || (p->strip->stripdata->name[0] == '\0')) {
                        p = p->next;
                        continue;
                }
index 65199ee9c3d8a1acc7412419f21e9b0e6885867c..93dfc347b1f370ca24626e76f49da419c01511c2 100644 (file)
@@ -118,7 +118,7 @@ static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op,
                Scene *scene = CTX_data_scene(C);
                Sequence *last_seq = BKE_sequencer_active_get(scene);
                if (last_seq && last_seq->strip && SEQ_HAS_PATH(last_seq)) {
-                       char path[sizeof(last_seq->strip->dir)];
+                       char path[FILE_MAX];
                        BLI_strncpy(path, last_seq->strip->dir, sizeof(path));
                        BLI_path_abs(path, G.main->name);
                        RNA_string_set(op->ptr, identifier, path);
@@ -761,7 +761,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
        BKE_sequencer_sort(scene);
 
        /* last active name */
-       strncpy(ed->act_imagedir, strip->dir, FILE_MAXDIR - 1);
+       BLI_strncpy(ed->act_imagedir, strip->dir, sizeof(ed->act_imagedir));
 
        if (RNA_boolean_get(op->ptr, "overlap") == FALSE) {
                if (BKE_sequence_test_overlap(ed->seqbasep, seq))
index ff7220ea22d0bc100deb919c4e169581898da9b6..a4dea4e25b1ff5eb4906aba021e1a5ad255a1d57 100644 (file)
@@ -551,6 +551,7 @@ int seq_effect_find_selected(Scene *scene, Sequence *activeseq, int type, Sequen
                        }
                        if (seq1 == NULL) seq1 = seq2;
                        if (seq3 == NULL) seq3 = seq2;
+                       /* fall-through */
                case 2:
                        if (seq1 == NULL || seq2 == NULL) {
                                *error_str = N_("2 selected sequence strips are needed");
index 7525b799067aa0a10e0522d0f480b308d3142850..cffcc738b5a15078864735f9b62b5a2a556b8f7f 100644 (file)
@@ -566,7 +566,12 @@ static DMDrawOption draw_em_tf_mapped__set_draw(void *userData, int index)
 {
        drawEMTFMapped_userData *data = userData;
        BMEditMesh *em = data->em;
-       BMFace *efa = EDBM_face_at_index(em, index);
+       BMFace *efa;
+
+       if (UNLIKELY(index >= em->bm->totface))
+               return DM_DRAW_OPTION_NORMAL;
+
+       efa = EDBM_face_at_index(em, index);
 
        if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
                return DM_DRAW_OPTION_SKIP;
@@ -922,7 +927,13 @@ static int tex_mat_set_face_editmesh_cb(void *userData, int index)
        /* editmode face hiding */
        TexMatCallback *data = (TexMatCallback *)userData;
        Mesh *me = (Mesh *)data->me;
-       BMFace *efa = EDBM_face_at_index(me->edit_btmesh, index);
+       BMEditMesh *em = me->edit_btmesh;
+       BMFace *efa;
+
+       if (UNLIKELY(index >= em->bm->totface))
+               return DM_DRAW_OPTION_NORMAL;
+
+       efa = EDBM_face_at_index(em, index);
 
        return !BM_elem_flag_test(efa, BM_ELEM_HIDDEN);
 }
index 54a3260439e39fb90d9c2c851aec8014b2a44321..5c46040a2f9af2189cf5f45cc4f76f81816c2ca0 100644 (file)
@@ -3049,24 +3049,38 @@ static void draw_em_indices(BMEditMesh *em)
 
 static DMDrawOption draw_em_fancy__setFaceOpts(void *userData, int index)
 {
-       BMFace *efa = EDBM_face_at_index(userData, index);
+       BMEditMesh *em = userData;
+       BMFace *efa;
+
+       if (UNLIKELY(index >= em->bm->totface))
+               return DM_DRAW_OPTION_NORMAL;
 
+       efa = EDBM_face_at_index(em, index);
        if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
                GPU_enable_material(efa->mat_nr + 1, NULL);
                return DM_DRAW_OPTION_NORMAL;
        }
-       else
+       else {
                return DM_DRAW_OPTION_SKIP;
+       }
 }
 
 static DMDrawOption draw_em_fancy__setGLSLFaceOpts(void *userData, int index)
 {
-       BMFace *efa = EDBM_face_at_index(userData, index);
+       BMEditMesh *em = userData;
+       BMFace *efa;
 
-       if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
-               return DM_DRAW_OPTION_SKIP;
-       else
+       if (UNLIKELY(index >= em->bm->totface))
                return DM_DRAW_OPTION_NORMAL;
+
+       efa = EDBM_face_at_index(em, index);
+
+       if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
+               return DM_DRAW_OPTION_NORMAL;
+       }
+       else {
+               return DM_DRAW_OPTION_SKIP;
+       }
 }
 
 static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,
index 4a823290f99041a5990e53fb6a155b7f51dfaef5..536bccfbe7a81bfe5e11625891ad142ad08a3666 100644 (file)
@@ -915,7 +915,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
                ot = WM_operatortype_find("OBJECT_OT_vertex_weight_normalize_active_vertex", 1);
                but = uiDefButO_ptr(block, BUT, ot, WM_OP_EXEC_DEFAULT, "Normalize",
                                    0, yco, UI_UNIT_X * 5, UI_UNIT_Y,
-                                   TIP_("Normalize weights of active vertex (if affected groups are unlocked"));
+                                   TIP_("Normalize weights of active vertex (if affected groups are unlocked)"));
                if (lock_count) {
                        uiButSetFlag(but, UI_BUT_DISABLED);
                }
@@ -923,7 +923,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa)
                ot = WM_operatortype_find("OBJECT_OT_vertex_weight_copy", 1);
                but = uiDefButO_ptr(block, BUT, ot, WM_OP_EXEC_DEFAULT, "Copy",
                                    UI_UNIT_X * 5, yco, UI_UNIT_X * 5, UI_UNIT_Y,
-                                   TIP_("Copy active vertex to other selected verts (if affected groups are unlocked)"));
+                                   TIP_("Copy active vertex to other selected vertices (if affected groups are unlocked)"));
                if (lock_count) {
                        uiButSetFlag(but, UI_BUT_DISABLED);
                }
index 0a2358aa137a3f694044e344261be9a294bc31d8..61532e75ee9cf4e7af5bd858debe3005f4e7fcd2 100644 (file)
@@ -3033,7 +3033,7 @@ static void view3d_main_area_draw_engine_info(View3D *v3d, RegionView3D *rv3d, A
 {
        float fill_color[4] = {0.0f, 0.0f, 0.0f, 0.25f};
 
-       if (!rv3d->render_engine || !rv3d->render_engine->text)
+       if (!rv3d->render_engine || !rv3d->render_engine->text[0])
                return;
        
        if (render_border) {
index c119fe2421047d9f0f1feaec38d66f2b346e3584..96cd5a22f58139963022b6d5e5aa9403add79f62 100644 (file)
@@ -609,7 +609,7 @@ static void do_lasso_select_armature__doSelectBone(void *userData, struct EditBo
        LassoSelectUserData *data = userData;
        bArmature *arm = data->vc->obedit->data;
 
-       if (EBONE_SELECTABLE(arm, ebone)) {
+       if (data->select ? EBONE_SELECTABLE(arm, ebone) : EBONE_VISIBLE(arm, ebone)) {
                bool is_point_done = false;
                int points_proj_tot = 0;
 
@@ -1907,7 +1907,7 @@ static int do_armature_box_select(ViewContext *vc, rcti *rect, bool select, bool
                int index = buffer[(4 * a) + 3];
                if (index != -1) {
                        ebone = BLI_findlink(arm->edbo, index & ~(BONESEL_ANY));
-                       if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
+                       if ((select == false) || ((ebone->flag & BONE_UNSELECTABLE) == 0)) {
                                if (index & BONESEL_TIP) {
                                        ebone->flag |= BONE_DONE;
                                        if (select) ebone->flag |= BONE_TIPSEL;
@@ -1937,7 +1937,7 @@ static int do_armature_box_select(ViewContext *vc, rcti *rect, bool select, bool
                if (index != -1) {
                        ebone = BLI_findlink(arm->edbo, index & ~(BONESEL_ANY));
                        if (index & BONESEL_BONE) {
-                               if ((ebone->flag & BONE_UNSELECTABLE) == 0) {
+                               if ((select == false) || ((ebone->flag & BONE_UNSELECTABLE) == 0)) {
                                        if (!(ebone->flag & BONE_DONE)) {
                                                if (select)
                                                        ebone->flag |= (BONE_ROOTSEL | BONE_TIPSEL | BONE_SELECTED);
@@ -1974,7 +1974,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b
                if (bone_only) {
                        CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones)
                        {
-                               if ((pchan->bone->flag & BONE_UNSELECTABLE) == 0) {
+                               if ((select == false) || ((pchan->bone->flag & BONE_UNSELECTABLE) == 0)) {
                                        pchan->bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
                                }
                        }
@@ -2622,7 +2622,7 @@ static void do_circle_select_armature__doSelectBone(void *userData, struct EditB
        CircleSelectUserData *data = userData;
        bArmature *arm = data->vc->obedit->data;
 
-       if (EBONE_SELECTABLE(arm, ebone)) {
+       if (data->select ? EBONE_SELECTABLE(arm, ebone) : EBONE_VISIBLE(arm, ebone)) {
                bool is_point_done = false;
                int points_proj_tot = 0;
 
index 70e01ef37181342795bf245f266e59fab316d4bc..130e11d45aaef109ea3695b30aa5513ca50e2875 100644 (file)
@@ -115,7 +115,7 @@ static TransformOrientation *createViewSpace(bContext *C, ReportList *UNUSED(rep
                View3D *v3d = CTX_wm_view3d(C);
                if (rv3d->persp == RV3D_CAMOB && v3d->camera) {
                        /* If an object is used as camera, then this space is the same as object space! */
-                       strncpy(name, v3d->camera->id.name + 2, MAX_NAME);
+                       BLI_strncpy(name, v3d->camera->id.name + 2, MAX_NAME);
                }
                else {
                        strcpy(name, "Custom View");
@@ -141,7 +141,7 @@ static TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(r
 
        /* use object name if no name is given */
        if (name[0] == 0) {
-               strncpy(name, ob->id.name + 2, MAX_ID_NAME - 2);
+               BLI_strncpy(name, ob->id.name + 2, MAX_ID_NAME - 2);
        }
 
        return addMatrixSpace(C, mat, name, overwrite);
@@ -306,7 +306,7 @@ TransformOrientation *addMatrixSpace(bContext *C, float mat[3][3], char name[],
        if (ts == NULL) {
                ts = MEM_callocN(sizeof(TransformOrientation), "UserTransSpace from matrix");
                BLI_addtail(transform_spaces, ts);
-               strncpy(ts->name, name, sizeof(ts->name));
+               BLI_strncpy(ts->name, name, sizeof(ts->name));
        }
 
        /* copy matrix into transform space */
index c10f201fb553cfee2711530d71f4669cf96f2df3..822f495d5bc70b66a7903c05b918aa870b9d4699 100644 (file)
@@ -918,25 +918,35 @@ static int getYUVtoRGBMatrix(float *matrix, LogImageElement logElement)
        }
 }
 
-static void getLinToLogLut(float *lut, LogImageFile *logImage, LogImageElement logElement)
+static float *getLinToLogLut(LogImageFile *logImage, LogImageElement logElement)
 {
+       float *lut;
        float gain, negativeFilmGamma, offset, step;
+       unsigned int lutsize = (unsigned int)(logElement.maxValue + 1);
        unsigned int i;
+       
+       lut = MEM_mallocN(sizeof(float) * lutsize, "getLinToLogLut");
 
        negativeFilmGamma = 0.6;
        step = logElement.refHighQuantity / logElement.maxValue;
        gain = logElement.maxValue / (1.0f - powf(10, (logImage->referenceBlack - logImage->referenceWhite) * step / negativeFilmGamma * logImage->gamma / 1.7f));
        offset = gain - logElement.maxValue;
 
-       for (i = 0; i < (int)(logElement.maxValue + 1); i++)
+       for (i = 0; i < lutsize; i++)
                lut[i] = (logImage->referenceWhite + log10f(powf((i + offset) / gain, 1.7f / logImage->gamma)) / (step / negativeFilmGamma)) / logElement.maxValue;
+       
+       return lut;
 }
 
-static void getLogToLinLut(float *lut, LogImageFile *logImage, LogImageElement logElement)
+static float *getLogToLinLut(LogImageFile *logImage, LogImageElement logElement)
 {
+       float *lut;
        float breakPoint, gain, kneeGain, kneeOffset, negativeFilmGamma, offset, step, softClip;
        /* float filmGamma; unused */
+       unsigned int lutsize = (unsigned int)(logElement.maxValue + 1);
        unsigned int i;
+       
+       lut = MEM_mallocN(sizeof(float) * lutsize, "getLogToLinLut");
 
        /* Building the Log -> Lin LUT */
        step = logElement.refHighQuantity / logElement.maxValue;
@@ -952,7 +962,7 @@ static void getLogToLinLut(float *lut, LogImageFile *logImage, LogImageElement l
        kneeOffset = powf(10, (breakPoint - logImage->referenceWhite) * step / negativeFilmGamma * logImage->gamma / 1.7f) * gain - offset;
        kneeGain = (logElement.maxValue - kneeOffset) / powf(5 * softClip, softClip / 100);
 
-       for (i = 0; i < (int)(logElement.maxValue + 1); i++) {
+       for (i = 0; i < lutsize; i++) {
                if (i < logImage->referenceBlack)
                        lut[i] = 0.0f;
                else if (i > breakPoint)
@@ -960,61 +970,76 @@ static void getLogToLinLut(float *lut, LogImageFile *logImage, LogImageElement l
                else
                        lut[i] = (powf(10, ((float)i - logImage->referenceWhite) * step / negativeFilmGamma * logImage->gamma / 1.7f) * gain - offset) / logElement.maxValue;
        }
+
+       return lut;
 }
 
-static void getLinToSrgbLut(float *lut, LogImageElement logElement)
+static float *getLinToSrgbLut(LogImageElement logElement)
 {
+       float col, *lut;
+       unsigned int lutsize = (unsigned int)(logElement.maxValue + 1);
        unsigned int i;
-       float col;
 
-       for (i = 0; i < (int)(logElement.maxValue + 1); i++) {
+       lut = MEM_mallocN(sizeof(float) * lutsize, "getLogToLinLut");
+
+       for (i = 0; i < lutsize; i++) {
                col = (float)i / logElement.maxValue;
                if (col < 0.0031308f)
                        lut[i] = (col < 0.0f) ? 0.0f : col * 12.92f;
                else
                        lut[i] = 1.055f * powf(col, 1.0f / 2.4f) - 0.055f;
        }
+
+       return lut;
 }
 
-static void getSrgbToLinLut(float *lut, LogImageElement logElement)
+static float *getSrgbToLinLut(LogImageElement logElement)
 {
+       float col, *lut;
+       unsigned int lutsize = (unsigned int)(logElement.maxValue + 1);
        unsigned int i;
-       float col;
 
-       for (i = 0; i < (int)(logElement.maxValue + 1); i++) {
+       lut = MEM_mallocN(sizeof(float) * lutsize, "getLogToLinLut");
+
+       for (i = 0; i < lutsize; i++) {
                col = (float)i / logElement.maxValue;
                if (col < 0.04045f)
                        lut[i] = (col < 0.0f) ? 0.0f : col * (1.0f / 12.92f);
                else
                        lut[i] = powf((col + 0.055f) * (1.0f / 1.055f), 2.4f);
        }
+
+       return lut;
 }
 
 static int convertRGBA_RGB(float *src, float *dst, LogImageFile *logImage,
                            LogImageElement logElement, int elementIsSource)
 {
        unsigned int i;
-       float lut[65536];
        float *src_ptr = src;
        float *dst_ptr = dst;
 
        switch (logElement.transfer) {
                case transfer_UserDefined:
                case transfer_Linear:
-               case transfer_Logarithmic:
+               case transfer_Logarithmic: {
                        for (i = 0; i < logImage->width * logImage->height; i++) {
                                *(dst_ptr++) = *(src_ptr++);
                                *(dst_ptr++) = *(src_ptr++);
                                *(dst_ptr++) = *(src_ptr++);
                                src_ptr++;
                        }
+
                        return 0;
+               }
+
+               case transfer_PrintingDensity: {
+                       float *lut;
 
-               case transfer_PrintingDensity:
                        if (elementIsSource == 1)
-                               getLogToLinLut((float *)&lut, logImage, logElement);
+                               lut = getLogToLinLut(logImage, logElement);
                        else
-                               getLinToLogLut((float *)&lut, logImage, logElement);
+                               lut = getLinToLogLut(logImage, logElement);
 
                        for (i = 0; i < logImage->width * logImage->height; i++) {
                                *(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
@@ -1022,7 +1047,11 @@ static int convertRGBA_RGB(float *src, float *dst, LogImageFile *logImage,
                                *(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
                                src_ptr++;
                        }
+
+                       MEM_freeN(lut);
+
                        return 0;
+               }
 
                default:
                        return 1;
@@ -1033,27 +1062,30 @@ static int convertRGB_RGBA(float *src, float *dst, LogImageFile *logImage,
                            LogImageElement logElement, int elementIsSource)
 {
        unsigned int i;
-       float lut[65536];
        float *src_ptr = src;
        float *dst_ptr = dst;
 
        switch (logElement.transfer) {
                case transfer_UserDefined:
                case transfer_Linear:
-               case transfer_Logarithmic:
+               case transfer_Logarithmic: {
                        for (i = 0; i < logImage->width * logImage->height; i++) {
                                *(dst_ptr++) = *(src_ptr++);
                                *(dst_ptr++) = *(src_ptr++);
                                *(dst_ptr++) = *(src_ptr++);
                                *(dst_ptr++) = 1.0f;
                        }
+
                        return 0;
+               }
+
+               case transfer_PrintingDensity: {
+                       float *lut;
 
-               case transfer_PrintingDensity:
                        if (elementIsSource == 1)
-                               getLogToLinLut((float *)&lut, logImage, logElement);
+                               lut = getLogToLinLut(logImage, logElement);
                        else
-                               getLinToLogLut((float *)&lut, logImage, logElement);
+                               lut = getLinToLogLut(logImage, logElement);
 
                        for (i = 0; i < logImage->width * logImage->height; i++) {
                                *(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
@@ -1061,7 +1093,11 @@ static int convertRGB_RGBA(float *src, float *dst, LogImageFile *logImage,
                                *(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
                                *(dst_ptr++) = 1.0f;
                        }
+
+                       MEM_freeN(lut);
+
                        return 0;
+               }
 
                default:
                        return 1;
@@ -1072,22 +1108,24 @@ static int convertRGBA_RGBA(float *src, float *dst, LogImageFile *logImage,
                             LogImageElement logElement, int elementIsSource)
 {
        unsigned int i;
-       float lut[65536];
        float *src_ptr = src;
        float *dst_ptr = dst;
 
        switch (logElement.transfer) {
                case transfer_UserDefined:
                case transfer_Linear:
-               case transfer_Logarithmic:
+               case transfer_Logarithmic: {
                        memcpy(dst, src, 4 * logImage->width * logImage->height * sizeof(float));
                        return 0;
+               }
+
+               case transfer_PrintingDensity: {
+                       float *lut;
 
-               case transfer_PrintingDensity:
                        if (elementIsSource == 1)
-                               getLogToLinLut((float *)&lut, logImage, logElement);
+                               lut = getLogToLinLut(logImage, logElement);
                        else
-                               getLinToLogLut((float *)&lut, logImage, logElement);
+                               lut = getLinToLogLut(logImage, logElement);
 
                        for (i = 0; i < logImage->width * logImage->height; i++) {
                                *(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
@@ -1095,7 +1133,11 @@ static int convertRGBA_RGBA(float *src, float *dst, LogImageFile *logImage,
                                *(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
                                *(dst_ptr++) = *(src_ptr++);
                        }
+
+                       MEM_freeN(lut);
+
                        return 0;
+               }
 
                default:
                        return 1;
@@ -1106,14 +1148,13 @@ static int convertABGR_RGBA(float *src, float *dst, LogImageFile *logImage,
                             LogImageElement logElement, int elementIsSource)
 {
        unsigned int i;
-       float lut[65536];
        float *src_ptr = src;
        float *dst_ptr = dst;
 
        switch (logElement.transfer) {
                case transfer_UserDefined:
                case transfer_Linear:
-               case transfer_Logarithmic:
+               case transfer_Logarithmic: {
                        for (i = 0; i < logImage->width * logImage->height; i++) {
                                src_ptr += 4;
                                *(dst_ptr++) = *(src_ptr--);
@@ -1123,12 +1164,15 @@ static int convertABGR_RGBA(float *src, float *dst, LogImageFile *logImage,
                                src_ptr += 4;
                        }
                        return 0;
+               }
+
+               case transfer_PrintingDensity: {
+                       float *lut;
 
-               case transfer_PrintingDensity:
                        if (elementIsSource == 1)
-                               getLogToLinLut((float *)&lut, logImage, logElement);
+                               lut = getLogToLinLut(logImage, logElement);
                        else
-                               getLinToLogLut((float *)&lut, logImage, logElement);
+                               lut = getLinToLogLut(logImage, logElement);
 
                        for (i = 0; i < logImage->width * logImage->height; i++) {
                                src_ptr += 4;
@@ -1138,7 +1182,11 @@ static int convertABGR_RGBA(float *src, float *dst, LogImageFile *logImage,
                                *(dst_ptr++) = *(src_ptr--);
                                src_ptr += 4;
                        }
+
+                       MEM_freeN(lut);
+
                        return 0;
+               }
 
                default:
                        return 1;
@@ -1309,7 +1357,6 @@ static int convertLogElementToRGBA(float *src, float *dst, LogImageFile *logImag
        unsigned int i;
        float *src_ptr;
        float *dst_ptr;
-       float lut[65536];
 
        /* Convert data in src to linear RGBA in dst */
        switch (logElement.descriptor) {
@@ -1357,7 +1404,7 @@ static int convertLogElementToRGBA(float *src, float *dst, LogImageFile *logImag
                return 1;
        else if (dstIsLinearRGB) {
                /* convert data from sRGB to Linear RGB via lut */
-               getSrgbToLinLut((float *)&lut, logElement);
+               float *lut = getSrgbToLinLut(logElement);
                src_ptr = dst; // no error here
                dst_ptr = dst;
                for (i = 0; i < logImage->width * logImage->height; i++) {
@@ -1366,6 +1413,7 @@ static int convertLogElementToRGBA(float *src, float *dst, LogImageFile *logImag
                        *(dst_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
                        dst_ptr++; src_ptr++;
                }
+               MEM_freeN(lut);
        }
        return 0;
 }
@@ -1378,7 +1426,7 @@ static int convertRGBAToLogElement(float *src, float *dst, LogImageFile *logImag
        float *srgbSrc;
        float *srgbSrc_ptr;
        float *src_ptr = src;
-       float lut[65536];
+       float *lut;
 
        if (srcIsLinearRGB != 0) {
                /* we need to convert src to sRGB */
@@ -1390,13 +1438,14 @@ static int convertRGBAToLogElement(float *src, float *dst, LogImageFile *logImag
                srgbSrc_ptr = srgbSrc;
 
                /* convert data from Linear RGB to sRGB via lut */
-               getLinToSrgbLut((float *)&lut, logElement);
+               lut = getLinToSrgbLut(logElement);
                for (i = 0; i < logImage->width * logImage->height; i++) {
                        *(srgbSrc_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
                        *(srgbSrc_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
                        *(srgbSrc_ptr++) = lut[float_uint(*(src_ptr++), logElement.maxValue)];
                        srgbSrc_ptr++; src_ptr++;
                }
+               MEM_freeN(lut);
        }
        else
                srgbSrc = src;
index 964fa11b0a24a0344d999cf52a894fb17e91e349..7ff8667f90eb5b58caa7a972decbc841a6d01cd5 100644 (file)
@@ -75,6 +75,7 @@ typedef struct BevList {
        struct BevList *next, *prev;
        int nr, dupe_nr;
        int poly, hole;
+       int charidx;
 } BevList;
 
 /* These two Lines with # tell makesdna this struct can be excluded. */
index 9686d7fab51785030bd4a0a74136fc1d9e0cff3b..faf348302e4ac5bb936b2c041a7466604ecc9fe0 100644 (file)
@@ -1256,7 +1256,7 @@ static char *rna_def_property_lookup_string_func(FILE *f, StructRNA *srna, Prope
        fprintf(f, "    extern int %s_%s_length(PointerRNA *);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
        fprintf(f, "    extern void %s_%s_get(PointerRNA *, char *);\n\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
 
-       fprintf(f, "    int found= 0;\n");
+       fprintf(f, "    bool found = false;\n");
        fprintf(f, "    CollectionPropertyIterator iter;\n");
        fprintf(f, "    char namebuf[%d];\n", namebuflen);
        fprintf(f, "    char *name;\n\n");
@@ -1264,26 +1264,29 @@ static char *rna_def_property_lookup_string_func(FILE *f, StructRNA *srna, Prope
        fprintf(f, "    %s_%s_begin(&iter, ptr);\n\n", srna->identifier, rna_safe_id(prop->identifier));
 
        fprintf(f, "    while (iter.valid) {\n");
-       fprintf(f, "            int namelen = %s_%s_length(&iter.ptr);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
-       fprintf(f, "            if (namelen < %d) {\n", namebuflen);
-       fprintf(f, "                    %s_%s_get(&iter.ptr, namebuf);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
-       fprintf(f, "                    if (strcmp(namebuf, key) == 0) {\n");
-       fprintf(f, "                            found = 1;\n");
-       fprintf(f, "                            *r_ptr = iter.ptr;\n");
-       fprintf(f, "                            break;\n");
+       fprintf(f, "            if (iter.ptr.data) {\n");
+       fprintf(f, "                    int namelen = %s_%s_length(&iter.ptr);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
+       fprintf(f, "                    if (namelen < %d) {\n", namebuflen);
+       fprintf(f, "                            %s_%s_get(&iter.ptr, namebuf);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
+       fprintf(f, "                            if (strcmp(namebuf, key) == 0) {\n");
+       fprintf(f, "                                    found = true;\n");
+       fprintf(f, "                                    *r_ptr = iter.ptr;\n");
+       fprintf(f, "                                    break;\n");
+       fprintf(f, "                            }\n");
        fprintf(f, "                    }\n");
-       fprintf(f, "            }\n");
-       fprintf(f, "            else {\n");
-       fprintf(f, "                    name = MEM_mallocN(namelen+1, \"name string\");\n");
-       fprintf(f, "                    %s_%s_get(&iter.ptr, name);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
-       fprintf(f, "                    if (strcmp(name, key) == 0) {\n");
-       fprintf(f, "                            MEM_freeN(name);\n\n");
-       fprintf(f, "                            found = 1;\n");
-       fprintf(f, "                            *r_ptr = iter.ptr;\n");
-       fprintf(f, "                            break;\n");
+       fprintf(f, "                    else {\n");
+       fprintf(f, "                            name = MEM_mallocN(namelen+1, \"name string\");\n");
+       fprintf(f, "                            %s_%s_get(&iter.ptr, name);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
+       fprintf(f, "                            if (strcmp(name, key) == 0) {\n");
+       fprintf(f, "                                    MEM_freeN(name);\n\n");
+       fprintf(f, "                                    found = true;\n");
+       fprintf(f, "                                    *r_ptr = iter.ptr;\n");
+       fprintf(f, "                                    break;\n");
+       fprintf(f, "                            }\n");
+       fprintf(f, "                            else {\n");
+       fprintf(f, "                                    MEM_freeN(name);\n");
+       fprintf(f, "                            }\n");
        fprintf(f, "                    }\n");
-       fprintf(f, "                    else\n");
-       fprintf(f, "                            MEM_freeN(name);\n");
        fprintf(f, "            }\n");
        fprintf(f, "            %s_%s_next(&iter);\n", srna->identifier, rna_safe_id(prop->identifier));
        fprintf(f, "    }\n");
index 900ae5122ef461367efbb538f59c9d0099c8c89f..fb16dd0c5a1c5633ffb4cd512b3ea54be7251b1a 100644 (file)
@@ -107,7 +107,7 @@ static void rna_DynamicPaintSurfaces_updateFrames(Main *bmain, Scene *scene, Poi
 
 static void rna_DynamicPaintSurface_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
-       dynamicPaint_resetSurface((DynamicPaintSurface *)ptr->data);
+       dynamicPaint_resetSurface(scene, (DynamicPaintSurface *)ptr->data);
        rna_DynamicPaint_redoModifier(bmain, scene, ptr);
 }
 
@@ -116,7 +116,7 @@ static void rna_DynamicPaintSurface_initialcolortype(Main *bmain, Scene *scene,
        DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data;
 
        surface->init_layername[0] = '\0';
-       dynamicPaint_clearSurface(surface);
+       dynamicPaint_clearSurface(scene, surface);
        rna_DynamicPaint_redoModifier(bmain, scene, ptr);
 }
 
@@ -143,7 +143,7 @@ static void rna_DynamicPaintSurface_uniqueName(Main *bmain, Scene *scene, Pointe
 static void rna_DynamicPaintSurface_changeType(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
        dynamicPaintSurface_updateType((DynamicPaintSurface *)ptr->data);
-       dynamicPaint_resetSurface((DynamicPaintSurface *)ptr->data);
+       dynamicPaint_resetSurface(scene, (DynamicPaintSurface *)ptr->data);
        rna_DynamicPaintSurface_reset(bmain, scene, ptr);
 }
 
index 4c652770e3f89a5a9ea685f51b6efaffbebe9749..fd9312629040ad9a405b995c3e78de99dcdf92ca 100644 (file)
@@ -335,6 +335,8 @@ Mesh *rna_Main_meshes_new_from_object(
                                return NULL;
                        }
 
+                       BKE_mesh_texspace_copy_from_object(tmpmesh, ob);
+
                        BKE_libblock_free_us(&bmain->object, tmpobj);
                        break;
                }
@@ -362,6 +364,8 @@ Mesh *rna_Main_meshes_new_from_object(
                        else
                                BKE_mesh_from_metaball(&ob->disp, tmpmesh);
 
+                       BKE_mesh_texspace_copy_from_object(tmpmesh, ob);
+
                        break;
 
                }
index 10ac5a9548a7907209205a1967721f962be4865d..132faacbaac7d0544c2282e5ebe6178c997f6d98 100644 (file)
@@ -72,7 +72,9 @@ static void clear_envmap(struct EnvMap *env, bContext *C)
 static void texture_evaluate(struct Tex *tex, float value[3], float color_r[4])
 {
        TexResult texres = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
-       multitex_ext(tex, value, NULL, NULL, 1, &texres, NULL);
+
+       /* TODO(sergey): always use color management now.  */
+       multitex_ext(tex, value, NULL, NULL, 1, &texres, NULL, true);
 
        color_r[0] = texres.tr;
        color_r[1] = texres.tg;
index 5805bcefdb4e8ad1d165c3b90679314d36dd9a37..c822378e76ef1330c47ebbf2bc0fd089b02b28f1 100644 (file)
@@ -333,17 +333,23 @@ void RNA_api_wm(StructRNA *srna)
 
        /* Progress bar interface */
        func = RNA_def_function(srna, "progress_begin", "rna_progress_begin");
+       RNA_def_function_ui_description(func, "Start Progress bar");
+
        parm = RNA_def_property(func, "min", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_ui_text(parm, "min", "any value in range [0,9999]");
        RNA_def_property_flag(parm, PROP_REQUIRED);
+
        parm = RNA_def_property(func, "max", PROP_FLOAT, PROP_NONE);
        RNA_def_property_flag(parm, PROP_REQUIRED);
+       RNA_def_property_ui_text(parm, "max", "any value in range [min+1,9998]");
 
        func = RNA_def_function(srna, "progress_update", "rna_progress_update");
        parm = RNA_def_property(func, "value", PROP_FLOAT, PROP_NONE);
        RNA_def_property_flag(parm, PROP_REQUIRED);
-       RNA_def_property_ui_text(parm, "value", "any value between min and max as set in progress_init()");
+       RNA_def_property_ui_text(parm, "value", "any value between min and max as set in progress_begin()");
 
        func = RNA_def_function(srna, "progress_end", "rna_progress_end");
+       RNA_def_function_ui_description(func, "Terminate Progress bar");
 
        /* invoke functions, for use with python */
        func = RNA_def_function(srna, "invoke_props_popup", "rna_Operator_props_popup");
index 05d00ca5375935a7da1e63884f792a8f13a686d4..05b51c2cf4bb3feca85e7d73bf6bb6b69337653d 100644 (file)
@@ -453,7 +453,7 @@ static void deformVerts(ModifierData *md, Object *ob,
        DerivedMesh *dm = NULL;
        CastModifierData *cmd = (CastModifierData *)md;
 
-       dm = get_dm(ob, NULL, derivedData, NULL, 0);
+       dm = get_dm(ob, NULL, derivedData, NULL, false, false);
 
        if (cmd->type == MOD_CAST_TYPE_CUBOID) {
                cuboid_do(cmd, ob, dm, vertexCos, numVerts);
@@ -470,7 +470,7 @@ static void deformVertsEM(
         ModifierData *md, Object *ob, struct BMEditMesh *editData,
         DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
 {
-       DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, 0);
+       DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, false, false);
        CastModifierData *cmd = (CastModifierData *)md;
 
        if (cmd->type == MOD_CAST_TYPE_CUBOID) {
index 33e0456d492d147fa7fd3495a1af74608a271b56..ec3212d4cbb57b0cf45820d39b84b2d8d5c9055d 100644 (file)
@@ -82,7 +82,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
                        return;
        }
 
-       dm = get_dm(ob, NULL, derivedData, NULL, 0);
+       dm = get_dm(ob, NULL, derivedData, NULL, false, false);
        if (dm == derivedData)
                dm = CDDM_copy(dm);
 
index ffd202736a936924b9f7c655470ec7a40dc94c9e..25254c7a30e7f8d82f352ef3d3def987e03bcb58 100644 (file)
@@ -219,7 +219,7 @@ static void displaceModifier_do(
 
                if (dmd->texture) {
                        texres.nor = NULL;
-                       get_texture_value(dmd->texture, tex_co[i], &texres);
+                       get_texture_value(dmd->modifier.scene, dmd->texture, tex_co[i], &texres, false);
                        delta = texres.tin - dmd->midlevel;
                }
                else {
@@ -265,7 +265,7 @@ static void deformVerts(ModifierData *md, Object *ob,
                         int numVerts,
                         ModifierApplyFlag UNUSED(flag))
 {
-       DerivedMesh *dm = get_cddm(ob, NULL, derivedData, vertexCos);
+       DerivedMesh *dm = get_cddm(ob, NULL, derivedData, vertexCos, dependsOnNormals(md));
 
        displaceModifier_do((DisplaceModifierData *)md, ob, dm,
                            vertexCos, numVerts);
@@ -278,7 +278,7 @@ static void deformVertsEM(
         ModifierData *md, Object *ob, struct BMEditMesh *editData,
         DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
 {
-       DerivedMesh *dm = get_cddm(ob, editData, derivedData, vertexCos);
+       DerivedMesh *dm = get_cddm(ob, editData, derivedData, vertexCos, dependsOnNormals(md));
 
        displaceModifier_do((DisplaceModifierData *)md, ob, dm,
                            vertexCos, numVerts);
index b4193a0a3698a0293ff1100f68154555d58f9bd6..4e8af650cb2f93d66170da7e0e1729162cbe6aff 100644 (file)
@@ -252,7 +252,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
        DerivedMesh *dm = derivedData;
        /* We need a valid dm for meshes when a vgroup is set... */
        if (!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
-               dm = get_dm(ob, NULL, dm, NULL, 0);
+               dm = get_dm(ob, NULL, dm, NULL, false, false);
 
        deformVerts_do(hmd, ob, dm, vertexCos, numVerts);
 
@@ -267,7 +267,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editD
        DerivedMesh *dm = derivedData;
        /* We need a valid dm for meshes when a vgroup is set... */
        if (!dm && ob->type == OB_MESH && hmd->name[0] != '\0')
-               dm = get_dm(ob, editData, dm, NULL, 0);
+               dm = get_dm(ob, editData, dm, NULL, false, false);
 
        deformVerts_do(hmd, ob, dm, vertexCos, numVerts);
 
index cf9ab8d5ec2b72f4477ab5c27eff07e5a841ba30..1abe1e97a23a92ee12a403a38fac25ca441ceb9e 100644 (file)
@@ -669,7 +669,7 @@ static void laplaciansmoothModifier_do(
 static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
                         float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag))
 {
-       DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, 0);
+       DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false);
 
        laplaciansmoothModifier_do((LaplacianSmoothModifierData *)md, ob, dm,
                                   vertexCos, numVerts);
@@ -682,7 +682,7 @@ static void deformVertsEM(
         ModifierData *md, Object *ob, struct BMEditMesh *editData,
         DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
 {
-       DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, 0);
+       DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, false, false);
 
        laplaciansmoothModifier_do((LaplacianSmoothModifierData *)md, ob, dm,
                                   vertexCos, numVerts);
index b6f8dede42f6f7edfa0312d48fd907f45670af99..8386f0ff9af70ced49b7502a15465354e7aecd07 100644 (file)
@@ -212,7 +212,7 @@ static void meshdeformModifier_do(
        /* if we don't have one computed, use derivedmesh from data
         * without any modifiers */
        if (!cagedm) {
-               cagedm = get_dm(mmd->object, NULL, NULL, NULL, 0);
+               cagedm = get_dm(mmd->object, NULL, NULL, NULL, false, false);
                if (cagedm)
                        cagedm->needsFree = 1;
        }
@@ -343,7 +343,7 @@ static void deformVerts(ModifierData *md, Object *ob,
                         int numVerts,
                         ModifierApplyFlag UNUSED(flag))
 {
-       DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, 0);
+       DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false);
 
        modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
        
@@ -359,7 +359,7 @@ static void deformVertsEM(ModifierData *md, Object *ob,
                           float (*vertexCos)[3],
                           int numVerts)
 {
-       DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, 0);
+       DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false);
 
        meshdeformModifier_do(md, ob, dm, vertexCos, numVerts);
 
index cd2ef5957cd3822213311d0e92c53d987d829d32..327ae5771086e20b68410dd4b25f8b1456599f07 100644 (file)
@@ -142,7 +142,7 @@ static void deformVerts(ModifierData *md, Object *ob,
                return;
 
        if (dm == NULL) {
-               dm = get_dm(ob, NULL, NULL, vertexCos, 1);
+               dm = get_dm(ob, NULL, NULL, vertexCos, false, true);
 
                if (!dm)
                        return;
index 9addcdc6ee16944d348ed53234c6e5861e2cec9b..e06c4f22553c179a66cd2e6ec639e58cf336ad68 100644 (file)
@@ -48,6 +48,8 @@
 
 #include "MOD_util.h"
 
+static bool dependsOnNormals(ModifierData *md);
+
 
 static void initData(ModifierData *md)
 {
@@ -120,8 +122,9 @@ static void deformVerts(ModifierData *md, Object *ob,
        CustomDataMask dataMask = requiredDataMask(ob, md);
 
        /* ensure we get a CDDM with applied vertex coords */
-       if (dataMask)
-               dm = get_cddm(ob, NULL, dm, vertexCos);
+       if (dataMask) {
+               dm = get_cddm(ob, NULL, dm, vertexCos, dependsOnNormals(md));
+       }
 
        shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ob, dm, vertexCos, numVerts);
 
@@ -136,8 +139,9 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editD
        CustomDataMask dataMask = requiredDataMask(ob, md);
 
        /* ensure we get a CDDM with applied vertex coords */
-       if (dataMask)
-               dm = get_cddm(ob, editData, dm, vertexCos);
+       if (dataMask) {
+               dm = get_cddm(ob, editData, dm, vertexCos, dependsOnNormals(md));
+       }
 
        shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ob, dm, vertexCos, numVerts);
 
index 5267c0d9ccb3a557d20d6fbc3b1fd82716a2f17e..588c98c98277ee92bb7c9b73236fdf94417dacc3 100644 (file)
@@ -317,7 +317,7 @@ static void deformVerts(ModifierData *md, Object *ob,
        /* we implement requiredDataMask but thats not really useful since
         * mesh_calc_modifiers pass a NULL derivedData */
        if (dataMask)
-               dm = get_dm(ob, NULL, dm, NULL, 0);
+               dm = get_dm(ob, NULL, dm, NULL, false, false);
 
        SimpleDeformModifier_do((SimpleDeformModifierData *)md, ob, dm, vertexCos, numVerts);
 
@@ -337,7 +337,7 @@ static void deformVertsEM(ModifierData *md, Object *ob,
        /* we implement requiredDataMask but thats not really useful since
         * mesh_calc_modifiers pass a NULL derivedData */
        if (dataMask)
-               dm = get_dm(ob, editData, dm, NULL, 0);
+               dm = get_dm(ob, editData, dm, NULL, false, false);
 
        SimpleDeformModifier_do((SimpleDeformModifierData *)md, ob, dm, vertexCos, numVerts);
 
index 6c2bd25f0a54a9d4ecff77f7d2a2fe12834fc5a5..daf0e5c9dc34113decba4def9b0ffd5e9de3f5a4 100644 (file)
@@ -237,7 +237,7 @@ static int build_hull(SkinOutput *so, Frame **frames, int totframe)
 
        /* Deselect all faces so that only new hull output faces are
         * selected after the operator is run */
-       BM_mesh_elem_hflag_disable_all(bm, BM_ALL, BM_ELEM_SELECT, 0);
+       BM_mesh_elem_hflag_disable_all(bm, BM_ALL_NOLOOP, BM_ELEM_SELECT, false);
 
        BMO_op_initf(bm, &op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
                     "convex_hull input=%hv", BM_ELEM_TAG);
@@ -288,7 +288,7 @@ static int build_hull(SkinOutput *so, Frame **frames, int totframe)
        
        /* Remove triangles that would fill the original frames -- skip if
         * frame is partially detached */
-       BM_mesh_elem_hflag_disable_all(bm, BM_ALL, BM_ELEM_TAG, FALSE);
+       BM_mesh_elem_hflag_disable_all(bm, BM_ALL_NOLOOP, BM_ELEM_TAG, false);
        for (i = 0; i < totframe; i++) {
                Frame *frame = frames[i];
                if (!frame->detached) {
index 0da122b0d0f017e0d70aef9eb78f8703450fbb34..96d7d5956c5badf2e02a363d702f9e7fd03f9315 100644 (file)
@@ -221,7 +221,7 @@ static void smoothModifier_do(
 static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
                         float (*vertexCos)[3], int numVerts, ModifierApplyFlag UNUSED(flag))
 {
-       DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, 0);
+       DerivedMesh *dm = get_dm(ob, NULL, derivedData, NULL, false, false);
 
        smoothModifier_do((SmoothModifierData *)md, ob, dm,
                          vertexCos, numVerts);
@@ -234,7 +234,7 @@ static void deformVertsEM(
         ModifierData *md, Object *ob, struct BMEditMesh *editData,
         DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts)
 {
-       DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, 0);
+       DerivedMesh *dm = get_dm(ob, editData, derivedData, NULL, false, false);
 
        smoothModifier_do((SmoothModifierData *)md, ob, dm,
                          vertexCos, numVerts);
index 78ac029d726a37ad1d9f7e4fb0fd3b56e78b3a64..1c462f12f9f25ecce682f30e3b9f5d741cca56fb 100644 (file)
@@ -98,7 +98,7 @@ static void deformVerts(ModifierData *md, Object *ob,
 
        /* if possible use/create DerivedMesh */
        if (derivedData) surmd->dm = CDDM_copy(derivedData);
-       else surmd->dm = get_dm(ob, NULL, NULL, NULL, 0);
+       else surmd->dm = get_dm(ob, NULL, NULL, NULL, false, false);
        
        if (!ob->pd) {
                printf("SurfaceModifier deformVerts: Should not happen!\n");
index c3748ce026531735d723fbb90ad61c1eee42464b..230931a1a337ed225d7495fb833dcce78f1ef81c 100644 (file)
@@ -50,6 +50,7 @@
 #include "BKE_lattice.h"
 #include "BKE_mesh.h"
 #include "BKE_displist.h"
+#include "BKE_scene.h"
 
 #include "BKE_modifier.h"
 
@@ -69,12 +70,17 @@ void modifier_init_texture(Scene *scene, Tex *tex)
                BKE_image_user_frame_calc(&tex->iuser, scene->r.cfra, 0);
 }
 
-void get_texture_value(Tex *texture, float *tex_co, TexResult *texres)
+void get_texture_value(Scene *scene, Tex *texture, float *tex_co, TexResult *texres, bool use_color_management)
 {
        int result_type;
+       bool do_color_manage = false;
+
+       if (use_color_management) {
+               do_color_manage = BKE_scene_check_color_management_enabled(scene);
+       }
 
        /* no node textures for now */
-       result_type = multitex_ext_safe(texture, tex_co, texres, NULL);
+       result_type = multitex_ext_safe(texture, tex_co, texres, NULL, do_color_manage);
 
        /* if the texture gave an RGB value, we assume it didn't give a valid
         * intensity, since this is in the context of modifiers don't use perceptual color conversion.
@@ -173,30 +179,33 @@ void modifier_vgroup_cache(ModifierData *md, float (*vertexCos)[3])
 }
 
 /* returns a cdderivedmesh if dm == NULL or is another type of derivedmesh */
-DerivedMesh *get_cddm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (*vertexCos)[3])
+DerivedMesh *get_cddm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (*vertexCos)[3], bool use_normals)
 {
-       if (dm && dm->type == DM_TYPE_CDDM)
-               return dm;
+       if (dm) {
+               if (dm->type != DM_TYPE_CDDM) {
+                       dm = CDDM_copy(dm);
+                       CDDM_apply_vert_coords(dm, vertexCos);
+               }
 
-       if (!dm) {
-               dm = get_dm(ob, em, dm, vertexCos, 0);
+               if (use_normals) {
+                       DM_ensure_normals(dm);
+               }
        }
        else {
-               dm = CDDM_copy(dm);
-               CDDM_apply_vert_coords(dm, vertexCos);
-               dm->dirty |= DM_DIRTY_NORMALS;
+               dm = get_dm(ob, em, dm, vertexCos, use_normals, false);
        }
 
        return dm;
 }
 
 /* returns a derived mesh if dm == NULL, for deforming modifiers that need it */
-DerivedMesh *get_dm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (*vertexCos)[3], int orco)
+DerivedMesh *get_dm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm,
+                    float (*vertexCos)[3], bool use_normals, bool use_orco)
 {
-       if (dm)
-               return dm;
-
-       if (ob->type == OB_MESH) {
+       if (dm) {
+               /* pass */
+       }
+       else if (ob->type == OB_MESH) {
                if (em) dm = CDDM_from_editbmesh(em, FALSE, FALSE);
                else dm = CDDM_from_mesh((struct Mesh *)(ob->data), ob);
 
@@ -205,13 +214,20 @@ DerivedMesh *get_dm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float (*
                        dm->dirty |= DM_DIRTY_NORMALS;
                }
                
-               if (orco)
+               if (use_orco) {
                        DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, BKE_mesh_orco_verts_get(ob));
+               }
        }
        else if (ELEM3(ob->type, OB_FONT, OB_CURVE, OB_SURF)) {
                dm = CDDM_from_curve(ob);
        }
 
+       if (use_normals) {
+               if (LIKELY(dm)) {
+                       DM_ensure_normals(dm);
+               }
+       }
+
        return dm;
 }
 
index 6f05c9a957a488fba7c803a21565c08f6210797b..25632eb5b80e903dd04217db5b08fcdf04122bcc 100644 (file)
@@ -41,14 +41,14 @@ struct Tex;
 struct TexResult;
 
 void modifier_init_texture(struct Scene *scene, struct Tex *texture);
-void get_texture_value(struct Tex *texture, float *tex_co, struct TexResult *texres);
+void get_texture_value(struct Scene *scene, struct Tex *texture, float *tex_co, struct TexResult *texres, bool do_color_manage);
 void get_texture_coords(struct MappingInfoModifierData *dmd, struct Object *ob, struct DerivedMesh *dm,
                         float (*co)[3], float (*texco)[3], int numVerts);
 void modifier_vgroup_cache(struct ModifierData *md, float (*vertexCos)[3]);
 struct DerivedMesh *get_cddm(struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm,
-                             float (*vertexCos)[3]);
+                             float (*vertexCos)[3], bool use_normals);
 struct DerivedMesh *get_dm(struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm,
-                           float (*vertexCos)[3], int orco);
+                           float (*vertexCos)[3], bool use_normals, bool use_orco);
 void modifier_get_vgroup(struct Object *ob, struct DerivedMesh *dm,
                          const char *name, struct MDeformVert **dvert, int *defgrp_index);
 
index cba1880491c1acfcf4ade5bf25cbd681f66caefd..3429acdcea447d726b79f401ccfb1fc3b34b64c5 100644 (file)
@@ -282,7 +282,7 @@ static void warpModifier_do(WarpModifierData *wmd, Object *ob,
                        if (tex_co) {
                                TexResult texres;
                                texres.nor = NULL;
-                               get_texture_value(wmd->texture, tex_co[i], &texres);
+                               get_texture_value(wmd->modifier.scene, wmd->texture, tex_co[i], &texres, false);
                                fac *= texres.tin;
                        }
 
@@ -327,7 +327,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
        int use_dm = warp_needs_dm((WarpModifierData *)md);
 
        if (use_dm) {
-               dm = get_cddm(ob, NULL, derivedData, vertexCos);
+               dm = get_cddm(ob, NULL, derivedData, vertexCos, false);
        }
 
        warpModifier_do((WarpModifierData *)md, ob, dm, vertexCos, numVerts);
index 8c6c483472edf2f0f1c6f8e089a12d41fd0714bd..43dc1ba4eb96a3aa0c7613fb4e300539d76729b9 100644 (file)
@@ -306,7 +306,7 @@ static void waveModifier_do(WaveModifierData *md,
                                if (wmd->texture) {
                                        TexResult texres;
                                        texres.nor = NULL;
-                                       get_texture_value(wmd->texture, tex_co[i], &texres);
+                                       get_texture_value(wmd->modifier.scene, wmd->texture, tex_co[i], &texres, false);
                                        amplit *= texres.tin;
                                }
 
@@ -346,9 +346,9 @@ static void deformVerts(ModifierData *md, Object *ob,
        WaveModifierData *wmd = (WaveModifierData *)md;
 
        if (wmd->flag & MOD_WAVE_NORM)
-               dm = get_cddm(ob, NULL, dm, vertexCos);
+               dm = get_cddm(ob, NULL, dm, vertexCos, false);
        else if (wmd->texture || wmd->defgrp_name[0])
-               dm = get_dm(ob, NULL, dm, NULL, 0);
+               dm = get_dm(ob, NULL, dm, NULL, false, false);
 
        waveModifier_do(wmd, md->scene, ob, dm, vertexCos, numVerts);
 
@@ -364,9 +364,9 @@ static void deformVertsEM(
        WaveModifierData *wmd = (WaveModifierData *)md;
 
        if (wmd->flag & MOD_WAVE_NORM)
-               dm = get_cddm(ob, editData, dm, vertexCos);
+               dm = get_cddm(ob, editData, dm, vertexCos, false);
        else if (wmd->texture || wmd->defgrp_name[0])
-               dm = get_dm(ob, editData, dm, NULL, 0);
+               dm = get_dm(ob, editData, dm, NULL, false, false);
 
        waveModifier_do(wmd, md->scene, ob, dm, vertexCos, numVerts);
 
index a5e63a7832fb8f62f9f1ab1b92ba50489f387c86..8ad9e26f78831e655f99f067d01b84d79d23cf49 100644 (file)
@@ -158,9 +158,12 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne
                        int idx = indices ? indices[i] : i;
                        TexResult texres;
                        float hsv[3]; /* For HSV color space. */
+                       bool do_color_manage;
+
+                       do_color_manage = tex_use_channel != MOD_WVG_MASK_TEX_USE_INT;
 
                        texres.nor = NULL;
-                       get_texture_value(texture, tex_co[idx], &texres);
+                       get_texture_value(scene, texture, tex_co[idx], &texres, do_color_manage);
                        /* Get the good channel value... */
                        switch (tex_use_channel) {
                                case MOD_WVG_MASK_TEX_USE_INT:
index d686de215177196b38bcbdff7ee9153d7eae263e..19ddfb7a13d5c080984799ffbd0185b3eb2f8a5a 100644 (file)
@@ -196,12 +196,13 @@ struct ImBuf;
 struct ImagePool;
 
 /* this one uses nodes */
-int    multitex_ext(struct Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, struct TexResult *texres, struct ImagePool *pool);
+int    multitex_ext(struct Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, struct TexResult *texres, struct ImagePool *pool, bool scene_color_manage);
 /* nodes disabled */
-int multitex_ext_safe(struct Tex *tex, float texvec[3], struct TexResult *texres, struct ImagePool *pool);
+int multitex_ext_safe(struct Tex *tex, float texvec[3], struct TexResult *texres, struct ImagePool *pool, bool scene_color_manage);
 /* only for internal node usage */
 int multitex_nodes(struct Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, struct TexResult *texres,
-                   const short thread, short which_output, struct ShadeInput *shi, struct MTex *mtex, struct ImagePool *pool);
+                   const short thread, short which_output, struct ShadeInput *shi, struct MTex *mtex,
+                   struct ImagePool *pool);
 
 /* shaded view and bake */
 struct Render;
index ee722ee426c22a7fd9b4a7bd12fa749068740de4..ad923a4172cb1b2cfec974278112b40922b7d54b 100644 (file)
@@ -1212,9 +1212,9 @@ static int multitex(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int o
        return retval;
 }
 
-/* this is called from the shader and texture nodes */
-int multitex_nodes(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres,
-                   const short thread, short which_output, ShadeInput *shi, MTex *mtex, struct ImagePool *pool)
+static int multitex_nodes_intern(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres,
+                                 const short thread, short which_output, ShadeInput *shi, MTex *mtex, struct ImagePool *pool,
+                                 bool scene_color_manage)
 {
        if (tex==NULL) {
                memset(texres, 0, sizeof(TexResult));
@@ -1236,7 +1236,7 @@ int multitex_nodes(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int os
                                ImBuf *ibuf = BKE_image_pool_acquire_ibuf(tex->ima, &tex->iuser, pool);
                                
                                /* don't linearize float buffers, assumed to be linear */
-                               if (ibuf && !(ibuf->rect_float) && R.scene_color_manage)
+                               if (ibuf && !(ibuf->rect_float) && scene_color_manage)
                                        IMB_colormanagement_colorspace_to_scene_linear_v3(&texres->tr, ibuf->rect_colorspace);
 
                                BKE_image_pool_release_ibuf(tex->ima, ibuf, pool);
@@ -1269,7 +1269,7 @@ int multitex_nodes(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int os
                                ImBuf *ibuf = BKE_image_pool_acquire_ibuf(tex->ima, &tex->iuser, pool);
 
                                /* don't linearize float buffers, assumed to be linear */
-                               if (ibuf && !(ibuf->rect_float) && R.scene_color_manage)
+                               if (ibuf && !(ibuf->rect_float) && scene_color_manage)
                                        IMB_colormanagement_colorspace_to_scene_linear_v3(&texres->tr, ibuf->rect_colorspace);
 
                                BKE_image_pool_release_ibuf(tex->ima, ibuf, pool);
@@ -1283,6 +1283,16 @@ int multitex_nodes(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int os
        }
 }
 
+/* this is called from the shader and texture nodes
+ * Use it from render pipeline only!
+ */
+int multitex_nodes(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres,
+                   const short thread, short which_output, ShadeInput *shi, MTex *mtex, struct ImagePool *pool)
+{
+       return multitex_nodes_intern(tex, texvec, dxt, dyt, osatex, texres,
+                                    thread, which_output, shi, mtex, pool, R.scene_color_manage);
+}
+
 /* this is called for surface shading */
 static int multitex_mtex(ShadeInput *shi, MTex *mtex, float texvec[3], float dxt[3], float dyt[3], TexResult *texres, struct ImagePool *pool)
 {
@@ -1300,19 +1310,25 @@ static int multitex_mtex(ShadeInput *shi, MTex *mtex, float texvec[3], float dxt
 }
 
 /* Warning, if the texres's values are not declared zero, check the return value to be sure
- * the color values are set before using the r/g/b values, otherwise you may use uninitialized values - Campbell */
-int multitex_ext(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, struct ImagePool *pool)
+ * the color values are set before using the r/g/b values, otherwise you may use uninitialized values - Campbell
+ *
+ * Use it for stuff which is out of render pipeline.
+ */
+int multitex_ext(Tex *tex, float texvec[3], float dxt[3], float dyt[3], int osatex, TexResult *texres, struct ImagePool *pool, bool scene_color_manage)
 {
-       return multitex_nodes(tex, texvec, dxt, dyt, osatex, texres, 0, 0, NULL, NULL, pool);
+       return multitex_nodes_intern(tex, texvec, dxt, dyt, osatex, texres, 0, 0, NULL, NULL, pool, scene_color_manage);
 }
 
-/* extern-tex doesn't support nodes (ntreeBeginExec() can't be called when rendering is going on) */
-int multitex_ext_safe(Tex *tex, float texvec[3], TexResult *texres, struct ImagePool *pool)
+/* extern-tex doesn't support nodes (ntreeBeginExec() can't be called when rendering is going on)\
+ *
+ * Use it for stuff which is out of render pipeline.
+ */
+int multitex_ext_safe(Tex *tex, float texvec[3], TexResult *texres, struct ImagePool *pool, bool scene_color_manage)
 {
        int use_nodes= tex->use_nodes, retval;
        
        tex->use_nodes = FALSE;
-       retval= multitex_nodes(tex, texvec, NULL, NULL, 0, texres, 0, 0, NULL, NULL, pool);
+       retval= multitex_nodes_intern(tex, texvec, NULL, NULL, 0, texres, 0, 0, NULL, NULL, pool, scene_color_manage);
        tex->use_nodes= use_nodes;
        
        return retval;
index b9a9d6b195755144ce2a3c3fb6f98e6a274e7cbe..981467cbba6f5c4d356218b0fc8be6e20206e1f2 100644 (file)
@@ -495,7 +495,7 @@ void WM_operator_py_idname(char *to, const char *from)
                BLI_ascii_strtolower(to, ofs);
 
                to[ofs] = '.';
-               BLI_strncpy(to + (ofs + 1), sep + 4, OP_MAX_TYPENAME);
+               BLI_strncpy(to + (ofs + 1), sep + 4, OP_MAX_TYPENAME - (ofs + 1));
        }
        else {
                /* should not happen but support just in case */
@@ -514,9 +514,8 @@ void WM_operator_bl_idname(char *to, const char *from)
 
                        memcpy(to, from, sizeof(char) * ofs);
                        BLI_ascii_strtoupper(to, ofs);
-
-                       BLI_strncpy(to + ofs, "_OT_", OP_MAX_TYPENAME);
-                       BLI_strncpy(to + (ofs + 4), sep + 1, OP_MAX_TYPENAME);
+                       strcpy(to + ofs, "_OT_");
+                       strcpy(to + (ofs + 4), sep + 1);
                }
                else {
                        /* should not happen but support just in case */
index 32efc5bde21997591267d5b4c7f17e4610282171..67739706e3c3b1cf96ddd0235dd308a45c82a82b 100644 (file)
@@ -25,11 +25,11 @@ set(INC
        ../../blender/windowmanager
        ../../../intern/container
        ../../../intern/guardedalloc
-       ../../../intern/moto/include
        ../../../intern/string
 )
 
 set(INC_SYS
+       ../../../intern/moto/include
        ${PTHREADS_INCLUDE_DIRS}
        ${GLEW_INCLUDE_PATH}
        ${BOOST_INCLUDE_DIR}
index f18646c1de03dcbc9913139ae28d8f6f5cc0a2a9..084a85c8a1f3bfb30cc8d3b8f3e1f0cb2dde5b1d 100644 (file)
@@ -51,11 +51,11 @@ set(INC
        ../../blender/windowmanager
        ../../../intern/container
        ../../../intern/guardedalloc
-       ../../../intern/moto/include
        ../../../intern/string
 )
 
 set(INC_SYS
+       ../../../intern/moto/include
        ../../../extern/recastnavigation/Detour/Include
        ../../../extern/Eigen3
        ${PTHREADS_INCLUDE_DIRS}
index 0c7d79b4cda2c25d27a6a3e539300f778dce9bcb..6907f314503f37fff03422edebf9a08940cad800 100644 (file)
@@ -28,12 +28,11 @@ set(INC
        ../SceneGraph
        ../../blender/blenlib
        ../../../intern/guardedalloc
-       ../../../intern/moto/include
        ../../../intern/string
 )
 
 set(INC_SYS
-
+       ../../../intern/moto/include
 )
 
 set(SRC
index ad357bd015b0c0314e47c5eb63dd6e6f7ebee8db..05071f5970738a9753aff36c6cdffe59d7e734ad 100644 (file)
@@ -30,13 +30,12 @@ set(INC
        ../SceneGraph
        ../../blender/blenlib
        ../../../intern/container
-       ../../../intern/moto/include
        ../../../intern/string
        ../../../intern/ghost
 )
 
 set(INC_SYS
-
+       ../../../intern/moto/include
 )
 
 set(SRC
index 8884ff8236357a9adb0beeffb16dc8551673127c..e7d4fc3dbce3418bf7d5ba3cb522fec4b2c2aa46 100644 (file)
@@ -48,18 +48,18 @@ set(INC
        ../../../../intern/container
        ../../../../intern/ghost
        ../../../../intern/guardedalloc
-       ../../../../intern/moto/include
        ../../../../intern/string
 )
 
 set(INC_SYS
+       ../../../../intern/moto/include
        ${GLEW_INCLUDE_PATH}
        ${PYTHON_INCLUDE_DIRS}
        ${PNG_INCLUDE_DIR}
        ${ZLIB_INCLUDE_DIRS}
 )
 
-set(SRC 
+set(SRC
        GPC_Canvas.cpp
        GPC_Engine.cpp
        GPC_KeyboardDevice.cpp
index 0e9422c07aa9410506bcbfbdb06a673d85858404..4ac9e78232eb58348fc0accabb285efae2d35935 100644 (file)
@@ -49,16 +49,16 @@ set(INC
        ../../../../intern/container
        ../../../../intern/ghost
        ../../../../intern/guardedalloc
-       ../../../../intern/moto/include
        ../../../../intern/string
 )
 
 set(INC_SYS
+       ../../../../intern/moto/include
        ${GLEW_INCLUDE_PATH}
        ${PYTHON_INCLUDE_DIRS}
 )
 
-set(SRC 
+set(SRC
        GPG_Application.cpp
        GPG_Canvas.cpp
        GPG_KeyboardDevice.cpp
index 3baa72eb3c856a573b8d93412ec0c1e6861130ef..1f5fa4ff80ea09e108597394f7f4cc8f27a32bdc 100644 (file)
@@ -50,16 +50,16 @@ set(INC
        ../../blender/python/mathutils
        ../../../intern/container
        ../../../intern/guardedalloc
-       ../../../intern/moto/include
        ../../../intern/string
 )
 
 set(INC_SYS
+       ../../../intern/moto/include
+       ../../../extern/recastnavigation/Recast/Include
+       ../../../extern/recastnavigation/Detour/Include
        ${PTHREADS_INCLUDE_DIRS}
        ${GLEW_INCLUDE_PATH}
        ${BOOST_INCLUDE_DIR}
-       ../../../extern/recastnavigation/Recast/Include
-       ../../../extern/recastnavigation/Detour/Include
 )
 
 set(SRC
index d5e2b375c720acc5bf8b5d232ae3a793da7ddf50..0c661cf2c8799ae0843e314b24e3fa246fe372cf 100644 (file)
@@ -31,12 +31,11 @@ set(INC
        ../../Network
        ../../SceneGraph
        ../../../../intern/container
-       ../../../../intern/moto/include
        ../../../../intern/string
 )
 
 set(INC_SYS
-
+       ../../../../intern/moto/include
 )
 
 set(SRC
index e1390e4038234efae950e6b45fa6d24ec65b98eb..bae00c464f2cc4f41870159b64eb3c797bd2af68 100644 (file)
 set(INC
        .
        ../../../intern/container
-       ../../../intern/moto/include
        ../../../intern/string
 )
 
 set(INC_SYS
-
+       ../../../intern/moto/include
 )
 
 set(SRC
index 89d7f41ab4dc96501b2baf1c61dcc2ec34daef30..87d851016dd5e3911bea4ce7967d9bd40f1c78bd 100644 (file)
@@ -39,11 +39,11 @@ set(INC
        ../../../blender/makesdna
        ../../../../intern/container
        ../../../../intern/guardedalloc
-       ../../../../intern/moto/include
        ../../../../intern/string
 )
 
 set(INC_SYS
+       ../../../../intern/moto/include
        ${GLEW_INCLUDE_PATH}
        ${PYTHON_INCLUDE_DIRS}
 )
index 529a75b2a62c3000d5943c635988057c92138194..692331f1ce471e3918ea4f5cf6e00f39bcabfdd1 100644 (file)
 set(INC
        .
        ../common
-       ../../../../intern/moto/include
 )
 
 set(INC_SYS
-
+       ../../../../intern/moto/include
 )
 
 set(SRC
index 3ea26c3be9dc1881b8d56c1c3974d49df1989b3c..9061532ba5d158c97c771714aa59c180ac53c68d 100644 (file)
@@ -33,11 +33,11 @@ set(INC
        ../../blender/blenkernel
        ../../../intern/container
        ../../../intern/guardedalloc
-       ../../../intern/moto/include
        ../../../intern/string
 )
 
 set(INC_SYS
+       ../../../intern/moto/include
        ${GLEW_INCLUDE_PATH}
        ${PYTHON_INCLUDE_DIRS}
 )
index d61f90378bbd7cde13e61d846c50baf518bdb394..6b53990770f139c6b29f1954b78e82e84bc334ef 100644 (file)
@@ -33,11 +33,11 @@ set(INC
        ../../../blender/gpu
        ../../../blender/makesdna
        ../../../../intern/container
-       ../../../../intern/moto/include
        ../../../../intern/string
 )
 
 set(INC_SYS
+       ../../../../intern/moto/include
        ${GLEW_INCLUDE_PATH}
 )
 
index 7b7f05da3e3fdb4ec0f0778934d6deec6b38b0dc..bbad429bbcd9d2be419c25af3af88211a19e8a35 100644 (file)
 
 set(INC
        .
-       ../../../intern/moto/include
 )
 
 set(INC_SYS
-
+       ../../../intern/moto/include
 )
 
 set(SRC
index f436fecf6b766532f0e702924edb00a87d8e5a5a..3ca3917cf6dd0f050b6a6c42d8f1380a9cdb6a74 100644 (file)
@@ -43,11 +43,11 @@ set(INC
        ../../../intern/container
        ../../../intern/ffmpeg
        ../../../intern/guardedalloc
-       ../../../intern/moto/include
        ../../../intern/string
 )
 
 set(INC_SYS
+       ../../../intern/moto/include
        ${GLEW_INCLUDE_PATH}
 )