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:
authorAntonio Vazquez <blendergit@gmail.com>2020-07-03 12:22:00 +0300
committerAntonio Vazquez <blendergit@gmail.com>2020-07-03 12:22:00 +0300
commit808ee09081f12f1f0345f81ab5be8861ad087331 (patch)
tree50bffed0852eb897bd0fec3bc369238bbd9d49d9
parent2dc43b4aca243caf00f80eed4764cc49bafdfd06 (diff)
parent868d6ba1a70edd7e49bd40191547e2537ae76973 (diff)
Merge branch 'master' into greasepencil-edit-curve
Conflicts: source/blender/blenkernel/intern/gpencil_geom.c
-rw-r--r--.clang-tidy56
-rw-r--r--CMakeLists.txt5
-rw-r--r--build_files/cmake/Modules/FindClangTidy.cmake104
-rw-r--r--intern/cycles/util/util_thread.h77
-rw-r--r--intern/ghost/intern/GHOST_Window.h2
-rw-r--r--intern/mantaflow/intern/strings/fluid_script.h8
m---------release/datafiles/locale0
m---------release/scripts/addons0
-rw-r--r--release/scripts/startup/bl_ui/space_clip.py2
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py2
-rw-r--r--release/scripts/startup/keyingsets_builtins.py28
-rw-r--r--source/CMakeLists.txt10
-rw-r--r--source/blender/blenkernel/BKE_paint.h1
-rw-r--r--source/blender/blenkernel/BKE_particle.h1
-rw-r--r--source/blender/blenkernel/BKE_subsurf.h1
-rw-r--r--source/blender/blenkernel/intern/gpencil_geom.c104
-rw-r--r--source/blender/blenkernel/intern/object_update.c2
-rw-r--r--source/blender/blenlib/BLI_threads.h16
-rw-r--r--source/blender/blenlib/CMakeLists.txt2
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c2
-rw-r--r--source/blender/blenlib/intern/threads.cc (renamed from source/blender/blenlib/intern/threads.c)147
-rw-r--r--source/blender/draw/engines/eevee/eevee_data.c1
-rw-r--r--source/blender/draw/engines/overlay/overlay_image.c6
-rw-r--r--source/blender/draw/engines/overlay/shaders/image_frag.glsl3
-rw-r--r--source/blender/editors/include/ED_armature.h1
-rw-r--r--source/blender/editors/include/ED_mesh.h2
-rw-r--r--source/blender/editors/include/ED_node.h2
-rw-r--r--source/blender/editors/include/ED_object.h1
-rw-r--r--source/blender/editors/include/UI_interface.h1
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c72
-rw-r--r--source/blender/editors/space_clip/tracking_ops_detect.c8
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c14
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h6
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c61
-rw-r--r--source/blender/makesdna/intern/makesdna.c2
-rw-r--r--source/blender/makesrna/intern/rna_camera.c2
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c22
-rw-r--r--source/blender/makesrna/intern/rna_key.c5
-rw-r--r--source/blender/makesrna/intern/rna_particle.c2
-rw-r--r--source/blender/makesrna/intern/rna_tracking.c11
40 files changed, 479 insertions, 313 deletions
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 00000000000..f4b7bc3e3be
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1,56 @@
+Checks: >
+ -*,
+ readability-*,
+ -readability-uppercase-literal-suffix,
+ -readability-magic-numbers,
+ -readability-isolate-declaration,
+ -readability-convert-member-functions-to-static,
+ -readability-implicit-bool-conversion,
+ -readability-avoid-const-params-in-decls,
+ -readability-simplify-boolean-expr,
+ -readability-make-member-function-const,
+
+ -readability-misleading-indentation,
+
+ -readability-else-after-return,
+ -readability-braces-around-statements,
+ -readability-inconsistent-declaration-parameter-name,
+ -readability-non-const-parameter,
+ -readability-redundant-preprocessor,
+ -readability-redundant-control-flow,
+ -readability-named-parameter,
+ -readability-function-size,
+ -readability-function-size,
+ -readability-static-definition-in-anonymous-namespace,
+ -readability-delete-null-pointer,
+ -readability-redundant-string-init,
+ -readability-redundant-member-init,
+ -readability-const-return-type,
+ -readability-container-size-empty,
+ -readability-redundant-string-cstr,
+ -readability-static-accessed-through-instance,
+ -readability-redundant-declaration,
+ -readability-qualified-auto,
+
+ bugprone-*,
+ -bugprone-narrowing-conversions,
+ -bugprone-unhandled-self-assignment,
+ -bugprone-branch-clone,
+ -bugprone-macro-parentheses,
+
+ -bugprone-sizeof-expression,
+ -bugprone-integer-division,
+ -bugprone-incorrect-roundings,
+ -bugprone-suspicious-string-compare,
+ -bugprone-too-small-loop-variable,
+ -bugprone-misplaced-widening-cast,
+ -bugprone-not-null-terminated-result,
+ -bugprone-suspicious-missing-comma,
+ -bugprone-argument-comment,
+ -bugprone-assert-side-effect,
+ -bugprone-parent-virtual-call,
+ -bugprone-infinite-loop,
+ -bugprone-copy-constructor-init,
+ -bugprone-lambda-function-name,
+
+WarningsAsErrors: '*'
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 60c6f638370..e03ebb578fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -415,6 +415,11 @@ mark_as_advanced(WITH_CXX_GUARDEDALLOC)
option(WITH_ASSERT_ABORT "Call abort() when raising an assertion through BLI_assert()" ON)
mark_as_advanced(WITH_ASSERT_ABORT)
+if(UNIX AND NOT APPLE)
+ option(WITH_CLANG_TIDY "Use Clang Tidy to analyze the source code (only enable for development on Limux using Clang)" OFF)
+ mark_as_advanced(WITH_CLANG_TIDY)
+endif()
+
option(WITH_BOOST "Enable features depending on boost" ON)
option(WITH_TBB "Enable features depending on TBB (OpenVDB, OpenImageDenoise, sculpt multithreading)" ON)
diff --git a/build_files/cmake/Modules/FindClangTidy.cmake b/build_files/cmake/Modules/FindClangTidy.cmake
new file mode 100644
index 00000000000..f556d05a0b9
--- /dev/null
+++ b/build_files/cmake/Modules/FindClangTidy.cmake
@@ -0,0 +1,104 @@
+# - Find clang-tidy executable
+#
+# Find the native clang-tidy executable
+#
+# This module defines
+# CLANG_TIDY_EXECUTABLE, the ful lpath to clang-tidy executable
+#
+# CLANG_TIDY_VERSION, the full version of the clang-tidy in the
+# major,minor.patch format
+#
+# CLANG_TIDY_VERSION_MAJOR,
+# CLANG_TIDY_VERSION_MINOR,
+# CLANG_TIDY_VERSION_PATCH, individual components of the clang-tidy version.
+#
+# CLANG_TIDY_FOUND, If false, do not try to use Eigen3.
+
+#=============================================================================
+# Copyright 2020 Blender Foundation.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+# If CLANG_TIDY_ROOT_DIR was defined in the environment, use it.
+if(NOT CLANG_TIDY_ROOT_DIR AND NOT $ENV{CLANG_TIDY_ROOT_DIR} STREQUAL "")
+ set(CLANG_TIDY_ROOT_DIR $ENV{CLANG_TIDY_ROOT_DIR})
+endif()
+
+set(_clang_tidy_SEARCH_DIRS
+ ${CLANG_TIDY_ROOT_DIR}
+ /usr/local/bin
+)
+
+# TODO(sergey): Find more reliable way of finding the latest clang-tidy.
+find_program(CLANG_TIDY_EXECUTABLE
+ NAMES
+ clang-tidy-10
+ clang-tidy-9
+ clang-tidy-8
+ clang-tidy-7
+ clang-tidy
+ HINTS
+ ${_clang_tidy_SEARCH_DIRS}
+)
+
+if(CLANG_TIDY_EXECUTABLE)
+ # Mark clang-tidy as found.
+ set(CLANG_TIDY_FOUND TRUE)
+
+ # Setup fallback values.
+ set(CLANG_TIDY_VERSION_MAJOR 0)
+ set(CLANG_TIDY_VERSION_MINOR 0)
+ set(CLANG_TIDY_VERSION_PATCH 0)
+
+ # Get version from the output.
+ #
+ # NOTE: Don't use name of the executable file since that only includes a
+ # major version. Also, even the major version might be missing in the
+ # executable name.
+ execute_process(COMMAND ${CLANG_TIDY_EXECUTABLE} -version
+ OUTPUT_VARIABLE CLANG_TIDY_VERSION_RAW
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ # Parse parts.
+ if(CLANG_TIDY_VERSION_RAW MATCHES "LLVM version .*")
+ # Strip the LLVM prefix and get list of individual version components.
+ string(REGEX REPLACE
+ ".*LLVM version ([.0-9]+).*" "\\1"
+ CLANG_SEMANTIC_VERSION "${CLANG_TIDY_VERSION_RAW}")
+ string(REPLACE "." ";" CLANG_VERSION_PARTS "${CLANG_SEMANTIC_VERSION}")
+ list(LENGTH CLANG_VERSION_PARTS NUM_CLANG_TIDY_VERSION_PARTS)
+
+ # Extract components into corresponding variables.
+ if(NUM_CLANG_TIDY_VERSION_PARTS GREATER 0)
+ list(GET CLANG_VERSION_PARTS 0 CLANG_TIDY_VERSION_MAJOR)
+ endif()
+ if(NUM_CLANG_TIDY_VERSION_PARTS GREATER 1)
+ list(GET CLANG_VERSION_PARTS 1 CLANG_TIDY_VERSION_MINOR)
+ endif()
+ if(NUM_CLANG_TIDY_VERSION_PARTS GREATER 2)
+ list(GET CLANG_VERSION_PARTS 2 CLANG_TIDY_VERSION_PATCH)
+ endif()
+
+ # Unset temp variables.
+ unset(NUM_CLANG_TIDY_VERSION_PARTS)
+ unset(CLANG_SEMANTIC_VERSION)
+ unset(CLANG_VERSION_PARTS)
+ endif()
+
+ # Construct full semantic version.
+ set(CLANG_TIDY_VERSION "${CLANG_TIDY_VERSION_MAJOR}.\
+${CLANG_TIDY_VERSION_MINOR}.\
+${CLANG_TIDY_VERSION_PATCH}")
+ unset(CLANG_TIDY_VERSION_RAW)
+
+ message(STATUS "Found clang-tidy ${CLANG_TIDY_EXECUTABLE} (${CLANG_TIDY_VERSION})")
+else()
+ set(CLANG_TIDY_FOUND FALSE)
+endif()
diff --git a/intern/cycles/util/util_thread.h b/intern/cycles/util/util_thread.h
index f6dbc9186b8..29f9becbefe 100644
--- a/intern/cycles/util/util_thread.h
+++ b/intern/cycles/util/util_thread.h
@@ -29,9 +29,9 @@
# include <pthread.h>
#endif
-#ifdef __APPLE__
-# include <libkern/OSAtomic.h>
-#endif
+/* NOTE: Use tbb/spin_mutex.h instead of util_tbb.h because some of the TBB
+ * functionality requires RTTI, which is disabled for OSL kernel. */
+#include <tbb/spin_mutex.h>
#include "util/util_function.h"
@@ -65,76 +65,7 @@ class thread {
int node_;
};
-/* Own wrapper around pthread's spin lock to make it's use easier. */
-
-class thread_spin_lock {
- public:
-#ifdef __APPLE__
- inline thread_spin_lock()
- {
- spin_ = OS_SPINLOCK_INIT;
- }
-
- inline void lock()
- {
- OSSpinLockLock(&spin_);
- }
-
- inline void unlock()
- {
- OSSpinLockUnlock(&spin_);
- }
-#elif defined(_WIN32)
- inline thread_spin_lock()
- {
- const DWORD SPIN_COUNT = 50000;
- InitializeCriticalSectionAndSpinCount(&cs_, SPIN_COUNT);
- }
-
- inline ~thread_spin_lock()
- {
- DeleteCriticalSection(&cs_);
- }
-
- inline void lock()
- {
- EnterCriticalSection(&cs_);
- }
-
- inline void unlock()
- {
- LeaveCriticalSection(&cs_);
- }
-#else
- inline thread_spin_lock()
- {
- pthread_spin_init(&spin_, 0);
- }
-
- inline ~thread_spin_lock()
- {
- pthread_spin_destroy(&spin_);
- }
-
- inline void lock()
- {
- pthread_spin_lock(&spin_);
- }
-
- inline void unlock()
- {
- pthread_spin_unlock(&spin_);
- }
-#endif
- protected:
-#ifdef __APPLE__
- OSSpinLock spin_;
-#elif defined(_WIN32)
- CRITICAL_SECTION cs_;
-#else
- pthread_spinlock_t spin_;
-#endif
-};
+using thread_spin_lock = tbb::spin_mutex;
class thread_scoped_spin_lock {
public:
diff --git a/intern/ghost/intern/GHOST_Window.h b/intern/ghost/intern/GHOST_Window.h
index 472149148e6..6738aa850ce 100644
--- a/intern/ghost/intern/GHOST_Window.h
+++ b/intern/ghost/intern/GHOST_Window.h
@@ -34,7 +34,7 @@ class GHOST_Context;
* Dimensions are given in screen coordinates that are relative to the
* upper-left corner of the screen.
* Implements part of the GHOST_IWindow interface and adds some methods to
- * be implemented by childs of this class.
+ * be implemented by sub-classes of this class.
*/
class GHOST_Window : public GHOST_IWindow {
public:
diff --git a/intern/mantaflow/intern/strings/fluid_script.h b/intern/mantaflow/intern/strings/fluid_script.h
index 62274101859..b166ab585b0 100644
--- a/intern/mantaflow/intern/strings/fluid_script.h
+++ b/intern/mantaflow/intern/strings/fluid_script.h
@@ -461,14 +461,14 @@ if 'fluid_data_dict_resume_s$ID$' in globals(): fluid_data_dict_resume_s$ID$.cle
if 'fluid_guiding_dict_s$ID$' in globals(): fluid_guiding_dict_s$ID$.clear()\n\
if 'fluid_vel_dict_s$ID$' in globals(): fluid_vel_dict_s$ID$.clear()\n\
\n\
-# Delete all childs from objects (e.g. pdata for particles)\n\
-mantaMsg('Release solver childs childs')\n\
+# Delete all children from objects (e.g. pdata for particles)\n\
+mantaMsg('Release solver childrens children')\n\
for var in list(globals()):\n\
if var.endswith('_pp$ID$') or var.endswith('_mesh$ID$'):\n\
del globals()[var]\n\
\n\
-# Now delete childs from solver objects\n\
-mantaMsg('Release solver childs')\n\
+# Now delete children from solver objects\n\
+mantaMsg('Release solver children')\n\
for var in list(globals()):\n\
if var.endswith('_s$ID$') or var.endswith('_sn$ID$') or var.endswith('_sm$ID$') or var.endswith('_sp$ID$') or var.endswith('_sg$ID$'):\n\
del globals()[var]\n\
diff --git a/release/datafiles/locale b/release/datafiles/locale
-Subproject caf68fed42f55e606b14c7105f5df694957ce03
+Subproject f1ab6e28bf1626daf898fc65e144f1e4e4f2098
diff --git a/release/scripts/addons b/release/scripts/addons
-Subproject bc1262f4d61feeba235bb75046e65e0e8411241
+Subproject 9128155de32592d84b08426a54ae1e56f02d463
diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index 5b6cc6609e0..73bc5fe5c29 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -1578,7 +1578,7 @@ class CLIP_MT_marker_pie(Menu):
layout = self.layout
pie = layout.menu_pie()
# Use Location Tracking
- prop = pie.operator("wm.context_set_enum", text="Loc")
+ prop = pie.operator("wm.context_set_enum", text="Location")
prop.data_path = "space_data.clip.tracking.tracks.active.motion_model"
prop.value = "Loc"
# Use Affine Tracking
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 25e87a39bc1..600f2b67bcc 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -4038,6 +4038,8 @@ class VIEW3D_MT_edit_mesh_edges(Menu):
layout.separator()
layout.operator("transform.edge_slide")
+ props = layout.operator("mesh.loopcut_slide")
+ props.TRANSFORM_OT_edge_slide.release_confirm = False
layout.operator("mesh.offset_edge_loops_slide")
layout.separator()
diff --git a/release/scripts/startup/keyingsets_builtins.py b/release/scripts/startup/keyingsets_builtins.py
index bebd10edde3..19d565d10b6 100644
--- a/release/scripts/startup/keyingsets_builtins.py
+++ b/release/scripts/startup/keyingsets_builtins.py
@@ -85,7 +85,7 @@ class BUILTIN_KSI_Rotation(KeyingSetInfo):
class BUILTIN_KSI_Scaling(KeyingSetInfo):
"""Insert a keyframe on each of the scale channels"""
bl_idname = ANIM_KS_SCALING_ID
- bl_label = "Scaling"
+ bl_label = "Scale"
# poll - use predefined callback for selected bones/objects
poll = keyingsets_utils.RKS_POLL_selected_items
@@ -102,7 +102,7 @@ class BUILTIN_KSI_Scaling(KeyingSetInfo):
# LocRot
class BUILTIN_KSI_LocRot(KeyingSetInfo):
"""Insert a keyframe on each of the location and rotation channels"""
- bl_label = "LocRot"
+ bl_label = "Location & Rotation"
# poll - use predefined callback for selected bones/objects
poll = keyingsets_utils.RKS_POLL_selected_items
@@ -121,7 +121,7 @@ class BUILTIN_KSI_LocRot(KeyingSetInfo):
# LocScale
class BUILTIN_KSI_LocScale(KeyingSetInfo):
"""Insert a keyframe on each of the location and scale channels"""
- bl_label = "LocScale"
+ bl_label = "Location & Scale"
# poll - use predefined callback for selected bones/objects
poll = keyingsets_utils.RKS_POLL_selected_items
@@ -141,7 +141,7 @@ class BUILTIN_KSI_LocScale(KeyingSetInfo):
class BUILTIN_KSI_LocRotScale(KeyingSetInfo):
"""Insert a keyframe on each of the location, rotation, and scale channels"""
bl_idname = ANIM_KS_LOC_ROT_SCALE_ID
- bl_label = "LocRotScale"
+ bl_label = "Location, Rotation & Scale"
# poll - use predefined callback for selected bones/objects
poll = keyingsets_utils.RKS_POLL_selected_items
@@ -162,7 +162,7 @@ class BUILTIN_KSI_LocRotScale(KeyingSetInfo):
# RotScale
class BUILTIN_KSI_RotScale(KeyingSetInfo):
"""Insert a keyframe on each of the rotation and scale channels"""
- bl_label = "RotScale"
+ bl_label = "Rotation & Scale"
# poll - use predefined callback for selected bones/objects
poll = keyingsets_utils.RKS_POLL_selected_items
@@ -237,7 +237,7 @@ class BUILTIN_KSI_VisualRot(KeyingSetInfo):
class BUILTIN_KSI_VisualScaling(KeyingSetInfo):
"""Insert a keyframe on each of the scale channels, """ \
"""taking into account effects of constraints and relationships"""
- bl_label = "Visual Scaling"
+ bl_label = "Visual Scale"
bl_options = {'INSERTKEY_VISUAL'}
@@ -255,7 +255,7 @@ class BUILTIN_KSI_VisualScaling(KeyingSetInfo):
class BUILTIN_KSI_VisualLocRot(KeyingSetInfo):
"""Insert a keyframe on each of the location and rotation channels, """ \
"""taking into account effects of constraints and relationships"""
- bl_label = "Visual LocRot"
+ bl_label = "Visual Location & Rotation"
bl_options = {'INSERTKEY_VISUAL'}
@@ -275,9 +275,9 @@ class BUILTIN_KSI_VisualLocRot(KeyingSetInfo):
# VisualLocScale
class BUILTIN_KSI_VisualLocScale(KeyingSetInfo):
- """Insert a keyframe on each of the location and scaling channels, """ \
+ """Insert a keyframe on each of the location and scale channels, """ \
"""taking into account effects of constraints and relationships"""
- bl_label = "Visual LocScale"
+ bl_label = "Visual Location & Scale"
bl_options = {'INSERTKEY_VISUAL'}
@@ -298,8 +298,8 @@ class BUILTIN_KSI_VisualLocScale(KeyingSetInfo):
# VisualLocRotScale
class BUILTIN_KSI_VisualLocRotScale(KeyingSetInfo):
"""Insert a keyframe on each of the location, """ \
- """rotation and scaling channels, taking into account effects of constraints and relationships"""
- bl_label = "Visual LocRotScale"
+ """rotation and scale channels, taking into account effects of constraints and relationships"""
+ bl_label = "Visual Location, Rotation & Scale"
bl_options = {'INSERTKEY_VISUAL'}
@@ -321,9 +321,9 @@ class BUILTIN_KSI_VisualLocRotScale(KeyingSetInfo):
# VisualRotScale
class BUILTIN_KSI_VisualRotScale(KeyingSetInfo):
- """Insert a keyframe on each of the rotation and scaling channels, """ \
+ """Insert a keyframe on each of the rotation and scale channels, """ \
"""taking into account effects of constraints and relationships"""
- bl_label = "Visual RotScale"
+ bl_label = "Visual Rotation & Scale"
bl_options = {'INSERTKEY_VISUAL'}
@@ -628,7 +628,7 @@ class BUILTIN_KSI_DeltaRotation(KeyingSetInfo):
# Delta Scale
class BUILTIN_KSI_DeltaScale(KeyingSetInfo):
- """Insert keyframes for additional scaling factor"""
+ """Insert keyframes for additional scale factor"""
bl_label = "Delta Scale"
# poll - selected objects only (and only if active object in object mode)
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 9b473812df2..88c19355960 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -22,4 +22,14 @@ if(WITH_LEGACY_OPENGL)
add_definitions(-DWITH_LEGACY_OPENGL)
endif()
+if(WITH_CLANG_TIDY)
+ if(NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
+ message(WARNING "Currently Clang-Tidy might fail with GCC toolchain, switch to Clang toolchain if that happens")
+ endif()
+
+ find_package(ClangTidy REQUIRED)
+ set(CMAKE_C_CLANG_TIDY ${CLANG_TIDY_EXECUTABLE})
+ set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_EXECUTABLE})
+endif()
+
add_subdirectory(blender)
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 78092884655..e08d3fe26fb 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -57,7 +57,6 @@ struct ReportList;
struct Scene;
struct StrokeCache;
struct SubdivCCG;
-struct SubdivCCG;
struct Tex;
struct ToolSettings;
struct UnifiedPaintSettings;
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index 00d010cd6d9..a22cb9ef126 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -48,7 +48,6 @@ struct BVHTreeRay;
struct BVHTreeRayHit;
struct CustomData_MeshMasks;
struct Depsgraph;
-struct Depsgraph;
struct EdgeHash;
struct KDTree_3d;
struct LatticeDeformData;
diff --git a/source/blender/blenkernel/BKE_subsurf.h b/source/blender/blenkernel/BKE_subsurf.h
index 2dee8de4dc7..0ed58180ffa 100644
--- a/source/blender/blenkernel/BKE_subsurf.h
+++ b/source/blender/blenkernel/BKE_subsurf.h
@@ -45,7 +45,6 @@ struct Mesh;
struct MeshElemMap;
struct Object;
struct PBVH;
-struct PBVH;
struct SubsurfModifierData;
/**************************** External *****************************/
diff --git a/source/blender/blenkernel/intern/gpencil_geom.c b/source/blender/blenkernel/intern/gpencil_geom.c
index 5eedfb00b75..ad310d700bd 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.c
+++ b/source/blender/blenkernel/intern/gpencil_geom.c
@@ -56,8 +56,12 @@
/* GP Object - Boundbox Support */
/**
- * Get min/max coordinate bounds for single stroke
- * \return Returns whether we found any selected points
+ *Get min/max coordinate bounds for single stroke.
+ * \param gps Grease pencil stroke
+ * \param use_select Include only selected points
+ * \param r_min Result minimum coordinates
+ * \param r_max Result maximum coordinates
+ * \return True if it was possible to calculate
*/
bool BKE_gpencil_stroke_minmax(const bGPDstroke *gps,
const bool use_select,
@@ -81,7 +85,13 @@ bool BKE_gpencil_stroke_minmax(const bGPDstroke *gps,
return changed;
}
-/* get min/max bounds of all strokes in GP datablock */
+/**
+ * Get min/max bounds of all strokes in grease pencil data-block.
+ * \param gpd Grease pencil datablock
+ * \param r_min Result minimum coordinates
+ * \param r_max Result maximum coordinates
+ * \return True if it was possible to calculate
+ */
bool BKE_gpencil_data_minmax(const bGPdata *gpd, float r_min[3], float r_max[3])
{
bool changed = false;
@@ -105,7 +115,11 @@ bool BKE_gpencil_data_minmax(const bGPdata *gpd, float r_min[3], float r_max[3])
return changed;
}
-/* compute center of bounding box */
+/**
+ * Compute center of bounding box.
+ * \param gpd Grease pencil data-block
+ * \param r_centroid Location of the center
+ */
void BKE_gpencil_centroid_3d(bGPdata *gpd, float r_centroid[3])
{
float min[3], max[3], tot[3];
@@ -116,14 +130,20 @@ void BKE_gpencil_centroid_3d(bGPdata *gpd, float r_centroid[3])
mul_v3_v3fl(r_centroid, tot, 0.5f);
}
-/* Compute stroke bounding box. */
+/**
+ * Compute stroke bounding box.
+ * \param gps Grease pencil Stroke
+ */
void BKE_gpencil_stroke_boundingbox_calc(bGPDstroke *gps)
{
INIT_MINMAX(gps->boundbox_min, gps->boundbox_max);
BKE_gpencil_stroke_minmax(gps, false, gps->boundbox_min, gps->boundbox_max);
}
-/* create bounding box values */
+/**
+ * Create bounding box values.
+ * \param ob Grease pencil object
+ */
static void boundbox_gpencil(Object *ob)
{
BoundBox *bb;
@@ -147,7 +167,11 @@ static void boundbox_gpencil(Object *ob)
bb->flag &= ~BOUNDBOX_DIRTY;
}
-/* get bounding box */
+/**
+ * Get grease pencil object bounding box.
+ * \param ob Grease pencil object
+ * \return Bounding box
+ */
BoundBox *BKE_gpencil_boundbox_get(Object *ob)
{
if (ELEM(NULL, ob, ob->data)) {
@@ -594,7 +618,15 @@ bool BKE_gpencil_stroke_trim_points(bGPDstroke *gps, const int index_from, const
return true;
}
-
+/**
+ * Split stroke.
+ * \param gpd Grease pencil data-block
+ * \param gpf Grease pencil frame
+ * \param gps Grease pencil original stroke
+ * \param before_index Position of the point to split
+ * \param remaining_gps Secondary stroke after split.
+ * \return True if the split was done
+ */
bool BKE_gpencil_stroke_split(bGPdata *gpd,
bGPDframe *gpf,
bGPDstroke *gps,
@@ -722,7 +754,7 @@ bool BKE_gpencil_stroke_shrink(bGPDstroke *gps, const float dist)
}
/**
- * Apply smooth to stroke point
+ * Apply smooth position to stroke point.
* \param gps: Stroke to smooth
* \param i: Point index
* \param inf: Amount of smoothing to apply
@@ -785,7 +817,11 @@ bool BKE_gpencil_stroke_smooth(bGPDstroke *gps, int i, float inf)
}
/**
- * Apply smooth for strength to stroke point */
+ * Apply smooth strength to stroke point.
+ * \param gps: Stroke to smooth
+ * \param point_index: Point index
+ * \param influence: Amount of smoothing to apply
+ */
bool BKE_gpencil_stroke_smooth_strength(bGPDstroke *gps, int point_index, float influence)
{
bGPDspoint *ptb = &gps->points[point_index];
@@ -845,7 +881,11 @@ bool BKE_gpencil_stroke_smooth_strength(bGPDstroke *gps, int point_index, float
}
/**
- * Apply smooth for thickness to stroke point (use pressure) */
+ * Apply smooth for thickness to stroke point (use pressure).
+ * \param gps: Stroke to smooth
+ * \param point_index: Point index
+ * \param influence: Amount of smoothing to apply
+ */
bool BKE_gpencil_stroke_smooth_thickness(bGPDstroke *gps, int point_index, float influence)
{
bGPDspoint *ptb = &gps->points[point_index];
@@ -905,6 +945,9 @@ bool BKE_gpencil_stroke_smooth_thickness(bGPDstroke *gps, int point_index, float
/**
* Apply smooth for UV rotation to stroke point (use pressure).
+ * \param gps: Stroke to smooth
+ * \param point_index: Point index
+ * \param influence: Amount of smoothing to apply
*/
bool BKE_gpencil_stroke_smooth_uv(bGPDstroke *gps, int point_index, float influence)
{
@@ -942,7 +985,15 @@ bool BKE_gpencil_stroke_smooth_uv(bGPDstroke *gps, int point_index, float influe
return true;
}
-/* Get points of stroke always flat to view not affected by camera view or view position */
+
+/**
+ * Get points of stroke always flat to view not affected
+ * by camera view or view position.
+ * \param points Array of grease pencil points (3D)
+ * \param totpoints Total of points
+ * \param points2d Result array of 2D points
+ * \param r_direction Concave (-1), Convex (1), or Autodetect (0)
+ */
void BKE_gpencil_stroke_2d_flat(const bGPDspoint *points,
int totpoints,
float (*points2d)[2],
@@ -999,8 +1050,16 @@ void BKE_gpencil_stroke_2d_flat(const bGPDspoint *points,
*r_direction = (int)locy[2];
}
-/* Get points of stroke always flat to view not affected by camera view or view position
- * using another stroke as reference
+/**
+ * Get points of stroke always flat to view not affected by camera view or view position
+ * using another stroke as reference.
+ * \param ref_points Array of reference points (3D)
+ * \param ref_totpoints Total reference points
+ * \param points Array of points to flat (3D)
+ * \param totpoints Total points
+ * \param points2d Result array of 2D points
+ * \param scale Scale factor
+ * \param r_direction Concave (-1), Convex (1), or Autodetect (0)
*/
void BKE_gpencil_stroke_2d_flat_ref(const bGPDspoint *ref_points,
int ref_totpoints,
@@ -1125,8 +1184,10 @@ static void gpencil_calc_stroke_fill_uv(const float (*points2d)[2],
}
}
-/* Triangulate stroke for high quality fill (this is done only if cache is null or stroke was
- * modified) */
+/**
+ * Triangulate stroke to generate data for filling areas.
+ * \param gps Grease pencil stroke
+ */
void BKE_gpencil_stroke_fill_triangulate(bGPDstroke *gps)
{
BLI_assert(gps->totpoints >= 3);
@@ -1185,7 +1246,10 @@ void BKE_gpencil_stroke_fill_triangulate(bGPDstroke *gps)
MEM_SAFE_FREE(uv);
}
-/* texture coordinate utilities */
+/**
+ * Update Stroke UV data.
+ * \param gps Grease pencil stroke
+ */
void BKE_gpencil_stroke_uv_update(bGPDstroke *gps)
{
if (gps == NULL || gps->totpoints == 0) {
@@ -1201,7 +1265,11 @@ void BKE_gpencil_stroke_uv_update(bGPDstroke *gps)
}
}
-/* Recalc the internal geometry caches for fill and uvs. */
+/**
+ * Recalc all internal geometry data for the stroke
+ * \param gpd Grease pencil data-block
+ * \param gps Grease pencil stroke
+ */
void BKE_gpencil_stroke_geometry_update(bGPdata *UNUSED(gpd), bGPDstroke *gps)
{
if (gps == NULL) {
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c
index d8c3e0bf714..7f378e6e80b 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -145,7 +145,7 @@ void BKE_object_eval_transform_final(Depsgraph *depsgraph, Object *ob)
DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob);
/* Make sure inverse matrix is always up to date. This way users of it
* do not need to worry about recalculating it. */
- invert_m4_m4(ob->imat, ob->obmat);
+ invert_m4_m4_safe(ob->imat, ob->obmat);
/* Set negative scale flag in object. */
if (is_negative_m4(ob->obmat)) {
ob->transflag |= OB_NEG_SCALE;
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h
index 03fe27c10ed..6f810144a48 100644
--- a/source/blender/blenlib/BLI_threads.h
+++ b/source/blender/blenlib/BLI_threads.h
@@ -28,10 +28,6 @@
#include "BLI_sys_types.h"
-#ifdef __APPLE__
-# include <libkern/OSAtomic.h>
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -100,8 +96,16 @@ void BLI_mutex_unlock(ThreadMutex *mutex);
/* Spin Lock */
-#if defined(__APPLE__)
-typedef OSSpinLock SpinLock;
+/* By default we use TBB for spin lock on all platforms. When building without
+ * TBB fall-back to spin lock implementation which is native to the platform.
+ *
+ * On macOS we use mutex lock instead of spin since the spin lock has been
+ * deprecated in SDK 10.12 and is discouraged from use. */
+
+#ifdef WITH_TBB
+typedef uint32_t SpinLock;
+#elif defined(__APPLE__)
+typedef ThreadMutex SpinLock;
#elif defined(_MSC_VER)
typedef volatile int SpinLock;
#else
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt
index 2630eb6bbd0..e599b00401a 100644
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@ -124,7 +124,7 @@ set(SRC
intern/task_pool.cc
intern/task_range.cc
intern/task_scheduler.cc
- intern/threads.c
+ intern/threads.cc
intern/time.c
intern/timecode.c
intern/timeit.cc
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index 40b011dca9e..0707e4c1d2a 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -94,7 +94,7 @@ typedef struct BVHNode {
struct BVHTree {
BVHNode **nodes;
BVHNode *nodearray; /* pre-alloc branch nodes */
- BVHNode **nodechild; /* pre-alloc childs for nodes */
+ BVHNode **nodechild; /* pre-alloc children for nodes */
float *nodebv; /* pre-alloc bounding-volumes for nodes */
float epsilon; /* epslion is used for inflation of the k-dop */
int totleaf; /* leafs */
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.cc
index be43c27e945..7acd9b071e1 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.cc
@@ -47,6 +47,10 @@
# include <unistd.h>
#endif
+#ifdef WITH_TBB
+# include <tbb/spin_mutex.h>
+#endif
+
#include "atomic_ops.h"
#include "numaapi.h"
@@ -151,7 +155,7 @@ void BLI_threadpool_init(ListBase *threadbase, void *(*do_thread)(void *), int t
{
int a;
- if (threadbase != NULL && tot > 0) {
+ if (threadbase != nullptr && tot > 0) {
BLI_listbase_clear(threadbase);
if (tot > RE_MAX_THREAD) {
@@ -162,7 +166,7 @@ void BLI_threadpool_init(ListBase *threadbase, void *(*do_thread)(void *), int t
}
for (a = 0; a < tot; a++) {
- ThreadSlot *tslot = MEM_callocN(sizeof(ThreadSlot), "threadslot");
+ ThreadSlot *tslot = static_cast<ThreadSlot *>(MEM_callocN(sizeof(ThreadSlot), "threadslot"));
BLI_addtail(threadbase, tslot);
tslot->do_thread = do_thread;
tslot->avail = 1;
@@ -183,28 +187,29 @@ void BLI_threadpool_init(ListBase *threadbase, void *(*do_thread)(void *), int t
/* amount of available threads */
int BLI_available_threads(ListBase *threadbase)
{
- ThreadSlot *tslot;
int counter = 0;
- for (tslot = threadbase->first; tslot; tslot = tslot->next) {
+ LISTBASE_FOREACH (ThreadSlot *, tslot, threadbase) {
if (tslot->avail) {
counter++;
}
}
+
return counter;
}
/* returns thread number, for sample patterns or threadsafe tables */
int BLI_threadpool_available_thread_index(ListBase *threadbase)
{
- ThreadSlot *tslot;
int counter = 0;
- for (tslot = threadbase->first; tslot; tslot = tslot->next, counter++) {
+ LISTBASE_FOREACH (ThreadSlot *, tslot, threadbase) {
if (tslot->avail) {
return counter;
}
+ ++counter;
}
+
return 0;
}
@@ -228,13 +233,11 @@ int BLI_thread_is_main(void)
void BLI_threadpool_insert(ListBase *threadbase, void *callerdata)
{
- ThreadSlot *tslot;
-
- for (tslot = threadbase->first; tslot; tslot = tslot->next) {
+ LISTBASE_FOREACH (ThreadSlot *, tslot, threadbase) {
if (tslot->avail) {
tslot->avail = 0;
tslot->callerdata = callerdata;
- pthread_create(&tslot->pthread, NULL, tslot_thread_start, tslot);
+ pthread_create(&tslot->pthread, nullptr, tslot_thread_start, tslot);
return;
}
}
@@ -243,12 +246,10 @@ void BLI_threadpool_insert(ListBase *threadbase, void *callerdata)
void BLI_threadpool_remove(ListBase *threadbase, void *callerdata)
{
- ThreadSlot *tslot;
-
- for (tslot = threadbase->first; tslot; tslot = tslot->next) {
+ LISTBASE_FOREACH (ThreadSlot *, tslot, threadbase) {
if (tslot->callerdata == callerdata) {
- pthread_join(tslot->pthread, NULL);
- tslot->callerdata = NULL;
+ pthread_join(tslot->pthread, nullptr);
+ tslot->callerdata = nullptr;
tslot->avail = 1;
}
}
@@ -256,27 +257,25 @@ void BLI_threadpool_remove(ListBase *threadbase, void *callerdata)
void BLI_threadpool_remove_index(ListBase *threadbase, int index)
{
- ThreadSlot *tslot;
int counter = 0;
- for (tslot = threadbase->first; tslot; tslot = tslot->next, counter++) {
+ LISTBASE_FOREACH (ThreadSlot *, tslot, threadbase) {
if (counter == index && tslot->avail == 0) {
- pthread_join(tslot->pthread, NULL);
- tslot->callerdata = NULL;
+ pthread_join(tslot->pthread, nullptr);
+ tslot->callerdata = nullptr;
tslot->avail = 1;
break;
}
+ ++counter;
}
}
void BLI_threadpool_clear(ListBase *threadbase)
{
- ThreadSlot *tslot;
-
- for (tslot = threadbase->first; tslot; tslot = tslot->next) {
+ LISTBASE_FOREACH (ThreadSlot *, tslot, threadbase) {
if (tslot->avail == 0) {
- pthread_join(tslot->pthread, NULL);
- tslot->callerdata = NULL;
+ pthread_join(tslot->pthread, nullptr);
+ tslot->callerdata = nullptr;
tslot->avail = 1;
}
}
@@ -284,19 +283,20 @@ void BLI_threadpool_clear(ListBase *threadbase)
void BLI_threadpool_end(ListBase *threadbase)
{
- ThreadSlot *tslot;
/* only needed if there's actually some stuff to end
* this way we don't end up decrementing thread_levels on an empty threadbase
* */
- if (threadbase && (BLI_listbase_is_empty(threadbase) == false)) {
- for (tslot = threadbase->first; tslot; tslot = tslot->next) {
- if (tslot->avail == 0) {
- pthread_join(tslot->pthread, NULL);
- }
+ if (threadbase == nullptr || BLI_listbase_is_empty(threadbase)) {
+ return;
+ }
+
+ LISTBASE_FOREACH (ThreadSlot *, tslot, threadbase) {
+ if (tslot->avail == 0) {
+ pthread_join(tslot->pthread, nullptr);
}
- BLI_freelistN(threadbase);
}
+ BLI_freelistN(threadbase);
}
/* System Information */
@@ -326,7 +326,7 @@ int BLI_system_thread_count(void)
mib[0] = CTL_HW;
mib[1] = HW_NCPU;
len = sizeof(t);
- sysctl(mib, 2, &t, &len, NULL, 0);
+ sysctl(mib, 2, &t, &len, nullptr, 0);
# else
t = (int)sysconf(_SC_NPROCESSORS_ONLN);
# endif
@@ -377,7 +377,7 @@ static ThreadMutex *global_mutex_from_type(const int type)
return &_view3d_lock;
default:
BLI_assert(0);
- return NULL;
+ return nullptr;
}
}
@@ -395,7 +395,7 @@ void BLI_thread_unlock(int type)
void BLI_mutex_init(ThreadMutex *mutex)
{
- pthread_mutex_init(mutex, NULL);
+ pthread_mutex_init(mutex, nullptr);
}
void BLI_mutex_lock(ThreadMutex *mutex)
@@ -420,7 +420,7 @@ void BLI_mutex_end(ThreadMutex *mutex)
ThreadMutex *BLI_mutex_alloc(void)
{
- ThreadMutex *mutex = MEM_callocN(sizeof(ThreadMutex), "ThreadMutex");
+ ThreadMutex *mutex = static_cast<ThreadMutex *>(MEM_callocN(sizeof(ThreadMutex), "ThreadMutex"));
BLI_mutex_init(mutex);
return mutex;
}
@@ -433,10 +433,24 @@ void BLI_mutex_free(ThreadMutex *mutex)
/* Spin Locks */
+#if WITH_TBB
+static tbb::spin_mutex *tbb_spin_mutex_cast(SpinLock *spin)
+{
+ static_assert(sizeof(SpinLock) >= sizeof(tbb::spin_mutex),
+ "SpinLock must match tbb::spin_mutex");
+ static_assert(alignof(SpinLock) % alignof(tbb::spin_mutex) == 0,
+ "SpinLock must be aligned same as tbb::spin_mutex");
+ return reinterpret_cast<tbb::spin_mutex *>(spin);
+}
+#endif
+
void BLI_spin_init(SpinLock *spin)
{
-#if defined(__APPLE__)
- *spin = OS_SPINLOCK_INIT;
+#ifdef WITH_TBB
+ tbb::spin_mutex *spin_mutex = tbb_spin_mutex_cast(spin);
+ new (spin_mutex) tbb::spin_mutex();
+#elif defined(__APPLE__)
+ BLI_mutex_init(spin);
#elif defined(_MSC_VER)
*spin = 0;
#else
@@ -446,8 +460,11 @@ void BLI_spin_init(SpinLock *spin)
void BLI_spin_lock(SpinLock *spin)
{
-#if defined(__APPLE__)
- OSSpinLockLock(spin);
+#ifdef WITH_TBB
+ tbb::spin_mutex *spin_mutex = tbb_spin_mutex_cast(spin);
+ spin_mutex->lock();
+#elif defined(__APPLE__)
+ BLI_mutex_lock(spin);
#elif defined(_MSC_VER)
while (InterlockedExchangeAcquire(spin, 1)) {
while (*spin) {
@@ -462,8 +479,11 @@ void BLI_spin_lock(SpinLock *spin)
void BLI_spin_unlock(SpinLock *spin)
{
-#if defined(__APPLE__)
- OSSpinLockUnlock(spin);
+#ifdef WITH_TBB
+ tbb::spin_mutex *spin_mutex = tbb_spin_mutex_cast(spin);
+ spin_mutex->unlock();
+#elif defined(__APPLE__)
+ BLI_mutex_unlock(spin);
#elif defined(_MSC_VER)
_ReadWriteBarrier();
*spin = 0;
@@ -472,22 +492,25 @@ void BLI_spin_unlock(SpinLock *spin)
#endif
}
-#if defined(__APPLE__) || defined(_MSC_VER)
-void BLI_spin_end(SpinLock *UNUSED(spin))
-{
-}
-#else
void BLI_spin_end(SpinLock *spin)
{
+#ifdef WITH_TBB
+ tbb::spin_mutex *spin_mutex = tbb_spin_mutex_cast(spin);
+ spin_mutex->~spin_mutex();
+#elif defined(__APPLE__)
+ BLI_mutex_end(spin);
+#elif defined(_MSC_VER)
+ BLI_mutex_unlock(spin);
+#else
pthread_spin_destroy(spin);
-}
#endif
+}
/* Read/Write Mutex Lock */
void BLI_rw_mutex_init(ThreadRWMutex *mutex)
{
- pthread_rwlock_init(mutex, NULL);
+ pthread_rwlock_init(mutex, nullptr);
}
void BLI_rw_mutex_lock(ThreadRWMutex *mutex, int mode)
@@ -512,7 +535,8 @@ void BLI_rw_mutex_end(ThreadRWMutex *mutex)
ThreadRWMutex *BLI_rw_mutex_alloc(void)
{
- ThreadRWMutex *mutex = MEM_callocN(sizeof(ThreadRWMutex), "ThreadRWMutex");
+ ThreadRWMutex *mutex = static_cast<ThreadRWMutex *>(
+ MEM_callocN(sizeof(ThreadRWMutex), "ThreadRWMutex"));
BLI_rw_mutex_init(mutex);
return mutex;
}
@@ -533,10 +557,11 @@ struct TicketMutex {
TicketMutex *BLI_ticket_mutex_alloc(void)
{
- TicketMutex *ticket = MEM_callocN(sizeof(TicketMutex), "TicketMutex");
+ TicketMutex *ticket = static_cast<TicketMutex *>(
+ MEM_callocN(sizeof(TicketMutex), "TicketMutex"));
- pthread_cond_init(&ticket->cond, NULL);
- pthread_mutex_init(&ticket->mutex, NULL);
+ pthread_cond_init(&ticket->cond, nullptr);
+ pthread_mutex_init(&ticket->mutex, nullptr);
return ticket;
}
@@ -576,7 +601,7 @@ void BLI_ticket_mutex_unlock(TicketMutex *ticket)
void BLI_condition_init(ThreadCondition *cond)
{
- pthread_cond_init(cond, NULL);
+ pthread_cond_init(cond, nullptr);
}
void BLI_condition_wait(ThreadCondition *cond, ThreadMutex *mutex)
@@ -619,12 +644,12 @@ ThreadQueue *BLI_thread_queue_init(void)
{
ThreadQueue *queue;
- queue = MEM_callocN(sizeof(ThreadQueue), "ThreadQueue");
+ queue = static_cast<ThreadQueue *>(MEM_callocN(sizeof(ThreadQueue), "ThreadQueue"));
queue->queue = BLI_gsqueue_new(sizeof(void *));
- pthread_mutex_init(&queue->mutex, NULL);
- pthread_cond_init(&queue->push_cond, NULL);
- pthread_cond_init(&queue->finish_cond, NULL);
+ pthread_mutex_init(&queue->mutex, nullptr);
+ pthread_cond_init(&queue->push_cond, nullptr);
+ pthread_cond_init(&queue->finish_cond, nullptr);
return queue;
}
@@ -654,7 +679,7 @@ void BLI_thread_queue_push(ThreadQueue *queue, void *work)
void *BLI_thread_queue_pop(ThreadQueue *queue)
{
- void *work = NULL;
+ void *work = nullptr;
/* wait until there is work */
pthread_mutex_lock(&queue->mutex);
@@ -691,7 +716,7 @@ static void wait_timeout(struct timespec *timeout, int ms)
#else
{
struct timeval now;
- gettimeofday(&now, NULL);
+ gettimeofday(&now, nullptr);
sec = now.tv_sec;
usec = now.tv_usec;
}
@@ -714,7 +739,7 @@ static void wait_timeout(struct timespec *timeout, int ms)
void *BLI_thread_queue_pop_timeout(ThreadQueue *queue, int ms)
{
double t;
- void *work = NULL;
+ void *work = nullptr;
struct timespec timeout;
t = PIL_check_seconds_timer();
@@ -805,7 +830,7 @@ static bool check_is_threadripper2_alike_topology(void)
}
is_initialized = true;
char *cpu_brand = BLI_cpu_brand_string();
- if (cpu_brand == NULL) {
+ if (cpu_brand == nullptr) {
return false;
}
if (strstr(cpu_brand, "Threadripper")) {
diff --git a/source/blender/draw/engines/eevee/eevee_data.c b/source/blender/draw/engines/eevee/eevee_data.c
index a4aa0e10198..87948f403a0 100644
--- a/source/blender/draw/engines/eevee/eevee_data.c
+++ b/source/blender/draw/engines/eevee/eevee_data.c
@@ -205,6 +205,7 @@ void EEVEE_view_layer_data_free(void *storage)
DRW_UBO_FREE_SAFE(sldata->renderpass_ubo.spec_color);
DRW_UBO_FREE_SAFE(sldata->renderpass_ubo.spec_light);
DRW_UBO_FREE_SAFE(sldata->renderpass_ubo.emit);
+ DRW_UBO_FREE_SAFE(sldata->renderpass_ubo.environment);
if (sldata->material_cache) {
BLI_memblock_destroy(sldata->material_cache, NULL);
diff --git a/source/blender/draw/engines/overlay/overlay_image.c b/source/blender/draw/engines/overlay/overlay_image.c
index be3510967b6..a754f7cbd49 100644
--- a/source/blender/draw/engines/overlay/overlay_image.c
+++ b/source/blender/draw/engines/overlay/overlay_image.c
@@ -61,11 +61,11 @@ void OVERLAY_image_cache_init(OVERLAY_Data *vedata)
state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS;
DRW_PASS_CREATE(psl->image_empties_ps, state | pd->clipping_state);
- state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND_ALPHA;
+ state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND_ALPHA_PREMUL;
DRW_PASS_CREATE(psl->image_empties_back_ps, state | pd->clipping_state);
DRW_PASS_CREATE(psl->image_empties_blend_ps, state | pd->clipping_state);
- state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA;
+ state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA_PREMUL;
DRW_PASS_CREATE(psl->image_empties_front_ps, state);
DRW_PASS_CREATE(psl->image_foreground_ps, state);
}
@@ -342,7 +342,7 @@ void OVERLAY_image_camera_cache_populate(OVERLAY_Data *vedata, Object *ob)
mul_m4_m4m4(mat, modelmat, mat);
const bool is_foreground = (bgpic->flag & CAM_BGIMG_FLAG_FOREGROUND) != 0;
- float color_premult_alpha[4] = {bgpic->alpha, bgpic->alpha, bgpic->alpha, bgpic->alpha};
+ float color_premult_alpha[4] = {1.0f, 1.0f, 1.0f, bgpic->alpha};
DRWPass *pass = is_foreground ? psl->image_foreground_ps : psl->image_background_ps;
diff --git a/source/blender/draw/engines/overlay/shaders/image_frag.glsl b/source/blender/draw/engines/overlay/shaders/image_frag.glsl
index 298ba1e27ed..4d37f1599a3 100644
--- a/source/blender/draw/engines/overlay/shaders/image_frag.glsl
+++ b/source/blender/draw/engines/overlay/shaders/image_frag.glsl
@@ -26,4 +26,7 @@ void main()
fragColor.a = 1.0;
}
}
+
+ /* Pre-multiplied blending. */
+ fragColor.rgb *= fragColor.a;
}
diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h
index eef431c40fa..d82c7126cf2 100644
--- a/source/blender/editors/include/ED_armature.h
+++ b/source/blender/editors/include/ED_armature.h
@@ -34,7 +34,6 @@ struct Depsgraph;
struct IDProperty;
struct ListBase;
struct Main;
-struct Main;
struct Mesh;
struct MeshDeformModifierData;
struct Object;
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index 9c49d991182..046eadb2ec3 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -47,8 +47,6 @@ struct ReportList;
struct Scene;
struct UndoType;
struct UvMapVert;
-struct UvMapVert;
-struct UvVertMap;
struct UvVertMap;
struct View3D;
struct ViewContext;
diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h
index 3471f9dcce9..47ccc0788c2 100644
--- a/source/blender/editors/include/ED_node.h
+++ b/source/blender/editors/include/ED_node.h
@@ -31,7 +31,6 @@ extern "C" {
struct ID;
struct Main;
struct Scene;
-struct Scene;
struct ScrArea;
struct Tex;
struct View2D;
@@ -40,7 +39,6 @@ struct bNode;
struct bNodeSocket;
struct bNodeSocketType;
struct bNodeTree;
-struct bNodeTree;
struct bNodeTreeType;
struct bNodeType;
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index e04d30892d7..10cd6980c90 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -34,7 +34,6 @@ extern "C" {
struct Base;
struct Depsgraph;
struct EnumPropertyItem;
-struct EnumPropertyItem;
struct ID;
struct Main;
struct ModifierData;
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 1cedd4e122f..da3d06230e3 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -65,7 +65,6 @@ struct uiWidgetColors;
struct wmDrag;
struct wmDropBox;
struct wmEvent;
-struct wmEvent;
struct wmGizmo;
struct wmKeyConfig;
struct wmKeyMap;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 2873f2003cf..178b29edfff 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -682,9 +682,9 @@ static void sculpt_vertex_neighbors_get_grids(SculptSession *ss,
const bool include_duplicates,
SculptVertexNeighborIter *iter)
{
- /* TODO: optimize this. We could fill SculptVertexNeighborIter directly,
+ /* TODO: optimize this. We could fill #SculptVertexNeighborIter directly,
* maybe provide coordinate and mask pointers directly rather than converting
- * back and forth between CCGElem and global index. */
+ * back and forth between #CCGElem and global index. */
const CCGKey *key = BKE_pbvh_get_grid_key(ss->pbvh);
const int grid_index = index / key->grid_area;
const int vertex_index = index - grid_index * key->grid_area;
@@ -777,7 +777,7 @@ bool SCULPT_vertex_is_boundary(SculptSession *ss, const int index)
return true;
}
-/* Utils */
+/* Utilities */
/**
* Returns true when the step belongs to the stroke that is directly performed by the brush and
@@ -1380,9 +1380,10 @@ static void paint_mesh_restore_co(Sculpt *sd, Object *ob)
BKE_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode);
/**
- * Disable OpenMP when dynamic-topology is enabled. Otherwise, new entries might be inserted by
- * #SCULPT_undo_push_node() into the #GHash used internally by #BM_log_original_vert_co()
- * by a different thread. See T33787. */
+ * Disable multi-threading when dynamic-topology is enabled. Otherwise,
+ * new entries might be inserted by #SCULPT_undo_push_node() into the #GHash
+ * used internally by #BM_log_original_vert_co() by a different thread. See T33787.
+ */
SculptThreadedTaskData data = {
.sd = sd,
.ob = ob,
@@ -1403,11 +1404,11 @@ static void paint_mesh_restore_co(Sculpt *sd, Object *ob)
static void sculpt_extend_redraw_rect_previous(Object *ob, rcti *rect)
{
- /* Expand redraw rect with redraw rect from previous step to
+ /* Expand redraw \a rect with redraw \a rect from previous step to
* prevent partial-redraw issues caused by fast strokes. This is
* needed here (not in sculpt_flush_update) as it was before
* because redraw rectangle should be the same in both of
- * optimized PBVH draw function and 3d view redraw (if not -- some
+ * optimized PBVH draw function and 3d view redraw, if not -- some
* mesh parts could disappear from screen (sergey). */
SculptSession *ss = ob->sculpt;
@@ -1448,8 +1449,8 @@ void ED_sculpt_redraw_planes_get(float planes[4][4], ARegion *region, Object *ob
paint_calc_redraw_planes(planes, region, ob, &rect);
- /* We will draw this rect, so now we can set it as the previous partial rect.
- * Note that we don't update with the union of previous/current (rect), only with
+ /* We will draw this \a rect, so now we can set it as the previous partial \a rect.
+ * Note that we don't update with the union of previous/current (\a rect), only with
* the current. Thus we avoid the rectangle needlessly growing to include
* all the stroke area. */
ob->sculpt->cache->previous_r = ob->sculpt->cache->current_r;
@@ -2397,7 +2398,7 @@ float SCULPT_brush_strength_factor(SculptSession *ss,
/* Paint mask. */
avg *= 1.0f - mask;
- /* Automasking. */
+ /* Auto-masking. */
avg *= SCULPT_automasking_factor_get(ss, vertex_index);
return avg;
@@ -2639,7 +2640,7 @@ static void calc_brush_local_mat(const Brush *brush, Object *ob, float local_mat
float angle, v[3];
float up[3];
- /* Ensure ob->imat is up to date. */
+ /* Ensure `ob->imat` is up to date. */
invert_m4_m4(ob->imat, ob->obmat);
/* Initialize last column of matrix. */
@@ -2669,8 +2670,7 @@ static void calc_brush_local_mat(const Brush *brush, Object *ob, float local_mat
scale_m4_fl(scale, cache->radius);
mul_m4_m4m4(tmat, mat, scale);
- /* Return inverse (for converting from modelspace coords to local
- * area coords). */
+ /* Return inverse (for converting from model-space coords to local area coords). */
invert_m4_m4(local_mat, tmat);
}
@@ -3454,7 +3454,7 @@ static void do_pinch_brush_task_cb_ex(void *__restrict userdata,
float disp_center[3];
float x_disp[3];
float z_disp[3];
- /* Calcualte displacement from the vertex to the brush center. */
+ /* Calculate displacement from the vertex to the brush center. */
sub_v3_v3v3(disp_center, test.location, vd.co);
/* Project the displacement into the X vector (aligned to the stroke). */
@@ -3463,8 +3463,8 @@ static void do_pinch_brush_task_cb_ex(void *__restrict userdata,
/* Project the displacement into the Z vector (aligned to the surface normal). */
mul_v3_v3fl(z_disp, z_object_space, dot_v3v3(disp_center, z_object_space));
- /* Add the two projected vectors to calculate the final displacement. The Y component is
- * removed */
+ /* Add the two projected vectors to calculate the final displacement.
+ * The Y component is removed. */
add_v3_v3v3(disp_center, x_disp, z_disp);
if (brush->falloff_shape == PAINT_FALLOFF_SHAPE_TUBE) {
@@ -3500,7 +3500,7 @@ static void do_pinch_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode
return;
}
- /* Init mat */
+ /* Initialize `mat`. */
cross_v3_v3v3(mat[0], area_no, ss->cache->grab_delta_symmetry);
mat[0][3] = 0.0f;
cross_v3_v3v3(mat[1], area_no, mat[0]);
@@ -3803,7 +3803,7 @@ void SCULPT_calc_brush_plane(
}
/* For flatten center. */
- /* fFlatten center has not been calculated yet if we are not using the area normal. */
+ /* Flatten center has not been calculated yet if we are not using the area normal. */
if (brush->sculpt_plane != SCULPT_DISP_DIR_AREA) {
calc_area_center(sd, ob, nodes, totnode, r_area_co);
}
@@ -4232,9 +4232,9 @@ static void do_layer_brush_task_cb_ex(void *__restrict userdata,
disp_factor = &ss->cache->layer_displacement_factor[vi];
}
- /* When using persistent base, the layer brush Ctrl invert mode resets the height of the
- * layer to 0. This makes possible to clean edges of previously added layers on top of the
- * base. */
+ /* When using persistent base, the layer brush (holding Control) invert mode resets the
+ * height of the layer to 0. This makes possible to clean edges of previously added layers
+ * on top of the base. */
/* The main direction of the layers is inverted using the regular brush strength with the
* brush direction property. */
if (use_persistent_base && ss->cache->invert) {
@@ -4791,7 +4791,7 @@ static void do_clay_strips_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int t
float area_co_displaced[3];
madd_v3_v3v3fl(area_co_displaced, area_co, area_no, -radius * 0.7f);
- /* Init brush local space matrix. */
+ /* Initialize brush local-space matrix. */
cross_v3_v3v3(mat[0], area_no, ss->cache->grab_delta_symmetry);
mat[0][3] = 0.0f;
cross_v3_v3v3(mat[1], area_no, mat[0]);
@@ -5153,7 +5153,7 @@ static void do_clay_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to
mul_v3_fl(temp, displace);
add_v3_v3(area_co, temp);
- /* Init brush local space matrix. */
+ /* Initialize brush local-space matrix. */
cross_v3_v3v3(mat[0], area_no, ss->cache->grab_delta_symmetry);
mat[0][3] = 0.0f;
cross_v3_v3v3(mat[1], area_no, mat[0]);
@@ -5453,7 +5453,7 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSe
if (brush->sculpt_tool == SCULPT_TOOL_DRAW_FACE_SETS &&
SCULPT_stroke_is_first_brush_step(ss->cache) && !ss->cache->alt_smooth) {
- /* Dyntopo does not support Face Sets data, so it can't store/restore it from undo. */
+ /* Dynamic-topology does not support Face Sets data, so it can't store/restore it from undo. */
/* TODO (pablodp606): This check should be done in the undo code and not here, but the rest of
* the sculpt code is not checking for unsupported undo types that may return a null node. */
if (BKE_pbvh_type(ss->pbvh) != PBVH_BMESH) {
@@ -5751,13 +5751,15 @@ static void sculpt_combine_proxies(Sculpt *sd, Object *ob)
MEM_SAFE_FREE(nodes);
}
-/*Copy the modified vertices from bvh to the active key. */
+/**
+ * Copy the modified vertices from the #PBVH to the active key.
+ */
static void sculpt_update_keyblock(Object *ob)
{
SculptSession *ss = ob->sculpt;
float(*vertCos)[3];
- /* Keyblock update happens after handling deformation caused by modifiers,
+ /* Key-block update happens after handling deformation caused by modifiers,
* so ss->orig_cos would be updated with new stroke. */
if (ss->orig_cos) {
vertCos = ss->orig_cos;
@@ -5844,7 +5846,7 @@ void SCULPT_flush_stroke_deform(Sculpt *sd, Object *ob, bool is_proxy_used)
/* Modifiers could depend on mesh normals, so we should update them.
* Note, then if sculpting happens on locked key, normals should be re-calculate after applying
- * coords from keyblock on base mesh. */
+ * coords from key-block on base mesh. */
BKE_mesh_calc_normals(me);
}
else if (ss->shapekey_active) {
@@ -5852,8 +5854,10 @@ void SCULPT_flush_stroke_deform(Sculpt *sd, Object *ob, bool is_proxy_used)
}
}
-/* Flip all the editdata across the axis/axes specified by symm. Used to
- * calculate multiple modifications to the mesh when symmetry is enabled. */
+/**
+ * Flip all the edit-data across the axis/axes specified by \a symm.
+ * Used to calculate multiple modifications to the mesh when symmetry is enabled.
+ */
void SCULPT_cache_calc_brushdata_symm(StrokeCache *cache,
const char symm,
const char axis,
@@ -8466,13 +8470,15 @@ void SCULPT_fake_neighbors_free(Object *ob)
sculpt_pose_fake_neighbors_free(ss);
}
-/* sculpt_mask_by_color_delta_get returns values in the (0,1) range that are used to generate the
- * mask based on the diference between two colors (the active color and the color of any other
+/**
+ * #sculpt_mask_by_color_delta_get returns values in the (0,1) range that are used to generate the
+ * mask based on the difference between two colors (the active color and the color of any other
* vertex). Ideally, a threshold of 0 should mask only the colors that are equal to the active
* color and threshold of 1 should mask all colors. In order to avoid artifacts and produce softer
* falloffs in the mask, the MASK_BY_COLOR_SLOPE defines the size of the transition values between
* masked and unmasked vertices. The smaller this value is, the sharper the generated mask is going
- * to be. */
+ * to be.
+ */
#define MASK_BY_COLOR_SLOPE 0.25f
static float sculpt_mask_by_color_delta_get(const float *color_a,
diff --git a/source/blender/editors/space_clip/tracking_ops_detect.c b/source/blender/editors/space_clip/tracking_ops_detect.c
index dd620e85324..54ec439471d 100644
--- a/source/blender/editors/space_clip/tracking_ops_detect.c
+++ b/source/blender/editors/space_clip/tracking_ops_detect.c
@@ -117,13 +117,13 @@ void CLIP_OT_detect_features(wmOperatorType *ot)
{1,
"INSIDE_GPENCIL",
0,
- "Inside Grease Pencil",
- "Place markers only inside areas outlined with Grease Pencil"},
+ "Inside Annotated Area",
+ "Place markers only inside areas outlined with the Annotation tool"},
{2,
"OUTSIDE_GPENCIL",
0,
- "Outside Grease Pencil",
- "Place markers only outside areas outlined with Grease Pencil"},
+ "Outside Annotated Area",
+ "Place markers only outside areas outlined with the Annotation tool"},
{0, NULL, 0, NULL, NULL},
};
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 6ea1d74112d..6f5f1294167 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -3171,9 +3171,9 @@ static void outliner_draw_tree_element(bContext *C,
*starty -= UI_UNIT_Y;
LISTBASE_FOREACH (TreeElement *, ten, &te->subtree) {
- /* check if element needs to be drawn grayed out, but also gray out
- * childs of a grayed out parent (pass on draw_grayed_out to childs) */
- bool draw_childs_grayed_out = draw_grayed_out || (ten->flag & TE_DRAGGING);
+ /* Check if element needs to be drawn grayed out, but also gray out
+ * children of a grayed out parent (pass on draw_grayed_out to children). */
+ bool draw_children_grayed_out = draw_grayed_out || (ten->flag & TE_DRAGGING);
outliner_draw_tree_element(C,
block,
fstyle,
@@ -3181,7 +3181,7 @@ static void outliner_draw_tree_element(bContext *C,
region,
soops,
ten,
- draw_childs_grayed_out,
+ draw_children_grayed_out,
startx + UI_UNIT_X,
starty,
restrict_column_width,
@@ -3228,10 +3228,10 @@ static void outliner_draw_hierarchy_lines_recursive(uint pos,
/* For vertical lines between objects. */
y1 = y2 = y1_dashed = y2_dashed = *starty;
for (te = lb->first; te; te = te->next) {
- bool draw_childs_grayed_out = draw_grayed_out || (te->flag & TE_DRAGGING);
+ bool draw_children_grayed_out = draw_grayed_out || (te->flag & TE_DRAGGING);
TreeStoreElem *tselem = TREESTORE(te);
- if (draw_childs_grayed_out) {
+ if (draw_children_grayed_out) {
immUniformColor3ubvAlpha(col, grayed_alpha);
}
else {
@@ -3268,7 +3268,7 @@ static void outliner_draw_hierarchy_lines_recursive(uint pos,
if (TSELEM_OPEN(tselem, soops)) {
outliner_draw_hierarchy_lines_recursive(
- pos, soops, &te->subtree, startx + UI_UNIT_X, col, draw_childs_grayed_out, starty);
+ pos, soops, &te->subtree, startx + UI_UNIT_X, col, draw_children_grayed_out, starty);
}
}
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index b590eb75407..b6fff3a1022 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -50,11 +50,11 @@ typedef enum TreeElementInsertType {
} TreeElementInsertType;
typedef enum TreeTraversalAction {
- /* Continue traversal regularly, don't skip children. */
+ /** Continue traversal regularly, don't skip children. */
TRAVERSE_CONTINUE = 0,
- /* Stop traversal */
+ /** Stop traversal. */
TRAVERSE_BREAK,
- /* Continue traversal, but skip childs of traversed element */
+ /** Continue traversal, but skip children of traversed element. */
TRAVERSE_SKIP_CHILDS,
} TreeTraversalAction;
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
index 2105eb0304c..c99ca64325c 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
@@ -97,54 +97,19 @@ static void update_mirror_object(Object *ob,
bGPDstroke *gps,
int axis)
{
- /* Calculate local matrix transformation. */
- float mat[3][3], inv_mat[3][3];
- BKE_object_to_mat3(ob, mat);
- invert_m3_m3(inv_mat, mat);
-
- int i;
- bGPDspoint *pt;
- float factor[3] = {1.0f, 1.0f, 1.0f};
- factor[axis] = -1.0f;
-
- float clear[3] = {0.0f, 0.0f, 0.0f};
- clear[axis] = 1.0f;
-
- float ob_origin[3];
- float pt_origin[3];
- float half_origin[3];
- float rot_mat[3][3];
-
- float eul[3];
- mat4_to_eul(eul, mmd->object->obmat);
- mul_v3_fl(eul, 2.0f);
- /* Don't apply rotation to current axis. */
- eul[axis] = 0.0f;
- eul_to_mat3(rot_mat, eul);
- sub_v3_v3v3(ob_origin, ob->obmat[3], mmd->object->obmat[3]);
-
- /* Only works with current axis. */
- mul_v3_v3(ob_origin, clear);
-
- /* Invert the origin. */
- mul_v3_v3fl(pt_origin, ob_origin, -2.0f);
- mul_v3_v3fl(half_origin, pt_origin, 0.5f);
-
- for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
- /* Apply any local transformation. */
- mul_m3_v3(mat, &pt->x);
-
- /* Apply mirror effect. */
- mul_v3_v3(&pt->x, factor);
- /* Apply location. */
- add_v3_v3(&pt->x, pt_origin);
- /* Apply rotation (around new center). */
- sub_v3_v3(&pt->x, half_origin);
- mul_m3_v3(rot_mat, &pt->x);
- add_v3_v3(&pt->x, half_origin);
-
- /* Undo local transformation to avoid double transform in drawing. */
- mul_m3_v3(inv_mat, &pt->x);
+ float mtx[4][4];
+ unit_m4(mtx);
+ mtx[axis][axis] = -1.0f;
+
+ float tmp[4][4];
+ float itmp[4][4];
+ invert_m4_m4(tmp, mmd->object->obmat);
+ mul_m4_m4m4(tmp, tmp, ob->obmat);
+ invert_m4_m4(itmp, tmp);
+ mul_m4_series(mtx, itmp, mtx, tmp);
+
+ for (int i = 0; i < gps->totpoints; i++) {
+ mul_m4_v3(mtx, &gps->points[i].x);
}
}
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 6d220454364..182296c0ba2 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -360,7 +360,7 @@ static int add_type(const char *str, int size)
}
else if (strchr(str, '*')) {
/* note: this is valid C syntax but we can't parse, complain!
- * 'struct SomeStruct* somevar;' <-- correct but we cant handle right now. */
+ * `struct SomeStruct* some_var;` <-- correct but we cant handle right now. */
return -1;
}
diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c
index 79ee9619e36..31a71a80bbc 100644
--- a/source/blender/makesrna/intern/rna_camera.c
+++ b/source/blender/makesrna/intern/rna_camera.c
@@ -264,7 +264,7 @@ static void rna_def_camera_background_image(BlenderRNA *brna)
prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "alpha");
RNA_def_property_ui_text(
- prop, "Alpha", "Image opacity to blend the image against the background color");
+ prop, "Opacity", "Image opacity to blend the image against the background color");
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index af300f6e088..d9dd35c4280 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -1228,17 +1228,17 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna)
prop = RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_X);
- RNA_def_property_ui_text(prop, "Lock X Rot", "Constraint rotation along X axis");
+ RNA_def_property_ui_text(prop, "Lock X Rotation", "Constraint rotation along X axis");
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
prop = RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_Y);
- RNA_def_property_ui_text(prop, "Lock Y Rot", "Constraint rotation along Y axis");
+ RNA_def_property_ui_text(prop, "Lock Y Rotation", "Constraint rotation along Y axis");
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
prop = RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_Z);
- RNA_def_property_ui_text(prop, "Lock Z Rot", "Constraint rotation along Z axis");
+ RNA_def_property_ui_text(prop, "Lock Z Rotation", "Constraint rotation along Z axis");
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
prop = RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE);
@@ -2063,8 +2063,8 @@ static void rna_def_constraint_transform(BlenderRNA *brna)
PropertyRNA *prop;
static const EnumPropertyItem transform_items[] = {
- {TRANS_LOCATION, "LOCATION", 0, "Loc", ""},
- {TRANS_ROTATION, "ROTATION", 0, "Rot", ""},
+ {TRANS_LOCATION, "LOCATION", 0, "Location", ""},
+ {TRANS_ROTATION, "ROTATION", 0, "Rotation", ""},
{TRANS_SCALE, "SCALE", 0, "Scale", ""},
{0, NULL, 0, NULL, NULL},
};
@@ -3036,32 +3036,32 @@ static void rna_def_constraint_pivot(BlenderRNA *brna)
{PIVOTCON_AXIS_X_NEG,
"NX",
0,
- "-X Rot",
+ "-X Rotation",
"Use the pivot point in the negative rotation range around the X-axis"},
{PIVOTCON_AXIS_Y_NEG,
"NY",
0,
- "-Y Rot",
+ "-Y Rotation",
"Use the pivot point in the negative rotation range around the Y-axis"},
{PIVOTCON_AXIS_Z_NEG,
"NZ",
0,
- "-Z Rot",
+ "-Z Rotation",
"Use the pivot point in the negative rotation range around the Z-axis"},
{PIVOTCON_AXIS_X,
"X",
0,
- "X Rot",
+ "X Rotation",
"Use the pivot point in the positive rotation range around the X-axis"},
{PIVOTCON_AXIS_Y,
"Y",
0,
- "Y Rot",
+ "Y Rotation",
"Use the pivot point in the positive rotation range around the Y-axis"},
{PIVOTCON_AXIS_Z,
"Z",
0,
- "Z Rot",
+ "Z Rotation",
"Use the pivot point in the positive rotation range around the Z-axis"},
{0, NULL, 0, NULL, NULL},
};
diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c
index f0de7317913..e0005766c48 100644
--- a/source/blender/makesrna/intern/rna_key.c
+++ b/source/blender/makesrna/intern/rna_key.c
@@ -708,9 +708,8 @@ static KeyBlock *rna_ShapeKeyData_find_keyblock(Key *key, float *point)
return NULL;
}
- /* we'll need to manually search through the keyblocks and check
- * if the point is somewhere in the middle of each block's data
- */
+ /* We'll need to manually search through the key-blocks and check
+ * if the point is somewhere in the middle of each block's data. */
for (kb = key->block.first; kb; kb = kb->next) {
if (kb->data) {
float *start = (float *)kb->data;
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 88bc9843bc0..14d84ddb9c8 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -2957,7 +2957,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "tangent_phase", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "tanphase");
RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Rot", "Rotate the surface tangent");
+ RNA_def_property_ui_text(prop, "Rotation", "Rotate the surface tangent");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "reactor_factor", PROP_FLOAT, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index 507d06482df..54fe2e4b513 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -834,22 +834,22 @@ static const EnumPropertyItem tracker_motion_model[] = {
{TRACK_MOTION_MODEL_TRANSLATION_ROTATION_SCALE,
"LocRotScale",
0,
- "LocRotScale",
+ "Location, Rotation & Scale",
"Search for markers that are translated, rotated, and scaled between frames"},
{TRACK_MOTION_MODEL_TRANSLATION_SCALE,
"LocScale",
0,
- "LocScale",
+ "Location & Scale",
"Search for markers that are translated and scaled between frames"},
{TRACK_MOTION_MODEL_TRANSLATION_ROTATION,
"LocRot",
0,
- "LocRot",
+ "Location & Rotation",
"Search for markers that are translated and rotated between frames"},
{TRACK_MOTION_MODEL_TRANSLATION,
"Loc",
0,
- "Loc",
+ "Location",
"Search for markers that are translated between frames"},
{0, NULL, 0, NULL, NULL},
};
@@ -1036,7 +1036,6 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
/* default_tracking_motion_model */
prop = RNA_def_property(srna, "default_motion_model", PROP_ENUM, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_enum_items(prop, tracker_motion_model);
RNA_def_property_ui_text(prop, "Motion Model", "Default motion model to use for tracking");
@@ -1070,7 +1069,6 @@ static void rna_def_trackingSettings(BlenderRNA *brna)
/* default minimal correlation */
prop = RNA_def_property(srna, "default_correlation_min", PROP_FLOAT, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_float_sdna(prop, NULL, "default_minimum_correlation");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.05, 3);
@@ -1203,7 +1201,6 @@ static void rna_def_trackingCamera(BlenderRNA *brna)
prop = RNA_def_property(srna, "units", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "units");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_enum_items(prop, camera_units_items);
RNA_def_property_ui_text(prop, "Units", "Units used for camera focal length");