diff --git a/CMakeLists.txt b/CMakeLists.txt index 62240515c4a..51d900ae35d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -120,7 +120,7 @@ option(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON) option(WITH_PYTHON "Enable Embedded Python API (only disable for development)" ON) option(WITH_PYTHON_SECURITY "Disables execution of scripts within blend files by default (recommend to leave off)" OFF) mark_as_advanced(WITH_PYTHON) # dont want people disabling this unless they really know what they are doing. -mark_as_advanced(WITH_PYTHON_SECURITY) # some distrobutions see this as a security issue, rather than have them patch it, make a build option. +mark_as_advanced(WITH_PYTHON_SECURITY) # some distributions see this as a security issue, rather than have them patch it, make a build option. option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency, only enable for development)." OFF) option(WITH_PYTHON_MODULE "Enable building as a python module which runs without a user interface, like running regular blender in background mode (experimental, only enable for development)" OFF) @@ -371,7 +371,7 @@ if(WITH_CYCLES OR WITH_MOD_BOOLEAN) set(WITH_BOOST ON) endif() -# don't store paths to libs for portable distrobution +# don't store paths to libs for portable distribution if(WITH_INSTALL_PORTABLE) set(CMAKE_SKIP_BUILD_RPATH TRUE) endif() @@ -566,7 +566,7 @@ if(UNIX AND NOT APPLE) mark_as_advanced(FFMPEG) - # lame, but until we have propper find module for ffmpeg + # lame, but until we have proper find module for ffmpeg set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include) if(EXISTS "${FFMPEG}/include/ffmpeg/") set(FFMPEG_INCLUDE_DIRS "${FFMPEG_INCLUDE_DIRS} ${FFMPEG}/include/ffmpeg") @@ -647,7 +647,11 @@ if(UNIX AND NOT APPLE) else() set(Boost_USE_MULTITHREADED ON) endif() - find_package(Boost 1.34 COMPONENTS filesystem regex system thread) + if(WITH_CYCLES_OSL) + find_package(Boost 1.34 COMPONENTS filesystem python3 regex system thread) # osl_nodes uses boost_python + else() + find_package(Boost 1.34 COMPONENTS filesystem regex system thread) + endif() mark_as_advanced(Boost_DIR) # why doesnt boost do this? endif() @@ -1079,9 +1083,17 @@ elseif(WIN32) endif() set(BOOST_LIBRARIES optimized libboost_date_time-${BOOST_POSTFIX} optimized libboost_filesystem-${BOOST_POSTFIX} - optimized libboost_regex-${BOOST_POSTFIX} optimized libboost_system-${BOOST_POSTFIX} optimized libboost_thread-${BOOST_POSTFIX} + optimized libboost_regex-${BOOST_POSTFIX} + optimized libboost_system-${BOOST_POSTFIX} optimized libboost_thread-${BOOST_POSTFIX} debug libboost_date_time-${BOOST_DEBUG_POSTFIX} debug libboost_filesystem-${BOOST_DEBUG_POSTFIX} - debug libboost_regex-${BOOST_DEBUG_POSTFIX} debug libboost_system-${BOOST_DEBUG_POSTFIX} debug libboost_thread-${BOOST_DEBUG_POSTFIX}) + debug libboost_regex-${BOOST_DEBUG_POSTFIX} + debug libboost_system-${BOOST_DEBUG_POSTFIX} debug libboost_thread-${BOOST_DEBUG_POSTFIX}) + if(WITH_CYCLES_OSL) + set(BOOST_LIBRARIES ${BOOST_LIBRARIES} + optimized libboost_python3-${BOOST_POSTFIX} + debug libboost_python3-${BOOST_DEBUG_POSTFIX}) + endif(WITH_CYCLES_OSL) + set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB") endif() @@ -1097,7 +1109,7 @@ elseif(WIN32) set(OPENCOLORIO ${LIBDIR}/opencolorio) set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include) set(OPENCOLORIO_LIBRARIES OpenColorIO) - set_lib_path(OPENCOLORIO_LIBPATH "opencolorio/lib") + set(OPENCOLORIO_LIBPATH ${LIBDIR}/opencolorio/lib) set(OPENCOLORIO_DEFINITIONS) endif() @@ -1257,9 +1269,17 @@ elseif(WIN32) endif() set(BOOST_LIBRARIES optimized boost_date_time-${BOOST_POSTFIX} boost_filesystem-${BOOST_POSTFIX} - boost_regex-${BOOST_POSTFIX} boost_system-${BOOST_POSTFIX} boost_thread-${BOOST_POSTFIX} + boost_regex-${BOOST_POSTFIX} + boost_system-${BOOST_POSTFIX} boost_thread-${BOOST_POSTFIX} debug boost_date_time-${BOOST_DEBUG_POSTFIX} boost_filesystem-${BOOST_DEBUG_POSTFIX} - boost_regex-${BOOST_DEBUG_POSTFIX} boost_system-${BOOST_DEBUG_POSTFIX} boost_thread-${BOOST_DEBUG_POSTFIX}) + boost_regex-${BOOST_DEBUG_POSTFIX} + boost_system-${BOOST_DEBUG_POSTFIX} boost_thread-${BOOST_DEBUG_POSTFIX}) + if(WITH_CYCLES_OSL) + set(BOOST_LIBRARIES ${BOOST_LIBRARIES} + optimized libboost_python3-${BOOST_POSTFIX} + debug libboost_python3-${BOOST_DEBUG_POSTFIX}) + endif(WITH_CYCLES_OSL) + set(BOOST_LIBPATH ${BOOST}/lib) set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB -DBOOST_THREAD_USE_LIB ") endif() @@ -1283,7 +1303,7 @@ elseif(WIN32) set(PLATFORM_LINKFLAGS "-Xlinker --stack=2097152") ## DISABLE - causes linking errors - ## for re-distrobution, so users dont need mingw installed + ## for re-distribution, so users dont need mingw installed # set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-libgcc -static-libstdc++") endif() @@ -1395,6 +1415,7 @@ elseif(APPLE) if(WITH_IMAGE_OPENEXR) set(OPENEXR ${LIBDIR}/openexr) + set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include) set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR) set(OPENEXR_LIBRARIES Iex Half IlmImf Imath IlmThread) set(OPENEXR_LIBPATH ${OPENEXR}/lib) @@ -1513,7 +1534,11 @@ elseif(APPLE) if(WITH_BOOST) set(BOOST ${LIBDIR}/boost) set(BOOST_INCLUDE_DIR ${BOOST}/include) - set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt) + if(WITH_CYCLES_OSL) + set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_python3-mt boost_regex-mt boost_system-mt boost_thread-mt) + else(WITH_CYCLES_OSL) + set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt) + endif(WITH_CYCLES_OSL) set(BOOST_LIBPATH ${BOOST}/lib) set(BOOST_DEFINITIONS) endif() @@ -1521,7 +1546,7 @@ elseif(APPLE) if(WITH_OPENIMAGEIO) set(OPENIMAGEIO ${LIBDIR}/openimageio) set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include) - set(OPENIMAGEIO_LIBRARIES OpenImageIO ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES}) + set(OPENIMAGEIO_LIBRARIES -force_load ${OPENIMAGEIO}/lib/libOpenImageIO.a ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES}) set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib ${JPEG_LIBPATH} ${PNG_LIBPATH} ${TIFF_LIBPATH} ${OPENEXR_LIBPATH} ${ZLIB_LIBPATH}) set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD") endif() @@ -1543,7 +1568,7 @@ elseif(APPLE) find_library(OSL_LIB_COMP NAMES oslcomp PATHS ${CYCLES_OSL}/lib) find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib) # WARNING! depends on correct order of OSL libs linking - list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} ${OSL_LIB_EXEC} ${OSL_LIB_QUERY}) + list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} -force_load ${OSL_LIB_EXEC} ${OSL_LIB_QUERY}) find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include) find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin) @@ -1557,6 +1582,66 @@ elseif(APPLE) endif() include_directories(${OSL_INCLUDES}) + + + # LLVM library setup, needed for osl + + set(LLVM_DIRECTORY "${LIBDIR}/llvm") + set(LLVM_STATIC YES) + if (LLVM_DIRECTORY) + set (LLVM_CONFIG "${LLVM_DIRECTORY}/bin/llvm-config") + else () + set (LLVM_CONFIG llvm-config) + endif () + execute_process (COMMAND ${LLVM_CONFIG} --version + OUTPUT_VARIABLE LLVM_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process (COMMAND ${LLVM_CONFIG} --prefix + OUTPUT_VARIABLE LLVM_DIRECTORY + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process (COMMAND ${LLVM_CONFIG} --libdir + OUTPUT_VARIABLE LLVM_LIB_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process (COMMAND ${LLVM_CONFIG} --includedir + OUTPUT_VARIABLE LLVM_INCLUDES + OUTPUT_STRIP_TRAILING_WHITESPACE) + find_library ( LLVM_LIBRARY + NAMES libLLVMAnalysis.a # first of a whole bunch of libs to get + PATHS ${LLVM_LIB_DIR}) + message (STATUS "LLVM version = ${LLVM_VERSION}") + message (STATUS "LLVM dir = ${LLVM_DIRECTORY}") + message (STATUS "LLVM includes = ${LLVM_INCLUDES}") + message (STATUS "LLVM lib dir = ${LLVM_LIB_DIR}") + + if (LLVM_LIBRARY AND LLVM_INCLUDES AND LLVM_DIRECTORY AND LLVM_LIB_DIR) + # ensure include directory is added (in case of non-standard locations + include_directories (BEFORE "${LLVM_INCLUDES}") + string (REGEX REPLACE "\\." "" OSL_LLVM_VERSION ${LLVM_VERSION}) + message (STATUS "LLVM OSL_LLVM_VERSION = ${OSL_LLVM_VERSION}") + add_definitions ("-DOSL_LLVM_VERSION=${OSL_LLVM_VERSION}") + if (LLVM_STATIC) + # if static LLVM libraries were requested, use llvm-config to generate + # the list of what libraries we need, and substitute that in the right + # way for LLVM_LIBRARY. + set (LLVM_LIBRARY "") + execute_process (COMMAND ${LLVM_CONFIG} --libs + OUTPUT_VARIABLE llvm_library_list + OUTPUT_STRIP_TRAILING_WHITESPACE) + string (REPLACE "-l" "" llvm_library_list ${llvm_library_list}) + string (REPLACE " " ";" llvm_library_list ${llvm_library_list}) + foreach (f ${llvm_library_list}) + list (APPEND LLVM_LIBRARY "${LLVM_LIB_DIR}/lib${f}.a") + endforeach () + endif () + string (REPLACE ";" " " LLVM_LIBRARY "${LLVM_LIBRARY}") + message (STATUS "LLVM library = ${LLVM_LIBRARY}") + else () + message (FATAL_ERROR "LLVM not found.") + endif () + set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} ${LLVM_LIBRARY}") + + # end LLVM library setup + endif() set(EXETYPE MACOSX_BUNDLE) diff --git a/build_files/scons/config/win32-mingw-config.py b/build_files/scons/config/win32-mingw-config.py index 327fb07ac7a..0a72d87bb2a 100644 --- a/build_files/scons/config/win32-mingw-config.py +++ b/build_files/scons/config/win32-mingw-config.py @@ -201,7 +201,7 @@ LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32 PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152'] ## DISABLED, causes linking errors! -## for re-distrobution, so users dont need mingw installed +## for re-distribution, so users dont need mingw installed # PLATFORM_LINKFLAGS += ["-static-libgcc", "-static-libstdc++"] BF_DEBUG = False diff --git a/build_files/scons/config/win64-mingw-config.py b/build_files/scons/config/win64-mingw-config.py index 020e5ad3a61..838822bbbcb 100644 --- a/build_files/scons/config/win64-mingw-config.py +++ b/build_files/scons/config/win64-mingw-config.py @@ -199,7 +199,7 @@ LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32 PLATFORM_LINKFLAGS = ['-Xlinker', '--stack=2097152'] ## DISABLED, causes linking errors! -## for re-distrobution, so users dont need mingw installed +## for re-distribution, so users dont need mingw installed # PLATFORM_LINKFLAGS += ["-static-libgcc", "-static-libstdc++"] BF_DEBUG = False diff --git a/intern/audaspace/fftw/AUD_BandPassFactory.h b/intern/audaspace/fftw/AUD_BandPassFactory.h index 75de071403f..90b090dce16 100644 --- a/intern/audaspace/fftw/AUD_BandPassFactory.h +++ b/intern/audaspace/fftw/AUD_BandPassFactory.h @@ -84,7 +84,7 @@ public: * Sets the highest passed frequency. * \param high The highest passed frequency. */ - void setHigh(float hight); + void setHigh(float high); virtual AUD_IReader* createReader(); }; diff --git a/intern/audaspace/intern/AUD_PyInit.h b/intern/audaspace/intern/AUD_PyInit.h index 95a60cd57bb..d8b6e2f3519 100644 --- a/intern/audaspace/intern/AUD_PyInit.h +++ b/intern/audaspace/intern/AUD_PyInit.h @@ -38,7 +38,7 @@ extern "C" { #endif /** - * Initalizes the Python module. + * Initializes the Python module. */ extern PyObject *AUD_initPython(void); diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt index 90eeb4b4758..38daf790955 100644 --- a/intern/cycles/CMakeLists.txt +++ b/intern/cycles/CMakeLists.txt @@ -59,7 +59,8 @@ include_directories( SYSTEM ${BOOST_INCLUDE_DIR} ${OPENIMAGEIO_INCLUDE_DIRS} - ${OPENIMAGEIO_INCLUDE_DIRS}/OpenImageIO) + ${OPENIMAGEIO_INCLUDE_DIRS}/OpenImageIO + ${OPENEXR_INCLUDE_DIR}) # Subdirectories diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 4d44dc84fdf..8d39b09ab0e 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -59,7 +59,7 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel): col = split.column() sub = col.column() - sub.enabled = (device_type == 'NONE' or cscene.device == 'CPU') + sub.active = (device_type == 'NONE' or cscene.device == 'CPU') sub.prop(cscene, "progressive") sub = col.column(align=True) @@ -438,6 +438,28 @@ class Cycles_PT_mesh_displacement(CyclesButtonsPanel, Panel): layout.prop(cdata, "dicing_rate") +class Cycles_PT_mesh_normals(CyclesButtonsPanel, Panel): + bl_label = "Normals" + bl_context = "data" + + @classmethod + def poll(cls, context): + return CyclesButtonsPanel.poll(context) and context.mesh + + def draw(self, context): + layout = self.layout + + mesh = context.mesh + + split = layout.split() + + col = split.column() + col.prop(mesh, "show_double_sided") + + col = split.column() + col.label() + + class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel): bl_label = "Ray Visibility" bl_context = "object" @@ -932,7 +954,7 @@ def draw_device(self, context): layout.prop(cscene, "device") elif device_type == 'OPENCL' and cscene.feature_set == 'EXPERIMENTAL': layout.prop(cscene, "device") - + if cscene.feature_set == 'EXPERIMENTAL' and cscene.device == 'CPU' and engine.with_osl(): layout.prop(cscene, "shading_system") diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index eb9deb0de2d..8fbb223cbc5 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -309,7 +309,7 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion) hide = hide || !(ob_layer & scene_layer); if(!hide) { - progress.set_status("Synchronizing object", (*b_ob).name()); + progress.set_sync_status("Synchronizing object", (*b_ob).name()); int num_particles = object_count_particles(*b_ob); @@ -356,6 +356,8 @@ void BlenderSync::sync_objects(BL::SpaceView3D b_v3d, int motion) } } + progress.set_sync_status(""); + if(!cancel && !motion) { sync_background_light(); diff --git a/intern/cycles/kernel/kernel_passes.h b/intern/cycles/kernel/kernel_passes.h index f3ddda4a392..42733d691e0 100644 --- a/intern/cycles/kernel/kernel_passes.h +++ b/intern/cycles/kernel/kernel_passes.h @@ -125,8 +125,18 @@ __device_inline void kernel_write_light_passes(KernelGlobals *kg, __global float kernel_write_pass_float3(buffer + kernel_data.film.pass_glossy_color, sample, L->color_glossy); if(flag & PASS_TRANSMISSION_COLOR) kernel_write_pass_float3(buffer + kernel_data.film.pass_transmission_color, sample, L->color_transmission); - if(flag & PASS_SHADOW) - kernel_write_pass_float4(buffer + kernel_data.film.pass_shadow, sample, L->shadow); + if(flag & PASS_SHADOW) { + float4 shadow = L->shadow; + + /* bit of an ugly hack to compensate for emitting triangles influencing + * amount of samples we get for this pass */ + if(kernel_data.integrator.progressive && kernel_data.integrator.pdf_triangles != 0.0f) + shadow.w = 0.5f; + else + shadow.w = 1.0f; + + kernel_write_pass_float4(buffer + kernel_data.film.pass_shadow, sample, shadow); + } #endif } diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp index 51568f65323..6f8740b8a51 100644 --- a/intern/cycles/render/buffers.cpp +++ b/intern/cycles/render/buffers.cpp @@ -196,7 +196,18 @@ bool RenderBuffers::get_pass_rect(PassType type, float exposure, int sample, int else if(components == 3) { assert(pass.components == 4); - if(pass.divide_type != PASS_NONE) { + /* RGBA */ + if(type == PASS_SHADOW) { + for(int i = 0; i < size; i++, in += pass_stride, pixels += 3) { + float4 f = make_float4(in[0], in[1], in[2], in[3]); + float invw = (f.w > 0.0f)? 1.0f/f.w: 1.0f; + + pixels[0] = f.x*invw; + pixels[1] = f.y*invw; + pixels[2] = f.z*invw; + } + } + else if(pass.divide_type != PASS_NONE) { /* RGB lighting passes that need to divide out color */ pass_offset = 0; foreach(Pass& color_pass, params.passes) { diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp index 4ee024dd52a..f136f08dc2c 100644 --- a/intern/cycles/render/image.cpp +++ b/intern/cycles/render/image.cpp @@ -366,8 +366,10 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int sl device_vector& tex_img = dscene->tex_float_image[slot]; - if(tex_img.device_pointer) + if(tex_img.device_pointer) { + thread_scoped_lock device_lock(device_mutex); device->tex_free(tex_img); + } if(!file_load_float_image(img, tex_img)) { /* on failure to load, we set a 1x1 pixels pink image */ @@ -384,8 +386,10 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int sl if(slot >= 10) name = string_printf("__tex_image_float_0%d", slot); else name = string_printf("__tex_image_float_00%d", slot); - if(!pack_images) + if(!pack_images) { + thread_scoped_lock device_lock(device_mutex); device->tex_alloc(name.c_str(), tex_img, true, true); + } } else { string filename = path_filename(images[slot - tex_image_byte_start]->filename); @@ -393,8 +397,10 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int sl device_vector& tex_img = dscene->tex_image[slot - tex_image_byte_start]; - if(tex_img.device_pointer) + if(tex_img.device_pointer) { + thread_scoped_lock device_lock(device_mutex); device->tex_free(tex_img); + } if(!file_load_image(img, tex_img)) { /* on failure to load, we set a 1x1 pixels pink image */ @@ -411,8 +417,10 @@ void ImageManager::device_load_image(Device *device, DeviceScene *dscene, int sl if(slot >= 10) name = string_printf("__tex_image_0%d", slot); else name = string_printf("__tex_image_00%d", slot); - if(!pack_images) + if(!pack_images) { + thread_scoped_lock device_lock(device_mutex); device->tex_alloc(name.c_str(), tex_img, true, true); + } } img->need_load = false; @@ -440,15 +448,27 @@ void ImageManager::device_free_image(Device *device, DeviceScene *dscene, int sl #endif } else if(is_float) { - device->tex_free(dscene->tex_float_image[slot]); - dscene->tex_float_image[slot].clear(); + device_vector& tex_img = dscene->tex_float_image[slot]; + + if(tex_img.device_pointer) { + thread_scoped_lock device_lock(device_mutex); + device->tex_free(tex_img); + } + + tex_img.clear(); delete float_images[slot]; float_images[slot] = NULL; } else { - device->tex_free(dscene->tex_image[slot - tex_image_byte_start]); - dscene->tex_image[slot - tex_image_byte_start].clear(); + device_vector& tex_img = dscene->tex_image[slot - tex_image_byte_start]; + + if(tex_img.device_pointer) { + thread_scoped_lock device_lock(device_mutex); + device->tex_free(tex_img); + } + + tex_img.clear(); delete images[slot - tex_image_byte_start]; images[slot - tex_image_byte_start] = NULL; @@ -460,7 +480,7 @@ void ImageManager::device_update(Device *device, DeviceScene *dscene, Progress& { if(!need_update) return; - + TaskPool pool; for(size_t slot = 0; slot < images.size(); slot++) { @@ -542,9 +562,9 @@ void ImageManager::device_free(Device *device, DeviceScene *dscene) device_free_image(device, dscene, slot); device->tex_free(dscene->tex_image_packed); - dscene->tex_image_packed.clear(); - device->tex_free(dscene->tex_image_packed_info); + + dscene->tex_image_packed.clear(); dscene->tex_image_packed_info.clear(); images.clear(); diff --git a/intern/cycles/render/image.h b/intern/cycles/render/image.h index 04a705c27bf..8fb229282dc 100644 --- a/intern/cycles/render/image.h +++ b/intern/cycles/render/image.h @@ -22,6 +22,7 @@ #include "device_memory.h" #include "util_string.h" +#include "util_thread.h" #include "util_vector.h" CCL_NAMESPACE_BEGIN @@ -66,6 +67,7 @@ private: int tex_num_images; int tex_num_float_images; int tex_image_byte_start; + thread_mutex device_mutex; struct Image { string filename; diff --git a/intern/cycles/util/util_progress.h b/intern/cycles/util/util_progress.h index ab9ab7243e9..c97379d8776 100644 --- a/intern/cycles/util/util_progress.h +++ b/intern/cycles/util/util_progress.h @@ -43,6 +43,8 @@ public: tile_time = 0.0f; status = "Initializing"; substatus = ""; + sync_status = ""; + sync_substatus = ""; update_cb = NULL; cancel = false; cancel_message = ""; @@ -164,11 +166,42 @@ public: set_update(); } + void set_sync_status(const string& status_, const string& substatus_ = "") + { + { + thread_scoped_lock lock(progress_mutex); + sync_status = status_; + sync_substatus = substatus_; + total_time = time_dt() - start_time; + } + + set_update(); + + } + + void set_sync_substatus(const string& substatus_) + { + { + thread_scoped_lock lock(progress_mutex); + sync_substatus = substatus_; + total_time = time_dt() - start_time; + } + + set_update(); + } + void get_status(string& status_, string& substatus_) { thread_scoped_lock lock(progress_mutex); - status_ = status; - substatus_ = substatus; + + if(sync_status != "") { + status_ = sync_status; + substatus_ = sync_substatus; + } + else { + status_ = status; + substatus_ = substatus; + } } /* callback */ @@ -202,6 +235,9 @@ protected: string status; string substatus; + string sync_status; + string sync_substatus; + volatile bool cancel; string cancel_message; }; diff --git a/intern/opencolorio/ocio_capi.cpp b/intern/opencolorio/ocio_capi.cpp index cc45eb9b2dd..152b537ab9b 100644 --- a/intern/opencolorio/ocio_capi.cpp +++ b/intern/opencolorio/ocio_capi.cpp @@ -35,7 +35,7 @@ #define OCIO_CAPI_IMPLEMENTATION #include "ocio_capi.h" -#ifdef NDEBUG +#if !defined(WITH_ASSERT_ABORT) # define OCIO_abort() #else # include @@ -53,7 +53,7 @@ static void OCIO_reportError(const char *err) { std::cerr << "OpenColorIO Error: " << err << std::endl; - // OCIO_abort(); + OCIO_abort(); } static void OCIO_reportException(Exception &exception) diff --git a/release/datafiles/colormanagement/config.ocio b/release/datafiles/colormanagement/config.ocio index 121c5b2055c..d73561338ba 100644 --- a/release/datafiles/colormanagement/config.ocio +++ b/release/datafiles/colormanagement/config.ocio @@ -11,7 +11,7 @@ luma: [0.2126, 0.7152, 0.0722] description: RRT version ut33 roles: - reference: Linear ACES + reference: Linear # Internal scene linear space scene_linear: Linear @@ -51,17 +51,19 @@ displays: - ! {name: Raw, colorspace: Raw} - ! {name: Log, colorspace: adx10} None: - - ! {name: Default, colorspace: raw} + - ! {name: Default, colorspace: Raw} active_displays: [sRGB, DCIP3, Rec709, XYZ, None] active_views: [Default, RRT, Raw, Log] colorspaces: - ! - name: Linear ACES + name: Linear family: aces equalitygroup: bitdepth: 32f + description: | + Rec. 709 (Full Range), Blender native linear space isdata: false allocation: lg2 allocationvars: [-8.5, 5] @@ -93,18 +95,19 @@ colorspaces: - ! {src: adx_cid_to_rle.spi1d, interpolation: linear} - ! {base: 10, direction: inverse} - ! {src: adx_exp_to_aces.spimtx} + - ! {src: rec709_to_aces.spimtx, interpolation: linear, direction: inverse} - ! - name: Linear + name: Linear ACES family: equalitygroup: bitdepth: 32f description: | - Rec. 709 (Full Range), Blender native linear space + ACES linear space isdata: false allocation: uniform - allocationvars: [-0.125, 1.125] - to_reference: ! {src: rec709_to_aces.spimtx, interpolation: nearest} + allocationvars: [-8.5, 5] + to_reference: ! {src: rec709_to_aces.spimtx, interpolation: linear, direction: inverse} - ! name: rrt_srgb @@ -116,6 +119,7 @@ colorspaces: allocationvars: [0, 1] from_reference: ! children: + - ! {src: rec709_to_aces.spimtx, interpolation: nearest} - ! {allocation: lg2, vars: [-8.5, 5]} - ! {src: rrt_ut33_sRGB.spi3d, interpolation: tetrahedral} @@ -132,7 +136,6 @@ colorspaces: to_reference: ! children: - ! {src: rec709.spi1d, interpolation: linear} - - ! {src: rec709_to_aces.spimtx, interpolation: nearest} - ! name: rrt_rec709 @@ -144,6 +147,7 @@ colorspaces: allocationvars: [0, 1] from_reference: ! children: + - ! {src: rec709_to_aces.spimtx, interpolation: nearest} - ! {allocation: lg2, vars: [-8.5, 5]} - ! {src: rrt_ut33_rec709.spi3d, interpolation: tetrahedral} @@ -157,6 +161,7 @@ colorspaces: allocationvars: [0, 1] from_reference: ! children: + - ! {src: rec709_to_aces.spimtx, interpolation: nearest} - ! {allocation: lg2, vars: [-8.5, 5]} - ! {src: rrt_ut33_p3dci.spi3d, interpolation: tetrahedral} @@ -170,6 +175,7 @@ colorspaces: allocationvars: [0, 1] from_reference: ! children: + - ! {src: rec709_to_aces.spimtx, interpolation: nearest} - ! {src: aces_to_xyz.spimtx, interpolation: linear} - ! @@ -182,6 +188,7 @@ colorspaces: allocationvars: [0, 1] from_reference: ! children: + - ! {src: rec709_to_aces.spimtx, interpolation: nearest} - ! {allocation: lg2, vars: [-8.5, 5]} - ! {src: rrt_ut33_dcdm.spi3d, interpolation: tetrahedral} @@ -197,7 +204,6 @@ colorspaces: allocationvars: [0, 1] from_reference: ! children: - - ! {src: rec709_to_aces.spimtx, interpolation: linear, direction: inverse} - ! {src: srgb_to_xyz.spimtx, interpolation: linear} - ! {src: dci_xyz.spi1d, interpolation: linear} @@ -213,7 +219,6 @@ colorspaces: to_reference: ! children: - ! {src: lg10.spi1d, interpolation: nearest} - - ! {src: rec709_to_aces.spimtx, interpolation: nearest} - ! name: srgb8 @@ -226,7 +231,7 @@ colorspaces: allocation: uniform from_reference: ! children: - - ! {src: Linear ACES, dst: lg10} + - ! {src: Linear, dst: lg10} - ! {src: spi_ocio_srgb_test.spi3d, interpolation: linear} - ! @@ -242,7 +247,6 @@ colorspaces: to_reference: ! children: - ! {src: srgb.spi1d, interpolation: linear} - - ! {src: rec709_to_aces.spimtx, interpolation: nearest} - ! name: VD16 @@ -256,7 +260,6 @@ colorspaces: to_reference: ! children: - ! {src: vd16.spi1d, interpolation: nearest} - - ! {src: rec709_to_aces.spimtx, interpolation: linear} - ! name: Non-Color @@ -280,5 +283,5 @@ colorspaces: allocation: uniform from_reference: ! children: - - ! {src: Linear ACES, dst: lg10} + - ! {src: Linear, dst: lg10} - ! {src: colorworks_filmlg_to_p3.3dl, interpolation: linear} diff --git a/release/datafiles/startup.blend b/release/datafiles/startup.blend index 773136a2f7d..3db58b8fb69 100644 Binary files a/release/datafiles/startup.blend and b/release/datafiles/startup.blend differ diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py index 485b4829b71..ab68c9424cd 100644 --- a/release/scripts/modules/addon_utils.py +++ b/release/scripts/modules/addon_utils.py @@ -275,7 +275,8 @@ def enable(module_name, default_set=True, persistent=False): try: mod.register() except: - print("Exception in module register(): %r" % getattr(mod, "__file__", module_name)) + print("Exception in module register(): %r" % + getattr(mod, "__file__", module_name)) handle_error() del sys.modules[module_name] return None @@ -317,7 +318,8 @@ def disable(module_name, default_set=True): try: mod.unregister() except: - print("Exception in module unregister(): %r" % getattr(mod, "__file__", module_name)) + print("Exception in module unregister(): %r" % + getattr(mod, "__file__", module_name)) import traceback traceback.print_exc() else: diff --git a/release/scripts/modules/bl_i18n_utils/bl_process_msg.py b/release/scripts/modules/bl_i18n_utils/bl_process_msg.py index b884423606d..33d3be63b0b 100644 --- a/release/scripts/modules/bl_i18n_utils/bl_process_msg.py +++ b/release/scripts/modules/bl_i18n_utils/bl_process_msg.py @@ -16,7 +16,7 @@ # # ***** END GPL LICENSE BLOCK ***** -# +# # Write out messages.txt from Blender. # XXX: This script is meant to be used from inside Blender! @@ -43,6 +43,7 @@ UNDOC_OPS_STR = settings.UNDOC_OPS_STR NC_ALLOWED = settings.WARN_MSGID_NOT_CAPITALIZED_ALLOWED + def check(check_ctxt, messages, key, msgsrc): if check_ctxt is None: return @@ -78,7 +79,8 @@ def dump_messages_rna(messages, check_ctxt): import bpy def classBlackList(): - blacklist_rna_class = [# core classes + blacklist_rna_class = [ + # core classes "Context", "Event", "Function", "UILayout", "BlendData", # registerable classes diff --git a/release/scripts/modules/bl_i18n_utils/check_po.py b/release/scripts/modules/bl_i18n_utils/check_po.py index 03a933887c6..2e82047bb95 100755 --- a/release/scripts/modules/bl_i18n_utils/check_po.py +++ b/release/scripts/modules/bl_i18n_utils/check_po.py @@ -162,9 +162,9 @@ def main(): " {} specific context{} present:\n {}\n" "".format(glob_stats["nbr"], glob_stats["lvl"] / glob_stats["nbr"], glob_stats["lvl_ttips"] / glob_stats["nbr"], - glob_stats["lvl_trans_ttips"]/glob_stats["nbr"], - glob_stats["lvl_ttips_in_trans"]/glob_stats["nbr"], - glob_stats["lvl_comm"]/glob_stats["nbr"], glob_stats["nbr_signs"], + glob_stats["lvl_trans_ttips"] / glob_stats["nbr"], + glob_stats["lvl_ttips_in_trans"] / glob_stats["nbr"], + glob_stats["lvl_comm"] / glob_stats["nbr"], glob_stats["nbr_signs"], glob_stats["nbr_trans_signs"], nbr_contexts, _ctx_txt, "\n ".join(glob_stats["contexts"]-{""}))) diff --git a/release/scripts/modules/bl_i18n_utils/utils.py b/release/scripts/modules/bl_i18n_utils/utils.py index 3e5394d85a4..25b9daa99e5 100644 --- a/release/scripts/modules/bl_i18n_utils/utils.py +++ b/release/scripts/modules/bl_i18n_utils/utils.py @@ -95,7 +95,6 @@ def parse_messages(fname): msgctxt_lines = [] comment_lines = [] - def finalize_message(): nonlocal reading_msgid, reading_msgstr, reading_msgctxt, \ reading_comment, is_fuzzy, is_translated, is_commented, \ @@ -225,7 +224,6 @@ def parse_messages(fname): if reading_msgstr: finalize_message() - return (messages, {"trans_msg": translated_messages, "fuzzy_msg": fuzzy_messages, diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py index e24b61a757d..573694ff08e 100644 --- a/release/scripts/modules/bpy/utils.py +++ b/release/scripts/modules/bpy/utils.py @@ -59,6 +59,7 @@ import addon_utils as _addon_utils _script_module_dirs = "startup", "modules" + def _test_import(module_name, loaded_modules): use_time = _bpy.app.debug_python @@ -615,12 +616,15 @@ def _blender_default_map(): # hooks for doc lookups _manual_map = [_blender_default_map] + def register_manual_map(manual_hook): _manual_map.append(manual_hook) + def unregister_manual_map(manual_hook): _manual_map.remove(manual_hook) + def manual_map(): # reverse so default is called last for cb in reversed(_manual_map): @@ -633,4 +637,3 @@ def manual_map(): continue yield prefix, url_manual_mapping - diff --git a/release/scripts/modules/console_python.py b/release/scripts/modules/console_python.py index 6e8fee07c0f..582a1c6ae14 100644 --- a/release/scripts/modules/console_python.py +++ b/release/scripts/modules/console_python.py @@ -304,7 +304,7 @@ def copy_as_script(context): for line in sc.scrollback: text = line.body type = line.type - + if type == 'INFO': # ignore autocomp. continue if type == 'INPUT': diff --git a/release/scripts/modules/rna_xml.py b/release/scripts/modules/rna_xml.py index a259a4ec396..2ea978419b9 100644 --- a/release/scripts/modules/rna_xml.py +++ b/release/scripts/modules/rna_xml.py @@ -257,7 +257,10 @@ def xml2rna(root_xml, try: value_xml_coerce = [int(v) for v in value_xml_split] except ValueError: - value_xml_coerce = [float(v) for v in value_xml_split] + try: + value_xml_coerce = [float(v) for v in value_xml_split] + except ValueError: # bool vector property + value_xml_coerce = [{'TRUE': True, 'FALSE': False}[v] for v in value_xml_split] del value_xml_split tp_name = 'ARRAY' diff --git a/release/scripts/presets/tracking_settings/blurry_footage.py b/release/scripts/presets/tracking_settings/blurry_footage.py index 0423f7662a2..de6f085f53d 100644 --- a/release/scripts/presets/tracking_settings/blurry_footage.py +++ b/release/scripts/presets/tracking_settings/blurry_footage.py @@ -14,4 +14,4 @@ settings.default_margin = 0 settings.use_default_red_channel = True settings.use_default_green_channel = True settings.use_default_blue_channel = True -settings.default_correlation_min = 0.6 \ No newline at end of file +settings.default_correlation_min = 0.6 diff --git a/release/scripts/presets/tracking_settings/default.py b/release/scripts/presets/tracking_settings/default.py index 0aef22195e7..3c61ea7cd7f 100644 --- a/release/scripts/presets/tracking_settings/default.py +++ b/release/scripts/presets/tracking_settings/default.py @@ -14,4 +14,4 @@ settings.default_margin = 0 settings.use_default_red_channel = True settings.use_default_green_channel = True settings.use_default_blue_channel = True -settings.default_correlation_min = 0.75 \ No newline at end of file +settings.default_correlation_min = 0.75 diff --git a/release/scripts/presets/tracking_settings/fast_motion.py b/release/scripts/presets/tracking_settings/fast_motion.py index f7f6b37db74..6051f235b0c 100644 --- a/release/scripts/presets/tracking_settings/fast_motion.py +++ b/release/scripts/presets/tracking_settings/fast_motion.py @@ -14,4 +14,4 @@ settings.default_margin = 0 settings.use_default_red_channel = True settings.use_default_green_channel = True settings.use_default_blue_channel = True -settings.default_correlation_min = 0.6 \ No newline at end of file +settings.default_correlation_min = 0.6 diff --git a/release/scripts/presets/tracking_settings/planar.py b/release/scripts/presets/tracking_settings/planar.py index b25df1fc466..49a64046002 100644 --- a/release/scripts/presets/tracking_settings/planar.py +++ b/release/scripts/presets/tracking_settings/planar.py @@ -14,4 +14,4 @@ settings.default_margin = 0 settings.use_default_red_channel = True settings.use_default_green_channel = True settings.use_default_blue_channel = True -settings.default_correlation_min = 0.75 \ No newline at end of file +settings.default_correlation_min = 0.75 diff --git a/release/scripts/startup/bl_operators/node.py b/release/scripts/startup/bl_operators/node.py index ee005fcb8bb..fb264cb3429 100644 --- a/release/scripts/startup/bl_operators/node.py +++ b/release/scripts/startup/bl_operators/node.py @@ -22,12 +22,16 @@ import bpy from bpy.types import Operator from bpy.props import EnumProperty -# XXX These node item lists should actually be generated by a callback at operator execution time (see node_type_items below), -# using the active node tree from the context. Due to a difficult bug in bpy this is not possible (item list memory gets freed too early), +# XXX These node item lists should actually be generated by a callback at +# operator execution time (see node_type_items below), +# using the active node tree from the context. +# Due to a difficult bug in bpy this is not possible +# (item list memory gets freed too early), # so for now just copy the static item lists to these global variables. # -# In the custom_nodes branch, the static per-tree-type node items are replaced by a single independent type list anyway (with a poll function -# to limit node types to the respective trees). So this workaround is only temporary. +# In the custom_nodes branch, the static per-tree-type node items are replaced +# by a single independent type list anyway (with a poll function to limit node +# types to the respective trees). So this workaround is only temporary. # lazy init node_type_items_dict = {} @@ -39,18 +43,21 @@ node_group_prefix = 'GROUP_' # Generate a list of enum items for a given node class # Copy existing type enum, adding a prefix to distinguish from node groups -# Skip the base node group type, node groups will be added below for all existing group trees +# Skip the base node group type, +# node groups will be added below for all existing group trees def node_type_items(node_class): return [(node_type_prefix + item.identifier, item.name, item.description) - for item in node_class.bl_rna.properties['type'].enum_items if item.identifier != 'GROUP'] + for item in node_class.bl_rna.properties['type'].enum_items + if item.identifier != 'GROUP'] # Generate items for node group types # Filter by the given tree_type -# Node group trees don't have a description property yet (could add this as a custom property though) +# Node group trees don't have a description property yet +# (could add this as a custom property though) def node_group_items(tree_type): return [(node_group_prefix + group.name, group.name, '') - for group in bpy.data.node_groups if group.type == tree_type] + for group in bpy.data.node_groups if group.type == tree_type] # Returns the enum item list for the edited tree in the context @@ -71,7 +78,11 @@ def node_type_items_cb(self, context): }) # XXX Does not work correctly, see comment above - #return [(item.identifier, item.name, item.description, item.value) for item in tree.nodes.bl_rna.functions['new'].parameters['type'].enum_items] + ''' + return [(item.identifier, item.name, item.description, item.value) + for item in + tree.nodes.bl_rna.functions['new'].parameters['type'].enum_items] + ''' if tree.type in node_type_items_dict: return node_type_items_dict[tree.type] + node_group_items(tree.type) @@ -85,7 +96,8 @@ class NODE_OT_add_search(Operator): bl_label = "Search and Add Node" bl_options = {'REGISTER', 'UNDO'} - # XXX this should be called 'node_type' but the operator search property is hardcoded to 'type' by a hack in bpy_operator_wrap.c ... + # XXX this should be called 'node_type' but the operator search + # property is hardcoded to 'type' by a hack in bpy_operator_wrap.c ... type = EnumProperty( name="Node Type", description="Node type", @@ -98,14 +110,17 @@ class NODE_OT_add_search(Operator): space = context.space_data tree = space.edit_tree - # Enum item identifier has an additional prefix to distinguish base node types from node groups + # Enum item identifier has an additional prefix to + # distinguish base node types from node groups item = self.type if item.startswith(node_type_prefix): # item means base node type node = tree.nodes.new(type=item[len(node_type_prefix):]) elif item.startswith(node_group_prefix): # item means node group type - node = tree.nodes.new(type='GROUP', group=bpy.data.node_groups[item[len(node_group_prefix):]]) + node = tree.nodes.new( + type='GROUP', + group=bpy.data.node_groups[item[len(node_group_prefix):]]) else: return None @@ -133,7 +148,8 @@ class NODE_OT_add_search(Operator): v2d = context.region.view2d # convert mouse position to the View2D for later node placement - space.cursor_location = v2d.region_to_view(event.mouse_region_x, event.mouse_region_y) + space.cursor_location = v2d.region_to_view(event.mouse_region_x, + event.mouse_region_y) context.window_manager.invoke_search_popup(self) return {'CANCELLED'} diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index ae0c4d4161c..ed390be49f5 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -216,7 +216,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): def DISPLACE(self, layout, ob, md): has_texture = (md.texture is not None) - + split = layout.split() col = split.column() diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index 275cb8fab65..f2c631b7ab1 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -185,7 +185,7 @@ class OBJECT_PT_groups(ObjectButtonsPanel, Panel): split = col.box().split() col = split.column() - col.prop(group, "layers", text="Dupli") + col.prop(group, "layers", text="Dupli Visibility") col = split.column() col.prop(group, "dupli_offset", text="") diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py index 47689b9be73..31a613d07bf 100644 --- a/release/scripts/startup/bl_ui/properties_render.py +++ b/release/scripts/startup/bl_ui/properties_render.py @@ -866,7 +866,6 @@ class RENDER_PT_shading(RenderButtonsPanel, Panel): col = split.column() col.prop(rd, "use_raytrace", text="Ray Tracing") - col.prop(rd, "use_color_unpremultiply") col.prop(rd, "alpha_mode", text="Alpha") diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py index 2ccdb9cee26..518b253d0b0 100644 --- a/release/scripts/startup/bl_ui/properties_scene.py +++ b/release/scripts/startup/bl_ui/properties_scene.py @@ -241,6 +241,7 @@ class SCENE_PT_color_management(Panel): layout = self.layout scene = context.scene + rd = scene.render col = layout.column() col.label(text="Display:") @@ -250,6 +251,7 @@ class SCENE_PT_color_management(Panel): col.separator() col.label(text="Render:") col.template_colormanaged_view_settings(scene, "view_settings") + col.prop(rd, "use_color_unpremultiply") col = layout.column() col.separator() diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index b0b587056b1..444e9349e9f 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -866,7 +866,7 @@ class USERPREF_MT_ndof_settings(Menu): layout.separator() layout.label(text="Orbit options") - layout.prop(input_prefs, "ndof_turntable") + layout.row().prop(input_prefs, "ndof_view_rotate_method", text="") layout.prop(input_prefs, "ndof_roll_invert_axis") layout.prop(input_prefs, "ndof_tilt_invert_axis") layout.prop(input_prefs, "ndof_rotate_invert_axis") @@ -953,6 +953,8 @@ class USERPREF_PT_input(Panel, InputKeyMapPanel): sub = col.column() sub.label(text="NDOF Device:") sub.prop(inputs, "ndof_sensitivity", text="NDOF Sensitivity") + sub.prop(inputs, "ndof_orbit_sensitivity", text="NDOF Orbit Sensitivity") + sub.row().prop(inputs, "ndof_view_rotate_method", expand=True) row.separator() diff --git a/release/scripts/templates/addon_add_object.py b/release/scripts/templates/addon_add_object.py index d7fc23f9242..a4df5fb7436 100644 --- a/release/scripts/templates/addon_add_object.py +++ b/release/scripts/templates/addon_add_object.py @@ -39,10 +39,9 @@ def add_object(self, context): class OBJECT_OT_add_object(Operator, AddObjectHelper): - """Add a Mesh Object""" + """Create a new Mesh Object""" bl_idname = "mesh.add_object" bl_label = "Add Mesh Object" - bl_description = "Create a new Mesh Object" bl_options = {'REGISTER', 'UNDO'} scale = FloatVectorProperty( @@ -82,6 +81,7 @@ def register(): bpy.utils.register_manual_map(add_object_manual_map) bpy.types.INFO_MT_mesh_add.append(add_object_button) + def unregister(): bpy.utils.unregister_class(OBJECT_OT_add_object) bpy.utils.unregister_manual_map(add_object_manual_map) diff --git a/release/scripts/templates/ui_panel.py b/release/scripts/templates/ui_panel.py index 095fa105efa..9ffa0cbeeea 100644 --- a/release/scripts/templates/ui_panel.py +++ b/release/scripts/templates/ui_panel.py @@ -12,36 +12,36 @@ class LayoutDemoPanel(bpy.types.Panel): def draw(self, context): layout = self.layout - sc = context.scene - - #Create a simple row. + scene = context.scene + + # Create a simple row. layout.label(text=" Simple Row:") - + row = layout.row() - row.prop(sc, "frame_start") - row.prop(sc, "frame_end") - - #Create an row where the buttons are aligned to each other. + row.prop(scene, "frame_start") + row.prop(scene, "frame_end") + + # Create an row where the buttons are aligned to each other. layout.label(text=" Aligned Row") - + row = layout.row(align=True) - row.prop(sc, "frame_start") - row.prop(sc, "frame_end") - - #Create two columns, by using a split layout. + row.prop(scene, "frame_start") + row.prop(scene, "frame_end") + + # Create two columns, by using a split layout. split = layout.split() - + # First column col = split.column() col.label(text="Column One:") - col.prop(sc, "frame_end") - col.prop(sc, "frame_start") - + col.prop(scene, "frame_end") + col.prop(scene, "frame_start") + # Second column, aligned col = split.column(align=True) col.label(text="Column Two") - col.prop(sc, "frame_start") - col.prop(sc, "frame_end") + col.prop(scene, "frame_start") + col.prop(scene, "frame_end") def register(): diff --git a/release/scripts/templates/ui_panel_simple.py b/release/scripts/templates/ui_panel_simple.py index 3fab7d92675..9bcc750560f 100644 --- a/release/scripts/templates/ui_panel_simple.py +++ b/release/scripts/templates/ui_panel_simple.py @@ -22,6 +22,9 @@ class HelloWorldPanel(bpy.types.Panel): row = layout.row() row.prop(obj, "name") + row = layout.row() + row.operator("mesh.primitive_cube_add") + def register(): bpy.utils.register_class(HelloWorldPanel) diff --git a/release/windows/contrib/vfapi/vfapi-plugin.c b/release/windows/contrib/vfapi/vfapi-plugin.c index 8e1bfb0f247..8d63baa0ce4 100644 --- a/release/windows/contrib/vfapi/vfapi-plugin.c +++ b/release/windows/contrib/vfapi/vfapi-plugin.c @@ -188,7 +188,7 @@ HRESULT __stdcall VF_OpenFileFunc_Blen( SOCKET s_in; char buf[256]; struct sockaddr_in addr; - FILE* fp; + FILE *fp; p = lpFileName; while (*p && *p != '.') p++; @@ -229,7 +229,7 @@ HRESULT __stdcall VF_OpenFileFunc_Blen( return VF_ERROR; } - rval = (conndesc*) malloc(sizeof(conndesc)); + rval = (conndesc *) malloc(sizeof(conndesc)); rval->addr = addr; @@ -281,7 +281,7 @@ HRESULT __stdcall VF_OpenFileFunc_Blen( HRESULT __stdcall VF_CloseFileFunc_Blen( VF_FileHandle hFileHandle ) { - free((conndesc*) hFileHandle); + free((conndesc *) hFileHandle); return VF_OK; } @@ -290,7 +290,7 @@ HRESULT __stdcall VF_GetFileInfoFunc_Blen( VF_FileHandle hFileHandle, LPVF_FileInfo lpFileInfo ) { - conndesc * c = (conndesc*) hFileHandle; + conndesc *c = (conndesc *) hFileHandle; if (c == 0) { return VF_ERROR; } @@ -385,10 +385,10 @@ HRESULT __stdcall VF_ReadDataFunc_Blen( framebuf = (unsigned char*) v->lpData; for (y = 0; y < height; y++) { - unsigned char * p = framebuf + v->lPitch * y; - unsigned char * e = p + width * 3; + unsigned char *p = framebuf + v->lPitch * y; + unsigned char *e = p + width * 3; - my_recv(s_in, (char*) p, width * 3); + my_recv(s_in, (char *)p, width * 3); while (p != e) { unsigned char tmp = p[2]; p[2] = p[0]; diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index d0b77222114..b694f1fafa7 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -63,12 +63,12 @@ #define SYSTEM_ENCODING_DEFAULT "UTF-8" #define FONT_SIZE_DEFAULT 12 -/* locale options. */ +/* Locale options. */ static char global_messagepath[1024]; static char global_language[32]; static char global_encoding_name[32]; -/* map from the rna_userdef.c:rna_def_userdef_system(BlenderRNA *brna):language_items */ +/* Map from the rna_userdef.c:rna_def_userdef_system(BlenderRNA *brna):language_items */ static const char *locales[] = { "", "", "english", "en_US", @@ -107,17 +107,16 @@ static const char *locales[] = { "kyrgyz", "ky_KG", "turkish", "tr_TR", "hungarian", "hu_HU", - "brazilian portuguese", "pt_BR", + "portuguese-brazilian", "pt_BR", "hebrew", "he_IL", }; void BLF_lang_init(void) { char *messagepath = BLI_get_folder(BLENDER_DATAFILES, "locale"); -/* printf("%s\n", messagepath);*/ BLI_strncpy(global_encoding_name, SYSTEM_ENCODING_DEFAULT, sizeof(global_encoding_name)); - + if (messagepath) { BLI_strncpy(global_messagepath, messagepath, sizeof(global_messagepath)); } @@ -125,10 +124,9 @@ void BLF_lang_init(void) printf("%s: 'locale' data path for translations not found, continuing\n", __func__); global_messagepath[0] = '\0'; } - } -/* get LANG/LANGUAGE environment variable */ +/* Get LANG/LANGUAGE environment variable. */ static void get_language_variable(const char *varname, char *var, const size_t maxlen) { char *env = getenv(varname); @@ -136,18 +134,18 @@ static void get_language_variable(const char *varname, char *var, const size_t m if (env) { char *s; - /* store defaul locale */ + /* Store defaul locale. */ BLI_strncpy(var, env, maxlen); - /* use first language as default */ + /* Use first language as default. */ s = strchr(var, ':'); if (s) s[0] = 0; } } -/* get language to be used based on locale(which might be empty when using default language) and - * LANG environment variable +/* Get language to be used based on locale (which might be empty when using default language) and + * LANG environment variable. */ static void get_language(const char *locale, const char *lang, char *language, const size_t maxlen) { @@ -165,7 +163,7 @@ static void get_language(const char *locale, const char *lang, char *language, c } } -/* XXX WARNING!!! IN osx somehow the previous function call jumps in this one??? (ton, ppc) */ +/* XXX WARNING!!! In osx somehow the previous function call jumps in this one??? (ton, ppc) */ void BLF_lang_set(const char *str) { char *locreturn; @@ -185,7 +183,7 @@ void BLF_lang_set(const char *str) if (short_locale) { char *envStr; - if (U.language == 0) /* use system setting */ + if (U.language == 0) /* Use system setting. */ envStr = BLI_sprintfN("LANG=%s", getenv("LANG")); else envStr = BLI_sprintfN("LANG=%s", short_locale); @@ -252,7 +250,7 @@ void BLF_lang_set(const char *str) printf("Fallback to LANG=%s and LANGUAGE=%s\n", default_lang, language); } - /* fallback to default settings */ + /* Fallback to default settings. */ BLI_setenv("LANG", default_lang); BLI_setenv("LANGUAGE", language); diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 7df491c0fef..2d7030b2d42 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -203,7 +203,7 @@ void BKE_pose_ikparam_init(struct bPose *pose); void BKE_pose_itasc_init(struct bItasc *itasc); /* clears BONE_UNKEYED flags for frame changing */ -// XXX to be depreceated for a more general solution in animsys... +// XXX to be deprecated for a more general solution in animsys... void framechange_poses_clear_unkeyed(void); /* Bone Groups API --------------------- */ diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h index db1139c9c7b..dd45ab19eb1 100644 --- a/source/blender/blenkernel/BKE_blender.h +++ b/source/blender/blenkernel/BKE_blender.h @@ -42,7 +42,7 @@ extern "C" { * and keep comment above the defines. * Use STRINGIFY() rather than defining with quotes */ #define BLENDER_VERSION 263 -#define BLENDER_SUBVERSION 21 +#define BLENDER_SUBVERSION 22 /* 262 was the last editmesh release but its has compatibility code for bmesh data, * so set the minversion to 2.61 */ diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index ac324b2af00..5e5f58f73fe 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -66,7 +66,7 @@ int BKE_imtype_is_movie(const char imtype); int BKE_imtype_supports_zbuf(const char imtype); int BKE_imtype_supports_compress(const char imtype); int BKE_imtype_supports_quality(const char imtype); -int BKE_imtype_supports_float(const char imtype); +int BKE_imtype_requires_linear_float(const char imtype); char BKE_imtype_valid_channels(const char imtype); char BKE_imtype_valid_depths(const char imtype); diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index ad5541a5a2f..06931662d3f 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -68,7 +68,7 @@ typedef struct Main { ListBase latt; ListBase lamp; ListBase camera; - ListBase ipo; // XXX depreceated + ListBase ipo; // XXX deprecated ListBase key; ListBase world; ListBase screen; diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 954fb47806b..c14085a559a 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -88,8 +88,8 @@ int BKE_mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata, struct CustomData *pdata, int totface, int totloop, int totpoly); /*calculates a face normal.*/ -void mesh_calc_poly_normal(struct MPoly *mpoly, struct MLoop *loopstart, - struct MVert *mvarray, float no[3]); +void BKE_mesh_calc_poly_normal(struct MPoly *mpoly, struct MLoop *loopstart, + struct MVert *mvarray, float no[3]); void BKE_mesh_calc_poly_normal_coords(struct MPoly *mpoly, struct MLoop *loopstart, const float (*vertex_coords)[3], float no[3]); @@ -98,7 +98,7 @@ void BKE_mesh_calc_poly_center(struct MPoly *mpoly, struct MLoop *loopstart, struct MVert *mvarray, float cent[3]); float BKE_mesh_calc_poly_area(struct MPoly *mpoly, struct MLoop *loopstart, - struct MVert *mvarray, float polynormal[3]); + struct MVert *mvarray, const float polynormal[3]); /* Find the index of the loop in 'poly' which references vertex, * returns -1 if not found */ diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 269d96d5c38..ec0703248fd 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -54,7 +54,7 @@ void BKE_object_workob_clear(struct Object *workob); void BKE_object_workob_calc_parent(struct Scene *scene, struct Object *ob, struct Object *workob); void BKE_object_transform_copy(struct Object *ob_tar, const struct Object *ob_src); -struct SoftBody *copy_softbody(struct SoftBody *sb); +struct SoftBody *copy_softbody(struct SoftBody *sb, int copy_caches); struct BulletSoftBody *copy_bulletsoftbody(struct BulletSoftBody *sb); void BKE_object_copy_particlesystems(struct Object *obn, struct Object *ob); void BKE_object_copy_softbody(struct Object *obn, struct Object *ob); @@ -82,6 +82,7 @@ struct Object *BKE_object_add(struct Scene *scene, int type); void *BKE_object_obdata_add_from_type(int type); struct Object *BKE_object_copy(struct Object *ob); +struct Object *BKE_object_copy_with_caches(struct Object *ob); void BKE_object_make_local(struct Object *ob); int BKE_object_is_libdata(struct Object *ob); int BKE_object_obdata_is_libdata(struct Object *ob); diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index d6ab9a35697..77b35e1a25c 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -303,7 +303,7 @@ struct PointCache *BKE_ptcache_add(struct ListBase *ptcaches); void BKE_ptcache_free_mem(struct ListBase *mem_cache); void BKE_ptcache_free(struct PointCache *cache); void BKE_ptcache_free_list(struct ListBase *ptcaches); -struct PointCache *BKE_ptcache_copy_list(struct ListBase *ptcaches_new, struct ListBase *ptcaches_old); +struct PointCache *BKE_ptcache_copy_list(struct ListBase *ptcaches_new, struct ListBase *ptcaches_old, int copy_data); /********************** Baking *********************/ diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 1b301ba43b3..ec15e2ea87f 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -1140,21 +1140,17 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa float *v3; /* float *v4; */ /* UNUSED */ float cent[3], quat[4], mat[3][3], mat3[3][3], tmat[4][4], obmat[4][4]; + float f_no[3]; MLoop *loopstart = mloop + mp->loopstart; - if (mp->totloop < 3) { - /* highly unlikely but to be safe */ + if (UNLIKELY(mp->totloop < 3)) { continue; } else { + BKE_mesh_calc_poly_normal(mp, mloop + mp->loopstart, mvert, f_no); v1 = mvert[(mv1 = loopstart[0].v)].co; v2 = mvert[(mv2 = loopstart[1].v)].co; v3 = mvert[(mv3 = loopstart[2].v)].co; -#if 0 - if (mp->totloop > 3) { - v4 = mvert[(mv4 = loopstart[3].v)].co; - } -#endif } /* translation */ @@ -1170,12 +1166,12 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa copy_v3_v3(obmat[3], cent); /* rotation */ - tri_to_quat(quat, v1, v2, v3); + tri_to_quat_ex(quat, v1, v2, v3, f_no); quat_to_mat3(mat, quat); /* scale */ if (par->transflag & OB_DUPLIFACES_SCALE) { - float size = BKE_mesh_calc_poly_area(mp, loopstart, mvert, NULL); + float size = BKE_mesh_calc_poly_area(mp, loopstart, mvert, f_no); size = sqrtf(size) * par->dupfacesca; mul_m3_fl(mat, size); } diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index cf785a4bb42..d685edfcda2 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -640,7 +640,7 @@ static void fcurves_path_rename_fix(ID *owner_id, const char *prefix, const char if (fcu->rna_path != old_path) { bActionGroup *agrp = fcu->grp; - if ((agrp) && strcmp(oldName, agrp->name)==0) { + if ((agrp) && strcmp(oldName, agrp->name) == 0) { BLI_strncpy(agrp->name, newName, sizeof(agrp->name)); } } diff --git a/source/blender/blenkernel/intern/bmfont.c b/source/blender/blenkernel/intern/bmfont.c index 18161bc6fcb..a7d90f09160 100644 --- a/source/blender/blenkernel/intern/bmfont.c +++ b/source/blender/blenkernel/intern/bmfont.c @@ -96,7 +96,7 @@ void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step) ysize = (bytes + (ibuf->x - 1)) / ibuf->x; if (ysize < ibuf->y) { - /* we're first going to copy all data into a liniar buffer. + /* we're first going to copy all data into a linear buffer. * step can be 4 or 1 bytes, and the data is not sequential because * the bitmap was flipped vertically. */ diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index fde95e0767e..ce39eea5ceb 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -529,7 +529,7 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf unsigned char *dst, crgb[3]; const float alpha = BKE_brush_alpha_get(scene, brush); float brush_rgb[3]; - + imbflag = (flt) ? IB_rectfloat : IB_rect; xoff = -bufsize / 2.0f + 0.5f; yoff = -bufsize / 2.0f + 0.5f; @@ -563,7 +563,7 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf else { BKE_brush_sample_tex(scene, brush, xy, rgba, 0); mul_v3_v3v3(dstf, rgba, brush_rgb); - dstf[3] = rgba[3] *alpha *BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); + dstf[3] = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); } } } @@ -594,7 +594,7 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf else if (texfall == 2) { BKE_brush_sample_tex(scene, brush, xy, rgba, 0); mul_v3_v3(rgba, brush->rgb); - alpha_f = rgba[3] *alpha *BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); + alpha_f = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); rgb_float_to_uchar(dst, rgba); @@ -602,7 +602,7 @@ void BKE_brush_imbuf_new(const Scene *scene, Brush *brush, short flt, short texf } else { BKE_brush_sample_tex(scene, brush, xy, rgba, 0); - alpha_f = rgba[3] *alpha *BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); + alpha_f = rgba[3] * alpha * BKE_brush_curve_strength_clamp(brush, len_v2(xy), radius); dst[0] = crgb[0]; dst[1] = crgb[1]; diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 09ca0df0680..0bda3b266b8 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2768,7 +2768,7 @@ static void calchandleNurb_intern(BezTriple *bezt, BezTriple *prev, BezTriple *n if (skip_align) { /* handles need to be updated during animation and applying stuff like hooks, - * but in such situatios it's quite difficult to distinguish in which order + * but in such situations it's quite difficult to distinguish in which order * align handles should be aligned so skip them for now */ return; } diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 1cb29b90133..d55848514cc 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -1944,7 +1944,7 @@ static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh { /* Note: Current method only uses polygon edges to detect neighboring pixels. * -> It doesn't always lead to the optimum pixel but is accurate enough - * and faster/simplier than including possible face tip point links) + * and faster/simpler than including possible face tip point links) */ int x, y; @@ -2852,15 +2852,15 @@ static void mesh_faces_nearest_point_dp(void *userdata, int index, const float c /***************************** Brush Painting Calls ******************************/ -/* - * Mix color values to canvas point. +/** + * Mix color values to canvas point. * - * surface : canvas surface - * index : surface point index - * paintFlags : paint object flags - * paintColor,Alpha,Wetness : to be mixed paint values - * timescale : value used to adjust time dependand - * operations when using substeps + * \param surface canvas surface + * \param index surface point index + * \param paintFlags paint object flags + * \param paintColor,Alpha,Wetness to be mixed paint values + * \param timescale value used to adjust time dependent + * operations when using substeps */ static void dynamicPaint_mixPaintColors(DynamicPaintSurface *surface, int index, int paintFlags, const float paintColor[3], float *paintAlpha, float *paintWetness, float *timescale) @@ -4161,7 +4161,7 @@ static int dynamicPaint_prepareEffectStep(DynamicPaintSurface *surface, Scene *s pdEndEffectors(&effectors); } - /* Get number of required steps using averate point distance + /* Get number of required steps using average point distance * so that just a few ultra close pixels wont up substeps to max */ /* adjust number of required substep by fastest active effect */ @@ -4224,7 +4224,7 @@ static void dynamicPaint_doEffectStep(DynamicPaintSurface *surface, float *force /* Only continue if surrounding point has higher wetness */ if (ePoint->wetness < pPoint->wetness || ePoint->wetness < MIN_WETNESS) continue; - w_factor = 1.0f / numOfNeighs *MIN2(ePoint->wetness, 1.0f) * speed_scale; + w_factor = 1.0f / numOfNeighs * MIN2(ePoint->wetness, 1.0f) * speed_scale; CLAMP(w_factor, 0.0f, 1.0f); /* mix new wetness and color */ diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index d620fc50e86..3d3afa7c4b3 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -619,6 +619,8 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char BLI_strncpy(colorspace_settings->name, colorspace, sizeof(colorspace_settings->name)); } + + IMB_colormanagement_check_is_data(ibuf, colorspace_settings->name); } else { ibuf = IMB_allocImBuf(width, height, depth, IB_rect); @@ -1031,7 +1033,7 @@ int BKE_imtype_supports_quality(const char imtype) return 0; } -int BKE_imtype_supports_float(const char imtype) +int BKE_imtype_requires_linear_float(const char imtype) { switch (imtype) { case R_IMF_IMTYPE_CINEON: @@ -2605,8 +2607,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_ /* invalidate color managed buffers if render result changed */ BLI_lock_thread(LOCK_COLORMANAGE); - if (ibuf->x != rres.rectx || ibuf->y != rres.recty || ibuf->rect_float != rectf) - { + if (ibuf->x != rres.rectx || ibuf->y != rres.recty || ibuf->rect_float != rectf) { ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID; } diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index b2a9e229be9..953ee673f6b 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -32,7 +32,7 @@ /* NOTE: * - * This file is no longer used to provide tools for the depreceated IPO system. Instead, it + * This file is no longer used to provide tools for the deprecated IPO system. Instead, it * is only used to house the conversion code to the new system. * * -- Joshua Leung, Jan 2009 @@ -1765,7 +1765,7 @@ void do_versions_ipos_to_animato(Main *main) /* Any actuators set to ACT_IPO at this point are actually Action Actuators that need this converted IPO to finish converting the actuator. */ if (act->type == ACT_IPO) { - aa = (bActionActuator*)act->data; + aa = (bActionActuator *)act->data; aa->act = ob->adt->action; act->type = ACT_ACTION; } diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 5b05ce02104..b9bf2fd01a3 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -133,7 +133,7 @@ Key *BKE_key_add(ID *id) /* common function */ key->uidgen = 1; - /* XXX the code here uses some defines which will soon be depreceated... */ + /* XXX the code here uses some defines which will soon be deprecated... */ switch (GS(id->name)) { case ID_ME: el = key->elemstr; diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c index 1a9ac9dc0af..13ad9962aff 100644 --- a/source/blender/blenkernel/intern/mask_rasterize.c +++ b/source/blender/blenkernel/intern/mask_rasterize.c @@ -1208,7 +1208,7 @@ static float maskrasterize_layer_isect(unsigned int *face, float (*cos)[3], cons /* needs work */ #if 1 - /* quad check fails for bowtie, so keep using 2 tri checks */ + /* quad check fails for bow-tie, so keep using 2 tri checks */ //if (isect_point_quad_v2(xy, cos[face[0]], cos[face[1]], cos[face[2]], cos[face[3]])) if (isect_point_tri_v2(xy, cos[face[0]], cos[face[1]], cos[face[2]]) || isect_point_tri_v2(xy, cos[face[0]], cos[face[2]], cos[face[3]])) @@ -1216,7 +1216,7 @@ static float maskrasterize_layer_isect(unsigned int *face, float (*cos)[3], cons return maskrasterize_layer_z_depth_quad(xy, cos[face[0]], cos[face[1]], cos[face[2]], cos[face[3]]); } #elif 1 - /* don't use isect_point_tri_v2_cw because we could have bowtie quads */ + /* don't use isect_point_tri_v2_cw because we could have bow-tie quads */ if (isect_point_tri_v2(xy, cos[face[0]], cos[face[1]], cos[face[2]])) { return maskrasterize_layer_z_depth_tri(xy, cos[face[0]], cos[face[1]], cos[face[2]]); diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 3408e2393c9..b8f891eabe1 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1328,9 +1328,9 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3]) r_col[2] = facm * (r_col[2]) + fac * (r_col[2]) / col[2]; break; case MA_RAMP_DIFF: - r_col[0] = facm * (r_col[0]) + fac *fabsf(r_col[0] - col[0]); - r_col[1] = facm * (r_col[1]) + fac *fabsf(r_col[1] - col[1]); - r_col[2] = facm * (r_col[2]) + fac *fabsf(r_col[2] - col[2]); + r_col[0] = facm * (r_col[0]) + fac * fabsf(r_col[0] - col[0]); + r_col[1] = facm * (r_col[1]) + fac * fabsf(r_col[1] - col[1]); + r_col[2] = facm * (r_col[2]) + fac * fabsf(r_col[2] - col[2]); break; case MA_RAMP_DARK: tmp = col[0] + ((1 - col[0]) * facm); @@ -1491,7 +1491,7 @@ void ramp_blend(int type, float r_col[3], const float fac, const float col[3]) } /** - * \brief copy/paste buffer, if we had a propper py api that would be better + * \brief copy/paste buffer, if we had a proper py api that would be better * \note matcopybuf.nodetree does _NOT_ use ID's * \todo matcopybuf.nodetree's node->id's are NOT validated, this will crash! */ diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 206d80a6ff0..e45a052db4d 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -788,7 +788,7 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr) nr--; } - /* check corrupt cases, bowtie geometry, cant handle these because edge data wont exist so just return 0 */ + /* check corrupt cases, bow-tie geometry, cant handle these because edge data wont exist so just return 0 */ if (nr == 3) { if ( /* real edges */ @@ -1864,7 +1864,7 @@ void BKE_mesh_calc_normals_mapping_ex(MVert *mverts, int numVerts, /* only calc poly normals */ mp = mpolys; for (i = 0; i < numPolys; i++, mp++) { - mesh_calc_poly_normal(mp, mloop + mp->loopstart, mverts, pnors[i]); + BKE_mesh_calc_poly_normal(mp, mloop + mp->loopstart, mverts, pnors[i]); } } @@ -1914,7 +1914,7 @@ void BKE_mesh_calc_normals(MVert *mverts, int numVerts, MLoop *mloop, MPoly *mpo mp = mpolys; for (i = 0; i < numPolys; i++, mp++) { - mesh_calc_poly_normal(mp, mloop + mp->loopstart, mverts, pnors[i]); + BKE_mesh_calc_poly_normal(mp, mloop + mp->loopstart, mverts, pnors[i]); ml = mloop + mp->loopstart; BLI_array_empty(vertcos); @@ -2900,8 +2900,8 @@ static void mesh_calc_ngon_normal(MPoly *mpoly, MLoop *loopstart, } } -void mesh_calc_poly_normal(MPoly *mpoly, MLoop *loopstart, - MVert *mvarray, float no[3]) +void BKE_mesh_calc_poly_normal(MPoly *mpoly, MLoop *loopstart, + MVert *mvarray, float no[3]) { if (mpoly->totloop > 4) { mesh_calc_ngon_normal(mpoly, loopstart, mvarray, no); @@ -3016,7 +3016,7 @@ void BKE_mesh_calc_poly_center(MPoly *mpoly, MLoop *loopstart, /* note, passing polynormal is only a speedup so we can skip calculating it */ float BKE_mesh_calc_poly_area(MPoly *mpoly, MLoop *loopstart, - MVert *mvarray, float polynormal[3]) + MVert *mvarray, const float polynormal[3]) { if (mpoly->totloop == 3) { return area_tri_v3(mvarray[loopstart[0].v].co, @@ -3035,7 +3035,7 @@ float BKE_mesh_calc_poly_area(MPoly *mpoly, MLoop *loopstart, int i; MLoop *l_iter = loopstart; float area, polynorm_local[3], (*vertexcos)[3]; - float *no = polynormal ? polynormal : polynorm_local; + const float *no = polynormal ? polynormal : polynorm_local; BLI_array_fixedstack_declare(vertexcos, BM_NGON_STACK_SIZE, mpoly->totloop, __func__); /* pack vertex cos into an array for area_poly_v3 */ @@ -3045,7 +3045,7 @@ float BKE_mesh_calc_poly_area(MPoly *mpoly, MLoop *loopstart, /* need normal for area_poly_v3 as well */ if (polynormal == NULL) { - mesh_calc_poly_normal(mpoly, loopstart, mvarray, no); + BKE_mesh_calc_poly_normal(mpoly, loopstart, mvarray, polynorm_local); } /* finally calculate the area */ diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 97d4c150b84..386e4163fd2 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -292,11 +292,11 @@ static void movieclip_calc_length(MovieClip *clip) clip->len = framenr + 1; } else { - for (;; ) { + for (;;) { get_sequence_fname(clip, framenr, name); if (!BLI_exists(name)) { - clip->len = framenr + 1; + clip->len = framenr; break; } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 6fd7a55dd0a..8b3d7b3d974 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -899,23 +899,44 @@ Object *BKE_object_add(struct Scene *scene, int type) return ob; } -SoftBody *copy_softbody(SoftBody *sb) +SoftBody *copy_softbody(SoftBody *sb, int copy_caches) { SoftBody *sbn; if (sb == NULL) return(NULL); sbn = MEM_dupallocN(sb); - sbn->totspring = sbn->totpoint = 0; - sbn->bpoint = NULL; - sbn->bspring = NULL; + + if (copy_caches == FALSE) { + sbn->totspring = sbn->totpoint = 0; + sbn->bpoint = NULL; + sbn->bspring = NULL; + } + else { + sbn->totspring = sb->totspring; + sbn->totpoint = sb->totpoint; + + if (sbn->bpoint) { + int i; + + sbn->bpoint = MEM_dupallocN(sbn->bpoint); + + for (i = 0; i < sbn->totpoint; i++) { + if (sbn->bpoint[i].springs) + sbn->bpoint[i].springs = MEM_dupallocN(sbn->bpoint[i].springs); + } + } + + if (sb->bspring) + sbn->bspring = MEM_dupallocN(sb->bspring); + } sbn->keys = NULL; sbn->totkey = sbn->totpointkey = 0; sbn->scratch = NULL; - sbn->pointcache = BKE_ptcache_copy_list(&sbn->ptcaches, &sb->ptcaches); + sbn->pointcache = BKE_ptcache_copy_list(&sbn->ptcaches, &sb->ptcaches, copy_caches); if (sb->effector_weights) sbn->effector_weights = MEM_dupallocN(sb->effector_weights); @@ -988,7 +1009,7 @@ static ParticleSystem *copy_particlesystem(ParticleSystem *psys) psysn->childcachebufs.first = psysn->childcachebufs.last = NULL; psysn->renderdata = NULL; - psysn->pointcache = BKE_ptcache_copy_list(&psysn->ptcaches, &psys->ptcaches); + psysn->pointcache = BKE_ptcache_copy_list(&psysn->ptcaches, &psys->ptcaches, FALSE); /* XXX - from reading existing code this seems correct but intended usage of * pointcache should /w cloth should be added in 'ParticleSystem' - campbell */ @@ -1049,7 +1070,7 @@ void BKE_object_copy_particlesystems(Object *obn, Object *ob) void BKE_object_copy_softbody(Object *obn, Object *ob) { if (ob->soft) - obn->soft = copy_softbody(ob->soft); + obn->soft = copy_softbody(ob->soft, FALSE); } static void copy_object_pose(Object *obn, Object *ob) @@ -1130,7 +1151,7 @@ void BKE_object_transform_copy(Object *ob_tar, const Object *ob_src) copy_v3_v3(ob_tar->size, ob_src->size); } -Object *BKE_object_copy(Object *ob) +static Object *object_copy_do(Object *ob, int copy_caches) { Object *obn; ModifierData *md; @@ -1191,7 +1212,7 @@ Object *BKE_object_copy(Object *ob) if (obn->pd->rng) obn->pd->rng = MEM_dupallocN(ob->pd->rng); } - obn->soft = copy_softbody(ob->soft); + obn->soft = copy_softbody(ob->soft, copy_caches); obn->bsoft = copy_bulletsoftbody(ob->bsoft); BKE_object_copy_particlesystems(obn, ob); @@ -1207,6 +1228,18 @@ Object *BKE_object_copy(Object *ob) return obn; } +/* copy objects, will re-initialize cached simulation data */ +Object *BKE_object_copy(Object *ob) +{ + return object_copy_do(ob, FALSE); +} + +/* copy objects, will duplicate cached simulation data */ +Object *BKE_object_copy_with_caches(Object *ob) +{ + return object_copy_do(ob, TRUE); +} + static void extern_local_object(Object *ob) { ParticleSystem *psys; diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 3267253e744..5a302cba2ab 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -190,7 +190,7 @@ void BKE_paint_free(Paint *paint) } /* called when copying scene settings, so even if 'src' and 'tar' are the same - * still do a id_us_plus(), rather then if we were copying betweem 2 existing + * still do a id_us_plus(), rather then if we were copying between 2 existing * scenes where a matching value should decrease the existing user count as * with paint_brush_set() */ void BKE_paint_copy(Paint *src, Paint *tar) diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index ef03db7ed8f..e8af794eaea 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -116,7 +116,7 @@ int count_particles_mod(ParticleSystem *psys, int totgr, int cur) } return tot; } -/* we allocate path cache memory in chunks instead of a big continguous +/* we allocate path cache memory in chunks instead of a big contiguous * chunk, windows' memory allocater fails to find big blocks of memory often */ #define PATH_CACHE_BUF_SIZE 1024 @@ -3776,7 +3776,7 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti ptex->gravity = ptex->field = ptex->time = ptex->clump = ptex->kink = ptex->effector = ptex->rough1 = ptex->rough2 = ptex->roughe = 1.f; - ptex->length = 1.0f - part->randlength *PSYS_FRAND(child_index + 26); + ptex->length = 1.0f - part->randlength * PSYS_FRAND(child_index + 26); ptex->length *= part->clength_thres < PSYS_FRAND(child_index + 27) ? part->clength : 1.0f; for (m = 0; m < MAX_MTEX; m++, mtexp++) { @@ -3968,7 +3968,7 @@ float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float UNUSED size *= part->childsize; if (part->childrandsize != 0.0f) - size *= 1.0f - part->childrandsize *PSYS_FRAND(cpa - psys->child + 26); + size *= 1.0f - part->childrandsize * PSYS_FRAND(cpa - psys->child + 26); return size; } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 2c0452bc2d1..154c8cca75d 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -797,8 +797,10 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch } else { ctx->jitoff[i] = fmod(ctx->jitoff[i],(float)ctx->jitlevel); - psys_uv_to_w(ctx->jit[2*(int)ctx->jitoff[i]], ctx->jit[2*(int)ctx->jitoff[i]+1], mface->v4, pa->fuv); - ctx->jitoff[i]++; + if (!isnan(ctx->jitoff[i])) { + psys_uv_to_w(ctx->jit[2*(int)ctx->jitoff[i]], ctx->jit[2*(int)ctx->jitoff[i]+1], mface->v4, pa->fuv); + ctx->jitoff[i]++; + } } break; case PART_DISTR_RAND: @@ -3775,7 +3777,7 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra)) /* Calculate the speed of the particle relative to the local scale of the * simulation. This should be called once per particle during a simulation * step, after the velocity has been updated. element_size defines the scale of - * the simulation, and is typically the distance to neighbourning particles. */ + * the simulation, and is typically the distance to neighboring particles. */ static void update_courant_num(ParticleSimulationData *sim, ParticleData *pa, float dtime, SPHData *sphdata) { diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 780528f4a0d..0d01bb33fc5 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2663,32 +2663,59 @@ void BKE_ptcache_free_list(ListBase *ptcaches) } } -static PointCache *ptcache_copy(PointCache *cache) +static PointCache *ptcache_copy(PointCache *cache, int copy_data) { PointCache *ncache; ncache= MEM_dupallocN(cache); - /* hmm, should these be copied over instead? */ ncache->mem_cache.first = NULL; ncache->mem_cache.last = NULL; - ncache->cached_frames = NULL; - ncache->edit = NULL; - ncache->flag= 0; - ncache->simframe= 0; + if (copy_data == FALSE) { + ncache->mem_cache.first = NULL; + ncache->mem_cache.last = NULL; + ncache->cached_frames = NULL; + + ncache->flag= 0; + ncache->simframe= 0; + } + else { + PTCacheMem *pm; + + for (pm = cache->mem_cache.first; pm; pm = pm->next) { + PTCacheMem *pmn = MEM_dupallocN(pm); + int i; + + for (i = 0; i < BPHYS_TOT_DATA; i++) { + if (pmn->data[i]) + pmn->data[i] = MEM_dupallocN(pm->data[i]); + } + + BKE_ptcache_mem_pointers_init(pm); + + BLI_addtail(&ncache->mem_cache, pmn); + } + + if (ncache->cached_frames) + ncache->cached_frames = MEM_dupallocN(cache->cached_frames); + } + + /* hmm, should these be copied over instead? */ + ncache->edit = NULL; return ncache; } + /* returns first point cache */ -PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old) +PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old, int copy_data) { PointCache *cache = ptcaches_old->first; ptcaches_new->first = ptcaches_new->last = NULL; for (; cache; cache=cache->next) - BLI_addtail(ptcaches_new, ptcache_copy(cache)); + BLI_addtail(ptcaches_new, ptcache_copy(cache, copy_data)); return ptcaches_new->first; } diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 0c0396ea758..4b91943f740 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -390,7 +390,7 @@ Scene *BKE_scene_add(const char *name) sce->r.edgeint = 10; sce->r.ocres = 128; - /* OCIO_TODO: for forwards compatibiliy only, so if no tonecurve are used, + /* OCIO_TODO: for forwards compatibility only, so if no tonecurve are used, * images would look in the same way as in current blender * * perhaps at some point should be completely deprecated? @@ -1274,9 +1274,11 @@ void BKE_scene_disable_color_management(Scene *scene) ColorManagedDisplaySettings *display_settings = &scene->display_settings; ColorManagedViewSettings *view_settings = &scene->view_settings; const char *view; + const char *none_display_name; - /* NOTE: None display with Default view should always exist in OCIO configuration, otherwise it wouldn't work as expected */ - BLI_strncpy(display_settings->display_device, "None", sizeof(display_settings->display_device)); + none_display_name = IMB_colormanagement_display_get_none_name(); + + BLI_strncpy(display_settings->display_device, none_display_name, sizeof(display_settings->display_device)); view = IMB_colormanagement_view_get_default_name(display_settings->display_device); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 8d7ca94ed48..bb845400cef 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -313,7 +313,7 @@ void BKE_sequencer_editing_free(Scene *scene) static void sequencer_imbuf_assign_spaces(Scene *scene, ImBuf *ibuf) { - IMB_colormanagement_imbuf_assign_float_space(ibuf, &scene->sequencer_colorspace_settings); + IMB_colormanagement_assign_float_colorspace(ibuf, scene->sequencer_colorspace_settings.name); } void BKE_sequencer_imbuf_to_sequencer_space(Scene *scene, ImBuf *ibuf, int make_float) @@ -1835,8 +1835,6 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra, StripCrop c = {0}; StripTransform t = {0}; int sx, sy, dx, dy; - double xscale = 1.0; - double yscale = 1.0; if (is_proxy_image) { double f = seq_rendersize_to_scale_factor(context.preview_render_size); @@ -1853,14 +1851,6 @@ static ImBuf *input_preprocess(SeqRenderData context, Sequence *seq, float cfra, t = *seq->strip->transform; } - xscale = context.scene->r.xsch ? ((double) context.rectx / (double) context.scene->r.xsch) : 1.0; - yscale = context.scene->r.ysch ? ((double) context.recty / (double) context.scene->r.ysch) : 1.0; - - c.left *= xscale; c.right *= xscale; - c.top *= yscale; c.bottom *= yscale; - - t.xofs *= xscale; t.yofs *= yscale; - sx = ibuf->x - c.left - c.right; sy = ibuf->y - c.top - c.bottom; dx = sx; @@ -2186,7 +2176,7 @@ static ImBuf *seq_render_movieclip_strip(SeqRenderData context, Sequence *seq, f memset(&user, 0, sizeof(MovieClipUser)); - BKE_movieclip_user_set_frame(&user, nr + seq->anim_startofs); + BKE_movieclip_user_set_frame(&user, nr + seq->anim_startofs + seq->clip->start_frame); user.render_size = MCLIP_PROXY_RENDER_SIZE_FULL; @@ -2583,17 +2573,19 @@ static ImBuf *do_render_strip_uncached(SeqRenderData context, Sequence *seq, flo case SEQ_TYPE_MOVIECLIP: { ibuf = seq_render_movieclip_strip(context, seq, nr); - sequencer_imbuf_assign_spaces(context.scene, ibuf); - if (ibuf && use_preprocess) { + if (ibuf) { + /* duplicate frame so movie cache wouldn't be confused by sequencer's stuff */ ImBuf *i = IMB_dupImBuf(ibuf); - IMB_freeImBuf(ibuf); - ibuf = i; + + if (ibuf->rect_float) + BKE_sequencer_imbuf_to_sequencer_space(context.scene, ibuf, FALSE); + + copy_to_ibuf_still(context, seq, nr, ibuf); } - copy_to_ibuf_still(context, seq, nr, ibuf); break; } diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 4c28fe01895..f47c931e309 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -151,7 +151,7 @@ typedef struct SB_thread_context { #define SOFTGOALSNAP 0.999f /* if bp-> goal is above make it a *forced follow original* and skip all ODE stuff for this bp - * removes *unnecessary* stiffnes from ODE system + * removes *unnecessary* stiffness from ODE system */ #define HEUNWARNLIMIT 1 /* 500 would be fine i think for detecting severe *stiff* stuff */ @@ -3925,7 +3925,7 @@ static void softbody_step(Scene *scene, Object *ob, SoftBody *sb, float dtime) sst=PIL_check_seconds_timer(); /* Integration back in time is possible in theory, but pretty useless here. - * So we refuse to do so. Since we do not know anything about 'outside' canges + * So we refuse to do so. Since we do not know anything about 'outside' changes * especially colliders we refuse to go more than 10 frames. */ if (dtime < 0 || dtime > 10.5f) return; diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 1f1d609ae42..05d0705107d 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -48,6 +48,7 @@ #include "DNA_constraint_types.h" #include "DNA_controller_types.h" +#include "DNA_actuator_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_space_types.h" @@ -528,6 +529,7 @@ void BKE_text_unlink(Main *bmain, Text *text) SpaceLink *sl; Object *ob; bController *cont; + bActuator *act; bConstraint *con; short update; @@ -541,6 +543,15 @@ void BKE_text_unlink(Main *bmain, Text *text) if (pc->text == text) pc->text = NULL; } } + /* game actuators */ + for (act = ob->actuators.first; act; act = act->next) { + if (act->type == ACT_2DFILTER) { + bTwoDFilterActuator *tfa; + + tfa = act->data; + if (tfa->text == text) tfa->text = NULL; + } + } /* pyconstraints */ update = 0; diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 337f1b5d248..c9d7ec3964f 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -335,7 +335,7 @@ static void search_pixel_to_marker_unified(int frame_width, int frame_height, } /* Each marker has 5 coordinates associated with it that get warped with - * tracking: the four corners ("pattern_corners"), and the cernter ("pos"). + * tracking: the four corners ("pattern_corners"), and the center ("pos"). * This function puts those 5 points into the appropriate frame for tracking * (the "search" coordinate frame). */ @@ -455,7 +455,7 @@ void BKE_tracking_clipboard_paste_tracks(MovieTracking *tracking, MovieTrackingO /*********************** Tracks *************************/ -static void tracking_marker_insert_disabled(MovieTrackingTrack *track, MovieTrackingMarker *ref_marker, +static void tracking_marker_insert_disabled(MovieTrackingTrack *track, const MovieTrackingMarker *ref_marker, int before, int overwrite) { MovieTrackingMarker marker_new; @@ -2400,7 +2400,7 @@ static void tracking_insert_new_marker(MovieTrackingContext *context, MovieTrack * if so -- create disabled marker before currently tracking "segment" */ - tracking_marker_insert_disabled(track, &new_marker, !context->backwards, FALSE); + tracking_marker_insert_disabled(track, old_marker, !context->backwards, FALSE); } /* insert currently tracked marker */ diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index da5e7ff3db7..46836b1f8d1 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -350,7 +350,7 @@ static int unit_as_string(char *str, int len_max, double value, int prec, bUnitC /* Add unit prefix and strip zeros */ /* replace trailing zero's with spaces - * so the number is less complicated but allignment in a button wont + * so the number is less complicated but alignment in a button wont * jump about while dragging */ i = len - 1; diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c index 4019eba5177..ff1fdebb728 100644 --- a/source/blender/blenkernel/intern/writeffmpeg.c +++ b/source/blender/blenkernel/intern/writeffmpeg.c @@ -839,7 +839,7 @@ static int start_ffmpeg_impl(struct RenderData *rd, int rectx, int recty, Report * inter-frames (H.264 B-frames, for example), it can output the frames * in a different order from the one it was given. * For example, when sending frames 1, 2, 3, 4 to the encoder, it may write - * them in the order 1, 4, 2, 3 - first the two frames used for predition, + * them in the order 1, 4, 2, 3 - first the two frames used for prediction, * and then the bidirectionally-predicted frames. What this means in practice * is that the encoder may not immediately produce one output frame for each * input frame. These delayed frames must be flushed before we close the @@ -914,8 +914,7 @@ void BKE_ffmpeg_filepath_get(char *string, RenderData *rd) } while (*fe) { - if (BLI_strcasecmp(string + strlen(string) - strlen(*fe), *fe) == 0) - { + if (BLI_strcasecmp(string + strlen(string) - strlen(*fe), *fe) == 0) { break; } fe++; diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index 8a439c7cf7a..652925fbe49 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -78,6 +78,8 @@ void quat_to_mat4(float mat[4][4], const float q[4]); void mat3_to_quat(float q[4], float mat[3][3]); void mat4_to_quat(float q[4], float mat[4][4]); +void tri_to_quat_ex(float quat[4], const float v1[3], const float v2[3], const float v3[3], + const float no_orig[3]); void tri_to_quat(float q[4], const float a[3], const float b[3], const float c[3]); void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag); /* note: v1 and v2 must be normalized */ @@ -105,7 +107,7 @@ void single_axis_angle_to_mat3(float R[3][3], const char axis, const float angle /****************************** Vector/Rotation ******************************/ /* old axis angle code */ -/* TODO: the following calls should probably be depreceated sometime */ +/* TODO: the following calls should probably be deprecated sometime */ /* conversion */ void vec_rot_to_mat3(float mat[3][3], const float vec[3], const float phi); diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 167797946bc..a86783f3450 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -705,8 +705,8 @@ static void non_recursive_bvh_div_nodes(BVHTree *tree, BVHNode *branches_array, BVHNode *tmp = branches_array + 0; tmp->parent = NULL; - /*Most of bvhtree code relies on 1-leaf trees having at least one branch - *We handle that special case here */ + /* Most of bvhtree code relies on 1-leaf trees having at least one branch + * We handle that special case here */ if (num_leafs == 1) { BVHNode *root = branches_array + 0; refit_kdop_hull(tree, root, 0, num_leafs); diff --git a/source/blender/blenlib/intern/DLRB_tree.c b/source/blender/blenlib/intern/DLRB_tree.c index 930ab4fc400..858eef0b2df 100644 --- a/source/blender/blenlib/intern/DLRB_tree.c +++ b/source/blender/blenlib/intern/DLRB_tree.c @@ -364,7 +364,7 @@ static void rotate_right(DLRBT_Tree *tree, DLRBT_Node *root) root_slot = &root->parent->right; } else - root_slot = ((DLRBT_Node **)&tree->root); /* &((DLRBT_Node*)tree->root); */ + root_slot = ((DLRBT_Node **)&tree->root); /* &((DLRBT_Node *)tree->root); */ /* - pivot's right child becomes root's left child * - root now becomes pivot's right child diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index c2f0c38247a..453463beaa8 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -42,6 +42,9 @@ #include "zlib.h" #ifdef WIN32 +#ifdef __MINGW32__ +#include +#endif #include # include "BLI_winstuff.h" # include "BLI_callbacks.h" @@ -514,8 +517,9 @@ static int recursive_operation(const char *startfrom, const char *startto, Recur } if (ret != 0) { - while (i < n) - free(dirlist[i]); + while (i < n) { + free(dirlist[i++]); + } break; } } diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 53e9a6b66cb..50cef039acf 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -1387,7 +1387,7 @@ int isect_ray_aabb(const IsectRayAABBData *data, const float bb_min[3], } /* find closest point to p on line through l1,l2 and return lambda, - * where (0 <= lambda <= 1) when cp is in the line segement l1,l2 + * where (0 <= lambda <= 1) when cp is in the line segment l1,l2 */ float closest_to_line_v3(float cp[3], const float p[3], const float l1[3], const float l2[3]) { @@ -1429,7 +1429,7 @@ float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2 return (dot_v2v2(u, h) / dot_v2v2(u, u)); } -/* ensyre the distance between these points is no greater then 'dist' +/* ensure the distance between these points is no greater then 'dist' * if it is, scale then both into the center */ void limit_dist_v3(float v1[3], float v2[3], const float dist) { @@ -1672,7 +1672,7 @@ static int point_in_slice(const float p[3], const float v1[3], const float l1[3] * the room inside usually is rather small compared to R3 though still infinite * useful for restricting (speeding up) searches * e.g. all points of triangular prism are within the intersection of 3 'slices' - * onother trivial case : cube + * another trivial case : cube * but see a 'spat' which is a deformed cube with paired parallel planes needs only 3 slices too */ float h, rp[3], cp[3], q[3]; @@ -1992,8 +1992,8 @@ void barycentric_weights_v2_quad(const float v1[2], const float v2[2], const flo const float co[2], float w[4]) { /* note: fabsf() here is not needed for convex quads (and not used in interp_weights_poly_v2). - * but in the case of concave/bowtie quads for the mask rasterizer it gives unreliable results - * without adding absf(). If this becomes an issue for more general useage we could have + * but in the case of concave/bow-tie quads for the mask rasterizer it gives unreliable results + * without adding absf(). If this becomes an issue for more general usage we could have * this optional or use a different function - Campbell */ #define MEAN_VALUE_HALF_TAN_V2(_area, i1, i2) \ ((_area = cross_v2v2(dirs[i1], dirs[i2])) != 0.0f ? \ diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index e10b0b3298c..53f2c1cd0d9 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -613,13 +613,21 @@ void add_qt_qtqt(float result[4], const float quat1[4], const float quat2[4], co result[3] = quat1[3] + t * quat2[3]; } -void tri_to_quat(float quat[4], const float v1[3], const float v2[3], const float v3[3]) +/* same as tri_to_quat() but takes pre-computed normal from the triangle + * used for ngons when we know their normal */ +void tri_to_quat_ex(float quat[4], const float v1[3], const float v2[3], const float v3[3], + const float no_orig[3]) { /* imaginary x-axis, y-axis triangle is being rotated */ float vec[3], q1[4], q2[4], n[3], si, co, angle, mat[3][3], imat[3][3]; /* move z-axis to face-normal */ +#if 0 normal_tri_v3(vec, v1, v2, v3); +#else + copy_v3_v3(vec, no_orig); + (void)v3; +#endif n[0] = vec[1]; n[1] = -vec[0]; @@ -659,6 +667,13 @@ void tri_to_quat(float quat[4], const float v1[3], const float v2[3], const floa mul_qt_qtqt(quat, q1, q2); } +void tri_to_quat(float quat[4], const float v1[3], const float v2[3], const float v3[3]) +{ + float vec[3]; + normal_tri_v3(vec, v1, v2, v3); + tri_to_quat_ex(quat, v1, v2, v3, vec); +} + void print_qt(const char *str, const float q[4]) { printf("%s: %.3f %.3f %.3f %.3f\n", str, q[0], q[1], q[2], q[3]); @@ -843,7 +858,7 @@ void single_axis_angle_to_mat3(float mat[3][3], const char axis, const float ang } /****************************** Vector/Rotation ******************************/ -/* TODO: the following calls should probably be depreceated sometime */ +/* TODO: the following calls should probably be deprecated sometime */ /* TODO, replace use of this function with axis_angle_to_mat3() */ void vec_rot_to_mat3(float mat[][3], const float vec[3], const float phi) diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index f5c09791a68..17b9ed7ea8d 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -58,11 +58,11 @@ static const char trailingBytesForUTF8[256] = { int BLI_utf8_invalid_byte(const char *str, int length) { - const unsigned char *p, *pend = (unsigned char*)str + length; + const unsigned char *p, *pend = (unsigned char *)str + length; unsigned char c; int ab; - for (p = (unsigned char*)str; p < pend; p++) { + for (p = (unsigned char *)str; p < pend; p++) { c = *p; if (c < 128) continue; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 9a2a09a98ae..0f0a77ca9c1 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -1000,7 +1000,7 @@ FileData *blo_openblenderfile(const char *filepath, ReportList *reports) gzfile = BLI_gzopen(filepath, "rb"); if (gzfile == (gzFile)Z_NULL) { - BKE_reportf(reports, RPT_ERROR, "Unable to open \"%s\": %s.", filepath, errno ? strerror(errno) : "Unknown error reading file"); + BKE_reportf(reports, RPT_WARNING, "Unable to open \"%s\": %s.", filepath, errno ? strerror(errno) : "Unknown error reading file"); return NULL; } else { @@ -1018,7 +1018,7 @@ FileData *blo_openblenderfile(const char *filepath, ReportList *reports) FileData *blo_openblendermemory(void *mem, int memsize, ReportList *reports) { if (!mem || memsize"); + BKE_report(reports, RPT_WARNING, "Unable to open blend "); return NULL; } else { @@ -1720,7 +1720,7 @@ static PreviewImage *direct_link_preview_image(FileData *fd, PreviewImage *old_p /* Legacy Data Support (for Version Patching) ----------------------------- */ -// XXX depreceated - old animation system +// XXX deprecated - old animation system static void lib_link_ipo(FileData *fd, Main *main) { Ipo *ipo; @@ -1737,7 +1737,7 @@ static void lib_link_ipo(FileData *fd, Main *main) } } -// XXX depreceated - old animation system +// XXX deprecated - old animation system static void direct_link_ipo(FileData *fd, Ipo *ipo) { IpoCurve *icu; @@ -1751,7 +1751,7 @@ static void direct_link_ipo(FileData *fd, Ipo *ipo) } } -// XXX depreceated - old animation system +// XXX deprecated - old animation system static void lib_link_nlastrips(FileData *fd, ID *id, ListBase *striplist) { bActionStrip *strip; @@ -1766,7 +1766,7 @@ static void lib_link_nlastrips(FileData *fd, ID *id, ListBase *striplist) } } -// XXX depreceated - old animation system +// XXX deprecated - old animation system static void direct_link_nlastrips(FileData *fd, ListBase *strips) { bActionStrip *strip; @@ -1777,7 +1777,7 @@ static void direct_link_nlastrips(FileData *fd, ListBase *strips) link_list(fd, &strip->modifiers); } -// XXX depreceated - old animation system +// XXX deprecated - old animation system static void lib_link_constraint_channels(FileData *fd, ID *id, ListBase *chanbase) { bConstraintChannel *chan; @@ -1948,12 +1948,12 @@ static void lib_link_action(FileData *fd, Main *main) if (act->id.flag & LIB_NEED_LINK) { act->id.flag -= LIB_NEED_LINK; -// XXX depreceated - old animation system <<< +// XXX deprecated - old animation system <<< for (chan=act->chanbase.first; chan; chan=chan->next) { chan->ipo = newlibadr_us(fd, act->id.lib, chan->ipo); lib_link_constraint_channels(fd, &act->id, &chan->constraintChannels); } -// >>> XXX depreceated - old animation system +// >>> XXX deprecated - old animation system lib_link_fcurves(fd, &act->id, &act->curves); } @@ -1962,21 +1962,21 @@ static void lib_link_action(FileData *fd, Main *main) static void direct_link_action(FileData *fd, bAction *act) { - bActionChannel *achan; // XXX depreceated - old animation system + bActionChannel *achan; // XXX deprecated - old animation system bActionGroup *agrp; link_list(fd, &act->curves); - link_list(fd, &act->chanbase); // XXX depreceated - old animation system + link_list(fd, &act->chanbase); // XXX deprecated - old animation system link_list(fd, &act->groups); link_list(fd, &act->markers); -// XXX depreceated - old animation system <<< +// XXX deprecated - old animation system <<< for (achan = act->chanbase.first; achan; achan=achan->next) { achan->grp = newdataadr(fd, achan->grp); link_list(fd, &achan->constraintChannels); } -// >>> XXX depreceated - old animation system +// >>> XXX deprecated - old animation system direct_link_fcurves(fd, &act->curves); @@ -2489,7 +2489,7 @@ static void lib_link_constraints(FileData *fd, ID *id, ListBase *conlist) con->type = CONSTRAINT_TYPE_NULL; } /* own ipo, all constraints have it */ - con->ipo = newlibadr_us(fd, id->lib, con->ipo); // XXX depreceated - old animation system + con->ipo = newlibadr_us(fd, id->lib, con->ipo); // XXX deprecated - old animation system } /* relink all ID-blocks used by the constraints */ @@ -2648,7 +2648,7 @@ static void lib_link_camera(FileData *fd, Main *main) if (ca->id.flag & LIB_NEED_LINK) { if (ca->adt) lib_link_animdata(fd, &ca->id, ca->adt); - ca->ipo = newlibadr_us(fd, ca->id.lib, ca->ipo); // XXX depreceated - old animation system + ca->ipo = newlibadr_us(fd, ca->id.lib, ca->ipo); // XXX deprecated - old animation system ca->dof_ob = newlibadr_us(fd, ca->id.lib, ca->dof_ob); @@ -2684,7 +2684,7 @@ static void lib_link_lamp(FileData *fd, Main *main) } } - la->ipo = newlibadr_us(fd, la->id.lib, la->ipo); // XXX depreceated - old animation system + la->ipo = newlibadr_us(fd, la->id.lib, la->ipo); // XXX deprecated - old animation system if (la->nodetree) lib_link_ntree(fd, &la->id, la->nodetree); @@ -2741,7 +2741,7 @@ static void lib_link_key(FileData *fd, Main *main) if (key->id.flag & LIB_NEED_LINK) { if (key->adt) lib_link_animdata(fd, &key->id, key->adt); - key->ipo = newlibadr_us(fd, key->id.lib, key->ipo); // XXX depreceated - old animation system + key->ipo = newlibadr_us(fd, key->id.lib, key->ipo); // XXX deprecated - old animation system key->from = newlibadr(fd, key->id.lib, key->from); key->id.flag -= LIB_NEED_LINK; @@ -2811,7 +2811,7 @@ static void lib_link_mball(FileData *fd, Main *main) for (a = 0; a < mb->totcol; a++) mb->mat[a]= newlibadr_us(fd, mb->id.lib, mb->mat[a]); - mb->ipo = newlibadr_us(fd, mb->id.lib, mb->ipo); // XXX depreceated - old animation system + mb->ipo = newlibadr_us(fd, mb->id.lib, mb->ipo); // XXX deprecated - old animation system mb->id.flag -= LIB_NEED_LINK; } @@ -2847,7 +2847,7 @@ static void lib_link_world(FileData *fd, Main *main) if (wrld->id.flag & LIB_NEED_LINK) { if (wrld->adt) lib_link_animdata(fd, &wrld->id, wrld->adt); - wrld->ipo = newlibadr_us(fd, wrld->id.lib, wrld->ipo); // XXX depreceated - old animation system + wrld->ipo = newlibadr_us(fd, wrld->id.lib, wrld->ipo); // XXX deprecated - old animation system for (a=0; a < MAX_MTEX; a++) { mtex = wrld->mtex[a]; @@ -3048,7 +3048,7 @@ static void lib_link_curve(FileData *fd, Main *main) cu->vfonti = newlibadr_us(fd, cu->id.lib, cu->vfonti); cu->vfontbi = newlibadr_us(fd, cu->id.lib, cu->vfontbi); - cu->ipo = newlibadr_us(fd, cu->id.lib, cu->ipo); // XXX depreceated - old animation system + cu->ipo = newlibadr_us(fd, cu->id.lib, cu->ipo); // XXX deprecated - old animation system cu->key = newlibadr_us(fd, cu->id.lib, cu->key); cu->id.flag -= LIB_NEED_LINK; @@ -3348,7 +3348,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main) for (part = main->particle.first; part; part = part->id.next) { if (part->id.flag & LIB_NEED_LINK) { if (part->adt) lib_link_animdata(fd, &part->id, part->adt); - part->ipo = newlibadr_us(fd, part->id.lib, part->ipo); // XXX depreceated - old animation system + part->ipo = newlibadr_us(fd, part->id.lib, part->ipo); // XXX deprecated - old animation system part->dup_ob = newlibadr(fd, part->id.lib, part->dup_ob); part->dup_group = newlibadr(fd, part->id.lib, part->dup_group); @@ -3938,7 +3938,7 @@ static void lib_link_latt(FileData *fd, Main *main) if (lt->id.flag & LIB_NEED_LINK) { if (lt->adt) lib_link_animdata(fd, <->id, lt->adt); - lt->ipo = newlibadr_us(fd, lt->id.lib, lt->ipo); // XXX depreceated - old animation system + lt->ipo = newlibadr_us(fd, lt->id.lib, lt->ipo); // XXX deprecated - old animation system lt->key = newlibadr_us(fd, lt->id.lib, lt->key); lt->id.flag -= LIB_NEED_LINK; @@ -3992,10 +3992,10 @@ static void lib_link_object(FileData *fd, Main *main) if (ob->id.properties) IDP_LibLinkProperty(ob->id.properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); if (ob->adt) lib_link_animdata(fd, &ob->id, ob->adt); -// XXX depreceated - old animation system <<< +// XXX deprecated - old animation system <<< ob->ipo = newlibadr_us(fd, ob->id.lib, ob->ipo); ob->action = newlibadr_us(fd, ob->id.lib, ob->action); -// >>> XXX depreceated - old animation system +// >>> XXX deprecated - old animation system ob->parent = newlibadr(fd, ob->id.lib, ob->parent); ob->track = newlibadr(fd, ob->id.lib, ob->track); @@ -4074,10 +4074,10 @@ static void lib_link_object(FileData *fd, Main *main) lib_link_pose(fd, ob, ob->pose); lib_link_constraints(fd, &ob->id, &ob->constraints); -// XXX depreceated - old animation system <<< +// XXX deprecated - old animation system <<< lib_link_constraint_channels(fd, &ob->id, &ob->constraintChannels); lib_link_nlastrips(fd, &ob->id, &ob->nlastrips); -// >>> XXX depreceated - old animation system +// >>> XXX deprecated - old animation system for (paf = ob->effect.first; paf; paf = paf->next) { if (paf->type == EFF_PARTICLE) { @@ -4538,10 +4538,10 @@ static void direct_link_object(FileData *fd, Object *ob) direct_link_motionpath(fd, ob->mpath); link_list(fd, &ob->defbase); -// XXX depreceated - old animation system <<< +// XXX deprecated - old animation system <<< direct_link_nlastrips(fd, &ob->nlastrips); link_list(fd, &ob->constraintChannels); -// >>> XXX depreceated - old animation system +// >>> XXX deprecated - old animation system ob->mat= newdataadr(fd, ob->mat); test_pointer_array(fd, (void **)&ob->mat); @@ -4783,7 +4783,7 @@ static void lib_link_scene(FileData *fd, Main *main) base->object = newlibadr_us(fd, sce->id.lib, base->object); if (base->object == NULL) { - BKE_reportf_wrap(fd->reports, RPT_ERROR, + BKE_reportf_wrap(fd->reports, RPT_WARNING, "LIB ERROR: Object lost from scene:'%s\'", sce->id.name + 2); BLI_remlink(&sce->base, base); @@ -6144,7 +6144,7 @@ static void lib_link_sound(FileData *fd, Main *main) for (sound = main->sound.first; sound; sound = sound->id.next) { if (sound->id.flag & LIB_NEED_LINK) { sound->id.flag -= LIB_NEED_LINK; - sound->ipo = newlibadr_us(fd, sound->id.lib, sound->ipo); // XXX depreceated - old animation system + sound->ipo = newlibadr_us(fd, sound->id.lib, sound->ipo); // XXX deprecated - old animation system sound_load(main, sound); } @@ -8254,7 +8254,7 @@ static void lib_link_all(FileData *fd, Main *main) lib_link_material(fd, main); lib_link_texture(fd, main); lib_link_image(fd, main); - lib_link_ipo(fd, main); // XXX depreceated... still needs to be maintained for version patches still + lib_link_ipo(fd, main); // XXX deprecated... still needs to be maintained for version patches still lib_link_key(fd, main); lib_link_world(fd, main); lib_link_lamp(fd, main); @@ -8591,7 +8591,7 @@ static void expand_doit(FileData *fd, Main *mainvar, void *old) -// XXX depreceated - old animation system +// XXX deprecated - old animation system static void expand_ipo(FileData *fd, Main *mainvar, Ipo *ipo) { IpoCurve *icu; @@ -8601,7 +8601,7 @@ static void expand_ipo(FileData *fd, Main *mainvar, Ipo *ipo) } } -// XXX depreceated - old animation system +// XXX deprecated - old animation system static void expand_constraint_channels(FileData *fd, Main *mainvar, ListBase *chanbase) { bConstraintChannel *chan; @@ -8657,7 +8657,7 @@ static void expand_action(FileData *fd, Main *mainvar, bAction *act) { bActionChannel *chan; - // XXX depreceated - old animation system -------------- + // XXX deprecated - old animation system -------------- for (chan=act->chanbase.first; chan; chan=chan->next) { expand_doit(fd, mainvar, chan->ipo); expand_constraint_channels(fd, mainvar, &chan->constraintChannels); @@ -8747,7 +8747,7 @@ static void expand_group(FileData *fd, Main *mainvar, Group *group) static void expand_key(FileData *fd, Main *mainvar, Key *key) { - expand_doit(fd, mainvar, key->ipo); // XXX depreceated - old animation system + expand_doit(fd, mainvar, key->ipo); // XXX deprecated - old animation system if (key->adt) expand_animdata(fd, mainvar, key->adt); @@ -8773,7 +8773,7 @@ static void expand_nodetree(FileData *fd, Main *mainvar, bNodeTree *ntree) static void expand_texture(FileData *fd, Main *mainvar, Tex *tex) { expand_doit(fd, mainvar, tex->ima); - expand_doit(fd, mainvar, tex->ipo); // XXX depreceated - old animation system + expand_doit(fd, mainvar, tex->ipo); // XXX deprecated - old animation system if (tex->adt) expand_animdata(fd, mainvar, tex->adt); @@ -8799,7 +8799,7 @@ static void expand_material(FileData *fd, Main *mainvar, Material *ma) } } - expand_doit(fd, mainvar, ma->ipo); // XXX depreceated - old animation system + expand_doit(fd, mainvar, ma->ipo); // XXX deprecated - old animation system if (ma->adt) expand_animdata(fd, mainvar, ma->adt); @@ -8822,7 +8822,7 @@ static void expand_lamp(FileData *fd, Main *mainvar, Lamp *la) } } - expand_doit(fd, mainvar, la->ipo); // XXX depreceated - old animation system + expand_doit(fd, mainvar, la->ipo); // XXX deprecated - old animation system if (la->adt) expand_animdata(fd, mainvar, la->adt); @@ -8833,7 +8833,7 @@ static void expand_lamp(FileData *fd, Main *mainvar, Lamp *la) static void expand_lattice(FileData *fd, Main *mainvar, Lattice *lt) { - expand_doit(fd, mainvar, lt->ipo); // XXX depreceated - old animation system + expand_doit(fd, mainvar, lt->ipo); // XXX deprecated - old animation system expand_doit(fd, mainvar, lt->key); if (lt->adt) @@ -8852,7 +8852,7 @@ static void expand_world(FileData *fd, Main *mainvar, World *wrld) } } - expand_doit(fd, mainvar, wrld->ipo); // XXX depreceated - old animation system + expand_doit(fd, mainvar, wrld->ipo); // XXX deprecated - old animation system if (wrld->adt) expand_animdata(fd, mainvar, wrld->adt); @@ -8887,7 +8887,7 @@ static void expand_curve(FileData *fd, Main *mainvar, Curve *cu) expand_doit(fd, mainvar, cu->vfonti); expand_doit(fd, mainvar, cu->vfontbi); expand_doit(fd, mainvar, cu->key); - expand_doit(fd, mainvar, cu->ipo); // XXX depreceated - old animation system + expand_doit(fd, mainvar, cu->ipo); // XXX deprecated - old animation system expand_doit(fd, mainvar, cu->bevobj); expand_doit(fd, mainvar, cu->taperobj); expand_doit(fd, mainvar, cu->textoncurve); @@ -8976,10 +8976,10 @@ static void expand_constraints(FileData *fd, Main *mainvar, ListBase *lb) id_loop_constraints(lb, expand_constraint_cb, &ced); - /* depreceated manual expansion stuff */ + /* deprecated manual expansion stuff */ for (curcon = lb->first; curcon; curcon = curcon->next) { if (curcon->ipo) - expand_doit(fd, mainvar, curcon->ipo); // XXX depreceated - old animation system + expand_doit(fd, mainvar, curcon->ipo); // XXX deprecated - old animation system } } @@ -9061,7 +9061,7 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob) expand_doit(fd, mainvar, ob->gpd); -// XXX depreceated - old animation system (for version patching only) +// XXX deprecated - old animation system (for version patching only) expand_doit(fd, mainvar, ob->ipo); expand_doit(fd, mainvar, ob->action); @@ -9072,7 +9072,7 @@ static void expand_object(FileData *fd, Main *mainvar, Object *ob) expand_doit(fd, mainvar, strip->act); expand_doit(fd, mainvar, strip->ipo); } -// XXX depreceated - old animation system (for version patching only) +// XXX deprecated - old animation system (for version patching only) if (ob->adt) expand_animdata(fd, mainvar, ob->adt); @@ -9251,7 +9251,7 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce) static void expand_camera(FileData *fd, Main *mainvar, Camera *ca) { - expand_doit(fd, mainvar, ca->ipo); // XXX depreceated - old animation system + expand_doit(fd, mainvar, ca->ipo); // XXX deprecated - old animation system if (ca->adt) expand_animdata(fd, mainvar, ca->adt); @@ -9267,7 +9267,7 @@ static void expand_speaker(FileData *fd, Main *mainvar, Speaker *spk) static void expand_sound(FileData *fd, Main *mainvar, bSound *snd) { - expand_doit(fd, mainvar, snd->ipo); // XXX depreceated - old animation system + expand_doit(fd, mainvar, snd->ipo); // XXX deprecated - old animation system } static void expand_movieclip(FileData *fd, Main *mainvar, MovieClip *clip) @@ -9390,7 +9390,7 @@ static void expand_main(FileData *fd, Main *mainvar) expand_armature(fd, mainvar, (bArmature *)id); break; case ID_AC: - expand_action(fd, mainvar, (bAction *)id); // XXX depreceated - old animation system + expand_action(fd, mainvar, (bAction *)id); // XXX deprecated - old animation system break; case ID_GR: expand_group(fd, mainvar, (Group *)id); @@ -9402,7 +9402,7 @@ static void expand_main(FileData *fd, Main *mainvar) expand_brush(fd, mainvar, (Brush *)id); break; case ID_IP: - expand_ipo(fd, mainvar, (Ipo *)id); // XXX depreceated - old animation system + expand_ipo(fd, mainvar, (Ipo *)id); // XXX deprecated - old animation system break; case ID_PA: expand_particlesettings(fd, mainvar, (ParticleSettings *)id); @@ -9844,7 +9844,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) else mainptr->curlib->filedata = NULL; if (fd == NULL) { - BKE_reportf_wrap(basefd->reports, RPT_ERROR, + BKE_reportf_wrap(basefd->reports, RPT_WARNING, "Can't find lib '%s'", mainptr->curlib->filepath); } @@ -9863,7 +9863,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) append_id_part(fd, mainptr, id, &realid); if (!realid) { - BKE_reportf_wrap(fd->reports, RPT_ERROR, + BKE_reportf_wrap(fd->reports, RPT_WARNING, "LIB ERROR: %s:'%s' missing from '%s'", BKE_idcode_to_name(GS(id->name)), id->name+2, mainptr->curlib->filepath); @@ -9895,7 +9895,7 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) idn = id->next; if (id->flag & LIB_READ) { BLI_remlink(lbarray[a], id); - BKE_reportf_wrap(basefd->reports, RPT_ERROR, + BKE_reportf_wrap(basefd->reports, RPT_WARNING, "LIB ERROR: %s:'%s' unread libblock missing from '%s'", BKE_idcode_to_name(GS(id->name)), id->name + 2, mainptr->curlib->filepath); change_idid_adr(mainlist, basefd, id, NULL); diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index 734f08142b1..0d072da5327 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -665,7 +665,7 @@ void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx) /* Verts' pointers, only edge pointers... */ if (eptr_map) { BM_ITER_MESH (ve, &iter, bm, BM_VERTS_OF_MESH) { -/* printf("Vert e: %p -> %p\n", ve->e, BLI_ghash_lookup(eptr_map, (const void*)ve->e));*/ +/* printf("Vert e: %p -> %p\n", ve->e, BLI_ghash_lookup(eptr_map, (const void *)ve->e));*/ ve->e = BLI_ghash_lookup(eptr_map, (const void *)ve->e); } } @@ -675,20 +675,20 @@ void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx) if (vptr_map || eptr_map) { BM_ITER_MESH (ed, &iter, bm, BM_EDGES_OF_MESH) { if (vptr_map) { -/* printf("Edge v1: %p -> %p\n", ed->v1, BLI_ghash_lookup(vptr_map, (const void*)ed->v1));*/ -/* printf("Edge v2: %p -> %p\n", ed->v2, BLI_ghash_lookup(vptr_map, (const void*)ed->v2));*/ +/* printf("Edge v1: %p -> %p\n", ed->v1, BLI_ghash_lookup(vptr_map, (const void *)ed->v1));*/ +/* printf("Edge v2: %p -> %p\n", ed->v2, BLI_ghash_lookup(vptr_map, (const void* )ed->v2));*/ ed->v1 = BLI_ghash_lookup(vptr_map, (const void *)ed->v1); ed->v2 = BLI_ghash_lookup(vptr_map, (const void *)ed->v2); } if (eptr_map) { /* printf("Edge v1_disk_link prev: %p -> %p\n", ed->v1_disk_link.prev,*/ -/* BLI_ghash_lookup(eptr_map, (const void*)ed->v1_disk_link.prev));*/ +/* BLI_ghash_lookup(eptr_map, (const void *)ed->v1_disk_link.prev));*/ /* printf("Edge v1_disk_link next: %p -> %p\n", ed->v1_disk_link.next,*/ -/* BLI_ghash_lookup(eptr_map, (const void*)ed->v1_disk_link.next));*/ +/* BLI_ghash_lookup(eptr_map, (const void *)ed->v1_disk_link.next));*/ /* printf("Edge v2_disk_link prev: %p -> %p\n", ed->v2_disk_link.prev,*/ -/* BLI_ghash_lookup(eptr_map, (const void*)ed->v2_disk_link.prev));*/ +/* BLI_ghash_lookup(eptr_map, (const void *)ed->v2_disk_link.prev));*/ /* printf("Edge v2_disk_link next: %p -> %p\n", ed->v2_disk_link.next,*/ -/* BLI_ghash_lookup(eptr_map, (const void*)ed->v2_disk_link.next));*/ +/* BLI_ghash_lookup(eptr_map, (const void *)ed->v2_disk_link.next));*/ ed->v1_disk_link.prev = BLI_ghash_lookup(eptr_map, (const void *)ed->v1_disk_link.prev); ed->v1_disk_link.next = BLI_ghash_lookup(eptr_map, (const void *)ed->v1_disk_link.next); ed->v2_disk_link.prev = BLI_ghash_lookup(eptr_map, (const void *)ed->v2_disk_link.prev); @@ -701,15 +701,15 @@ void BM_mesh_remap(BMesh *bm, int *vert_idx, int *edge_idx, int *face_idx) BM_ITER_MESH (fa, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_ELEM (lo, &iterl, fa, BM_LOOPS_OF_FACE) { if (vptr_map) { -/* printf("Loop v: %p -> %p\n", lo->v, BLI_ghash_lookup(vptr_map, (const void*)lo->v));*/ +/* printf("Loop v: %p -> %p\n", lo->v, BLI_ghash_lookup(vptr_map, (const void *)lo->v));*/ lo->v = BLI_ghash_lookup(vptr_map, (const void *)lo->v); } if (eptr_map) { -/* printf("Loop e: %p -> %p\n", lo->e, BLI_ghash_lookup(eptr_map, (const void*)lo->e));*/ +/* printf("Loop e: %p -> %p\n", lo->e, BLI_ghash_lookup(eptr_map, (const void *)lo->e));*/ lo->e = BLI_ghash_lookup(eptr_map, (const void *)lo->e); } if (fptr_map) { -/* printf("Loop f: %p -> %p\n", lo->f, BLI_ghash_lookup(fptr_map, (const void*)lo->f));*/ +/* printf("Loop f: %p -> %p\n", lo->f, BLI_ghash_lookup(fptr_map, (const void *)lo->f));*/ lo->f = BLI_ghash_lookup(fptr_map, (const void *)lo->f); } } diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c index 1987294fc42..bb2e49d043c 100644 --- a/source/blender/bmesh/operators/bmo_connect.c +++ b/source/blender/bmesh/operators/bmo_connect.c @@ -380,8 +380,9 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op) /* compute summed length between vertices in forward direction */ len = 0.0f; - for (j = 0; j < lenv2; j++) - len += len_v3v3(vv1[clamp_index(i+j, lenv1)]->co, vv2[j]->co); + for (j = 0; j < lenv2; j++) { + len += len_v3v3(vv1[clamp_index(i + j, lenv1)]->co, vv2[j]->co); + } if (len < min) { min = len; @@ -390,8 +391,9 @@ void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op) /* compute summed length between vertices in backward direction */ len = 0.0f; - for (j = 0; j < lenv2; j++) - len += len_v3v3(vv1[clamp_index(i-j, lenv1)]->co, vv2[j]->co); + for (j = 0; j < lenv2; j++) { + len += len_v3v3(vv1[clamp_index(i - j, lenv1)]->co, vv2[j]->co); + } if (len < min) { min = len; diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index 1567455e354..519778cb638 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -1223,7 +1223,7 @@ void bmo_edgenet_prepare(BMesh *bm, BMOperator *op) v4 = BM_vert_in_edge(edges2[i - 1], edges2[i]->v1) ? edges2[i]->v2 : edges2[i]->v1; } - /* if there is ever bowtie quads between two edges the problem is here! [#30367] */ + /* if there is ever bow-tie quads between two edges the problem is here! [#30367] */ #if 0 normal_tri_v3(dvec1, v1->co, v2->co, v4->co); normal_tri_v3(dvec2, v1->co, v4->co, v3->co); diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c index 0d8b397110e..7191aa7a7b6 100644 --- a/source/blender/bmesh/operators/bmo_join_triangles.c +++ b/source/blender/bmesh/operators/bmo_join_triangles.c @@ -163,8 +163,8 @@ static int bm_edge_faces_cmp(BMesh *bm, BMEdge *e, const int do_uv, const int do }; if (lcol[0]) { - if (!compare_rgb_uchar((unsigned char*)&lcol[0]->r, (unsigned char*)&lcol[2]->r, T2QCOL_LIMIT) || - !compare_rgb_uchar((unsigned char*)&lcol[1]->r, (unsigned char*)&lcol[3]->r, T2QCOL_LIMIT)) + if (!compare_rgb_uchar((unsigned char *)&lcol[0]->r, (unsigned char *)&lcol[2]->r, T2QCOL_LIMIT) || + !compare_rgb_uchar((unsigned char *)&lcol[1]->r, (unsigned char *)&lcol[3]->r, T2QCOL_LIMIT)) { return FALSE; } diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c index 70173d942a1..30561e47d20 100644 --- a/source/blender/bmesh/operators/bmo_primitive.c +++ b/source/blender/bmesh/operators/bmo_primitive.c @@ -309,7 +309,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op) phid /= 2; for (a = 0; a <= tot; a++) { /* Going in this direction, then edge extruding, makes normals face outward */ - vec[0] = -dia *sinf(phi); + vec[0] = -dia * sinf(phi); vec[1] = 0.0; vec[2] = dia * cosf(phi); eve = BM_vert_create(bm, vec, NULL); @@ -354,7 +354,7 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op) { float len, len2, vec2[3]; - len = 2 *dia *sinf(phid / 2.0f); + len = 2 *dia * sinf(phid / 2.0f); /* length of one segment in shortest parallen */ vec[0] = dia * sinf(phid); @@ -517,16 +517,16 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op) phi = 0; if (cap_ends) { - vec[0] = vec[1] = 0.0f; - vec[2] = 0.0; + zero_v3(vec); mul_m4_v3(mat, vec); cent1 = BM_vert_create(bm, vec, NULL); + BMO_elem_flag_enable(bm, cent1, VERT_MARK); } for (a = 0; a < segs; a++, phi += phid) { /* Going this way ends up with normal(s) upward */ - vec[0] = -dia *sinf(phi); + vec[0] = -dia * sinf(phi); vec[1] = dia * cosf(phi); vec[2] = 0.0f; mul_m4_v3(mat, vec); diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index b239be1c83b..4ec3d3471e6 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -53,6 +53,9 @@ #define ELE_INNER 8 #define ELE_SPLIT 16 +/* see bug [#32665], 0.00005 means a we get face splits at a little under 1.0 degrees */ +#define FLT_FACE_SPLIT_EPSILON 0.00005 + /* * NOTE: beauty has been renamed to flag! */ @@ -823,16 +826,12 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op) /* make sure the two edges have a valid angle to each other */ if (totesel == 2 && BM_edge_share_vert_count(e1, e2)) { - float angle; - sub_v3_v3v3(vec1, e1->v2->co, e1->v1->co); sub_v3_v3v3(vec2, e2->v2->co, e2->v1->co); normalize_v3(vec1); normalize_v3(vec2); - angle = dot_v3v3(vec1, vec2); - angle = fabsf(angle); - if (fabsf(angle - 1.0f) < 0.01f) { + if (fabsf(dot_v3v3(vec1, vec2)) > 1.0f - FLT_FACE_SPLIT_EPSILON) { totesel = 0; } } diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index f29933ea0c1..4d4f26561e3 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -210,7 +210,7 @@ void DocumentImporter::finish() } - mesh_importer.optimize_material_assignements(); + mesh_importer.optimize_material_assignments(); armature_importer.set_tags_map(this->uid_tags_map); armature_importer.make_armatures(mContext); diff --git a/source/blender/collada/MeshImporter.cpp b/source/blender/collada/MeshImporter.cpp index cf211e2fbb1..47ee35f0268 100644 --- a/source/blender/collada/MeshImporter.cpp +++ b/source/blender/collada/MeshImporter.cpp @@ -1061,7 +1061,7 @@ std::vector MeshImporter::get_all_users_of(Mesh *reference_mesh) * * During import all materials have been assigned to Object. * Now we iterate over the imported objects and optimize - * the assignements as follows: + * the assignments as follows: * * for each imported geometry: * if number of users is 1: @@ -1075,7 +1075,7 @@ std::vector MeshImporter::get_all_users_of(Mesh *reference_mesh) * adjust all other users accordingly. * **/ -void MeshImporter::optimize_material_assignements() +void MeshImporter::optimize_material_assignments() { for (std::vector::iterator it = imported_objects.begin(); it != imported_objects.end(); ++it) @@ -1119,7 +1119,7 @@ void MeshImporter::optimize_material_assignements() * come along with different materials. So we first create the objects * and assign the materials to Object, then in a later cleanup we decide * which materials shall be moved to the created geometries. Also see - * optimize_material_assignements() above. + * optimize_material_assignments() above. */ MTFace *MeshImporter::assign_material_to_geom(COLLADAFW::MaterialBinding cmaterial, std::map& uid_material_map, diff --git a/source/blender/collada/MeshImporter.h b/source/blender/collada/MeshImporter.h index 2cac26d5329..746b0738108 100644 --- a/source/blender/collada/MeshImporter.h +++ b/source/blender/collada/MeshImporter.h @@ -106,10 +106,10 @@ private: #endif void set_face_uv(MTFace *mtface, UVDataWrapper &uvs, - COLLADAFW::IndexList& index_list, unsigned int *tris_indices); + COLLADAFW::IndexList& index_list, unsigned int *tris_indices); void set_face_uv(MTFace *mtface, UVDataWrapper &uvs, - COLLADAFW::IndexList& index_list, int index, bool quad); + COLLADAFW::IndexList& index_list, int index, bool quad); #ifdef COLLADA_DEBUG void print_index_list(COLLADAFW::IndexList& index_list); @@ -132,7 +132,7 @@ private: CustomData create_edge_custom_data(EdgeHash *eh); - void allocate_face_data(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris); + void allocate_face_data(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris); // TODO: import uv set names void read_faces(COLLADAFW::Mesh *mesh, Mesh *me, int new_tris); @@ -153,22 +153,22 @@ public: virtual Object *get_object_by_geom_uid(const COLLADAFW::UniqueId& geom_uid); MTex *assign_textures_to_uvlayer(COLLADAFW::TextureCoordinateBinding &ctexture, - Mesh *me, TexIndexTextureArrayMap& texindex_texarray_map, - MTex *color_texture); + Mesh *me, TexIndexTextureArrayMap& texindex_texarray_map, + MTex *color_texture); - void optimize_material_assignements(); + void optimize_material_assignments(); MTFace *assign_material_to_geom(COLLADAFW::MaterialBinding cmaterial, - std::map& uid_material_map, - Object *ob, const COLLADAFW::UniqueId *geom_uid, - MTex **color_texture, char *layername, MTFace *texture_face, - std::map& material_texture_mapping_map, short mat_index); + std::map& uid_material_map, + Object *ob, const COLLADAFW::UniqueId *geom_uid, + MTex **color_texture, char *layername, MTFace *texture_face, + std::map& material_texture_mapping_map, short mat_index); Object *create_mesh_object(COLLADAFW::Node *node, COLLADAFW::InstanceGeometry *geom, - bool isController, - std::map& uid_material_map, - std::map& material_texture_mapping_map); + bool isController, + std::map& uid_material_map, + std::map& material_texture_mapping_map); // create a mesh storing a pointer in a map so it can be retrieved later by geometry UID bool write_geometry(const COLLADAFW::Geometry* geom); diff --git a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp index bedbfc72722..33a5cafebbe 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp +++ b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp @@ -49,7 +49,8 @@ void ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_star /* add all nodes of the tree to the node list */ bNode *node = (bNode *)tree->nodes.first; while (node != NULL) { - addNode(nodes, node, isActiveGroup, system.getContext().isFastCalculation()); + Node *nnode = addNode(nodes, node, isActiveGroup, system.getContext().isFastCalculation()); + nnode->setbNodeGroup(groupnode); node = (bNode *)node->next; } diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h index bfccd069ad1..e8fd936e749 100644 --- a/source/blender/compositor/intern/COM_Node.h +++ b/source/blender/compositor/intern/COM_Node.h @@ -53,6 +53,12 @@ private: * @brief Is this node part of the active group */ bool m_inActiveGroup; + + /** + * @brief The group node this node belongs to. + * @note: used to find the links in the current subtree for muting nodes + */ + bNode* m_bNodeGroup; public: Node(bNode *editorNode, bool create_sockets = true); @@ -134,6 +140,9 @@ public: * @param socket */ OutputSocket *findOutputSocketBybNodeSocket(bNodeSocket *socket); + + inline void setbNodeGroup(bNode* group) {this->m_bNodeGroup = group;} + inline bNode* getbNodeGroup() {return this->m_bNodeGroup;} protected: void addPreviewOperation(ExecutionSystem *system, CompositorContext *context, InputSocket *inputSocket); void addPreviewOperation(ExecutionSystem *system, CompositorContext *context, OutputSocket *outputSocket); diff --git a/source/blender/compositor/nodes/COM_MuteNode.cpp b/source/blender/compositor/nodes/COM_MuteNode.cpp index eb2da147eca..1821844c6f5 100644 --- a/source/blender/compositor/nodes/COM_MuteNode.cpp +++ b/source/blender/compositor/nodes/COM_MuteNode.cpp @@ -111,11 +111,18 @@ void MuteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co if ((editorNode->flag & NODE_MUTED) && editorNode->typeinfo->internal_connect) { vector &inputsockets = this->getInputSockets(); vector relinkedsockets; - bNodeTree *editorTree = (bNodeTree *) context->getbNodeTree(); + bNodeTree *editorTree; SocketMap socketMap; ListBase intlinks; bNodeLink *link; + if (this->getbNodeGroup()) { + editorTree = (bNodeTree *) getbNodeGroup()->id; + } + else { + editorTree = (bNodeTree *) context->getbNodeTree(); + } + intlinks = editorNode->typeinfo->internal_connect(editorTree, editorNode); this->fillSocketMap(outputsockets, socketMap); diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp index 21ecfdb5272..c8b6a4ee330 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp +++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp @@ -138,8 +138,9 @@ void OutputSingleLayerOperation::deinitExecution() ibuf->mall |= IB_rectfloat; ibuf->dither = this->m_rd->dither_intensity; - IMB_display_buffer_to_imbuf_rect(ibuf, m_viewSettings, m_displaySettings); - + IMB_colormanagement_imbuf_for_write(ibuf, TRUE, FALSE, m_viewSettings, m_displaySettings, + this->m_format); + BKE_makepicstring(filename, this->m_path, bmain->name, this->m_rd->cfra, this->m_format->imtype, (this->m_rd->scemode & R_EXTENSION), true); diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 270e7fc8f90..895aaec29da 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -504,7 +504,7 @@ static int ed_markers_poll_markers_exist(bContext *C) * "custom"/third-tier invoke() callback supplied as the last arg (which would normally * be the operator's invoke() callback elsewhere) * - * < invoke_func: (fn(bContext*, wmOperator*, wmEvent*)=int) "standard" invoke function + * < invoke_func: (fn(bContext *, wmOperator *, wmEvent *)=int) "standard" invoke function * that operator would otherwise have used. If NULL, the operator's standard * exec() callback will be called instead in the appropriate places. */ diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index cb52d88f985..b8b89785e17 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -4842,7 +4842,7 @@ static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob, bone_looper(ob, arm->bonebase.first, &looper_data, bone_skinnable_cb); /* create an array of pointers to the deform groups that - * coorespond to the skinnable bones (creating them + * correspond to the skinnable bones (creating them * as necessary. */ dgrouplist = MEM_callocN(numbones * sizeof(bDeformGroup *), "dgrouplist"); dgroupflip = MEM_callocN(numbones * sizeof(bDeformGroup *), "dgroupflip"); diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 5a94d54f329..5ff4ccbd126 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -757,8 +757,8 @@ void draw_gpencil_view3d(Scene *scene, View3D *v3d, ARegion *ar, short only3d) { bGPdata *gpd; int dflag = 0; - rcti rect; RegionView3D *rv3d = ar->regiondata; + int offsx, offsy, winx, winy; /* check that we have grease-pencil stuff to draw */ gpd = gpencil_data_get_active_v3d(scene); // XXX @@ -769,19 +769,23 @@ void draw_gpencil_view3d(Scene *scene, View3D *v3d, ARegion *ar, short only3d) if ((rv3d->persp == RV3D_CAMOB) && !(G.f & G_RENDER_OGL)) { rctf rectf; ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &rectf, TRUE); /* no shift */ - BLI_rcti_rctf_copy(&rect, &rectf); + + offsx = floorf(rectf.xmin + 0.5f); + offsy = floorf(rectf.ymin + 0.5f); + winx = floorf((rectf.xmax - rectf.xmin) + 0.5f); + winy = floorf((rectf.ymax - rectf.ymin) + 0.5f); } else { - rect.xmin = 0; - rect.ymin = 0; - rect.xmax = ar->winx; - rect.ymax = ar->winy; + offsx = 0; + offsy = 0; + winx = ar->winx; + winy = ar->winy; } /* draw it! */ if (only3d) dflag |= (GP_DRAWDATA_ONLY3D | GP_DRAWDATA_NOSTATUS); - gp_draw_data(gpd, rect.xmin, rect.ymin, rect.xmax, rect.ymax, CFRA, dflag); + gp_draw_data(gpd, offsx, offsy, winx, winy, CFRA, dflag); } /* ************************************************** */ diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 8ba4985ffc4..5909c4fc270 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1736,25 +1736,32 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event) //printf("\tGP - handle modal event...\n"); - /* exit painting mode (and/or end current stroke) */ - if (ELEM5(event->type, RETKEY, PADENTER, ESCKEY, SPACEKEY, RIGHTMOUSE)) { + /* exit painting mode (and/or end current stroke) + * NOTE: cannot do RIGHTMOUSE (as is standard for cancelling) as that would break polyline [#32647] + */ + if (ELEM4(event->type, RETKEY, PADENTER, ESCKEY, SPACEKEY)) { /* exit() ends the current stroke before cleaning up */ //printf("\t\tGP - end of paint op + end of stroke\n"); p->status = GP_STATUS_DONE; estate = OPERATOR_FINISHED; } - /* toggle painting mode upon mouse-button movement */ - if (event->type == LEFTMOUSE) { + /* toggle painting mode upon mouse-button movement + * - LEFTMOUSE = standard drawing (all) / straight line drawing (all) / polyline (toolbox only) + * - RIGHTMOUSE = polyline (hotkey) / eraser (all) + * (Disabling RIGHTMOUSE case here results in bugs like [#32647]) + */ + if (ELEM(event->type, LEFTMOUSE, RIGHTMOUSE)) { /* if painting, end stroke */ if (p->status == GP_STATUS_PAINTING) { int sketch = 0; + /* basically, this should be mouse-button up = end stroke * BUT what happens next depends on whether we 'painting sessions' is enabled */ sketch |= GPENCIL_SKETCH_SESSIONS_ON(p->scene); /* polyline drawing is also 'sketching' -- all knots should be added during one session */ - sketch |= p->paintmode == GP_PAINTMODE_DRAW_POLY; + sketch |= (p->paintmode == GP_PAINTMODE_DRAW_POLY); if (sketch) { /* end stroke only, and then wait to resume painting soon */ diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 3d15f349f9b..02c7d52f08d 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -79,6 +79,7 @@ struct BMVert *EDBM_verts_mirror_get(struct BMEditMesh *em, struct BMVert *v); void EDBM_verts_mirror_cache_clear(struct BMEditMesh *em, struct BMVert *v); void EDBM_verts_mirror_cache_end(struct BMEditMesh *em); +void EDBM_mesh_ensure_valid_dm_hack(struct Scene *scene, struct BMEditMesh *em); void EDBM_mesh_normals_update(struct BMEditMesh *em); void EDBM_mesh_clear(struct BMEditMesh *em); diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index a08db8072f2..26c8b865377 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -86,7 +86,7 @@ extern struct EnumPropertyItem prop_clear_parent_types[]; extern struct EnumPropertyItem prop_make_parent_types[]; int ED_object_parent_set(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, - struct Object *par, int partype, int xmirror); + struct Object *par, int partype, int xmirror, int keep_transform); void ED_object_parent_clear(struct Object *ob, int type); struct Base *ED_object_scene_link(struct Scene *scene, struct Object *ob); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index e7c7d934f9f..010df0cbfbc 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -954,12 +954,12 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), static float polar_to_x(float center, float diam, float ampli, float angle) { - return center + diam *ampli *cosf(angle); + return center + diam *ampli * cosf(angle); } static float polar_to_y(float center, float diam, float ampli, float angle) { - return center + diam *ampli *sinf(angle); + return center + diam *ampli * sinf(angle); } static void vectorscope_draw_target(float centerx, float centery, float diam, const float colf[3]) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 593744f01e0..bfa9cc2727c 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -852,7 +852,7 @@ static void ui_add_smart_controller(bContext *C, uiBut *from, uiBut *to) RNA_pointer_create((ID *)ob, &RNA_Object, ob, &object_ptr); WM_operator_properties_create(&props_ptr, "LOGIC_OT_controller_add"); - RNA_string_set(&props_ptr, "object", ob->id.name+2); + RNA_string_set(&props_ptr, "object", ob->id.name + 2); /* (3) add a new controller */ if (WM_operator_name_call(C, "LOGIC_OT_controller_add", WM_OP_EXEC_DEFAULT, &props_ptr) & OPERATOR_FINISHED) { @@ -1368,7 +1368,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho while (TRUE) { /* XXX does not take zoom level into account */ - cdist = startx + aspect_sqrt *BLF_width(fstyle->uifont_id, origstr + but->ofs); + cdist = startx + aspect_sqrt * BLF_width(fstyle->uifont_id, origstr + but->ofs); /* check if position is found */ if (cdist < x) { @@ -4707,8 +4707,8 @@ static int ui_but_menu(bContext *C, uiBut *but) /* Property Operators */ - /*Copy Property Value - *Paste Property Value */ + /* Copy Property Value + * Paste Property Value */ if (length) { uiItemBooleanO(layout, CTX_IFACE_(BLF_I18NCONTEXT_OPERATOR_DEFAULT, "Reset All to Default Values"), diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index ded5887f7f2..1ee06b1ff64 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -915,20 +915,41 @@ static void UI_OT_editsource(wmOperatorType *ot) static void edittranslation_find_po_file(const char *root, const char *uilng, char *path, const size_t maxlen) { char tstr[32]; /* Should be more than enough! */ + /* First, full lang code. */ BLI_snprintf(tstr, sizeof(tstr), "%s.po", uilng); BLI_join_dirfile(path, maxlen, root, uilng); BLI_join_dirfile(path, maxlen, path, tstr); if (BLI_is_file(path)) return; + /* Now try without the second iso code part (_ES in es_ES). */ - strncpy(tstr, uilng, 2); - BLI_strncpy(tstr + 2, uilng + 5, sizeof(tstr) - 2); /* Because of some codes like sr_SR@latin... */ - BLI_join_dirfile(path, maxlen, root, tstr); - strcat(tstr, ".po"); - BLI_join_dirfile(path, maxlen, path, tstr); - if (BLI_is_file(path)) - return; + { + char *tc = NULL; + size_t szt = 0; + tstr[0] = '\0'; + + tc = strchr(uilng, '_'); + if (tc) { + szt = tc - uilng; + if (szt < sizeof(tstr)) /* Paranoid, should always be true! */ + BLI_strncpy(tstr, uilng, szt + 1); /* +1 for '\0' char! */ + } + if (tstr[0]) { + /* Because of some codes like sr_SR@latin... */ + tc = strchr(uilng, '@'); + if (tc) + BLI_strncpy(tstr + szt, tc, sizeof(tstr) - szt); + + BLI_join_dirfile(path, maxlen, root, tstr); + strcat(tstr, ".po"); + BLI_join_dirfile(path, maxlen, path, tstr); + if (BLI_is_file(path)) + return; + } + } + + /* Else no po file! */ path[0] = '\0'; } @@ -967,7 +988,7 @@ static int edittranslation_exec(bContext *C, wmOperator *op) } /* Try to find a valid po file for current language... */ edittranslation_find_po_file(root, uilng, popath, FILE_MAX); - printf("po path: %s\n", popath); +/* printf("po path: %s\n", popath);*/ if (popath[0] == '\0') { BKE_reportf(op->reports, RPT_ERROR, "No valid po found for language '%s' under %s.", uilng, root); return OPERATOR_CANCELLED; @@ -1021,14 +1042,6 @@ static int edittranslation_exec(bContext *C, wmOperator *op) } } -#if 0 -static int edittranslation_poll(bContext *UNUSED(C)) -{ - /* We need the i18n py addon to be enabled! */ - return WM_operatortype_find(EDTSRC_I18N_OP_NAME, 0) ? TRUE : FALSE; -} -#endif - static void UI_OT_edittranslation_init(wmOperatorType *ot) { /* identifiers */ @@ -1038,7 +1051,6 @@ static void UI_OT_edittranslation_init(wmOperatorType *ot) /* callbacks */ ot->exec = edittranslation_exec; -/* ot->poll = edittranslation_poll;*/ } #endif /* WITH_PYTHON */ diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index adf839d433b..605233cd96f 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -152,7 +152,7 @@ static void menudata_free(MenuData *md) * if %xNN is given then NN is the return value if * that option is selected otherwise the return value * is the index of the option (starting with 1). %l - * indicates a seperator, sss%l indicates a label and + * indicates a separator, sss%l indicates a label and * new column. * * \param str String to be parsed. @@ -2083,7 +2083,7 @@ static void square_picker(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, in /* a HS circle, V slider, rgb/hsv/hex sliders */ -static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, PropertyRNA *prop) +static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, PropertyRNA *prop, int show_picker) { static short colormode = 0; /* temp? 0=rgb, 1=hsv, 2=hex */ uiBut *bt; @@ -2144,8 +2144,10 @@ static void uiBlockPicker(uiBlock *block, float rgba[4], PointerRNA *ptr, Proper uiButSetFunc(bt, do_picker_new_mode_cb, bt, NULL); uiBlockEndAlign(block); - bt = uiDefIconButO(block, BUT, "UI_OT_eyedropper", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, butwidth + 10, -60, UI_UNIT_X, UI_UNIT_Y, NULL); - uiButSetFunc(bt, close_popup_cb, bt, NULL); + if (show_picker) { + bt = uiDefIconButO(block, BUT, "UI_OT_eyedropper", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, butwidth + 10, -60, UI_UNIT_X, UI_UNIT_Y, NULL); + uiButSetFunc(bt, close_popup_cb, bt, NULL); + } /* RGB values */ uiBlockBeginAlign(block); @@ -2230,6 +2232,7 @@ uiBlock *ui_block_func_COLOR(bContext *C, uiPopupBlockHandle *handle, void *arg_ { uiBut *but = arg_but; uiBlock *block; + int show_picker = TRUE; block = uiBeginBlock(C, handle->region, __func__, UI_EMBOSS); @@ -2238,12 +2241,20 @@ uiBlock *ui_block_func_COLOR(bContext *C, uiPopupBlockHandle *handle, void *arg_ block->color_profile = FALSE; } } + + if (but->block) { + /* if color block is invoked from a popup we wouldn't be able to set color properly + * this is because color picker will close popups first and then will try to figure + * out active button RNA, and of course it'll fail + */ + show_picker = (but->block->flag & UI_BLOCK_POPUP) == 0; + } uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT); copy_v3_v3(handle->retvec, but->editvec); - uiBlockPicker(block, handle->retvec, &but->rnapoin, but->rnaprop); + uiBlockPicker(block, handle->retvec, &but->rnapoin, but->rnaprop, show_picker); block->flag = UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_KEEP_OPEN | UI_BLOCK_OUT_1; uiBoundsBlock(block, 10); diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 37503acfeb0..9a41d32e8ca 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1750,11 +1750,11 @@ static void curvemap_buttons_redraw(bContext *C, void *UNUSED(arg1), void *UNUSE ED_region_tag_redraw(CTX_wm_region(C)); } -static void curvemap_buttons_update(bContext *UNUSED(C), void *UNUSED(arg1), void *cumap_v) +static void curvemap_buttons_update(bContext *C, void *arg1_v, void *cumap_v) { CurveMapping *cumap = cumap_v; - curvemapping_changed(cumap, TRUE); + rna_update_cb(C, arg1_v, NULL); } static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v) @@ -1901,9 +1901,9 @@ static void curvemap_buttons_layout(uiLayout *layout, PointerRNA *ptr, char labe if (cmp) { uiLayoutRow(layout, TRUE); - uiBlockSetNFunc(block, curvemap_buttons_update, NULL, cumap); - uiDefButF(block, NUM, 0, "X", 0, 2 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, &cmp->x, 0.0f, 1.0f, 1, 5, ""); - uiDefButF(block, NUM, 0, "Y", 0, 1 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, &cmp->y, 0.0f, 1.0f, 1, 5, ""); + uiBlockSetNFunc(block, curvemap_buttons_update, MEM_dupallocN(cb), cumap); + bt = uiDefButF(block, NUM, 0, "X", 0, 2 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, &cmp->x, 0.0f, 1.0f, 1, 5, ""); + bt = uiDefButF(block, NUM, 0, "Y", 0, 1 * UI_UNIT_Y, UI_UNIT_X * 10, UI_UNIT_Y, &cmp->y, 0.0f, 1.0f, 1, 5, ""); } /* black/white levels */ diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index f3539af821e..87a7d1957c5 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1014,42 +1014,42 @@ static void ui_text_clip_cursor(uiFontStyle *fstyle, uiBut *but, rcti *rect) if (fstyle->kerning == 1) /* for BLF_width */ BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT); - if ((but->strwidth = BLF_width(fstyle->uifont_id, but->drawstr)) <= okwidth) { + /* define ofs dynamically */ + if (but->ofs > but->pos) + but->ofs = but->pos; + + if (BLF_width(fstyle->uifont_id, but->drawstr) <= okwidth) but->ofs = 0; - } - else { - /* define ofs dynamically */ - if (but->ofs > but->pos) - but->ofs = but->pos; - while (but->strwidth > okwidth) { - float width; - char buf[UI_MAX_DRAW_STR]; + but->strwidth = BLF_width(fstyle->uifont_id, but->drawstr + but->ofs); - /* copy draw string */ - BLI_strncpy_utf8(buf, but->drawstr, sizeof(buf)); - /* string position of cursor */ - buf[but->pos] = 0; - width = BLF_width(fstyle->uifont_id, buf + but->ofs); + while (but->strwidth > okwidth) { + float width; + char buf[UI_MAX_DRAW_STR]; - /* if cursor is at 20 pixels of right side button we clip left */ - if (width > okwidth - 20) { - ui_text_clip_give_next_off(but); - } - else { - int len, bytes; - /* shift string to the left */ - if (width < 20 && but->ofs > 0) - ui_text_clip_give_prev_off(but); - len = strlen(but->drawstr); - bytes = BLI_str_utf8_size(BLI_str_find_prev_char_utf8(but->drawstr, but->drawstr + len)); - but->drawstr[len - bytes] = 0; - } + /* copy draw string */ + BLI_strncpy_utf8(buf, but->drawstr, sizeof(buf)); + /* string position of cursor */ + buf[but->pos] = 0; + width = BLF_width(fstyle->uifont_id, buf + but->ofs); - but->strwidth = BLF_width(fstyle->uifont_id, but->drawstr + but->ofs); - - if (but->strwidth < 10) break; + /* if cursor is at 20 pixels of right side button we clip left */ + if (width > okwidth - 20) { + ui_text_clip_give_next_off(but); } + else { + int len, bytes; + /* shift string to the left */ + if (width < 20 && but->ofs > 0) + ui_text_clip_give_prev_off(but); + len = strlen(but->drawstr); + bytes = BLI_str_utf8_size(BLI_str_find_prev_char_utf8(but->drawstr, but->drawstr + len)); + but->drawstr[len - bytes] = 0; + } + + but->strwidth = BLF_width(fstyle->uifont_id, but->drawstr + but->ofs); + + if (but->strwidth < 10) break; } if (fstyle->kerning == 1) { diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 1d0cd2707ac..a964052cc23 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -907,6 +907,7 @@ void ui_theme_init_default(void) rgba_char_args_set(btheme->tnode.syntaxb, 108, 105, 111, 255); /* operator */ rgba_char_args_set(btheme->tnode.syntaxv, 104, 106, 117, 255); /* generator */ rgba_char_args_set(btheme->tnode.syntaxc, 105, 117, 110, 255); /* group */ + rgba_char_args_set(btheme->tnode.movie, 155, 155, 155, 160); /* frame */ btheme->tnode.noodle_curving = 5; /* space logic */ @@ -1940,6 +1941,18 @@ void init_userdef_do_versions(void) } } + if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 22)) { + bTheme *btheme; + + for (btheme = U.themes.first; btheme; btheme = btheme->next) { + if (btheme->tipo.lastsel_point[3] == 0) + rgba_char_args_set(btheme->tipo.lastsel_point, 0xff, 0xff, 0xff, 255); + + if (btheme->tv3d.skin_root[3] == 0) + rgba_char_args_set(btheme->tv3d.skin_root, 180, 77, 77, 255); + } + } + /* Freestyle color settings */ { bTheme *btheme; @@ -1988,7 +2001,10 @@ void init_userdef_do_versions(void) } if (U.ndof_orbit_sensitivity == 0.0f) { - U.ndof_orbit_sensitivity = 1.0f; + U.ndof_orbit_sensitivity = U.ndof_sensitivity; + + if (!(U.flag & USER_TRACKBALL)) + U.ndof_flag |= NDOF_TURNTABLE; } if (U.tweak_threshold == 0) U.tweak_threshold = 10; diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 3d3f309a8d4..5ac20829480 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -849,12 +849,12 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op) float mval_faci = 1.0f - mval_fac; float ofs = (mval_fac * dx) - (mval_faci * dx); - v2d->cur.xmin += ofs + dx; - v2d->cur.xmax += ofs - dx; + v2d->cur.xmin += ofs - dx; + v2d->cur.xmax += ofs + dx; } else { - v2d->cur.xmin += dx; - v2d->cur.xmax -= dx; + v2d->cur.xmin -= dx; + v2d->cur.xmax += dx; } } } @@ -868,12 +868,12 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op) float mval_faci = 1.0f - mval_fac; float ofs = (mval_fac * dy) - (mval_faci * dy); - v2d->cur.ymin += ofs + dy; - v2d->cur.ymax += ofs - dy; + v2d->cur.ymin += ofs - dy; + v2d->cur.ymax += ofs + dy; } else { - v2d->cur.ymin += dy; - v2d->cur.ymax -= dy; + v2d->cur.ymin -= dy; + v2d->cur.ymax += dy; } } } @@ -1044,8 +1044,14 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event) } /* set transform amount, and add current deltas to stored total delta (for redo) */ - RNA_float_set(op->ptr, "deltax", dx); - RNA_float_set(op->ptr, "deltay", dy); + if (U.uiflag & USER_ZOOM_INVERT) { + RNA_float_set(op->ptr, "deltax", -dx); + RNA_float_set(op->ptr, "deltay", -dy); + } + else { + RNA_float_set(op->ptr, "deltax", dx); + RNA_float_set(op->ptr, "deltay", dy); + } vzd->dx += dx; vzd->dy += dy; @@ -1273,11 +1279,10 @@ void UI_view2d_smooth_view(bContext *C, ARegion *ar, } if (C && U.smooth_viewtx && fac > FLT_EPSILON) { - int changed = 0; /* zero means no difference */ + int changed = FALSE; if (BLI_rctf_compare(&sms.new_cur, &v2d->cur, FLT_EPSILON) == FALSE) - changed = 1; - changed=1; + changed = TRUE; /* The new view is different from the old one * so animate the view */ @@ -1479,6 +1484,7 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event, View2DScrollers *scrollers; ARegion *ar = CTX_wm_region(C); View2D *v2d = &ar->v2d; + rctf tot_cur_union; float mask_size; /* set custom-data for operator */ @@ -1498,14 +1504,20 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event, */ scrollers = UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY); + /* use a union of 'cur' & 'tot' incase the current view is far outside 'tot'. + * In this cases moving the scroll bars has far too little effect and the view can get stuck [#31476] */ + tot_cur_union = v2d->tot; + BLI_rctf_union(&tot_cur_union, &v2d->cur); if (in_scroller == 'h') { /* horizontal scroller - calculate adjustment factor first */ mask_size = (float)BLI_rcti_size_x(&v2d->hor); - vsm->fac = BLI_rctf_size_x(&v2d->tot) / mask_size; + vsm->fac = BLI_rctf_size_x(&tot_cur_union) / mask_size; /* get 'zone' (i.e. which part of scroller is activated) */ - vsm->zone = mouse_in_scroller_handle(event->mval[0], v2d->hor.xmin, v2d->hor.xmax, scrollers->hor_min, scrollers->hor_max); + vsm->zone = mouse_in_scroller_handle(event->mval[0], + v2d->hor.xmin, v2d->hor.xmax, + scrollers->hor_min, scrollers->hor_max); if ((v2d->keepzoom & V2D_LOCKZOOM_X) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) { /* default to scroll, as handles not usable */ @@ -1518,10 +1530,12 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event, else { /* vertical scroller - calculate adjustment factor first */ mask_size = (float)BLI_rcti_size_y(&v2d->vert); - vsm->fac = BLI_rctf_size_y(&v2d->tot) / mask_size; + vsm->fac = BLI_rctf_size_y(&tot_cur_union) / mask_size; /* get 'zone' (i.e. which part of scroller is activated) */ - vsm->zone = mouse_in_scroller_handle(event->mval[1], v2d->vert.ymin, v2d->vert.ymax, scrollers->vert_min, scrollers->vert_max); + vsm->zone = mouse_in_scroller_handle(event->mval[1], + v2d->vert.ymin, v2d->vert.ymax, + scrollers->vert_min, scrollers->vert_max); if ((v2d->keepzoom & V2D_LOCKZOOM_Y) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) { /* default to scroll, as handles not usable */ @@ -1529,7 +1543,7 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event, } vsm->scrollbarwidth = scrollers->vert_max - scrollers->vert_min; - vsm->scrollbar_orig = ((scrollers->vert_max + scrollers->vert_min) / 2) + +ar->winrct.ymin; + vsm->scrollbar_orig = ((scrollers->vert_max + scrollers->vert_min) / 2) + ar->winrct.ymin; } UI_view2d_scrollers_free(scrollers); diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c index 39a19bdaa5f..18384ad9de4 100644 --- a/source/blender/editors/mask/mask_edit.c +++ b/source/blender/editors/mask/mask_edit.c @@ -436,8 +436,8 @@ void ED_keymap_mask(wmKeyConfig *keyconf) ED_keymap_proportional_maskmode(keyconf, keymap); /* geometry */ - WM_keymap_add_item(keymap, "MASK_OT_add_vertex_slide", LEFTMOUSE, KM_PRESS, KM_CTRL, 0); - WM_keymap_add_item(keymap, "MASK_OT_add_feather_vertex_slide", LEFTMOUSE, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_item(keymap, "MASK_OT_add_vertex_slide", ACTIONMOUSE, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "MASK_OT_add_feather_vertex_slide", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "MASK_OT_delete", XKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "MASK_OT_delete", DELKEY, KM_PRESS, 0, 0); @@ -486,7 +486,7 @@ void ED_keymap_mask(wmKeyConfig *keyconf) /* shape */ WM_keymap_add_item(keymap, "MASK_OT_cyclic_toggle", CKEY, KM_PRESS, KM_ALT, 0); - WM_keymap_add_item(keymap, "MASK_OT_slide_point", LEFTMOUSE, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "MASK_OT_slide_point", ACTIONMOUSE, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "MASK_OT_handle_type_set", VKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "MASK_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0); // WM_keymap_add_item(keymap, "MASK_OT_feather_weight_clear", SKEY, KM_PRESS, KM_ALT, 0); diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c index ace427f65ab..55bad39f4f2 100644 --- a/source/blender/editors/mask/mask_select.c +++ b/source/blender/editors/mask/mask_select.c @@ -148,7 +148,7 @@ void ED_mask_select_toggle_all(Mask *mask, int action) } if (action == SEL_INVERT) { - /* we don't have generic functons for this, its restricted to this operator + /* we don't have generic functions for this, its restricted to this operator * if one day we need to re-use such functionality, they can be split out */ MaskSpline *spline; diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 1dcbf574b44..790fd0a7cf1 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -566,7 +566,9 @@ static int find_connected_linehit(KnifeTool_OpData *kcd, int testi, BMFace *f, i if (testi >= 0 && testi < kcd->totlinehit) { if (knife_find_common_face(&kcd->linehits[testi].kfe->faces, &kcd->linehits[i].kfe->faces)) + { return i; + } } else if (f) { if (find_ref(&kcd->linehits[i].kfe->faces, f)) @@ -1156,7 +1158,7 @@ static BMEdgeHit *knife_edge_tri_isect(KnifeTool_OpData *kcd, BMBVHTree *bmtree, /* for comparing distances, error of intersection depends on triangle scale. * need to scale down before squaring for accurate comparison */ - const float depsilon = 50 *FLT_EPSILON *len_v3_tri_side_max(v1, v2, v3); + const float depsilon = 50 *FLT_EPSILON * len_v3_tri_side_max(v1, v2, v3); const float depsilon_squared = depsilon * depsilon; copy_v3_v3(cos + 0, v1); diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 8b13cc61d3e..c0a36e24015 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -373,11 +373,12 @@ static void ringsel_exit(bContext *UNUSED(C), wmOperator *op) op->customdata = NULL; } + /* called when modal loop selection gets set up... */ static int ringsel_init(bContext *C, wmOperator *op, int do_cut) { RingSelOpData *lcd; - + /* alloc new customdata */ lcd = op->customdata = MEM_callocN(sizeof(RingSelOpData), "ringsel Modal Op Data"); @@ -392,7 +393,10 @@ static int ringsel_init(bContext *C, wmOperator *op, int do_cut) initNumInput(&lcd->num); lcd->num.idx_max = 0; lcd->num.flag |= NUM_NO_NEGATIVE | NUM_NO_FRACTION; - + + /* XXX, temp, workaround for [# ] */ + EDBM_mesh_ensure_valid_dm_hack(CTX_data_scene(C), lcd->em); + em_setup_viewcontext(C, &lcd->vc); ED_region_tag_redraw(lcd->ar); diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index b844ba0baa2..537d463dfbc 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -48,6 +48,8 @@ #include "BKE_report.h" #include "BKE_tessmesh.h" +#include "BKE_object.h" /* XXX. only for EDBM_mesh_ensure_valid_dm_hack() which will be removed */ + #include "WM_api.h" #include "WM_types.h" @@ -102,7 +104,17 @@ void EDBM_redo_state_free(BMBackup *backup, BMEditMesh *em, int recalctess) BMEdit_RecalcTessellation(em); } - +/* hack to workaround multiple operators being called within the same event loop without an update + * see: [#31811] */ +void EDBM_mesh_ensure_valid_dm_hack(Scene *scene, BMEditMesh *em) +{ + if ((((ID *)em->ob->data)->flag & LIB_ID_RECALC) || + (em->ob->recalc & OB_RECALC_DATA)) + { + em->ob->recalc |= OB_RECALC_DATA; /* since we may not have done selection flushing */ + BKE_object_handle_update(scene, em->ob); + } +} void EDBM_mesh_normals_update(BMEditMesh *em) { diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index a52c8d47ecd..4637d926a62 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -760,12 +760,17 @@ static int mesh_customdata_clear_exec__internal(bContext *C, BLI_assert(CustomData_layertype_is_singleton(type) == TRUE); - CustomData_free_layers(data, type, tot); + if (CustomData_has_layer(data, type)) { + CustomData_free_layers(data, type, tot); - DAG_id_tag_update(&me->id, 0); - WM_event_add_notifier(C, NC_GEOM | ND_DATA, me); + DAG_id_tag_update(&me->id, 0); + WM_event_add_notifier(C, NC_GEOM | ND_DATA, me); - return OPERATOR_FINISHED; + return OPERATOR_FINISHED; + } + else { + return OPERATOR_CANCELLED; + } } /* Clear Mask */ @@ -785,13 +790,27 @@ static int mesh_customdata_clear_mask_poll(bContext *C) if (CustomData_has_layer(data, CD_PAINT_MASK)) { return TRUE; } + data = GET_CD_DATA(me, ldata); + if (CustomData_has_layer(data, CD_GRID_PAINT_MASK)) { + return TRUE; + } } } return FALSE; } static int mesh_customdata_clear_mask_exec(bContext *C, wmOperator *UNUSED(op)) { - return mesh_customdata_clear_exec__internal(C, BM_VERT, CD_PAINT_MASK); + int ret_a = mesh_customdata_clear_exec__internal(C, BM_VERT, CD_PAINT_MASK); + int ret_b = mesh_customdata_clear_exec__internal(C, BM_LOOP, CD_GRID_PAINT_MASK); + + if (ret_a == OPERATOR_FINISHED || + ret_b == OPERATOR_FINISHED) + { + return OPERATOR_FINISHED; + } + else { + return OPERATOR_CANCELLED; + } } void MESH_OT_customdata_clear_mask(wmOperatorType *ot) diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index f2b7a2e9c22..ef826c07cc1 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -400,7 +400,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) fp1 = ((float *)kb->data) + (vertofs * 3); /* check if this was one of the original shapekeys */ - okb = BKE_keyblock_find_name(nkey, kb->name); + okb = nkey ? BKE_keyblock_find_name(nkey, kb->name) : NULL; if (okb) { /* copy this mesh's shapekey to the destination shapekey */ fp2 = ((float *)(okb->data)); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index f95a186990e..bdc7699ee96 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -957,7 +957,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) base->object->softflag = ob->softflag; if (base->object->soft) sbFree(base->object->soft); - base->object->soft = copy_softbody(ob->soft); + base->object->soft = copy_softbody(ob->soft, FALSE); if (!modifiers_findByType(base->object, eModifierType_Softbody)) { BLI_addhead(&base->object->modifiers, modifier_new(eModifierType_Softbody)); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index cafc7ce9300..446c0a51ed5 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -525,7 +525,7 @@ EnumPropertyItem prop_make_parent_types[] = { }; int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object *ob, Object *par, - int partype, int xmirror) + int partype, int xmirror, int keep_transform) { bPoseChannel *pchan = NULL; int pararm = ELEM4(partype, PAR_ARMATURE, PAR_ARMATURE_NAME, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO); @@ -577,10 +577,14 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object } else { Object workob; - + /* apply transformation of previous parenting */ - /* BKE_object_apply_mat4(ob, ob->obmat); */ /* removed because of bug [#23577] */ - + if (keep_transform) { + /* was removed because of bug [#23577], + * but this can be handy in some cases too [#32616], so make optional */ + BKE_object_apply_mat4(ob, ob->obmat, FALSE, FALSE); + } + /* set the parent (except for follow-path constraint option) */ if (partype != PAR_PATH_CONST) { ob->parent = par; @@ -682,11 +686,12 @@ static int parent_set_exec(bContext *C, wmOperator *op) Object *par = ED_object_active_context(C); int partype = RNA_enum_get(op->ptr, "type"); int xmirror = RNA_boolean_get(op->ptr, "xmirror"); + int keep_transform = RNA_boolean_get(op->ptr, "keep_transform"); int ok = 1; CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects) { - if (!ED_object_parent_set(op->reports, bmain, scene, ob, par, partype, xmirror)) { + if (!ED_object_parent_set(op->reports, bmain, scene, ob, par, partype, xmirror, keep_transform)) { ok = 0; break; } @@ -710,25 +715,36 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSE Object *ob = ED_object_active_context(C); uiPopupMenu *pup = uiPupMenuBegin(C, "Set Parent To", ICON_NONE); uiLayout *layout = uiPupMenuLayout(pup); - - uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); - uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_OBJECT); - + + wmOperatorType *ot = WM_operatortype_find("OBJECT_OT_parent_set", TRUE); + PointerRNA opptr; + +#if 0 + uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_OBJECT); +#else + opptr = uiItemFullO_ptr(layout, ot, "Object", ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); + RNA_enum_set(&opptr, "type", PAR_OBJECT); + RNA_boolean_set(&opptr, "keep_transform", FALSE); + + opptr = uiItemFullO_ptr(layout, ot, "Object (Keep Transform)", ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); + RNA_enum_set(&opptr, "type", PAR_OBJECT); + RNA_boolean_set(&opptr, "keep_transform", TRUE); +#endif /* ob becomes parent, make the associated menus */ if (ob->type == OB_ARMATURE) { - uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_ARMATURE); - uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_ARMATURE_NAME); - uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_ARMATURE_ENVELOPE); - uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_ARMATURE_AUTO); - uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_BONE); + uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE); + uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_NAME); + uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_ENVELOPE); + uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_AUTO); + uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_BONE); } else if (ob->type == OB_CURVE) { - uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_CURVE); - uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_FOLLOW); - uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_PATH_CONST); + uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_CURVE); + uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_FOLLOW); + uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_PATH_CONST); } else if (ob->type == OB_LATTICE) { - uiItemEnumO(layout, "OBJECT_OT_parent_set", NULL, 0, "type", PAR_LATTICE); + uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_LATTICE); } uiPupMenuEnd(C, pup); @@ -783,6 +799,9 @@ void OBJECT_OT_parent_set(wmOperatorType *ot) RNA_def_enum(ot->srna, "type", prop_make_parent_types, 0, "Type", ""); RNA_def_boolean(ot->srna, "xmirror", FALSE, "X Mirror", "Apply weights symmetrically along X axis, for Envelope/Automatic vertex groups creation"); + RNA_def_boolean(ot->srna, "keep_transform", FALSE, "Keep Transform", + "Apply transformation before parenting"); + } /* ************ Make Parent Without Inverse Operator ******************* */ @@ -1275,6 +1294,9 @@ static int make_links_scene_exec(bContext *C, wmOperator *op) DAG_ids_flush_update(bmain, 0); + /* redraw the 3D view because the object center points are colored differently */ + WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL); + /* one day multiple scenes will be visible, then we should have some update function for them */ return OPERATOR_FINISHED; } diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index ff7f33f6107..4ed14c3cdce 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -198,7 +198,7 @@ enum { }; static EnumPropertyItem prop_select_linked_types[] = { - //{OBJECT_SELECT_LINKED_IPO, "IPO", 0, "Object IPO", ""}, // XXX depreceated animation system stuff... + //{OBJECT_SELECT_LINKED_IPO, "IPO", 0, "Object IPO", ""}, // XXX deprecated animation system stuff... {OBJECT_SELECT_LINKED_OBDATA, "OBDATA", 0, "Object Data", ""}, {OBJECT_SELECT_LINKED_MATERIAL, "MATERIAL", 0, "Material", ""}, {OBJECT_SELECT_LINKED_TEXTURE, "TEXTURE", 0, "Texture", ""}, diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 72bbcda2b5e..ea6f9d4cebb 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -328,7 +328,7 @@ void PE_hide_keys_time(Scene *scene, PTCacheEdit *edit, float cfra) static int pe_x_mirror(Object *ob) { if (ob->type == OB_MESH) - return (((Mesh*)ob->data)->editflag & ME_EDIT_MIRROR_X); + return (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_X); return 0; } @@ -2602,7 +2602,7 @@ void PARTICLE_OT_delete(wmOperatorType *ot) static void PE_mirror_x(Scene *scene, Object *ob, int tagged) { - Mesh *me= (Mesh*)(ob->data); + Mesh *me= (Mesh *)(ob->data); ParticleSystemModifierData *psmd; PTCacheEdit *edit= PE_get_current(scene, ob); ParticleSystem *psys = edit->psys; @@ -3379,7 +3379,7 @@ static int brush_add(PEData *data, short number) ppa= psys->particles+ptn[0].index; for (k=0; ktotaddkey; k++) { - thkey= (HairKey*)pa->hair + k; + thkey= (HairKey *)pa->hair + k; thkey->time= pa->time + k * framestep; key3[0].time= thkey->time/ 100.0f; @@ -4139,7 +4139,7 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache, return; if (!edit) { - totpoint = psys ? psys->totpart : (int)((PTCacheMem*)cache->mem_cache.first)->totpoint; + totpoint = psys ? psys->totpart : (int)((PTCacheMem *)cache->mem_cache.first)->totpoint; edit= MEM_callocN(sizeof(PTCacheEdit), "PE_create_particle_edit"); edit->points=MEM_callocN(totpoint*sizeof(PTCacheEditPoint), "PTCacheEditPoints"); diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index d9618e89b68..85ae923f881 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -547,11 +547,11 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) if (ibuf) { int needs_free = FALSE; - if (is_movie || !BKE_imtype_supports_float(scene->r.im_format.imtype)) { - ImBuf *colormanage_ibuf = IMB_dupImBuf(ibuf); + if (is_movie || !BKE_imtype_requires_linear_float(scene->r.im_format.imtype)) { + ImBuf *colormanage_ibuf; - IMB_display_buffer_to_imbuf_rect(colormanage_ibuf, &scene->view_settings, &scene->display_settings); - imb_freerectfloatImBuf(colormanage_ibuf); + colormanage_ibuf = IMB_colormanagement_imbuf_for_write(ibuf, TRUE, TRUE, &scene->view_settings, + &scene->display_settings, &scene->r.im_format); // IMB_freeImBuf(ibuf); /* owned by the image */ ibuf = colormanage_ibuf; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index b8e365c4c8e..c6aaae6b879 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -2320,7 +2320,7 @@ static int IsectPoly2Df_twoside(const float pt[2], float uv[][2], const int tot) return 1; } -/* One of the most important function for projectiopn painting, since it selects the pixels to be added into each bucket. +/* One of the most important function for projection painting, since it selects the pixels to be added into each bucket. * initialize pixels from this face where it intersects with the bucket_index, optionally initialize pixels for removing seams */ static void project_paint_face_init(const ProjPaintState *ps, const int thread_index, const int bucket_index, const int face_index, const int image_index, rctf *bucket_bounds, const ImBuf *ibuf, const short clamp_u, const short clamp_v) { @@ -5366,7 +5366,7 @@ void ED_space_image_paint_update(wmWindowManager *wm, ToolSettings *settings) for (win = wm->windows.first; win; win = win->next) for (sa = win->screen->areabase.first; sa; sa = sa->next) if (sa->spacetype == SPACE_IMAGE) - if (((SpaceImage*)sa->spacedata.first)->mode == SI_MODE_PAINT) + if (((SpaceImage *)sa->spacedata.first)->mode == SI_MODE_PAINT) enabled = TRUE; if (enabled) { diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index bb2b4b8c743..25555f2526f 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -108,7 +108,7 @@ static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNo /* shape key has been changed before calling undo operator */ Key *key = BKE_key_from_object(ob); - KeyBlock *kb = BKE_keyblock_find_name(key, unode->shapeName); + KeyBlock *kb = key ? BKE_keyblock_find_name(key, unode->shapeName) : NULL; if (kb) { ob->shapenr = BLI_findindex(&key->block, kb) + 1; @@ -266,13 +266,15 @@ static void sculpt_undo_restore(bContext *C, ListBase *lb) Scene *scene = CTX_data_scene(C); Sculpt *sd = CTX_data_tool_settings(C)->sculpt; Object *ob = CTX_data_active_object(C); - DerivedMesh *dm = mesh_get_derived_final(scene, ob, 0); + DerivedMesh *dm; SculptSession *ss = ob->sculpt; SculptUndoNode *unode; MultiresModifierData *mmd; int update = FALSE, rebuild = FALSE; sculpt_update_mesh_elements(scene, sd, ob, 0); + /* call _after_ sculpt_update_mesh_elements() which may update 'ob->derivedFinal' */ + dm = mesh_get_derived_final(scene, ob, 0); for (unode = lb->first; unode; unode = unode->next) { if (!(strcmp(unode->idname, ob->id.name) == 0)) diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 1f641829e7e..92b6517cbd9 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -409,6 +409,7 @@ static void action_listener(ScrArea *sa, wmNotifier *wmn) switch (wmn->data) { case ND_DATA: ED_area_tag_refresh(sa); + ED_area_tag_redraw(sa); break; default: /* just redrawing the view will do */ ED_area_tag_redraw(sa); diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index 32f91671daf..167353e7cb7 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -368,7 +368,7 @@ int ED_clip_view_selection(const bContext *C, ARegion *ar, int fit) ED_space_clip_get_size(sc, &frame_width, &frame_height); - if (frame_width == 0 || frame_height == 0) + if ((frame_width == 0) || (frame_height == 0) || (sc->clip == NULL)) return FALSE; if (!selected_boundbox(sc, min, max)) diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 7f39545258d..4fe4ad133a9 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -252,7 +252,7 @@ static void file_refresh(const bContext *C, ScrArea *UNUSED(sa)) static void file_listener(ScrArea *sa, wmNotifier *wmn) { - /* SpaceFile *sfile = (SpaceFile*)sa->spacedata.first; */ + /* SpaceFile *sfile = (SpaceFile *)sa->spacedata.first; */ /* context changes */ switch (wmn->category) { diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index d54e3694f07..08b13b49f55 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -372,7 +372,7 @@ static void graphedit_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap) /* insertkey */ WM_keymap_add_item(keymap, "GRAPH_OT_keyframe_insert", IKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "GRAPH_OT_click_insert", LEFTMOUSE, KM_CLICK, KM_CTRL, 0); + WM_keymap_add_item(keymap, "GRAPH_OT_click_insert", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0); /* copy/paste */ WM_keymap_add_item(keymap, "GRAPH_OT_copy", CKEY, KM_PRESS, KM_CTRL, 0); diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 0b904f36a8c..59416dcf0c3 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -814,7 +814,7 @@ void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, int color_man /* color management */ if (color_management && - (!BKE_imtype_supports_float(imf->imtype) || + (!BKE_imtype_requires_linear_float(imf->imtype) || (show_preview && imf->flag & R_IMF_FLAG_PREVIEW_JPG))) { prop = RNA_struct_find_property(imfptr, "display_settings"); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 749ba75cfa1..04566af2b3b 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -522,7 +522,7 @@ static void draw_image_buffer_tiled(SpaceImage *sima, ARegion *ar, Scene *scene, dy = ibuf->y / ima->yrep; sx = (sima->curtile % ima->xrep) * dx; sy = (sima->curtile / ima->xrep) * dy; - rect = get_part_from_buffer((unsigned int*)display_buffer, ibuf->x, sx, sy, sx + dx, sy + dy); + rect = get_part_from_buffer((unsigned int *)display_buffer, ibuf->x, sx, sy, sx + dx, sy + dy); /* draw repeated */ for (sy = 0; sy + dy <= ibuf->y; sy += dy) { diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c index 92433449985..0d40a6ae007 100644 --- a/source/blender/editors/space_image/image_edit.c +++ b/source/blender/editors/space_image/image_edit.c @@ -78,8 +78,8 @@ void ED_space_image_set(SpaceImage *sima, Scene *scene, Object *obedit, Image *i if (sima->image) BKE_image_signal(sima->image, &sima->iuser, IMA_SIGNAL_USER_NEW_IMAGE); - if (sima->image && sima->image->id.us == 0) - sima->image->id.us = 1; + if (sima->image && ID_REAL_USERS(sima->image) <= 0) + sima->image->id.us = MAX2(sima->image->id.us, 0) + 1; if (obedit) WM_main_add_notifier(NC_GEOM | ND_DATA, obedit->data); @@ -97,8 +97,8 @@ void ED_space_image_set_mask(bContext *C, SpaceImage *sima, Mask *mask) sima->mask_info.mask = mask; /* weak, but same as image/space */ - if (sima->mask_info.mask && sima->mask_info.mask->id.us == 0) - sima->mask_info.mask->id.us = 1; + if (sima->mask_info.mask && ID_REAL_USERS(sima->mask_info.mask) <= 0) + sima->mask_info.mask->id.us = MAX2(sima->mask_info.mask->id.us, 0) + 1; if (C) { WM_event_add_notifier(C, NC_MASK | NA_SELECTED, mask); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 16c9405e098..4f57b2249d1 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1205,39 +1205,6 @@ static void save_image_options_to_op(SaveImageOptions *simopts, wmOperator *op) RNA_string_set(op->ptr, "filepath", simopts->filepath); } -static ImBuf *save_image_colormanaged_imbuf_acquire(ImBuf *ibuf, SaveImageOptions *simopts, int save_as_render, void **cache_handle) -{ - ImageFormatData *imf = &simopts->im_format; - ImBuf *colormanaged_ibuf; - int do_colormanagement; - - *cache_handle = NULL; - do_colormanagement = save_as_render && !BKE_imtype_supports_float(imf->imtype); - - if (do_colormanagement) { - unsigned char *display_buffer; - - display_buffer = IMB_display_buffer_acquire(ibuf, &imf->view_settings, &imf->display_settings, cache_handle); - - if (*cache_handle) { - colormanaged_ibuf = IMB_allocImBuf(ibuf->x, ibuf->y, ibuf->planes, 0); - colormanaged_ibuf->rect = (unsigned int *) display_buffer; - } - else { - /* no cache handle means color management didn't run transformation - * or performed transformation to image's byte buffer which doesn't - * require allocating new image buffer - */ - colormanaged_ibuf = ibuf; - } - } - else { - colormanaged_ibuf = ibuf; - } - - return colormanaged_ibuf; -} - /* assumes name is FILE_MAX */ /* ima->name and ibuf->name should end up the same */ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveImageOptions *simopts, int do_newpath) @@ -1247,12 +1214,12 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock); if (ibuf) { - void *cache_handle; ImBuf *colormanaged_ibuf; const char *relbase = ID_BLEND_PATH(CTX_data_main(C), &ima->id); const short relative = (RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path")); const short save_copy = (RNA_struct_find_property(op->ptr, "copy") && RNA_boolean_get(op->ptr, "copy")); const short save_as_render = (RNA_struct_find_property(op->ptr, "save_as_render") && RNA_boolean_get(op->ptr, "save_as_render")); + ImageFormatData *imf = &simopts->im_format; short ok = FALSE; /* old global to ensure a 2nd save goes to same dir */ @@ -1277,7 +1244,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI } } - colormanaged_ibuf = save_image_colormanaged_imbuf_acquire(ibuf, simopts, save_as_render, &cache_handle); + colormanaged_ibuf = IMB_colormanagement_imbuf_for_write(ibuf, save_as_render, TRUE, &imf->view_settings, &imf->display_settings, imf); if (simopts->im_format.imtype == R_IMF_IMTYPE_MULTILAYER) { Scene *scene = CTX_data_scene(C); @@ -1345,12 +1312,8 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI WM_cursor_wait(0); - if (cache_handle) { - colormanaged_ibuf->rect = NULL; + if (colormanaged_ibuf != ibuf) IMB_freeImBuf(colormanaged_ibuf); - - IMB_display_buffer_release(cache_handle); - } } ED_space_image_release_buffer(sima, lock); @@ -1461,6 +1424,24 @@ static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op) uiDefAutoButsRNA(layout, &ptr, image_save_as_draw_check_prop, '\0'); } +static int image_save_as_poll(bContext *C) +{ + if (space_image_buffer_exists_poll(C)) { + if (G.is_rendering) { + /* no need to NULL check here */ + SpaceImage *sima = CTX_wm_space_image(C); + Image *ima = ED_space_image(sima); + + if (ima->source == IMA_SRC_VIEWER) { + CTX_wm_operator_poll_msg_set(C, "can't save image while rendering"); + return FALSE; + } + } + return TRUE; + } + return FALSE; +} + void IMAGE_OT_save_as(wmOperatorType *ot) { // PropertyRNA *prop; @@ -1476,7 +1457,7 @@ void IMAGE_OT_save_as(wmOperatorType *ot) ot->invoke = image_save_as_invoke; ot->cancel = image_save_as_cancel; ot->ui = image_save_as_draw; - ot->poll = space_image_buffer_exists_poll; + ot->poll = image_save_as_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index abe8dfb751b..dbad6e8bb24 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -408,8 +408,6 @@ static void image_refresh(const bContext *C, ScrArea *sa) MTexPoly *tf; if (em && EDBM_mtexpoly_check(em)) { - sima->image = NULL; - tf = EDBM_mtexpoly_active_get(em, NULL, sloppy, selected); if (tf) { diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index 7cb89b6bc6b..034c382cfd2 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -101,7 +101,7 @@ static SpaceLink *info_new(const bContext *UNUSED(C)) /* not spacelink itself */ static void info_free(SpaceLink *UNUSED(sl)) { -// SpaceInfo *sinfo= (SpaceInfo*) sl; +// SpaceInfo *sinfo = (SpaceInfo *) sl; } diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 3bba02f4fc8..8ad02ad7d8b 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -1494,6 +1494,21 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA * node_buts_image_user(layout, C, ptr, &imaptr, &iuserptr); } +static void node_composit_buts_image_details(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + bNode *node = ptr->data; + PointerRNA imaptr; + + node_composit_buts_image(layout, C, ptr); + + if (!node->id) + return; + + imaptr = RNA_pointer_get(ptr, "image"); + + uiTemplateColorspaceSettings(layout, &imaptr, "colorspace_settings"); +} + static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, PointerRNA *ptr) { bNode *node = ptr->data; @@ -2021,7 +2036,7 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C int multilayer = (RNA_enum_get(&imfptr, "file_format") == R_IMF_IMTYPE_MULTILAYER); node_composit_buts_file_output(layout, C, ptr); - uiTemplateImageSettings(layout, &imfptr, TRUE); + uiTemplateImageSettings(layout, &imfptr, FALSE); uiItemS(layout); @@ -2080,7 +2095,7 @@ static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C col = uiLayoutColumn(layout, FALSE); uiLayoutSetActive(col, RNA_boolean_get(&active_input_ptr, "use_node_format") == FALSE); - uiTemplateImageSettings(col, &imfptr, TRUE); + uiTemplateImageSettings(col, &imfptr, FALSE); } } } @@ -2221,6 +2236,21 @@ static void node_composit_buts_movieclip(uiLayout *layout, bContext *C, PointerR uiTemplateID(layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL); } +static void node_composit_buts_movieclip_details(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + bNode *node = ptr->data; + PointerRNA clipptr; + + uiTemplateID(layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL); + + if (!node->id) + return; + + clipptr = RNA_pointer_get(ptr, "clip"); + + uiTemplateColorspaceSettings(layout, &clipptr, "colorspace_settings"); +} + static void node_composit_buts_stabilize2d(uiLayout *layout, bContext *C, PointerRNA *ptr) { bNode *node = ptr->data; @@ -2619,6 +2649,7 @@ static void node_composit_set_butfunc(bNodeType *ntype) case CMP_NODE_IMAGE: ntype->uifunc = node_composit_buts_image; + ntype->uifuncbut = node_composit_buts_image_details; break; case CMP_NODE_R_LAYERS: ntype->uifunc = node_composit_buts_renderlayers; @@ -2773,6 +2804,7 @@ static void node_composit_set_butfunc(bNodeType *ntype) break; case CMP_NODE_MOVIECLIP: ntype->uifunc = node_composit_buts_movieclip; + ntype->uifuncbut = node_composit_buts_movieclip_details; break; case CMP_NODE_STABILIZE2D: ntype->uifunc = node_composit_buts_stabilize2d; diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 21e06f00d8e..a05588495e9 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -256,10 +256,12 @@ void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag) /* not in editmode */ if (scene->obedit != gob->ob) { gob->ob->restrictflag |= flag; - - if (flag == OB_RESTRICT_VIEW) - if ((gob->ob->flag & SELECT) == 0) - ED_base_object_select(BKE_scene_base_find(scene, gob->ob), BA_SELECT); + + if (ELEM(flag, OB_RESTRICT_SELECT, OB_RESTRICT_VIEW)) { + if ((gob->ob->flag & SELECT)) { + ED_base_object_select(BKE_scene_base_find(scene, gob->ob), BA_DESELECT); + } + } } } } diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index d7e180f982b..2ec23091019 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -1423,7 +1423,7 @@ static int parent_drop_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "child", childname); ob = (Object *)BKE_libblock_find_name(ID_OB, childname); - ED_object_parent_set(op->reports, bmain, scene, ob, par, partype, FALSE); + ED_object_parent_set(op->reports, bmain, scene, ob, par, partype, FALSE, FALSE); DAG_scene_sort(bmain, scene); DAG_ids_flush_update(bmain, 0); @@ -1514,7 +1514,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, wmEvent *event) } if ((par->type != OB_ARMATURE) && (par->type != OB_CURVE) && (par->type != OB_LATTICE)) { - if (ED_object_parent_set(op->reports, bmain, scene, ob, par, partype, FALSE)) { + if (ED_object_parent_set(op->reports, bmain, scene, ob, par, partype, FALSE, FALSE)) { DAG_scene_sort(bmain, scene); DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index f927e83cabe..c72bff12056 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -885,7 +885,10 @@ static ImBuf *sequencer_make_scope(Scene *scene, ImBuf *ibuf, ImBuf *(*make_scop ImBuf *display_ibuf = IMB_dupImBuf(ibuf); ImBuf *scope; - IMB_colormanagement_imbuf_make_display_space(display_ibuf, &scene->view_settings, &scene->display_settings); + if (display_ibuf->rect_float) { + IMB_colormanagement_imbuf_make_display_space(display_ibuf, &scene->view_settings, + &scene->display_settings); + } scope = make_scope_cb(display_ibuf); @@ -967,7 +970,10 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq if (!scopes->zebra_ibuf) { ImBuf *display_ibuf = IMB_dupImBuf(ibuf); - IMB_colormanagement_imbuf_make_display_space(display_ibuf, &scene->view_settings, &scene->display_settings); + if (display_ibuf->rect_float) { + IMB_colormanagement_imbuf_make_display_space(display_ibuf, &scene->view_settings, + &scene->display_settings); + } scopes->zebra_ibuf = make_zebra_view_from_ibuf(display_ibuf, sseq->zebra); IMB_freeImBuf(display_ibuf); } diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c index 3c3489115a4..92b17393114 100644 --- a/source/blender/editors/space_sequencer/sequencer_view.c +++ b/source/blender/editors/space_sequencer/sequencer_view.c @@ -25,7 +25,7 @@ */ -/** \file blender/editors/space_sequencer/sequencer_modifier.c +/** \file blender/editors/space_sequencer/sequencer_view.c * \ingroup spseq */ diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 8ac50a57b10..21c70a5b4a9 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -196,7 +196,7 @@ static SpaceLink *sequencer_new(const bContext *C) /* not spacelink itself */ static void sequencer_free(SpaceLink *sl) { - SpaceSeq *sseq= (SpaceSeq *) sl; + SpaceSeq *sseq = (SpaceSeq *) sl; SequencerScopes *scopes = &sseq->scopes; // XXX if (sseq->gpd) BKE_gpencil_free(sseq->gpd); diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index a9315313d26..13c1938d77c 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -401,6 +401,7 @@ static void time_listener(ScrArea *sa, wmNotifier *wmn) case ND_POINTCACHE: case ND_MODIFIER: case ND_PARTICLE: + case ND_KEYS: ED_area_tag_refresh(sa); ED_area_tag_redraw(sa); break; diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c index 5376b82f24c..1ea3876f5cc 100644 --- a/source/blender/editors/space_userpref/space_userpref.c +++ b/source/blender/editors/space_userpref/space_userpref.c @@ -80,7 +80,7 @@ static SpaceLink *userpref_new(const bContext *UNUSED(C)) /* not spacelink itself */ static void userpref_free(SpaceLink *UNUSED(sl)) { -// SpaceUserPref *spref= (SpaceUserPref*) sl; +// SpaceUserPref *spref = (SpaceUserPref *)sl; } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 8d58530765a..5286718a587 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3825,7 +3825,7 @@ static int drawDispListwire(ListBase *dlbase) return 0; } -static void drawDispListsolid(ListBase *lb, Object *ob, +static void drawDispListsolid(ListBase *lb, Object *ob, const short dflag, const unsigned char ob_wire_col[4], int use_glsl) { DispList *dl; @@ -3856,7 +3856,9 @@ static void drawDispListsolid(ListBase *lb, Object *ob, int nr; glDisable(GL_LIGHTING); - glColor3ubv(ob_wire_col); + + if ((dflag & DRAW_CONSTCOLOR) == 0) + glColor3ubv(ob_wire_col); // glVertexPointer(3, GL_FLOAT, 0, dl->verts); // glDrawArrays(GL_LINE_STRIP, 0, dl->nr); @@ -3983,7 +3985,7 @@ static int drawCurveDerivedMesh(Scene *scene, View3D *v3d, RegionView3D *rv3d, B /* returns 1 when nothing was drawn */ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, - const short dt, const unsigned char ob_wire_col[4]) + const short dt, const short dflag, const unsigned char ob_wire_col[4]) { Object *ob = base->object; ListBase *lb = NULL; @@ -4031,12 +4033,12 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas else { if (draw_glsl_material(scene, ob, v3d, dt)) { GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL); - drawDispListsolid(lb, ob, ob_wire_col, TRUE); + drawDispListsolid(lb, ob, dflag, ob_wire_col, TRUE); GPU_end_object_materials(); } else { GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL); - drawDispListsolid(lb, ob, ob_wire_col, FALSE); + drawDispListsolid(lb, ob, dflag, ob_wire_col, FALSE); GPU_end_object_materials(); } if (cu->editnurb && cu->bevobj == NULL && cu->taperobj == NULL && cu->ext1 == 0.0f && cu->ext2 == 0.0f) { @@ -4068,12 +4070,12 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas if (draw_glsl_material(scene, ob, v3d, dt)) { GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL); - drawDispListsolid(lb, ob, ob_wire_col, TRUE); + drawDispListsolid(lb, ob, dflag, ob_wire_col, TRUE); GPU_end_object_materials(); } else { GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL); - drawDispListsolid(lb, ob, ob_wire_col, FALSE); + drawDispListsolid(lb, ob, dflag, ob_wire_col, FALSE); GPU_end_object_materials(); } } @@ -4092,12 +4094,12 @@ static int drawDispList(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *bas if (draw_glsl_material(scene, ob, v3d, dt)) { GPU_begin_object_materials(v3d, rv3d, scene, ob, 1, NULL); - drawDispListsolid(lb, ob, ob_wire_col, TRUE); + drawDispListsolid(lb, ob, dflag, ob_wire_col, TRUE); GPU_end_object_materials(); } else { GPU_begin_object_materials(v3d, rv3d, scene, ob, 0, NULL); - drawDispListsolid(lb, ob, ob_wire_col, FALSE); + drawDispListsolid(lb, ob, dflag, ob_wire_col, FALSE); GPU_end_object_materials(); } } @@ -5610,7 +5612,7 @@ static void draw_editnurb(Object *ob, Nurb *nurb, int sel) } static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, Nurb *nurb, - const short dt, const unsigned char ob_wire_col[4]) + const short dt, const short dflag, const unsigned char ob_wire_col[4]) { ToolSettings *ts = scene->toolsettings; Object *ob = base->object; @@ -5625,7 +5627,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, UI_GetThemeColor3ubv(TH_WIRE, wire_col); glColor3ubv(wire_col); - drawDispList(scene, v3d, rv3d, base, dt, ob_wire_col); + drawDispList(scene, v3d, rv3d, base, dt, dflag, ob_wire_col); if (v3d->zbuf) glDisable(GL_DEPTH_TEST); @@ -5954,13 +5956,13 @@ static int drawmball(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, UI_GetThemeColor3ubv(TH_WIRE, wire_col); glColor3ubv(wire_col); - drawDispList(scene, v3d, rv3d, base, dt, wire_col); + drawDispList(scene, v3d, rv3d, base, dt, dflag, wire_col); } ml = mb->editelems->first; } else { if ((base->flag & OB_FROMDUPLI) == 0) { - drawDispList(scene, v3d, rv3d, base, dt, ob_wire_col); + drawDispList(scene, v3d, rv3d, base, dt, dflag, ob_wire_col); } ml = mb->elems.first; } @@ -6728,11 +6730,11 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short if (cu->flag & CU_FAST) { cpack(0xFFFFFF); set_inverted_drawing(1); - drawDispList(scene, v3d, rv3d, base, OB_WIRE, ob_wire_col); + drawDispList(scene, v3d, rv3d, base, OB_WIRE, dflag, ob_wire_col); set_inverted_drawing(0); } else { - drawDispList(scene, v3d, rv3d, base, dt, ob_wire_col); + drawDispList(scene, v3d, rv3d, base, dt, dflag, ob_wire_col); } if (cu->linewidth != 0.0f) { @@ -6807,7 +6809,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short } } else if (ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { - empty_object = drawDispList(scene, v3d, rv3d, base, dt, ob_wire_col); + empty_object = drawDispList(scene, v3d, rv3d, base, dt, dflag, ob_wire_col); } break; @@ -6817,7 +6819,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short if (cu->editnurb) { ListBase *nurbs = BKE_curve_editNurbs_get(cu); - drawnurb(scene, v3d, rv3d, base, nurbs->first, dt, ob_wire_col); + drawnurb(scene, v3d, rv3d, base, nurbs->first, dt, dflag, ob_wire_col); } else if (dt == OB_BOUNDBOX) { if (((v3d->flag2 & V3D_RENDER_OVERRIDE) && (v3d->drawtype >= OB_WIRE)) == 0) { @@ -6825,7 +6827,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short } } else if (ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { - empty_object = drawDispList(scene, v3d, rv3d, base, dt, ob_wire_col); + empty_object = drawDispList(scene, v3d, rv3d, base, dt, dflag, ob_wire_col); //XXX old animsys if (cu->path) // curve_draw_speed(scene, ob); @@ -7170,7 +7172,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short } /* object centers, need to be drawn in viewmat space for speed, but OK for picking select */ - if (!is_obact || !(ob->mode & (OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT | OB_MODE_TEXTURE_PAINT))) { + if (!is_obact || !(ob->mode & OB_MODE_ALL_PAINT)) { int do_draw_center = -1; /* defines below are zero or positive... */ if (v3d->flag2 & V3D_RENDER_OVERRIDE) { diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index c0ea4173392..25ad85d3db8 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -243,7 +243,7 @@ static void drawgrid_draw(ARegion *ar, double wx, double wy, double x, double y, verts[1][1] = (double)ar->winy; /* iter over 'X' */ - verts[0][0] = verts[1][0] = x - dx *floor(x / dx); + verts[0][0] = verts[1][0] = x - dx * floor(x / dx); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_DOUBLE, 0, verts); @@ -257,7 +257,7 @@ static void drawgrid_draw(ARegion *ar, double wx, double wy, double x, double y, verts[1][0] = (double)ar->winx; /* iter over 'Y' */ - verts[0][1] = verts[1][1] = y - dx *floor(y / dx); + verts[0][1] = verts[1][1] = y - dx * floor(y / dx); while (verts[0][1] < ar->winy) { glDrawArrays(GL_LINES, 0, 2); verts[0][1] = verts[1][1] = verts[0][1] + dx; @@ -730,7 +730,7 @@ static void draw_rotation_guide(RegionView3D *rv3d) glColor4fv(color); glBegin(GL_LINE_LOOP); for (i = 0, angle = 0.f; i < ROT_AXIS_DETAIL; ++i, angle += step) { - float p[3] = {s *cosf(angle), s * sinf(angle), 0.0f}; + float p[3] = {s * cosf(angle), s * sinf(angle), 0.0f}; if (!upright) { mul_qt_v3(q, p); @@ -2559,7 +2559,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, /* NOTE: currently OpenGL is supposed to always work in sRGB space and do not * apply any tonemaps since it's really tricky to support for all features (GLSL, textures, etc) * but due to compatibility issues background is being affected display transform, so we can - * emulate behavior of disabled colro management + * emulate behavior of disabled color management * but this function is also used for sequencer's scene strips which shouldn't be affected by * tonemaps now and should be purely sRGB, that's why we've got this colormanage_background * we can drop this flag in cost of some compatibility loss -- background wouldn't be @@ -2860,8 +2860,8 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw engine = RE_engine_create(type); - engine->tile_x = ceil(ar->winx/(float)scene->r.xparts); - engine->tile_y = ceil(ar->winy/(float)scene->r.yparts); + engine->tile_x = ceil(ar->winx / (float)scene->r.xparts); + engine->tile_y = ceil(ar->winy / (float)scene->r.yparts); type->view_update(engine, C); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index e409ad4e81e..a2ad54cb92e 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1395,7 +1395,7 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short dese } /* index of bundle is 1<<16-based. if there's no "bone" index - * in hight word, this buffer value belongs to camera,. not to bundle */ + * in height word, this buffer value belongs to camera,. not to bundle */ if (buffer[4 * i + 3] & 0xFFFF0000) { MovieClip *clip = BKE_object_movieclip_get(scene, basact->object, 0); MovieTracking *tracking = &clip->tracking; diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 4ca9bd95485..e55e97e501b 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -607,9 +607,9 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) else { ob->recalc |= OB_RECALC_OB; - vec[0] = -ob->obmat[3][0] + gridf *floorf(0.5f + ob->obmat[3][0] / gridf); - vec[1] = -ob->obmat[3][1] + gridf *floorf(0.5f + ob->obmat[3][1] / gridf); - vec[2] = -ob->obmat[3][2] + gridf *floorf(0.5f + ob->obmat[3][2] / gridf); + vec[0] = -ob->obmat[3][0] + gridf * floorf(0.5f + ob->obmat[3][0] / gridf); + vec[1] = -ob->obmat[3][1] + gridf * floorf(0.5f + ob->obmat[3][1] / gridf); + vec[2] = -ob->obmat[3][2] + gridf * floorf(0.5f + ob->obmat[3][2] / gridf); if (ob->parent) { BKE_object_where_is_calc(scene, ob); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index ee5d50c7aba..822ab0b9e70 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -332,6 +332,9 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2]) UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr + 1); } + else { + BLI_assert(0); + } } else if (t->spacetype == SPACE_NODE) { UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], adr, adr + 1); @@ -3906,7 +3909,7 @@ int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2])) sprintf(str, "Shrink/Fatten: %.4f %s", distance, t->proptext); } - t->values[0] = distance; + t->values[0] = -distance; for (i = 0; i < t->total; i++, td++) { if (td->flag & TD_NOACTION) diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 022e9177a4a..540cbb97609 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1334,10 +1334,9 @@ static TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struc return hdata; } -static void createTransCurveVerts(bContext *C, TransInfo *t) +static void createTransCurveVerts(TransInfo *t) { - Object *obedit = CTX_data_edit_object(C); - Curve *cu = obedit->data; + Curve *cu = t->obedit->data; TransData *td = NULL; Nurb *nu; BezTriple *bezt; @@ -1935,9 +1934,9 @@ static void VertsToTransData(TransInfo *t, TransData *td, TransDataExtension *tx } } -static void createTransEditVerts(bContext *C, TransInfo *t) +static void createTransEditVerts(TransInfo *t) { - ToolSettings *ts = CTX_data_tool_settings(C); + ToolSettings *ts = t->scene->toolsettings; TransData *tob = NULL; TransDataExtension *tx = NULL; BMEditMesh *em = BMEdit_FromObject(t->obedit); @@ -3292,15 +3291,19 @@ static void createTransActionData(bContext *C, TransInfo *t) if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) { if (t->mode == TFM_TIME_SLIDE) { t->customData = MEM_callocN((sizeof(float) * 2) + (sizeof(tGPFtransdata) * count), "TimeSlide + tGPFtransdata"); + t->flag |= T_FREE_CUSTOMDATA; tfd = (tGPFtransdata *)((float *)(t->customData) + 2); } else { t->customData = MEM_callocN(sizeof(tGPFtransdata) * count, "tGPFtransdata"); + t->flag |= T_FREE_CUSTOMDATA; tfd = (tGPFtransdata *)(t->customData); } } - else if (t->mode == TFM_TIME_SLIDE) + else if (t->mode == TFM_TIME_SLIDE) { t->customData = MEM_callocN(sizeof(float) * 2, "TimeSlide Min/Max"); + t->flag |= T_FREE_CUSTOMDATA; + } /* loop 2: build transdata array */ for (ale = anim_data.first; ale; ale = ale->next) { @@ -5762,6 +5765,7 @@ static void transDataTrackingFree(TransInfo *t) MEM_freeN(tdt->smarkers); MEM_freeN(tdt); + t->customData = NULL; } } @@ -6420,10 +6424,10 @@ void createTransData(bContext *C, TransInfo *t) else if (t->obedit) { t->ext = NULL; if (t->obedit->type == OB_MESH) { - createTransEditVerts(C, t); + createTransEditVerts(t); } else if (ELEM(t->obedit->type, OB_CURVE, OB_SURF)) { - createTransCurveVerts(C, t); + createTransCurveVerts(t); } else if (t->obedit->type == OB_LATTICE) { createTransLatticeVerts(t); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 325dbe639b4..b8db0b575cf 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1293,19 +1293,26 @@ void postTrans(bContext *C, TransInfo *t) if (t->customFree) { /* Can take over freeing t->data and data2d etc... */ t->customFree(t); + BLI_assert(t->customData == NULL); } else if ((t->customData != NULL) && (t->flag & T_FREE_CUSTOMDATA)) { MEM_freeN(t->customData); + t->customData = NULL; } /* postTrans can be called when nothing is selected, so data is NULL already */ if (t->data) { - int a; /* free data malloced per trans-data */ - for (a = 0, td = t->data; a < t->total; a++, td++) { - if (td->flag & TD_BEZTRIPLE) - MEM_freeN(td->hdata); + if ((t->obedit && ELEM(t->obedit->type, OB_CURVE, OB_SURF)) || + (t->spacetype == SPACE_IPO)) + { + int a; + for (a = 0, td = t->data; a < t->total; a++, td++) { + if (td->flag & TD_BEZTRIPLE) { + MEM_freeN(td->hdata); + } + } } MEM_freeN(t->data); } diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 930573ec750..659cd4e944c 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -1330,7 +1330,7 @@ static void gpu_colors_disable(VBO_State vbo_state) static float gpu_color_from_mask(float mask) { - return 1.0f - mask; + return 1.0f - mask * 0.75f; } static void gpu_color_from_mask_copy(float mask, const float diffuse_color[4], unsigned char out[3]) diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h index 5d0ab5e57d4..e2604241caf 100644 --- a/source/blender/imbuf/IMB_colormanagement.h +++ b/source/blender/imbuf/IMB_colormanagement.h @@ -45,15 +45,11 @@ struct rcti; struct PartialBufferUpdateContext; struct wmWindow; struct Scene; +struct ImageFormatData; struct ColorSpace; struct ColorManagedDisplay; -/* ** Initialization / De-initialization ** */ - -void IMB_colormanagement_init(void); -void IMB_colormanagement_exit(void); - /* ** Generic functions ** */ void IMB_colormanagement_check_file_config(struct Main *bmain); @@ -62,6 +58,8 @@ void IMB_colormanagement_validate_settings(struct ColorManagedDisplaySettings *d struct ColorManagedViewSettings *view_settings); const char *IMB_colormanagement_role_colorspace_name_get(int role); +void IMB_colormanagement_check_is_data(struct ImBuf *ibuf, const char *name); +void IMB_colormanagement_assign_float_colorspace(struct ImBuf *ibuf, const char *name); void IMB_colormanagement_assign_rect_colorspace(struct ImBuf *ibuf, const char *name); /* ** Color space transformation functions ** */ @@ -85,20 +83,20 @@ void IMB_colormanagement_pixel_to_display_space_v4(float result[4], const float void IMB_colormanagement_pixel_to_display_space_v3(float result[3], const float pixel[3], const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings); -void IMB_colormanagement_imbuf_assign_float_space(struct ImBuf *ibuf, struct ColorManagedColorspaceSettings *colorspace_settings); - void IMB_colormanagement_imbuf_make_display_space(struct ImBuf *ibuf, const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings); +struct ImBuf *IMB_colormanagement_imbuf_for_write(struct ImBuf *ibuf, int save_as_render, int allocate_result, + const struct ColorManagedViewSettings *view_settings, + const struct ColorManagedDisplaySettings *display_settings, + struct ImageFormatData *image_format_data); + /* ** Public display buffers interfaces ** */ unsigned char *IMB_display_buffer_acquire(struct ImBuf *ibuf, const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings, void **cache_handle); unsigned char *IMB_display_buffer_acquire_ctx(const struct bContext *C, struct ImBuf *ibuf, void **cache_handle); -void IMB_display_buffer_to_imbuf_rect(struct ImBuf *ibuf, const struct ColorManagedViewSettings *view_settings, - const struct ColorManagedDisplaySettings *display_settings); - void IMB_display_buffer_transform_apply(unsigned char *display_buffer, float *linear_buffer, int width, int height, int channels, const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings, int predivide); @@ -110,6 +108,7 @@ int IMB_colormanagement_display_get_named_index(const char *name); const char *IMB_colormanagement_display_get_indexed_name(int index); const char *IMB_colormanagement_display_get_default_name(void); struct ColorManagedDisplay *IMB_colormanagement_display_get_named(const char *name); +const char *IMB_colormanagement_display_get_none_name(void); /* ** View funcrions ** */ int IMB_colormanagement_view_get_named_index(const char *name); diff --git a/source/blender/imbuf/intern/IMB_colormanagement_intern.h b/source/blender/imbuf/intern/IMB_colormanagement_intern.h index 059bdee00eb..35a6ea9b207 100644 --- a/source/blender/imbuf/intern/IMB_colormanagement_intern.h +++ b/source/blender/imbuf/intern/IMB_colormanagement_intern.h @@ -67,8 +67,14 @@ typedef struct ColorManagedView { char name[64]; } ColorManagedView; +/* ** Initialization / De-initialization ** */ + +void colormanagement_init(void); +void colormanagement_exit(void); + void colormanage_cache_free(struct ImBuf *ibuf); +const char *colormanage_display_get_default_name(void); struct ColorManagedDisplay *colormanage_display_get_default(void); struct ColorManagedDisplay *colormanage_display_add(const char *name); struct ColorManagedDisplay *colormanage_display_get_named(const char *name); diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 11dce3087c6..02d84819924 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -59,6 +59,7 @@ #include "BKE_colortools.h" #include "BKE_context.h" +#include "BKE_image.h" #include "BKE_utildefines.h" #include "BKE_main.h" @@ -547,7 +548,7 @@ static void colormanage_free_config(void) BLI_freelistN(&global_views); } -void IMB_colormanagement_init(void) +void colormanagement_init(void) { const char *ocio_env; const char *configdir; @@ -584,7 +585,7 @@ void IMB_colormanagement_init(void) BLI_init_srgb_conversion(); } -void IMB_colormanagement_exit(void) +void colormanagement_exit(void) { colormanage_free_config(); } @@ -632,6 +633,37 @@ static void display_transform_get_from_ctx(const bContext *C, ColorManagedViewSe } } +static const char *display_transform_get_colorspace_name(const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings) +{ + ConstConfigRcPtr *config = OCIO_getCurrentConfig(); + + if (config) { + const char *display = display_settings->display_device; + const char *view = view_settings->view_transform; + const char *colorspace_name; + + colorspace_name = OCIO_configGetDisplayColorSpaceName(config, display, view); + + OCIO_configRelease(config); + + return colorspace_name; + } + + return NULL; +} + +static ColorSpace *display_transform_get_colorspace(const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings) +{ + const char *colorspace_name = display_transform_get_colorspace_name(view_settings, display_settings); + + if (colorspace_name) + return colormanage_colorspace_get_named(colorspace_name); + + return NULL; +} + static ConstProcessorRcPtr *create_display_buffer_processor(const char *view_transform, const char *display, float exposure, float gamma) { @@ -996,8 +1028,7 @@ void IMB_colormanagement_validate_settings(ColorManagedDisplaySettings *display_ display = colormanage_display_get_named(display_settings->display_device); - if (display) - default_view = colormanage_view_get_default(display); + default_view = colormanage_view_get_default(display); for (view_link = display->views.first; view_link; view_link = view_link->next) { ColorManagedView *view = view_link->data; @@ -1039,17 +1070,38 @@ const char *IMB_colormanagement_role_colorspace_name_get(int role) return NULL; } +void IMB_colormanagement_check_is_data(ImBuf *ibuf, const char *name) +{ + ColorSpace *colorspace = colormanage_colorspace_get_named(name); + + if (colorspace->is_data) + ibuf->colormanage_flag |= IMB_COLORMANAGE_IS_DATA; + else + ibuf->colormanage_flag &= ~IMB_COLORMANAGE_IS_DATA; +} + +void IMB_colormanagement_assign_float_colorspace(ImBuf *ibuf, const char *name) +{ + ColorSpace *colorspace = colormanage_colorspace_get_named(name); + + ibuf->float_colorspace = colorspace; + + if (colorspace->is_data) + ibuf->colormanage_flag |= IMB_COLORMANAGE_IS_DATA; + else + ibuf->colormanage_flag &= ~IMB_COLORMANAGE_IS_DATA; +} + void IMB_colormanagement_assign_rect_colorspace(ImBuf *ibuf, const char *name) { ColorSpace *colorspace = colormanage_colorspace_get_named(name); - if (colorspace) { - ibuf->rect_colorspace = colorspace; - if (colorspace->is_data) - ibuf->colormanage_flag |= IMB_COLORMANAGE_IS_DATA; - else - ibuf->colormanage_flag &= ~IMB_COLORMANAGE_IS_DATA; - } + ibuf->rect_colorspace = colorspace; + + if (colorspace->is_data) + ibuf->colormanage_flag |= IMB_COLORMANAGE_IS_DATA; + else + ibuf->colormanage_flag &= ~IMB_COLORMANAGE_IS_DATA; } /*********************** Threaded display buffer transform routines *************************/ @@ -1310,19 +1362,11 @@ static void colormanage_display_buffer_process_ex(ImBuf *ibuf, float *display_bu view_settings->exposure == 0.0f && view_settings->gamma == 1.0f) { - ConstConfigRcPtr *config = OCIO_getCurrentConfig(); + const char *from_colorspace = ibuf->rect_colorspace->name; + const char *to_colorspace = display_transform_get_colorspace_name(view_settings, display_settings); - if (config) { - const char *display = display_settings->display_device; - const char *view = view_settings->view_transform; - const char *from_colorspace = ibuf->rect_colorspace->name; - const char *to_colorspace = OCIO_configGetDisplayColorSpaceName(config, display, view); - - if (!strcmp(from_colorspace, to_colorspace)) - skip_transform = TRUE; - - OCIO_configRelease(config); - } + if (to_colorspace && !strcmp(from_colorspace, to_colorspace)) + skip_transform = TRUE; } } @@ -1495,10 +1539,8 @@ void IMB_colormanagement_colorspace_to_scene_linear_v3(float pixel[3], ColorSpac ConstProcessorRcPtr *processor; if (!colorspace) { - /* OCIO_TODO: make sure it never happens */ - + /* should never happen */ printf("%s: perform conversion from unknown color space\n", __func__); - return; } @@ -1514,10 +1556,8 @@ void IMB_colormanagement_scene_linear_to_colorspace_v3(float pixel[3], ColorSpac ConstProcessorRcPtr *processor; if (!colorspace) { - /* OCIO_TODO: make sure it never happens */ - + /* should never happen */ printf("%s: perform conversion from unknown color space\n", __func__); - return; } @@ -1532,10 +1572,8 @@ void IMB_colormanagement_colorspace_to_scene_linear(float *buffer, int width, in ConstProcessorRcPtr *processor; if (!colorspace) { - /* OCIO_TODO: make sure it never happens */ - + /* should never happen */ printf("%s: perform conversion from unknown color space\n", __func__); - return; } @@ -1607,27 +1645,106 @@ void IMB_colormanagement_pixel_to_display_space_v3(float result[3], const float IMB_colormanagement_processor_free(cm_processor); } -void IMB_colormanagement_imbuf_assign_float_space(ImBuf *ibuf, ColorManagedColorspaceSettings *colorspace_settings) +static void colormanagement_imbuf_make_display_space(ImBuf *ibuf, const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings, int make_byte) { - ibuf->float_colorspace = colormanage_colorspace_get_named(colorspace_settings->name); -} - -void IMB_colormanagement_imbuf_make_display_space(ImBuf *ibuf, const ColorManagedViewSettings *view_settings, - const ColorManagedDisplaySettings *display_settings) -{ - /* OCIO_TODO: byte buffer management is not supported here yet */ - if (!ibuf->rect_float) - return; + if (!ibuf->rect && make_byte) + imb_addrectImBuf(ibuf); if (global_tot_display == 0 || global_tot_view == 0) { IMB_buffer_float_from_float(ibuf->rect_float, ibuf->rect_float, ibuf->channels, IB_PROFILE_SRGB, IB_PROFILE_LINEAR_RGB, ibuf->flags & IB_cm_predivide, ibuf->x, ibuf->y, ibuf->x, ibuf->x); } else { - colormanage_display_buffer_process_ex(ibuf, ibuf->rect_float, NULL, view_settings, display_settings); + colormanage_display_buffer_process_ex(ibuf, ibuf->rect_float, (unsigned char *)ibuf->rect, + view_settings, display_settings); } } +void IMB_colormanagement_imbuf_make_display_space(ImBuf *ibuf, const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings) +{ + colormanagement_imbuf_make_display_space(ibuf, view_settings, display_settings, FALSE); +} + +/* prepare image buffer to be saved on disk, applying color management if needed + * color management would be applied if image is saving as render result and if + * file format is not expecting float buffer to be in linear space (currently + * JPEG2000 and TIFF are such formats -- they're storing image as float but + * file itself stores applied color space). + * + * Both byte and float buffers would contain applied color space, and result's + * float_colorspace would be set to display color space. This should be checked + * in image format write callback and if float_colorspace is not NULL, no color + * space transformation should be applied on this buffer. + */ +ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf, int save_as_render, int allocate_result, const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings, ImageFormatData *image_format_data) +{ + ImBuf *colormanaged_ibuf = ibuf; + int do_colormanagement; + int is_movie = BKE_imtype_is_movie(image_format_data->imtype); + int requires_linear_float = BKE_imtype_requires_linear_float(image_format_data->imtype); + + do_colormanagement = save_as_render && (is_movie || !requires_linear_float); + + if (do_colormanagement) { + int make_byte = FALSE; + ImFileType *type; + + if (allocate_result) { + colormanaged_ibuf = IMB_dupImBuf(ibuf); + } + else { + /* render pipeline is constructing image buffer itself, but it's re-using byte and float buffers from render result + * make copy of this buffers here sine this buffers would be transformed to other color space here + */ + + if (ibuf->rect && (ibuf->mall & IB_rect) == 0) { + ibuf->rect = MEM_dupallocN(ibuf->rect); + ibuf->mall |= IB_rect; + } + + if (ibuf->rect_float && (ibuf->mall & IB_rectfloat) == 0) { + ibuf->rect_float = MEM_dupallocN(ibuf->rect_float); + ibuf->mall |= IB_rectfloat; + } + } + + /* for proper check whether byte buffer is required by a format or not + * should be pretty safe since this image buffer is supposed to be used for + * saving only and ftype would be overwritten a bit later by BKE_imbuf_write + */ + colormanaged_ibuf->ftype = BKE_imtype_to_ftype(image_format_data->imtype); + + /* if file format isn't able to handle float buffer itself, + * we need to allocate byte buffer and store color managed + * image there + */ + for (type = IMB_FILE_TYPES; type->is_a; type++) { + if (type->save && type->ftype(type, colormanaged_ibuf)) { + if ((type->flag & IM_FTYPE_FLOAT) == 0) + make_byte = TRUE; + + break; + } + } + + /* perform color space conversions */ + colormanagement_imbuf_make_display_space(colormanaged_ibuf, view_settings, display_settings, make_byte); + + if (colormanaged_ibuf->rect_float) { + /* float buffer isn't linear anymore, + * image format write callback should check for this flag and assume + * no space conversion should happen if ibuf->float_colorspace != NULL + */ + colormanaged_ibuf->float_colorspace = display_transform_get_colorspace(view_settings, display_settings); + } + } + + return colormanaged_ibuf; +} + static void imbuf_verify_float(ImBuf *ibuf) { /* multiple threads could request for display buffer at once and in case @@ -1713,7 +1830,7 @@ unsigned char *IMB_display_buffer_acquire(ImBuf *ibuf, const ColorManagedViewSet return display_buffer; } - buffer_size = DISPLAY_BUFFER_CHANNELS * ibuf->x * ibuf->y * sizeof(float); + buffer_size = DISPLAY_BUFFER_CHANNELS * ibuf->x * ibuf->y * sizeof(char); display_buffer = MEM_callocN(buffer_size, "imbuf display buffer"); colormanage_display_buffer_process(ibuf, display_buffer, applied_view_settings, display_settings); @@ -1737,22 +1854,6 @@ unsigned char *IMB_display_buffer_acquire_ctx(const bContext *C, ImBuf *ibuf, vo return IMB_display_buffer_acquire(ibuf, view_settings, display_settings, cache_handle); } -/* covert float buffer to display space and store it in image buffer's byte array */ -void IMB_display_buffer_to_imbuf_rect(ImBuf *ibuf, const ColorManagedViewSettings *view_settings, - const ColorManagedDisplaySettings *display_settings) -{ - if (global_tot_display == 0 || global_tot_view == 0) { - imbuf_verify_float(ibuf); - } - else { - if (!ibuf->rect) { - imb_addrectImBuf(ibuf); - } - - colormanage_display_buffer_process(ibuf, (unsigned char *) ibuf->rect, view_settings, display_settings); - } -} - void IMB_display_buffer_transform_apply(unsigned char *display_buffer, float *linear_buffer, int width, int height, int channels, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, int predivide) @@ -1792,10 +1893,10 @@ void IMB_display_buffer_release(void *cache_handle) /*********************** Display functions *************************/ -ColorManagedDisplay *colormanage_display_get_default(void) +const char *colormanage_display_get_default_name(void) { ConstConfigRcPtr *config = OCIO_getCurrentConfig(); - const char *display; + const char *display_name; if (!config) { /* no valid OCIO configuration, can't get default display */ @@ -1803,14 +1904,21 @@ ColorManagedDisplay *colormanage_display_get_default(void) return NULL; } - display = OCIO_configGetDefaultDisplay(config); + display_name = OCIO_configGetDefaultDisplay(config); OCIO_configRelease(config); - if (display[0] == '\0') + return display_name; +} + +ColorManagedDisplay *colormanage_display_get_default(void) +{ + const char *display_name = colormanage_display_get_default_name(); + + if (display_name[0] == '\0') return NULL; - return colormanage_display_get_named(display); + return colormanage_display_get_named(display_name); } ColorManagedDisplay *colormanage_display_add(const char *name) @@ -1892,6 +2000,14 @@ ColorManagedDisplay *IMB_colormanagement_display_get_named(const char *name) return colormanage_display_get_named(name); } +const char *IMB_colormanagement_display_get_none_name(void) +{ + if (colormanage_display_get_named("None") != NULL) + return "None"; + + return colormanage_display_get_default_name(); +} + /*********************** View functions *************************/ const char *colormanage_view_get_default_name(const ColorManagedDisplay *display) diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index dd559c55402..01523463712 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -544,6 +544,10 @@ static void cinema_setup_encoder(opj_cparameters_t *parameters, opj_image_t *ima parameters->cp_disto_alloc = 1; } +static float channel_colormanage_noop(float value) +{ + return value; +} static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) { @@ -560,9 +564,20 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) opj_image_cmptparm_t cmptparm[4]; /* maximum of 4 components */ opj_image_t *image = NULL; + float (*chanel_colormanage_cb)(float); + img_fol_t img_fol; /* only needed for cinema presets */ memset(&img_fol, 0, sizeof(img_fol_t)); + if (ibuf->float_colorspace) { + /* float buffer was managed already, no need in color space conversion */ + chanel_colormanage_cb = channel_colormanage_noop; + } + else { + /* standard linear-to-srgb conversion if float buffer wasn't managed */ + chanel_colormanage_cb = linearrgb_to_srgb; + } + if (ibuf->ftype & JP2_CINE) { if (ibuf->x == 4096 || ibuf->y == 2160) @@ -649,9 +664,9 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) if (numcomps == 4) { PIXEL_LOOPER_BEGIN(rect_float) { - r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(linearrgb_to_srgb(rect_float[0])); - g[i] = DOWNSAMPLE_FLOAT_TO_8BIT(linearrgb_to_srgb(rect_float[1])); - b[i] = DOWNSAMPLE_FLOAT_TO_8BIT(linearrgb_to_srgb(rect_float[2])); + r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[0])); + g[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[1])); + b[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[2])); a[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rect_float[3]); } PIXEL_LOOPER_END; @@ -659,9 +674,9 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) else { PIXEL_LOOPER_BEGIN(rect_float) { - r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(linearrgb_to_srgb(rect_float[0])); - g[i] = DOWNSAMPLE_FLOAT_TO_8BIT(linearrgb_to_srgb(rect_float[1])); - b[i] = DOWNSAMPLE_FLOAT_TO_8BIT(linearrgb_to_srgb(rect_float[2])); + r[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[0])); + g[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[1])); + b[i] = DOWNSAMPLE_FLOAT_TO_8BIT(chanel_colormanage_cb(rect_float[2])); } PIXEL_LOOPER_END; } @@ -671,9 +686,9 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) if (numcomps == 4) { PIXEL_LOOPER_BEGIN(rect_float) { - r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(linearrgb_to_srgb(rect_float[0])); - g[i] = DOWNSAMPLE_FLOAT_TO_12BIT(linearrgb_to_srgb(rect_float[1])); - b[i] = DOWNSAMPLE_FLOAT_TO_12BIT(linearrgb_to_srgb(rect_float[2])); + r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[0])); + g[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[1])); + b[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[2])); a[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rect_float[3]); } PIXEL_LOOPER_END; @@ -681,9 +696,9 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) else { PIXEL_LOOPER_BEGIN(rect_float) { - r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(linearrgb_to_srgb(rect_float[0])); - g[i] = DOWNSAMPLE_FLOAT_TO_12BIT(linearrgb_to_srgb(rect_float[1])); - b[i] = DOWNSAMPLE_FLOAT_TO_12BIT(linearrgb_to_srgb(rect_float[2])); + r[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[0])); + g[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[1])); + b[i] = DOWNSAMPLE_FLOAT_TO_12BIT(chanel_colormanage_cb(rect_float[2])); } PIXEL_LOOPER_END; } @@ -693,9 +708,9 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) if (numcomps == 4) { PIXEL_LOOPER_BEGIN(rect_float) { - r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(linearrgb_to_srgb(rect_float[0])); - g[i] = DOWNSAMPLE_FLOAT_TO_16BIT(linearrgb_to_srgb(rect_float[1])); - b[i] = DOWNSAMPLE_FLOAT_TO_16BIT(linearrgb_to_srgb(rect_float[2])); + r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[0])); + g[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[1])); + b[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[2])); a[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rect_float[3]); } PIXEL_LOOPER_END; @@ -703,9 +718,9 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) else { PIXEL_LOOPER_BEGIN(rect_float) { - r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(linearrgb_to_srgb(rect_float[0])); - g[i] = DOWNSAMPLE_FLOAT_TO_16BIT(linearrgb_to_srgb(rect_float[1])); - b[i] = DOWNSAMPLE_FLOAT_TO_16BIT(linearrgb_to_srgb(rect_float[2])); + r[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[0])); + g[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[1])); + b[i] = DOWNSAMPLE_FLOAT_TO_16BIT(chanel_colormanage_cb(rect_float[2])); } PIXEL_LOOPER_END; } diff --git a/source/blender/imbuf/intern/module.c b/source/blender/imbuf/intern/module.c index 55a29333620..9141dad6f9c 100644 --- a/source/blender/imbuf/intern/module.c +++ b/source/blender/imbuf/intern/module.c @@ -28,16 +28,19 @@ #include #include "IMB_imbuf.h" #include "IMB_filetype.h" +#include "IMB_colormanagement_intern.h" void IMB_init(void) { imb_filetypes_init(); imb_tile_cache_init(); + colormanagement_init(); } void IMB_exit(void) { imb_tile_cache_exit(); imb_filetypes_exit(); + colormanagement_exit(); } diff --git a/source/blender/imbuf/intern/radiance_hdr.c b/source/blender/imbuf/intern/radiance_hdr.c index 5add372cd4e..53b00f441c8 100644 --- a/source/blender/imbuf/intern/radiance_hdr.c +++ b/source/blender/imbuf/intern/radiance_hdr.c @@ -168,9 +168,9 @@ int imb_is_a_hdr(unsigned char *buf) { /* For recognition, Blender only loads first 32 bytes, so use #?RADIANCE id instead */ /* update: actually, the 'RADIANCE' part is just an optional program name, the magic word is really only the '#?' part */ - //if (strstr((char*)buf, "#?RADIANCE")) return 1; + //if (strstr((char *)buf, "#?RADIANCE")) return 1; if (strstr((char *)buf, "#?")) return 1; - // if (strstr((char*)buf, "32-bit_rle_rgbe")) return 1; + // if (strstr((char *)buf, "32-bit_rle_rgbe")) return 1; return 0; } diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index 932a4941a0a..83830f260e1 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -114,7 +114,7 @@ static int imb_tiff_DummyMapProc(thandle_t fd, tdata_t *pbase, toff_t *psize) * Reads data from an in-memory TIFF file. * * \param handle: Handle of the TIFF file (pointer to ImbTIFFMemFile). - * \param data: Buffer to contain data (treat as void*). + * \param data: Buffer to contain data (treat as (void *)). * \param n: Number of bytes to read. * * \return: Number of bytes actually read. @@ -790,7 +790,14 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags) /* convert from float source */ float rgb[4]; - linearrgb_to_srgb_v3_v3(rgb, &fromf[from_i]); + if (ibuf->float_colorspace) { + /* float buffer was managed already, no need in color space conversion */ + copy_v3_v3(rgb, &fromf[from_i]); + } + else { + /* standard linear-to-srgb conversion if float buffer wasn't managed */ + linearrgb_to_srgb_v3_v3(rgb, &fromf[from_i]); + } rgb[3] = fromf[from_i + 3]; diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 9a7feb77cfc..59874e0434b 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -605,11 +605,11 @@ typedef enum eSAction_Flag { /* draw time in seconds instead of time in frames */ SACTION_DRAWTIME = (1 << 2), /* don't filter action channels according to visibility */ - //SACTION_NOHIDE = (1<<3), // XXX depreceated... old animation system + //SACTION_NOHIDE = (1<<3), // XXX deprecated... old animation system /* don't kill overlapping keyframes after transform */ SACTION_NOTRANSKEYCULL = (1 << 4), /* don't include keyframes that are out of view */ - //SACTION_HORIZOPTIMISEON = (1<<5), // XXX depreceated... old irrelevant trick + //SACTION_HORIZOPTIMISEON = (1<<5), // XXX deprecated... old irrelevant trick /* show pose-markers (local to action) in Action Editor mode */ SACTION_POSEMARKERS_SHOW = (1 << 6), /* don't draw action channels using group colors (where applicable) */ @@ -654,7 +654,7 @@ typedef enum eAnimEdit_AutoSnap { /* ************************************************ */ /* Legacy Data */ -/* WARNING: Action Channels are now depreceated... they were part of the old animation system! +/* WARNING: Action Channels are now deprecated... they were part of the old animation system! * (ONLY USED FOR DO_VERSIONS...) * * Action Channels belong to Actions. They are linked with an IPO block, and can also own diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index 0afe3773c94..0a20a60c893 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -103,13 +103,13 @@ typedef struct bArmature { unsigned int layer_used; /* for UI, to show which layers are there */ unsigned int layer, layer_protected; /* for buttons to work, both variables in this order together */ -// XXX depreceated... old animaton system (armature only viz) --- +// XXX deprecated... old animaton system (armature only viz) --- short ghostep, ghostsize; /* number of frames to ghosts to show, and step between them */ short ghosttype, pathsize; /* ghost drawing options and number of frames between points of path */ int ghostsf, ghostef; /* start and end frames of ghost-drawing range */ int pathsf, pathef; /* start and end frames of path-calculation range for all bones */ int pathbc, pathac; /* number of frames before/after current frame of path-calculation for all bones */ -// XXX end of depreceated code ---------------------------------- +// XXX end of deprecated code ---------------------------------- } bArmature; /* armature->flag */ @@ -127,7 +127,7 @@ typedef enum eArmature_Flag { ARM_AUTO_IK = (1<<9), ARM_NO_CUSTOM = (1<<10), /* made option negative, for backwards compat */ ARM_COL_CUSTOM = (1<<11), /* draw custom colors */ - ARM_GHOST_ONLYSEL = (1<<12), /* when ghosting, only show selected bones (this should belong to ghostflag instead) */ /* XXX depreceated */ + ARM_GHOST_ONLYSEL = (1<<12), /* when ghosting, only show selected bones (this should belong to ghostflag instead) */ /* XXX deprecated */ ARM_DS_EXPAND = (1<<13), /* dopesheet channel is expanded */ ARM_HAS_VIZ_DEPS = (1<<14), /* other objects are used for visualizing various states (hack for efficient updates) */ } eArmature_Flag; @@ -157,7 +157,7 @@ typedef enum eArmature_DeformFlag { } eArmature_DeformFlag; /* armature->pathflag */ -// XXX depreceated... old animation system (armature only viz) +// XXX deprecated... old animation system (armature only viz) typedef enum eArmature_PathFlag { ARM_PATH_FNUMS = (1<<0), ARM_PATH_KFRAS = (1<<1), @@ -167,7 +167,7 @@ typedef enum eArmature_PathFlag { } eArmature_PathFlag; /* armature->ghosttype */ -// XXX depreceated... old animation system (armature only viz) +// XXX deprecated... old animation system (armature only viz) typedef enum eArmature_GhostType { ARM_GHOST_CUR = 0, ARM_GHOST_RANGE = 1, diff --git a/source/blender/makesdna/DNA_camera_types.h b/source/blender/makesdna/DNA_camera_types.h index 73cebfb3d9f..1ece25c9f70 100644 --- a/source/blender/makesdna/DNA_camera_types.h +++ b/source/blender/makesdna/DNA_camera_types.h @@ -99,7 +99,7 @@ typedef struct Camera { #define CAM_SHOWSENSOR 256 /* yafray: dof sampling switch */ -/* #define CAM_YF_NO_QMC 512 */ /* depreceated */ +/* #define CAM_YF_NO_QMC 512 */ /* deprecated */ /* Sensor fit */ #define CAMERA_SENSOR_FIT_AUTO 0 diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index ad3284d430d..8b1e7e12e17 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -42,7 +42,7 @@ struct Text; struct Ipo; /* channels reside in Object or Action (ListBase) constraintChannels */ -// XXX depreceated... old AnimSys +// XXX deprecated... old AnimSys typedef struct bConstraintChannel { struct bConstraintChannel *next, *prev; struct Ipo *ipo; @@ -182,7 +182,7 @@ typedef struct bSplineIKConstraint { typedef struct bTrackToConstraint { struct Object *tar; int reserved1; /* I'll be using reserved1 and reserved2 as Track and Up flags, - * not sure if that's what they were intented for anyway. + * not sure if that's what they were intended for anyway. * Not sure either if it would create backward incompatibility if I were to rename them. * - theeth*/ int reserved2; @@ -515,7 +515,7 @@ typedef enum eBConstraint_SpaceTypes { } eBConstraint_SpaceTypes; /* bConstraintChannel.flag */ -// XXX depreceated... old AnimSys +// XXX deprecated... old AnimSys typedef enum eConstraintChannel_Flags { CONSTRAINT_CHANNEL_SELECT = (1<<0), CONSTRAINT_CHANNEL_PROTECTED = (1<<1) @@ -539,7 +539,7 @@ typedef enum eCopyLocation_Flags { LOCLIKE_X = (1<<0), LOCLIKE_Y = (1<<1), LOCLIKE_Z = (1<<2), - /* LOCLIKE_TIP is a depreceated option... use headtail=1.0f instead */ + /* LOCLIKE_TIP is a deprecated option... use headtail=1.0f instead */ LOCLIKE_TIP = (1<<3), LOCLIKE_X_INVERT = (1<<4), LOCLIKE_Y_INVERT = (1<<5), diff --git a/source/blender/makesdna/DNA_dynamicpaint_types.h b/source/blender/makesdna/DNA_dynamicpaint_types.h index ca1b1bf1725..1f2a589dc27 100644 --- a/source/blender/makesdna/DNA_dynamicpaint_types.h +++ b/source/blender/makesdna/DNA_dynamicpaint_types.h @@ -136,7 +136,7 @@ typedef struct DynamicPaintSurface { /* canvas flags */ #if 0 /* This should not be needed, having a valid WEIGHT_MCOL layer should be enough. - * And if not, should be a general flag. But seems unecessary for now... */ + * And if not, should be a general flag. But seems unnecessary for now... */ #define MOD_DPAINT_PREVIEW_READY (1<<0) /* if viewport preview is ready */ #endif #define MOD_DPAINT_BAKING (1<<1) /* surface is already baking, so it wont get updated (loop) */ diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h index 3de5372d848..71b344d23d7 100644 --- a/source/blender/makesdna/DNA_gpencil_types.h +++ b/source/blender/makesdna/DNA_gpencil_types.h @@ -141,16 +141,16 @@ typedef struct bGPdata { } bGPdata; /* bGPdata->flag */ -// XXX many of these flags should be depreceated for more general ideas in 2.5 +// XXX many of these flags should be deprecated for more general ideas in 2.5 /* don't allow painting to occur at all */ - // XXX is depreceated - not well understood + // XXX is deprecated - not well understood #define GP_DATA_LMBPLOCK (1<<0) /* show debugging info in viewport (i.e. status print) */ #define GP_DATA_DISPINFO (1<<1) /* in Action Editor, show as expanded channel */ #define GP_DATA_EXPAND (1<<2) /* is the block overriding all clicks? */ - // XXX is depreceated - nasty old concept + // XXX is deprecated - nasty old concept #define GP_DATA_EDITPAINT (1<<3) /* new strokes are added in viewport space */ #define GP_DATA_VIEWALIGN (1<<4) diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h index 6bf8dbbe73a..a73fc9073fa 100644 --- a/source/blender/makesdna/DNA_ipo_types.h +++ b/source/blender/makesdna/DNA_ipo_types.h @@ -28,7 +28,7 @@ /** \file DNA_ipo_types.h * \ingroup DNA * \deprecated - * The contents of this file are now officially depreceated. They were used for the 'old' animation system, + * The contents of this file are now officially deprecated. They were used for the 'old' animation system, * which has (as of 2.50) been replaced with a completely new system by Joshua Leung (aligorith). All defines, * etc. are only still maintained to provide backwards compatibility for old files. */ diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 4172db90c05..b40af805f77 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -705,6 +705,8 @@ typedef struct SimpleDeformModifierData { /* indicates whether simple deform should use the local * coordinates or global coordinates of origin */ +/* XXX, this should have never been an option, all other modifiers work relatively + * (so moving both objects makes no change!) - Campbell */ #define MOD_SIMPLEDEFORM_ORIGIN_LOCAL (1<<0) #define MOD_UVPROJECT_MAX 10 diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index af44db3896a..3a8620fdaba 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -117,7 +117,7 @@ typedef struct Object { struct Ipo *ipo DNA_DEPRECATED; /* old animation system, deprecated for 2.5 */ /* struct Path *path; */ struct BoundBox *bb; - struct bAction *action DNA_DEPRECATED; // XXX depreceated... old animation system + struct bAction *action DNA_DEPRECATED; // XXX deprecated... old animation system struct bAction *poselib; struct bPose *pose; /* pose data, armature objects only */ void *data; /* pointer to objects data - an 'ID' or NULL */ @@ -127,8 +127,8 @@ typedef struct Object { bAnimVizSettings avs; /* settings for visualization of object-transform animation */ bMotionPath *mpath; /* motion path cache for this object */ - ListBase constraintChannels DNA_DEPRECATED; // XXX depreceated... old animation system - ListBase effect DNA_DEPRECATED; // XXX depreceated... keep for readfile + ListBase constraintChannels DNA_DEPRECATED; // XXX deprecated... old animation system + ListBase effect DNA_DEPRECATED; // XXX deprecated... keep for readfile ListBase disp; /* list of DispList, used by lattice, metaballs curve & surfaces */ ListBase defbase; /* list of bDeformGroup (vertex groups) names and flag only */ ListBase modifiers; /* list of ModifierData structures */ @@ -175,7 +175,7 @@ typedef struct Object { short transflag, protectflag; /* transformation settings and transform locks */ short trackflag, upflag; short nlaflag; /* used for DopeSheet filtering settings (expanded/collapsed) */ - short ipoflag; // xxx depreceated... old animation system + short ipoflag; // xxx deprecated... old animation system short scaflag; /* ui state for game logic */ char scavisflag; /* more display settings for game logic */ char pad5; @@ -244,8 +244,8 @@ typedef struct Object { float anisotropicFriction[3]; ListBase constraints; /* object constraints */ - ListBase nlastrips DNA_DEPRECATED; // XXX depreceated... old animation system - ListBase hooks DNA_DEPRECATED; // XXX depreceated... old animation system + ListBase nlastrips DNA_DEPRECATED; // XXX deprecated... old animation system + ListBase hooks DNA_DEPRECATED; // XXX deprecated... old animation system ListBase particlesystem; /* particle systems */ struct PartDeflect *pd; /* particle deflector/attractor/collision data */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 3f8f043efad..2aab702add0 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1055,7 +1055,7 @@ typedef struct UnitSettings { /* Display/Editing unit options for each scene */ float scale_length; /* maybe have other unit conversions? */ char system; /* imperial, metric etc */ - char system_rotation; /* not implemented as a propper unit system yet */ + char system_rotation; /* not implemented as a proper unit system yet */ short flag; } UnitSettings; diff --git a/source/blender/makesdna/DNA_sdna_types.h b/source/blender/makesdna/DNA_sdna_types.h index 8b2e7645823..28204ebeb88 100644 --- a/source/blender/makesdna/DNA_sdna_types.h +++ b/source/blender/makesdna/DNA_sdna_types.h @@ -48,7 +48,7 @@ typedef struct SDNA { short *typelens; /* type lengths */ int nr_structs; /* number of struct types */ - short **structs; /* sp = structs[a] is the address of a struct definintion + short **structs; /* sp = structs[a] is the address of a struct definition * sp[0] is struct type number, sp[1] amount of members * * (sp[2], sp[3]), (sp[4], sp[5]), .. are the member diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 6cc4541f19e..a1534c7b9d3 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -376,7 +376,7 @@ typedef struct SpaceNla { /* nla->flag */ typedef enum eSpaceNla_Flag { - /* flags (1<<0), (1<<1), and (1<<3) are depreceated flags from old verisons */ + /* flags (1<<0), (1<<1), and (1<<3) are deprecated flags from old verisons */ /* draw timing in seconds instead of frames */ SNLA_DRAWTIME = (1 << 2), diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 4b65d7e0185..f6142f37248 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1091,7 +1091,7 @@ static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, Property const char *manualfunc, const char *nextfunc) { /* note on indices, this is for external functions and ignores skipped values. - * so the the index can only be checked against the length when there is no 'skip' funcion. */ + * so the the index can only be checked against the length when there is no 'skip' function. */ char *func; if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL) diff --git a/source/blender/makesrna/intern/rna_action_api.c b/source/blender/makesrna/intern/rna_action_api.c index 7e95aaab31b..fe429d8698b 100644 --- a/source/blender/makesrna/intern/rna_action_api.c +++ b/source/blender/makesrna/intern/rna_action_api.c @@ -34,10 +34,14 @@ #include #include +#include "BLI_utildefines.h" + #include "RNA_define.h" #include "DNA_action_types.h" +#include "rna_internal.h" /* own include */ + #ifdef RNA_RUNTIME #include "BKE_action.h" @@ -47,7 +51,7 @@ #else -void RNA_api_action(StructRNA *srna) +void RNA_api_action(StructRNA *UNUSED(srna)) { } diff --git a/source/blender/makesrna/intern/rna_actuator_api.c b/source/blender/makesrna/intern/rna_actuator_api.c index 68b2c4f8b52..4a34961964d 100644 --- a/source/blender/makesrna/intern/rna_actuator_api.c +++ b/source/blender/makesrna/intern/rna_actuator_api.c @@ -35,6 +35,8 @@ #include "WM_types.h" #include "RNA_define.h" +#include "rna_internal.h" /* own include */ + #ifdef RNA_RUNTIME #include "BKE_sca.h" diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index a645930f09a..ceadaa036f1 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -271,7 +271,7 @@ static void rna_Armature_layer_set(PointerRNA *ptr, const int *values) } } -/* XXX depreceated.... old armature only animviz */ +/* XXX deprecated.... old armature only animviz */ static void rna_Armature_ghost_start_frame_set(PointerRNA *ptr, int value) { bArmature *data = (bArmature *)ptr->data; @@ -293,7 +293,7 @@ static void rna_Armature_ghost_end_frame_set(PointerRNA *ptr, int value) data->ghostsf = MAX2(data->ghostef, 1); } } -/* XXX depreceated... old armature only animviz */ +/* XXX deprecated... old armature only animviz */ static void rna_EditBone_name_set(PointerRNA *ptr, const char *value) { @@ -945,14 +945,14 @@ static void rna_def_armature(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); -/* XXX depreceated ....... old animviz for armatures only */ +/* XXX deprecated ....... old animviz for armatures only */ prop = RNA_def_property(srna, "ghost_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "ghosttype"); RNA_def_property_enum_items(prop, prop_ghost_type_items); RNA_def_property_ui_text(prop, "Ghost Type", "Method of Onion-skinning for active Action"); RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); -/* XXX depreceated ....... old animviz for armatures only */ +/* XXX deprecated ....... old animviz for armatures only */ /* Boolean values */ /* layer */ @@ -1013,16 +1013,16 @@ static void rna_def_armature(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Draw Bone Group Colors", "Draw bone group colors"); RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); -/* XXX depreceated ....... old animviz for armatures only */ +/* XXX deprecated ....... old animviz for armatures only */ prop = RNA_def_property(srna, "show_only_ghost_selected", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_GHOST_ONLYSEL); RNA_def_property_ui_text(prop, "Draw Ghosts on Selected Bones Only", ""); RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); -/* XXX depreceated ....... old animviz for armatures only */ +/* XXX deprecated ....... old animviz for armatures only */ /* Number fields */ -/* XXX depreceated ....... old animviz for armatures only */ +/* XXX deprecated ....... old animviz for armatures only */ /* ghost/onionskining settings */ prop = RNA_def_property(srna, "ghost_step", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ghostep"); @@ -1058,7 +1058,7 @@ static void rna_def_armature(BlenderRNA *brna) "(not for 'Around Current Frame' Onion-skinning method)"); RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); RNA_def_property_flag(prop, PROP_LIB_EXCEPTION); -/* XXX depreceated ....... old animviz for armatures only */ +/* XXX deprecated ....... old animviz for armatures only */ } void RNA_def_armature(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index bf8b687139b..4d33dc2f1e9 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -896,7 +896,7 @@ static void rna_def_colormanage(BlenderRNA *brna) srna = RNA_def_struct(brna, "ColorManagedDisplaySettings", NULL); RNA_def_struct_ui_text(srna, "ColorManagedDisplaySettings", "Color management specific to display device"); - prop= RNA_def_property(srna, "display_device", PROP_ENUM, PROP_NONE); + prop = RNA_def_property(srna, "display_device", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, display_device_items); RNA_def_property_enum_funcs(prop, "rna_ColorManagedDisplaySettings_display_device_get", "rna_ColorManagedDisplaySettings_display_device_set", @@ -908,7 +908,7 @@ static void rna_def_colormanage(BlenderRNA *brna) srna = RNA_def_struct(brna, "ColorManagedViewSettings", NULL); RNA_def_struct_ui_text(srna, "ColorManagedViewSettings", "Color management settings used for displaying images on the display"); - prop= RNA_def_property(srna, "view_transform", PROP_ENUM, PROP_NONE); + prop = RNA_def_property(srna, "view_transform", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, view_transform_items); RNA_def_property_enum_funcs(prop, "rna_ColorManagedViewSettings_view_transform_get", "rna_ColorManagedViewSettings_view_transform_set", @@ -945,7 +945,7 @@ static void rna_def_colormanage(BlenderRNA *brna) srna = RNA_def_struct(brna, "ColorManagedColorspaceSettings", NULL); RNA_def_struct_ui_text(srna, "ColorManagedColorspaceSettings", "Input color space settings"); - prop= RNA_def_property(srna, "name", PROP_ENUM, PROP_NONE); + prop = RNA_def_property(srna, "name", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, color_space_items); RNA_def_property_enum_funcs(prop, "rna_ColorManagedColorspaceSettings_colorspace_get", "rna_ColorManagedColorspaceSettings_colorspace_set", diff --git a/source/blender/makesrna/intern/rna_fcurve_api.c b/source/blender/makesrna/intern/rna_fcurve_api.c index 1f8b827f320..ab96f6f384d 100644 --- a/source/blender/makesrna/intern/rna_fcurve_api.c +++ b/source/blender/makesrna/intern/rna_fcurve_api.c @@ -34,10 +34,14 @@ #include #include +#include "BLI_utildefines.h" + #include "RNA_define.h" #include "DNA_anim_types.h" +#include "rna_internal.h" /* own include */ + #ifdef RNA_RUNTIME #include @@ -47,7 +51,7 @@ #else -void RNA_api_drivers(StructRNA *srna) +void RNA_api_drivers(StructRNA *UNUSED(srna)) { /* FunctionRNA *func; */ /* PropertyRNA *parm; */ diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index fdab874cf01..a77e93f6a56 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -403,7 +403,6 @@ static void rna_def_imageuser(BlenderRNA *brna) prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "offset"); - RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); RNA_def_property_ui_text(prop, "Offset", "Offset the number of the frame to use in the animation"); RNA_def_property_update(prop, 0, "rna_ImageUser_update"); diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index c66c0085763..7766dff4273 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -41,6 +41,8 @@ #include "BIF_gl.h" +#include "rna_internal.h" /* own include */ + #ifdef RNA_RUNTIME #include "BKE_image.h" @@ -81,9 +83,10 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports BKE_reportf(reports, RPT_ERROR, "Couldn't acquire buffer from image"); } else { - ImBuf *write_ibuf = IMB_dupImBuf(ibuf); + ImBuf *write_ibuf; - IMB_display_buffer_to_imbuf_rect(write_ibuf, &scene->view_settings, &scene->display_settings); + write_ibuf = IMB_colormanagement_imbuf_for_write(ibuf, TRUE, TRUE, &scene->view_settings, + &scene->display_settings, &scene->r.im_format); write_ibuf->planes = scene->r.im_format.planes; write_ibuf->dither = scene->r.dither_intensity; @@ -91,7 +94,9 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports if (!BKE_imbuf_write(write_ibuf, path, &scene->r.im_format)) { BKE_reportf(reports, RPT_ERROR, "Couldn't write image: %s", path); } - IMB_freeImBuf(write_ibuf); + + if (write_ibuf != ibuf) + IMB_freeImBuf(write_ibuf); } BKE_image_release_ibuf(image, lock); diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index b85688e156c..f75862af61d 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -266,6 +266,7 @@ void RNA_api_material(StructRNA *srna); void RNA_api_mesh(struct StructRNA *srna); void RNA_api_object(struct StructRNA *srna); void RNA_api_object_base(struct StructRNA *srna); +void RNA_api_pose(struct StructRNA *srna); void RNA_api_pose_channel(struct StructRNA *srna); void RNA_api_scene(struct StructRNA *srna); void RNA_api_scene_render(struct StructRNA *srna); @@ -360,7 +361,7 @@ typedef struct ArrayIterator { void *free_ptr; /* will be freed if set */ int itemsize; - /* array length with no skip functins applied, take care not to compare against index from animsys + /* array length with no skip functions applied, take care not to compare against index from animsys * or python indices */ int length; diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 100485dd714..3485f6b2528 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -599,8 +599,8 @@ static void rna_Main_textures_tag(Main *bmain, int value) { tag_main_lb(&bmain-> static void rna_Main_brushes_tag(Main *bmain, int value) { tag_main_lb(&bmain->brush, value); } static void rna_Main_worlds_tag(Main *bmain, int value) { tag_main_lb(&bmain->world, value); } static void rna_Main_groups_tag(Main *bmain, int value) { tag_main_lb(&bmain->group, value); } -static void rna_Main_shape_keys_tag(Main *bmain, int value) { tag_main_lb(&bmain->key, value); } -static void rna_Main_scripts_tag(Main *bmain, int value) { tag_main_lb(&bmain->script, value); } +// static void rna_Main_shape_keys_tag(Main *bmain, int value) { tag_main_lb(&bmain->key, value); } +// static void rna_Main_scripts_tag(Main *bmain, int value) { tag_main_lb(&bmain->script, value); } static void rna_Main_texts_tag(Main *bmain, int value) { tag_main_lb(&bmain->text, value); } static void rna_Main_speakers_tag(Main *bmain, int value) { tag_main_lb(&bmain->speaker, value); } static void rna_Main_sounds_tag(Main *bmain, int value) { tag_main_lb(&bmain->sound, value); } diff --git a/source/blender/makesrna/intern/rna_material_api.c b/source/blender/makesrna/intern/rna_material_api.c index 538a4c99df4..c7441f92c33 100644 --- a/source/blender/makesrna/intern/rna_material_api.c +++ b/source/blender/makesrna/intern/rna_material_api.c @@ -31,15 +31,19 @@ #include #include +#include "BLI_utildefines.h" + #include "RNA_define.h" #include "DNA_material_types.h" +#include "rna_internal.h" /* own include */ + #ifdef RNA_RUNTIME #else -void RNA_api_material(StructRNA *srna) +void RNA_api_material(StructRNA *UNUSED(srna)) { /* FunctionRNA *func; */ /* PropertyRNA *parm; */ diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index ce86f90f018..df73fcd96dd 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -224,7 +224,7 @@ static void rna_MeshPolygon_normal_get(PointerRNA *ptr, float *values) MPoly *mp = (MPoly *)ptr->data; /* BMESH_TODO: might be faster to look for a CD_NORMALS layer and use that */ - mesh_calc_poly_normal(mp, me->mloop + mp->loopstart, me->mvert, values); + BKE_mesh_calc_poly_normal(mp, me->mloop + mp->loopstart, me->mvert, values); } static float rna_MeshPolygon_area_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c index c221d1175df..99effc990a8 100644 --- a/source/blender/makesrna/intern/rna_movieclip.c +++ b/source/blender/makesrna/intern/rna_movieclip.c @@ -299,6 +299,12 @@ static void rna_def_movieclip(BlenderRNA *brna) "(affects only how footage is loading, does not change data associated with a clip)"); RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update"); + /* length */ + prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_int_sdna(prop, NULL, "len"); + RNA_def_property_ui_text(prop, "Duration", "Detected duration of movie clip in frames"); + /* color management */ prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "colorspace_settings"); diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c index 6e0f9f37d17..4ff1365427e 100644 --- a/source/blender/makesrna/intern/rna_nla.c +++ b/source/blender/makesrna/intern/rna_nla.c @@ -520,7 +520,7 @@ static void rna_def_nlastrip(BlenderRNA *brna) prop = RNA_def_property(srna, "repeat", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "repeat"); RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_repeat_set", NULL); - /* these limits have currently be chosen arbitarily, but could be extended + /* these limits have currently be chosen arbitrarily, but could be extended * (minimum should still be > 0 though) if needed... */ RNA_def_property_range(prop, 0.1f, 1000.0f); RNA_def_property_ui_text(prop, "Repeat", "Number of times to repeat the action range"); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 6b543f9f576..3239e8ac596 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -1803,7 +1803,7 @@ static void def_cmp_blur(StructRNA *srna) /* duplicated in def_cmp_bokehblur */ prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_VARIABLE_SIZE); - RNA_def_property_ui_text(prop, "Variable Size", "Support variable blue per-pixel when using an image for size input"); + RNA_def_property_ui_text(prop, "Variable Size", "Support variable blur per-pixel when using an image for size input"); RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage"); diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index 1263e7716dd..a6f49d80b25 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -96,7 +96,7 @@ Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_ float (*orco)[3] = NULL; /* copies object and modifiers (but not the data) */ - tmpobj = BKE_object_copy(ob); + tmpobj = BKE_object_copy_with_caches(ob); tmpcu = (Curve *)tmpobj->data; tmpcu->id.us--; diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 2b6fd2cb263..df278e7cf16 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -1300,7 +1300,7 @@ static void rna_def_pose(BlenderRNA *brna) /* animviz */ rna_def_animviz_common(srna); - /* RNA_api_pose(srna); */ + RNA_api_pose(srna); } void RNA_def_pose(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_pose_api.c b/source/blender/makesrna/intern/rna_pose_api.c index ed4690ac6a7..29d7c616d25 100644 --- a/source/blender/makesrna/intern/rna_pose_api.c +++ b/source/blender/makesrna/intern/rna_pose_api.c @@ -34,12 +34,16 @@ #include #include +#include "BLI_utildefines.h" + #include "RNA_define.h" #include "DNA_object_types.h" /* #include "BLO_sys_types.h" */ +#include "rna_internal.h" /* own include */ + #ifdef RNA_RUNTIME /* #include "DNA_anim_types.h" */ @@ -57,7 +61,7 @@ static float rna_PoseBone_do_envelope(bPoseChannel *chan, float *vec) } #else -void RNA_api_pose(StructRNA *srna) +void RNA_api_pose(StructRNA *UNUSED(srna)) { /* FunctionRNA *func; */ /* PropertyRNA *parm; */ diff --git a/source/blender/makesrna/intern/rna_sensor_api.c b/source/blender/makesrna/intern/rna_sensor_api.c index fd0c6f622ff..d920cbef4a2 100644 --- a/source/blender/makesrna/intern/rna_sensor_api.c +++ b/source/blender/makesrna/intern/rna_sensor_api.c @@ -35,6 +35,8 @@ #include "WM_types.h" #include "RNA_define.h" +#include "rna_internal.h" /* own include */ + #ifdef RNA_RUNTIME #include "BKE_sca.h" diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index b27148e964d..d83debd3266 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -699,12 +699,6 @@ static int colbalance_seq_cmp_cb(Sequence *seq, void *arg_pt) { SequenceSearchData *data = arg_pt; - if (seq->strip && seq->strip->color_balance == data->data) { - data->seq = seq; - data->smd = NULL; - return -1; /* done so bail out */ - } - if (seq->modifiers.first) { SequenceModifierData *smd = seq->modifiers.first; diff --git a/source/blender/makesrna/intern/rna_text_api.c b/source/blender/makesrna/intern/rna_text_api.c index 0366012e260..5f67f367195 100644 --- a/source/blender/makesrna/intern/rna_text_api.c +++ b/source/blender/makesrna/intern/rna_text_api.c @@ -30,6 +30,8 @@ #include "RNA_define.h" +#include "rna_internal.h" /* own include */ + #ifdef RNA_RUNTIME #include "WM_api.h" diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index eada607ed97..3eadc4468ba 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -265,7 +265,7 @@ static void rna_UserDef_audio_update(Main *bmain, Scene *UNUSED(scene), PointerR static void rna_Userdef_memcache_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) { - MEM_CacheLimiter_set_maximum(U.memcachelimit * 1024 * 1024); + MEM_CacheLimiter_set_maximum(((size_t) U.memcachelimit) * 1024 * 1024); } static void rna_UserDef_weight_color_update(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -3303,6 +3303,12 @@ static void rna_def_userdef_input(BlenderRNA *brna) {USER_TRACKBALL, "TRACKBALL", 0, "Trackball", "Use trackball style rotation in the viewport"}, {0, NULL, 0, NULL, NULL} }; + + static EnumPropertyItem ndof_view_rotation_items[] = { + {NDOF_TURNTABLE, "TURNTABLE", 0, "Turntable", "Use turntable style rotation in the viewport"}, + {0, "TRACKBALL", 0, "Trackball", "Use trackball style rotation in the viewport"}, + {0, NULL, 0, NULL, NULL} + }; static EnumPropertyItem view_zoom_styles[] = { {USER_ZOOM_CONT, "CONTINUE", 0, "Continue", "Old style zoom, continues while moving mouse up or down"}, @@ -3394,9 +3400,10 @@ static void rna_def_userdef_input(BlenderRNA *brna) /* TODO: update description when fly-mode visuals are in place ("projected position in fly mode")*/ /* 3D view */ - prop = RNA_def_property(srna, "ndof_turntable", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_TURNTABLE); - RNA_def_property_ui_text(prop, "Turntable", "Turntable for ndof rotation"); + prop = RNA_def_property(srna, "ndof_view_rotate_method", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); + RNA_def_property_enum_items(prop, ndof_view_rotation_items); + RNA_def_property_ui_text(prop, "NDOF View Rotation", "Rotation style in the viewport"); /* 3D view: roll */ prop = RNA_def_property(srna, "ndof_roll_invert_axis", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index cb4e00a042e..d6979161cdc 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -32,6 +32,8 @@ #include #include +#include "BLI_utildefines.h" + #include "RNA_define.h" #include "RNA_enum_types.h" @@ -383,7 +385,7 @@ void RNA_api_macro(StructRNA *srna) RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); } -void RNA_api_keyconfig(StructRNA *srna) +void RNA_api_keyconfig(StructRNA *UNUSED(srna)) { /* FunctionRNA *func; */ /* PropertyRNA *parm; */ diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c index dc6fef9b617..8eb47f4066c 100644 --- a/source/blender/modifiers/intern/MOD_cloth.c +++ b/source/blender/modifiers/intern/MOD_cloth.c @@ -155,7 +155,7 @@ static void copyData(ModifierData *md, ModifierData *target) if (clmd->sim_parms->effector_weights) tclmd->sim_parms->effector_weights = MEM_dupallocN(clmd->sim_parms->effector_weights); tclmd->coll_parms = MEM_dupallocN(clmd->coll_parms); - tclmd->point_cache = BKE_ptcache_copy_list(&tclmd->ptcaches, &clmd->ptcaches); + tclmd->point_cache = BKE_ptcache_copy_list(&tclmd->ptcaches, &clmd->ptcaches, FALSE); tclmd->clothObject = NULL; } diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index bf5f6cd095e..44ebc76e4a1 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -72,7 +72,7 @@ static void simpleDeform_taper(const float factor, const float dcut[3], float r_ r_co[1] = y + y * scale; r_co[2] = z; - if (dcut) { + { r_co[0] += dcut[0]; r_co[1] += dcut[1]; r_co[2] += dcut[2]; @@ -90,7 +90,7 @@ static void simpleDeform_stretch(const float factor, const float dcut[3], float r_co[1] = y * scale; r_co[2] = z * (1.0f + factor); - if (dcut) { + { r_co[0] += dcut[0]; r_co[1] += dcut[1]; r_co[2] += dcut[2]; @@ -110,7 +110,7 @@ static void simpleDeform_twist(const float factor, const float *dcut, float r_co r_co[1] = x * sint + y * cost; r_co[2] = z; - if (dcut) { + { r_co[0] += dcut[0]; r_co[1] += dcut[1]; r_co[2] += dcut[2]; @@ -132,7 +132,7 @@ static void simpleDeform_bend(const float factor, const float dcut[3], float r_c r_co[2] = z; } - if (dcut) { + { r_co[0] += cost * dcut[0]; r_co[1] += sint * dcut[0]; r_co[2] += dcut[2]; @@ -163,7 +163,7 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object smd->limit[0] = minf(smd->limit[0], smd->limit[1]); /* Upper limit >= than lower limit */ - //Calculate matrixs do convert between coordinate spaces + /* Calculate matrixs do convert between coordinate spaces */ if (smd->origin) { transf = &tmp_transf; @@ -176,10 +176,11 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object } } - //Setup vars - limit_axis = (smd->mode == MOD_SIMPLEDEFORM_MODE_BEND) ? 0 : 2; //Bend limits on X.. all other modes limit on Z + /* Setup vars, + * Bend limits on X.. all other modes limit on Z */ + limit_axis = (smd->mode == MOD_SIMPLEDEFORM_MODE_BEND) ? 0 : 2; - //Update limits if needed + /* Update limits if needed */ { float lower = FLT_MAX; float upper = -FLT_MAX; @@ -199,7 +200,7 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object smd_limit[1] = lower + (upper - lower) * smd->limit[1]; smd_limit[0] = lower + (upper - lower) * smd->limit[0]; - smd_factor = smd->factor / MAX2(FLT_EPSILON, smd_limit[1] - smd_limit[0]); + smd_factor = smd->factor / maxf(FLT_EPSILON, smd_limit[1] - smd_limit[0]); } modifier_get_vgroup(ob, dm, smd->vgroup_name, &dvert, &vgroup); @@ -235,7 +236,9 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object simpleDeform_callback(smd_factor, dcut, co); /* apply deform */ interp_v3_v3v3(vertexCos[i], vertexCos[i], co, weight); /* Use vertex weight has coef of linear interpolation */ - if (transf) space_transform_invert(transf, vertexCos[i]); + if (transf) { + space_transform_invert(transf, vertexCos[i]); + } } } } @@ -249,6 +252,7 @@ static void initData(ModifierData *md) SimpleDeformModifierData *smd = (SimpleDeformModifierData *) md; smd->mode = MOD_SIMPLEDEFORM_MODE_TWIST; + smd->originOpts = MOD_SIMPLEDEFORM_ORIGIN_LOCAL; smd->axis = 0; smd->origin = NULL; diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index fc74b446762..1df7d535c35 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -107,7 +107,7 @@ static void dm_calc_normal(DerivedMesh *dm, float (*temp_nors)[3]) f_no = face_nors[i]; if (calc_face_nors) - mesh_calc_poly_normal(mp, mloop + mp->loopstart, mvert, f_no); + BKE_mesh_calc_poly_normal(mp, mloop + mp->loopstart, mvert, f_no); ml = mloop + mp->loopstart; @@ -483,7 +483,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* --- not related to angle calc --- */ if (face_nors_calc) - mesh_calc_poly_normal(mp, ml, mvert, face_nors[i]); + BKE_mesh_calc_poly_normal(mp, ml, mvert, face_nors[i]); /* --- end non-angle-calc section --- */ sub_v3_v3v3(nor_prev, mvert[ml[i_this - 1].v].co, mvert[ml[i_this].v].co); @@ -635,15 +635,15 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* notice we use 'mp->totloop' which is later overwritten, * we could lookup the original face but theres no point since this is a copy * and will have the same value, just take care when changing order of assignment */ - k1 = mpoly[fidx].loopstart + ((edge_order[eidx] + 1) % mp->totloop); + k1 = mpoly[fidx].loopstart + (((edge_order[eidx] - 1) + mp->totloop) % mp->totloop); /* prev loop */ k2 = mpoly[fidx].loopstart + (edge_order[eidx]); mp->totloop = 4; - CustomData_copy_data(&dm->loopData, &result->loopData, k1, numLoops * 2 + j + 0, 1); - CustomData_copy_data(&dm->loopData, &result->loopData, k2, numLoops * 2 + j + 1, 1); - CustomData_copy_data(&dm->loopData, &result->loopData, k2, numLoops * 2 + j + 2, 1); - CustomData_copy_data(&dm->loopData, &result->loopData, k1, numLoops * 2 + j + 3, 1); + CustomData_copy_data(&dm->loopData, &result->loopData, k2, numLoops * 2 + j + 0, 1); + CustomData_copy_data(&dm->loopData, &result->loopData, k1, numLoops * 2 + j + 1, 1); + CustomData_copy_data(&dm->loopData, &result->loopData, k1, numLoops * 2 + j + 2, 1); + CustomData_copy_data(&dm->loopData, &result->loopData, k2, numLoops * 2 + j + 3, 1); if (flip == FALSE) { ml[j].v = ed->v1; diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index c9960df1345..68bafd94ce4 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -226,7 +226,7 @@ static void local_merge(bNodeTree *localtree, bNodeTree *ntree) } else if (lnode->type==CMP_NODE_MOVIEDISTORTION) { /* special case for distortion node: distortion context is allocating in exec function - * and to achive much better performance on further calls this context should be + * and to achieve much better performance on further calls this context should be * copied back to original node */ if (lnode->storage) { if (lnode->new_node->storage) diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c index 8f01408d8c7..ad2d26d7c27 100644 --- a/source/blender/nodes/composite/node_composite_util.c +++ b/source/blender/nodes/composite/node_composite_util.c @@ -1121,7 +1121,7 @@ void convolve(CompBuf* dst, CompBuf* in1, CompBuf* in2) /* * - * Utility functions qd_* should probably be intergrated better with other functions here. + * Utility functions qd_* should probably be integrated better with other functions here. * */ // sets fcol to pixelcolor at (x, y) diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c index 0868c9467e5..a9f930f9cf2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.c +++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.c @@ -71,8 +71,8 @@ DO_INLINE float colorbalance_cdl(float in, float offset, float power, float slop /* note: lift_lgg is just 2-lift, gamma_inv is 1.0/gamma */ DO_INLINE float colorbalance_lgg(float in, float lift_lgg, float gamma_inv, float gain) { - /* 1:1 match with the sequencer with linear/srgb conversions, the conversion isn'tisn't pretty - * but best keep it this way, sice testing for durian shows a similar calculation + /* 1:1 match with the sequencer with linear/srgb conversions, the conversion isn't pretty + * but best keep it this way, since testing for durian shows a similar calculation * without lin/srgb conversions gives bad results (over-saturated shadows) with colors * slightly below 1.0. some correction can be done but it ends up looking bad for shadows or lighter tones - campbell */ float x= (((linearrgb_to_srgb(in) - 1.0f) * lift_lgg) + 1.0f) * gain; diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c index 2878d303632..a343315264d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.c +++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.c @@ -65,7 +65,7 @@ static CompBuf *dblur(bNode *node, CompBuf *img, int iterations, int wrap, center_y_pix = center_y * img->y; tx = itsc * D * cosf(a); - ty = -itsc *D *sinf(a); + ty = -itsc * D * sinf(a); sc = itsc * zoom; rot = itsc * spin; diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 59a4d6818c8..a61cf00d81c 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -223,13 +223,13 @@ bNodeTemplate node_group_template(bNode *node) { bNodeTemplate ntemp; ntemp.type = NODE_GROUP; - ntemp.ngroup = (bNodeTree*)node->id; + ntemp.ngroup = (bNodeTree *)node->id; return ntemp; } void node_group_init(bNodeTree *ntree, bNode *node, bNodeTemplate *ntemp) { - node->id = (ID*)ntemp->ngroup; + node->id = (ID *)ntemp->ngroup; /* NB: group socket input/output roles are inverted internally! * Group "inputs" work as outputs in links and vice versa. diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index d7d9baf35ed..fefccceeb6e 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -189,7 +189,7 @@ static int bpy_bm_elem_index_set(BPy_BMElem *self, PyObject *value, void *UNUSED /* Mesh * ^^^^ */ -/* doc-strings for all uses of this funcion */ +/* doc-strings for all uses of this function */ PyDoc_STRVAR(bpy_bmvertseq_doc, "This meshes vert sequence (read-only).\n\n:type: :class:`BMVertSeq`" @@ -2581,7 +2581,7 @@ static PyObject *bpy_bmelemseq_subscript(BPy_BMElemSeq *self, PyObject *key) /* only get the length for negative values */ Py_ssize_t len = bpy_bmelemseq_length(self); if (start < 0) start += len; - if (stop < 0) start += len; + if (stop < 0) stop += len; } if (stop - start <= 0) { diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c index e45a39a0643..2a9592d21e2 100644 --- a/source/blender/python/bmesh/bmesh_py_types_customdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c @@ -685,7 +685,7 @@ static PyObject *bpy_bmlayercollection_subscript(BPy_BMLayerCollection *self, Py /* only get the length for negative values */ Py_ssize_t len = bpy_bmlayercollection_length(self); if (start < 0) start += len; - if (stop < 0) start += len; + if (stop < 0) stop += len; } if (stop - start <= 0) { diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c index b5fee2a3e8e..8316d33ea38 100644 --- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c @@ -251,7 +251,7 @@ PyObject *BPy_BMLoopUV_CreatePyObject(struct MLoopUV *mloopuv) /* Mesh Loop Color * *************** */ -/* This simply provices a color wrapper for +/* This simply provides a color wrapper for * color which uses mathutils callbacks for mathutils.Color */ diff --git a/source/blender/python/bmesh/bmesh_py_types_select.c b/source/blender/python/bmesh/bmesh_py_types_select.c index c3adc8366bd..85095596a4e 100644 --- a/source/blender/python/bmesh/bmesh_py_types_select.c +++ b/source/blender/python/bmesh/bmesh_py_types_select.c @@ -280,7 +280,7 @@ static PyObject *bpy_bmeditselseq_subscript(BPy_BMEditSelSeq *self, PyObject *ke /* only get the length for negative values */ Py_ssize_t len = bpy_bmeditselseq_length(self); if (start < 0) start += len; - if (stop < 0) start += len; + if (stop < 0) stop += len; } if (stop - start <= 0) { diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 2e4d4e870b8..a2521484c88 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -450,7 +450,7 @@ PyObject *PyC_UnicodeFromByte(const char *str) * >> foo = 10 * >> print(__import__("__main__").foo) * - * note: this overwrites __main__ which gives problems with nested calles. + * note: this overwrites __main__ which gives problems with nested calls. * be sure to run PyC_MainModule_Backup & PyC_MainModule_Restore if there is * any chance that python is in the call stack. ****************************************************************************/ diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index 360e041270f..529ad2782ab 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -173,7 +173,7 @@ static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObj } PyDoc_STRVAR(bpy_resource_path_doc, -".. function:: resource_path(type, major=2, minor=57)\n" +".. function:: resource_path(type, major=bpy.app.version[0], minor=bpy.app.version[1])\n" "\n" " Return the base path for storing system files.\n" "\n" diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index abf609cd235..bb116017f6b 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -360,6 +360,7 @@ static int py_long_as_int(PyObject *py_long, int *r_int) #define BPY_PROPDEF_UPDATE_DOC \ " :arg update: function to be called when this value is modified,\n" \ " This function must take 2 values (self, context) and return None.\n" \ +" *Warning* there are no safety checks to avoid infinite recursion.\n" \ " :type update: function\n" \ #if 0 diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 8ec8c4c41ba..00c1f5cfe6c 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -2211,7 +2211,7 @@ static int pyrna_prop_collection_subscript_str_lib_pair_ptr(BPy_PropertyRNA *sel return -1; } - /* lib is either a valid poniter or NULL, + /* lib is either a valid pointer or NULL, * either way can do direct comparison with id.lib */ RNA_PROP_BEGIN (&self->ptr, itemptr, self->prop) @@ -2420,7 +2420,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject /* only get the length for negative values */ Py_ssize_t len = (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop); if (start < 0) start += len; - if (stop < 0) start += len; + if (stop < 0) stop += len; } if (stop - start <= 0) { @@ -2546,7 +2546,7 @@ static int pyrna_prop_collection_ass_subscript(BPy_PropertyRNA *self, PyObject * /* only get the length for negative values */ Py_ssize_t len = (Py_ssize_t)RNA_property_collection_length(&self->ptr, self->prop); if (start < 0) start += len; - if (stop < 0) start += len; + if (stop < 0) stop += len; } if (stop - start <= 0) { diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c index 01495c793a8..53d0e10a01e 100644 --- a/source/blender/python/intern/bpy_util.c +++ b/source/blender/python/intern/bpy_util.c @@ -37,7 +37,7 @@ #include "../generic/py_capi_utils.h" -static bContext* __py_context = NULL; +static bContext *__py_context = NULL; bContext *BPy_GetContext(void) { return __py_context; } void BPy_SetContext(bContext *C) { __py_context = C; } diff --git a/source/blender/python/intern/gpu.h b/source/blender/python/intern/gpu.h index 68e7fa4aa9e..f8c751f7f94 100644 --- a/source/blender/python/intern/gpu.h +++ b/source/blender/python/intern/gpu.h @@ -30,7 +30,7 @@ */ /** - * Initalizes the gpu Python module. + * Initializes the gpu Python module. */ PyObject *GPU_initPython(void); diff --git a/source/blender/python/mathutils/mathutils_Color.c b/source/blender/python/mathutils/mathutils_Color.c index 05fc84eaa87..8b5e39fbd27 100644 --- a/source/blender/python/mathutils/mathutils_Color.c +++ b/source/blender/python/mathutils/mathutils_Color.c @@ -565,7 +565,7 @@ static PyObject *Color_div(PyObject *v1, PyObject *v2) return NULL; } -/* mulplication in-place: obj *= obj */ +/* multiplication in-place: obj *= obj */ static PyObject *Color_imul(PyObject *v1, PyObject *v2) { ColorObject *color = (ColorObject *)v1; @@ -591,7 +591,7 @@ static PyObject *Color_imul(PyObject *v1, PyObject *v2) return v1; } -/* mulplication in-place: obj *= obj */ +/* multiplication in-place: obj *= obj */ static PyObject *Color_idiv(PyObject *v1, PyObject *v2) { ColorObject *color = (ColorObject *)v1; diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index be519ded88e..9a0a1b3ca95 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -1875,7 +1875,7 @@ static PyObject *Matrix_sub(PyObject *m1, PyObject *m2) return Matrix_CreatePyObject(mat, mat1->num_col, mat1->num_row, Py_NEW, Py_TYPE(mat1)); } /*------------------------obj * obj------------------------------ - * mulplication */ + * multiplication */ static PyObject *matrix_mul_float(MatrixObject *mat, const float scalar) { float tmat[16]; diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index b595dab494d..2debff68af1 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -795,8 +795,8 @@ static PyObject *quat_mul_float(QuaternionObject *quat, const float scalar) return Quaternion_CreatePyObject(tquat, Py_NEW, Py_TYPE(quat)); } -//------------------------obj * obj------------------------------ -//mulplication +/*------------------------obj * obj------------------------------ + * multiplication */ static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2) { float quat[QUAT_SIZE], scalar; diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index 74a4cd838d0..d461486d485 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -1530,7 +1530,7 @@ static PyObject *Vector_isub(PyObject *v1, PyObject *v2) } /*------------------------obj * obj------------------------------ - * mulplication*/ + * multiplication */ /* COLUMN VECTOR Multiplication (Matrix X Vector) @@ -1687,7 +1687,7 @@ static PyObject *Vector_mul(PyObject *v1, PyObject *v2) return NULL; } -/* mulplication in-place: obj *= obj */ +/* multiplication in-place: obj *= obj */ static PyObject *Vector_imul(PyObject *v1, PyObject *v2) { VectorObject *vec = (VectorObject *)v1; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 9bc639515c2..2e3468862d9 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -3972,6 +3972,9 @@ static void add_lightgroup(Render *re, Group *group, int exclusive) /* note that 'exclusive' will remove it from the global list */ for (go= group->gobject.first; go; go= go->next) { go->lampren= NULL; + + if (go->ob->restrictflag & OB_RESTRICT_RENDER) + continue; if (go->ob->lay & re->lay) { if (go->ob && go->ob->type==OB_LAMP) { diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c index 7a9df51e493..f62ed909094 100644 --- a/source/blender/render/intern/source/imagetexture.c +++ b/source/blender/render/intern/source/imagetexture.c @@ -1054,7 +1054,9 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex if ((ibuf == NULL) || ((ibuf->rect == NULL) && (ibuf->rect_float == NULL))) return retval; - ima->flag |= IMA_USED_FOR_RENDER; + if (ima) { + ima->flag |= IMA_USED_FOR_RENDER; + } /* mipmap test */ image_mipmap_test(tex, ibuf); diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index ecd8524016d..981f705e07c 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2175,14 +2175,6 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr G.is_rendering = FALSE; } -static void colormanage_image_for_write(Scene *scene, ImBuf *ibuf) -{ - IMB_display_buffer_to_imbuf_rect(ibuf, &scene->view_settings, &scene->display_settings); - - if (ibuf) - imb_freerectfloatImBuf(ibuf); -} - void RE_RenderFreestyleStrokes(Render *re, Main *bmain, Scene *scene) { re->result_ok= 0; @@ -2213,7 +2205,9 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie do_free = TRUE; } - colormanage_image_for_write(scene, ibuf); + + IMB_colormanagement_imbuf_for_write(ibuf, TRUE, FALSE, &scene->view_settings, + &scene->display_settings, &scene->r.im_format); ok = mh->append_movie(&re->r, scene->r.sfra, scene->r.cfra, (int *) ibuf->rect, ibuf->x, ibuf->y, re->reports); @@ -2241,12 +2235,9 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie } else { ImBuf *ibuf = render_result_rect_to_ibuf(&rres, &scene->r); - int do_colormanagement; - do_colormanagement = !BKE_imtype_supports_float(scene->r.im_format.imtype); - - if (do_colormanagement) - colormanage_image_for_write(scene, ibuf); + IMB_colormanagement_imbuf_for_write(ibuf, TRUE, FALSE, &scene->view_settings, + &scene->display_settings, &scene->r.im_format); ok = BKE_imbuf_write_stamp(scene, camera, ibuf, name, &scene->r.im_format); @@ -2265,7 +2256,8 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie BKE_add_image_extension(name, R_IMF_IMTYPE_JPEG90); ibuf->planes = 24; - colormanage_image_for_write(scene, ibuf); + IMB_colormanagement_imbuf_for_write(ibuf, TRUE, FALSE, &scene->view_settings, + &scene->display_settings, &imf); BKE_imbuf_write_stamp(scene, camera, ibuf, name, &imf); printf("\nSaved: %s", name); @@ -2611,7 +2603,7 @@ int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env, return 0; } - IMB_display_buffer_to_imbuf_rect(ibuf, &scene->view_settings, &scene->display_settings); + IMB_colormanagement_imbuf_for_write(ibuf, TRUE, FALSE, &scene->view_settings, &scene->display_settings, &imf); /* to save, we first get absolute path */ BLI_strncpy(filepath, relpath, sizeof(filepath)); diff --git a/source/blender/render/intern/source/sunsky.c b/source/blender/render/intern/source/sunsky.c index 6a1517e19fb..94e94b98d26 100644 --- a/source/blender/render/intern/source/sunsky.c +++ b/source/blender/render/intern/source/sunsky.c @@ -275,7 +275,7 @@ void GetSkyXYZRadiance(struct SunSky *sunsky, float theta, float phi, float colo /* Compute xyY values */ x = PerezFunction(sunsky, sunsky->perez_x, theta, gamma, sunsky->zenith_x); y = PerezFunction(sunsky, sunsky->perez_y, theta, gamma, sunsky->zenith_y); - Y = 6.666666667e-5f *nfade *hfade *PerezFunction(sunsky, sunsky->perez_Y, theta, gamma, sunsky->zenith_Y); + Y = 6.666666667e-5f * nfade * hfade * PerezFunction(sunsky, sunsky->perez_Y, theta, gamma, sunsky->zenith_Y); if (sunsky->sky_exposure != 0.0f) Y = 1.0 - exp(Y * sunsky->sky_exposure); diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 9570638fb25..ac05331095b 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -155,6 +155,7 @@ struct wmEventHandler *WM_event_add_dropbox_handler(ListBase *handlers, ListBase /* mouse */ void WM_event_add_mousemove(struct bContext *C); +void WM_event_add_mousemove_window(struct wmWindow *window); int WM_modal_tweak_exit(struct wmEvent *evt, int tweak_event); /* notifiers */ diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index c05d9532f74..2f238cd22e7 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2021,23 +2021,26 @@ void wm_event_do_handlers(bContext *C) Scene *scene = win->screen->scene; if (scene) { - int playing = sound_scene_playing(win->screen->scene); + int is_playing_sound = sound_scene_playing(win->screen->scene); - if (playing != -1) { + if (is_playing_sound != -1) { + int is_playing_screen; CTX_wm_window_set(C, win); CTX_wm_screen_set(C, win->screen); CTX_data_scene_set(C, scene); - if (((playing == 1) && (!ED_screen_animation_playing(wm))) || - ((playing == 0) && (ED_screen_animation_playing(wm)))) + is_playing_screen = (ED_screen_animation_playing(wm) != NULL); + + if (((is_playing_sound == 1) && (is_playing_screen == 0)) || + ((is_playing_sound == 0) && (is_playing_screen == 1))) { ED_screen_animation_play(C, -1, 1); } - if (playing == 0) { - float time = sound_sync_scene(scene); + if (is_playing_sound == 0) { + const float time = sound_sync_scene(scene); if (finite(time)) { - int ncfra = sound_sync_scene(scene) * (float)FPS + 0.5f; + int ncfra = time * (float)FPS + 0.5f; if (ncfra != scene->r.cfra) { scene->r.cfra = ncfra; ED_update_for_newframe(CTX_data_main(C), scene, 1); @@ -2469,6 +2472,11 @@ void WM_event_add_mousemove(bContext *C) window->addmousemove = 1; } +void WM_event_add_mousemove_window(wmWindow *window) +{ + window->addmousemove = 1; +} + /* for modal callbacks, check configuration for how to interpret exit with tweaks */ int WM_modal_tweak_exit(wmEvent *evt, int tweak_event) { diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 534bfdc369e..9bb3b2a0e69 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -114,8 +114,6 @@ #include "BKE_sound.h" #include "COM_compositor.h" -#include "IMB_colormanagement.h" - static void wm_init_reports(bContext *C) { BKE_reports_init(CTX_wm_reports(C), RPT_STORE); @@ -144,12 +142,6 @@ void WM_init(bContext *C, int argc, const char **argv) ED_spacetypes_init(); /* editors/space_api/spacetype.c */ - /* initialize color management stuff - * do this before ED_file_init because that function would load images, - * so at least default byte color space should be already known - */ - IMB_colormanagement_init(); - ED_file_init(); /* for fsmenu */ ED_node_init_butfuncs(); @@ -374,8 +366,6 @@ void WM_exit_ext(bContext *C, const short do_python) sound_exit(); - IMB_colormanagement_exit(); - /* first wrap up running stuff, we assume only the active WM is running */ /* modal handlers are on window level freed, others too? */ /* note; same code copied in wm_files.c */ diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c index e3d6b0f73e1..4a410363167 100644 --- a/source/blender/windowmanager/intern/wm_jobs.c +++ b/source/blender/windowmanager/intern/wm_jobs.c @@ -492,7 +492,11 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt) WM_event_add_notifier(C, wm_job->endnote, NULL); WM_event_add_notifier(C, NC_WM | ND_JOB, NULL); - + + /* so the info header updates on job end even if the mouse doesn't move. + * a rather annoying/obscure bug, see [#32537] (second reply) */ + WM_event_add_mousemove_window(wm_job->win); + /* new job added for wm_job? */ if (wm_job->customdata) { // printf("job restarted with new data %s\n", wm_job->name); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 18072d805fc..d0bed4e5965 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -933,7 +933,7 @@ static int wm_window_timer(const bContext *C) wt->delta = time - wt->ltime; wt->duration += wt->delta; wt->ltime = time; - wt->ntime = wt->stime + wt->timestep *ceil(wt->duration / wt->timestep); + wt->ntime = wt->stime + wt->timestep * ceil(wt->duration / wt->timestep); if (wt->event_type == TIMERJOBS) wm_jobs_timer(C, wm, wt); diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 5236f928581..ce71757e7cb 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -637,7 +637,7 @@ elseif(WIN32) if(WITH_OPENIMAGEIO) if(NOT MINGW) - set_lib_path(OIIOBIN "openimageio") + set(OIIOBIN ${LIBDIR}/openimageio) install( FILES ${OIIOBIN}/bin/OpenImageIO.dll @@ -647,7 +647,7 @@ elseif(WIN32) endif() if(WITH_OPENCOLORIO) - set_lib_path(OCIOBIN "opencolorio/bin") + set(OCIOBIN ${LIBDIR}/opencolorio/bin) if(NOT MINGW) install( FILES @@ -737,7 +737,15 @@ elseif(APPLE) ) endif() - + + #OSL shader_headers needed + if(WITH_CYCLES_OSL) + install( + FILES ${LIBDIR}/osl/shaders/oslutil.h ${LIBDIR}/osl/shaders/stdosl.h + DESTINATION ${TARGETDIR}/blender.app/Contents/shaders/ + ) + endif() + # install blenderplayer bundle - copy of blender.app above. re-using macros et al # note we are using OSX Bundle as base and copying Blender dummy bundle on top of it if(WITH_GAMEENGINE AND WITH_PLAYER) @@ -779,6 +787,7 @@ elseif(APPLE) endif() endif() + endif() # ----------------------------------------------------------------------------- diff --git a/source/gameengine/Expressions/ListValue.cpp b/source/gameengine/Expressions/ListValue.cpp index 88b0a986a05..43f84d273fd 100644 --- a/source/gameengine/Expressions/ListValue.cpp +++ b/source/gameengine/Expressions/ListValue.cpp @@ -316,7 +316,37 @@ static PyObject *listvalue_buffer_item(PyObject *self, Py_ssize_t index) return cval->GetProxy(); } -static PyObject *listvalue_mapping_subscript(PyObject *self, PyObject *pyindex) + +/* just slice it into a python list... */ +static PyObject *listvalue_buffer_slice(CListValue *list, Py_ssize_t start, Py_ssize_t stop) +{ + PyObject *newlist; + Py_ssize_t i, j; + + /* caller needs to validate negative index */ +#if 0 + Py_ssize_t len = list->GetCount(); + + if (start > len) start = len; + if (stop > len) stop = len; +#endif + + newlist = PyList_New(stop - start); + if (!newlist) + return NULL; + + for (i = start, j = 0; i < stop; i++, j++) { + PyObject *pyobj = list->GetValue(i)->ConvertValueToPython(); + if (!pyobj) { + pyobj = list->GetValue(i)->GetProxy(); + } + PyList_SET_ITEM(newlist, j, pyobj); + } + return newlist; +} + + +static PyObject *listvalue_mapping_subscript(PyObject *self, PyObject *key) { CListValue *list= static_cast(BGE_PROXY_REF(self)); if (list==NULL) { @@ -324,9 +354,8 @@ static PyObject *listvalue_mapping_subscript(PyObject *self, PyObject *pyindex) return NULL; } - if (PyUnicode_Check(pyindex)) - { - CValue *item = ((CListValue*) list)->FindValue(_PyUnicode_AsString(pyindex)); + if (PyUnicode_Check(key)) { + CValue *item = ((CListValue*) list)->FindValue(_PyUnicode_AsString(key)); if (item) { PyObject *pyobj = item->ConvertValueToPython(); if (pyobj) @@ -335,54 +364,33 @@ static PyObject *listvalue_mapping_subscript(PyObject *self, PyObject *pyindex) return item->GetProxy(); } } - else if (PyLong_Check(pyindex)) - { - int index = PyLong_AsSsize_t(pyindex); + else if (PyIndex_Check(key)) { + int index = PyLong_AsSsize_t(key); return listvalue_buffer_item(self, index); /* wont add a ref */ } + else if (PySlice_Check(key)) { + Py_ssize_t start, stop, step, slicelength; + + if (PySlice_GetIndicesEx(key, list->GetCount(), &start, &stop, &step, &slicelength) < 0) + return NULL; + + if (slicelength <= 0) { + return PyList_New(0); + } + else if (step == 1) { + return listvalue_buffer_slice(list, start, stop); + } + else { + PyErr_SetString(PyExc_TypeError, "CList[slice]: slice steps not supported"); + return NULL; + } + } PyErr_Format(PyExc_KeyError, - "CList[key]: '%R' key not in list", pyindex); + "CList[key]: '%R' key not in list", key); return NULL; } - -/* just slice it into a python list... */ -static PyObject *listvalue_buffer_slice(PyObject *self,Py_ssize_t ilow, Py_ssize_t ihigh) -{ - CListValue *list= static_cast(BGE_PROXY_REF(self)); - if (list==NULL) { - PyErr_SetString(PyExc_SystemError, "val = CList[i:j], "BGE_PROXY_ERROR_MSG); - return NULL; - } - - int i, j; - PyObject *newlist; - - if (ilow < 0) ilow = 0; - - int n = ((CListValue*) list)->GetCount(); - - if (ihigh >= n) - ihigh = n; - if (ihigh < ilow) - ihigh = ilow; - - newlist = PyList_New(ihigh - ilow); - if (!newlist) - return NULL; - - for (i = ilow, j = 0; i < ihigh; i++, j++) - { - PyObject *pyobj = list->GetValue(i)->ConvertValueToPython(); - if (!pyobj) - pyobj = list->GetValue(i)->GetProxy(); - PyList_SET_ITEM(newlist, i, pyobj); - } - return newlist; -} - - /* clist + list, return a list that python owns */ static PyObject *listvalue_buffer_concat(PyObject *self, PyObject *other) { diff --git a/source/gameengine/GamePlayer/common/bmfont.cpp b/source/gameengine/GamePlayer/common/bmfont.cpp index 6f40d13fe7a..fe6f2187138 100644 --- a/source/gameengine/GamePlayer/common/bmfont.cpp +++ b/source/gameengine/GamePlayer/common/bmfont.cpp @@ -104,7 +104,7 @@ void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step) ysize = (bytes + (ibuf->x - 1)) / ibuf->x; if (ysize < ibuf->y) { - // we're first going to copy all data into a liniar buffer. + // we're first going to copy all data into a linear buffer. // step can be 4 or 1 bytes, and the data is not sequential because // the bitmap was flipped vertically. diff --git a/source/tests/bl_rna_wiki_reference.py b/source/tests/bl_rna_wiki_reference.py index a4019214138..cfe7f22f7dd 100644 --- a/source/tests/bl_rna_wiki_reference.py +++ b/source/tests/bl_rna_wiki_reference.py @@ -29,9 +29,10 @@ import bpy + def test_data(): import rna_wiki_reference - + assert(isinstance(rna_wiki_reference.url_manual_mapping, tuple)) for i, value in enumerate(rna_wiki_reference.url_manual_mapping): try: @@ -44,12 +45,11 @@ def test_data(): traceback.print_exc() raise -# a stripped down version of api_dump() in rna_info_dump.py +# a stripped down version of api_dump() in rna_info_dump.py def test_lookup_coverage(): def rna_ids(): - import rna_info struct = rna_info.BuildRNAInfo()[0] for struct_id, v in sorted(struct.items()): @@ -81,11 +81,12 @@ def test_lookup_coverage(): print("") print("---------------------") print("Undocumented Sections") - + for rna_group in sorted(set_group_all): if rna_group not in set_group_doc: print("%s.*" % rna_group) + def test_urls(): pass # TODO diff --git a/source/tests/bl_run_operators.py b/source/tests/bl_run_operators.py index 146b60b8f28..f792b83a8cd 100644 --- a/source/tests/bl_run_operators.py +++ b/source/tests/bl_run_operators.py @@ -89,6 +89,7 @@ def run_ops(operators, setup_func=None, reset=True): bpy.ops.wm.read_factory_settings() setup_func() + # contexts def ctx_clear_scene(): # copied from batch_import.py unique_obs = set() @@ -231,7 +232,7 @@ def main(): #import random #random.shuffle(operators) - + # 2 passes, first just run setup_func to make sure they are ok for operators_test in ((), operators): # Run the operator tests in different contexts @@ -259,7 +260,7 @@ def main(): run_ops(operators_test, setup_func=ctx_editmode_mball) run_ops(operators_test, setup_func=ctx_editmode_text) run_ops(operators_test, setup_func=ctx_editmode_lattice) - + if not operators_test: print("All setup functions run fine!")