Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonique <mdewanchand@atmind.nl>2022-09-10 16:53:28 +0300
committerMonique <mdewanchand@atmind.nl>2022-09-10 16:53:28 +0300
commitefb81f45dd8b24b408afe4a00e0aef91d2fb9c0e (patch)
tree1086fad304a998998c05885c11d1202512b857fa
parent5082fd5e63737bf8cb76478d143647e1907d13f4 (diff)
parent98c4e1e590cbfe0e16f8da8c0664830c5979ad65 (diff)
Merge branch 'master' into temp-T73411-add-scene-parameters
-rw-r--r--CMakeLists.txt14
-rwxr-xr-xbuild_files/build_environment/install_deps.sh17
-rw-r--r--build_files/cmake/Modules/FindPythonLibsUnix.cmake16
-rw-r--r--build_files/cmake/macros.cmake8
-rw-r--r--build_files/cmake/platform/platform_apple.cmake43
-rw-r--r--intern/cycles/kernel/osl/closures.cpp2
-rw-r--r--intern/cycles/kernel/osl/services.cpp4
-rw-r--r--intern/cycles/kernel/osl/shader.cpp13
-rw-r--r--intern/cycles/kernel/osl/types.h1
-rw-r--r--release/scripts/startup/bl_ui/space_outliner.py1
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py1
-rw-r--r--source/blender/blenkernel/BKE_appdir.h31
-rw-r--r--source/blender/blenkernel/intern/appdir.c1
-rw-r--r--source/blender/blenkernel/intern/mesh.cc2
-rw-r--r--source/blender/blenkernel/intern/studiolight.c22
-rw-r--r--source/blender/blenlib/intern/system.c4
-rw-r--r--source/blender/bmesh/operators/bmo_utils.c4
-rw-r--r--source/blender/editors/asset/intern/asset_ops.cc1
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c95
-rw-r--r--source/blender/editors/gpencil/gpencil_intern.h1
-rw-r--r--source/blender/editors/gpencil/gpencil_ops.c1
-rw-r--r--source/blender/editors/screen/area.c10
-rw-r--r--source/blender/editors/space_action/space_action.c2
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c2
-rw-r--r--source/blender/editors/space_clip/space_clip.c2
-rw-r--r--source/blender/editors/space_console/space_console.c2
-rw-r--r--source/blender/editors/space_file/file_ops.c136
-rw-r--r--source/blender/editors/space_file/fsmenu.c19
-rw-r--r--source/blender/editors/space_file/fsmenu.h7
-rw-r--r--source/blender/editors/space_file/space_file.c2
-rw-r--r--source/blender/editors/space_graph/space_graph.c2
-rw-r--r--source/blender/editors/space_image/space_image.c2
-rw-r--r--source/blender/editors/space_info/space_info.c2
-rw-r--r--source/blender/editors/space_nla/space_nla.c2
-rw-r--r--source/blender/editors/space_node/space_node.cc2
-rw-r--r--source/blender/editors/space_outliner/space_outliner.cc2
-rw-r--r--source/blender/editors/space_script/space_script.c2
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c2
-rw-r--r--source/blender/editors/space_spreadsheet/space_spreadsheet.cc2
-rw-r--r--source/blender/editors/space_statusbar/space_statusbar.c2
-rw-r--r--source/blender/editors/space_text/space_text.c2
-rw-r--r--source/blender/editors/space_text/text_draw.c2
-rw-r--r--source/blender/editors/space_topbar/space_topbar.c2
-rw-r--r--source/blender/editors/space_userpref/space_userpref.c2
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c2
-rw-r--r--source/blender/imbuf/intern/cineon/cineonlib.c9
-rw-r--r--source/blender/imbuf/intern/cineon/dpxlib.c7
-rw-r--r--source/blender/makesdna/DNA_sequence_types.h2
-rw-r--r--source/blender/modifiers/intern/MOD_volume_to_mesh.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_bokehblur.cc2
-rw-r--r--source/blender/python/gpu/gpu_py_shader.c4
-rw-r--r--source/blender/render/intern/render_result.cc2
-rw-r--r--source/blender/sequencer/intern/proxy.c4
-rw-r--r--source/blender/windowmanager/intern/wm_files.c25
-rw-r--r--source/blender/windowmanager/intern/wm_platform_support.c44
-rw-r--r--source/creator/CMakeLists.txt6
56 files changed, 335 insertions, 266 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 53859196cfb..5a08e7d167c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -157,9 +157,6 @@ mark_as_advanced(WITH_PYTHON_SECURITY) # some distributions see this as a secur
option(WITH_PYTHON_SAFETY "Enable internal API error checking to track invalid data to prevent crash on access (at the expense of some efficiency, only enable for development)." OFF)
mark_as_advanced(WITH_PYTHON_SAFETY)
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), installs to PYTHON_SITE_PACKAGES (or CMAKE_INSTALL_PREFIX if WITH_INSTALL_PORTABLE is enabled)." OFF)
-if(APPLE)
- option(WITH_PYTHON_FRAMEWORK "Enable building using the Python available in the framework (OSX only)" OFF)
-endif()
option(WITH_BUILDINFO "Include extra build details (only disable for development & faster builds)" ON)
set(BUILDINFO_OVERRIDE_DATE "" CACHE STRING "Use instead of the current date for reproducible builds (empty string disables this option)")
@@ -1628,8 +1625,8 @@ if(WITH_PYTHON)
)
endif()
- if(WIN32 OR APPLE)
- # Windows and macOS have this bundled with Python libraries.
+ if(WIN32)
+ # Always use numpy bundled in precompiled libs.
elseif((WITH_PYTHON_INSTALL AND WITH_PYTHON_INSTALL_NUMPY) OR WITH_PYTHON_NUMPY)
if(("${PYTHON_NUMPY_PATH}" STREQUAL "") OR (${PYTHON_NUMPY_PATH} MATCHES NOTFOUND))
find_python_package(numpy "core/include")
@@ -1637,13 +1634,13 @@ if(WITH_PYTHON)
endif()
if(WIN32 OR APPLE)
- # pass, we have this in lib/python/site-packages
+ # Always copy from precompiled libs.
elseif(WITH_PYTHON_INSTALL_REQUESTS)
find_python_package(requests "")
endif()
if(WIN32 OR APPLE)
- # pass, we have this in lib/python/site-packages
+ # Always copy from precompiled libs.
elseif(WITH_PYTHON_INSTALL_ZSTANDARD)
find_python_package(zstandard "")
endif()
@@ -1908,9 +1905,6 @@ if(FIRST_RUN)
info_cfg_option(WITH_LZO)
info_cfg_text("Python:")
- if(APPLE)
- info_cfg_option(WITH_PYTHON_FRAMEWORK)
- endif()
info_cfg_option(WITH_PYTHON_INSTALL)
info_cfg_option(WITH_PYTHON_INSTALL_NUMPY)
info_cfg_option(WITH_PYTHON_INSTALL_ZSTANDARD)
diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh
index 60665d31521..287a7a0c962 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -136,7 +136,7 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS:
Build and install the OpenImageDenoise libraries.
--with-nanovdb
- Build and install the NanoVDB branch of OpenVDB (instead of official release of OpenVDB).
+ Build and install NanoVDB together with OpenVDB.
--with-jack
Install the jack libraries.
@@ -534,10 +534,10 @@ OSD_SKIP=false
# OpenVDB needs to be compiled for now
OPENVDB_BLOSC_VERSION="1.21.1"
-OPENVDB_VERSION="9.0.0"
-OPENVDB_VERSION_SHORT="9.0"
+OPENVDB_VERSION="9.1.0"
+OPENVDB_VERSION_SHORT="9.1"
OPENVDB_VERSION_MIN="9.0"
-OPENVDB_VERSION_MEX="9.1"
+OPENVDB_VERSION_MEX="9.2"
OPENVDB_FORCE_BUILD=false
OPENVDB_FORCE_REBUILD=false
OPENVDB_SKIP=false
@@ -2919,6 +2919,10 @@ compile_OPENVDB() {
cmake_d="$cmake_d -D CMAKE_INSTALL_PREFIX=$_inst"
cmake_d="$cmake_d -D USE_STATIC_DEPENDENCIES=OFF"
cmake_d="$cmake_d -D OPENVDB_BUILD_BINARIES=OFF"
+ # Unfortunately OpenVDB currently forces using recent oneTBB over older versions when it finds it,
+ # even when TBB_ROOT is specified. So have to prevent any check for system library -
+ # in the hope it will not break in some other cases.
+ cmake_d="$cmake_d -D DISABLE_CMAKE_SEARCH_PATHS=ON"
if [ "$WITH_NANOVDB" = true ]; then
cmake_d="$cmake_d -D USE_NANOVDB=ON"
@@ -2931,7 +2935,6 @@ compile_OPENVDB() {
cmake_d="$cmake_d -D Boost_USE_MULTITHREADED=ON"
cmake_d="$cmake_d -D Boost_NO_SYSTEM_PATHS=ON"
cmake_d="$cmake_d -D Boost_NO_BOOST_CMAKE=ON"
- cmake_d="$cmake_d -D Boost_NO_BOOST_CMAKE=ON"
fi
if [ -d $INST/tbb ]; then
cmake_d="$cmake_d -D TBB_ROOT=$INST/tbb"
@@ -3195,7 +3198,7 @@ _init_opencollada() {
_inst_shortcut=$INST/opencollada
}
-_update_deps_collada() {
+_update_deps_opencollada() {
:
}
@@ -6215,7 +6218,7 @@ print_info() {
fi
if [ -d $INST/nanovdb ]; then
_1="-D WITH_NANOVDB=ON"
- _2="-D NANOVDB_ROOT_DIR=$INST/nanovdb"
+ _2="-D NANOVDB_ROOT_DIR=$INST/openvdb"
PRINT " $_1"
PRINT " $_2"
_buildargs="$_buildargs $_1 $_2"
diff --git a/build_files/cmake/Modules/FindPythonLibsUnix.cmake b/build_files/cmake/Modules/FindPythonLibsUnix.cmake
index 1e88621303f..0afe1299330 100644
--- a/build_files/cmake/Modules/FindPythonLibsUnix.cmake
+++ b/build_files/cmake/Modules/FindPythonLibsUnix.cmake
@@ -34,11 +34,17 @@ SET(PYTHON_VERSION 3.10 CACHE STRING "Python Version (major and minor only)")
MARK_AS_ADVANCED(PYTHON_VERSION)
-# See: http://docs.python.org/extending/embedding.html#linking-requirements
-# for why this is needed
-SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic" CACHE STRING "Linker flags for python")
-MARK_AS_ADVANCED(PYTHON_LINKFLAGS)
-
+if(APPLE)
+ if(WITH_PYTHON_MODULE)
+ set(PYTHON_LINKFLAGS "-undefined dynamic_lookup")
+ else()
+ set(PYTHON_LINKFLAGS)
+ endif()
+else()
+ # See: http://docs.python.org/extending/embedding.html#linking-requirements
+ SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic" CACHE STRING "Linker flags for python")
+ MARK_AS_ADVANCED(PYTHON_LINKFLAGS)
+endif()
# if the user passes these defines as args, we don't want to overwrite
SET(_IS_INC_DEF OFF)
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 5508e8f2104..d271d8f216f 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -1208,16 +1208,8 @@ endmacro()
macro(without_system_libs_begin)
set(CMAKE_IGNORE_PATH "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES};${CMAKE_SYSTEM_INCLUDE_PATH};${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES};${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}")
- if(APPLE)
- # Avoid searching for headers in frameworks (like Mono), and libraries in LIBDIR.
- set(CMAKE_FIND_FRAMEWORK NEVER)
- endif()
endmacro()
macro(without_system_libs_end)
unset(CMAKE_IGNORE_PATH)
- if(APPLE)
- # FIRST is the default.
- set(CMAKE_FIND_FRAMEWORK FIRST)
- endif()
endmacro()
diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake
index bc5baf43530..e428b2abab3 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -36,6 +36,9 @@ endmacro()
# ------------------------------------------------------------------------
# Find system provided libraries.
+# Avoid searching for headers in frameworks (like Mono), and libraries in LIBDIR.
+set(CMAKE_FIND_FRAMEWORK NEVER)
+
# Find system ZLIB, not the pre-compiled one supplied with OpenCollada.
set(ZLIB_ROOT /usr)
find_package(ZLIB REQUIRED)
@@ -75,6 +78,11 @@ if(NOT EXISTS "${LIBDIR}/")
message(FATAL_ERROR "Mac OSX requires pre-compiled libs at: '${LIBDIR}'")
endif()
+# Optionally use system Python if PYTHON_ROOT_DIR is specified.
+if(WITH_PYTHON AND (WITH_PYTHON_MODULE AND PYTHON_ROOT_DIR))
+ find_package(PythonLibsUnix REQUIRED)
+endif()
+
# Prefer lib directory paths
file(GLOB LIB_SUBDIRS ${LIBDIR}/*)
set(CMAKE_PREFIX_PATH ${LIB_SUBDIRS})
@@ -123,34 +131,8 @@ if(WITH_CODEC_SNDFILE)
unset(_sndfile_VORBISENC_LIBRARY)
endif()
-if(WITH_PYTHON)
- # Use precompiled libraries by default.
- set(PYTHON_VERSION 3.10)
- if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
- # Normally cached but not since we include them with blender.
- set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}")
- set(PYTHON_EXECUTABLE "${LIBDIR}/python/bin/python${PYTHON_VERSION}")
- set(PYTHON_LIBRARY ${LIBDIR}/python/lib/libpython${PYTHON_VERSION}.a)
- set(PYTHON_LIBPATH "${LIBDIR}/python/lib/python${PYTHON_VERSION}")
- else()
- # Module must be compiled against Python framework.
- set(_py_framework "/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}")
- set(PYTHON_INCLUDE_DIR "${_py_framework}/include/python${PYTHON_VERSION}")
- set(PYTHON_EXECUTABLE "${_py_framework}/bin/python${PYTHON_VERSION}")
- set(PYTHON_LIBPATH "${_py_framework}/lib/python${PYTHON_VERSION}")
- unset(_py_framework)
- endif()
-
- # uncached vars
- set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
- set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
-
- # needed for Audaspace, numpy is installed into python site-packages
- set(PYTHON_NUMPY_INCLUDE_DIRS "${PYTHON_LIBPATH}/site-packages/numpy/core/include")
-
- if(NOT EXISTS "${PYTHON_EXECUTABLE}")
- message(FATAL_ERROR "Python executable missing: ${PYTHON_EXECUTABLE}")
- endif()
+if(WITH_PYTHON AND NOT (WITH_PYTHON_MODULE AND PYTHON_ROOT_DIR))
+ find_package(PythonLibsUnix REQUIRED)
endif()
if(WITH_FFTW3)
@@ -213,11 +195,6 @@ if(WITH_JACK)
string(APPEND PLATFORM_LINKFLAGS " -F/Library/Frameworks -weak_framework jackmp")
endif()
-if(WITH_PYTHON_MODULE OR WITH_PYTHON_FRAMEWORK)
- # force cmake to link right framework
- string(APPEND PLATFORM_LINKFLAGS " /Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}/Python")
-endif()
-
if(WITH_OPENCOLLADA)
find_package(OpenCOLLADA)
find_library(PCRE_LIBRARIES NAMES pcre HINTS ${LIBDIR}/opencollada/lib)
diff --git a/intern/cycles/kernel/osl/closures.cpp b/intern/cycles/kernel/osl/closures.cpp
index 604d672063b..45ecd5132ef 100644
--- a/intern/cycles/kernel/osl/closures.cpp
+++ b/intern/cycles/kernel/osl/closures.cpp
@@ -20,8 +20,8 @@
#include "kernel/device/cpu/compat.h"
#include "kernel/device/cpu/globals.h"
-#include "kernel/osl/types.h"
#include "kernel/osl/closures_setup.h"
+#include "kernel/osl/types.h"
CCL_NAMESPACE_BEGIN
diff --git a/intern/cycles/kernel/osl/services.cpp b/intern/cycles/kernel/osl/services.cpp
index 334f06861b2..cff3e24a739 100644
--- a/intern/cycles/kernel/osl/services.cpp
+++ b/intern/cycles/kernel/osl/services.cpp
@@ -450,6 +450,7 @@ static bool set_attribute_float2(float2 f[3], TypeDesc type, bool derivatives, v
return false;
}
+#if 0
static bool set_attribute_float2(float2 f, TypeDesc type, bool derivatives, void *val)
{
float2 fv[3];
@@ -460,6 +461,7 @@ static bool set_attribute_float2(float2 f, TypeDesc type, bool derivatives, void
return set_attribute_float2(fv, type, derivatives, val);
}
+#endif
static bool set_attribute_float3(float3 f[3], TypeDesc type, bool derivatives, void *val)
{
@@ -588,6 +590,7 @@ static bool set_attribute_float4(float4 f[3], TypeDesc type, bool derivatives, v
return false;
}
+#if 0
static bool set_attribute_float4(float4 f, TypeDesc type, bool derivatives, void *val)
{
float4 fv[3];
@@ -598,6 +601,7 @@ static bool set_attribute_float4(float4 f, TypeDesc type, bool derivatives, void
return set_attribute_float4(fv, type, derivatives, val);
}
+#endif
static bool set_attribute_float(float f[3], TypeDesc type, bool derivatives, void *val)
{
diff --git a/intern/cycles/kernel/osl/shader.cpp b/intern/cycles/kernel/osl/shader.cpp
index 83fdfab1217..c3079e8af4d 100644
--- a/intern/cycles/kernel/osl/shader.cpp
+++ b/intern/cycles/kernel/osl/shader.cpp
@@ -150,7 +150,8 @@ static void flatten_surface_closure_tree(const KernelGlobalsCPU *kg,
switch (closure->id) {
case OSL::ClosureColor::MUL: {
OSL::ClosureMul *mul = (OSL::ClosureMul *)closure;
- flatten_surface_closure_tree(kg, sd, path_flag, mul->closure, TO_FLOAT3(mul->weight) * weight);
+ flatten_surface_closure_tree(
+ kg, sd, path_flag, mul->closure, TO_FLOAT3(mul->weight) * weight);
break;
}
case OSL::ClosureColor::ADD: {
@@ -161,14 +162,10 @@ static void flatten_surface_closure_tree(const KernelGlobalsCPU *kg,
}
#define OSL_CLOSURE_STRUCT_BEGIN(Upper, lower) \
case OSL_CLOSURE_##Upper##_ID: { \
- const OSL::ClosureComponent *comp = \
- reinterpret_cast<const OSL::ClosureComponent *>(closure); \
+ const OSL::ClosureComponent *comp = reinterpret_cast<const OSL::ClosureComponent *>(closure); \
weight *= TO_FLOAT3(comp->w); \
- osl_closure_##lower##_setup(kg, \
- sd, \
- path_flag, \
- weight, \
- reinterpret_cast<const Upper##Closure *>(comp + 1)); \
+ osl_closure_##lower##_setup( \
+ kg, sd, path_flag, weight, reinterpret_cast<const Upper##Closure *>(comp + 1)); \
break; \
}
#include "closures_template.h"
diff --git a/intern/cycles/kernel/osl/types.h b/intern/cycles/kernel/osl/types.h
index 14feb16aad4..46e06114360 100644
--- a/intern/cycles/kernel/osl/types.h
+++ b/intern/cycles/kernel/osl/types.h
@@ -17,5 +17,4 @@ enum ClosureTypeOSL {
#include "closures_template.h"
};
-
CCL_NAMESPACE_END
diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py
index 5c488748db8..2b60158e3ae 100644
--- a/release/scripts/startup/bl_ui/space_outliner.py
+++ b/release/scripts/startup/bl_ui/space_outliner.py
@@ -331,6 +331,7 @@ def has_selected_ids_in_context(context):
return False
+
class OUTLINER_MT_asset(Menu):
bl_label = "Assets"
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 23c3b0191d4..c07853789ba 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -5175,6 +5175,7 @@ class VIEW3D_MT_edit_gpencil_stroke(Menu):
layout.operator("gpencil.stroke_cyclical_set", text="Toggle Cyclic").type = 'TOGGLE'
layout.operator_menu_enum("gpencil.stroke_caps_set", text="Toggle Caps", property="type")
layout.operator("gpencil.stroke_flip", text="Switch Direction")
+ layout.operator("gpencil.stroke_start_set", text="Set Start Point")
layout.separator()
layout.operator("gpencil.stroke_normalize", text="Normalize Thickness").mode = 'THICKNESS'
diff --git a/source/blender/blenkernel/BKE_appdir.h b/source/blender/blenkernel/BKE_appdir.h
index dcacc2ca7b3..0f00ab9c321 100644
--- a/source/blender/blenkernel/BKE_appdir.h
+++ b/source/blender/blenkernel/BKE_appdir.h
@@ -56,7 +56,7 @@ const char *BKE_appdir_folder_home(void);
*
* \returns True if the path is valid and points to an existing directory.
*/
-bool BKE_appdir_folder_documents(char *dir);
+bool BKE_appdir_folder_documents(char *dir) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT;
/**
* Get the user's cache directory, i.e.
* - Linux: `$HOME/.cache/blender/`
@@ -66,7 +66,7 @@ bool BKE_appdir_folder_documents(char *dir);
* \returns True if the path is valid. It doesn't create or checks format
* if the `blender` folder exists. It does check if the parent of the path exists.
*/
-bool BKE_appdir_folder_caches(char *r_path, size_t path_len);
+bool BKE_appdir_folder_caches(char *r_path, size_t path_len) ATTR_NONNULL(1);
/**
* Get a folder out of the \a folder_id presets for paths.
*
@@ -75,15 +75,17 @@ bool BKE_appdir_folder_caches(char *r_path, size_t path_len);
* \return The path if found, NULL string if not.
*/
bool BKE_appdir_folder_id_ex(int folder_id, const char *subfolder, char *path, size_t path_len);
-const char *BKE_appdir_folder_id(int folder_id, const char *subfolder);
+const char *BKE_appdir_folder_id(int folder_id, const char *subfolder) ATTR_WARN_UNUSED_RESULT;
/**
* Returns the path to a folder in the user area, creating it if it doesn't exist.
*/
-const char *BKE_appdir_folder_id_create(int folder_id, const char *subfolder);
+const char *BKE_appdir_folder_id_create(int folder_id,
+ const char *subfolder) ATTR_WARN_UNUSED_RESULT;
/**
* Returns the path to a folder in the user area without checking that it actually exists first.
*/
-const char *BKE_appdir_folder_id_user_notest(int folder_id, const char *subfolder);
+const char *BKE_appdir_folder_id_user_notest(int folder_id,
+ const char *subfolder) ATTR_WARN_UNUSED_RESULT;
/**
* Returns the path of the top-level version-specific local, user or system directory.
* If check_is_dir, then the result will be NULL if the directory doesn't exist.
@@ -99,23 +101,24 @@ bool BKE_appdir_app_is_portable_install(void);
* Return true if templates exist
*/
bool BKE_appdir_app_template_any(void);
-bool BKE_appdir_app_template_id_search(const char *app_template, char *path, size_t path_len);
-bool BKE_appdir_app_template_has_userpref(const char *app_template);
-void BKE_appdir_app_templates(struct ListBase *templates);
+bool BKE_appdir_app_template_id_search(const char *app_template, char *path, size_t path_len)
+ ATTR_NONNULL(1);
+bool BKE_appdir_app_template_has_userpref(const char *app_template) ATTR_NONNULL(1);
+void BKE_appdir_app_templates(struct ListBase *templates) ATTR_NONNULL(1);
/**
* Initialize path to program executable.
*/
-void BKE_appdir_program_path_init(const char *argv0);
+void BKE_appdir_program_path_init(const char *argv0) ATTR_NONNULL(1);
/**
* Path to executable
*/
-const char *BKE_appdir_program_path(void);
+const char *BKE_appdir_program_path(void) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL;
/**
* Path to directory of executable
*/
-const char *BKE_appdir_program_dir(void);
+const char *BKE_appdir_program_dir(void) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL;
/**
* Gets a good default directory for fonts.
@@ -128,7 +131,7 @@ bool BKE_appdir_font_folder_default(char *dir);
bool BKE_appdir_program_python_search(char *fullpath,
size_t fullpath_len,
int version_major,
- int version_minor);
+ int version_minor) ATTR_NONNULL(1);
/**
* Initialize path to temporary directory.
@@ -138,11 +141,11 @@ void BKE_tempdir_init(const char *userdir);
/**
* Path to persistent temporary directory (with trailing slash)
*/
-const char *BKE_tempdir_base(void);
+const char *BKE_tempdir_base(void) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL;
/**
* Path to temporary directory (with trailing slash)
*/
-const char *BKE_tempdir_session(void);
+const char *BKE_tempdir_session(void) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL;
/**
* Delete content of this instance's temp dir.
*/
diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index f4dec0aecd7..24e4305d916 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -734,6 +734,7 @@ const char *BKE_appdir_folder_id_create(const int folder_id, const char *subfold
BLENDER_USER_CONFIG,
BLENDER_USER_SCRIPTS,
BLENDER_USER_AUTOSAVE)) {
+ BLI_assert_unreachable();
return NULL;
}
diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc
index a5b50824542..a0548b7efd4 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -253,7 +253,7 @@ static void mesh_blend_write(BlendWriter *writer, ID *id, const void *id_address
BKE_mesh_legacy_convert_material_indices_to_mpoly(mesh);
BKE_mesh_legacy_bevel_weight_from_layers(mesh);
/* When converting to the old mesh format, don't save redundant attributes. */
- names_to_skip.add_multiple_new({".hide_vert", ".hide_edge", ".hide_poly"});
+ names_to_skip.add_multiple_new({".hide_vert", ".hide_edge", ".hide_poly", "material_index"});
/* Set deprecated mesh data pointers for forward compatibility. */
mesh->mvert = const_cast<MVert *>(mesh->verts().data());
diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c
index f17450ac3f4..64f998ea67f 100644
--- a/source/blender/blenkernel/intern/studiolight.c
+++ b/source/blender/blenkernel/intern/studiolight.c
@@ -1166,19 +1166,21 @@ static void studiolight_add_files_from_datafolder(const int folder_id,
const char *subfolder,
int flag)
{
- struct direntry *dirs;
const char *folder = BKE_appdir_folder_id(folder_id, subfolder);
- if (folder) {
- const uint dirs_num = BLI_filelist_dir_contents(folder, &dirs);
- int i;
- for (i = 0; i < dirs_num; i++) {
- if (dirs[i].type & S_IFREG) {
- studiolight_add_file(dirs[i].path, flag);
- }
+ if (!folder) {
+ return;
+ }
+
+ struct direntry *dirs;
+ const uint dirs_num = BLI_filelist_dir_contents(folder, &dirs);
+ int i;
+ for (i = 0; i < dirs_num; i++) {
+ if (dirs[i].type & S_IFREG) {
+ studiolight_add_file(dirs[i].path, flag);
}
- BLI_filelist_free(dirs, dirs_num);
- dirs = NULL;
}
+ BLI_filelist_free(dirs, dirs_num);
+ dirs = NULL;
}
static int studiolight_flag_cmp_order(const StudioLight *sl)
diff --git a/source/blender/blenlib/intern/system.c b/source/blender/blenlib/intern/system.c
index 781b38f713a..f7249e491d7 100644
--- a/source/blender/blenlib/intern/system.c
+++ b/source/blender/blenlib/intern/system.c
@@ -154,12 +154,12 @@ void BLI_hostname_get(char *buffer, size_t bufsize)
if (gethostname(buffer, bufsize - 1) < 0) {
BLI_strncpy(buffer, "-unknown-", bufsize);
}
- /* When gethostname() truncates, it doesn't guarantee the trailing \0. */
+ /* When `gethostname()` truncates, it doesn't guarantee the trailing `\0`. */
buffer[bufsize - 1] = '\0';
#else
DWORD bufsize_inout = bufsize;
if (!GetComputerName(buffer, &bufsize_inout)) {
- strncpy(buffer, "-unknown-", bufsize);
+ BLI_strncpy(buffer, "-unknown-", bufsize);
}
#endif
}
diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c
index 309ef2cf21e..d88f3112a71 100644
--- a/source/blender/bmesh/operators/bmo_utils.c
+++ b/source/blender/bmesh/operators/bmo_utils.c
@@ -470,7 +470,7 @@ void bmo_rotate_uvs_exec(BMesh *bm, BMOperator *op)
BMLoop *lf; /* current face loops */
MLoopUV *f_luv; /* first face loop uv */
float p_uv[2]; /* previous uvs */
- float t_uv[2]; /* tmp uvs */
+ float t_uv[2]; /* temp uvs */
int n = 0;
BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) {
@@ -603,7 +603,7 @@ void bmo_rotate_colors_exec(BMesh *bm, BMOperator *op)
const size_t size = cd_loop_color_type == CD_PROP_COLOR ? sizeof(MPropCol) : sizeof(MLoopCol);
void *p_col; /* previous color */
- void *t_col = alloca(size); /* tmp color */
+ void *t_col = alloca(size); /* Temp color. */
BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
if (use_ccw == false) { /* same loops direction */
diff --git a/source/blender/editors/asset/intern/asset_ops.cc b/source/blender/editors/asset/intern/asset_ops.cc
index 05d0b7d0af4..ba7b56db3ec 100644
--- a/source/blender/editors/asset/intern/asset_ops.cc
+++ b/source/blender/editors/asset/intern/asset_ops.cc
@@ -781,6 +781,7 @@ static const EnumPropertyItem *rna_asset_library_reference_itemf(bContext *UNUSE
const EnumPropertyItem *items = ED_asset_library_reference_to_rna_enum_itemf(false);
if (!items) {
*r_free = false;
+ return nullptr;
}
*r_free = true;
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 120c806c727..89ab9eda7f0 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -3791,6 +3791,101 @@ void GPENCIL_OT_stroke_flip(wmOperatorType *ot)
/** \} */
/* -------------------------------------------------------------------- */
+/** \name Stroke Start Set Operator
+ * \{ */
+
+static int gpencil_stroke_start_set_exec(bContext *C, wmOperator *op)
+{
+ Object *ob = CTX_data_active_object(C);
+ bGPdata *gpd = ob->data;
+
+ /* sanity checks */
+ if (ELEM(NULL, ob, gpd)) {
+ return OPERATOR_CANCELLED;
+ }
+
+ const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
+ const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd);
+ if (is_curve_edit) {
+ BKE_report(op->reports, RPT_ERROR, "Curve Edit mode not supported");
+ return OPERATOR_CANCELLED;
+ }
+
+ bool changed = false;
+ /* Read all selected strokes. */
+ CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) {
+ bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe;
+
+ for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) {
+ if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) {
+ if (gpf == NULL) {
+ continue;
+ }
+ LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
+ if (gps->flag & GP_STROKE_SELECT) {
+ /* skip strokes that are invalid for current view */
+ if (ED_gpencil_stroke_can_use(C, gps) == false) {
+ continue;
+ }
+ /* check if the color is editable */
+ if (ED_gpencil_stroke_material_editable(ob, gpl, gps) == false) {
+ continue;
+ }
+
+ /* Only cyclic strokes. */
+ if ((gps->flag & GP_STROKE_CYCLIC) == 0) {
+ continue;
+ }
+
+ /* Find first selected point and set start. */
+ bGPDspoint *pt;
+ for (int i = 0; i < gps->totpoints; i++) {
+ pt = &gps->points[i];
+ if (pt->flag & GP_SPOINT_SELECT) {
+ BKE_gpencil_stroke_start_set(gps, i);
+ BKE_gpencil_stroke_geometry_update(gpd, gps);
+ changed = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+ /* If not multi-edit, exit loop. */
+ if (!is_multiedit) {
+ break;
+ }
+ }
+ }
+ CTX_DATA_END;
+
+ if (changed) {
+ /* notifiers */
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+ WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+void GPENCIL_OT_stroke_start_set(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Set Start Point";
+ ot->idname = "GPENCIL_OT_stroke_start_set";
+ ot->description = "Set start point for cyclic strokes";
+
+ /* api callbacks */
+ ot->exec = gpencil_stroke_start_set_exec;
+ ot->poll = gpencil_active_layer_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
/** \name Stroke Re-project Operator
* \{ */
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index 3cb3a50e702..4d62f834d86 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -593,6 +593,7 @@ void GPENCIL_OT_stroke_cyclical_set(struct wmOperatorType *ot);
*/
void GPENCIL_OT_stroke_caps_set(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_join(struct wmOperatorType *ot);
+void GPENCIL_OT_stroke_start_set(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_flip(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_subdivide(struct wmOperatorType *ot);
void GPENCIL_OT_stroke_simplify(struct wmOperatorType *ot);
diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c
index 3d92fbabfc4..85cc281ca90 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -621,6 +621,7 @@ void ED_operatortypes_gpencil(void)
WM_operatortype_append(GPENCIL_OT_stroke_caps_set);
WM_operatortype_append(GPENCIL_OT_stroke_join);
WM_operatortype_append(GPENCIL_OT_stroke_flip);
+ WM_operatortype_append(GPENCIL_OT_stroke_start_set);
WM_operatortype_append(GPENCIL_OT_stroke_subdivide);
WM_operatortype_append(GPENCIL_OT_stroke_simplify);
WM_operatortype_append(GPENCIL_OT_stroke_simplify_fixed);
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index dfd724ca473..08565a86ee7 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -16,6 +16,7 @@
#include "BLI_linklist_stack.h"
#include "BLI_math.h"
#include "BLI_rand.h"
+#include "BLI_string_utils.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
@@ -2688,12 +2689,13 @@ static void ed_panel_draw(const bContext *C,
const uiStyle *style = UI_style_get_dpi();
/* Draw panel. */
-
char block_name[BKE_ST_MAXNAME + INSTANCED_PANEL_UNIQUE_STR_LEN];
- strncpy(block_name, pt->idname, BKE_ST_MAXNAME);
- if (unique_panel_str != NULL) {
+ if (unique_panel_str) {
/* Instanced panels should have already been added at this point. */
- strncat(block_name, unique_panel_str, INSTANCED_PANEL_UNIQUE_STR_LEN);
+ BLI_string_join(block_name, sizeof(block_name), pt->idname, unique_panel_str);
+ }
+ else {
+ STRNCPY(block_name, pt->idname);
}
uiBlock *block = UI_block_begin(C, region, block_name, UI_EMBOSS);
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index fc0588dbab5..98782ca15a8 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -840,7 +840,7 @@ void ED_spacetype_action(void)
ARegionType *art;
st->spaceid = SPACE_ACTION;
- strncpy(st->name, "Action", BKE_ST_MAXNAME);
+ STRNCPY(st->name, "Action");
st->create = action_create;
st->free = action_free;
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 2bee60557b7..74b7fa3719a 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -917,7 +917,7 @@ void ED_spacetype_buttons(void)
ARegionType *art;
st->spaceid = SPACE_PROPERTIES;
- strncpy(st->name, "Buttons", BKE_ST_MAXNAME);
+ STRNCPY(st->name, "Buttons");
st->create = buttons_create;
st->free = buttons_free;
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index f8bf1893d89..ab952470757 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -1251,7 +1251,7 @@ void ED_spacetype_clip(void)
ARegionType *art;
st->spaceid = SPACE_CLIP;
- strncpy(st->name, "Clip", BKE_ST_MAXNAME);
+ STRNCPY(st->name, "Clip");
st->create = clip_create;
st->free = clip_free;
diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c
index a7ab6bc5169..8af0c1fc6ab 100644
--- a/source/blender/editors/space_console/space_console.c
+++ b/source/blender/editors/space_console/space_console.c
@@ -289,7 +289,7 @@ void ED_spacetype_console(void)
ARegionType *art;
st->spaceid = SPACE_CONSOLE;
- strncpy(st->name, "Console", BKE_ST_MAXNAME);
+ STRNCPY(st->name, "Console");
st->create = console_create;
st->free = console_free;
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 59d9a15fbab..721c58fc34e 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -367,6 +367,39 @@ static FileSelect file_select(
/** \} */
/* -------------------------------------------------------------------- */
+/** \name Bookmark Utilities
+ * \{ */
+
+/**
+ * Local utility to write #BLENDER_BOOKMARK_FILE, reporting an error on failure.
+ */
+static bool fsmenu_write_file_and_refresh_or_report_error(struct FSMenu *fsmenu,
+ ScrArea *area,
+ ReportList *reports)
+{
+ /* NOTE: use warning instead of error here, because the bookmark operation may be part of
+ * other actions which should not cause the operator to fail entirely. */
+ const char *cfgdir = BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL);
+ if (UNLIKELY(!cfgdir)) {
+ BKE_report(reports, RPT_ERROR, "Unable to create configuration directory to write bookmarks");
+ return false;
+ }
+
+ char filepath[FILE_MAX];
+ BLI_join_dirfile(filepath, sizeof(filepath), cfgdir, BLENDER_BOOKMARK_FILE);
+ if (UNLIKELY(!fsmenu_write_file(fsmenu, filepath))) {
+ BKE_reportf(reports, RPT_ERROR, "Unable to open or write bookmark file \"%s\"", filepath);
+ return false;
+ }
+
+ ED_area_tag_refresh(area);
+ ED_area_tag_redraw(area);
+ return true;
+}
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
/** \name Box Select Operator
* \{ */
@@ -1053,19 +1086,17 @@ static int bookmark_select_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
SpaceFile *sfile = CTX_wm_space_file(C);
- PropertyRNA *prop;
- if ((prop = RNA_struct_find_property(op->ptr, "dir"))) {
- FileSelectParams *params = ED_fileselect_get_active_params(sfile);
- char entry[256];
+ PropertyRNA *prop = RNA_struct_find_property(op->ptr, "dir");
+ FileSelectParams *params = ED_fileselect_get_active_params(sfile);
+ char entry[256];
- RNA_property_string_get(op->ptr, prop, entry);
- BLI_strncpy(params->dir, entry, sizeof(params->dir));
- BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), params->dir);
- ED_file_change_dir(C);
+ RNA_property_string_get(op->ptr, prop, entry);
+ BLI_strncpy(params->dir, entry, sizeof(params->dir));
+ BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), params->dir);
+ ED_file_change_dir(C);
- WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
- }
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
return OPERATOR_FINISHED;
}
@@ -1095,7 +1126,7 @@ void FILE_OT_select_bookmark(wmOperatorType *ot)
/** \name Add Bookmark Operator
* \{ */
-static int bookmark_add_exec(bContext *C, wmOperator *UNUSED(op))
+static int bookmark_add_exec(bContext *C, wmOperator *op)
{
ScrArea *area = CTX_wm_area(C);
SpaceFile *sfile = CTX_wm_space_file(C);
@@ -1103,19 +1134,11 @@ static int bookmark_add_exec(bContext *C, wmOperator *UNUSED(op))
struct FileSelectParams *params = ED_fileselect_get_active_params(sfile);
if (params->dir[0] != '\0') {
- char name[FILE_MAX];
fsmenu_insert_entry(
fsmenu, FS_CATEGORY_BOOKMARKS, params->dir, NULL, ICON_FILE_FOLDER, FS_INSERT_SAVE);
- BLI_join_dirfile(name,
- sizeof(name),
- BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL),
- BLENDER_BOOKMARK_FILE);
- fsmenu_write_file(fsmenu, name);
+ fsmenu_write_file_and_refresh_or_report_error(fsmenu, area, op->reports);
}
-
- ED_area_tag_refresh(area);
- ED_area_tag_redraw(area);
return OPERATOR_FINISHED;
}
@@ -1146,27 +1169,11 @@ static int bookmark_delete_exec(bContext *C, wmOperator *op)
int nentries = ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_BOOKMARKS);
PropertyRNA *prop = RNA_struct_find_property(op->ptr, "index");
-
- if (prop) {
- int index;
- if (RNA_property_is_set(op->ptr, prop)) {
- index = RNA_property_int_get(op->ptr, prop);
- }
- else { /* if index unset, use active bookmark... */
- index = sfile->bookmarknr;
- }
- if ((index > -1) && (index < nentries)) {
- char name[FILE_MAX];
-
- fsmenu_remove_entry(fsmenu, FS_CATEGORY_BOOKMARKS, index);
- BLI_join_dirfile(name,
- sizeof(name),
- BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL),
- BLENDER_BOOKMARK_FILE);
- fsmenu_write_file(fsmenu, name);
- ED_area_tag_refresh(area);
- ED_area_tag_redraw(area);
- }
+ const int index = RNA_property_is_set(op->ptr, prop) ? RNA_property_int_get(op->ptr, prop) :
+ sfile->bookmarknr;
+ if ((index > -1) && (index < nentries)) {
+ fsmenu_remove_entry(fsmenu, FS_CATEGORY_BOOKMARKS, index);
+ fsmenu_write_file_and_refresh_or_report_error(fsmenu, area, op->reports);
}
return OPERATOR_FINISHED;
@@ -1197,7 +1204,7 @@ void FILE_OT_bookmark_delete(wmOperatorType *ot)
/** \name Cleanup Bookmark Operator
* \{ */
-static int bookmark_cleanup_exec(bContext *C, wmOperator *UNUSED(op))
+static int bookmark_cleanup_exec(bContext *C, wmOperator *op)
{
ScrArea *area = CTX_wm_area(C);
struct FSMenu *fsmenu = ED_fsmenu_get();
@@ -1218,16 +1225,8 @@ static int bookmark_cleanup_exec(bContext *C, wmOperator *UNUSED(op))
}
if (changed) {
- char name[FILE_MAX];
-
- BLI_join_dirfile(name,
- sizeof(name),
- BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL),
- BLENDER_BOOKMARK_FILE);
- fsmenu_write_file(fsmenu, name);
+ fsmenu_write_file_and_refresh_or_report_error(fsmenu, area, op->reports);
fsmenu_refresh_bookmarks_status(CTX_wm_manager(C), fsmenu);
- ED_area_tag_refresh(area);
- ED_area_tag_redraw(area);
}
return OPERATOR_FINISHED;
@@ -1269,8 +1268,6 @@ static int bookmark_move_exec(bContext *C, wmOperator *op)
struct FSMenuEntry *fsmentry = ED_fsmenu_get_category(fsmenu, FS_CATEGORY_BOOKMARKS);
const struct FSMenuEntry *fsmentry_org = fsmentry;
- char fname[FILE_MAX];
-
const int direction = RNA_enum_get(op->ptr, "direction");
const int totitems = ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_BOOKMARKS);
const int act_index = sfile->bookmarknr;
@@ -1306,13 +1303,8 @@ static int bookmark_move_exec(bContext *C, wmOperator *op)
/* Need to update active bookmark number. */
sfile->bookmarknr = new_index;
- BLI_join_dirfile(fname,
- sizeof(fname),
- BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL),
- BLENDER_BOOKMARK_FILE);
- fsmenu_write_file(fsmenu, fname);
+ fsmenu_write_file_and_refresh_or_report_error(fsmenu, area, op->reports);
- ED_area_tag_redraw(area);
return OPERATOR_FINISHED;
}
@@ -1352,21 +1344,16 @@ void FILE_OT_bookmark_move(wmOperatorType *ot)
/** \name Reset Recent Blend Files Operator
* \{ */
-static int reset_recent_exec(bContext *C, wmOperator *UNUSED(op))
+static int reset_recent_exec(bContext *C, wmOperator *op)
{
ScrArea *area = CTX_wm_area(C);
- char name[FILE_MAX];
struct FSMenu *fsmenu = ED_fsmenu_get();
while (ED_fsmenu_get_entry(fsmenu, FS_CATEGORY_RECENT, 0) != NULL) {
fsmenu_remove_entry(fsmenu, FS_CATEGORY_RECENT, 0);
}
- BLI_join_dirfile(name,
- sizeof(name),
- BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL),
- BLENDER_BOOKMARK_FILE);
- fsmenu_write_file(fsmenu, name);
- ED_area_tag_redraw(area);
+
+ fsmenu_write_file_and_refresh_or_report_error(fsmenu, area, op->reports);
return OPERATOR_FINISHED;
}
@@ -1795,6 +1782,8 @@ static bool file_execute(bContext *C, SpaceFile *sfile)
}
/* Opening file, sends events now, so things get handled on window-queue level. */
else if (sfile->op) {
+ ScrArea *area = CTX_wm_area(C);
+ struct FSMenu *fsmenu = ED_fsmenu_get();
wmOperator *op = sfile->op;
char filepath[FILE_MAX];
@@ -1803,7 +1792,7 @@ static bool file_execute(bContext *C, SpaceFile *sfile)
file_sfile_to_operator_ex(bmain, op, sfile, filepath);
if (BLI_exists(params->dir)) {
- fsmenu_insert_entry(ED_fsmenu_get(),
+ fsmenu_insert_entry(fsmenu,
FS_CATEGORY_RECENT,
params->dir,
NULL,
@@ -1811,11 +1800,8 @@ static bool file_execute(bContext *C, SpaceFile *sfile)
FS_INSERT_SAVE | FS_INSERT_FIRST);
}
- BLI_join_dirfile(filepath,
- sizeof(filepath),
- BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL),
- BLENDER_BOOKMARK_FILE);
- fsmenu_write_file(ED_fsmenu_get(), filepath);
+ fsmenu_write_file_and_refresh_or_report_error(fsmenu, area, op->reports);
+
WM_event_fileselect_event(CTX_wm_manager(C), op, EVT_FILESELECT_EXEC);
}
@@ -2327,7 +2313,6 @@ static int file_directory_new_exec(bContext *C, wmOperator *op)
char name[FILE_MAXFILE];
char path[FILE_MAX];
bool generate_name = true;
- PropertyRNA *prop;
wmWindowManager *wm = CTX_wm_manager(C);
SpaceFile *sfile = CTX_wm_space_file(C);
@@ -2341,7 +2326,8 @@ static int file_directory_new_exec(bContext *C, wmOperator *op)
path[0] = '\0';
- if ((prop = RNA_struct_find_property(op->ptr, "directory"))) {
+ {
+ PropertyRNA *prop = RNA_struct_find_property(op->ptr, "directory");
RNA_property_string_get(op->ptr, prop, path);
if (path[0] != '\0') {
generate_name = false;
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index 30e13235f45..35ce7ef364c 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -519,7 +519,7 @@ void fsmenu_remove_entry(struct FSMenu *fsmenu, FSMenuCategory category, int idx
}
}
-void fsmenu_write_file(struct FSMenu *fsmenu, const char *filepath)
+bool fsmenu_write_file(struct FSMenu *fsmenu, const char *filepath)
{
FSMenuEntry *fsm_iter = NULL;
char fsm_name[FILE_MAX];
@@ -527,33 +527,36 @@ void fsmenu_write_file(struct FSMenu *fsmenu, const char *filepath)
FILE *fp = BLI_fopen(filepath, "w");
if (!fp) {
- return;
+ return false;
}
- fprintf(fp, "[Bookmarks]\n");
+ bool has_error = false;
+ has_error |= (fprintf(fp, "[Bookmarks]\n") < 0);
for (fsm_iter = ED_fsmenu_get_category(fsmenu, FS_CATEGORY_BOOKMARKS); fsm_iter;
fsm_iter = fsm_iter->next) {
if (fsm_iter->path && fsm_iter->save) {
fsmenu_entry_generate_name(fsm_iter, fsm_name, sizeof(fsm_name));
if (fsm_iter->name[0] && !STREQ(fsm_iter->name, fsm_name)) {
- fprintf(fp, "!%s\n", fsm_iter->name);
+ has_error |= (fprintf(fp, "!%s\n", fsm_iter->name) < 0);
}
- fprintf(fp, "%s\n", fsm_iter->path);
+ has_error |= (fprintf(fp, "%s\n", fsm_iter->path) < 0);
}
}
- fprintf(fp, "[Recent]\n");
+ has_error = (fprintf(fp, "[Recent]\n") < 0);
for (fsm_iter = ED_fsmenu_get_category(fsmenu, FS_CATEGORY_RECENT);
fsm_iter && (nwritten < FSMENU_RECENT_MAX);
fsm_iter = fsm_iter->next, nwritten++) {
if (fsm_iter->path && fsm_iter->save) {
fsmenu_entry_generate_name(fsm_iter, fsm_name, sizeof(fsm_name));
if (fsm_iter->name[0] && !STREQ(fsm_iter->name, fsm_name)) {
- fprintf(fp, "!%s\n", fsm_iter->name);
+ has_error |= (fprintf(fp, "!%s\n", fsm_iter->name) < 0);
}
- fprintf(fp, "%s\n", fsm_iter->path);
+ has_error |= (fprintf(fp, "%s\n", fsm_iter->path) < 0);
}
}
fclose(fp);
+
+ return !has_error;
}
void fsmenu_read_bookmarks(struct FSMenu *fsmenu, const char *filepath)
diff --git a/source/blender/editors/space_file/fsmenu.h b/source/blender/editors/space_file/fsmenu.h
index 6e980a326fc..f4f0dafbc73 100644
--- a/source/blender/editors/space_file/fsmenu.h
+++ b/source/blender/editors/space_file/fsmenu.h
@@ -37,8 +37,11 @@ short fsmenu_can_save(struct FSMenu *fsmenu, enum FSMenuCategory category, int i
/** Removes the fsmenu entry at the given \a index. */
void fsmenu_remove_entry(struct FSMenu *fsmenu, enum FSMenuCategory category, int idx);
-/** saves the 'bookmarks' to the specified file */
-void fsmenu_write_file(struct FSMenu *fsmenu, const char *filepath);
+/**
+ * Saves the 'bookmarks' to the specified file.
+ * \return true on success.
+ */
+bool fsmenu_write_file(struct FSMenu *fsmenu, const char *filepath);
/** reads the 'bookmarks' from the specified file */
void fsmenu_read_bookmarks(struct FSMenu *fsmenu, const char *filepath);
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index b5cad0f6ff8..bba0c27bb4d 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -992,7 +992,7 @@ void ED_spacetype_file(void)
ARegionType *art;
st->spaceid = SPACE_FILE;
- strncpy(st->name, "File", BKE_ST_MAXNAME);
+ STRNCPY(st->name, "File");
st->create = file_create;
st->free = file_free;
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 3594c65c1cb..1434f204ee5 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -810,7 +810,7 @@ void ED_spacetype_ipo(void)
ARegionType *art;
st->spaceid = SPACE_GRAPH;
- strncpy(st->name, "Graph", BKE_ST_MAXNAME);
+ STRNCPY(st->name, "Graph");
st->create = graph_create;
st->free = graph_free;
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 67bff9677dc..08b7897ec5a 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -1029,7 +1029,7 @@ void ED_spacetype_image(void)
ARegionType *art;
st->spaceid = SPACE_IMAGE;
- strncpy(st->name, "Image", BKE_ST_MAXNAME);
+ STRNCPY(st->name, "Image");
st->create = image_create;
st->free = image_free;
diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c
index 1513ba5e892..63c8d74c684 100644
--- a/source/blender/editors/space_info/space_info.c
+++ b/source/blender/editors/space_info/space_info.c
@@ -254,7 +254,7 @@ void ED_spacetype_info(void)
ARegionType *art;
st->spaceid = SPACE_INFO;
- strncpy(st->name, "Info", BKE_ST_MAXNAME);
+ STRNCPY(st->name, "Info");
st->create = info_create;
st->free = info_free;
diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c
index ba7e8987dd5..c71e63e9dcd 100644
--- a/source/blender/editors/space_nla/space_nla.c
+++ b/source/blender/editors/space_nla/space_nla.c
@@ -568,7 +568,7 @@ void ED_spacetype_nla(void)
ARegionType *art;
st->spaceid = SPACE_NLA;
- strncpy(st->name, "NLA", BKE_ST_MAXNAME);
+ STRNCPY(st->name, "NLA");
st->create = nla_create;
st->free = nla_free;
diff --git a/source/blender/editors/space_node/space_node.cc b/source/blender/editors/space_node/space_node.cc
index 17fc02e98a8..fae3eb1a143 100644
--- a/source/blender/editors/space_node/space_node.cc
+++ b/source/blender/editors/space_node/space_node.cc
@@ -1021,7 +1021,7 @@ void ED_spacetype_node()
ARegionType *art;
st->spaceid = SPACE_NODE;
- strncpy(st->name, "Node", BKE_ST_MAXNAME);
+ STRNCPY(st->name, "Node");
st->create = node_create;
st->free = node_free;
diff --git a/source/blender/editors/space_outliner/space_outliner.cc b/source/blender/editors/space_outliner/space_outliner.cc
index 76b7197b86a..365bcae3f5d 100644
--- a/source/blender/editors/space_outliner/space_outliner.cc
+++ b/source/blender/editors/space_outliner/space_outliner.cc
@@ -445,7 +445,7 @@ void ED_spacetype_outliner(void)
ARegionType *art;
st->spaceid = SPACE_OUTLINER;
- strncpy(st->name, "Outliner", BKE_ST_MAXNAME);
+ STRNCPY(st->name, "Outliner");
st->create = outliner_create;
st->free = outliner_free;
diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c
index a623b98f1b1..c35b1e00184 100644
--- a/source/blender/editors/space_script/space_script.c
+++ b/source/blender/editors/space_script/space_script.c
@@ -152,7 +152,7 @@ void ED_spacetype_script(void)
ARegionType *art;
st->spaceid = SPACE_SCRIPT;
- strncpy(st->name, "Script", BKE_ST_MAXNAME);
+ STRNCPY(st->name, "Script");
st->create = script_create;
st->free = script_free;
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index 201f132052d..538cfad14f5 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -997,7 +997,7 @@ void ED_spacetype_sequencer(void)
ARegionType *art;
st->spaceid = SPACE_SEQ;
- strncpy(st->name, "Sequencer", BKE_ST_MAXNAME);
+ STRNCPY(st->name, "Sequencer");
st->create = sequencer_create;
st->free = sequencer_free;
diff --git a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc
index 5c0f69905fa..435436611c5 100644
--- a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc
+++ b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc
@@ -619,7 +619,7 @@ void ED_spacetype_spreadsheet()
ARegionType *art;
st->spaceid = SPACE_SPREADSHEET;
- strncpy(st->name, "Spreadsheet", BKE_ST_MAXNAME);
+ STRNCPY(st->name, "Spreadsheet");
st->create = spreadsheet_create;
st->free = spreadsheet_free;
diff --git a/source/blender/editors/space_statusbar/space_statusbar.c b/source/blender/editors/space_statusbar/space_statusbar.c
index 9c64235870c..e99e8f21364 100644
--- a/source/blender/editors/space_statusbar/space_statusbar.c
+++ b/source/blender/editors/space_statusbar/space_statusbar.c
@@ -136,7 +136,7 @@ void ED_spacetype_statusbar(void)
ARegionType *art;
st->spaceid = SPACE_STATUSBAR;
- strncpy(st->name, "Status Bar", BKE_ST_MAXNAME);
+ STRNCPY(st->name, "Status Bar");
st->create = statusbar_create;
st->free = statusbar_free;
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 45cf557c4b4..be9bbdf109e 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -403,7 +403,7 @@ void ED_spacetype_text(void)
ARegionType *art;
st->spaceid = SPACE_TEXT;
- strncpy(st->name, "Text", BKE_ST_MAXNAME);
+ STRNCPY(st->name, "Text");
st->create = text_create;
st->free = text_free;
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 0f0ecb0e4bf..46c459dd0bc 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -706,7 +706,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *region)
drawcache->showlinenrs = st->showlinenrs;
drawcache->tabnumber = st->tabnumber;
- strncpy(drawcache->text_id, txt->id.name, MAX_ID_NAME);
+ STRNCPY(drawcache->text_id, txt->id.name);
/* clear update flag */
drawcache->update_flag = 0;
diff --git a/source/blender/editors/space_topbar/space_topbar.c b/source/blender/editors/space_topbar/space_topbar.c
index ee0e0c3ef46..e4826ed5964 100644
--- a/source/blender/editors/space_topbar/space_topbar.c
+++ b/source/blender/editors/space_topbar/space_topbar.c
@@ -288,7 +288,7 @@ void ED_spacetype_topbar(void)
ARegionType *art;
st->spaceid = SPACE_TOPBAR;
- strncpy(st->name, "Top Bar", BKE_ST_MAXNAME);
+ STRNCPY(st->name, "Top Bar");
st->create = topbar_create;
st->free = topbar_free;
diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c
index 1cda9cc0f0c..06a4c1d8702 100644
--- a/source/blender/editors/space_userpref/space_userpref.c
+++ b/source/blender/editors/space_userpref/space_userpref.c
@@ -189,7 +189,7 @@ void ED_spacetype_userpref(void)
ARegionType *art;
st->spaceid = SPACE_USERPREF;
- strncpy(st->name, "Userpref", BKE_ST_MAXNAME);
+ STRNCPY(st->name, "Userpref");
st->create = userpref_create;
st->free = userpref_free;
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 73b009bc1e0..c1c7147b3b1 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -1972,7 +1972,7 @@ void ED_spacetype_view3d(void)
ARegionType *art;
st->spaceid = SPACE_VIEW3D;
- strncpy(st->name, "View3D", BKE_ST_MAXNAME);
+ STRNCPY(st->name, "View3D");
st->create = view3d_create;
st->free = view3d_free;
diff --git a/source/blender/imbuf/intern/cineon/cineonlib.c b/source/blender/imbuf/intern/cineon/cineonlib.c
index 8312476bda0..fa05f155b30 100644
--- a/source/blender/imbuf/intern/cineon/cineonlib.c
+++ b/source/blender/imbuf/intern/cineon/cineonlib.c
@@ -18,6 +18,7 @@
#include <time.h>
#include "BLI_fileops.h"
+#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"
@@ -56,9 +57,8 @@ static void fillCineonMainHeader(LogImageFile *cineon,
cineon->height *
getRowLength(cineon->width, cineon->element[0]),
cineon->isMSB);
- strcpy(header->fileHeader.version, "v4.5");
- strncpy(header->fileHeader.file_name, filepath, 99);
- header->fileHeader.file_name[99] = 0;
+ STRNCPY(header->fileHeader.version, "v4.5");
+ STRNCPY(header->fileHeader.file_name, filepath);
fileClock = time(NULL);
fileTime = localtime(&fileClock);
strftime(header->fileHeader.creation_date, 12, "%Y:%m:%d", fileTime);
@@ -93,8 +93,7 @@ static void fillCineonMainHeader(LogImageFile *cineon,
header->imageHeader.green_primary_y = swap_float(0.0f, cineon->isMSB);
header->imageHeader.blue_primary_x = swap_float(0.0f, cineon->isMSB);
header->imageHeader.blue_primary_y = swap_float(0.0f, cineon->isMSB);
- strncpy(header->imageHeader.label, creator, 199);
- header->imageHeader.label[199] = 0;
+ STRNCPY(header->imageHeader.label, creator);
header->imageHeader.interleave = 0;
header->imageHeader.data_sign = 0;
header->imageHeader.sense = 0;
diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c
index 28c19116361..4c780032f0b 100644
--- a/source/blender/imbuf/intern/cineon/dpxlib.c
+++ b/source/blender/imbuf/intern/cineon/dpxlib.c
@@ -18,6 +18,7 @@
#include <time.h>
#include "BLI_fileops.h"
+#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"
@@ -60,14 +61,12 @@ static void fillDpxMainHeader(LogImageFile *dpx,
header->fileHeader.ind_hdr_size = swap_uint(sizeof(DpxFilmHeader) + sizeof(DpxTelevisionHeader),
dpx->isMSB);
header->fileHeader.user_data_size = DPX_UNDEFINED_U32;
- strncpy(header->fileHeader.file_name, filename, 99);
- header->fileHeader.file_name[99] = 0;
+ STRNCPY(header->fileHeader.file_name, filename);
fileClock = time(NULL);
fileTime = localtime(&fileClock);
strftime(header->fileHeader.creation_date, 24, "%Y:%m:%d:%H:%M:%S%Z", fileTime);
header->fileHeader.creation_date[23] = 0;
- strncpy(header->fileHeader.creator, creator, 99);
- header->fileHeader.creator[99] = 0;
+ STRNCPY(header->fileHeader.creator, creator);
header->fileHeader.project[0] = 0;
header->fileHeader.copyright[0] = 0;
header->fileHeader.key = 0xFFFFFFFF;
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index b436b33cfb3..c0f92010c22 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -136,7 +136,7 @@ typedef struct SequenceRuntime {
*/
typedef struct Sequence {
struct Sequence *next, *prev;
- /** Tmp var for copying, and tagging for linked selection. */
+ /** Temp var for copying, and tagging for linked selection. */
void *tmp;
/** Needed (to be like ipo), else it will raise libdata warnings, this should never be used. */
void *lib;
diff --git a/source/blender/modifiers/intern/MOD_volume_to_mesh.cc b/source/blender/modifiers/intern/MOD_volume_to_mesh.cc
index 215436e4a8d..0065012db97 100644
--- a/source/blender/modifiers/intern/MOD_volume_to_mesh.cc
+++ b/source/blender/modifiers/intern/MOD_volume_to_mesh.cc
@@ -51,7 +51,7 @@ static void initData(ModifierData *md)
VolumeToMeshModifierData *vmmd = reinterpret_cast<VolumeToMeshModifierData *>(md);
vmmd->object = nullptr;
vmmd->threshold = 0.1f;
- strncpy(vmmd->grid_name, "density", MAX_NAME);
+ STRNCPY(vmmd->grid_name, "density");
vmmd->adaptivity = 0.0f;
vmmd->resolution_mode = VOLUME_TO_MESH_RESOLUTION_MODE_GRID;
vmmd->voxel_amount = 32;
diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc b/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc
index 182169405de..9c0617ee8c3 100644
--- a/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc
@@ -113,7 +113,7 @@ class BokehBlurOperation : public NodeOperation {
* computations of the bokeh blur. */
const float size = math::clamp(get_input("Size").get_float_value_default(1.0f), 0.0f, 10.0f);
- /* The 100 divisor is arbitrary and was chosen using visual judgement. */
+ /* The 100 divisor is arbitrary and was chosen using visual judgment. */
return size * (max_size / 100.0f);
}
diff --git a/source/blender/python/gpu/gpu_py_shader.c b/source/blender/python/gpu/gpu_py_shader.c
index 02fccedd820..fbc45124147 100644
--- a/source/blender/python/gpu/gpu_py_shader.c
+++ b/source/blender/python/gpu/gpu_py_shader.c
@@ -37,6 +37,9 @@
"``IMAGE``\n" \
" :Attributes: vec3 pos, vec2 texCoord\n" \
" :Uniforms: sampler2D image\n" \
+ "``IMAGE_COLOR``\n" \
+ " :Attributes: vec3 pos, vec2 texCoord\n" \
+ " :Uniforms: sampler2D image, vec4 color\n" \
"``SMOOTH_COLOR``\n" \
" :Attributes: vec3 pos, vec4 color\n" \
" :Uniforms: none\n" \
@@ -56,6 +59,7 @@
static const struct PyC_StringEnumItems pygpu_shader_builtin_items[] = {
{GPU_SHADER_3D_FLAT_COLOR, "FLAT_COLOR"},
{GPU_SHADER_3D_IMAGE, "IMAGE"},
+ {GPU_SHADER_3D_IMAGE_COLOR, "IMAGE_COLOR"},
{GPU_SHADER_3D_SMOOTH_COLOR, "SMOOTH_COLOR"},
{GPU_SHADER_3D_UNIFORM_COLOR, "UNIFORM_COLOR"},
{GPU_SHADER_3D_POLYLINE_FLAT_COLOR, "POLYLINE_FLAT_COLOR"},
diff --git a/source/blender/render/intern/render_result.cc b/source/blender/render/intern/render_result.cc
index 50eb7e9f2d2..8b7a07e2b3f 100644
--- a/source/blender/render/intern/render_result.cc
+++ b/source/blender/render/intern/render_result.cc
@@ -952,7 +952,7 @@ static void render_result_exr_file_cache_path(Scene *sce,
}
BLI_hash_md5_to_hexdigest(path_digest, path_hexdigest);
- /* Default to *non-volatile* tmp dir. */
+ /* Default to *non-volatile* temp dir. */
if (*root == '\0') {
root = BKE_tempdir_base();
}
diff --git a/source/blender/sequencer/intern/proxy.c b/source/blender/sequencer/intern/proxy.c
index 374e18dd36a..4220efab8bf 100644
--- a/source/blender/sequencer/intern/proxy.c
+++ b/source/blender/sequencer/intern/proxy.c
@@ -177,14 +177,12 @@ static bool seq_proxy_get_fname(Scene *scene,
BLI_snprintf(name,
PROXY_MAXFILE,
- "%s/images/%d/%s_proxy%s",
+ "%s/images/%d/%s_proxy%s.jpg",
dir,
proxy_size_number,
SEQ_render_give_stripelem(scene, seq, timeline_frame)->name,
suffix);
BLI_path_abs(name, BKE_main_blendfile_path_from_global());
- strcat(name, ".jpg");
-
return true;
}
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 186edfe68d6..0e43ed5509a 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1397,29 +1397,27 @@ void wm_homefile_read_post(struct bContext *C,
void wm_history_file_read(void)
{
- char name[FILE_MAX];
- LinkNode *l, *lines;
- struct RecentFile *recent;
- const char *line;
- int num;
const char *const cfgdir = BKE_appdir_folder_id(BLENDER_USER_CONFIG, NULL);
-
if (!cfgdir) {
return;
}
+ char name[FILE_MAX];
+ LinkNode *l;
+ int num;
+
BLI_join_dirfile(name, sizeof(name), cfgdir, BLENDER_HISTORY_FILE);
- lines = BLI_file_read_as_lines(name);
+ LinkNode *lines = BLI_file_read_as_lines(name);
wm_history_files_free();
/* read list of recent opened files from recent-files.txt to memory */
for (l = lines, num = 0; l && (num < U.recent_files); l = l->next) {
- line = l->link;
+ const char *line = l->link;
/* don't check if files exist, causes slow startup for remote/external drives */
if (line[0]) {
- recent = (RecentFile *)MEM_mallocN(sizeof(RecentFile), "RecentFile");
+ struct RecentFile *recent = (RecentFile *)MEM_mallocN(sizeof(RecentFile), "RecentFile");
BLI_addtail(&(G.recent_files), recent);
recent->filepath = BLI_strdup(line);
num++;
@@ -1919,12 +1917,11 @@ static void wm_autosave_location(char filepath[FILE_MAX])
}
const char *tempdir_base = BKE_tempdir_base();
+ /* NOTE(@campbellbarton): It's strange that this is only used on WIN32.
+ * From reading commits it seems accessing the temporary directory used to be less reliable.
+ * If this is still the case on WIN32 - other features such as copy-paste will also fail.
+ * We could support #BLENDER_USER_AUTOSAVE on all platforms or remove it entirely. */
#ifdef WIN32
- /* XXX Need to investigate how to handle default location of `/tmp/`
- * This is a relative directory on Windows, and it may be found. Example:
- * Blender installed on `D:\` drive, `D:\` drive has `D:\tmp\` Now, `BLI_exists()`
- * will find `/tmp/` exists, but #BLI_windows_get_default_root_dir will expand this to `C:\`.
- * If there is no `C:\tmp` autosave fails. */
if (!BLI_exists(tempdir_base)) {
const char *savedir = BKE_appdir_folder_id_create(BLENDER_USER_AUTOSAVE, NULL);
if (savedir) {
diff --git a/source/blender/windowmanager/intern/wm_platform_support.c b/source/blender/windowmanager/intern/wm_platform_support.c
index becc2d896d0..a0519506d29 100644
--- a/source/blender/windowmanager/intern/wm_platform_support.c
+++ b/source/blender/windowmanager/intern/wm_platform_support.c
@@ -32,35 +32,35 @@
*/
static bool wm_platform_support_check_approval(const char *platform_support_key, bool update)
{
- const char *const cfgdir = BKE_appdir_folder_id(BLENDER_USER_CONFIG, NULL);
- bool result = false;
-
if (G.factory_startup) {
- return result;
+ return false;
+ }
+ const char *const cfgdir = BKE_appdir_folder_id(BLENDER_USER_CONFIG, NULL);
+ if (!cfgdir) {
+ return false;
}
- if (cfgdir) {
- char filepath[FILE_MAX];
- BLI_join_dirfile(filepath, sizeof(filepath), cfgdir, BLENDER_PLATFORM_SUPPORT_FILE);
- LinkNode *lines = BLI_file_read_as_lines(filepath);
- for (LinkNode *line_node = lines; line_node; line_node = line_node->next) {
- char *line = line_node->link;
- if (STREQ(line, platform_support_key)) {
- result = true;
- break;
- }
+ bool result = false;
+ char filepath[FILE_MAX];
+ BLI_join_dirfile(filepath, sizeof(filepath), cfgdir, BLENDER_PLATFORM_SUPPORT_FILE);
+ LinkNode *lines = BLI_file_read_as_lines(filepath);
+ for (LinkNode *line_node = lines; line_node; line_node = line_node->next) {
+ char *line = line_node->link;
+ if (STREQ(line, platform_support_key)) {
+ result = true;
+ break;
}
+ }
- if (!result && update) {
- FILE *fp = BLI_fopen(filepath, "a");
- if (fp) {
- fprintf(fp, "%s\n", platform_support_key);
- fclose(fp);
- }
+ if (!result && update) {
+ FILE *fp = BLI_fopen(filepath, "a");
+ if (fp) {
+ fprintf(fp, "%s\n", platform_support_key);
+ fclose(fp);
}
-
- BLI_file_free_lines(lines);
}
+
+ BLI_file_free_lines(lines);
return result;
}
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index f8cbb9bc07c..b228c8d9ac1 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -362,9 +362,9 @@ elseif(APPLE)
else()
# Paths defined in terms of site-packages since the site-packages
# directory can be a symlink (brew for example).
- set(TARGETDIR_BPY ${PYTHON_LIBPATH}/site-packages/bpy)
- set(TARGETDIR_VER ${PYTHON_LIBPATH}/site-packages/bpy/${BLENDER_VERSION})
- set(TARGETDIR_LIB ${PYTHON_LIBPATH}/site-packages/bpy/lib)
+ set(TARGETDIR_BPY ${PYTHON_SITE_PACKAGES}/bpy)
+ set(TARGETDIR_VER ${PYTHON_SITE_PACKAGES}/bpy/${BLENDER_VERSION})
+ set(TARGETDIR_LIB ${PYTHON_SITE_PACKAGES}/bpy/lib)
endif()
else()
set(TARGETDIR_VER Blender.app/Contents/Resources/${BLENDER_VERSION})